added some specific playlist items, fix s8-s10 markers because i broke, fixed removing items on aircraft on every version, added thanos stone automatic spawning, fix a bug with lategame, add marshmello stage, fix multiple battle buses, fix teams on large team gamemodes, fix some items not removing automatically
This commit is contained in:
Milxnor
2023-04-21 22:09:20 -04:00
parent a16bb42c01
commit 769dfa08ef
29 changed files with 572 additions and 93 deletions

View File

@@ -19,7 +19,7 @@ void UAthenaMarkerComponent::ServerAddMapMarkerHook(UAthenaMarkerComponent* Mark
auto MarkerRequestPtr = &MarkerRequest; auto MarkerRequestPtr = &MarkerRequest;
bool useRealloc = true; bool useRealloc = false;
auto MarkerData = Alloc<FFortWorldMarkerData>(FFortWorldMarkerData::GetStructSize(), useRealloc); auto MarkerData = Alloc<FFortWorldMarkerData>(FFortWorldMarkerData::GetStructSize(), useRealloc);
static auto IconOffset = FindOffsetStruct("/Script/FortniteGame.MarkedActorDisplayInfo", "Icon"); static auto IconOffset = FindOffsetStruct("/Script/FortniteGame.MarkedActorDisplayInfo", "Icon");

View File

@@ -0,0 +1,8 @@
#pragma once
#include "Actor.h"
class AFortAthenaMutator : public AActor // AFortGameplayMutator
{
public:
};

View File

@@ -0,0 +1,69 @@
#pragma once
#include "Actor.h"
#include "CurveTable.h"
#include "GameplayAbilityTypes.h"
#include "FortWeaponItemDefinition.h"
#include "Stack.h"
#include "FortPlayerStateAthena.h"
#include "FortAthenaMutator.h"
struct FGunGameGunEntry
{
UFortWeaponItemDefinition* Weapon; // 0x0000(0x0008) (Edit, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
FScalableFloat Enabled; // 0x0008(0x0020) (Edit, DisableEditOnInstance, NativeAccessSpecifierPublic)
FScalableFloat AwardAtElim; // 0x0028(0x0020) (Edit, DisableEditOnInstance, NativeAccessSpecifierPublic)
};
struct FGunGameGunEntries
{
TArray<struct FGunGameGunEntry> Entries; // 0x0000(0x0010) (ZeroConstructor, NativeAccessSpecifierPublic)
};
struct FGunGamePlayerData
{
TArray<class UFortWeaponItemDefinition*> CurrentlyAssignedWeapons; // 0x0000(0x0010) (ZeroConstructor, NativeAccessSpecifierPublic)
};
class AFortAthenaMutator_GG : public AFortAthenaMutator
{
public:
TArray<FGunGameGunEntry>& GetWeaponEntries()
{
static auto WeaponEntriesOffset = GetOffset("WeaponEntries");
return Get<TArray<FGunGameGunEntry>>(WeaponEntriesOffset);
}
TMap<int, FGunGameGunEntries>& GetAwardEntriesAtElimMap()
{
static auto AwardEntriesAtElimMapOffset = GetOffset("AwardEntriesAtElimMap");
return Get<TMap<int, FGunGameGunEntries>>(AwardEntriesAtElimMapOffset);
}
TMap<AFortPlayerStateAthena*, FGunGamePlayerData>& GetPlayerData()
{
static auto PlayerDataOffset = GetOffset("PlayerData");
return Get<TMap<AFortPlayerStateAthena*, FGunGamePlayerData>>(PlayerDataOffset);
}
FGunGameGunEntries GetEntriesFromAward(const FScalableFloat& AwardAtElim)
{
auto& AwardEntriesAtElimMap = GetAwardEntriesAtElimMap();
float Value = 0;
for (auto& AwardEntry : AwardEntriesAtElimMap)
{
if (AwardEntry.First == Value)
{
return AwardEntry.Second;
}
}
}
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortAthenaMutator_GG");
return Class;
}
};

View File

@@ -0,0 +1,8 @@
#include "FortAthenaMutator_GiveItemsAtGamePhaseStep.h"
void AFortAthenaMutator_GiveItemsAtGamePhaseStep::OnGamePhaseStepChangedHook(UObject* Context, FFrame& Stack, void* Ret)
{
LOG_INFO(LogDev, "OnGamePhaseStepChangedHook!");
return OnGamePhaseStepChangedOriginal(Context, Stack, Ret);
}

View File

@@ -0,0 +1,40 @@
#pragma once
#include "Actor.h"
#include "CurveTable.h"
#include "GameplayAbilityTypes.h"
#include "FortWorldItemDefinition.h"
#include "Stack.h"
#include "FortAthenaMutator.h"
struct FItemsToGive
{
UFortWorldItemDefinition* ItemToDrop; // 0x0000(0x0008) (Edit, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
FScalableFloat NumberToGive; // 0x0008(0x0020) (Edit, NativeAccessSpecifierPublic)
};
class AFortAthenaMutator_GiveItemsAtGamePhaseStep : public AFortAthenaMutator
{
public:
static inline void (*OnGamePhaseStepChangedOriginal)(UObject* Context, FFrame& Stack, void* Ret);
uint8_t& GetPhaseToGiveItems()
{
static auto PhaseToGiveItemsOffset = GetOffset("PhaseToGiveItems");
return Get<uint8_t>(PhaseToGiveItemsOffset);
}
TArray<FItemsToGive>& GetItemsToGive()
{
static auto ItemsToGiveOffset = GetOffset("ItemsToGive");
return Get<TArray<FItemsToGive>>(ItemsToGiveOffset);
}
static void OnGamePhaseStepChangedHook(UObject* Context, FFrame& Stack, void* Ret);
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortAthenaMutator_GiveItemsAtGamePhaseStep");
return Class;
}
};

View File

@@ -0,0 +1,8 @@
#pragma once
#include "FortAthenaMutator.h"
class AFortAthenaMutator_InventoryOverride : public AFortAthenaMutator
{
public:
};

View File

