From fa6fac754aa7bee25aad64f3092ad3982e558b46 Mon Sep 17 00:00:00 2001 From: Milxnor Date: Mon, 3 Apr 2023 12:10:18 -0400 Subject: [PATCH] fix winning 1.11, added cheat listplayers --- Project Reboot 3.0/FortGameModeAthena.cpp | 47 +++++++++++---------- Project Reboot 3.0/FortGameStateAthena.cpp | 3 +- Project Reboot 3.0/FortPlayerController.cpp | 38 +++++++++++------ Project Reboot 3.0/commands.h | 21 +++++++++ Project Reboot 3.0/dllmain.cpp | 4 +- 5 files changed, 75 insertions(+), 38 deletions(-) diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index bbaa0a3..e121209 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -693,30 +693,33 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena bool bPrintWarmup = false; - for (int i = 0; i < SpawnIsland_FloorLoot_Actors.Num(); i++) + if (false) { - ABuildingContainer* CurrentActor = (ABuildingContainer*)SpawnIsland_FloorLoot_Actors.at(i); - - // CurrentActor->K2_DestroyActor(); - // continue; - - auto Location = CurrentActor->GetActorLocation(); - Location.Z += UpZ; - - std::vector LootDrops = PickLootDrops(SpawnIslandTierGroup, bPrintWarmup); - - if (bPrintWarmup) + for (int i = 0; i < SpawnIsland_FloorLoot_Actors.Num(); i++) { - std::cout << "\n\n"; - } + ABuildingContainer* CurrentActor = (ABuildingContainer*)SpawnIsland_FloorLoot_Actors.at(i); - if (LootDrops.size()) - { - for (auto& LootDrop : LootDrops) - AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo); - } + // CurrentActor->K2_DestroyActor(); + // continue; - CurrentActor->K2_DestroyActor(); + auto Location = CurrentActor->GetActorLocation(); + Location.Z += UpZ; + + std::vector LootDrops = PickLootDrops(SpawnIslandTierGroup, bPrintWarmup); + + if (bPrintWarmup) + { + std::cout << "\n\n"; + } + + if (LootDrops.size()) + { + for (auto& LootDrop : LootDrops) + AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo); + } + + CurrentActor->K2_DestroyActor(); + } } bool bPrint = false; @@ -750,9 +753,9 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena // SpawnIsland_FloorLoot_Actors.Free(); // BRIsland_FloorLoot_Actors.Free(); - } - LOG_INFO(LogDev, "Spawned loot!"); + LOG_INFO(LogDev, "Spawned loot!"); + } } if (Engine_Version >= 423 && Fortnite_Version <= 12.41) // 423+ we need to spawn manually and vehicle sync doesn't work on >S13. diff --git a/Project Reboot 3.0/FortGameStateAthena.cpp b/Project Reboot 3.0/FortGameStateAthena.cpp index b1ad031..d1fdd9e 100644 --- a/Project Reboot 3.0/FortGameStateAthena.cpp +++ b/Project Reboot 3.0/FortGameStateAthena.cpp @@ -62,7 +62,8 @@ bool AFortGameStateAthena::IsRespawningAllowed(AFortPlayerState* PlayerState) // if (!IsRespawningAllowedFn) { - auto CurrentPlaylist = GetCurrentPlaylist(); + static auto CurrentPlaylistDataOffset = GetOffset("CurrentPlaylistData", false); + auto CurrentPlaylist = CurrentPlaylistDataOffset == -1 && Fortnite_Version < 6 ? nullptr : GetCurrentPlaylist(); if (!CurrentPlaylist) return false; diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 865ad28..433a0a8 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -623,7 +623,7 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe GiveAbilityAndActivateOnce(PlayerState->GetAbilitySystemComponent(), &outHandle, __int64(Spec), nullptr); } -uint8 ToDeathCause(const FGameplayTagContainer& TagContainer, bool bWasDBNO = false) +uint8 ToDeathCause(const FGameplayTagContainer& TagContainer, bool bWasDBNO = false, AFortPawn* Pawn = nullptr) { static auto ToDeathCauseFn = FindObject("/Script/FortniteGame.FortPlayerStateAthena.ToDeathCause"); @@ -649,6 +649,8 @@ uint8 ToDeathCause(const FGameplayTagContainer& TagContainer, bool bWasDBNO = fa { bHaveFoundAddress = true; + if (Engine_Version == 419) + Addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 41 0F B6 F8 48 8B DA 48 8B F1 E8 ? ? ? ? 33 ED").Get(); if (Engine_Version == 420) Addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 0F B6 FA 48 8B D9 E8 ? ? ? ? 33 F6 48 89 74 24").Get(); @@ -667,6 +669,12 @@ uint8 ToDeathCause(const FGameplayTagContainer& TagContainer, bool bWasDBNO = fa return 0; } + if (Engine_Version == 419) + { + static uint8(*sub_7FF7AB499410)(AFortPawn* Pawn, FGameplayTagContainer TagContainer, char bWasDBNOIg) = decltype(sub_7FF7AB499410)(Addr); + return sub_7FF7AB499410(Pawn, TagContainer, bWasDBNO); + } + static uint8 (*sub_7FF7AB499410)(FGameplayTagContainer TagContainer, char bWasDBNOIg) = decltype(sub_7FF7AB499410)(Addr); return sub_7FF7AB499410(TagContainer, bWasDBNO); } @@ -698,7 +706,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo // LOG_INFO(LogDev, "Tags: {}", Tags.ToStringSimple(true)); - auto DeathCause = ToDeathCause(Tags, false); // DeadPawn->IsDBNO() ?? + auto DeathCause = ToDeathCause(Tags, false, DeadPawn); // DeadPawn->IsDBNO() ?? LOG_INFO(LogDev, "DeathCause: {}", (int)DeathCause); @@ -722,7 +730,8 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo } else { - *(float*)(__int64(DeathInfo) + MemberOffsets::DeathInfo::Distance) = KillerPawn ? KillerPawn->GetDistanceTo(DeadPawn) : 0; + if (MemberOffsets::DeathInfo::Distance != -1) + *(float*)(__int64(DeathInfo) + MemberOffsets::DeathInfo::Distance) = KillerPawn ? KillerPawn->GetDistanceTo(DeadPawn) : 0; } if (MemberOffsets::FortPlayerState::PawnDeathLocation != -1) @@ -819,15 +828,18 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo static auto FortProjectileBaseClass = FindObject("/Script/FortniteGame.FortProjectileBase"); LOG_INFO(LogDev, "FortProjectileBaseClass: {}", __int64(FortProjectileBaseClass)); - if (DamageCauser->IsA(FortProjectileBaseClass)) + if (DamageCauser) { - LOG_INFO(LogDev, "From a projectile!"); - KillerWeaponDef = ((AFortWeapon*)DamageCauser->GetOwner())->GetWeaponData(); - } - if (auto Weapon = Cast(DamageCauser)) - { - LOG_INFO(LogDev, "From a weapon!"); - KillerWeaponDef = Weapon->GetWeaponData(); + if (DamageCauser->IsA(FortProjectileBaseClass)) + { + LOG_INFO(LogDev, "From a projectile!"); + KillerWeaponDef = ((AFortWeapon*)DamageCauser->GetOwner())->GetWeaponData(); + } + if (auto Weapon = Cast(DamageCauser)) + { + LOG_INFO(LogDev, "From a weapon!"); + KillerWeaponDef = Weapon->GetWeaponData(); + } } // LOG_INFO(LogDev, "KillerWeaponDef: {}", KillerWeaponDef ? KillerWeaponDef->GetFullName() : "InvalidObject"); @@ -838,11 +850,11 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo { LOG_INFO(LogDev, "Starting Spectating!"); - /* static auto PlayerToSpectateOnDeathOffset = PlayerController->GetOffset("PlayerToSpectateOnDeath"); + static auto PlayerToSpectateOnDeathOffset = PlayerController->GetOffset("PlayerToSpectateOnDeath"); PlayerController->Get(PlayerToSpectateOnDeathOffset) = KillerPawn; static auto SpectateOnDeathFn = FindObject("/Script/FortniteGame.FortPlayerControllerZone.SpectateOnDeath") ? FindObject("/Script/FortniteGame.FortPlayerControllerZone.SpectateOnDeath") : FindObject("/Script/FortniteGame.FortPlayerControllerAthena.SpectateOnDeath"); - PlayerController->ProcessEvent(SpectateOnDeathFn); */ + PlayerController->ProcessEvent(SpectateOnDeathFn); } } } diff --git a/Project Reboot 3.0/commands.h b/Project Reboot 3.0/commands.h index 4360c0d..d6edb77 100644 --- a/Project Reboot 3.0/commands.h +++ b/Project Reboot 3.0/commands.h @@ -185,6 +185,27 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) SendMessageToConsole(PlayerController, L"Granted item!"); } + else if (Command == "listplayers") + { + std::string PlayerNames; + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPlayerController = Cast(ClientConnections.at(i)->Get("PlayerController")); + + if (!CurrentPlayerController) + continue; + + auto CurrentPlayerState = Cast(CurrentPlayerController->GetPlayerState()); + + if (!CurrentPlayerState) + continue; + + PlayerNames += "\"" + CurrentPlayerState->GetPlayerName().ToString() + "\" "; + } + + SendMessageToConsole(PlayerController, std::wstring(PlayerNames.begin(), PlayerNames.end()).c_str()); + } else if (Command == "launch") { if (Arguments.size() <= 3) diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index efcfc0e..a39f44e 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -555,7 +555,7 @@ DWORD WINAPI Main(LPVOID) AddVehicleHook(); - if (Fortnite_Version > 1.8) + if (Fortnite_Version > 1.8 || Fortnite_Version == 1.11) { LOG_INFO(LogDev, "ahh!"); LOG_INFO(LogDev, "Test: 0x{:x}", FindFunctionCall(L"ClientOnPawnDied") - __int64(GetModuleHandleW(0))); @@ -587,7 +587,7 @@ DWORD WINAPI Main(LPVOID) MemberOffsets::DeathInfo::bDBNO = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "bDBNO"); MemberOffsets::DeathInfo::DeathCause = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "DeathCause"); MemberOffsets::DeathInfo::bInitialized = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "bInitialized", false); - MemberOffsets::DeathInfo::Distance = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "Distance"); + MemberOffsets::DeathInfo::Distance = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "Distance", false); MemberOffsets::DeathInfo::DeathTags = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "DeathTags", false); MemberOffsets::DeathInfo::DeathLocation = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "DeathLocation", false);