squad comms

squad comms, ltms now work less (this will return better in a later update), performance, fixed some versions, fixed vulnerabilities
This commit is contained in:
Milxnor
2023-06-15 22:04:53 -04:00
parent ed0c9005e6
commit 4482192a2b
46 changed files with 444 additions and 427 deletions

View File

@@ -17,7 +17,7 @@ void LoopSpecs(UAbilitySystemComponent* AbilitySystemComponent, std::function<vo
if (ActivatableAbilities && Items)
{
for (int i = 0; i < Items->Num(); i++)
for (int i = 0; i < Items->Num(); ++i)
{
auto CurrentSpec = Items->AtPtr(i, SpecSize); // (FGameplayAbilitySpec*)(__int64(Items->Data) + (static_cast<long long>(SpecSize) * i));
func(CurrentSpec);
@@ -112,7 +112,7 @@ bool UAbilitySystemComponent::HasAbility(UObject* DefaultAbility)
auto& Items = ActivatableAbilities->GetItems();
for (int i = 0; i < Items.Num(); i++)
for (int i = 0; i < Items.Num(); ++i)
{
auto Spec = Items.AtPtr(i, FGameplayAbilitySpec::GetStructSize());

View File

@@ -38,6 +38,15 @@ FTransform AActor::GetTransform()
return Ret;
}
/*
UWorld* AActor::GetWorld()
{
return GetWorld(); // for real
}
*/
void AActor::SetNetDormancy(ENetDormancy Dormancy)
{
static auto SetNetDormancyFn = FindObject<UFunction>(L"/Script/Engine.Actor.SetNetDormancy");
@@ -220,8 +229,8 @@ void AActor::GetActorEyesViewPoint(FVector* OutLocation, FRotator* OutRotation)
static auto GetActorEyesViewPointFn = FindObject<UFunction>(L"/Script/Engine.Actor.GetActorEyesViewPoint");
struct
{
struct FVector OutLocation; // (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
struct FRotator OutRotation; // (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic)
FVector OutLocation; // (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
FRotator OutRotation; // (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic)
} AActor_GetActorEyesViewPoint_Params{};
this->ProcessEvent(GetActorEyesViewPointFn, &AActor_GetActorEyesViewPoint_Params);
@@ -237,7 +246,7 @@ AActor* AActor::GetClosestActor(UClass* ActorClass, float DistMax, std::function
TArray<AActor*> AllActors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ActorClass);
auto ActorLocation = GetActorLocation();
for (int i = 0; i < AllActors.Num(); i++)
for (int i = 0; i < AllActors.Num(); ++i)
{
auto Actor = AllActors.at(i);

View File

@@ -19,6 +19,7 @@ class AActor : public UObject
public:
struct FTransform GetTransform();
// class UWorld* GetWorld();
bool HasAuthority();
bool IsTearOff();
/* FORCEINLINE */ ENetDormancy& GetNetDormancy();

View File

@@ -350,7 +350,7 @@ public:
{
if (!IsBadReadPtr(Data, 8) && ArrayNum > 0 && sizeof(InElementType) > 0)
{
for (int i = 0; i < ArrayNum; i++)
for (int i = 0; i < ArrayNum; ++i)
{
auto current = AtPtr(i, Size);

View File

@@ -87,7 +87,7 @@ void UAthenaMarkerComponent::ServerAddMapMarkerHook(UAthenaMarkerComponent* Mark
static auto TeamMembersOffset = PlayerTeam->GetOffset("TeamMembers");
auto& TeamMembers = PlayerTeam->Get<TArray<AController*>>(TeamMembersOffset);
for (int i = 0; i < TeamMembers.Num(); i++)
for (int i = 0; i < TeamMembers.Num(); ++i)
{
if (TeamMembers.at(i) == PlayerController)
continue;
@@ -155,7 +155,7 @@ void UAthenaMarkerComponent::ServerRemoveMapMarkerHook(UAthenaMarkerComponent* M
static auto TeamMembersOffset = PlayerTeam->GetOffset("TeamMembers");
auto& TeamMembers = PlayerTeam->Get<TArray<AController*>>(TeamMembersOffset);
for (int i = 0; i < TeamMembers.Num(); i++)
for (int i = 0; i < TeamMembers.Num(); ++i)
{
if (TeamMembers.at(i) == PlayerController)
continue;

View File

@@ -9,7 +9,7 @@
static inline void SpawnBGAs() // hahah not "proper", there's a function that we can hook and it gets called on each spawner whenever playlist gets set, but it's fine.
{
static auto BGAConsumableSpawnerClass = FindObject<UClass>("/Script/FortniteGame.BGAConsumableSpawner");
static auto BGAConsumableSpawnerClass = FindObject<UClass>(L"/Script/FortniteGame.BGAConsumableSpawner");
if (!BGAConsumableSpawnerClass)
return;
@@ -20,7 +20,7 @@ static inline void SpawnBGAs() // hahah not "proper", there's a function that we
LOG_INFO(LogDev, "AllBGAConsumableSpawners.Num(): {}", (int)AllBGAConsumableSpawners.Num());
for (int i = 0; i < AllBGAConsumableSpawners.Num(); i++)
for (int i = 0; i < AllBGAConsumableSpawners.Num(); ++i)
{
auto BGAConsumableSpawner = AllBGAConsumableSpawners.at(i);
auto SpawnLocation = BGAConsumableSpawner->GetActorLocation();

View File

@@ -321,7 +321,7 @@ public:
}
FORCEINLINE void ZeroAll()
{
for (int i = 0; i < MaxBits; i++)
for (int i = 0; i < MaxBits; ++i)
{
Set(i, false, true);
}

View File

@@ -26,10 +26,8 @@ bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn)
// LOG_INFO(LogInteraction, "LootDrops.size(): {}", LootDrops.size());
for (int i = 0; i < LootDrops.size(); i++)
for (auto& lootDrop : LootDrops)
{
auto& lootDrop = LootDrops.at(i);
PickupCreateData CreateData;
CreateData.bToss = true;
// CreateData.PawnOwner = Pawn;

View File

@@ -26,10 +26,5 @@ void ABuildingFoundation::SetDynamicFoundationEnabledHook(UObject* Context, FFra
ShowFoundation(BuildingFoundation, bEnabled);
// idk lol
BuildingFoundation->ForceNetUpdate();
BuildingFoundation->FlushNetDormancy();
return SetDynamicFoundationEnabledOriginal(Context, Stack, Ret);
}

View File

@@ -42,7 +42,7 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
{
auto& SquadArray = TeamArrayContainer->SquadsArray.at(SpawnMachine->GetSquadId());
for (int i = 0; i < SquadArray.Num(); i++)
for (int i = 0; i < SquadArray.Num(); ++i)
{
auto StrongPlayerState = SquadArray.at(i).Get();

View File

@@ -59,7 +59,7 @@ public:
{
auto Names = (TArray<TPair<FName, __int64>>*)(__int64(this) + sizeof(UField) + sizeof(FString));
for (int i = 0; i < Names->Num(); i++)
for (int i = 0; i < Names->Num(); ++i)
{
auto& Pair = Names->At(i);
auto& Name = Pair.Key();

View File

@@ -858,44 +858,6 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
if (Ret)
{
LOG_INFO(LogDev, "Athena_ReadyToStartMatchOriginal RET!"); // if u dont see this, not good
// We are assuming it successfully became warmup.
std::vector<std::pair<AFortAthenaMutator*, UFunction*>> FunctionsToCall;
LoopMutators([&](AFortAthenaMutator* Mutator) { LOG_INFO(LogGame, "Mutator {}", Mutator->GetPathName()); });
LoopMutators([&](AFortAthenaMutator* Mutator) { FunctionsToCall.push_back(std::make_pair(Mutator, Mutator->FindFunction("OnGamePhaseStepChanged"))); });
static int LastNum1 = 3125;
if (LastNum1 != Globals::AmountOfListens)
{
LastNum1 = Globals::AmountOfListens;
for (auto& FunctionToCallPair : FunctionsToCall)
{
// On newer versions there is a second param.
// LOG_INFO(LogDev, "FunctionToCallPair.second: {}", __int64(FunctionToCallPair.second));
if (FunctionToCallPair.second)
{
if (Fortnite_Version < 10)
{
// mem leak btw
auto a = ConstructOnGamePhaseStepChangedParams(EAthenaGamePhaseStep::None);
if (a)
{
FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, a);
FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, ConstructOnGamePhaseStepChangedParams(EAthenaGamePhaseStep::Setup));
FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, ConstructOnGamePhaseStepChangedParams(EAthenaGamePhaseStep::Warmup));
}
}
}
}
}
}
return Ret;
@@ -1185,7 +1147,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
uint8 SpawnFlag = EFortPickupSourceTypeFlag::GetContainerValue();
bool bTest = false;
bool bPrintWarmup = false;
bool bPrintWarmup = bDebugPrintFloorLoot;
for (int i = 0; i < SpawnIsland_FloorLoot_Actors.Num(); i++)
{
@@ -1211,7 +1173,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
CurrentActor->K2_DestroyActor();
}
bool bPrint = false;
bool bPrintIsland = bDebugPrintFloorLoot;
int spawned = 0;
@@ -1222,7 +1184,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
auto Location = CurrentActor->GetActorLocation() + CurrentActor->GetActorForwardVector() * CurrentActor->GetLootSpawnLocation_Athena().X + CurrentActor->GetActorRightVector() * CurrentActor->GetLootSpawnLocation_Athena().Y + CurrentActor->GetActorUpVector() * CurrentActor->GetLootSpawnLocation_Athena().Z;
std::vector<LootDrop> LootDrops = PickLootDrops(BRIslandTierGroup, GameState->GetWorldLevel(), -1, bPrint);
std::vector<LootDrop> LootDrops = PickLootDrops(BRIslandTierGroup, GameState->GetWorldLevel(), -1, bPrintIsland);
for (auto& LootDrop : LootDrops)
{

View File

@@ -47,16 +47,11 @@ static void SetFoundationTransform(AActor* BuildingFoundation, const FTransform&
{
static auto DynamicFoundationRepDataOffset = BuildingFoundation->GetOffset("DynamicFoundationRepData", false);
static auto Enabled = 1;
static auto Disabled = 2;
static auto DynamicFoundationTransformOffset = BuildingFoundation->GetOffset("DynamicFoundationTransform", false);
if (DynamicFoundationTransformOffset != -1) // needed check?
{
auto DynamicFoundationTransform = BuildingFoundation->GetPtr<FTransform>(DynamicFoundationTransformOffset);
*DynamicFoundationTransform = Transform;
*BuildingFoundation->GetPtr<FTransform>(DynamicFoundationTransformOffset) = Transform;
}
if (DynamicFoundationRepDataOffset != -1)
@@ -70,11 +65,15 @@ static void SetFoundationTransform(AActor* BuildingFoundation, const FTransform&
{
auto DynamicFoundationTransform = BuildingFoundation->GetPtr<FTransform>(DynamicFoundationTransformOffset);
*(FRotator*)(__int64(DynamicFoundationRepData) + RotationOffset) = DynamicFoundationTransform->Rotation.Rotator();
if (Fortnite_Version >= 13)
*(FRotator*)(__int64(DynamicFoundationRepData) + RotationOffset) = DynamicFoundationTransform->Rotation.Rotator();
else
*(FQuat*)(__int64(DynamicFoundationRepData) + RotationOffset) = DynamicFoundationTransform->Rotation;
*(FVector*)(__int64(DynamicFoundationRepData) + TranslationOffset) = DynamicFoundationTransform->Translation;
}
static auto OnRep_DynamicFoundationRepDataFn = FindObject<UFunction>("/Script/FortniteGame.BuildingFoundation.OnRep_DynamicFoundationRepData");
static auto OnRep_DynamicFoundationRepDataFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.OnRep_DynamicFoundationRepData");
BuildingFoundation->ProcessEvent(OnRep_DynamicFoundationRepDataFn);
}
}
@@ -136,32 +135,16 @@ static void ShowFoundation(AActor* BuildingFoundation, bool bShow = true)
static auto OnRep_ServerStreamedInLevelFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.OnRep_ServerStreamedInLevel");
BuildingFoundation->ProcessEvent(OnRep_ServerStreamedInLevelFn);
static auto DynamicFoundationRepDataOffset = BuildingFoundation->GetOffset("DynamicFoundationRepData", false);
static auto Enabled = 1;
static auto Disabled = 2;
if (DynamicFoundationRepDataOffset != -1)
{
auto DynamicFoundationRepData = BuildingFoundation->GetPtr<void>(DynamicFoundationRepDataOffset);
static auto RotationOffset = FindOffsetStruct("/Script/FortniteGame.DynamicBuildingFoundationRepData", "Rotation");
static auto TranslationOffset = FindOffsetStruct("/Script/FortniteGame.DynamicBuildingFoundationRepData", "Translation");
static auto EnabledStateOffset = FindOffsetStruct("/Script/FortniteGame.DynamicBuildingFoundationRepData", "EnabledState");
*(uint8_t*)(__int64(DynamicFoundationRepData) + EnabledStateOffset) = bShow ? Enabled : Disabled;
static auto OnRep_DynamicFoundationRepDataFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.OnRep_DynamicFoundationRepData");
BuildingFoundation->ProcessEvent(OnRep_DynamicFoundationRepDataFn);
}
static auto FoundationEnabledStateOffset = BuildingFoundation->GetOffset("FoundationEnabledState", false);
LOG_INFO(LogDev, "BuildingFoundation->Get<uint8_t>(FoundationEnabledStateOffset) Prev: {}", (int)BuildingFoundation->Get<uint8_t>(FoundationEnabledStateOffset));
if (FoundationEnabledStateOffset != -1)
BuildingFoundation->Get<uint8_t>(FoundationEnabledStateOffset) = bShow ? Enabled : Disabled;
// SetFoundationTransform(BuildingFoundation, BuildingFoundation->GetTransform()); // idk
static auto LevelToStreamOffset = BuildingFoundation->GetOffset("LevelToStream");
auto& LevelToStream = BuildingFoundation->Get<FName>(LevelToStreamOffset);
@@ -174,7 +157,40 @@ static void ShowFoundation(AActor* BuildingFoundation, bool bShow = true)
UGameplayStatics::UnloadStreamLevel(GetWorld(), LevelToStream, FLatentActionInfo(), false);
} */
// real
static auto OnRep_LevelToStreamFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.OnRep_LevelToStream");
BuildingFoundation->ProcessEvent(OnRep_LevelToStreamFn);
static auto DynamicFoundationRepDataOffset = BuildingFoundation->GetOffset("DynamicFoundationRepData", false);
if (DynamicFoundationRepDataOffset != -1)
{
auto DynamicFoundationRepData = BuildingFoundation->GetPtr<void>(DynamicFoundationRepDataOffset);
static auto EnabledStateOffset = FindOffsetStruct("/Script/FortniteGame.DynamicBuildingFoundationRepData", "EnabledState");
*(uint8_t*)(__int64(DynamicFoundationRepData) + EnabledStateOffset) = bShow ? Enabled : Disabled;
if (false)
{
static auto TranslationOffset = FindOffsetStruct("/Script/FortniteGame.DynamicBuildingFoundationRepData", "Translation");
static auto RotationOffset = FindOffsetStruct("/Script/FortniteGame.DynamicBuildingFoundationRepData", "Rotation");
*(FVector*)(__int64(DynamicFoundationRepData) + TranslationOffset) = BuildingFoundation->GetActorLocation();
const FRotator BuildingRotation = BuildingFoundation->GetActorRotation();
if (Fortnite_Version >= 13)
*(FRotator*)(__int64(DynamicFoundationRepData) + RotationOffset) = BuildingRotation;
else
*(FQuat*)(__int64(DynamicFoundationRepData) + RotationOffset) = BuildingRotation.Quaternion();
static auto OnRep_DynamicFoundationRepDataFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.OnRep_DynamicFoundationRepData");
BuildingFoundation->ProcessEvent(OnRep_DynamicFoundationRepDataFn);
}
else
{
SetFoundationTransform(BuildingFoundation, BuildingFoundation->GetTransform());
}
}
BuildingFoundation->FlushNetDormancy();
BuildingFoundation->ForceNetUpdate();

View File

@@ -101,33 +101,6 @@ TScriptInterface<UFortSafeZoneInterface> AFortGameStateAthena::GetSafeZoneInterf
return ScriptInterface;
}
void AFortGameStateAthena::SetGamePhaseStep(EAthenaGamePhaseStep NewGamePhaseStep)
{
this->GetGamePhaseStep() = NewGamePhaseStep;
std::vector<std::pair<AFortAthenaMutator*, UFunction*>> FunctionsToCall;
LoopMutators([&](AFortAthenaMutator* Mutator) { FunctionsToCall.push_back(std::make_pair(Mutator, Mutator->FindFunction("OnGamePhaseStepChanged"))); });
for (auto& FunctionToCallPair : FunctionsToCall)
{
// On newer versions there is a second param.
// LOG_INFO(LogDev, "A1: {} FunctionToCallPair.second: {}", FunctionToCallPair.first->IsValidLowLevel() ? FunctionToCallPair.first->GetFullName() : "BadRead", __int64(FunctionToCallPair.second));
if (FunctionToCallPair.second->IsValidLowLevel() && FunctionToCallPair.first->IsValidLowLevel())
{
auto Params = ConstructOnGamePhaseStepChangedParams(NewGamePhaseStep);
if (Params)
{
FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, Params);
VirtualFree(Params, 0, MEM_RELEASE);
}
}
}
}
UFortPlaylist*& AFortGameStateAthena::GetCurrentPlaylist()
{
static auto CurrentPlaylistInfoOffset = GetOffset("CurrentPlaylistInfo", false);

View File

@@ -149,8 +149,6 @@ public:
return Get<EAthenaGamePhaseStep>(GamePhaseStepOffset);
}
void SetGamePhaseStep(EAthenaGamePhaseStep NewGamePhaseStep);
UFortPlaylist*& GetCurrentPlaylist();
TScriptInterface<UFortSafeZoneInterface> GetSafeZoneInterface();
@@ -167,35 +165,3 @@ public:
static UClass* StaticClass();
};
static void* ConstructOnGamePhaseStepChangedParams(EAthenaGamePhaseStep GamePhaseStep)
{
struct AFortAthenaAIBotController_OnGamePhaseStepChanged_Params
{
TScriptInterface<UFortSafeZoneInterface> SafeZoneInterface; // (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, UObjectWrapper, NativeAccessSpecifierPublic)
EAthenaGamePhaseStep GamePhaseStep; // (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
};
bool bHasSafeZoneInterfaceParam = Fortnite_Version >= 10; // idk what version
AFortAthenaAIBotController_OnGamePhaseStepChanged_Params* Params = Alloc<AFortAthenaAIBotController_OnGamePhaseStepChanged_Params>();
if (bHasSafeZoneInterfaceParam)
{
auto GameState = (AFortGameStateAthena*)GetWorld()->GetGameState();
auto Interface = GameState->GetSafeZoneInterface();
if (!Interface.ObjectPointer)
return nullptr;
Params->SafeZoneInterface = Interface;
Params->GamePhaseStep = GamePhaseStep;
}
else
{
*(EAthenaGamePhaseStep*)(__int64(Params) + 0) = GamePhaseStep;
}
return Params;
}

View File

@@ -9,17 +9,17 @@ UFortResourceItemDefinition* UFortKismetLibrary::K2_GetResourceItemDefinition(EF
{
if (ResourceType == EFortResourceType::Wood)
{
static auto WoodItemData = FindObject<UFortResourceItemDefinition>("/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
static auto WoodItemData = FindObject<UFortResourceItemDefinition>(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
return WoodItemData;
}
else if (ResourceType == EFortResourceType::Stone)
{
static auto StoneItemData = FindObject<UFortResourceItemDefinition>("/Game/Items/ResourcePickups/StoneItemData.StoneItemData");
static auto StoneItemData = FindObject<UFortResourceItemDefinition>(L"/Game/Items/ResourcePickups/StoneItemData.StoneItemData");
return StoneItemData;
}
else if (ResourceType == EFortResourceType::Metal)
{
static auto MetalItemData = FindObject<UFortResourceItemDefinition>("/Game/Items/ResourcePickups/MetalItemData.MetalItemData");
static auto MetalItemData = FindObject<UFortResourceItemDefinition>(L"/Game/Items/ResourcePickups/MetalItemData.MetalItemData");
return MetalItemData;
}
@@ -38,7 +38,7 @@ UFortResourceItemDefinition* UFortKismetLibrary::K2_GetResourceItemDefinition(EF
FVector UFortKismetLibrary::FindGroundLocationAt(UWorld* World, AActor* IgnoreActor, FVector InLocation, float TraceStartZ, float TraceEndZ, FName TraceName)
{
static auto FindGroundLocationAtFn = FindObject<UFunction>("/Script/FortniteGame.FortKismetLibrary.FindGroundLocationAt");
static auto FindGroundLocationAtFn = FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.FindGroundLocationAt");
struct
{

View File

@@ -38,7 +38,7 @@ void CollectDataTablesRows(const std::vector<UDataTable*>& DataTables, LOOTING_M
static auto ParentTablesOffset = CompositeDataTable->GetOffset("ParentTables");
auto& ParentTables = CompositeDataTable->Get<TArray<UDataTable*>>(ParentTablesOffset);
for (int i = 0; i < ParentTables.Num(); i++)
for (int i = 0; i < ParentTables.Num(); ++i)
{
DataTablesToIterate.push_back(ParentTables.at(i));
}
@@ -78,7 +78,7 @@ float GetAmountOfLootPackagesToDrop(FFortLootTierData* LootTierData, int Origina
if (LootTierData->GetLootPackageCategoryMinArray().Num() > 0)
{
for (int i = 0; i < LootTierData->GetLootPackageCategoryMinArray().Num(); i++)
for (int i = 0; i < LootTierData->GetLootPackageCategoryMinArray().Num(); ++i)
{
// Fortnite does more here, we need to figure it out.
MinimumLootDrops += LootTierData->GetLootPackageCategoryMinArray().at(i);
@@ -95,7 +95,7 @@ float GetAmountOfLootPackagesToDrop(FFortLootTierData* LootTierData, int Origina
if (LootTierData->GetLootPackageCategoryWeightArray().Num() > 0)
{
for (int i = 0; i < LootTierData->GetLootPackageCategoryWeightArray().Num(); i++)
for (int i = 0; i < LootTierData->GetLootPackageCategoryWeightArray().Num(); ++i)
{
// Fortnite does more here, we need to figure it out.
@@ -151,56 +151,76 @@ float GetAmountOfLootPackagesToDrop(FFortLootTierData* LootTierData, int Origina
std::vector<FFortItemEntry> ItemEntries;
}; */
FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, FName LootTierGroup, int ForcedLootTier = -1, FName* OutRowName = nullptr) // Fortnite returns the row name and then finds the tier data again, but I really don't see the point of this.
bool PickRowForLootTier(FName* OutName, FFortLootTierData** OutLTD, float RandMultiplier, const LOOTING_MAP_TYPE<FName, FFortLootTierData*>& Rows)
{
float Rand = RandomFloatForLoot(RandMultiplier);
if (!Rows.size())
return false;
for (auto& currentPair : Rows)
{
float currentWeight = currentPair.second->GetWeight();
if (Rand <= currentWeight)
{
*OutName = currentPair.first;
*OutLTD = currentPair.second;
return true;
}
Rand -= currentWeight;
}
return false;
}
FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, FName LootTierGroup, int ForcedLootTier = -1, FName* OutRowName = nullptr, int* OutLootTierDataTier = nullptr) // Fortnite returns the row name and then finds the tier data again, but I really don't see the point of this.
{
// This like isn't right, at all.
float LootTier = ForcedLootTier;
float TotalWeight = 0;
if (LootTier == -1)
LOOTING_MAP_TYPE<FName, FFortLootTierData*> TierGroupLTDs;
if (ForcedLootTier == -1)
{
// LootTier = ??
CollectDataTablesRows<FFortLootTierData>(LTDTables, &TierGroupLTDs, [&](FName RowName, FFortLootTierData* TierData) -> bool {
if (LootTierGroup == TierData->GetTierGroup())
{
TotalWeight += TierData->GetWeight();
return true;
}
return false;
});
}
else
{
// buncha code im too lazy to reverse
}
// if (fabs(LootTier) <= 0.0000000099999999)
// return 0;
int Multiplier = LootTier == -1 ? 1 : LootTier; // Idk i think we need to fill out the code above for this to work properly maybe
LOOTING_MAP_TYPE<FName, FFortLootTierData*> TierGroupLTDs;
CollectDataTablesRows<FFortLootTierData>(LTDTables, &TierGroupLTDs, [&](FName RowName, FFortLootTierData* TierData) -> bool {
if (LootTierGroup == TierData->GetTierGroup())
{
if ((LootTier == -1 ? true : LootTier == TierData->GetLootTier()))
{
return true;
}
}
return false;
});
if (fabs(TotalWeight) <= 0.0000000099999999)
return 0;
// LOG_INFO(LogDev, "TierGroupLTDs.size(): {}", TierGroupLTDs.size());
FFortLootTierData* ChosenRowLootTierData = PickWeightedElement<FName, FFortLootTierData*>(TierGroupLTDs,
[](FFortLootTierData* LootTierData) -> float { return LootTierData->GetWeight(); }, RandomFloatForLoot, -1,
true, Multiplier, OutRowName);
FFortLootTierData* ChosenRowLootTierData = nullptr;
PickRowForLootTier(OutRowName, &ChosenRowLootTierData, TotalWeight, TierGroupLTDs);
return ChosenRowLootTierData;
}
void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, const FName& LootPackageName, std::vector<LootDrop>* OutEntries, int LootPackageCategory = -1, int WorldLevel = 0, bool bPrint = false, bool bCombineDrops = true)
void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, FName LootPackageName, std::vector<LootDrop>* OutEntries, int LootPackageCategory = -1, int WorldLevel = 0, bool bPrint = false, bool bCombineDrops = true)
{
if (!OutEntries)
return;
LOOTING_MAP_TYPE<FName, FFortLootPackageData*> LootPackageIDMap;
float TotalWeight = 0;
CollectDataTablesRows<FFortLootPackageData>(LPTables, &LootPackageIDMap, [&](FName RowName, FFortLootPackageData* LootPackage) -> bool {
if (LootPackage->GetLootPackageID() != LootPackageName)
{
@@ -215,16 +235,18 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
if (WorldLevel >= 0)
{
if (LootPackage->GetMaxWorldLevel() >= 0 && WorldLevel > LootPackage->GetMaxWorldLevel())
return 0;
return false;
if (LootPackage->GetMinWorldLevel() >= 0 && WorldLevel < LootPackage->GetMinWorldLevel())
return 0;
return false;
}
TotalWeight += LootPackage->GetWeight();
return true;
});
if (LootPackageIDMap.size() == 0)
if (TotalWeight == 0)
{
// std::cout << std::format("Loot Package {} has no valid weights.\n", LootPackageName.ToString());
return;
@@ -232,8 +254,7 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
FName PickedPackageRowName;
FFortLootPackageData* PickedPackage = PickWeightedElement<FName, FFortLootPackageData*>(LootPackageIDMap,
[](FFortLootPackageData* LootPackageData) -> float { return LootPackageData->GetWeight(); }, RandomFloatForLoot,
-1, true, 1, &PickedPackageRowName, bPrint);
[](FFortLootPackageData* LootPackageData) -> float { return LootPackageData->GetWeight(); }, RandomFloatForLoot, -1, true, 1, &PickedPackageRowName, bPrint);
if (!PickedPackage)
return;
@@ -454,7 +475,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
if (FortGameFeatureDataClass)
{
for (int i = 0; i < ChunkedObjects->Num(); i++)
for (int i = 0; i < ChunkedObjects->Num(); ++i)
{
auto Object = ChunkedObjects->GetObjectByIndex(i);
@@ -492,7 +513,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
static auto GameplayTagContainerOffset = CurrentPlaylist->GetOffset("GameplayTagContainer");
auto GameplayTagContainer = CurrentPlaylist->GetPtr<FGameplayTagContainer>(GameplayTagContainerOffset);
for (int i = 0; i < GameplayTagContainer->GameplayTags.Num(); i++)
for (int i = 0; i < GameplayTagContainer->GameplayTags.Num(); ++i)
{
auto& Tag = GameplayTagContainer->GameplayTags.At(i);
@@ -509,23 +530,6 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
if (ptr)
{
/* if (bOverrideIsComposite)
{
static auto ParentTablesOffset = ptr->GetOffset("ParentTables");
auto ParentTables = ptr->GetPtr<TArray<UDataTable*>>(ParentTablesOffset);
for (int z = 0; z < ParentTables->size(); z++)
{
auto ParentTable = ParentTables->At(z);
if (ParentTable)
{
LPTables.push_back(ParentTable);
}
}
} */
LPTables.push_back(ptr);
}
}
@@ -546,7 +550,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
static auto GameplayTagContainerOffset = CurrentPlaylist->GetOffset("GameplayTagContainer");
auto GameplayTagContainer = CurrentPlaylist->GetPtr<FGameplayTagContainer>(GameplayTagContainerOffset);
for (int i = 0; i < GameplayTagContainer->GameplayTags.Num(); i++)
for (int i = 0; i < GameplayTagContainer->GameplayTags.Num(); ++i)
{
auto& Tag = GameplayTagContainer->GameplayTags.At(i);
@@ -569,7 +573,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
auto ParentTables = ptr->GetPtr<TArray<UDataTable*>>(ParentTablesOffset);
for (int z = 0; z < ParentTables->size(); z++)
for (int z = 0; z < ParentTables->size(); ++z)
{
auto ParentTable = ParentTables->At(z);
@@ -591,7 +595,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
}
}
for (int i = 0; i < LTDTables.size(); i++)
for (int i = 0; i < LTDTables.size(); ++i)
{
auto& Table = LTDTables.at(i);
@@ -604,7 +608,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
LOG_INFO(LogDev, "[{}] LTD {}", i, Table->GetFullName());
}
for (int i = 0; i < LPTables.size(); i++)
for (int i = 0; i < LPTables.size(); ++i)
{
auto& Table = LPTables.at(i);
@@ -674,7 +678,8 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
}
FName LootTierRowName;
auto ChosenRowLootTierData = PickLootTierData(LTDTables, TierGroupName, ForcedLootTier, &LootTierRowName);
int ltdLootTier = 0;
auto ChosenRowLootTierData = PickLootTierData(LTDTables, TierGroupName, ForcedLootTier, &LootTierRowName, &ltdLootTier);
if (!ChosenRowLootTierData)
{
@@ -717,12 +722,12 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
if (AmountOfLootPackageDrops > 0)
{
for (int i = 0; i < AmountOfLootPackageDrops; i++)
for (int i = 0; i < AmountOfLootPackageDrops; ++i)
{
if (i >= ChosenRowLootTierData->GetLootPackageCategoryMinArray().Num())
break;
for (int j = 0; j < ChosenRowLootTierData->GetLootPackageCategoryMinArray().at(i); j++)
for (int j = 0; j < ChosenRowLootTierData->GetLootPackageCategoryMinArray().at(i); ++j)
{
if (ChosenRowLootTierData->GetLootPackageCategoryMinArray().at(i) < 1)
break;

View File

@@ -137,7 +137,7 @@ struct LootDrop
static inline float RandomFloatForLoot(float AllWeightsSum)
{
return (rand() * 0.000030518509) * AllWeightsSum;
return (rand() * 0.000030518509f) * AllWeightsSum;
}
template <typename KeyType, typename ValueType>
@@ -165,8 +165,7 @@ FORCEINLINE static ValueType PickWeightedElement(const std::map<KeyType, ValueTy
});
}
float RandomNumber = // UKismetMathLibrary::RandomFloatInRange(0, TotalWeight);
RandMultiplier * RandomFloatGenerator(TotalWeight);
float RandomNumber = RandMultiplier * RandomFloatGenerator(TotalWeight);
if (bPrint)
{

View File

@@ -17,7 +17,7 @@ void AFortMinigame::ClearPlayerInventoryHook(UObject* Context, FFrame& Stack, vo
auto& ItemInstances = PlayerController->GetWorldInventory()->GetItemList().GetItemInstances();
for (int i = 0; i < ItemInstances.Num(); i++)
for (int i = 0; i < ItemInstances.Num(); ++i)
{
auto ItemInstance = ItemInstances.at(i);

View File

@@ -98,7 +98,7 @@ AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
std::vector<float> AttributeValueVector;
for (int i = 0; i < GadgetItemDefinition->GetTrackedAttributes().Num(); i++)
for (int i = 0; i < GadgetItemDefinition->GetTrackedAttributes().Num(); ++i)
{
auto& CurrentTrackedAttribute = GadgetItemDefinition->GetTrackedAttributes().at(i);
@@ -111,7 +111,7 @@ AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
int CurrentAttributeValue = -1;
for (int i = 0; i < ASC->GetSpawnedAttributes().Num(); i++)
for (int i = 0; i < ASC->GetSpawnedAttributes().Num(); ++i)
{
auto CurrentSpawnedAttribute = ASC->GetSpawnedAttributes().at(i);
@@ -365,7 +365,7 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
bool bIsInventoryFull = false;
for (int i = 0; i < ItemInstances.Num(); i++)
for (int i = 0; i < ItemInstances.Num(); ++i)
{
auto ItemInstance = ItemInstances.at(i);
auto CurrentItemEntry = ItemInstance->GetItemEntry();
@@ -504,7 +504,7 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
// auto Item = GiveItem(PlayerController, ItemDef, cpyCount, CurrentPickup->PrimaryPickupItemEntry.LoadedAmmo, true);
/* for (int i = 0; i < Pawn->IncomingPickups.Num(); i++)
/* for (int i = 0; i < Pawn->IncomingPickups.Num(); ++i)
{
Pawn->IncomingPickups[i]->PickupLocationData.PickupGuid = Item->ItemEntry.ItemGuid;
} */

View File

@@ -80,7 +80,7 @@ void AFortPlayerController::DropAllItems(const std::vector<UFortItemDefinition*>
auto PickaxeInstance = WorldInventory->GetPickaxeInstance();
for (int i = 0; i < ItemInstances.Num(); i++)
for (int i = 0; i < ItemInstances.Num(); ++i)
{
auto ItemInstance = ItemInstances.at(i);
@@ -185,7 +185,7 @@ void AFortPlayerController::ApplyCosmeticLoadout()
{
auto& BackpackCharacterParts = Backpack->Get<TArray<UObject*>>(CharacterPartsOffset);
for (int i = 0; i < BackpackCharacterParts.Num(); i++)
for (int i = 0; i < BackpackCharacterParts.Num(); ++i)
{
auto BackpackCharacterPart = BackpackCharacterParts.at(i);
@@ -222,21 +222,32 @@ void AFortPlayerController::ApplyCosmeticLoadout()
void AFortPlayerController::ServerLoadingScreenDroppedHook(UObject* Context, FFrame* Stack, void* Ret)
{
LOG_INFO(LogDev, "ServerLoadingScreenDroppedHook!");
auto PlayerController = (AFortPlayerController*)Context;
PlayerController->ApplyCosmeticLoadout();
// PlayerController->ApplyCosmeticLoadout();
return ServerLoadingScreenDroppedOriginal(Context, Stack, Ret);
}
void AFortPlayerController::ServerRepairBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToRepair)
{
if (!BuildingActorToRepair)
if (!BuildingActorToRepair
// || !BuildingActorToRepair->GetWorld()
)
return;
if (BuildingActorToRepair->GetEditingPlayer())
{
// ClientSendMessage
return;
}
float BuildingHealthPercent = BuildingActorToRepair->GetHealthPercent();
// todo not hardcode these?
// todo not hardcode these
float BuildingCost = 10;
float RepairCostMultiplier = 0.75;
@@ -273,13 +284,9 @@ void AFortPlayerController::ServerRepairBuildingActorHook(AFortPlayerController*
WorldInventory->Update();
}
struct
{
AFortPlayerController* RepairingController; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
int ResourcesSpent; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
}ABuildingSMActor_RepairBuilding_Params{ PlayerController, RepairCost };
struct { AFortPlayerController* RepairingController; int ResourcesSpent; } ABuildingSMActor_RepairBuilding_Params{ PlayerController, RepairCost };
static auto RepairBuildingFn = FindObject<UFunction>("/Script/FortniteGame.BuildingSMActor.RepairBuilding");
static auto RepairBuildingFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingSMActor.RepairBuilding");
BuildingActorToRepair->ProcessEvent(RepairBuildingFn, &ABuildingSMActor_RepairBuilding_Params);
// PlayerController->FortClientPlaySoundAtLocation(PlayerController->StartRepairSound, BuildingActorToRepair->K2_GetActorLocation(), 0, 0);
}
@@ -517,7 +524,7 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
static auto WeaponSeatDefinitionsOffset = WeaponComponent->GetOffset("WeaponSeatDefinitions");
auto& WeaponSeatDefinitions = WeaponComponent->Get<TArray<__int64>>(WeaponSeatDefinitionsOffset);
for (int i = 0; i < WeaponSeatDefinitions.Num(); i++)
for (int i = 0; i < WeaponSeatDefinitions.Num(); ++i)
{
auto WeaponSeat = WeaponSeatDefinitions.AtPtr(i, WeaponSeatDefinitionStructSize);
@@ -861,7 +868,7 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
}
for (int i = 0; i < ExistingBuildings.Num(); i++)
for (int i = 0; i < ExistingBuildings.Num(); ++i)
{
auto ExistingBuilding = ExistingBuildings.At(i);
@@ -1162,7 +1169,7 @@ DWORD WINAPI SpectateThread(LPVOID)
while (1)
{
for (auto PC : PlayerControllersDead)
// for (int i = 0; i < PlayerControllersDead.size(); i++)
// for (int i = 0; i < PlayerControllersDead.size(); ++i)
{
// auto PC = PlayerControllersDead.at(i).load();
@@ -1358,7 +1365,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
std::vector<std::pair<FGuid, int>> GuidAndCountsToRemove;
for (int i = 0; i < ItemInstances.Num(); i++)
for (int i = 0; i < ItemInstances.Num(); ++i)
{
auto ItemInstance = ItemInstances.at(i);
@@ -1490,7 +1497,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
bool bDidSomeoneWin = AllPlayerStates.Num() == 0;
for (int i = 0; i < AllPlayerStates.Num(); i++)
for (int i = 0; i < AllPlayerStates.Num(); ++i)
{
auto CurrentPlayerState = (AFortPlayerStateAthena*)AllPlayerStates.at(i);
@@ -1584,8 +1591,8 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
if (!BuildingActorToEdit || !NewBuildingClass || BuildingActorToEdit->IsDestroyed() || BuildingActorToEdit->GetEditingPlayer() != PlayerState)
{
LOG_INFO(LogDev, "Cheater?");
LOG_INFO(LogDev, "BuildingActorToEdit->GetEditingPlayer(): {} PlayerState: {} NewBuildingClass: {} BuildingActorToEdit: {}", BuildingActorToEdit ? __int64(BuildingActorToEdit->GetEditingPlayer()) : -1, __int64(PlayerState), __int64(NewBuildingClass), __int64(BuildingActorToEdit));
// LOG_INFO(LogDev, "Cheater?");
// LOG_INFO(LogDev, "BuildingActorToEdit->GetEditingPlayer(): {} PlayerState: {} NewBuildingClass: {} BuildingActorToEdit: {}", BuildingActorToEdit ? __int64(BuildingActorToEdit->GetEditingPlayer()) : -1, __int64(PlayerState), __int64(NewBuildingClass), __int64(BuildingActorToEdit));
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
}

View File

@@ -11,6 +11,7 @@
#include "AthenaResurrectionComponent.h"
#include "FortAthenaMutator_InventoryOverride.h"
#include "FortGadgetItemDefinition.h"
#include "gui.h"
void AFortPlayerControllerAthena::StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret)
{
@@ -155,7 +156,7 @@ void AFortPlayerControllerAthena::EnterAircraftHook(UObject* PC, AActor* Aircraf
auto& ItemInstances = InventoryList.GetItemInstances();
for (int i = 0; i < ItemInstances.Num(); i++)
for (int i = 0; i < ItemInstances.Num(); ++i)
{
auto ItemEntry = ItemInstances.at(i)->GetItemEntry();
auto ItemDefinition = Cast<UFortWorldItemDefinition>(ItemEntry->GetItemDefinition());
@@ -239,7 +240,7 @@ void AFortPlayerControllerAthena::EnterAircraftHook(UObject* PC, AActor* Aircraf
{
auto LoadoutContainer = InventoryOverride->GetLoadoutContainerForTeamIndex(TeamIndex);
for (int i = 0; i < LoadoutContainer.Loadout.Num(); i++)
for (int i = 0; i < LoadoutContainer.Loadout.Num(); ++i)
{
auto& ItemAndCount = LoadoutContainer.Loadout.at(i);
WorldInventory->AddItem(ItemAndCount.GetItem(), nullptr, ItemAndCount.GetCount());
@@ -250,40 +251,6 @@ void AFortPlayerControllerAthena::EnterAircraftHook(UObject* PC, AActor* Aircraf
LoopMutators(AddInventoryOverrideTeamLoadouts);
static int LastNum1 = 3125;
if (LastNum1 != Globals::AmountOfListens)
{
LastNum1 = Globals::AmountOfListens;
for (auto& FunctionToCallPair : FunctionsToCall)
{
// On newer versions there is a second param.
LOG_INFO(LogDev, "FunctionToCallPair.second: {}", __int64(FunctionToCallPair.second));
if (FunctionToCallPair.second)
{
{
// mem leak btw
auto a = ConstructOnGamePhaseStepChangedParams(EAthenaGamePhaseStep::GetReady);
if (a)
{
FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, a);
FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, ConstructOnGamePhaseStepChangedParams(EAthenaGamePhaseStep::BusLocked));
FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, ConstructOnGamePhaseStepChangedParams(EAthenaGamePhaseStep::BusFlying));
}
// FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, &StormFormingGamePhaseStep);
// FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, &StormHoldingGamePhaseStep);
// FunctionToCallPair.first->ProcessEvent(FunctionToCallPair.second, &StormShrinkingGamePhaseStep);
}
}
}
}
WorldInventory->Update();
// Should we equip the pickaxe for older builds here?
@@ -403,7 +370,7 @@ void AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook(AFor
static auto FortPlayerStartCreativeClass = FindObject<UClass>(L"/Script/FortniteGame.FortPlayerStartCreative");
auto AllCreativePlayerStarts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartCreativeClass);
for (int i = 0; i < AllCreativePlayerStarts.Num(); i++)
for (int i = 0; i < AllCreativePlayerStarts.Num(); ++i)
{
auto CurrentPlayerStart = AllCreativePlayerStarts.at(i);
@@ -449,10 +416,64 @@ void AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessageHook(AFortPlaye
{
using UAthenaEmojiItemDefinition = UFortItemDefinition;
auto PlayerStateAthena = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState());
if (!PlayerStateAthena)
return;
static auto IndexOffset = FindOffsetStruct("/Script/FortniteGame.AthenaQuickChatActiveEntry", "Index");
auto Index = *(int8*)(__int64(ChatEntry) + IndexOffset);
LOG_INFO(LogDev, "Index: {}", (int)Index);
uint8 NewTeamMemberState = 0;
switch (Index)
{
case 0:
NewTeamMemberState = 8;
break;
case 1:
NewTeamMemberState = 9;
break;
case 2:
NewTeamMemberState = 11;
break;
case 3:
NewTeamMemberState = 10;
break;
case 4:
NewTeamMemberState = 12;
break;
case 5:
NewTeamMemberState = 3;
break;
case 6:
NewTeamMemberState = 4;
break;
case 7:
NewTeamMemberState = 2;
break;
case 8:
NewTeamMemberState = 5;
break;
case 9:
NewTeamMemberState = 6;
break;
default:
break;
}
NewTeamMemberState -= AmountToSubtractIndex;
PlayerStateAthena->Get<uint8_t>("ReplicatedTeamMemberState") = NewTeamMemberState;
PlayerStateAthena->Get<uint8_t>("TeamMemberState") = NewTeamMemberState; // pretty sure unneeded
static auto EmojiComm = FindObject<UAthenaEmojiItemDefinition>(L"/Game/Athena/Items/Cosmetics/Dances/Emoji/Emoji_Comm.Emoji_Comm");
PlayerController->ServerPlayEmoteItemHook(PlayerController, EmojiComm);
// idk what else we are supposed to do here
static auto OnRep_ReplicatedTeamMemberStateFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.OnRep_ReplicatedTeamMemberState");
PlayerStateAthena->ProcessEvent(OnRep_ReplicatedTeamMemberStateFn);
}
void AFortPlayerControllerAthena::GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation)
@@ -533,7 +554,7 @@ void AFortPlayerControllerAthena::UpdateTrackedAttributesHook(AFortPlayerControl
std::vector<UFortItem*> ItemInstancesToRemove;
for (int i = 0; i < ItemInstances.Num(); i++)
for (int i = 0; i < ItemInstances.Num(); ++i)
{
auto ItemInstance = ItemInstances.at(i);
auto GadgetItemDefinition = Cast<UFortGadgetItemDefinition>(ItemInstance->GetItemEntry()->GetItemDefinition());
@@ -546,13 +567,13 @@ void AFortPlayerControllerAthena::UpdateTrackedAttributesHook(AFortPlayerControl
bool bIsTrackedAttributesZero = true;
for (int i = 0; i < GadgetItemDefinition->GetTrackedAttributes().Num(); i++)
for (int i = 0; i < GadgetItemDefinition->GetTrackedAttributes().Num(); ++i)
{
auto& CurrentTrackedAttribute = GadgetItemDefinition->GetTrackedAttributes().at(i);
int CurrentAttributeValue = -1;
for (int i = 0; i < ASC->GetSpawnedAttributes().Num(); i++)
for (int i = 0; i < ASC->GetSpawnedAttributes().Num(); ++i)
{
auto CurrentSpawnedAttribute = ASC->GetSpawnedAttributes().at(i);

View File

@@ -62,7 +62,7 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
bool bCanStack = false;
bool bFoundStack = false;
for (int i = 0; i < ItemInstances.Num(); i++)
for (int i = 0; i < ItemInstances.Num(); ++i)
{
auto ItemInstance = ItemInstances.at(i);

View File

@@ -301,9 +301,9 @@ public:
auto& ModifierList = this->GetModifierList();
static auto FortGameplayModifierItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.FortGameplayModifierItemDefinition");
static auto FortGameplayModifierItemDefinitionClass = FindObject<UClass>(L"/Script/FortniteGame.FortGameplayModifierItemDefinition");
for (int i = 0; i < ModifierList.Num(); i++)
for (int i = 0; i < ModifierList.Num(); ++i)
{
auto& ModifierSoft = ModifierList.at(i);
auto StrongModifier = ModifierSoft.Get(FortGameplayModifierItemDefinitionClass, true);

View File

@@ -78,7 +78,7 @@ public:
{
auto& PrimaryQuickBarSlots = PrimaryQuickBar->GetSlots();
for (int i = 0; i < PrimaryQuickBarSlots.Num(); i++)
for (int i = 0; i < PrimaryQuickBarSlots.Num(); ++i)
{
auto Slot = PrimaryQuickBarSlots.AtPtr(i, FQuickBarSlot::GetStructSize());
@@ -98,7 +98,7 @@ public:
{
auto& SecondaryQuickBarSlots = SecondaryQuickBar->GetSlots();
for (int i = 0; i < SecondaryQuickBarSlots.Num(); i++)
for (int i = 0; i < SecondaryQuickBarSlots.Num(); ++i)
{
auto Slot = SecondaryQuickBarSlots.AtPtr(i, FQuickBarSlot::GetStructSize());

View File

@@ -17,14 +17,5 @@ void AFortSafeZoneIndicator::OnSafeZoneStateChangeHook(AFortSafeZoneIndicator* S
LOG_INFO(LogDev, "OnSafeZoneStateChangeHook!");
if (NewState == EFortSafeZoneState::Shrinking)
{
GameState->SetGamePhaseStep(EAthenaGamePhaseStep::StormShrinking);
}
else if (NewState == EFortSafeZoneState::Holding)
{
GameState->SetGamePhaseStep(EAthenaGamePhaseStep::StormHolding);
}
return OnSafeZoneStateChangeOriginal(SafeZoneIndicator, NewState, bInitial);
}

View File

@@ -17,7 +17,7 @@ int UFortWeaponItemDefinition::GetClipSize()
void* Row = nullptr;
for (int i = 0; i < RowMap.Pairs.Elements.Data.Num(); i++)
for (int i = 0; i < RowMap.Pairs.Elements.Data.Num(); ++i)
{
auto& Pair = RowMap.Pairs.Elements.Data.at(i).ElementData.Value;

View File

@@ -99,18 +99,18 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
if (!PlayerStateAthena)
return nullptr; // return original?
static auto PawnClass = FindObject<UClass>("/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C");
static auto PawnClass = FindObject<UClass>(L"/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C");
static auto DefaultPawnClassOffset = GameMode->GetOffset("DefaultPawnClass");
GameMode->Get<UClass*>(DefaultPawnClassOffset) = PawnClass;
constexpr bool bUseSpawnActor = false;
bool bUseSpawnActor = Fortnite_Version >= 20;
static auto SpawnDefaultPawnAtTransformFn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnAtTransform");
FTransform SpawnTransform = StartSpot->GetTransform();
APawn* NewPawn = nullptr;
if constexpr (bUseSpawnActor)
if (bUseSpawnActor)
{
NewPawn = GetWorld()->SpawnActor<APawn>(PawnClass, SpawnTransform, CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn));
}
@@ -179,7 +179,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
NewPlayerAsAthena->AddPickaxeToInventory();
for (int i = 0; i < StartingItems.Num(); i++)
for (int i = 0; i < StartingItems.Num(); ++i)
{
auto& StartingItem = StartingItems.at(i);
@@ -190,7 +190,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
{
auto SpawnIslandTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaFloorLoot_Warmup");
for (int i = 0; i < 5; i++)
for (int i = 0; i < 5; ++i)
{
auto LootDrops = PickLootDrops(SpawnIslandTierGroup);
@@ -212,7 +212,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
{
auto LoadoutContainer = InventoryOverride->GetLoadoutContainerForTeamIndex(TeamIndex);
for (int i = 0; i < LoadoutContainer.Loadout.Num(); i++)
for (int i = 0; i < LoadoutContainer.Loadout.Num(); ++i)
{
auto& ItemAndCount = LoadoutContainer.Loadout.at(i);
WorldInventory->AddItem(ItemAndCount.GetItem(), nullptr, ItemAndCount.GetCount());

View File

@@ -40,7 +40,7 @@ struct FGameplayTagContainer
int Find(const std::string& Str)
{
for (int i = 0; i < GameplayTags.Num(); i++)
for (int i = 0; i < GameplayTags.Num(); ++i)
{
if (GameplayTags.at(i).TagName.ToString() == Str)
return i;

View File

@@ -207,7 +207,7 @@ void UInventoryManagementLibrary::AddItemsHook(UObject* Context, FFrame& Stack,
if (!WorldInventory)
return;
for (int i = 0; i < Items.Num(); i++)
for (int i = 0; i < Items.Num(); ++i)
{
WorldInventory->AddItem(Items.at(i).GetItem(), nullptr, Items.at(i).GetCount());
}

View File

@@ -319,7 +319,7 @@ static UActorChannel* FindChannel(AActor * Actor, UNetConnection * Connection)
// LOG_INFO(LogReplication, "OpenChannels.Num(): {}", OpenChannels.Num());
for (int i = 0; i < OpenChannels.Num(); i++)
for (int i = 0; i < OpenChannels.Num(); ++i)
{
auto Channel = OpenChannels.at(i);
@@ -342,7 +342,9 @@ static UActorChannel* FindChannel(AActor * Actor, UNetConnection * Connection)
return (UActorChannel*)Channel;
}
return NULL;
// LOG_INFO(LogDev, "Failed to find channel for {}!", Actor->GetName());
return nullptr;
}
static bool IsActorRelevantToConnection(AActor * Actor, std::vector<FNetViewer>&ConnectionViewers)
@@ -461,8 +463,6 @@ int32 UNetDriver::ServerReplicateActors()
if (ShouldUseNetworkObjectList())
ConsiderList.reserve(GetNetworkObjectList().ActiveNetworkObjects.Num());
// std::cout << "ConsiderList.size(): " << GetNetworkObjectList(NetDriver).ActiveNetworkObjects.Num() << '\n';
auto World = GetWorld();
ServerReplicateActors_BuildConsiderList(ConsiderList, ServerTickTime);
@@ -621,15 +621,18 @@ int32 UNetDriver::ServerReplicateActors()
{
if (ReplicateActor(Channel))
{
// LOG_INFO(LogReplication, "Replicated Actor!");
auto TimeSeconds = UGameplayStatics::GetTimeSeconds(World);
const float MinOptimalDelta = 1.0f / Actor->GetNetUpdateFrequency();
const float MaxOptimalDelta = max(1.0f / Actor->GetMinNetUpdateFrequency(), MinOptimalDelta);
const float DeltaBetweenReplications = (TimeSeconds - ActorInfo->LastNetReplicateTime);
if (ShouldUseNetworkObjectList())
{
// LOG_INFO(LogReplication, "Replicated Actor!");
auto TimeSeconds = UGameplayStatics::GetTimeSeconds(World);
const float MinOptimalDelta = 1.0f / Actor->GetNetUpdateFrequency();
const float MaxOptimalDelta = max(1.0f / Actor->GetMinNetUpdateFrequency(), MinOptimalDelta);
const float DeltaBetweenReplications = (TimeSeconds - ActorInfo->LastNetReplicateTime);
// Choose an optimal time, we choose 70% of the actual rate to allow frequency to go up if needed
ActorInfo->OptimalNetUpdateDelta = std::clamp(DeltaBetweenReplications * 0.7f, MinOptimalDelta, MaxOptimalDelta); // should we use fmath?
ActorInfo->LastNetReplicateTime = TimeSeconds;
// Choose an optimal time, we choose 70% of the actual rate to allow frequency to go up if needed
ActorInfo->OptimalNetUpdateDelta = std::clamp(DeltaBetweenReplications * 0.7f, MinOptimalDelta, MaxOptimalDelta); // should we use fmath?
ActorInfo->LastNetReplicateTime = TimeSeconds;
}
}
}
}

View File

@@ -194,6 +194,7 @@
<ClCompile Include="DataTableFunctionLibrary.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="EngineTypes.cpp" />
<ClCompile Include="finder.cpp" />
<ClCompile Include="FortAthenaCreativePortal.cpp" />
<ClCompile Include="FortAthenaMapInfo.cpp" />
<ClCompile Include="FortAthenaMutator_Barrier.cpp" />

View File

@@ -292,6 +292,9 @@
<ClCompile Include="FortLootLevel.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
<ClCompile Include="finder.cpp">
<Filter>Reboot\Private</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="log.h" />

View File

@@ -17,7 +17,7 @@ struct FRotator
float Roll;
#endif
FQuat Quaternion();
FQuat Quaternion() const;
FVector Vector() const;

View File

@@ -47,7 +47,7 @@ static FORCEINLINE void SinCos(float* ScalarSin, float* ScalarCos, float Value)
*ScalarCos = sign * p;
}
struct FQuat FRotator::Quaternion()
struct FQuat FRotator::Quaternion() const
{
#if PLATFORM_ENABLE_VECTORINTRINSICS
const VectorRegister Angles = MakeVectorRegister(Rotator.Pitch, Rotator.Yaw, Rotator.Roll, 0.0f);

View File

@@ -295,7 +295,7 @@ static AFortPlayerPawn* SpawnAIFromCustomizationData(const FVector& Location, UF
{
auto& StartupInventoryItems = StartupInventory->Get<TArray<UFortItemDefinition*>>(StartupInventoryItemsOffset);
for (int i = 0; i < StartupInventoryItems.Num(); i++)
for (int i = 0; i < StartupInventoryItems.Num(); ++i)
{
ItemsToGrant.push_back({ StartupInventoryItems.at(i), 1 });
}
@@ -304,7 +304,7 @@ static AFortPlayerPawn* SpawnAIFromCustomizationData(const FVector& Location, UF
{
auto& StartupInventoryItems = StartupInventory->Get<TArray<FItemAndCount>>(StartupInventoryItemsOffset);
for (int i = 0; i < StartupInventoryItems.Num(); i++)
for (int i = 0; i < StartupInventoryItems.Num(); ++i)
{
ItemsToGrant.push_back({ StartupInventoryItems.at(i).Item, StartupInventoryItems.at(i).Count });
}
@@ -315,7 +315,7 @@ static AFortPlayerPawn* SpawnAIFromCustomizationData(const FVector& Location, UF
if (Inventory)
{
for (int i = 0; i < ItemsToGrant.size(); i++)
for (int i = 0; i < ItemsToGrant.size(); ++i)
{
auto pair = Inventory->AddItem(ItemsToGrant.at(i).first, nullptr, ItemsToGrant.at(i).second);

View File

@@ -192,7 +192,7 @@ public:
{
auto& StartingItems = GameMode->GetStartingItems();
for (int i = 0; i < StartingItems.Num(); i++)
for (int i = 0; i < StartingItems.Num(); ++i)
{
auto& StartingItem = StartingItems.at(i);
@@ -233,7 +233,7 @@ public:
UFortItemDefinition* HeroType = FindObject<UFortItemDefinition>(L"/Game/Athena/Heroes/HID_030_Athena_Commando_M_Halloween.HID_030_Athena_Commando_M_Halloween");
for (int i = 0; i < AllHeroTypes.size(); i++)
for (int i = 0; i < AllHeroTypes.size(); ++i)
{
auto CurrentHeroType = (UFortItemDefinition*)AllHeroTypes.at(i);
@@ -303,7 +303,7 @@ namespace Bots
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
for (int i = 0; i < AmountOfBots; i++)
for (int i = 0; i < AmountOfBots; ++i)
{
FTransform SpawnTransform{};
SpawnTransform.Translation = FVector(1, 1, 10000);
@@ -336,7 +336,7 @@ namespace Bots
// auto AllBuildingContainers = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ABuildingContainer::StaticClass());
// for (int i = 0; i < GameMode->GetAlivePlayers().Num(); i++)
// for (int i = 0; i < GameMode->GetAlivePlayers().Num(); ++i)
for (auto& PlayerBot : AllPlayerBotsToTick)
{
auto CurrentPlayer = PlayerBot.Controller;

View File

@@ -137,7 +137,7 @@ namespace Builder
{
/* auto AllBuildingActors = LoadIntoVolume->GetActorsWithinVolumeByClass(ABuildingActor::StaticClass());
for (int i = 0; i < AllBuildingActors.Num(); i++)
for (int i = 0; i < AllBuildingActors.Num(); ++i)
{
auto CurrentBuildingActor = (ABuildingActor*)AllBuildingActors[i];
CurrentBuildingActor->SilentDie();

View File

@@ -80,7 +80,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
player = player.substr(firstBackslash + 1, lastBackslash - firstBackslash - 1);
for (int i = 0; i < ClientConnections.Num(); i++)
for (int i = 0; i < ClientConnections.Num(); ++i)
{
static auto PlayerControllerOffset = ClientConnections.at(i)->GetOffset("PlayerController");
auto CurrentPlayerController = Cast<AFortPlayerControllerAthena>(ClientConnections.at(i)->Get(PlayerControllerOffset));
@@ -228,7 +228,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
auto LootDrops = PickLootDrops(UKismetStringLibrary::Conv_StringToName(std::wstring(lootTierGroup.begin(), lootTierGroup.end()).c_str()), -1, true);
for (int i = 0; i < LootDrops.size(); i++)
for (int i = 0; i < LootDrops.size(); ++i)
{
}
@@ -247,7 +247,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
SendMessageToConsole(PlayerController, (L"AbilitySystemComponent->GetSpawnedAttributes().Num(): " + std::to_wstring(AbilitySystemComponent->GetSpawnedAttributes().Num())).c_str());
for (int i = 0; i < AbilitySystemComponent->GetSpawnedAttributes().Num(); i++)
for (int i = 0; i < AbilitySystemComponent->GetSpawnedAttributes().Num(); ++i)
{
auto CurrentAttributePathName = AbilitySystemComponent->GetSpawnedAttributes().at(i)->GetPathName();
SendMessageToConsole(PlayerController, (L"SpawnedAttribute Name: " + std::wstring(CurrentAttributePathName.begin(), CurrentAttributePathName.end())).c_str());
@@ -297,7 +297,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
SendMessageToConsole(PlayerController, (L"ReplicatedEntry->GetGenericAttributeValues().Num(): " + std::to_wstring(ReplicatedEntry->GetGenericAttributeValues().Num())).c_str());
SendMessageToConsole(PlayerController, (L"ReplicatedEntry->GetStateValues().Num(): " + std::to_wstring(ReplicatedEntry->GetStateValues().Num())).c_str());
for (int i = 0; i < ReplicatedEntry->GetStateValues().Num(); i++)
for (int i = 0; i < ReplicatedEntry->GetStateValues().Num(); ++i)
{
SendMessageToConsole(PlayerController, (L"[{}] StateValue Type: "
+ std::to_wstring((int)ReplicatedEntry->GetStateValues().at(i, FFortItemEntryStateValue::GetStructSize()).GetStateType())).c_str()

View File

@@ -376,6 +376,14 @@ DWORD WINAPI Main(LPVOID)
LOG_INFO(LogDev, "Fortnite_Version: {}", Fortnite_Version);
LOG_INFO(LogDev, "Engine_Version: {}", Engine_Version);
#ifdef ABOVE_S20
if (Fortnite_Version < 20)
{
MessageBoxA(0, "Please undefined ABOVE_S20", "Project Reboot 3.0", MB_ICONERROR);
return 0;
}
#endif
CreateThread(0, 0, GuiThread, 0, 0, 0);
while (SecondsUntilTravel > 0)
@@ -444,13 +452,17 @@ DWORD WINAPI Main(LPVOID)
// LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0)));
// LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0)));
/* Hooking::MinHook::Hook(FindObject<ABuildingFoundation>(L"/Script/FortniteGame.Default__BuildingFoundation"),
/*
Hooking::MinHook::Hook(FindObject<ABuildingFoundation>(L"/Script/FortniteGame.Default__BuildingFoundation"),
FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.SetDynamicFoundationTransform"),
ABuildingFoundation::SetDynamicFoundationTransformHook, (PVOID*)&ABuildingFoundation::SetDynamicFoundationTransformOriginal, false, true);
Hooking::MinHook::Hook(FindObject<ABuildingFoundation>(L"/Script/FortniteGame.Default__BuildingFoundation"),
FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.SetDynamicFoundationEnabled"),
ABuildingFoundation::SetDynamicFoundationEnabledHook, (PVOID*)&ABuildingFoundation::SetDynamicFoundationEnabledOriginal, false, true); */
ABuildingFoundation::SetDynamicFoundationEnabledHook, (PVOID*)&ABuildingFoundation::SetDynamicFoundationEnabledOriginal, false, true);
*/
/*
if (Fortnite_Version == 6.21) // ur trolling
@@ -1112,6 +1124,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View File

@@ -0,0 +1,102 @@
#include "finder.h"
#include "reboot.h"
#include "FortPlayerControllerAthena.h"
uint64 FindGetPlayerViewpoint()
{
// We find FailedToSpawnPawn and then go back on VFT by 1.
uint64 FailedToSpawnPawnAddr = 0;
auto FailedToSpawnPawnStrRefAddr = Memcury::Scanner::FindStringRef(L"%s failed to spawn a pawn", true, 0, Fortnite_Version >= 18).Get();
for (int i = 0; i < 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(FailedToSpawnPawnStrRefAddr - i) == 0x40 && *(uint8_t*)(uint8_t*)(FailedToSpawnPawnStrRefAddr - i + 1) == 0x53)
{
FailedToSpawnPawnAddr = FailedToSpawnPawnStrRefAddr - i;
break;
}
}
if (!FailedToSpawnPawnAddr)
{
LOG_ERROR(LogFinder, "Failed to find FailedToSpawnPawn! Report to Milxnor immediately.");
return 0;
}
static auto FortPlayerControllerAthenaDefault = FindObject<AFortPlayerControllerAthena>(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); // FindObject<UClass>(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C");
void** const PlayerControllerVFT = FortPlayerControllerAthenaDefault->VFTable;
int FailedToSpawnPawnIdx = 0;
for (int i = 0; i < 500; i++)
{
if (PlayerControllerVFT[i] == (void*)FailedToSpawnPawnAddr)
{
FailedToSpawnPawnIdx = i;
break;
}
}
if (FailedToSpawnPawnIdx == 0)
{
LOG_ERROR(LogFinder, "Failed to find FailedToSpawnPawn in virtual function table! Report to Milxnor immediately.");
return 0;
}
return __int64(PlayerControllerVFT[FailedToSpawnPawnIdx - 1]);
// LITERALLY KMS BRO
if (Engine_Version == 420 && Fortnite_Version < 4.5)
{
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 55 41 56 41 57 48 8B EC 48 83 EC 50").Get(); // idk why finder doesnt work and cba to debug
}
auto Addrr = Memcury::Scanner::FindStringRef(L"APlayerController::GetPlayerViewPoint: out_Location, ViewTarget=%s").Get();
LOG_INFO(LogDev, "GetPlayerViewpoint StringRef: 0x{:x}", __int64(Addrr) - __int64(GetModuleHandleW(0)));
for (int i = 0; i < Fortnite_Version >= 20 ? 2000 : 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x55)
{
LOG_INFO(LogDev, "GetPlayerViewpoint1!");
return Addrr - i;
}
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0xC4)
{
LOG_INFO(LogDev, "GetPlayerViewpoint2!");
return Addrr - i;
}
if (Fortnite_Version == 7.20 && *(uint8_t*)(uint8_t*)(Addrr - i) == 0xC3) // hmm scuffed lmfao
{
LOG_INFO(LogDev, "Hit C3!");
break;
}
}
for (int i = 0; i < 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x74)
{
LOG_INFO(LogDev, "GetPlayerViewpoint3!");
return Addrr - i;
}
}
for (int i = 0; i < 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x5C)
{
LOG_INFO(LogDev, "GetPlayerViewpoint4!");
return Addrr - i;
}
}
return 0;
}

View File

@@ -285,7 +285,6 @@ static inline uint64 FindKickPlayer()
{
if (Engine_Version == 416)
return Memcury::Scanner::FindPattern("40 53 56 48 81 EC ? ? ? ? 48 8B DA 48 8B F1 E8 ? ? ? ? 48 8B 06 48 8B CE").Get();
if (std::floor(Fortnite_Version) == 18)
return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4C 89 60 20 55 41 56 41 57 48 8B EC 48 83 EC 60 48 83 65 ? ? 4C 8B F2 83 65 E8 00 4C 8B E1 83 65 EC").Get();
if (std::floor(Fortnite_Version) == 19)
@@ -293,10 +292,6 @@ static inline uint64 FindKickPlayer()
if (Engine_Version >= 423 || Engine_Version <= 425) // && instead of || ??
return Memcury::Scanner::FindPattern("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC ? 49 8B F0 48 8B DA 48 85 D2").Get();
// return 0;
// return Memcury::Scanner::FindPattern("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC ? 49 8B F0 48 8B DA 48 85 D2").Get(); // 12.41
uint64 Ret = 0;
auto Addr = Memcury::Scanner::FindStringRef(L"Validation Failure: %s. kicking %s", false, 0, Fortnite_Version >= 19);
@@ -496,54 +491,7 @@ static inline uint64 FindGetMaxTickRate() // UEngine::getmaxtickrate
// return FindBytes(stringRef, Fortnite_Version <= 4.1 ? std::vector<uint8_t>{ 0x40, 0x53 } : std::vector<uint8_t>{ 0x48, 0x89, 0x5C }, 1000, 0, true);
}
static inline uint64 FindGetPlayerViewpoint()
{
if (Engine_Version == 420 && Fortnite_Version < 4.5)
{
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 55 41 56 41 57 48 8B EC 48 83 EC 50").Get(); // idk why finder doesnt work and cba to debug
}
auto Addrr = Memcury::Scanner::FindStringRef(L"APlayerController::GetPlayerViewPoint: out_Location, ViewTarget=%s").Get();
LOG_INFO(LogDev, "GetPlayerViewpoint StringRef: 0x{:x}", __int64(Addrr) - __int64(GetModuleHandleW(0)));
for (int i = 0; i < 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x55)
{
return Addrr - i;
}
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0xC4)
{
return Addrr - i;
}
if (Fortnite_Version == 7.20 && *(uint8_t*)(uint8_t*)(Addrr - i) == 0xC3) // hmm scuffed lmfao
{
LOG_INFO(LogDev, "Hit C3!");
break;
}
}
for (int i = 0; i < 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x74)
{
return Addrr - i;
}
}
for (int i = 0; i < 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x5C)
{
return Addrr - i;
}
}
return 0;
}
uint64 FindGetPlayerViewpoint();
static inline uint64 FindFree()
{
@@ -841,7 +789,14 @@ static inline uint64 FindCompletePickupAnimation()
}
if (Engine_Version == 500)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 55 57 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 48 8B B9").Get(); // 19.10
{
auto addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 55 57 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 48 8B B9", false).Get(); // 19.10;
if (!addr)
addr = Memcury::Scanner::FindPattern("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 48 8B B9 ? ? ? ? 45 33 E4 48 8B D9 48 85 FF 74 0F").Get(); // 20.40
return addr;
}
return 0;
}
@@ -1144,9 +1099,14 @@ static inline uint64 FindActorGetNetMode()
{
// return 0;
if (Engine_Version == 500)
if (Engine_Version == 500) // hah well this and 427 does like nothing cuz inline mostly
{
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 F6 41 08 10 48 8B D9 0F 85 ? ? ? ? 48 8B 41 20 48 85 C0 0F 84 ? ? ? ? F7 40").Get();
auto addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 F6 41 08 10 48 8B D9 0F 85 ? ? ? ? 48 8B 41 20 48 85 C0 0F 84 ? ? ? ? F7 40", false).Get();
if (!addr)
addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 F6 41 08 10 48 8B D9 0F 85").Get(); // 20.40
return addr;
}
if (Engine_Version == 427)
@@ -1493,37 +1453,12 @@ static inline uint64 FindMcpIsDedicatedServerOffset()
static inline uint64 FindGIsClient()
{
if (Fortnite_Version >= 20)
return 0;
// if (Fortnite_Version == 2.5)
// return __int64(GetModuleHandleW(0)) + 0x46AD734;
/* if (Fortnite_Version == 1.72)
return __int64(GetModuleHandleW(0)) + 0x6536B65;
if (Fortnite_Version == 1.8)
return __int64(GetModuleHandleW(0)) + 0x66637E5;
if (Fortnite_Version == 1.11)
return __int64(GetModuleHandleW(0)) + 0x5BAA38F;
if (Fortnite_Version == 4.1)
return __int64(GetModuleHandleW(0)) + 0x4BF6F17;
if (Fortnite_Version == 10.40)
return __int64(GetModuleHandleW(0)) + 0x637925B;
if (Fortnite_Version == 11.31)
return __int64(GetModuleHandleW(0)) + 0x6F41270;
if (Fortnite_Version == 12.41)
return __int64(GetModuleHandleW(0)) + 0x804B659;
if (Fortnite_Version == 12.61)
return __int64(GetModuleHandleW(0)) + 0x8237B86;
if (Fortnite_Version == 14.60)
return __int64(GetModuleHandleW(0)) + 0x939930D;
if (Fortnite_Version == 17.30)
return __int64(GetModuleHandleW(0)) + 0x973E49B; */
// return 0;
/* if (Fortnite_Version >= 20)
return 0; */
auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering");
std::vector<std::vector<uint8_t>> BytesArray = {{0xC6, 0x05}, {0x88, 0x1D}, { 0x44, 0x88 } };
std::vector<std::vector<uint8_t>> BytesArray = { {0x88, 0x05}, {0xC6, 0x05}, {0x88, 0x1D}, {0x44, 0x88}};
int Skip = Engine_Version <= 420 ? 1 : 2;
@@ -1627,7 +1562,7 @@ static inline uint64 FindGetNetMode()
static inline uint64 FindApplyCharacterCustomization()
{
auto Addrr = Memcury::Scanner::FindStringRef(L"AFortPlayerState::ApplyCharacterCustomization - Failed initialization, using default parts. Player Controller: %s PlayerState: %s, HeroId: %s", false).Get();
auto Addrr = Memcury::Scanner::FindStringRef(L"AFortPlayerState::ApplyCharacterCustomization - Failed initialization, using default parts. Player Controller: %s PlayerState: %s, HeroId: %s", false, 0, Fortnite_Version >= 20, true).Get();
if (!Addrr)
return 0;
@@ -1838,7 +1773,7 @@ static inline uint64 FindCantBuild()
add = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 4D 8B F1 4D 8B F8", false).Get(); // 4.26.1
if (!add)
add = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 49 8B E9 4D 8B F8 48 8B DA 48 8B F9 BE ? ? ? ? 48").Get(); // 5.00
add = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 49 8B E9 4D 8B F8 48 8B DA 48 8B F9 BE ? ? ? ? 48", false).Get(); // 5.00
if (!add)
add = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 70 49 8B E9 4D 8B F8 48 8B DA 48 8B F9").Get(); // 20.00

View File

@@ -61,12 +61,14 @@
#define LOADOUT_PLAYERTAB 4
#define FUN_PLAYERTAB 5
extern inline int AmountToSubtractIndex = 1;
extern inline int SecondsUntilTravel = 5;
extern inline bool bSwitchedInitialLevel = false;
extern inline bool bIsInAutoRestart = false;
extern inline float AutoBusStartSeconds = 60;
extern inline int NumRequiredPlayersToStart = 2;
extern inline bool bDebugPrintLooting = false;
extern inline bool bDebugPrintFloorLoot = false;
extern inline bool bDebugPrintSwapping = false;
extern inline bool bEnableBotTick = false;
extern inline bool bEnableCombinePickup = false;
@@ -102,7 +104,7 @@ static inline void Restart() // todo move?
static auto BeaconClass = FindObject<UClass>(L"/Script/FortniteGame.FortOnlineBeaconHost");
auto AllFortBeacons = UGameplayStatics::GetAllActorsOfClass(GetWorld(), BeaconClass);
for (int i = 0; i < AllFortBeacons.Num(); i++)
for (int i = 0; i < AllFortBeacons.Num(); ++i)
{
AllFortBeacons.at(i)->K2_DestroyActor();
}
@@ -569,7 +571,7 @@ static inline void MainUI()
static auto mutatorClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaMutator");
auto AllMutators = UGameplayStatics::GetAllActorsOfClass(GetWorld(), mutatorClass);
for (int i = 0; i < AllMutators.Num(); i++)
for (int i = 0; i < AllMutators.Num(); ++i)
{
auto Mutator = AllMutators.at(i);
@@ -1151,10 +1153,21 @@ static inline void MainUI()
ImGui::Checkbox("Fill Vending Machines", &Globals::bFillVendingMachines);
ImGui::Checkbox("Enable Bot Tick", &bEnableBotTick);
ImGui::Checkbox("Enable Combine Pickup", &bEnableCombinePickup);
ImGui::InputInt("Amount To Subtract Index", &AmountToSubtractIndex);
ImGui::InputText("Class Name to mess with", &ClassNameToDump);
ImGui::InputText("Function Name to mess with", &FunctionNameToDump);
if (ImGui::Button("Print Gamephase Step"))
{
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
if (GameState)
{
LOG_INFO(LogDev, "GamePhaseStep: {}", (int)GameState->GetGamePhaseStep());
}
}
if (ImGui::Button("Find all classes that inherit"))
{
auto ClassToScuff = FindObject<UClass>(ClassNameToDump);
@@ -1244,6 +1257,7 @@ static inline void MainUI()
}
else if (Tab == DEBUGLOG_TAB)
{
ImGui::Checkbox("Floor Loot Debug Log", &bDebugPrintFloorLoot);
ImGui::Checkbox("Looting Debug Log", &bDebugPrintLooting);
ImGui::Checkbox("Swapping Debug Log", &bDebugPrintSwapping);
ImGui::Checkbox("Engine Debug Log", &bEngineDebugLogs);

View File

@@ -6,6 +6,8 @@
#include "memcury.h"
#include "Class.h"
#include "reboot.h"
struct FunctionHooks
{
void* Original;

View File

@@ -152,9 +152,7 @@ inline uint8_t GetFieldMask(void* Property, int additional = 0)
// 3 = sizeof(FieldSize) + sizeof(ByteOffset) + sizeof(ByteMask)
if (Engine_Version <= 420)
return *(uint8_t*)(__int64(Property) + (112 + 3 + additional));
else if (Engine_Version >= 421 && Engine_Version <= 424)
if (Engine_Version <= 424 || Fortnite_Version >= 20)
return *(uint8_t*)(__int64(Property) + (112 + 3 + additional));
else if (Engine_Version >= 425)
return *(uint8_t*)(__int64(Property) + (120 + 3 + additional));

9
vendor/memcury.h vendored
View File

@@ -50,6 +50,7 @@
#include <DbgHelp.h>
#pragma comment(lib, "Dbghelp.lib")
#include "../Project Reboot 3.0/log.h"
#include "../Project Reboot 3.0/inc.h"
#define MemcuryAssert(cond) \
@@ -811,7 +812,8 @@
{
if (add == 0)
{
MessageBoxA(0, "FindPointerRef return nullptr", "Memcury", MB_OK);
LOG_WARN(LogMemory, "FindPointerRef return nullptr");
// MessageBoxA(0, "FindPointerRef return nullptr", "Memcury", MB_OK);
}
else
{
@@ -824,7 +826,7 @@
// Supports wide and normal strings both std and pointers
template <typename T = const wchar_t*>
static auto FindStringRef(T string, bool bWarnIfNotFound = true, int useRefNum = 0, bool bIsInFunc = false) -> Scanner
static auto FindStringRef(T string, bool bWarnIfNotFound = true, int useRefNum = 0, bool bIsInFunc = false, bool bSkunky = false) -> Scanner
{
PE::Address add{ nullptr };
@@ -930,7 +932,8 @@
{
for (int i = 0; i < 300; i++)
{
if (*(uint8_t*)(add.Get() - i) == 0x48 && *(uint8_t*)(add.Get() - i + 1) == 0x83)
if (!bSkunky ? (*(uint8_t*)(add.Get() - i) == 0x48 && *(uint8_t*)(add.Get() - i + 1) == 0x83) :
(*(uint8_t*)(add.Get() - i) == 0x4C && *(uint8_t*)(add.Get() - i + 1) == 0x8B && *(uint8_t*)(add.Get() - i + 2) == 0xDC))
{
// MessageBoxA(0, std::format("0x{:x}", (__int64(add.Get() - i) - __int64(GetModuleHandleW(0)))).c_str(), "Memcury", MB_OK);