@@ -0,0 +1,35 @@
#pragma once
#include "FortAthenaMutator_InventoryOverride.h"
#include "GameplayAbilityTypes.h"
#include "CurveTable.h"
#include "FortItemDefinition.h"
#include "FortInventory.h"
struct FHotfixableInventoryOverrideItem
{
public:
FScalableFloat Count; // 0x0(0x20)(Edit, BlueprintVisible, NativeAccessSpecifierPublic)
UFortItemDefinition* Item; // 0x20(0x8)(Edit, BlueprintVisible, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
};
struct FItemLoadoutContainer
{
public:
FScalableFloat bEnabled; // 0x0(0x20)(Edit, DisableEditOnInstance, NativeAccessSpecifierPublic)
TArray<FItemAndCount> Loadout; // 0x20(0x10)(ZeroConstructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
TArray<FHotfixableInventoryOverrideItem> LoadoutList; // 0x30(0x10)(Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, HasGetValueTypeHash, NativeAccessSpecifierPublic)
};
struct FItemLoadoutBucket
{
public:
FScalableFloat bEnabled; // 0x0(0x20)(Edit, DisableEditOnInstance, NativeAccessSpecifierPublic)
TArray<FItemLoadoutContainer> Loadouts; // 0x20(0x10)(Edit, ZeroConstructor, DisableEditOnInstance, HasGetValueTypeHash, NativeAccessSpecifierPublic)
uint8 Pad_3D83[0x8]; // Fixing Size Of Struct [ Dumper-7 ]
};
class AFortAthenaMutator_InventoryOverride_Bucket : public AFortAthenaMutator_InventoryOverride
{
public:
};

View File

@@ -0,0 +1,23 @@
#pragma once
#include "FortAthenaMutator.h"
#include "GameplayAbilityTypes.h"
#include "CurveTable.h"
#include "FortWorldItemDefinition.h"
#include "FortInventory.h"
struct FItemsToDropOnDeath
{
UFortWorldItemDefinition* ItemToDrop; // 0x0000(0x0008) (Edit, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
FScalableFloat NumberToDrop; // 0x0008(0x0020) (Edit, NativeAccessSpecifierPublic)
};
class AFortAthenaMutator_ItemDropOnDeath : public AFortAthenaMutator
{
public:
TArray<FItemsToDropOnDeath>& GetItemsToDrop()
{
static auto ItemsToDropOffset = GetOffset("ItemsToDrop");
return Get<TArray<FItemsToDropOnDeath>>(ItemsToDropoOffset);
}
};

View File

@@ -1,5 +1,36 @@
#include "FortAthenaSupplyDrop.h" #include "FortAthenaSupplyDrop.h"
AFortPickup* AFortAthenaSupplyDrop::SpawnPickupFromItemEntryHook(UObject* Context, FFrame& Stack, AFortPickup** Ret)
{
LOG_INFO(LogDev, __FUNCTION__);
return SpawnPickupFromItemEntryOriginal(Context, Stack, Ret);
}
AFortPickup* AFortAthenaSupplyDrop::SpawnGameModePickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret)
{
UFortWorldItemDefinition* ItemDefinition = nullptr; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
UClass* PickupClass = nullptr; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic)
int NumberToSpawn; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
AFortPawn* TriggeringPawn = nullptr; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
FVector Position; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
FVector Direction;
Stack.StepCompiledIn(&ItemDefinition);
Stack.StepCompiledIn(&PickupClass);
Stack.StepCompiledIn(&NumberToSpawn);
Stack.StepCompiledIn(&TriggeringPawn);
Stack.StepCompiledIn(&Position);
Stack.StepCompiledIn(&Direction);
SpawnGameModePickupOriginal(Context, Stack, Ret);
if (!ItemDefinition || !PickupClass)
return nullptr;
*Ret = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource::SupplyDrop, -1, TriggeringPawn, PickupClass);
return *Ret;
}
AFortPickup* AFortAthenaSupplyDrop::SpawnPickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret) AFortPickup* AFortAthenaSupplyDrop::SpawnPickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret)
{ {
UFortWorldItemDefinition* ItemDefinition = nullptr; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) UFortWorldItemDefinition* ItemDefinition = nullptr; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
@@ -21,4 +52,5 @@ AFortPickup* AFortAthenaSupplyDrop::SpawnPickupHook(UObject* Context, FFrame& St
*Ret = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource::SupplyDrop, -1, TriggeringPawn); *Ret = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource::SupplyDrop, -1, TriggeringPawn);
return *Ret; return *Ret;
} }

View File

