hopefully fix compile error & fix pausesafezone?

This commit is contained in:
Milxnor
2023-05-18 20:06:50 -04:00
parent e54f00e9da
commit 6fb730f425
8 changed files with 45 additions and 39 deletions

View File

@@ -23,7 +23,7 @@ struct FBarrierTeamState // Idk if this actually changes
{ {
static UStruct* GetStruct() static UStruct* GetStruct()
{ {
static auto Struct = FindObject<UStruct>("/Script/FortniteGame.BarrierTeamState"); static auto Struct = FindObject<UStruct>(L"/Script/FortniteGame.BarrierTeamState");
return Struct; return Struct;
} }

View File

@@ -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<float>(TimeRemainingWhenPhasePausedOffset) = SafeZoneIndicator->GetSafeZoneFinishShrinkTime() - GameState->GetServerWorldTimeSeconds();
else
SafeZoneIndicator->GetSafeZoneFinishShrinkTime() = GameState->GetServerWorldTimeSeconds() + this->Get<float>(TimeRemainingWhenPhasePausedOffset);
}
bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* GameMode) bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* GameMode)
{ {
Globals::bHitReadyToStartMatch = true; Globals::bHitReadyToStartMatch = true;

View File

@@ -244,6 +244,7 @@ public:
FName RedirectLootTier(const FName& LootTier); FName RedirectLootTier(const FName& LootTier);
UClass* GetVehicleClassOverride(UClass* DefaultClass); UClass* GetVehicleClassOverride(UClass* DefaultClass);
void PauseSafeZone(bool bPaused = true);
static void HandleSpawnRateForActorClass(UClass* ActorClass, float SpawnPercentage); // idk where to put static void HandleSpawnRateForActorClass(UClass* ActorClass, float SpawnPercentage); // idk where to put

View File

@@ -99,6 +99,12 @@ public:
return Get<int>(PlayersLeftOffset); return Get<int>(PlayersLeftOffset);
} }
bool& IsSafeZonePaused()
{
static auto bSafeZonePausedOffset = this->GetOffset("bSafeZonePaused");
return this->Get<bool>(bSafeZonePausedOffset);
}
EAthenaGamePhase& GetGamePhase() EAthenaGamePhase& GetGamePhase()
{ {
static auto GamePhaseOffset = GetOffset("GamePhase"); static auto GamePhaseOffset = GetOffset("GamePhase");

View File

@@ -1,5 +1,7 @@
#pragma once #pragma once
#include <unordered_map>
#include "ObjectMacros.h" #include "ObjectMacros.h"
#include "NameTypes.h" #include "NameTypes.h"
@@ -76,13 +78,14 @@ public:
void SetBitfieldValue(int Offset, uint8_t FieldMask, bool NewValue); 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); } void SetBitfieldValue(const std::string& ChildName, uint8_t FieldMask, bool NewValue) { return SetBitfieldValue(GetOffset(ChildName), FieldMask, NewValue); }
template <typename T = UObject*> /* template <typename T = UObject*>
T& GetCached(const std::string& ChildName) 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. // 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<std::string, int32_t> SavedOffsets; // Name (formatted in {Member}) and Offset static std::unordered_map<std::string, int32_t> SavedOffsets; // Name (formatted in {Member}) and Offset
auto CachedName = /* ClassPrivate->GetName() + */ ChildName; auto CachedName = // ClassPrivate->GetName() +
ChildName;
auto Offset = SavedOffsets.find(CachedName); auto Offset = SavedOffsets.find(CachedName);
if (Offset != SavedOffsets.end()) if (Offset != SavedOffsets.end())
@@ -97,7 +100,7 @@ public:
SavedOffsets.emplace(CachedName, Offset->second); SavedOffsets.emplace(CachedName, Offset->second);
return *(T*)(__int64(this) + Offset->second); return *(T*)(__int64(this) + Offset->second);
} } */
template <typename T = UObject*> template <typename T = UObject*>
T& Get(const std::string& ChildName) { return Get<T>(GetOffset(ChildName)); } T& Get(const std::string& ChildName) { return Get<T>(GetOffset(ChildName)); }

