preload, starting shield

This commit is contained in:
Milxnor
2023-06-26 09:38:40 -04:00
parent 3f8ca2888e
commit a67fe1a361
4 changed files with 65 additions and 11 deletions

View File

@@ -390,6 +390,8 @@ void AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook(AFor
void AFortPlayerControllerAthena::ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn) void AFortPlayerControllerAthena::ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn)
{ {
static auto AcknowledgedPawnOffset = Controller->GetOffset("AcknowledgedPawn"); static auto AcknowledgedPawnOffset = Controller->GetOffset("AcknowledgedPawn");
const APawn* OldAcknowledgedPawn = Controller->Get<APawn*>(AcknowledgedPawnOffset);
Controller->Get<APawn*>(AcknowledgedPawnOffset) = Pawn; Controller->Get<APawn*>(AcknowledgedPawnOffset) = Pawn;
auto ControllerAsFort = Cast<AFortPlayerController>(Controller); auto ControllerAsFort = Cast<AFortPlayerController>(Controller);
@@ -399,6 +401,11 @@ void AFortPlayerControllerAthena::ServerAcknowledgePossessionHook(APlayerControl
if (!PawnAsFort) if (!PawnAsFort)
return; return;
if (OldAcknowledgedPawn != PawnAsFort)
{
PawnAsFort->SetShield(StartingShield);
}
if (Globals::bNoMCP) if (Globals::bNoMCP)
{ {
static auto CustomCharacterPartClass = FindObject<UClass>("/Script/FortniteGame.CustomCharacterPart"); static auto CustomCharacterPartClass = FindObject<UClass>("/Script/FortniteGame.CustomCharacterPart");

View File

@@ -203,9 +203,25 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
}; };
LoopMutators(AddInventoryOverrideTeamLoadouts); LoopMutators(AddInventoryOverrideTeamLoadouts);
WorldInventory->Update();
} }
const auto& ItemInstances = WorldInventory->GetItemList().GetItemInstances();
for (int i = 0; i < ItemInstances.Num(); ++i)
{
auto ItemInstance = ItemInstances.at(i);
if (!ItemInstance) continue;
auto WeaponItemDefinition = Cast<UFortWeaponItemDefinition>(ItemInstance->GetItemEntry()->GetItemDefinition());
if (!WeaponItemDefinition) continue;
ItemInstance->GetItemEntry()->GetLoadedAmmo() = WeaponItemDefinition->GetClipSize();
WorldInventory->GetItemList().MarkItemDirty(ItemInstance->GetItemEntry());
}
WorldInventory->Update();
} }
} }
else else

View File

@@ -32,7 +32,7 @@ void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int OverridePhaseMa
GameState->Get<int>(GameState_SafeZonePhaseOffset) = NewLateGameSafeZonePhase; GameState->Get<int>(GameState_SafeZonePhaseOffset) = NewLateGameSafeZonePhase;
SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK);
if (NewLateGameSafeZonePhase == 5) if (NewLateGameSafeZonePhase == EndReverseZonePhase)
{ {
bReversing = false; bReversing = false;
} }
@@ -45,7 +45,7 @@ void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int OverridePhaseMa
LOG_WARN(LogZone, "Invalid SafeZoneIndicator!"); LOG_WARN(LogZone, "Invalid SafeZoneIndicator!");
} }
if (NewLateGameSafeZonePhase >= 7) // This means instead of going to the 8th phase its gonna go down. if (NewLateGameSafeZonePhase >= StartReverseZonePhase) // This means instead of going to the 8th phase its gonna go down.
{ {
bReversing = true; bReversing = true;
} }
@@ -128,12 +128,12 @@ void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int OverridePhaseMa
GameState->Get<int>(GameState_SafeZonePhaseOffset) = NewLateGameSafeZonePhase; GameState->Get<int>(GameState_SafeZonePhaseOffset) = NewLateGameSafeZonePhase;
SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK);
if (NewLateGameSafeZonePhase == 5) if (NewLateGameSafeZonePhase == EndReverseZonePhase)
{ {
bReversing = false; bReversing = false;
} }
if (NewLateGameSafeZonePhase >= 7) // This means instead of going to the 8th phase its gonna go down. if (NewLateGameSafeZonePhase >= StartReverseZonePhase) // This means instead of going to the 8th phase its gonna go down.
{ {
bReversing = true; bReversing = true;
} }

View File