@@ -9,6 +9,10 @@ class AFortAthenaSupplyDrop : public ABuildingGameplayActor
{ {
public: public:
static inline AFortPickup* (*SpawnPickupOriginal)(UObject* Context, FFrame& Stack, AFortPickup** Ret); static inline AFortPickup* (*SpawnPickupOriginal)(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static inline AFortPickup* (*SpawnGameModePickupOriginal)(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static inline AFortPickup* (*SpawnPickupFromItemEntryOriginal)(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static AFortPickup* SpawnPickupFromItemEntryHook(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static AFortPickup* SpawnGameModePickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static AFortPickup* SpawnPickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret); static AFortPickup* SpawnPickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret);
}; };

View File

@@ -327,6 +327,15 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
} }
if (Fortnite_Version == 7.30)
{
auto PleasantParkIdk = FindObject<AActor>(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.PleasentParkFestivus"));
ShowFoundation(PleasantParkIdk);
auto PleasantParkGround = FindObject<AActor>("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.PleasentParkDefault");
ShowFoundation(PleasantParkGround);
}
if (Fortnite_Season == 6) if (Fortnite_Season == 6)
{ {
if (Fortnite_Version != 6.10) if (Fortnite_Version != 6.10)
@@ -374,7 +383,24 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
if (TheBlock) if (TheBlock)
ShowFoundation(TheBlock); ShowFoundation(TheBlock);
SetBitfield(GameMode->GetPtr<PlaceholderBitfield>("bWorldIsReady"), 1, true); static auto GameState_AirCraftBehaviorOffset = GameState->GetOffset("AirCraftBehavior", false);
if (GameState_AirCraftBehaviorOffset != -1)
{
GET_PLAYLIST(GameState);
if (CurrentPlaylist)
{
static auto Playlist_AirCraftBehaviorOffset = CurrentPlaylist->GetOffset("AirCraftBehavior", false);
if (Playlist_AirCraftBehaviorOffset != -1)
{
GameState->Get<uint8_t>(GameState_AirCraftBehaviorOffset) = CurrentPlaylist->Get<uint8_t>(Playlist_AirCraftBehaviorOffset);
}
}
}
SetBitfield(GameMode->GetPtr<PlaceholderBitfield>("bWorldIsReady"), 1, true); // idk when we actually set this
Globals::bInitializedPlaylist = true; Globals::bInitializedPlaylist = true;
} }
@@ -478,6 +504,23 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
static auto bAlwaysDBNOOffset = GameMode->GetOffset("bAlwaysDBNO"); static auto bAlwaysDBNOOffset = GameMode->GetOffset("bAlwaysDBNO");
// GameMode->Get<bool>(bAlwaysDBNOOffset) = true; // GameMode->Get<bool>(bAlwaysDBNOOffset) = true;
static auto GameState_AirCraftBehaviorOffset = GameState->GetOffset("AirCraftBehavior", false);
if (GameState_AirCraftBehaviorOffset != -1)
{
GET_PLAYLIST(GameState);
if (CurrentPlaylist)
{
static auto Playlist_AirCraftBehaviorOffset = CurrentPlaylist->GetOffset("AirCraftBehavior", false);
if (Playlist_AirCraftBehaviorOffset != -1)
{
GameState->Get<uint8_t>(GameState_AirCraftBehaviorOffset) = CurrentPlaylist->Get<uint8_t>(Playlist_AirCraftBehaviorOffset);
}
}
}
LOG_INFO(LogDev, "Initialized!"); LOG_INFO(LogDev, "Initialized!");
} }
@@ -529,6 +572,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint8 preferredTeam, AActor* Controller) int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint8 preferredTeam, AActor* Controller)
{ {
// VERY BASIC IMPLEMENTATION
LOG_INFO(LogTeams, "PickTeam called!"); LOG_INFO(LogTeams, "PickTeam called!");
auto GameState = Cast<AFortGameStateAthena>(GameMode->GetGameState()); auto GameState = Cast<AFortGameStateAthena>(GameMode->GetGameState());
@@ -537,6 +582,7 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint
UObject* Playlist = nullptr; UObject* Playlist = nullptr;
static int DefaultFirstTeam = 3;
static int CurrentTeamMembers = 0; // bad static int CurrentTeamMembers = 0; // bad
static int Current = 3; static int Current = 3;
@@ -553,6 +599,9 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint
// std::cout << "Dru!\n"; // std::cout << "Dru!\n";
int MaxSquadSize = 1; int MaxSquadSize = 1;
int TeamsNum = 0;
bool bShouldSpreadTeams = false;
if (CurrentPlaylistDataOffset != -1 || Fortnite_Version >= 6) if (CurrentPlaylistDataOffset != -1 || Fortnite_Version >= 6)
{ {
@@ -568,6 +617,16 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint
static auto MaxSquadSizeOffset = Playlist->GetOffset("MaxSquadSize"); static auto MaxSquadSizeOffset = Playlist->GetOffset("MaxSquadSize");
MaxSquadSize = Playlist->Get<int>(MaxSquadSizeOffset); MaxSquadSize = Playlist->Get<int>(MaxSquadSizeOffset);
static auto bShouldSpreadTeamsOffset = Playlist->GetOffset("bShouldSpreadTeams", false);
if (bShouldSpreadTeamsOffset != -1)
bShouldSpreadTeams = Playlist->Get<bool>(bShouldSpreadTeamsOffset);
static auto MaxTeamCountOffset = Playlist->GetOffset("MaxTeamCount", false);
if (MaxTeamCountOffset != -1)
TeamsNum = Playlist->Get<int>(MaxTeamCountOffset);
} }
else else
{ {
@@ -576,9 +635,12 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint
: OldPlaylist == EFortAthenaPlaylist::AthenaDuo ? 2 : OldPlaylist == EFortAthenaPlaylist::AthenaDuo ? 2
: OldPlaylist == EFortAthenaPlaylist::AthenaSquad ? 4 : OldPlaylist == EFortAthenaPlaylist::AthenaSquad ? 4
: 1; : 1;
TeamsNum = 100;
} }
static int NextTeamIndex = 3; // Playlist->Get<uint8>("DefaultFirstTeam"); // + 1? static int NextTeamIndex = DefaultFirstTeam;
static int LastTeamIndex = NextTeamIndex;
static int LastNum1 = 1; static int LastNum1 = 1;
@@ -586,17 +648,34 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint
{ {
LastNum1 = AmountOfRestarts; LastNum1 = AmountOfRestarts;
NextTeamIndex = 3; // Playlist->Get<uint8>("DefaultFirstTeam"); // + 1? NextTeamIndex = DefaultFirstTeam;
} }
// std::cout << "CurrentTeamMembers: " << CurrentTeamMembers << '\n'; LastTeamIndex = NextTeamIndex;
if (CurrentTeamMembers >= MaxSquadSize) if (!bShouldSpreadTeams)
{ {
// std::cout << "Moving next team!\n"; if (CurrentTeamMembers >= MaxSquadSize)
{
NextTeamIndex++;
CurrentTeamMembers = 0;
}
}
else
{
// Basically, this goes through all the teams, and whenever we hit the last team, we go back to the first.
NextTeamIndex++; auto Idx = NextTeamIndex - 2; // 1-100
CurrentTeamMembers = 0;
if (CurrentTeamMembers >= 1) // We spread every player.
{
if (Idx > TeamsNum)
NextTeamIndex = DefaultFirstTeam;
else
NextTeamIndex++;
CurrentTeamMembers = 0;
}
} }
LOG_INFO(LogTeams, "Player is going on team {} with {} members.", NextTeamIndex, CurrentTeamMembers); LOG_INFO(LogTeams, "Player is going on team {} with {} members.", NextTeamIndex, CurrentTeamMembers);

View File

@@ -275,7 +275,9 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
if (!ItemDefinition) if (!ItemDefinition)
return false; return false;
if (Count < 0) int OldCount = Count;
if (Count < 0) // idk why i have this
{ {
Count = 0; Count = 0;
bForceRemoval = true; bForceRemoval = true;
@@ -310,7 +312,7 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
} }
} }
if (NewCount > 0 || bOverrideChangeStackSize) if (OldCount != -1 && (NewCount > 0 || bOverrideChangeStackSize))
{ {
ItemInstance->GetItemEntry()->GetCount() = NewCount; ItemInstance->GetItemEntry()->GetCount() = NewCount;
ReplicatedEntry->GetCount() = NewCount; ReplicatedEntry->GetCount() = NewCount;
@@ -339,6 +341,7 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
{ {
if (auto GadgetItemDefinition = Cast<UFortGadgetItemDefinition>(ItemDefinition)) if (auto GadgetItemDefinition = Cast<UFortGadgetItemDefinition>(ItemDefinition))
{ {
LOG_INFO(LogDev, "Unequipping Gadget!");
GadgetItemDefinition->UnequipGadgetData(FortPlayerController, ItemInstances.at(i)); GadgetItemDefinition->UnequipGadgetData(FortPlayerController, ItemInstances.at(i));
} }
} }

View File

@@ -177,7 +177,8 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
if (ItemDefGoingInPrimary && IsPrimaryQuickbar(CurrentItemEntry->GetItemDefinition())) if (ItemDefGoingInPrimary && IsPrimaryQuickbar(CurrentItemEntry->GetItemDefinition()))
{ {
PrimarySlotsFilled++; int AmountOfSlotsTakenUp = 1; // TODO
PrimarySlotsFilled += AmountOfSlotsTakenUp;
} }
// LOG_INFO(LogDev, "[{}] PrimarySlotsFilled: {}", i, PrimarySlotsFilled); // LOG_INFO(LogDev, "[{}] PrimarySlotsFilled: {}", i, PrimarySlotsFilled);

View File

@@ -596,12 +596,32 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController*
auto NewPawnAsFort = Cast<AFortPawn>(NewPawn); auto NewPawnAsFort = Cast<AFortPawn>(NewPawn);
if (NewPawnAsFort) if (NewPawnAsFort)
{
NewPawnAsFort->SetHealth(100); NewPawnAsFort->SetHealth(100);
if (Globals::bLateGame)
NewPawnAsFort->SetShield(100);
}
// PlayerController->ServerRestartPlayer(); // PlayerController->ServerRestartPlayer();
if (Globals::bLateGame) if (Globals::bLateGame)
{ {
static int LastNum1 = 124;
if (LastNum1 != AmountOfRestarts)
{
auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator();
if (SafeZoneIndicator)
{
LastNum1 = AmountOfRestarts;
SafeZoneIndicator->SkipShrinkSafeZone();
SafeZoneIndicator->SkipShrinkSafeZone();
}
}
static auto WoodItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); static auto WoodItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
static auto StoneItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/StoneItemData.StoneItemData"); static auto StoneItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/StoneItemData.StoneItemData");
static auto MetalItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/MetalItemData.MetalItemData"); static auto MetalItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/MetalItemData.MetalItemData");
@@ -637,21 +657,6 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController*
WorldInventory->Update(); WorldInventory->Update();
} }
static int LastNum1 = 124;
if (LastNum1 != AmountOfRestarts)
{
auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator();
if (SafeZoneIndicator)
{
LastNum1 = AmountOfRestarts;
SafeZoneIndicator->SkipShrinkSafeZone();
SafeZoneIndicator->SkipShrinkSafeZone();
}
}
// return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); // return ServerAttemptAircraftJumpOriginal(PC, ClientRotation);
} }
@@ -1019,7 +1024,6 @@ uint8 ToDeathCause(const FGameplayTagContainer& TagContainer, bool bWasDBNO = fa
Addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 41 0F B6 F8 48 8B DA 48 8B F1 E8 ? ? ? ? 33 ED").Get(); Addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 41 0F B6 F8 48 8B DA 48 8B F1 E8 ? ? ? ? 33 ED").Get();
if (Engine_Version == 420) if (Engine_Version == 420)
Addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 0F B6 FA 48 8B D9 E8 ? ? ? ? 33 F6 48 89 74 24").Get(); Addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 0F B6 FA 48 8B D9 E8 ? ? ? ? 33 F6 48 89 74 24").Get();
if (Engine_Version == 421) // 5.1 if (Engine_Version == 421) // 5.1
Addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 0F B6 FA 48 8B D9 E8 ? ? ? ? 33").Get(); Addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 0F B6 FA 48 8B D9 E8 ? ? ? ? 33").Get();
@@ -1222,7 +1226,8 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
if (DamageCauser->IsA(FortProjectileBaseClass)) if (DamageCauser->IsA(FortProjectileBaseClass))
{ {
LOG_INFO(LogDev, "From a projectile!"); LOG_INFO(LogDev, "From a projectile!");
KillerWeaponDef = ((AFortWeapon*)DamageCauser->GetOwner())->GetWeaponData(); auto Owner = Cast<AFortWeapon>(DamageCauser->GetOwner());
KillerWeaponDef = Owner->IsValidLowLevel() ? Owner->GetWeaponData() : nullptr; // I just added the IsValidLowLevel check because what if the weapon destroys?
} }
if (auto Weapon = Cast<AFortWeapon>(DamageCauser)) if (auto Weapon = Cast<AFortWeapon>(DamageCauser))
{ {

View File

@@ -6,6 +6,103 @@
#include "globals.h" #include "globals.h"
#include "GameplayStatics.h" #include "GameplayStatics.h"
#include "hooking.h" #include "hooking.h"
#include "FortAthenaMutator_GiveItemsAtGamePhaseStep.h"
#include "DataTableFunctionLibrary.h"
void AFortPlayerControllerAthena::EnterAircraftHook(UObject* PC, AActor* Aircraft)
{
auto PlayerController = Cast<AFortPlayerController>(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner());
if (!PlayerController)
return;
LOG_INFO(LogDev, "EnterAircraftHook");
EnterAircraftOriginal(PC, Aircraft);
// TODO Check if the player successfully got in the aircraft.
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return;
std::vector<std::pair<FGuid, int>> GuidAndCountsToRemove;
auto& InventoryList = WorldInventory->GetItemList();
auto& ItemInstances = InventoryList.GetItemInstances();
for (int i = 0; i < ItemInstances.Num(); i++)
{
auto ItemEntry = ItemInstances.at(i)->GetItemEntry();
auto ItemDefinition = Cast<UFortWorldItemDefinition>(ItemEntry->GetItemDefinition());
if (!ItemDefinition)
continue;
if (!ItemDefinition->CanBeDropped())
continue;
GuidAndCountsToRemove.push_back({ ItemEntry->GetItemGuid(), ItemEntry->GetCount() });
}
for (auto& Pair : GuidAndCountsToRemove)
{
WorldInventory->RemoveItem(Pair.first, nullptr, Pair.second, true);
}
static auto mutatorClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaMutator");
auto AllMutators = UGameplayStatics::GetAllActorsOfClass(GetWorld(), mutatorClass);
for (int i = 0; i < AllMutators.Num(); i++)
{
auto Mutator = AllMutators.at(i);
LOG_INFO(LogDev, "[{}] Mutator: {}", i, Mutator->GetFullName());
if (auto GiveItemsAtGamePhaseStepMutator = Cast<AFortAthenaMutator_GiveItemsAtGamePhaseStep>(Mutator))
{
auto PhaseToGive = GiveItemsAtGamePhaseStepMutator->GetPhaseToGiveItems();
LOG_INFO(LogDev, "[{}] PhaseToGiveItems: {}", i, (int)PhaseToGive);
auto& ItemsToGive = GiveItemsAtGamePhaseStepMutator->GetItemsToGive();
LOG_INFO(LogDev, "[{}] ItemsToGive.Num(): {}", i, ItemsToGive.Num());
if (PhaseToGive <= 5) // Flying or lower
{
for (int j = 0; j < ItemsToGive.Num(); j++)
{
auto& ItemToGive = ItemsToGive.at(j);
float Out = 1;
FString ContextString;
EEvaluateCurveTableResult result;
// UDataTableFunctionLibrary::EvaluateCurveTableRow(ItemToGive.NumberToGive.GetCurve().CurveTable, ItemToGive.NumberToGive.GetCurve().RowName, 0.f, ContextString, &result, &Out);
LOG_INFO(LogDev, "Out: {}", Out);
WorldInventory->AddItem(ItemToGive.ItemToDrop, nullptr, Out);
}
}
}
/* else if (auto GGMutator = Cast<AFortAthenaMutator_GG>(Mutator))
{
auto& WeaponEntries = GGMutator->GetWeaponEntries();
LOG_INFO(LogDev, "[{}] WeaponEntries.Num(): {}", i, WeaponEntries.Num());
for (int j = 0; j < WeaponEntries.Num(); j++)
{
WorldInventory->AddItem(WeaponEntries.at(j).Weapon, nullptr, 1);
}
} */
}
WorldInventory->Update();
}
void AFortPlayerControllerAthena::ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex) void AFortPlayerControllerAthena::ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex)
{ {
@@ -104,6 +201,8 @@ void AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook(AFor
if (!Pawn) if (!Pawn)
return; return;
// TODO IsTeleportToCreativeHubAllowed
static auto FortPlayerStartCreativeClass = FindObject<UClass>("/Script/FortniteGame.FortPlayerStartCreative"); static auto FortPlayerStartCreativeClass = FindObject<UClass>("/Script/FortniteGame.FortPlayerStartCreative");
auto AllCreativePlayerStarts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartCreativeClass); auto AllCreativePlayerStarts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartCreativeClass);

View File

@@ -79,6 +79,7 @@ public:
static inline void (*GetPlayerViewPointOriginal)(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation); static inline void (*GetPlayerViewPointOriginal)(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation);
static inline void (*ServerReadyToStartMatchOriginal)(AFortPlayerControllerAthena* PlayerController); static inline void (*ServerReadyToStartMatchOriginal)(AFortPlayerControllerAthena* PlayerController);
static inline void (*ServerRequestSeatChangeOriginal)(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); static inline void (*ServerRequestSeatChangeOriginal)(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex);
static inline void (*EnterAircraftOriginal)(UObject* PC, AActor* Aircraft);
AFortPlayerStateAthena* GetPlayerStateAthena() AFortPlayerStateAthena* GetPlayerStateAthena()
{ {
@@ -91,6 +92,7 @@ public:
return Get<UAthenaMarkerComponent*>(MarkerComponentOffset); return Get<UAthenaMarkerComponent*>(MarkerComponentOffset);
} }
static void EnterAircraftHook(UObject* PC, AActor* Aircraft);
static void ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); // actually in zone static void ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); // actually in zone
static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller); static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller);
static void ServerGiveCreativeItemHook(AFortPlayerControllerAthena* Controller, FFortItemEntry CreativeItem); static void ServerGiveCreativeItemHook(AFortPlayerControllerAthena* Controller, FFortItemEntry CreativeItem);

