mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
fix looting bug
This commit is contained in:
@@ -6,6 +6,11 @@
|
|||||||
|
|
||||||
bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn)
|
bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn)
|
||||||
{
|
{
|
||||||
|
if (!Pawn)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
this->ForceNetUpdate();
|
||||||
|
|
||||||
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
|
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
|
||||||
FVector LocationToSpawnLoot = this->GetActorLocation() + this->GetActorRightVector() * 70.f + this->GetActorUpVector() * 50.f;
|
FVector LocationToSpawnLoot = this->GetActorLocation() + this->GetActorRightVector() * 70.f + this->GetActorUpVector() * 50.f;
|
||||||
|
|
||||||
@@ -36,5 +41,11 @@ bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn)
|
|||||||
auto NewPickup = AFortPickup::SpawnPickup(CreateData);
|
auto NewPickup = AFortPickup::SpawnPickup(CreateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this->IsDestroyed())
|
||||||
|
{
|
||||||
|
this->ForceNetUpdate();
|
||||||
|
// a buncha other stuff
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -45,6 +45,12 @@ public:
|
|||||||
return Get<float>(LootNoiseRangeOffset);
|
return Get<float>(LootNoiseRangeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BounceContainer()
|
||||||
|
{
|
||||||
|
static auto BounceContainerFn = FindObject<UFunction>("/Script/FortniteGame.BuildingContainer.BounceContainer");
|
||||||
|
this->ProcessEvent(BounceContainerFn);
|
||||||
|
}
|
||||||
|
|
||||||
bool SpawnLoot(AFortPawn* Pawn);
|
bool SpawnLoot(AFortPawn* Pawn);
|
||||||
|
|
||||||
static UClass* StaticClass()
|
static UClass* StaticClass()
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
|
|||||||
|
|
||||||
if (Fortnite_Season == 6)
|
if (Fortnite_Season == 6)
|
||||||
{
|
{
|
||||||
if (Fortnite_Version != 6.10)
|
if (Fortnite_Version > 6.10)
|
||||||
{
|
{
|
||||||
auto Lake = FindObject<AActor>(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake1");
|
auto Lake = FindObject<AActor>(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake1");
|
||||||
auto Lake2 = FindObject<AActor>(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake2");
|
auto Lake2 = FindObject<AActor>(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake2");
|
||||||
|
|||||||
@@ -49,12 +49,17 @@ void CollectDataTablesRows(const std::vector<UDataTable*>& DataTables, LOOTING_M
|
|||||||
|
|
||||||
for (auto CurrentDataTable : DataTablesToIterate)
|
for (auto CurrentDataTable : DataTablesToIterate)
|
||||||
{
|
{
|
||||||
for (auto& CurrentPair : CurrentDataTable->GetRowMap())
|
for (TPair<FName, uint8_t*>& CurrentPair : CurrentDataTable->GetRowMap())
|
||||||
{
|
{
|
||||||
if (Check(CurrentPair.Key(), (RowStructType*)CurrentPair.Value()))
|
if (Check(CurrentPair.Key(), (RowStructType*)CurrentPair.Value()))
|
||||||
{
|
{
|
||||||
// LOG_INFO(LogDev, "row: {} comp {} num: {} passed check!", CurrentPair.Key().ToString(), CurrentPair.Key().ComparisonIndex.Value, CurrentPair.Key().Number);
|
// LOG_INFO(LogDev, "Setting key with {} comp {} num: {} then iterating through map!", CurrentPair.Key().ToString(), CurrentPair.Key().ComparisonIndex.Value, CurrentPair.Key().Number);
|
||||||
(*OutMap)[CurrentPair.Key()] = (RowStructType*)CurrentPair.Value();
|
(*OutMap)[CurrentPair.Key()] = (RowStructType*)CurrentPair.Value();
|
||||||
|
|
||||||
|
/* for (auto PairInOutMap : *OutMap)
|
||||||
|
{
|
||||||
|
// LOG_INFO(LogDev, "Current Row Key {} comp {} num: {}!", PairInOutMap.first.ToString(), PairInOutMap.first.ComparisonIndex.Value, PairInOutMap.first.Number);
|
||||||
|
} */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,13 +445,16 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
|
|||||||
|
|
||||||
// LOG_INFO(LogInteraction, "bAlreadySearchedFieldMask: {}", bAlreadySearchedFieldMask);
|
// LOG_INFO(LogInteraction, "bAlreadySearchedFieldMask: {}", bAlreadySearchedFieldMask);
|
||||||
|
|
||||||
|
BuildingContainer->SpawnLoot(PlayerController->GetMyFortPawn());
|
||||||
|
|
||||||
BuildingContainer->SetBitfieldValue(bAlreadySearchedOffset, bAlreadySearchedFieldMask, true);
|
BuildingContainer->SetBitfieldValue(bAlreadySearchedOffset, bAlreadySearchedFieldMask, true);
|
||||||
(*(int*)(__int64(SearchBounceData) + SearchAnimationCountOffset))++;
|
(*(int*)(__int64(SearchBounceData) + SearchAnimationCountOffset))++;
|
||||||
|
BuildingContainer->BounceContainer();
|
||||||
|
|
||||||
|
BuildingContainer->ForceNetUpdate(); // ?
|
||||||
|
|
||||||
static auto OnRep_bAlreadySearchedFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingContainer.OnRep_bAlreadySearched");
|
static auto OnRep_bAlreadySearchedFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingContainer.OnRep_bAlreadySearched");
|
||||||
BuildingContainer->ProcessEvent(OnRep_bAlreadySearchedFn);
|
// BuildingContainer->ProcessEvent(OnRep_bAlreadySearchedFn);
|
||||||
|
|
||||||
BuildingContainer->SpawnLoot(PlayerController->GetMyFortPawn());
|
|
||||||
|
|
||||||
// if (BuildingContainer->ShouldDestroyOnSearch())
|
// if (BuildingContainer->ShouldDestroyOnSearch())
|
||||||
// BuildingContainer->K2_DestroyActor();
|
// BuildingContainer->K2_DestroyActor();
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "inc.h"
|
#include "inc.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
struct FNameEntryId
|
struct FNameEntryId
|
||||||
{
|
{
|
||||||
uint32 Value;
|
uint32 Value; // well depends on version if its int32 or uint32 i think
|
||||||
|
|
||||||
FNameEntryId() : Value(0) {}
|
FNameEntryId() : Value(0) {}
|
||||||
|
|
||||||
@@ -59,17 +60,20 @@ struct FName
|
|||||||
return Compare(Other) < 0;
|
return Compare(Other) < 0;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
FORCEINLINE bool operator<(const FName& Other) const
|
FORCEINLINE bool operator<(const FName& Rhs) const
|
||||||
{
|
{
|
||||||
return GetComparisonIndexFast() < Other.GetComparisonIndexFast();
|
auto res = this->ComparisonIndex == Rhs.ComparisonIndex ? /* (Number - Rhs.Number) < 0 */ Number < Rhs.Number : this->ComparisonIndex < Rhs.ComparisonIndex;
|
||||||
|
// LOG_INFO(LogDev, "LHS ({} {}) RHS ({} {}) RESULT {}", this->ComparisonIndex.Value, this->Number, Rhs.ComparisonIndex.Value, Rhs.Number, res);
|
||||||
|
return res;
|
||||||
|
// return GetComparisonIndexFast() < Rhs.GetComparisonIndexFast() || (GetComparisonIndexFast() == Rhs.GetComparisonIndexFast() && GetNumber() < Rhs.GetNumber());
|
||||||
|
|
||||||
// (Milxnor) BRO IDK
|
// (Milxnor) BRO IDK
|
||||||
|
|
||||||
if (GetComparisonIndexFast() == Other.GetComparisonIndexFast())
|
if (GetComparisonIndexFast() == Rhs.GetComparisonIndexFast())
|
||||||
{
|
{
|
||||||
return GetNumber() - Other.GetNumber();
|
return (GetNumber() - Rhs.GetNumber()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetComparisonIndexFast() < Other.GetComparisonIndexFast();
|
return GetComparisonIndexFast() < Rhs.GetComparisonIndexFast();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -63,7 +63,7 @@ int32 FName::Compare(const FName& Other) const
|
|||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return GetComparisonIndexFast() < Other.GetComparisonIndexFast();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FName::ToString()
|
std::string FName::ToString()
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
|
|||||||
auto Message = Msg.ToString();
|
auto Message = Msg.ToString();
|
||||||
|
|
||||||
size_t start = Message.find('\\');
|
size_t start = Message.find('\\');
|
||||||
|
|
||||||
while (start != std::string::npos) // remove the playername
|
while (start != std::string::npos) // remove the playername
|
||||||
{
|
{
|
||||||
size_t end = Message.find('\\', start + 1);
|
size_t end = Message.find('\\', start + 1);
|
||||||
@@ -133,7 +134,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
|
|||||||
|
|
||||||
// std::cout << "Message Before: " << Message << '\n';
|
// std::cout << "Message Before: " << Message << '\n';
|
||||||
|
|
||||||
while (Message.find(" ") != -1)
|
while (Message.find(" ") != std::string::npos)
|
||||||
{
|
{
|
||||||
auto arg = Message.substr(0, Message.find(' '));
|
auto arg = Message.substr(0, Message.find(' '));
|
||||||
Arguments.push_back(arg);
|
Arguments.push_back(arg);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ static inline void FillItemCollector(ABuildingItemCollectorActor* ItemCollector,
|
|||||||
if (LootDrops.size() == 0)
|
if (LootDrops.size() == 0)
|
||||||
{
|
{
|
||||||
// LOG_WARN(LogGame, "Failed to find LootDrops for vending machine loot tier: {}", LootTier);
|
// LOG_WARN(LogGame, "Failed to find LootDrops for vending machine loot tier: {}", LootTier);
|
||||||
// ItemCollectorIt--; // retry (?)
|
ItemCollectorIt--; // retry (?)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ static inline void FillVendingMachines()
|
|||||||
|
|
||||||
for (int i = 0; i < ThingAndWeights.size(); i++)
|
for (int i = 0; i < ThingAndWeights.size(); i++)
|
||||||
{
|
{
|
||||||
LOG_INFO(LogDev, "[{}] bruh: {}", i, ThingAndWeights.at(i));
|
// LOG_INFO(LogDev, "[{}] bruh: {}", i, ThingAndWeights.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<int, int> PickedRarities;
|
std::map<int, int> PickedRarities;
|
||||||
|
|||||||
Reference in New Issue
Block a user