@@ -63,6 +63,9 @@
#define LOADOUT_PLAYERTAB 4 #define LOADOUT_PLAYERTAB 4
#define FUN_PLAYERTAB 5 #define FUN_PLAYERTAB 5
extern inline int StartReverseZonePhase = 7;
extern inline int EndReverseZonePhase = 5;
extern inline float StartingShield = 0;
extern inline bool bEnableReverseZone = false; extern inline bool bEnableReverseZone = false;
extern inline int AmountOfPlayersWhenBusStart = 0; extern inline int AmountOfPlayersWhenBusStart = 0;
extern inline bool bHandleDeath = true; extern inline bool bHandleDeath = true;
@@ -82,6 +85,7 @@ extern inline bool bEnableCombinePickup = false;
extern inline int AmountOfBotsToSpawn = 0; extern inline int AmountOfBotsToSpawn = 0;
extern inline bool bEnableRebooting = false; extern inline bool bEnableRebooting = false;
extern inline bool bEngineDebugLogs = false; extern inline bool bEngineDebugLogs = false;
extern inline bool bStartedBus = false;
extern inline int AmountOfHealthSiphon = 0; extern inline int AmountOfHealthSiphon = 0;
// THE BASE CODE IS FROM IMGUI GITHUB // THE BASE CODE IS FROM IMGUI GITHUB
@@ -96,7 +100,11 @@ static inline void CleanupDeviceD3D();
static inline void ResetDevice(); static inline void ResetDevice();
static inline LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); static inline LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
extern inline bool bStartedBus = false; static inline void SetIsLategame(bool Value)
{
Globals::bLateGame.store(Value);
StartingShield = 100;
}
static inline void Restart() // todo move? static inline void Restart() // todo move?
{ {
@@ -532,7 +540,7 @@ static inline DWORD WINAPI LateGameThread(LPVOID)
if (SafeZoneLocations.Num() < 4) if (SafeZoneLocations.Num() < 4)
{ {
LOG_WARN(LogLateGame, "Unable to find SafeZoneLocation! Disabling lategame.."); LOG_WARN(LogLateGame, "Unable to find SafeZoneLocation! Disabling lategame..");
Globals::bLateGame.store(false); SetIsLategame(false);
return 0; return 0;
} }
@@ -681,8 +689,8 @@ static inline void MainUI()
if (!bStartedBus) if (!bStartedBus)
{ {
bool bWillBeLategame = Globals::bLateGame.load(); bool bWillBeLategame = Globals::bLateGame.load();
ImGui::Checkbox("Lategame (HIGHLY EXPERIMENTAL)", &bWillBeLategame); ImGui::Checkbox("Lategame", &bWillBeLategame);
Globals::bLateGame.store(bWillBeLategame); SetIsLategame(bWillBeLategame);
} }
ImGui::Text(std::format("Joinable {}", Globals::bStartedListening).c_str()); ImGui::Text(std::format("Joinable {}", Globals::bStartedListening).c_str());
@@ -1065,9 +1073,26 @@ static inline void MainUI()
static std::string ItemToGrantEveryone; static std::string ItemToGrantEveryone;
static int AmountToGrantEveryone = 1; static int AmountToGrantEveryone = 1;
ImGui::InputFloat("Starting Shield", &StartingShield);
ImGui::InputText("Item to Give", &ItemToGrantEveryone); ImGui::InputText("Item to Give", &ItemToGrantEveryone);
ImGui::InputInt("Amount to Give", &AmountToGrantEveryone); ImGui::InputInt("Amount to Give", &AmountToGrantEveryone);
if (ImGui::Button("Destroy all player builds"))
{
auto AllBuildingSMActors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ABuildingSMActor::StaticClass());
for (int i = 0; i < AllBuildingSMActors.Num(); i++)
{
auto CurrentBuildingSMActor = (ABuildingSMActor*)AllBuildingSMActors.at(i);
if (!CurrentBuildingSMActor->IsPlayerPlaced()) continue;
CurrentBuildingSMActor->K2_DestroyActor();
}
AllBuildingSMActors.Free();
}
if (ImGui::Button("Give Item to Everyone")) if (ImGui::Button("Give Item to Everyone"))
{ {
auto ItemDefinition = FindObject<UFortItemDefinition>(ItemToGrantEveryone, nullptr, ANY_PACKAGE); auto ItemDefinition = FindObject<UFortItemDefinition>(ItemToGrantEveryone, nullptr, ANY_PACKAGE);
@@ -1142,6 +1167,12 @@ static inline void MainUI()
else if (Tab == LATEGAME_TAB) else if (Tab == LATEGAME_TAB)
{ {
ImGui::Checkbox("Enable Reverse Zone (EXPERIMENTAL)", &bEnableReverseZone); ImGui::Checkbox("Enable Reverse Zone (EXPERIMENTAL)", &bEnableReverseZone);
if (bEnableReverseZone)
{
ImGui::InputInt("Start Reversing Phase", &StartReverseZonePhase);
ImGui::InputInt("End Reversing Phase", &EndReverseZonePhase);
}
} }
else if (Tab == DEVELOPER_TAB) else if (Tab == DEVELOPER_TAB)
{ {
@@ -1324,7 +1355,7 @@ static inline void PregameUI()
{ {
bool bWillBeLategame = Globals::bLateGame.load(); bool bWillBeLategame = Globals::bLateGame.load();
ImGui::Checkbox("Lategame", &bWillBeLategame); ImGui::Checkbox("Lategame", &bWillBeLategame);
Globals::bLateGame.store(bWillBeLategame); SetIsLategame(bWillBeLategame);
} }
if (HasEvent()) if (HasEvent())