View File

@@ -26,33 +26,11 @@ 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()) bool bOverrideDontClearInventory = false;
if (/* (bNewInAircraft && !PlayerController->IsInAircraft()) || */ /* (Globals::bLateGame ? bNewInAircraft : true)) && */
!Globals::bLateGame.load() && ItemInstances.Num() && !bOverrideDontClearInventory)
{ {
// std::cout << "InventoryList.ItemInstances.Num(): " << InventoryList.ItemInstances.Num() << '\n';
std::vector<std::pair<FGuid, int>> GuidAndCountsToRemove;
for (int i = 0; i < ItemInstances.Num(); i++)
{
auto ItemEntry = ItemInstances.at(i)->GetItemEntry();
auto ItemDefinition = Cast<UFortWorldItemDefinition>(ItemEntry->GetItemDefinition());
if (!ItemDefinition)
continue;
if (!ItemDefinition->CanBeDropped())
continue;
GuidAndCountsToRemove.push_back({ ItemEntry->GetItemGuid(), ItemEntry->GetCount() });
}
for (auto& Pair : GuidAndCountsToRemove)
{
WorldInventory->RemoveItem(Pair.first, nullptr, Pair.second, true);
}
WorldInventory->Update();
static auto CurrentShieldOffset = PlayerState->GetOffset("CurrentShield"); static auto CurrentShieldOffset = PlayerState->GetOffset("CurrentShield");
if (CurrentShieldOffset != -1) if (CurrentShieldOffset != -1)

View File

@@ -4,6 +4,9 @@
#include "FortPlayerControllerAthena.h" #include "FortPlayerControllerAthena.h"
#include "FortGameModeAthena.h" #include "FortGameModeAthena.h"
#include "FortLootPackage.h" #include "FortLootPackage.h"
#include "FortAthenaMutator_GiveItemsAtGamePhaseStep.h"
#include "DataTableFunctionLibrary.h"
#include "FortAthenaMutator_GG.h"
UClass* AGameModeBase::GetDefaultPawnClassForController(AController* InController) UClass* AGameModeBase::GetDefaultPawnClassForController(AController* InController)
{ {
@@ -41,16 +44,16 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
if constexpr (bUseSpawnActor) if constexpr (bUseSpawnActor)
{ {
NewPawn = GetWorld()->SpawnActor<APawn>(PawnClass, SpawnTransform, SpawnParameters); NewPawn = GetWorld()->SpawnActor<APawn>(PawnClass, SpawnTransform, SpawnParameters);
} }
else else
{ {
struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; } struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; }
AGameModeBase_SpawnDefaultPawnAtTransform_Params{ NewPlayer, SpawnTransform }; AGameModeBase_SpawnDefaultPawnAtTransform_Params{ NewPlayer, SpawnTransform };
GameMode->ProcessEvent(fn, &AGameModeBase_SpawnDefaultPawnAtTransform_Params); GameMode->ProcessEvent(fn, &AGameModeBase_SpawnDefaultPawnAtTransform_Params);
NewPawn = AGameModeBase_SpawnDefaultPawnAtTransform_Params.ReturnValue; NewPawn = AGameModeBase_SpawnDefaultPawnAtTransform_Params.ReturnValue;
} }
if (!NewPawn) if (!NewPawn)
@@ -77,7 +80,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
auto PlayerState = NewPlayerAsAthena->GetPlayerStateAthena(); auto PlayerState = NewPlayerAsAthena->GetPlayerStateAthena();
PlayerState->GetAbilitySystemComponent()->RemoveActiveGameplayEffectBySourceEffect(StormEffectClass, 1, PlayerState->GetAbilitySystemComponent()); PlayerState->GetAbilitySystemComponent()->RemoveActiveGameplayEffectBySourceEffect(StormEffectClass, 1, PlayerState->GetAbilitySystemComponent());
} */ } */
if (NewPlayerAsAthena) if (NewPlayerAsAthena)
{ {
auto WorldInventory = NewPlayerAsAthena->GetWorldInventory(); auto WorldInventory = NewPlayerAsAthena->GetWorldInventory();

View File

@@ -11,8 +11,6 @@ struct FMegaStormCircle
static auto MegaStormCircleStruct = FindObject<UStruct>("/Script/FortniteGame.MegaStormCircle"); static auto MegaStormCircleStruct = FindObject<UStruct>("/Script/FortniteGame.MegaStormCircle");
return MegaStormCircleStruct->GetPropertiesSize(); return MegaStormCircleStruct->GetPropertiesSize();
} }
}; };
class AMegaStormManager : public AActor class AMegaStormManager : public AActor

