From d427e60df3216b5350fdc7d4fae3a388abe2ce3b Mon Sep 17 00:00:00 2001 From: Milxnor Date: Mon, 5 Jun 2023 18:51:57 -0400 Subject: [PATCH] respawn button and "suicide" in console (no cheat) --- Project Reboot 3.0/FortPlayerController.cpp | 26 +++++++++ Project Reboot 3.0/FortPlayerController.h | 2 + Project Reboot 3.0/Project Reboot 3.0.vcxproj | 1 + .../Project Reboot 3.0.vcxproj.filters | 3 + Project Reboot 3.0/calendar.h | 47 ++++++++++++--- Project Reboot 3.0/dllmain.cpp | 3 + Project Reboot 3.0/gui.h | 57 +++++++++++++++++-- Project Reboot 3.0/objectviewer.h | 2 + 8 files changed, 129 insertions(+), 12 deletions(-) create mode 100644 Project Reboot 3.0/objectviewer.h diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index b2611d5..69a638c 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -711,6 +711,32 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* // return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); } +void AFortPlayerController::ServerSuicideHook(AFortPlayerController* PlayerController) +{ + auto Pawn = PlayerController->GetPawn(); + + if (!Pawn) + return; + + // theres some other checks here idk + + if (!Pawn->IsA(AFortPlayerPawn::StaticClass())) // Why FortPlayerPawn? Ask Fortnite + return; + + // suicide doesn't actually call force kill but its basically the same function + + static auto ForceKillFn = FindObject(L"/Script/FortniteGame.FortPawn.ForceKill"); // exists on 1.2 and 19.10 with same params so I assume it's the same on every other build. + + FGameplayTag DeathReason; // unused on 1.7.2 + AActor* KillerActor = nullptr; // its just 0 in suicide (not really but easiest way to explain it) + + struct { FGameplayTag DeathReason; AController* KillerController; AActor* KillerActor; } AFortPawn_ForceKill_Params{ DeathReason, PlayerController, KillerActor }; + + Pawn->ProcessEvent(ForceKillFn, &AFortPawn_ForceKill_Params); + + //PlayerDeathReport->ServerTimeForRespawn && PlayerDeathReport->ServerTimeForResurrect = 0? // I think this is what they do on 1.7.2 I'm too lazy to double check though. +} + void AFortPlayerController::ServerDropAllItemsHook(AFortPlayerController* PlayerController, UFortItemDefinition* IgnoreItemDef) { LOG_INFO(LogDev, "DropAllItems!"); diff --git a/Project Reboot 3.0/FortPlayerController.h b/Project Reboot 3.0/FortPlayerController.h index 441ae65..9458e0c 100644 --- a/Project Reboot 3.0/FortPlayerController.h +++ b/Project Reboot 3.0/FortPlayerController.h @@ -140,6 +140,8 @@ public: void DropAllItems(const std::vector& IgnoreItemDefs, bool bIgnoreSecondaryQuickbar = false, bool bRemoveIfNotDroppable = false, bool RemovePickaxe = false); void ApplyCosmeticLoadout(); + static void ServerSuicideHook(AFortPlayerController* PlayerController); + static void ServerLoadingScreenDroppedHook(UObject* Context, FFrame* Stack, void* Ret); static void ServerRepairBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToRepair); static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid); diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj b/Project Reboot 3.0/Project Reboot 3.0.vcxproj index 35b470d..f33e25d 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj @@ -432,6 +432,7 @@ + diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters index 4e23df4..ba02b97 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -939,6 +939,9 @@ FortniteGame\Source\FortniteGame\Public\Athena\Vehicle + + Reboot\Public + diff --git a/Project Reboot 3.0/calendar.h b/Project Reboot 3.0/calendar.h index abc8031..89b554d 100644 --- a/Project Reboot 3.0/calendar.h +++ b/Project Reboot 3.0/calendar.h @@ -13,7 +13,9 @@ namespace Calendar static inline UObject* GetSnowSetup() { - auto Class = FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C"); + auto Class = FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C") ? FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C") : + FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C"); + auto Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), Class); return Actors.Num() > 0 ? Actors.at(0) : nullptr; @@ -30,24 +32,55 @@ namespace Calendar // 15; return TimeAndValues[3].first; } + else if (Fortnite_Version == 11.31) + { + return 100; + } return -1; } static inline void SetSnow(float NewValue) { - static auto SetSnowFn = FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow"); + static auto SetSnowFn = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_0A511B314AE165C51798519FB84738B8") ? FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_0A511B314AE165C51798519FB84738B8") : + FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow"); auto SnowSetup = GetSnowSetup(); LOG_INFO(LogDev, "SnowSetup: {}", SnowSetup->IsValidLowLevel() ? SnowSetup->GetFullName() : "BadRead"); - if (SnowSetup) + if (SnowSetup && SetSnowFn) { - static auto OnReady_347B1F4D45630C357605FCB417D749A3Fn = FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.OnReady_347B1F4D45630C357605FCB417D749A3"); - auto GameState = GetWorld()->GetGameState(); - SnowSetup->ProcessEvent(OnReady_347B1F4D45630C357605FCB417D749A3Fn, &GameState); + auto GameState = (AFortGameStateAthena*)GetWorld()->GetGameState(); - SnowSetup->ProcessEvent(SetSnowFn, &NewValue); + GET_PLAYLIST(GameState) + struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ GameState, CurrentPlaylist, FGameplayTagContainer()}; + + UFunction* OnReadyFunc = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_0A511B314AE165C51798519FB84738B8"); + + LOG_INFO(LogDev, "Calling OnReady!"); + + if (OnReadyFunc) + { + SnowSetup->ProcessEvent(OnReadyFunc, &OnReadyParams); + } + + LOG_INFO(LogDev, "Called OnReady!"); + + if (NewValue != -1) + { + static auto SnowAmountOffset = SnowSetup->GetOffset("SnowAmount"); + SnowSetup->Get(SnowAmountOffset) = NewValue; + + static auto OnRep_Snow_AmountFn = FindObject("/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnRep_Snow_Amount"); + SnowSetup->ProcessEvent(OnRep_Snow_AmountFn); + + // SnowSetup->ProcessEvent(SetSnowFn, &NewValue); + } + + LOG_INFO(LogDev, "Called SetSnow!"); + + static auto ada = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFullSnowEd"); + SnowSetup->ProcessEvent(ada); } } } \ No newline at end of file diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 465b196..e65f583 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -653,6 +653,9 @@ DWORD WINAPI Main(LPVOID) auto FortServerRestartPlayer = FortPlayerControllerDefault->VFTable[ServerReturnToMainMenuIdx]; VirtualSwap(FortPlayerControllerAthenaDefault->VFTable, ServerReturnToMainMenuIdx, FortServerRestartPlayer); + Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerSuicide"), + AFortPlayerController::ServerSuicideHook, nullptr, false); + // HookInstruction(Addresses::UpdateTrackedAttributesLea, (PVOID)AFortPlayerControllerAthena::UpdateTrackedAttributesHook, "/Script/Engine.PlayerController.EnableCheats", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault); // HookInstruction(Addresses::CombinePickupLea, (PVOID)AFortPickup::CombinePickupHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault); diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index d2a33ef..709d172 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -50,10 +50,11 @@ #define DUMP_TAB 7 #define UNBAN_TAB 8 #define FUN_TAB 9 -#define DEVELOPER_TAB 10 -#define DEBUGLOG_TAB 11 -#define SETTINGS_TAB 12 -#define CREDITS_TAB 13 +#define LATEGAME_TAB 10 +#define DEVELOPER_TAB 11 +#define DEBUGLOG_TAB 12 +#define SETTINGS_TAB 13 +#define CREDITS_TAB 14 #define MAIN_PLAYERTAB 1 #define INVENTORY_PLAYERTAB 2 @@ -374,6 +375,14 @@ static inline void MainTabs() ImGui::EndTabItem(); } + if (Globals::bLateGame.load() && ImGui::BeginTabItem("Lategame")) + { + Tab = LATEGAME_TAB; + PlayerTab = -1; + bInformationTab = false; + ImGui::EndTabItem(); + } + #if 0 if (bannedStream.is_open() && ImGui::BeginTabItem("Unban")) // skunked { @@ -769,8 +778,43 @@ static inline void MainUI() UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr); SafeZoneIndicator->SkipShrinkSafeZone(); - Sleep(1000); + bool bBreak = false; + int a = 0; + + while (!bBreak) + { + for (int z = 0; z < ClientConnections.Num(); z++) + { + auto ClientConnection = ClientConnections.at(z); + auto FortPC = Cast(ClientConnection->GetPlayerController()); + + if (!FortPC) + continue; + + if (FortPC->GetMyFortPawn()) + { + bBreak = true; + break; + } + } + + if (++a >= 5) + bBreak = true; + + Sleep(1000); + } + SafeZoneIndicator->SkipShrinkSafeZone(); + + if (Engine_Version >= 424) + { + Sleep(1000); + SafeZoneIndicator->SkipShrinkSafeZone(); + } + } + else + { + LOG_WARN(LogDev, "Invalid Indicator!"); } } @@ -1088,6 +1132,9 @@ static inline void MainUI() LOG_WARN(LogUI, "Invalid Item Definition!"); } } + } + else if (Tab == LATEGAME_TAB) + { } else if (Tab == DEVELOPER_TAB) diff --git a/Project Reboot 3.0/objectviewer.h b/Project Reboot 3.0/objectviewer.h new file mode 100644 index 0000000..3f59c93 --- /dev/null +++ b/Project Reboot 3.0/objectviewer.h @@ -0,0 +1,2 @@ +#pragma once +