View File

@@ -720,7 +720,11 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
} }
else if (Command == "pausesafezone") else if (Command == "pausesafezone")
{ {
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"pausesafezone", nullptr); auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"pausesafezone", nullptr);
GameMode->PauseSafeZone(GameState->IsSafeZonePaused() == 0);
} }
else if (Command == "teleport") else if (Command == "teleport")
{ {
@@ -764,36 +768,6 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
Pawn->TeleportTo(FVector(X, Y, Z), Pawn->GetActorRotation()); Pawn->TeleportTo(FVector(X, Y, Z), Pawn->GetActorRotation());
SendMessageToConsole(PlayerController, L"Teleported!"); SendMessageToConsole(PlayerController, L"Teleported!");
} }
else if (Command == "test")
{
auto SpawnBigWall = [&](AFortAthenaMutator* Mutator) {
if (auto BarrierMutator = Cast<AFortAthenaMutator_Barrier>(Mutator))
{
auto BigBaseWallClass = BarrierMutator->GetBigBaseWallClass();
LOG_INFO(LogDev, "BigBaseWallClass: {}", BigBaseWallClass->IsValidLowLevel() ? BigBaseWallClass->GetFullName() : "BadRead");
if (BigBaseWallClass->IsValidLowLevel())
{
BarrierMutator->GetBigBaseWall() = GetWorld()->SpawnActor<AAthenaBigBaseWall>(BigBaseWallClass, FVector(0, 0, 0));
}
}
};
LoopMutators(SpawnBigWall);
}
else if (Command == "printpawn")
{
auto Pawn = Cast<APawn>(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; };
} }
else { bSendHelpMessage = true; }; else { bSendHelpMessage = true; };
@@ -812,6 +786,8 @@ cheat setshield <Shield=0.f> - Sets executing player's shield.
cheat applycid <CIDShortName> - Sets a player's character. cheat applycid <CIDShortName> - Sets a player's character.
cheat spawnpickup <ShortWID> - Spawns a pickup at specified player. cheat spawnpickup <ShortWID> - Spawns a pickup at specified player.
cheat teleport - Teleports to what the player is looking at. cheat teleport - Teleports to what the player is looking at.
cheat spawnbot <Amount=1> - Spawns a bot at the player (experimental).
cheat setpickaxe <PickaxeID> - 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 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
)"; )";

View File

@@ -20,7 +20,7 @@ namespace Globals
extern inline bool bHitReadyToStartMatch = false; extern inline bool bHitReadyToStartMatch = false;
extern inline bool bInitializedPlaylist = false; extern inline bool bInitializedPlaylist = false;
extern inline bool bStartedListening = 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 bool bFillVendingMachines = true;
extern inline int AmountOfListens = 0; // TODO: Switch to this for LastNum extern inline int AmountOfListens = 0; // TODO: Switch to this for LastNum
} }

View File

@@ -458,7 +458,7 @@ static inline void MainUI()
if (!bStartedBus) if (!bStartedBus)
{ {
bool bWillBeLategame = Globals::bLateGame.load(); bool bWillBeLategame = Globals::bLateGame.load();
ImGui::Checkbox("Lategame", &bWillBeLategame); ImGui::Checkbox("Lategame (HIGHLY EXPERIMENTAL)", &bWillBeLategame);
Globals::bLateGame.store(bWillBeLategame); Globals::bLateGame.store(bWillBeLategame);
} }
@@ -478,10 +478,10 @@ static inline void MainUI()
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr);
} }
if (ImGui::Button("Spawn BGAs")) /* if (ImGui::Button("Spawn BGAs"))
{ {
SpawnBGAs(); SpawnBGAs();
} } */
/* /*
if (ImGui::Button("New")) if (ImGui::Button("New"))