View File

@@ -192,6 +192,7 @@
<ClCompile Include="EngineTypes.cpp" /> <ClCompile Include="EngineTypes.cpp" />
<ClCompile Include="events.cpp" /> <ClCompile Include="events.cpp" />
<ClCompile Include="FortAthenaCreativePortal.cpp" /> <ClCompile Include="FortAthenaCreativePortal.cpp" />
<ClCompile Include="FortAthenaMutator_GiveItemsAtGamePhaseStep.cpp" />
<ClCompile Include="FortAthenaSupplyDrop.cpp" /> <ClCompile Include="FortAthenaSupplyDrop.cpp" />
<ClCompile Include="FortAthenaVehicle.cpp" /> <ClCompile Include="FortAthenaVehicle.cpp" />
<ClCompile Include="FortDecoItemDefinition.cpp" /> <ClCompile Include="FortDecoItemDefinition.cpp" />
@@ -289,6 +290,12 @@
<ClInclude Include="finder.h" /> <ClInclude Include="finder.h" />
<ClInclude Include="FortAbilitySet.h" /> <ClInclude Include="FortAbilitySet.h" />
<ClInclude Include="FortAthenaCreativePortal.h" /> <ClInclude Include="FortAthenaCreativePortal.h" />
<ClInclude Include="FortAthenaMutator.h" />
<ClInclude Include="FortAthenaMutator_GG.h" />
<ClInclude Include="FortAthenaMutator_GiveItemsAtGamePhaseStep.h" />
<ClInclude Include="FortAthenaMutator_InventoryOverride.h" />
<ClInclude Include="FortAthenaMutator_InventoryOverride_Bucket.h" />
<ClInclude Include="FortAthenaMutator_ItemDropOnDeath.h" />
<ClInclude Include="FortAthenaSKPushCannon.h" /> <ClInclude Include="FortAthenaSKPushCannon.h" />
<ClInclude Include="FortAthenaSupplyDrop.h" /> <ClInclude Include="FortAthenaSupplyDrop.h" />
<ClInclude Include="FortAthenaVehicle.h" /> <ClInclude Include="FortAthenaVehicle.h" />

