quite a good update

Fixed Devourer of Worlds Event, Fixed chapter 2+ editing bug, Fixed all other bugs with editing, Fixed S13+ lategame.
This commit is contained in:
Milxnor
2023-04-21 13:34:13 -04:00
parent 4ad4e9cf14
commit a16bb42c01
16 changed files with 213 additions and 35 deletions

View File

@@ -19,14 +19,13 @@ void UAthenaMarkerComponent::ServerAddMapMarkerHook(UAthenaMarkerComponent* Mark
auto MarkerRequestPtr = &MarkerRequest; auto MarkerRequestPtr = &MarkerRequest;
static auto FortWorldMarkerDataStruct = FindObject<UStruct>("/Script/FortniteGame.FortWorldMarkerData"); bool useRealloc = true;
static auto FortWorldMarkerDataSize = FortWorldMarkerDataStruct->GetPropertiesSize(); auto MarkerData = Alloc<FFortWorldMarkerData>(FFortWorldMarkerData::GetStructSize(), useRealloc);
auto MarkerData = Alloc<FFortWorldMarkerData>(FortWorldMarkerDataSize);
static auto IconOffset = FindOffsetStruct("/Script/FortniteGame.MarkedActorDisplayInfo", "Icon"); static auto IconOffset = FindOffsetStruct("/Script/FortniteGame.MarkedActorDisplayInfo", "Icon");
static auto DisplayNameOffset = FindOffsetStruct("/Script/FortniteGame.MarkedActorDisplayInfo", "DisplayName"); static auto DisplayNameOffset = FindOffsetStruct("/Script/FortniteGame.MarkedActorDisplayInfo", "DisplayName");
static auto WorldPositionOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "WorldPosition", false); static auto WorldPositionOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "WorldPosition", false);
static auto bIncludeSquadOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "bIncludeSquad", false);
static auto WorldPositionOffsetOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "WorldPositionOffset", false); static auto WorldPositionOffsetOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "WorldPositionOffset", false);
FMarkerID MarkerID{}; FMarkerID MarkerID{};
@@ -40,6 +39,9 @@ void UAthenaMarkerComponent::ServerAddMapMarkerHook(UAthenaMarkerComponent* Mark
MarkerData->GetWorldPosition() = MarkerRequestPtr->GetWorldPosition(); MarkerData->GetWorldPosition() = MarkerRequestPtr->GetWorldPosition();
if (WorldPositionOffset != -1) if (WorldPositionOffset != -1)
MarkerData->GetWorldPositionOffset() = MarkerRequestPtr->GetWorldPositionOffset(); MarkerData->GetWorldPositionOffset() = MarkerRequestPtr->GetWorldPositionOffset();
if (bIncludeSquadOffset != -1)
MarkerData->DoesIncludeSquad() = MarkerRequestPtr->DoesIncludeSquad();
MarkerData->GetMarkerID() = MarkerID; MarkerData->GetMarkerID() = MarkerID;
MarkerData->GetMarkedActorClass().SoftObjectPtr.WeakPtr.ObjectIndex = -1; MarkerData->GetMarkedActorClass().SoftObjectPtr.WeakPtr.ObjectIndex = -1;
MarkerData->GetMarkedActorClass().SoftObjectPtr.TagAtLastTest = 0; MarkerData->GetMarkedActorClass().SoftObjectPtr.TagAtLastTest = 0;
@@ -101,8 +103,33 @@ void UAthenaMarkerComponent::ServerAddMapMarkerHook(UAthenaMarkerComponent* Mark
continue; continue;
static auto ClientAddMarkerFn = FindObject<UFunction>("/Script/FortniteGame.AthenaMarkerComponent.ClientAddMarker"); static auto ClientAddMarkerFn = FindObject<UFunction>("/Script/FortniteGame.AthenaMarkerComponent.ClientAddMarker");
if (ClientAddMarkerFn)
{
CurrentTeamMemberMarkerComponent->ProcessEvent(ClientAddMarkerFn, MarkerData); CurrentTeamMemberMarkerComponent->ProcessEvent(ClientAddMarkerFn, MarkerData);
} }
else
{
// We are assuming it is not the TArray and it is FFortWorldMarkerContainer
static auto MarkerStreamOffset = CurrentTeamMemberMarkerComponent->GetOffset("MarkerStream");
auto MarkerStream = CurrentTeamMemberMarkerComponent->GetPtr<FFastArraySerializer>(MarkerStreamOffset);
static auto MarkersOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerContainer", "Markers");
if (MarkersOffset != -1)
{
// We are assuming it is a FFastArraySerializerItem
((FFastArraySerializerItem*)MarkerData)->MostRecentArrayReplicationKey = -1;
((FFastArraySerializerItem*)MarkerData)->ReplicationID = -1;
((FFastArraySerializerItem*)MarkerData)->ReplicationKey = -1;
auto& Markers = *(TArray<FFortWorldMarkerData>*)(__int64(MarkerStream) + MarkersOffset);
Markers.AddPtr(MarkerData, FFortWorldMarkerData::GetStructSize());
MarkerStream->MarkArrayDirty();
}
}
}
} }
void UAthenaMarkerComponent::ServerRemoveMapMarkerHook(UAthenaMarkerComponent* MarkerComponent, FMarkerID MarkerID, uint8_t CancelReason) void UAthenaMarkerComponent::ServerRemoveMapMarkerHook(UAthenaMarkerComponent* MarkerComponent, FMarkerID MarkerID, uint8_t CancelReason)
@@ -144,6 +171,14 @@ void UAthenaMarkerComponent::ServerRemoveMapMarkerHook(UAthenaMarkerComponent* M
continue; continue;
static auto ClientCancelMarkerFn = FindObject<UFunction>("/Script/FortniteGame.AthenaMarkerComponent.ClientCancelMarker"); static auto ClientCancelMarkerFn = FindObject<UFunction>("/Script/FortniteGame.AthenaMarkerComponent.ClientCancelMarker");
if (ClientCancelMarkerFn)
{
CurrentTeamMemberMarkerComponent->ProcessEvent(ClientCancelMarkerFn, &MarkerID); CurrentTeamMemberMarkerComponent->ProcessEvent(ClientCancelMarkerFn, &MarkerID);
} }
else
{
// UnmarkActorOnClient ?
}
}
} }

