From 9d9412f103a7ebf68b26f5e837099b3145264c80 Mon Sep 17 00:00:00 2001 From: Milxnor Date: Mon, 22 May 2023 07:53:32 -0400 Subject: [PATCH] fix 2.3 and 2.4 and 3.5 --- .../FortAthenaAIBotCustomizationData.h | 22 +++++++++++++++---- Project Reboot 3.0/FortPlayerController.cpp | 2 +- Project Reboot 3.0/addresses.cpp | 8 +++++-- Project Reboot 3.0/bots.h | 2 +- Project Reboot 3.0/globals.h | 2 ++ Project Reboot 3.0/gui.h | 1 - Project Reboot 3.0/vendingmachine.h | 10 +++++++++ 7 files changed, 38 insertions(+), 9 deletions(-) diff --git a/Project Reboot 3.0/FortAthenaAIBotCustomizationData.h b/Project Reboot 3.0/FortAthenaAIBotCustomizationData.h index 0c43558..ae2ac00 100644 --- a/Project Reboot 3.0/FortAthenaAIBotCustomizationData.h +++ b/Project Reboot 3.0/FortAthenaAIBotCustomizationData.h @@ -12,16 +12,30 @@ public: return Get(CharacterCustomizationOffset); } - /* static void ApplyOverrideCharacterCustomizationHook(UFortAthenaAIBotCustomizationData* InBotData, AFortPlayerPawn* NewBot, __int64 idk) + static void ApplyOverrideCharacterCustomizationHook(UFortAthenaAIBotCustomizationData* InBotData, AFortPlayerPawn* NewBot, __int64 idk) { LOG_INFO(LogDev, "ApplyOverrideCharacterCustomizationHook!"); auto CharacterCustomization = InBotData->GetCharacterCustomization(); - NewBot->GetCosmeticLoadout()->GetCharacter() = CharacterCustomization->GetCustomizationLoadout()->GetCharacter(); + auto Controller = NewBot->GetController(); - NewBot->Get(0x1B30) = true; // idk this is like a initialize check - } */ + LOG_INFO(LogDev, "Controller: {}", Controller->IsValidLowLevel() ? Controller->GetPathName() : "BadRead"); + + static auto CosmeticLoadoutBCOffset = Controller->GetOffset("CosmeticLoadoutBC"); + Controller->GetPtr(CosmeticLoadoutBCOffset)->GetCharacter() = CharacterCustomization->GetCustomizationLoadout()->GetCharacter(); + + auto PlayerStateAsFort = Cast(Controller->GetPlayerState()); + + static auto UpdatePlayerCustomCharacterPartsVisualizationFn = FindObject(L"/Script/FortniteGame.FortKismetLibrary.UpdatePlayerCustomCharacterPartsVisualization"); + PlayerStateAsFort->ProcessEvent(UpdatePlayerCustomCharacterPartsVisualizationFn, &PlayerStateAsFort); + + PlayerStateAsFort->ForceNetUpdate(); + NewBot->ForceNetUpdate(); + Controller->ForceNetUpdate(); + + // NewBot->GetCosmeticLoadout()->GetCharacter() = CharacterCustomization->GetCustomizationLoadout()->GetCharacter(); + } static UClass* StaticClass() { diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index e62c963..2ef95a9 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -139,7 +139,7 @@ void AFortPlayerController::ApplyCosmeticLoadout() if (!PawnAsFort) return; - static auto UpdatePlayerCustomCharacterPartsVisualizationFn = FindObject("/Script/FortniteGame.FortKismetLibrary.UpdatePlayerCustomCharacterPartsVisualization"); + static auto UpdatePlayerCustomCharacterPartsVisualizationFn = FindObject(L"/Script/FortniteGame.FortKismetLibrary.UpdatePlayerCustomCharacterPartsVisualization"); if (!UpdatePlayerCustomCharacterPartsVisualizationFn) { diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index 34aeec7..f2b64f1 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -100,6 +100,10 @@ void Addresses::SetupVersion() Fortnite_Version = 1.9; if (Fortnite_CL == 3841827) Fortnite_Version = 2.2; + if (Fortnite_CL == 3847564) + Fortnite_Version = 2.3; + if (Fortnite_CL == 3858292) + Fortnite_Version = 2.4; if (Fortnite_CL == 3870737) Fortnite_Version = 2.42; @@ -438,7 +442,7 @@ void Offsets::FindAll() { Offsets::ClientWorldPackageName = 0x337B8; } - if (Fortnite_Version == 2.20) + if (Fortnite_Version >= 2.2 && Fortnite_Version <= 2.4) // 2.2 & 2.4 { Offsets::ClientWorldPackageName = 0xA17A8; } @@ -514,7 +518,7 @@ std::vector Addresses::GetFunctionsToNull() toNull.push_back(Memcury::Scanner::FindPattern("48 89 54 24 ? 48 89 4C 24 ? 55 53 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 8B 41 08 C1 E8 05").Get()); // Widget class } - if (Fortnite_Version == 1.11 || Fortnite_Version == 2.2) + if (Fortnite_Version == 1.11 || Fortnite_Version >= 2.2 && Fortnite_Version <= 2.4) { toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 57 41 56 41 57 48 81 EC ? ? ? ? 48 8B 01 49 8B E9 45 0F B6 F8").Get()); // No Reserve } diff --git a/Project Reboot 3.0/bots.h b/Project Reboot 3.0/bots.h index d745be7..82f05c7 100644 --- a/Project Reboot 3.0/bots.h +++ b/Project Reboot 3.0/bots.h @@ -76,7 +76,7 @@ public: static auto SquadIdOffset = PlayerState->GetOffset("SquadId", false); if (SquadIdOffset != -1) - PlayerState->GetSquadId() = PlayerState->GetTeamIndex() - 2; // NumToSubtractFromSquadId; + PlayerState->GetSquadId() = PlayerState->GetTeamIndex() - NumToSubtractFromSquadId; GameState->AddPlayerStateToGameMemberInfo(PlayerState); diff --git a/Project Reboot 3.0/globals.h b/Project Reboot 3.0/globals.h index 0b38a5e..ca18762 100644 --- a/Project Reboot 3.0/globals.h +++ b/Project Reboot 3.0/globals.h @@ -25,6 +25,8 @@ namespace Globals extern inline int AmountOfListens = 0; // TODO: Switch to this for LastNum } +extern inline int NumToSubtractFromSquadId = 0; // I think 2? + extern inline std::string PlaylistName = "/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo"; // "/Game/Athena/Playlists/gg/Playlist_Gg_Reverse.Playlist_Gg_Reverse"; diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index e980997..e19548a 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -59,7 +59,6 @@ #define LOADOUT_PLAYERTAB 4 #define FUN_PLAYERTAB 5 -extern inline int NumToSubtractFromSquadId = 0; // I think 2? extern inline int SecondsUntilTravel = 5; extern inline bool bSwitchedInitialLevel = false; extern inline bool bIsInAutoRestart = false; diff --git a/Project Reboot 3.0/vendingmachine.h b/Project Reboot 3.0/vendingmachine.h index 5f82182..f6d0412 100644 --- a/Project Reboot 3.0/vendingmachine.h +++ b/Project Reboot 3.0/vendingmachine.h @@ -112,8 +112,16 @@ static inline void FillItemCollector(ABuildingItemCollectorActor* ItemCollector, LegendaryPrice = 0; } + int itemCollectorRecursive = 0; + for (int ItemCollectorIt = 0; ItemCollectorIt < ItemCollections.Num(); ItemCollectorIt++) { + if (itemCollectorRecursive > 3) + { + itemCollectorRecursive = 0; + continue; + } + auto ItemCollection = ItemCollections.AtPtr(ItemCollectorIt, FCollectorUnitInfo::GetPropertiesSize()); if (ItemCollection->GetOutputItemEntry()->Num() > 0) @@ -130,6 +138,7 @@ static inline void FillItemCollector(ABuildingItemCollectorActor* ItemCollector, { // LOG_WARN(LogGame, "Failed to find LootDrops for vending machine loot tier: {}", LootTier); ItemCollectorIt--; // retry (?) + itemCollectorRecursive++; continue; } @@ -167,6 +176,7 @@ static inline void FillItemCollector(ABuildingItemCollectorActor* ItemCollector, if (!ItemCollection->GetOutputItem()) { ItemCollectorIt--; // retry + itemCollectorRecursive++; continue; }