View File

@@ -236,6 +236,9 @@
<ClCompile Include="FortSafeZoneIndicator.cpp"> <ClCompile Include="FortSafeZoneIndicator.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private</Filter> <Filter>FortniteGame\Source\FortniteGame\Private</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortAthenaMutator_GiveItemsAtGamePhaseStep.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Mutators</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
@@ -725,6 +728,24 @@
<ClInclude Include="FortSafeZoneIndicator.h"> <ClInclude Include="FortSafeZoneIndicator.h">
<Filter>FortniteGame\Source\FortniteGame\Public</Filter> <Filter>FortniteGame\Source\FortniteGame\Public</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FortAthenaMutator_GiveItemsAtGamePhaseStep.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_GG.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_InventoryOverride_Bucket.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_InventoryOverride.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_ItemDropOnDeath.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">
@@ -949,6 +970,12 @@
<Filter Include="FortniteGame\Source\FortniteGame\Public\Athena\Vehicle"> <Filter Include="FortniteGame\Source\FortniteGame\Public\Athena\Vehicle">
<UniqueIdentifier>{b1cc2ad4-6196-455c-bda7-d0a2e7be2e70}</UniqueIdentifier> <UniqueIdentifier>{b1cc2ad4-6196-455c-bda7-d0a2e7be2e70}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Mutators">
<UniqueIdentifier>{bfeeff9b-a86e-47a9-973c-47f6d0dfe5d5}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Mutators">
<UniqueIdentifier>{6efc7bff-2d7b-4fdb-bae8-3d2e736cc82e}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="UnrealEngine.cpp"> <None Include="UnrealEngine.cpp">

View File

@@ -260,6 +260,9 @@ void Addresses::FindAll()
LOG_INFO(LogDev, "Finding ApplyCharacterCustomization"); LOG_INFO(LogDev, "Finding ApplyCharacterCustomization");
Addresses::ApplyCharacterCustomization = FindApplyCharacterCustomization(); Addresses::ApplyCharacterCustomization = FindApplyCharacterCustomization();
LOG_INFO(LogDev, "Finding EnterAircraft");
Addresses::EnterAircraft = FindEnterAircraft();
LOG_INFO(LogDev, "Finished finding!"); LOG_INFO(LogDev, "Finished finding!");
} }
@@ -319,6 +322,7 @@ void Addresses::Print()
LOG_INFO(LogDev, "RemoveGadgetData: 0x{:x}", RemoveGadgetData - Base); LOG_INFO(LogDev, "RemoveGadgetData: 0x{:x}", RemoveGadgetData - Base);
LOG_INFO(LogDev, "GetInterfaceAddress: 0x{:x}", GetInterfaceAddress - Base); LOG_INFO(LogDev, "GetInterfaceAddress: 0x{:x}", GetInterfaceAddress - Base);
LOG_INFO(LogDev, "ApplyCharacterCustomization: 0x{:x}", ApplyCharacterCustomization - Base); LOG_INFO(LogDev, "ApplyCharacterCustomization: 0x{:x}", ApplyCharacterCustomization - Base);
LOG_INFO(LogDev, "EnterAircraft: 0x{:x}", EnterAircraft - Base);
} }
void Offsets::FindAll() void Offsets::FindAll()