View File

@@ -9,7 +9,7 @@ struct FMarkerID { int PlayerID; int InstanceID; };
struct FFortClientMarkerRequest struct FFortClientMarkerRequest
{ {
char pad[0x20]; // real char pad[0x20]; // real idk
int& GetInstanceID() int& GetInstanceID()
{ {
@@ -19,6 +19,18 @@ struct FFortClientMarkerRequest
return *(int*)(__int64(this) + InstanceIDOffset); return *(int*)(__int64(this) + InstanceIDOffset);
} }
bool& DoesIncludeSquad()
{
static auto bIncludeSquadOffset = FindOffsetStruct("/Script/FortniteGame.FortClientMarkerRequest", "bIncludeSquad");
return *(bool*)(__int64(this) + bIncludeSquadOffset);
}
bool& UsesHoveredMarkerDetail()
{
static auto bUseHoveredMarkerDetailOffset = FindOffsetStruct("/Script/FortniteGame.FortClientMarkerRequest", "bUseHoveredMarkerDetail");
return *(bool*)(__int64(this) + bUseHoveredMarkerDetailOffset);
}
FVector& GetWorldPosition() FVector& GetWorldPosition()
{ {
static auto WorldPositionOffset = FindOffsetStruct("/Script/FortniteGame.FortClientMarkerRequest", "WorldPosition"); static auto WorldPositionOffset = FindOffsetStruct("/Script/FortniteGame.FortClientMarkerRequest", "WorldPosition");
@@ -46,18 +58,38 @@ struct FFortClientMarkerRequest
struct FFortWorldMarkerData struct FFortWorldMarkerData
{ {
static UStruct* GetStruct()
{
static auto Struct = FindObject<UStruct>("/Script/FortniteGame.FortWorldMarkerData");
return Struct;
}
static int GetStructSize() { return GetStruct()->GetPropertiesSize(); }
FMarkerID& GetMarkerID() FMarkerID& GetMarkerID()
{ {
static auto MarkerIDOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "MarkerID"); static auto MarkerIDOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "MarkerID");
return *(FMarkerID*)(__int64(this) + MarkerIDOffset); return *(FMarkerID*)(__int64(this) + MarkerIDOffset);
} }
UObject*& GetMarkerInstance()
{
static auto MarkerInstanceOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "MarkerInstance");
return *(UObject**)(__int64(this) + MarkerInstanceOffset);
}
FVector& GetWorldPosition() FVector& GetWorldPosition()
{ {
static auto WorldPositionOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "WorldPosition"); static auto WorldPositionOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "WorldPosition");
return *(FVector*)(__int64(this) + WorldPositionOffset); return *(FVector*)(__int64(this) + WorldPositionOffset);
} }
bool& DoesIncludeSquad()
{
static auto bIncludeSquadOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "bIncludeSquad");
return *(bool*)(__int64(this) + bIncludeSquadOffset);
}
FVector& GetWorldPositionOffset() FVector& GetWorldPositionOffset()
{ {
static auto WorldPositionOffsetOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "WorldPositionOffset"); static auto WorldPositionOffsetOffset = FindOffsetStruct("/Script/FortniteGame.FortWorldMarkerData", "WorldPositionOffset");

View File

@@ -32,7 +32,8 @@ public:
void SilentDie() void SilentDie()
{ {
static auto SilentDieFn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SilentDie"); static auto SilentDieFn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SilentDie");
this->ProcessEvent(SilentDieFn); bool bPropagateSilentDeath = false; // idfk
this->ProcessEvent(SilentDieFn, &bPropagateSilentDeath);
} }
float GetMaxHealth() float GetMaxHealth()

