From 6fb730f425023c574412697a0952e66be79879a5 Mon Sep 17 00:00:00 2001 From: Milxnor Date: Thu, 18 May 2023 20:06:50 -0400 Subject: [PATCH] hopefully fix compile error & fix pausesafezone? --- .../FortAthenaMutator_Barrier.h | 2 +- Project Reboot 3.0/FortGameModeAthena.cpp | 20 ++++++++++ Project Reboot 3.0/FortGameModeAthena.h | 1 + Project Reboot 3.0/FortGameStateAthena.h | 6 +++ Project Reboot 3.0/Object.h | 9 +++-- Project Reboot 3.0/commands.h | 38 ++++--------------- Project Reboot 3.0/globals.h | 2 +- Project Reboot 3.0/gui.h | 6 +-- 8 files changed, 45 insertions(+), 39 deletions(-) diff --git a/Project Reboot 3.0/FortAthenaMutator_Barrier.h b/Project Reboot 3.0/FortAthenaMutator_Barrier.h index a9148eb..4f823c8 100644 --- a/Project Reboot 3.0/FortAthenaMutator_Barrier.h +++ b/Project Reboot 3.0/FortAthenaMutator_Barrier.h @@ -23,7 +23,7 @@ struct FBarrierTeamState // Idk if this actually changes { static UStruct* GetStruct() { - static auto Struct = FindObject("/Script/FortniteGame.BarrierTeamState"); + static auto Struct = FindObject(L"/Script/FortniteGame.BarrierTeamState"); return Struct; } diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 688f283..ad9f372 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -143,6 +143,26 @@ void AFortGameModeAthena::HandleSpawnRateForActorClass(UClass* ActorClass, float } } +void AFortGameModeAthena::PauseSafeZone(bool bPaused) +{ + auto GameState = GetGameStateAthena(); + + static auto bSafeZonePausedOffset = GameState->GetOffset("bSafeZonePaused"); + GameState->IsSafeZonePaused() = bPaused; + + auto SafeZoneIndicator = GetSafeZoneIndicator(); + + if (!SafeZoneIndicator) + return; + + static auto TimeRemainingWhenPhasePausedOffset = this->GetOffset("TimeRemainingWhenPhasePaused"); + + if (bPaused) + this->Get(TimeRemainingWhenPhasePausedOffset) = SafeZoneIndicator->GetSafeZoneFinishShrinkTime() - GameState->GetServerWorldTimeSeconds(); + else + SafeZoneIndicator->GetSafeZoneFinishShrinkTime() = GameState->GetServerWorldTimeSeconds() + this->Get(TimeRemainingWhenPhasePausedOffset); +} + bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* GameMode) { Globals::bHitReadyToStartMatch = true; diff --git a/Project Reboot 3.0/FortGameModeAthena.h b/Project Reboot 3.0/FortGameModeAthena.h index 8adbfa0..5d10264 100644 --- a/Project Reboot 3.0/FortGameModeAthena.h +++ b/Project Reboot 3.0/FortGameModeAthena.h @@ -244,6 +244,7 @@ public: FName RedirectLootTier(const FName& LootTier); UClass* GetVehicleClassOverride(UClass* DefaultClass); + void PauseSafeZone(bool bPaused = true); static void HandleSpawnRateForActorClass(UClass* ActorClass, float SpawnPercentage); // idk where to put diff --git a/Project Reboot 3.0/FortGameStateAthena.h b/Project Reboot 3.0/FortGameStateAthena.h index 5a1061f..7002921 100644 --- a/Project Reboot 3.0/FortGameStateAthena.h +++ b/Project Reboot 3.0/FortGameStateAthena.h @@ -99,6 +99,12 @@ public: return Get(PlayersLeftOffset); } + bool& IsSafeZonePaused() + { + static auto bSafeZonePausedOffset = this->GetOffset("bSafeZonePaused"); + return this->Get(bSafeZonePausedOffset); + } + EAthenaGamePhase& GetGamePhase() { static auto GamePhaseOffset = GetOffset("GamePhase"); diff --git a/Project Reboot 3.0/Object.h b/Project Reboot 3.0/Object.h index 5f78ecc..a5f0dfa 100644 --- a/Project Reboot 3.0/Object.h +++ b/Project Reboot 3.0/Object.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "ObjectMacros.h" #include "NameTypes.h" @@ -76,13 +78,14 @@ public: void SetBitfieldValue(int Offset, uint8_t FieldMask, bool NewValue); void SetBitfieldValue(const std::string& ChildName, uint8_t FieldMask, bool NewValue) { return SetBitfieldValue(GetOffset(ChildName), FieldMask, NewValue); } - template + /* template T& GetCached(const std::string& ChildName) { // We need to find a better way to do this because if there is a member with the same name in a different class then it will return the wrong offset. static std::unordered_map SavedOffsets; // Name (formatted in {Member}) and Offset - auto CachedName = /* ClassPrivate->GetName() + */ ChildName; + auto CachedName = // ClassPrivate->GetName() + + ChildName; auto Offset = SavedOffsets.find(CachedName); if (Offset != SavedOffsets.end()) @@ -97,7 +100,7 @@ public: SavedOffsets.emplace(CachedName, Offset->second); return *(T*)(__int64(this) + Offset->second); - } + } */ template T& Get(const std::string& ChildName) { return Get(GetOffset(ChildName)); } diff --git a/Project Reboot 3.0/commands.h b/Project Reboot 3.0/commands.h index c190858..072b6d4 100644 --- a/Project Reboot 3.0/commands.h +++ b/Project Reboot 3.0/commands.h @@ -720,7 +720,11 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) } else if (Command == "pausesafezone") { - UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"pausesafezone", nullptr); + auto GameState = Cast(GetWorld()->GetGameState()); + auto GameMode = Cast(GetWorld()->GetGameMode()); + + // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"pausesafezone", nullptr); + GameMode->PauseSafeZone(GameState->IsSafeZonePaused() == 0); } else if (Command == "teleport") { @@ -764,36 +768,6 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) Pawn->TeleportTo(FVector(X, Y, Z), Pawn->GetActorRotation()); SendMessageToConsole(PlayerController, L"Teleported!"); } - else if (Command == "test") - { - auto SpawnBigWall = [&](AFortAthenaMutator* Mutator) { - if (auto BarrierMutator = Cast(Mutator)) - { - auto BigBaseWallClass = BarrierMutator->GetBigBaseWallClass(); - - LOG_INFO(LogDev, "BigBaseWallClass: {}", BigBaseWallClass->IsValidLowLevel() ? BigBaseWallClass->GetFullName() : "BadRead"); - - if (BigBaseWallClass->IsValidLowLevel()) - { - BarrierMutator->GetBigBaseWall() = GetWorld()->SpawnActor(BigBaseWallClass, FVector(0, 0, 0)); - } - } - }; - - LoopMutators(SpawnBigWall); - } - else if (Command == "printpawn") - { - auto Pawn = Cast(ReceivingController->GetPawn()); - - if (!Pawn) - { - SendMessageToConsole(PlayerController, L"No pawn to print!"); - return; - } - - LOG_INFO(LogDev, "Pawn: 0x{:x}", __int64(Pawn)); - } else { bSendHelpMessage = true; }; } else { bSendHelpMessage = true; }; @@ -812,6 +786,8 @@ cheat setshield - Sets executing player's shield. cheat applycid - Sets a player's character. cheat spawnpickup - Spawns a pickup at specified player. cheat teleport - Teleports to what the player is looking at. +cheat spawnbot - Spawns a bot at the player (experimental). +cheat setpickaxe - Set player's pickaxe. If you want to execute a command on a certain player, surround their name (case sensitive) with \, and put the param anywhere. Example: cheat sethealth \Milxnor\ 100 )"; diff --git a/Project Reboot 3.0/globals.h b/Project Reboot 3.0/globals.h index 2e5e77d..71894c9 100644 --- a/Project Reboot 3.0/globals.h +++ b/Project Reboot 3.0/globals.h @@ -20,7 +20,7 @@ namespace Globals extern inline bool bHitReadyToStartMatch = false; extern inline bool bInitializedPlaylist = false; extern inline bool bStartedListening = false; - extern inline bool bAutoRestart = true; // doesnt work fyi + extern inline bool bAutoRestart = false; // doesnt work fyi extern inline bool bFillVendingMachines = true; extern inline int AmountOfListens = 0; // TODO: Switch to this for LastNum } diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index 66fed20..dc225a1 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -458,7 +458,7 @@ static inline void MainUI() if (!bStartedBus) { bool bWillBeLategame = Globals::bLateGame.load(); - ImGui::Checkbox("Lategame", &bWillBeLategame); + ImGui::Checkbox("Lategame (HIGHLY EXPERIMENTAL)", &bWillBeLategame); Globals::bLateGame.store(bWillBeLategame); } @@ -478,10 +478,10 @@ static inline void MainUI() UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr); } - if (ImGui::Button("Spawn BGAs")) + /* if (ImGui::Button("Spawn BGAs")) { SpawnBGAs(); - } + } */ /* if (ImGui::Button("New"))