View File

@@ -60,6 +60,7 @@ namespace Addresses
extern inline uint64 RemoveGadgetData = 0; extern inline uint64 RemoveGadgetData = 0;
extern inline uint64 ApplyCharacterCustomization = 0; extern inline uint64 ApplyCharacterCustomization = 0;
extern inline uint64 GetInterfaceAddress = 0; extern inline uint64 GetInterfaceAddress = 0;
extern inline uint64 EnterAircraft = 0;
void SetupVersion(); // Finds Engine Version void SetupVersion(); // Finds Engine Version
void FindAll(); void FindAll();

View File

@@ -447,23 +447,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
CheatManager->Teleport(); CheatManager->Teleport();
CheatManager = nullptr; CheatManager = nullptr;
} SendMessageToConsole(PlayerController, L"Teleported!");
else if (Command == "setsafezonephase")
{
int NewSafeZonePhase = 1;
try { NewSafeZonePhase = std::stof(Arguments[1]); }
catch (...) {}
auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode();
auto GameState = GameMode->GetGameState();
static auto GameMode_SafeZonePhaseOffset = GameMode->GetOffset("SafeZonePhase");
static auto GameState_SafeZonePhaseOffset = GameState->GetOffset("SafeZonePhase");
GameMode->Get<int>(GameMode_SafeZonePhaseOffset) = NewSafeZonePhase;
GameState->Get<int>(GameState_SafeZonePhaseOffset) = NewSafeZonePhase;
SendMessageToConsole(PlayerController, L"Set safe zone phase!");
} }
else if (Command == "bugitgo") else if (Command == "bugitgo")
{ {

View File

@@ -13,6 +13,7 @@
#include "FortInventoryInterface.h" #include "FortInventoryInterface.h"
#include <fstream> #include <fstream>
#include "GenericPlatformTime.h" #include "GenericPlatformTime.h"
#include "FortAthenaMutator_GiveItemsAtGamePhaseStep.h"
#include "BuildingFoundation.h" #include "BuildingFoundation.h"
#include "Map.h" #include "Map.h"
@@ -363,7 +364,7 @@ DWORD WINAPI Main(LPVOID)
} }
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook,
(PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false); (PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false, false, true);
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"),
AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); AGameModeBase::SpawnDefaultPawnForHook, nullptr, false);
@@ -473,6 +474,9 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortPlayerStateAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.ServerSetInAircraft"), Hooking::MinHook::Hook(FortPlayerStateAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.ServerSetInAircraft"),
AFortPlayerStateAthena::ServerSetInAircraftHook, (PVOID*)&AFortPlayerStateAthena::ServerSetInAircraftOriginal, false, true); // We could use second method but eh AFortPlayerStateAthena::ServerSetInAircraftHook, (PVOID*)&AFortPlayerStateAthena::ServerSetInAircraftOriginal, false, true); // We could use second method but eh
Hooking::MinHook::Hook(FindObject<AFortAthenaMutator_GiveItemsAtGamePhaseStep>("/Script/FortniteGame.Default__FortAthenaMutator_GiveItemsAtGamePhaseStep"), FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaMutator_GiveItemsAtGamePhaseStep.OnGamePhaseStepChanged"),
AFortAthenaMutator_GiveItemsAtGamePhaseStep::OnGamePhaseStepChangedHook, (PVOID*)&AFortAthenaMutator_GiveItemsAtGamePhaseStep::OnGamePhaseStepChangedOriginal, false, true);
if (FortOctopusVehicleDefault) if (FortOctopusVehicleDefault)
{ {
static auto ServerUpdateTowhookFn = FindObject<UFunction>("/Script/FortniteGame.FortOctopusVehicle.ServerUpdateTowhook"); static auto ServerUpdateTowhookFn = FindObject<UFunction>("/Script/FortniteGame.FortOctopusVehicle.ServerUpdateTowhook");
@@ -554,6 +558,10 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortAthenaSupplyDropDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaSupplyDrop.SpawnPickup"), Hooking::MinHook::Hook(FortAthenaSupplyDropDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaSupplyDrop.SpawnPickup"),
AFortAthenaSupplyDrop::SpawnPickupHook, (PVOID*)&AFortAthenaSupplyDrop::SpawnPickupOriginal, false, true); AFortAthenaSupplyDrop::SpawnPickupHook, (PVOID*)&AFortAthenaSupplyDrop::SpawnPickupOriginal, false, true);
Hooking::MinHook::Hook(FortAthenaSupplyDropDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaSupplyDrop.SpawnGameModePickup"),
AFortAthenaSupplyDrop::SpawnGameModePickupHook, (PVOID*)&AFortAthenaSupplyDrop::SpawnGameModePickupOriginal, false, true);
Hooking::MinHook::Hook(FortAthenaSupplyDropDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaSupplyDrop.SpawnPickupFromItemEntry"),
AFortAthenaSupplyDrop::SpawnPickupFromItemEntryHook, (PVOID*)&AFortAthenaSupplyDrop::SpawnPickupFromItemEntryOriginal, false, true);
static auto FortAthenaCreativePortalDefault = FindObject(L"/Script/FortniteGame.Default__FortAthenaCreativePortal"); static auto FortAthenaCreativePortalDefault = FindObject(L"/Script/FortniteGame.Default__FortAthenaCreativePortal");
@@ -693,6 +701,7 @@ DWORD WINAPI Main(LPVOID)
// if (Fortnite_Version >= 13) // if (Fortnite_Version >= 13)
Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)SetZoneToIndexHook, (PVOID*)&SetZoneToIndexOriginal); Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)SetZoneToIndexHook, (PVOID*)&SetZoneToIndexOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::EnterAircraft, (PVOID)AFortPlayerControllerAthena::EnterAircraftHook, (PVOID*)&AFortPlayerControllerAthena::EnterAircraftOriginal);
#ifndef PROD #ifndef PROD
Hooking::MinHook::Hook((PVOID)Addresses::ProcessEvent, ProcessEventHook, (PVOID*)&UObject::ProcessEventOriginal); Hooking::MinHook::Hook((PVOID)Addresses::ProcessEvent, ProcessEventHook, (PVOID*)&UObject::ProcessEventOriginal);

View File