View File

@@ -1,6 +1,21 @@
#include "BuildingFoundation.h" #include "BuildingFoundation.h"
#include "FortGameModeAthena.h" #include "FortGameModeAthena.h"
void ABuildingFoundation::SetDynamicFoundationTransformHook(UObject* Context, FFrame& Stack, void* Ret)
{
FTransform NewTransform;
Stack.StepCompiledIn(&NewTransform);
auto BuildingFoundation = (ABuildingFoundation*)Context;
LOG_INFO(LogDev, "Bruh: {}", BuildingFoundation->GetName());
static auto DynamicFoundationTransformOffset = BuildingFoundation->GetOffset("DynamicFoundationTransform");
BuildingFoundation->Get<FTransform>(DynamicFoundationTransformOffset) = NewTransform;
return SetDynamicFoundationTransformOriginal(Context, Stack, Ret);
}
void ABuildingFoundation::SetDynamicFoundationEnabledHook(UObject* Context, FFrame& Stack, void* Ret) void ABuildingFoundation::SetDynamicFoundationEnabledHook(UObject* Context, FFrame& Stack, void* Ret)
{ {
bool bEnabled; bool bEnabled;

View File

@@ -33,7 +33,8 @@ class ABuildingFoundation : public ABuildingSMActor
{ {
public: public:
static inline void (*SetDynamicFoundationEnabledOriginal)(UObject* Context, FFrame& Stack, void* Ret); static inline void (*SetDynamicFoundationEnabledOriginal)(UObject* Context, FFrame& Stack, void* Ret);
static inline void (*SetDynamicFoundationTransformOriginal)(UObject* Context, FFrame& Stack, void* Ret);
static void SetDynamicFoundationTransformHook(UObject* Context, FFrame& Stack, void* Ret);
static void SetDynamicFoundationEnabledHook(UObject* Context, FFrame& Stack, void* Ret); static void SetDynamicFoundationEnabledHook(UObject* Context, FFrame& Stack, void* Ret);
}; };

View File

@@ -48,5 +48,17 @@ public:
return Get<EFortResourceType>(ResourceTypeOffset); return Get<EFortResourceType>(ResourceTypeOffset);
} }
void SetEditingPlayer(APlayerState* NewEditingPlayer) // actually AFortPlayerStateZone
{
if (// AActor::HasAuthority() &&
(!GetEditingPlayer() || !NewEditingPlayer)
)
{
SetNetDormancy((ENetDormancy)(2 - (NewEditingPlayer != 0)));
// they do something here
GetEditingPlayer() = NewEditingPlayer;
}
}
static UClass* StaticClass(); static UClass* StaticClass();
}; };