@@ -248,7 +248,7 @@ static inline std::vector<Event> Events =
{ {
false, false,
// "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.PlayConcert" // "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.PlayConcert"
"/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.ServerPlayFestivus" "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.ServerPlayFestivus" // StartEventFromCalendarAsBackup calls this
}, },
0 0
@@ -260,7 +260,6 @@ static inline std::vector<Event> Events =
7.30 7.30
// Not sure if this requires playlist. // Not sure if this requires playlist.
), ),
Event Event
( (
"Rift Tour", "Rift Tour",

View File

@@ -659,6 +659,27 @@ static inline uint64 FindSetZoneToIndex() // actually StartNewSafeZonePhase
return 0; return 0;
} }
static inline uint64 FindEnterAircraft()
{
auto Addr = Memcury::Scanner::FindStringRef(L"EnterAircraft: [%s] is attempting to enter aircraft after having already exited.", true, 0, Engine_Version >= 500).Get();
for (int i = 0; i < 1000; i++)
{
if ((*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x53)
|| (*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x55))
{
return Addr - i;
}
if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0x5C && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0x24)
{
return Addr - i;
}
}
return 0;
}
static inline uint64 FindRemoveGadgetData() static inline uint64 FindRemoveGadgetData()
{ {
if (Engine_Version <= 423) if (Engine_Version <= 423)
@@ -666,15 +687,27 @@ static inline uint64 FindRemoveGadgetData()
auto Addr = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadget Item [%s]!", false).Get(); auto Addr = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadget Item [%s]!", false).Get();
if (!Addr) if (!Addr)
Addr = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadet Item [%s]!").Get(); Addr = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadet Item [%s]!", false).Get();
if (!Addr)
{
Addr = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Failed to get the Player Controller to cleanup Gadget Item [%s]!").Get();
}
if (!Addr) if (!Addr)
return 0; return 0;
for (int i = 0; i < 1000; i++) for (int i = 0; i < 1000; i++)
{ {
if (/* (*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x53) if (Fortnite_Version >= 10)
|| */ (*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x55)) {
if ((*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x53))
{
return Addr - i;
}
}
if ((*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x55))
{ {
return Addr - i; return Addr - i;
} }

View File

@@ -221,7 +221,7 @@ void StaticUI()
ImGui::Checkbox("No MCP (Don't change unless you know what this is)", &Globals::bNoMCP); ImGui::Checkbox("No MCP (Don't change unless you know what this is)", &Globals::bNoMCP);
if (Addresses::ApplyGadgetData && Addresses::RemoveGadgetData) if (Addresses::ApplyGadgetData && Addresses::RemoveGadgetData && Engine_Version < 424)
{ {
ImGui::Checkbox("Enable AGIDs (Don't change unless you know what this is)", &Globals::bEnableAGIDs); ImGui::Checkbox("Enable AGIDs (Don't change unless you know what this is)", &Globals::bEnableAGIDs);
} }
@@ -368,6 +368,13 @@ void MainUI()
#ifndef PROD #ifndef PROD
ImGui::Checkbox("Log ProcessEvent", &Globals::bLogProcessEvent); ImGui::Checkbox("Log ProcessEvent", &Globals::bLogProcessEvent);
#endif #endif
if (!bStartedBus)
{
bool bWillBeLategame = Globals::bLateGame.load();
ImGui::Checkbox("Lategame", &bWillBeLategame);
Globals::bLateGame.store(bWillBeLategame);
}
ImGui::Text(std::format("Joinable {}", Globals::bStartedListening).c_str()); ImGui::Text(std::format("Joinable {}", Globals::bStartedListening).c_str());
static std::string ConsoleCommand; static std::string ConsoleCommand;
@@ -384,9 +391,9 @@ void MainUI()
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr);
} }
if (ImGui::Button("Restart")) if (Engine_Version < 424 && ImGui::Button("Restart"))
{ {
if (true) // Engine_Version < 424) if (Engine_Version < 424)
{ {
FString LevelA = Engine_Version < 424 FString LevelA = Engine_Version < 424
? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501 ? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501
@@ -409,6 +416,17 @@ void MainUI()
LOG_INFO(LogDev, "Switching!"); LOG_INFO(LogDev, "Switching!");
((AGameMode*)GetWorld()->GetGameMode())->RestartGame(); ((AGameMode*)GetWorld()->GetGameMode())->RestartGame();
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), LevelA, nullptr); // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), LevelA, nullptr);
/*
auto& LevelCollections = GetWorld()->Get<TArray<__int64>>("LevelCollections");
int LevelCollectionSize = FindObject<UStruct>("/Script/Engine.LevelCollection")->GetPropertiesSize();
*(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = nullptr;
*(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = nullptr;
*/
// UGameplayStatics::OpenLevel(GetWorld(), UKismetStringLibrary::Conv_StringToName(LevelA), true, FString()); // UGameplayStatics::OpenLevel(GetWorld(), UKismetStringLibrary::Conv_StringToName(LevelA), true, FString());
LOG_INFO(LogGame, "Restarting!"); LOG_INFO(LogGame, "Restarting!");
Globals::bInitializedPlaylist = false; Globals::bInitializedPlaylist = false;
@@ -591,7 +609,6 @@ void MainUI()
if (EventScripting) if (EventScripting)
{ {
FName Name = UKismetStringLibrary::Conv_StringToName(L"DrumGun"); FName Name = UKismetStringLibrary::Conv_StringToName(L"DrumGun");
EventScripting->ProcessEvent(SetUnvaultItemNameFn, &Name); EventScripting->ProcessEvent(SetUnvaultItemNameFn, &Name);

View File

@@ -248,8 +248,11 @@ namespace Hooking
// *(int32_t*)(instrAddr + 1) = static_cast<int32_t>(delta); // *(int32_t*)(instrAddr + 1) = static_cast<int32_t>(delta);
} }
static bool Hook(UObject* DefaultClass, UFunction* Function, void* Detour, void** Original = nullptr, bool bUseSecondMethod = true, bool bHookExec = false) // Native hook static bool Hook(UObject* DefaultClass, UFunction* Function, void* Detour, void** Original = nullptr, bool bUseSecondMethod = true, bool bHookExec = false, bool bOverride = true) // Native hook
{ {
if (!bOverride)
return false;
if (!Function) if (!Function)
return false; return false;
@@ -263,7 +266,7 @@ namespace Hooking
if (bHookExec) if (bHookExec)
{ {
LOG_INFO(LogDev, "Hooking Exec {}", Function->GetName()); LOG_INFO(LogDev, "Hooking Exec {} at 0x{:x}", Function->GetName(), __int64(Exec) - __int64(GetModuleHandleW(0)));
if (Original) if (Original)
*Original = Exec; *Original = Exec;