View File

@@ -250,11 +250,6 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
ShowFoundation(TheBlock); ShowFoundation(TheBlock);
} }
if (Fortnite_Version == 14.60 && Globals::bGoingToPlayEvent)
{
ShowFoundation(FindObject<AActor>("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation3")); // Aircraft Carrier
}
if (Fortnite_Version == 17.50) { if (Fortnite_Version == 17.50) {
auto FarmAfter = FindObject<AActor>(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.farmbase_2")); auto FarmAfter = FindObject<AActor>(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.farmbase_2"));
ShowFoundation(FarmAfter); ShowFoundation(FarmAfter);
@@ -369,6 +364,11 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
} }
if (Fortnite_Version == 14.60 && Globals::bGoingToPlayEvent)
{
ShowFoundation(FindObject<AActor>("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation3")); // Aircraft Carrier
}
auto TheBlock = FindObject<AActor>("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank auto TheBlock = FindObject<AActor>("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank
if (TheBlock) if (TheBlock)

View File

@@ -6,6 +6,7 @@
#include "KismetStringLibrary.h" #include "KismetStringLibrary.h"
#include "reboot.h" #include "reboot.h"
#include "BuildingSMActor.h" #include "BuildingSMActor.h"
#include "FortSafeZoneIndicator.h"
#include "GameplayStatics.h" #include "GameplayStatics.h"
struct FAircraftFlightInfo struct FAircraftFlightInfo
@@ -48,6 +49,8 @@ static void ShowFoundation(AActor* BuildingFoundation, bool bShow = true)
return; return;
} }
LOG_INFO(LogDev, "{} {}", bShow ? "Showing" : "Hiding", BuildingFoundation->GetName());
bool bServerStreamedInLevelValue = bShow; // ?? bool bServerStreamedInLevelValue = bShow; // ??
static auto bServerStreamedInLevelFieldMask = GetFieldMask(BuildingFoundation->GetProperty("bServerStreamedInLevel")); static auto bServerStreamedInLevelFieldMask = GetFieldMask(BuildingFoundation->GetProperty("bServerStreamedInLevel"));
@@ -173,6 +176,12 @@ public:
static inline void (*Athena_HandleStartingNewPlayerOriginal)(AFortGameModeAthena* GameMode, AActor* NewPlayer); static inline void (*Athena_HandleStartingNewPlayerOriginal)(AFortGameModeAthena* GameMode, AActor* NewPlayer);
static inline void (*SetZoneToIndexOriginal)(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK); static inline void (*SetZoneToIndexOriginal)(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK);
AFortSafeZoneIndicator*& GetSafeZoneIndicator()
{
static auto SafeZoneIndicatorOffset = GetOffset("SafeZoneIndicator");
return Get<AFortSafeZoneIndicator*>(SafeZoneIndicatorOffset);
}
AFortGameStateAthena* GetGameStateAthena() AFortGameStateAthena* GetGameStateAthena()
{ {
return (AFortGameStateAthena*)GetGameState(); return (AFortGameStateAthena*)GetGameState();

View File

@@ -640,12 +640,19 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController*
static int LastNum1 = 124; static int LastNum1 = 124;
if (LastNum1 != AmountOfRestarts) if (LastNum1 != AmountOfRestarts)
{
auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator();
if (SafeZoneIndicator)
{ {
LastNum1 = AmountOfRestarts; LastNum1 = AmountOfRestarts;
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipshrinksafezone", nullptr); SafeZoneIndicator->SkipShrinkSafeZone();
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipshrinksafezone", nullptr); SafeZoneIndicator->SkipShrinkSafeZone();
} }
}
// return ServerAttemptAircraftJumpOriginal(PC, ClientRotation);
} }
void AFortPlayerController::ServerDropAllItemsHook(AFortPlayerController* PlayerController, UFortItemDefinition* IgnoreItemDef) void AFortPlayerController::ServerDropAllItemsHook(AFortPlayerController* PlayerController, UFortItemDefinition* IgnoreItemDef)
@@ -1284,11 +1291,7 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr
if (!PlayerState) if (!PlayerState)
return; return;
// if (!BuildingActorToEdit->GetEditingPlayer() || !PlayerController->GetPlayerState()) BuildingActorToEdit->SetEditingPlayer(PlayerState);
// SetNetDormancy(BuildingActorToEdit, 1);
BuildingActorToEdit->SetNetDormancy(ENetDormancy::DORM_Awake);
BuildingActorToEdit->GetEditingPlayer() = PlayerState;
// Onrep?
auto WorldInventory = PlayerController->GetWorldInventory(); auto WorldInventory = PlayerController->GetWorldInventory();
@@ -1302,16 +1305,15 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr
if (!EditToolInstance) if (!EditToolInstance)
return; return;
if (auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()))) Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
// if (auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, FGuid{})))
{ auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
if (!EditTool)
return;
EditTool->GetEditActor() = BuildingActorToEdit; EditTool->GetEditActor() = BuildingActorToEdit;
EditTool->OnRep_EditActor(); EditTool->OnRep_EditActor();
}
else
{
LOG_INFO(LogDev, "Failed to equip editing tool!");
}
} }
void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame& Stack, void* Ret) void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame& Stack, void* Ret)
@@ -1344,7 +1346,7 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
// if (!PlayerState || PlayerState->GetTeamIndex() != BuildingActorToEdit->GetTeamIndex()) // if (!PlayerState || PlayerState->GetTeamIndex() != BuildingActorToEdit->GetTeamIndex())
//return ServerEditBuildingActorOriginal(Context, Frame, Ret); //return ServerEditBuildingActorOriginal(Context, Frame, Ret);
BuildingActorToEdit->GetEditingPlayer() = nullptr; BuildingActorToEdit->SetEditingPlayer(nullptr);
static ABuildingSMActor* (*BuildingSMActorReplaceBuildingActor)(ABuildingSMActor*, __int64, UClass*, int, int, uint8_t, AFortPlayerController*) = static ABuildingSMActor* (*BuildingSMActorReplaceBuildingActor)(ABuildingSMActor*, __int64, UClass*, int, int, uint8_t, AFortPlayerController*) =
decltype(BuildingSMActorReplaceBuildingActor)(Addresses::ReplaceBuildingActor); decltype(BuildingSMActorReplaceBuildingActor)(Addresses::ReplaceBuildingActor);
@@ -1369,6 +1371,22 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl
|| BuildingActorToStopEditing->IsDestroyed()) || BuildingActorToStopEditing->IsDestroyed())
return; return;
BuildingActorToStopEditing->SetEditingPlayer(nullptr);
static auto EditToolDef = FindObject<UFortWeaponItemDefinition>("/Game/Items/Weapons/BuildingTools/EditTool.EditTool");
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return;
auto EditToolInstance = WorldInventory->FindItemInstance(EditToolDef);
if (!EditToolInstance)
return;
Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon()); auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
BuildingActorToStopEditing->GetEditingPlayer() = nullptr; BuildingActorToStopEditing->GetEditingPlayer() = nullptr;

View File

@@ -26,7 +26,7 @@ void AFortPlayerStateAthena::ServerSetInAircraftHook(UObject* Context, FFrame& S
auto& ItemInstances = InventoryList.GetItemInstances(); auto& ItemInstances = InventoryList.GetItemInstances();
if (/* (bNewInAircraft && !PlayerController->IsInAircraft()) || */ /* (Globals::bLateGame ? bNewInAircraft : true)) && */ /* !Globals::bLateGame.load() && */ ItemInstances.Num()) if (/* (bNewInAircraft && !PlayerController->IsInAircraft()) || */ /* (Globals::bLateGame ? bNewInAircraft : true)) && */ !Globals::bLateGame.load() && ItemInstances.Num())
{ {
// std::cout << "InventoryList.ItemInstances.Num(): " << InventoryList.ItemInstances.Num() << '\n'; // std::cout << "InventoryList.ItemInstances.Num(): " << InventoryList.ItemInstances.Num() << '\n';

View File

@@ -0,0 +1,12 @@
#include "FortSafeZoneIndicator.h"
#include "FortGameModeAthena.h"
#include "reboot.h"
void AFortSafeZoneIndicator::SkipShrinkSafeZone()
{
auto GameState = Cast<AFortGameStateAthena>(((AFortGameMode*)GetWorld()->GetGameMode())->GetGameState());
GetSafeZoneStartShrinkTime() = GameState->GetServerWorldTimeSeconds();
GetSafeZoneFinishShrinkTime() = GameState->GetServerWorldTimeSeconds() + 0.2;
}

View File

@@ -0,0 +1,21 @@
#pragma once
#include "Actor.h"
class AFortSafeZoneIndicator : public AActor
{
public:
float& GetSafeZoneStartShrinkTime()
{
static auto SafeZoneStartShrinkTimeOffset = GetOffset("SafeZoneStartShrinkTime");
return Get<float>(SafeZoneStartShrinkTimeOffset);
}
float& GetSafeZoneFinishShrinkTime()
{
static auto SafeZoneFinishShrinkTimeOffset = GetOffset("SafeZoneFinishShrinkTime");
return Get<float>(SafeZoneFinishShrinkTimeOffset);
}
void SkipShrinkSafeZone();
};

View File

@@ -218,6 +218,7 @@
<ClCompile Include="FortPlayerPawnAthena.cpp" /> <ClCompile Include="FortPlayerPawnAthena.cpp" />
<ClCompile Include="FortPlayerStateAthena.cpp" /> <ClCompile Include="FortPlayerStateAthena.cpp" />
<ClCompile Include="FortPlaysetItemDefinition.cpp" /> <ClCompile Include="FortPlaysetItemDefinition.cpp" />
<ClCompile Include="FortSafeZoneIndicator.cpp" />
<ClCompile Include="FortWeapon.cpp" /> <ClCompile Include="FortWeapon.cpp" />
<ClCompile Include="FortWeaponItemDefinition.cpp" /> <ClCompile Include="FortWeaponItemDefinition.cpp" />
<ClCompile Include="FortWeaponRangedMountedCannon.cpp" /> <ClCompile Include="FortWeaponRangedMountedCannon.cpp" />
@@ -319,6 +320,7 @@
<ClInclude Include="FortPlaysetItemDefinition.h" /> <ClInclude Include="FortPlaysetItemDefinition.h" />
<ClInclude Include="FortQuickBars.h" /> <ClInclude Include="FortQuickBars.h" />
<ClInclude Include="FortResourceItemDefinition.h" /> <ClInclude Include="FortResourceItemDefinition.h" />
<ClInclude Include="FortSafeZoneIndicator.h" />
<ClInclude Include="FortVolume.h" /> <ClInclude Include="FortVolume.h" />
<ClInclude Include="FortWeapon.h" /> <ClInclude Include="FortWeapon.h" />
<ClInclude Include="FortWeaponItemDefinition.h" /> <ClInclude Include="FortWeaponItemDefinition.h" />

View File

@@ -233,6 +233,9 @@
<ClCompile Include="BuildingFoundation.cpp"> <ClCompile Include="BuildingFoundation.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortSafeZoneIndicator.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
@@ -719,6 +722,9 @@
<ClInclude Include="LatentActionManager.h"> <ClInclude Include="LatentActionManager.h">
<Filter>Engine\Source\Runtime\Engine\Classes\Engine</Filter> <Filter>Engine\Source\Runtime\Engine\Classes\Engine</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FortSafeZoneIndicator.h">
<Filter>FortniteGame\Source\FortniteGame\Public</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">

View File

@@ -61,6 +61,12 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
static auto SafeZoneIndicatorOffset = GameModeAthena->GetOffset("SafeZoneIndicator"); static auto SafeZoneIndicatorOffset = GameModeAthena->GetOffset("SafeZoneIndicator");
auto SafeZoneIndicator = GameModeAthena->Get<AActor*>(SafeZoneIndicatorOffset); auto SafeZoneIndicator = GameModeAthena->Get<AActor*>(SafeZoneIndicatorOffset);
if (!SafeZoneIndicator)
{
LOG_WARN(LogZone, "Invalid SafeZoneIndicator!");
return SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK);
}
static auto SafeZoneFinishShrinkTimeOffset = SafeZoneIndicator->GetOffset("SafeZoneFinishShrinkTime"); static auto SafeZoneFinishShrinkTimeOffset = SafeZoneIndicator->GetOffset("SafeZoneFinishShrinkTime");
static auto SafeZoneStartShrinkTimeOffset = SafeZoneIndicator->GetOffset("SafeZoneStartShrinkTime"); static auto SafeZoneStartShrinkTimeOffset = SafeZoneIndicator->GetOffset("SafeZoneStartShrinkTime");
static auto RadiusOffset = SafeZoneIndicator->GetOffset("Radius"); static auto RadiusOffset = SafeZoneIndicator->GetOffset("Radius");
@@ -70,6 +76,12 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
static auto MapInfoOffset = GameState->GetOffset("MapInfo"); static auto MapInfoOffset = GameState->GetOffset("MapInfo");
auto MapInfo = GameState->Get<AActor*>(MapInfoOffset); auto MapInfo = GameState->Get<AActor*>(MapInfoOffset);
if (!MapInfo)
{
LOG_WARN(LogZone, "Invalid MapInfo!")
return SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK);
}
static auto SafeZoneDefinitionOffset = MapInfo->GetOffset("SafeZoneDefinition"); static auto SafeZoneDefinitionOffset = MapInfo->GetOffset("SafeZoneDefinition");
auto SafeZoneDefinition = MapInfo->GetPtr<__int64>(SafeZoneDefinitionOffset); auto SafeZoneDefinition = MapInfo->GetPtr<__int64>(SafeZoneDefinitionOffset);
@@ -159,7 +171,6 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
SafeZoneIndicator->Get<float>(SafeZoneFinishShrinkTimeOffset) = SafeZoneIndicator->Get<float>(SafeZoneStartShrinkTimeOffset) + ZoneDuration; SafeZoneIndicator->Get<float>(SafeZoneFinishShrinkTimeOffset) = SafeZoneIndicator->Get<float>(SafeZoneStartShrinkTimeOffset) + ZoneDuration;
} }
void ProcessEventHook(UObject* Object, UFunction* Function, void* Parameters) void ProcessEventHook(UObject* Object, UFunction* Function, void* Parameters)
{ {
if (!Object || !Function) if (!Object || !Function)

View File

@@ -193,6 +193,9 @@ DWORD WINAPI Main(LPVOID)
bool bUseRemovePlayer = false; bool bUseRemovePlayer = false;
bool bUseSwitchLevel = false; bool bUseSwitchLevel = false;
Hooking::MinHook::Hook(FindObject<ABuildingFoundation>("/Script/FortniteGame.Default__BuildingFoundation"),
FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.SetDynamicFoundationTransform"),
ABuildingFoundation::SetDynamicFoundationTransformHook, (PVOID*)&ABuildingFoundation::SetDynamicFoundationTransformOriginal, false, true);
Hooking::MinHook::Hook(FindObject<ABuildingFoundation>("/Script/FortniteGame.Default__BuildingFoundation"), Hooking::MinHook::Hook(FindObject<ABuildingFoundation>("/Script/FortniteGame.Default__BuildingFoundation"),
FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.SetDynamicFoundationEnabled"), FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.SetDynamicFoundationEnabled"),