clip size vehicles cheat command

This commit is contained in:
Milxnor
2023-03-12 16:00:26 -04:00
parent ea7086c85f
commit 32bcc705af
37 changed files with 803 additions and 57 deletions

View File

@@ -1,5 +1,9 @@
#include "AbilitySystemComponent.h" #include "AbilitySystemComponent.h"
#include "NetSerialization.h" #include "NetSerialization.h"
#include "Actor.h"
#include "FortPawn.h"
#include "FortPlayerController.h"
#include "FortPlayerStateAthena.h"
void LoopSpecs(UAbilitySystemComponent* AbilitySystemComponent, std::function<void(FGameplayAbilitySpec*)> func) void LoopSpecs(UAbilitySystemComponent* AbilitySystemComponent, std::function<void(FGameplayAbilitySpec*)> func)
{ {
@@ -76,6 +80,46 @@ void InternalServerTryActivateAbility(UAbilitySystemComponent* AbilitySystemComp
static auto ActivatableAbilitiesOffset = AbilitySystemComponent->GetOffset("ActivatableAbilities"); static auto ActivatableAbilitiesOffset = AbilitySystemComponent->GetOffset("ActivatableAbilities");
AbilitySystemComponent->Get<FFastArraySerializer>(ActivatableAbilitiesOffset).MarkItemDirty(Spec); // we only need to do this if the ability fails but eh AbilitySystemComponent->Get<FFastArraySerializer>(ActivatableAbilitiesOffset).MarkItemDirty(Spec); // we only need to do this if the ability fails but eh
// bro ignore this next part idk where to put it ok
/* static auto OwnerActorOffset = AbilitySystemComponent->GetOffset("OwnerActor");
auto PlayerState = Cast<AFortPlayerStateAthena>(AbilitySystemComponent->Get<AActor*>(OwnerActorOffset));
if (!PlayerState)
return;
auto Controller = Cast<AFortPlayerController>(PlayerState->GetOwner());
LOG_INFO(LogAbilities, "Owner {}", PlayerState->GetOwner()->GetFullName());
if (!Controller)
return;
auto Pawn = Controller->GetMyFortPawn();
if (!Pawn)
return;
auto CurrentWeapon = Pawn->GetCurrentWeapon();
auto WorldInventory = Controller ? Controller->GetWorldInventory() : nullptr;
if (!WorldInventory || !CurrentWeapon)
return;
auto CurrentWeaponInstance = WorldInventory->FindItemInstance(CurrentWeapon->GetItemEntryGuid());
auto CurrentWeaponReplicatedEntry = WorldInventory->FindReplicatedEntry(CurrentWeapon->GetItemEntryGuid());
static auto AmmoCountOffset = CurrentWeapon->GetOffset("AmmoCount");
auto AmmoCount = CurrentWeapon->Get<int>(AmmoCountOffset);
if (CurrentWeaponReplicatedEntry->GetLoadedAmmo() != AmmoCount)
{
CurrentWeaponInstance->GetItemEntry()->GetLoadedAmmo() = AmmoCount;
CurrentWeaponReplicatedEntry->GetLoadedAmmo() = AmmoCount;
WorldInventory->GetItemList().MarkItemDirty(CurrentWeaponInstance->GetItemEntry());
WorldInventory->GetItemList().MarkItemDirty(CurrentWeaponReplicatedEntry);
} */
} }
FGameplayAbilitySpecHandle UAbilitySystemComponent::GiveAbilityEasy(UClass* AbilityClass) FGameplayAbilitySpecHandle UAbilitySystemComponent::GiveAbilityEasy(UClass* AbilityClass)

View File

@@ -70,4 +70,25 @@ FVector AActor::GetActorRightVector()
this->ProcessEvent(GetActorRightVectorFn, &ret); this->ProcessEvent(GetActorRightVectorFn, &ret);
return ret; return ret;
}
FRotator AActor::GetActorRotation()
{
static auto K2_GetActorRotationFn = FindObject<UFunction>(L"/Script/Engine.Actor.K2_GetActorRotation");
FRotator ret;
this->ProcessEvent(K2_GetActorRotationFn, &ret);
return ret;
}
void AActor::FlushNetDormancy()
{
static auto fn = FindObject<UFunction>("/Script/Engine.Actor.FlushNetDormancy");
this->ProcessEvent(fn);
}
UClass* AActor::StaticClass()
{
static auto Class = FindObject<UClass>(L"/Script/Engine.Actor");
return Class;
} }

View File

@@ -13,4 +13,8 @@ public:
void K2_DestroyActor(); void K2_DestroyActor();
class UActorComponent* GetComponentByClass(class UClass* ComponentClass); class UActorComponent* GetComponentByClass(class UClass* ComponentClass);
float GetDistanceTo(AActor* OtherActor); float GetDistanceTo(AActor* OtherActor);
struct FRotator GetActorRotation();
void FlushNetDormancy();
static class UClass* StaticClass();
}; };

View File

@@ -92,4 +92,4 @@ UClass* ABuildingActor::StaticClass()
{ {
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.BuildingActor"); static auto Class = FindObject<UClass>(L"/Script/FortniteGame.BuildingActor");
return Class; return Class;
} }

View File

@@ -32,12 +32,17 @@ public:
void SetTeam(unsigned char InTeam) void SetTeam(unsigned char InTeam)
{ {
static auto fn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SetTeam"); static auto fn = nullptr; // FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SetTeam");
if (!fn) if (!fn)
{ {
static auto TeamOffset = GetOffset("Team"); static auto TeamOffset = GetOffset("Team");
Get<uint8_t>(TeamOffset) = InTeam; Get<uint8_t>(TeamOffset) = InTeam;
static auto TeamIndexOffset = GetOffset("TeamIndex", false);
if (TeamIndexOffset != 0)
Get<uint8_t>(TeamIndexOffset) = InTeam;
} }
else else
{ {

View File

@@ -18,12 +18,16 @@ class ABuildingSMActor : public ABuildingActor
public: public:
bool IsPlayerPlaced() bool IsPlayerPlaced()
{ {
return true; // FOR NOW static auto bPlayerPlacedOffset = GetOffset("bPlayerPlaced");
static auto bPlayerPlacedFieldMask = GetFieldMask(this->GetProperty("bPlayerPlaced"));
return ReadBitfieldValue(bPlayerPlacedOffset, bPlayerPlacedFieldMask);
} }
void SetPlayerPlaced(bool NewValue) void SetPlayerPlaced(bool NewValue)
{ {
static auto bPlayerPlacedOffset = GetOffset("bPlayerPlaced");
static auto bPlayerPlacedFieldMask = GetFieldMask(this->GetProperty("bPlayerPlaced"));
this->SetBitfieldValue(bPlayerPlacedOffset, bPlayerPlacedFieldMask, NewValue);
} }
bool IsDestroyed() bool IsDestroyed()

View File

@@ -0,0 +1,4 @@
#include "BuildingTrap.h"
#include "GameplayStatics.h"
#include "FortPlayerStateAthena.h"

View File

@@ -0,0 +1,9 @@
#pragma once
#include "BuildingSMActor.h"
class ABuildingTrap : public ABuildingSMActor
{
public:
};

View File

@@ -14,4 +14,10 @@ public:
return *(TMap<FName, RowDataType*>*)(__int64(this) + (RowStructOffset + sizeof(UObject*))); // because after rowstruct is rowmap return *(TMap<FName, RowDataType*>*)(__int64(this) + (RowStructOffset + sizeof(UObject*))); // because after rowstruct is rowmap
} }
}; };
struct FDataTableRowHandle
{
UDataTable* DataTable; // 0x0000(0x0008) (Edit, BlueprintVisible, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
FName RowName; // 0x0008(0x0008) (Edit, BlueprintVisible, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
};

View File

@@ -14,6 +14,7 @@
#include "KismetStringLibrary.h" #include "KismetStringLibrary.h"
#include "SoftObjectPtr.h" #include "SoftObjectPtr.h"
#include "vehicles.h"
#include "globals.h" #include "globals.h"
#include "events.h" #include "events.h"
#include "reboot.h" #include "reboot.h"
@@ -124,7 +125,19 @@ UObject* GetPlaylistToUse()
if (Globals::bGoingToPlayEvent) if (Globals::bGoingToPlayEvent)
{ {
if (Fortnite_Version != 12.61) if (Fortnite_Version != 12.61)
Playlist = GetEventPlaylist(); {
auto EventPlaylist = GetEventPlaylist();
if (!EventPlaylist)
{
LOG_ERROR(LogPlaylist, "No event playlist! Turning off going to play event");
Globals::bGoingToPlayEvent = false;
}
else
{
Playlist = EventPlaylist;
}
}
} }
// Playlist = FindObject("/MoleGame/Playlists/Playlist_MoleGame.Playlist_MoleGame"); // Playlist = FindObject("/MoleGame/Playlists/Playlist_MoleGame.Playlist_MoleGame");
@@ -616,7 +629,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
auto Location = CurrentActor->GetActorLocation(); auto Location = CurrentActor->GetActorLocation();
Location.Z += UpZ; Location.Z += UpZ;
std::vector<std::pair<UFortItemDefinition*, int>> LootDrops = PickLootDrops(SpawnIslandTierGroup, bPrintWarmup); std::vector<LootDrop> LootDrops = PickLootDrops(SpawnIslandTierGroup, bPrintWarmup);
if (bPrintWarmup) if (bPrintWarmup)
{ {
@@ -626,7 +639,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
if (LootDrops.size()) if (LootDrops.size())
{ {
for (auto& LootDrop : LootDrops) for (auto& LootDrop : LootDrops)
AFortPickup::SpawnPickup(LootDrop.first, Location, LootDrop.second, SpawnFlag); AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo);
} }
} }
@@ -645,7 +658,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
auto Location = CurrentActor->GetActorLocation(); auto Location = CurrentActor->GetActorLocation();
Location.Z += UpZ; Location.Z += UpZ;
std::vector<std::pair<UFortItemDefinition*, int>> LootDrops = PickLootDrops(BRIslandTierGroup, bPrint); std::vector<LootDrop> LootDrops = PickLootDrops(BRIslandTierGroup, bPrint);
if (bPrint) if (bPrint)
std::cout << "\n"; std::cout << "\n";
@@ -653,11 +666,20 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
if (LootDrops.size()) if (LootDrops.size())
{ {
for (auto& LootDrop : LootDrops) for (auto& LootDrop : LootDrops)
AFortPickup::SpawnPickup(LootDrop.first, Location, LootDrop.second, SpawnFlag); AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo);
} }
} }
} }
static bool bSpawnedVehicles = Engine_Version < 423;
if (!bSpawnedVehicles)
{
bSpawnedVehicles = true;
SpawnVehicles();
}
auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor; auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor;
auto PlayerStateAthena = NewPlayer->GetPlayerStateAthena(); auto PlayerStateAthena = NewPlayer->GetPlayerStateAthena();
@@ -704,6 +726,10 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
PlayerStateAthena->ProcessEvent(OnRep_bHasStartedPlayingFn); PlayerStateAthena->ProcessEvent(OnRep_bHasStartedPlayingFn);
} }
// static int CurrentPlayerId = 1;
static auto PlayerIdOffset = PlayerStateAthena->GetOffset("PlayerId");
PlayerStateAthena->GetWorldPlayerId() = PlayerStateAthena->Get<int>(PlayerIdOffset); // ++CurrentPlayerId;
if (Globals::bAbilitiesEnabled) if (Globals::bAbilitiesEnabled)
{ {
static auto GameplayAbilitySet = Fortnite_Version >= 8.30 ? // LoadObject<UObject>(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") ? static auto GameplayAbilitySet = Fortnite_Version >= 8.30 ? // LoadObject<UObject>(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") ?

View File

@@ -16,6 +16,14 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
if (bShouldUpdate) if (bShouldUpdate)
*bShouldUpdate = false; *bShouldUpdate = false;
if (LoadedAmmo == -1)
{
if (auto WeaponDef = Cast<UFortWeaponItemDefinition>(ItemDefinition))
LoadedAmmo = WeaponDef->GetClipSize();
else
LoadedAmmo = 0;
}
std::vector<UFortItem*> NewItemInstances; std::vector<UFortItem*> NewItemInstances;
std::vector<UFortItem*> ModifiedItemInstances; std::vector<UFortItem*> ModifiedItemInstances;
@@ -25,8 +33,8 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
if (NewItemInstance) if (NewItemInstance)
{ {
if (LoadedAmmo != -1) // if (LoadedAmmo != -1)
NewItemInstance->GetItemEntry()->GetLoadedAmmo() = LoadedAmmo; NewItemInstance->GetItemEntry()->GetLoadedAmmo() = LoadedAmmo;
NewItemInstances.push_back(NewItemInstance); NewItemInstances.push_back(NewItemInstance);

View File

@@ -0,0 +1,14 @@
#include "FortInventoryInterface.h"
#include "reboot.h"
char UFortInventoryInterface::RemoveInventoryItemHook(__int64 a1, FGuid a2, int Count, char bForceRemoveFromQuickBars, char bForceRemoval)
{
static auto FortPlayerControllerSuperSize = (*(UClass**)(__int64(FindObject<UClass>("/Script/FortniteGame.FortPlayerController")) + Offsets::SuperStruct))->GetPropertiesSize();
auto Controller = *(UObject**)(__int64(a1) - (FortPlayerControllerSuperSize + 8));
LOG_INFO(LogDev, "FortPlayerControllerSuperSize: {}", FortPlayerControllerSuperSize);
LOG_INFO(LogDev, "Controller: {}", Controller->GetFullName());
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "Object.h"
class UFortInventoryInterface
{
public:
static char RemoveInventoryItemHook(__int64 a1, FGuid a2, int Count, char bForceRemoveFromQuickBars, char bForceRemoval);
};

View File

@@ -74,12 +74,23 @@ void UFortKismetLibrary::GiveItemToInventoryOwnerHook(UObject* Context, FFrame&
static auto ItemLevelOffset = FindOffsetStruct("/Script/FortniteGame.FortKismetLibrary.GiveItemToInventoryOwner", "ItemLevel"); static auto ItemLevelOffset = FindOffsetStruct("/Script/FortniteGame.FortKismetLibrary.GiveItemToInventoryOwner", "ItemLevel");
static auto PickupInstigatorHandleOffset = FindOffsetStruct("/Script/FortniteGame.FortKismetLibrary.GiveItemToInventoryOwner", "PickupInstigatorHandle"); static auto PickupInstigatorHandleOffset = FindOffsetStruct("/Script/FortniteGame.FortKismetLibrary.GiveItemToInventoryOwner", "PickupInstigatorHandle");
auto InventoryOwner = *(TScriptInterface<UFortInventoryOwnerInterface>*)(__int64(Params) + InventoryOwnerOffset); LOG_INFO(LogDev, "wtf: {}", __int64(Stack.Code));
auto ItemDefinition = *(UFortWorldItemDefinition**)(__int64(Params) + ItemDefinitionOffset);
auto NumberToGive = *(int*)(__int64(Params) + NumberToGiveOffset); return;
auto bNotifyPlayer = *(bool*)(__int64(Params) + bNotifyPlayerOffset);
auto ItemLevel = *(int*)(__int64(Params) + ItemLevelOffset); TScriptInterface<UFortInventoryOwnerInterface> InventoryOwner; // = *(TScriptInterface<UFortInventoryOwnerInterface>*)(__int64(Params) + InventoryOwnerOffset);
auto PickupInstigatorHandle = *(int*)(__int64(Params) + PickupInstigatorHandleOffset); UFortWorldItemDefinition* ItemDefinition; // *(UFortWorldItemDefinition**)(__int64(Params) + ItemDefinitionOffset);
int NumberToGive; // = *(int*)(__int64(Params) + NumberToGiveOffset);
bool bNotifyPlayer; // = *(bool*)(__int64(Params) + bNotifyPlayerOffset);
int ItemLevel; // = *(int*)(__int64(Params) + ItemLevelOffset);
int PickupInstigatorHandle; // = *(int*)(__int64(Params) + PickupInstigatorHandleOffset);
Stack.Step(Context, &InventoryOwner);
Stack.Step(Context, &ItemDefinition);
Stack.Step(Context, &NumberToGive);
Stack.Step(Context, &bNotifyPlayer);
Stack.Step(Context, &ItemLevel);
Stack.Step(Context, &PickupInstigatorHandle);
auto InterfacePointer = InventoryOwner.InterfacePointer; auto InterfacePointer = InventoryOwner.InterfacePointer;

View File

@@ -2,6 +2,7 @@
#include "DataTable.h" #include "DataTable.h"
#include "KismetMathLibrary.h" #include "KismetMathLibrary.h"
#include "FortWeaponItemDefinition.h"
static FFortLootTierData* GetLootTierData(std::vector<FFortLootTierData*>& LootTierData, bool bPrint) static FFortLootTierData* GetLootTierData(std::vector<FFortLootTierData*>& LootTierData, bool bPrint)
{ {
@@ -73,9 +74,9 @@ static FFortLootPackageData* GetLootPackage(std::vector<FFortLootPackageData*>&
return SelectedItem; return SelectedItem;
} }
std::vector<std::pair<UFortItemDefinition*, int>> PickLootDrops(FName TierGroupName, bool bPrint, int recursive) std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recursive)
{ {
std::vector<std::pair<UFortItemDefinition*, int>> LootDrops; std::vector<LootDrop> LootDrops;
static std::vector<UDataTable*> LTDTables; static std::vector<UDataTable*> LTDTables;
static std::vector<UDataTable*> LPTables; static std::vector<UDataTable*> LPTables;
@@ -334,7 +335,14 @@ std::vector<std::pair<UFortItemDefinition*, int>> PickLootDrops(FName TierGroupN
std::cout << std::format("[{}] {} {} {}\n", i, lootPackageCalls.size(), TierGroupLPStr, ItemDef->GetName()); std::cout << std::format("[{}] {} {} {}\n", i, lootPackageCalls.size(), TierGroupLPStr, ItemDef->GetName());
} }
LootDrops.push_back({ ItemDef, LootPackageCall->GetCount() }); auto WeaponDef = Cast<UFortWeaponItemDefinition>(ItemDef);
LootDrop lootDrop{};
lootDrop.ItemDefinition = ItemDef;
lootDrop.LoadedAmmo = WeaponDef ? WeaponDef->GetClipSize() : 0;
lootDrop.Count = LootPackageCall->GetCount();
LootDrops.push_back(lootDrop);
} }
return LootDrops; return LootDrops;

View File

@@ -3,9 +3,16 @@
#include <vector> #include <vector>
#include "Array.h" #include "Array.h"
#include "FortItemDefinition.h" #include "FortWorldItemDefinition.h"
#include "SoftObjectPtr.h" #include "SoftObjectPtr.h"
struct LootDrop
{
UFortItemDefinition* ItemDefinition;
int Count;
int LoadedAmmo;
};
struct FFortLootPackageData struct FFortLootPackageData
{ {
public: public:
@@ -86,4 +93,4 @@ public:
} }
}; };
std::vector<std::pair<UFortItemDefinition*, int>> PickLootDrops(FName TierGroupName, bool bPrint = false, int recursive = 0); std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint = false, int recursive = 0);

View File

@@ -20,7 +20,7 @@ void AFortPickup::TossPickup(FVector FinalLocation, AFortPawn* ItemOwner, int Ov
AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Location, int Count, EFortPickupSourceTypeFlag PickupSource, EFortPickupSpawnSource SpawnSource, int LoadedAmmo, AFortPawn* Pawn) AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Location, int Count, EFortPickupSourceTypeFlag PickupSource, EFortPickupSpawnSource SpawnSource, int LoadedAmmo, AFortPawn* Pawn)
{ {
static auto FortPickupClass = FindObject<UClass>(L"/Script/FortniteGame.FortPickup"); static auto FortPickupClass = FindObject<UClass>(L"/Script/FortniteGame.FortPickup");
// auto PlayerState = Pawn ? Cast<AFortPlayerState>(Pawn->GetPlayerState) : nullptr; auto PlayerState = Pawn ? Cast<AFortPlayerState>(Pawn->GetPlayerState()) : nullptr;
if (auto Pickup = GetWorld()->SpawnActor<AFortPickup>(FortPickupClass, Location)) if (auto Pickup = GetWorld()->SpawnActor<AFortPickup>(FortPickupClass, Location))
{ {
@@ -32,6 +32,8 @@ AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Loca
PrimaryPickupItemEntry->GetItemDefinition() = ItemDef; PrimaryPickupItemEntry->GetItemDefinition() = ItemDef;
PrimaryPickupItemEntry->GetLoadedAmmo() = LoadedAmmo; PrimaryPickupItemEntry->GetLoadedAmmo() = LoadedAmmo;
static auto OptionalOwnerIDOffset = Pickup->GetOffset("OptionalOwnerID");
Pickup->Get<int>(OptionalOwnerIDOffset) = PlayerState ? PlayerState->GetWorldPlayerId() : -1;
// Pickup->OptionalOwnerID = Pawn ? PlayerState->WorldPlayerId : -1; // Pickup->OptionalOwnerID = Pawn ? PlayerState->WorldPlayerId : -1;
Pickup->Get<AFortPawn*>(PawnWhoDroppedPickupOffset) = Pawn; Pickup->Get<AFortPawn*>(PawnWhoDroppedPickupOffset) = Pawn;

View File

@@ -119,7 +119,8 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
for (int i = 0; i < LootDrops.size(); i++) for (int i = 0; i < LootDrops.size(); i++)
{ {
AFortPickup::SpawnPickup(LootDrops.at(i).first, LocationToSpawnLoot, LootDrops.at(i).second, EFortPickupSourceTypeFlag::Container, EFortPickupSpawnSource::Unset, -1 auto& lootDrop = LootDrops.at(i);
AFortPickup::SpawnPickup(lootDrop.ItemDefinition, LocationToSpawnLoot, lootDrop.Count, EFortPickupSourceTypeFlag::Container, EFortPickupSpawnSource::Unset, lootDrop.LoadedAmmo
// , (AFortPawn*)PlayerController->GetPawn() // should we put this here? // , (AFortPawn*)PlayerController->GetPawn() // should we put this here?
); );
} }
@@ -180,6 +181,7 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
if (Fortnite_Version >= 8.30) if (Fortnite_Version >= 8.30)
{ {
struct FCreateBuildingActorData { uint32_t BuildingClassHandle; FVector BuildLoc; FRotator BuildRot; bool bMirrored; };
auto CreateBuildingData = (FCreateBuildingActorData*)Stack->Locals; auto CreateBuildingData = (FCreateBuildingActorData*)Stack->Locals;
BuildLocation = CreateBuildingData->BuildLoc; BuildLocation = CreateBuildingData->BuildLoc;
@@ -240,9 +242,12 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
if (!BuildingActor) if (!BuildingActor)
return ServerCreateBuildingActorOriginal(Context, Stack, Ret); return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
// static auto OwnerPersistentIDOffset = BuildingActor->GetOffset("OwnerPersistentID");
// BuildingActor->Get<int>(OwnerPersistentIDOffset) = PlayerStateAthena->GetWorldPlayerId();
BuildingActor->SetPlayerPlaced(true); BuildingActor->SetPlayerPlaced(true);
BuildingActor->SetTeam(PlayerStateAthena->GetTeamIndex());
BuildingActor->InitializeBuildingActor(PlayerController, BuildingActor, true); BuildingActor->InitializeBuildingActor(PlayerController, BuildingActor, true);
BuildingActor->SetTeam(PlayerStateAthena->GetTeamIndex());
return ServerCreateBuildingActorOriginal(Context, Stack, Ret); return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
} }
@@ -311,9 +316,6 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe
int outHandle = 0; int outHandle = 0;
FGameplayAbilitySpecHandle Handle{};
Handle.GenerateNewHandle();
FGameplayAbilitySpec* Spec = MakeNewSpec((UClass*)AbilityToUse, EmoteAsset, true); FGameplayAbilitySpec* Spec = MakeNewSpec((UClass*)AbilityToUse, EmoteAsset, true);
static unsigned int* (*GiveAbilityAndActivateOnce)(UAbilitySystemComponent * ASC, int* outHandle, __int64 Spec) static unsigned int* (*GiveAbilityAndActivateOnce)(UAbilitySystemComponent * ASC, int* outHandle, __int64 Spec)
@@ -492,10 +494,8 @@ void AFortPlayerController::ServerEditBuildingActorHook(AFortPlayerController* P
{ {
BuildingActor->SetPlayerPlaced(true); BuildingActor->SetPlayerPlaced(true);
if (auto PlayerState = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState())) // if (auto PlayerState = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState()))
BuildingActor->SetTeam(PlayerState->GetTeamIndex()); // BuildingActor->SetTeam(PlayerState->GetTeamIndex());
// BuildingActor->OnRep_Team();
} }
} }

View File

@@ -8,8 +8,6 @@
#include "BuildingSMActor.h" #include "BuildingSMActor.h"
#include "Stack.h" #include "Stack.h"
struct FCreateBuildingActorData { uint32_t BuildingClassHandle; FVector BuildLoc; FRotator BuildRot; bool bMirrored; };
struct FFortAthenaLoadout struct FFortAthenaLoadout
{ {
UObject*& GetCharacter() UObject*& GetCharacter()

View File

@@ -12,6 +12,12 @@ public:
return this->Get<UAbilitySystemComponent*>(AbilitySystemComponentOffset); return this->Get<UAbilitySystemComponent*>(AbilitySystemComponentOffset);
} }
int& GetWorldPlayerId()
{
static auto WorldPlayerIdOffset = GetOffset("WorldPlayerId");
return this->Get<int>(WorldPlayerIdOffset);
}
static UClass* StaticClass() static UClass* StaticClass()
{ {
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPlayerState"); static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPlayerState");

View File

@@ -16,4 +16,18 @@ public:
static auto TeamIndexOffset = GetOffset("TeamIndex"); static auto TeamIndexOffset = GetOffset("TeamIndex");
return Get<uint8>(TeamIndexOffset); return Get<uint8>(TeamIndexOffset);
} }
FString GetPlayerName()
{
static auto GetPlayerNameFn = FindObject<UFunction>("/Script/Engine.PlayerState.GetPlayerName");
FString PlayerName;
this->ProcessEvent(GetPlayerNameFn, &PlayerName);
return PlayerName;
}
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPlayerStateAthena");
return Class;
}
}; };

View File

@@ -0,0 +1,41 @@
#include "FortWeaponItemDefinition.h"
#include "DataTable.h"
int UFortWeaponItemDefinition::GetClipSize()
{
static auto WeaponStatHandleOffset = GetOffset("WeaponStatHandle");
auto& WeaponStatHandle = Get<FDataTableRowHandle>(WeaponStatHandleOffset);
auto Table = WeaponStatHandle.DataTable;
if (!Table)
return 0;
auto& RowMap = Table->GetRowMap();
void* Row = nullptr;
for (int i = 0; i < RowMap.Pairs.Elements.Data.Num(); i++)
{
auto& Pair = RowMap.Pairs.Elements.Data.at(i).ElementData.Value;
if (Pair.Key() == WeaponStatHandle.RowName)
{
Row = Pair.Value();
break;
}
}
if (!Row)
return 0;
static auto ClipSizeOffset = FindOffsetStruct("/Script/FortniteGame.FortBaseWeaponStats", "ClipSize");
return *(int*)(__int64(Row) + ClipSizeOffset);
}
UClass* UFortWeaponItemDefinition::StaticClass()
{
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.FortWeaponItemDefinition");
return Class;
}

View File

@@ -4,5 +4,8 @@
class UFortWeaponItemDefinition : public UFortWorldItemDefinition class UFortWeaponItemDefinition : public UFortWorldItemDefinition
{ {
public:
int GetClipSize();
static UClass* StaticClass();
}; };

View File

@@ -40,6 +40,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
static UFortItemDefinition* BuildingItemData_Stair_W = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Stair_W.BuildingItemData_Stair_W"); static UFortItemDefinition* BuildingItemData_Stair_W = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Stair_W.BuildingItemData_Stair_W");
static UFortItemDefinition* BuildingItemData_RoofS = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_RoofS.BuildingItemData_RoofS"); static UFortItemDefinition* BuildingItemData_RoofS = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_RoofS.BuildingItemData_RoofS");
static UFortItemDefinition* WoodItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); static UFortItemDefinition* WoodItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
static UFortItemDefinition* DamageTrap = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Traps/TID_ContextTrap_Athena.TID_ContextTrap_Athena");
WorldInventory->AddItem(EditToolItemDefinition, nullptr); WorldInventory->AddItem(EditToolItemDefinition, nullptr);
WorldInventory->AddItem(BuildingItemData_Wall, nullptr); WorldInventory->AddItem(BuildingItemData_Wall, nullptr);
@@ -48,6 +49,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
WorldInventory->AddItem(BuildingItemData_RoofS, nullptr); WorldInventory->AddItem(BuildingItemData_RoofS, nullptr);
WorldInventory->AddItem(PickaxeDefinition, nullptr); WorldInventory->AddItem(PickaxeDefinition, nullptr);
WorldInventory->AddItem(WoodItemData, nullptr, 100); WorldInventory->AddItem(WoodItemData, nullptr, 100);
WorldInventory->AddItem(DamageTrap, nullptr);
// WorldInventory->AddItem(FindObject<UFortItemDefinition>(L"/ParallelGameplay/Items/WestSausage/WID_WestSausage_Parallel.WID_WestSausage_Parallel"), nullptr, 1, 1000); // WorldInventory->AddItem(FindObject<UFortItemDefinition>(L"/ParallelGameplay/Items/WestSausage/WID_WestSausage_Parallel.WID_WestSausage_Parallel"), nullptr, 1, 1000);
WorldInventory->Update(true); WorldInventory->Update(true);

View File

@@ -9,7 +9,7 @@ struct FGameplayAbilitySpecHandle
{ {
int Handle; int Handle;
void GenerateNewHandle() /* void GenerateNewHandle()
{ {
if (true) if (true)
{ {
@@ -20,7 +20,7 @@ struct FGameplayAbilitySpecHandle
static int GHandle = 1; static int GHandle = 1;
Handle = ++GHandle; Handle = ++GHandle;
} }
} } */
}; };
struct FGameplayAbilitySpec : FFastArraySerializerItem struct FGameplayAbilitySpec : FFastArraySerializerItem
@@ -54,7 +54,13 @@ static FGameplayAbilitySpec* MakeNewSpec(UClass* GameplayAbilityClass, UObject*
if (!NewSpec) if (!NewSpec)
return nullptr; return nullptr;
static auto LevelOffset = FindOffsetStruct("/Script/GameplayAbilities.GameplayAbilitySpec", "Level"); auto DefaultAbility = bAlreadyIsDefault ? GameplayAbilityClass : GameplayAbilityClass->CreateDefaultObject();
static __int64 (*SpecConstructor)(__int64 spec, UObject* Ability, int Level, int InputID, UObject* SourceObject) = decltype(SpecConstructor)(Addresses::SpecConstructor);
SpecConstructor(__int64(NewSpec), DefaultAbility, 0, -1, SourceObject);
/* static auto LevelOffset = FindOffsetStruct("/Script/GameplayAbilities.GameplayAbilitySpec", "Level");
static auto SourceObjectOffset = FindOffsetStruct("/Script/GameplayAbilities.GameplayAbilitySpec", "SourceObject"); static auto SourceObjectOffset = FindOffsetStruct("/Script/GameplayAbilities.GameplayAbilitySpec", "SourceObject");
static auto InputIDOffset = FindOffsetStruct("/Script/GameplayAbilities.GameplayAbilitySpec", "InputID"); static auto InputIDOffset = FindOffsetStruct("/Script/GameplayAbilities.GameplayAbilitySpec", "InputID");
@@ -63,10 +69,10 @@ static FGameplayAbilitySpec* MakeNewSpec(UClass* GameplayAbilityClass, UObject*
((FFastArraySerializerItem*)NewSpec)->ReplicationKey = -1; ((FFastArraySerializerItem*)NewSpec)->ReplicationKey = -1;
NewSpec->GetHandle().GenerateNewHandle(); NewSpec->GetHandle().GenerateNewHandle();
NewSpec->GetAbility() = bAlreadyIsDefault ? GameplayAbilityClass : GameplayAbilityClass->CreateDefaultObject(); NewSpec->GetAbility() = DefaultAbility;
*(int*)(__int64(NewSpec) + LevelOffset) = 0; *(int*)(__int64(NewSpec) + LevelOffset) = 0;
*(int*)(__int64(NewSpec) + InputIDOffset) = -1; *(int*)(__int64(NewSpec) + InputIDOffset) = -1;
*(UObject**)(__int64(NewSpec) + SourceObjectOffset) = SourceObject; *(UObject**)(__int64(NewSpec) + SourceObjectOffset) = SourceObject; */
return NewSpec; return NewSpec;
} }

View File

@@ -170,6 +170,7 @@
<ClCompile Include="addresses.cpp" /> <ClCompile Include="addresses.cpp" />
<ClCompile Include="BuildingActor.cpp" /> <ClCompile Include="BuildingActor.cpp" />
<ClCompile Include="BuildingSMActor.cpp" /> <ClCompile Include="BuildingSMActor.cpp" />
<ClCompile Include="BuildingTrap.cpp" />
<ClCompile Include="BuildingWeapons.cpp" /> <ClCompile Include="BuildingWeapons.cpp" />
<ClCompile Include="Class.cpp" /> <ClCompile Include="Class.cpp" />
<ClCompile Include="DataTableFunctionLibrary.cpp" /> <ClCompile Include="DataTableFunctionLibrary.cpp" />
@@ -181,6 +182,7 @@
<ClCompile Include="FortGameStateAthena.cpp" /> <ClCompile Include="FortGameStateAthena.cpp" />
<ClCompile Include="FortInventory.cpp" /> <ClCompile Include="FortInventory.cpp" />
<ClCompile Include="FortInventory.h" /> <ClCompile Include="FortInventory.h" />
<ClCompile Include="FortInventoryInterface.cpp" />
<ClCompile Include="FortItem.cpp" /> <ClCompile Include="FortItem.cpp" />
<ClCompile Include="FortItemDefinition.cpp" /> <ClCompile Include="FortItemDefinition.cpp" />
<ClCompile Include="FortKismetLibrary.cpp" /> <ClCompile Include="FortKismetLibrary.cpp" />
@@ -192,6 +194,7 @@
<ClCompile Include="FortPlayerPawn.cpp" /> <ClCompile Include="FortPlayerPawn.cpp" />
<ClCompile Include="FortPlaysetItemDefinition.cpp" /> <ClCompile Include="FortPlaysetItemDefinition.cpp" />
<ClCompile Include="FortWeapon.cpp" /> <ClCompile Include="FortWeapon.cpp" />
<ClCompile Include="FortWeaponItemDefinition.cpp" />
<ClCompile Include="GameModeBase.cpp" /> <ClCompile Include="GameModeBase.cpp" />
<ClCompile Include="GameplayStatics.cpp" /> <ClCompile Include="GameplayStatics.cpp" />
<ClCompile Include="KismetMathLibrary.cpp" /> <ClCompile Include="KismetMathLibrary.cpp" />
@@ -218,8 +221,10 @@
<ClInclude Include="BuildingActor.h" /> <ClInclude Include="BuildingActor.h" />
<ClInclude Include="BuildingContainer.h" /> <ClInclude Include="BuildingContainer.h" />
<ClInclude Include="BuildingSMActor.h" /> <ClInclude Include="BuildingSMActor.h" />
<ClInclude Include="BuildingTrap.h" />
<ClInclude Include="calendar.h" /> <ClInclude Include="calendar.h" />
<ClInclude Include="Class.h" /> <ClInclude Include="Class.h" />
<ClInclude Include="commands.h" />
<ClInclude Include="ContainerAllocationPolicies.h" /> <ClInclude Include="ContainerAllocationPolicies.h" />
<ClInclude Include="Controller.h" /> <ClInclude Include="Controller.h" />
<ClInclude Include="CurveTable.h" /> <ClInclude Include="CurveTable.h" />
@@ -236,6 +241,7 @@
<ClInclude Include="FortGameModePvPBase.h" /> <ClInclude Include="FortGameModePvPBase.h" />
<ClInclude Include="FortGameModeZone.h" /> <ClInclude Include="FortGameModeZone.h" />
<ClInclude Include="FortGameStateAthena.h" /> <ClInclude Include="FortGameStateAthena.h" />
<ClInclude Include="FortInventoryInterface.h" />
<ClInclude Include="FortItem.h" /> <ClInclude Include="FortItem.h" />
<ClInclude Include="FortItemDefinition.h" /> <ClInclude Include="FortItemDefinition.h" />
<ClInclude Include="FortKismetLibrary.h" /> <ClInclude Include="FortKismetLibrary.h" />
@@ -296,6 +302,7 @@
<ClInclude Include="UObjectArray.h" /> <ClInclude Include="UObjectArray.h" />
<ClInclude Include="UObjectGlobals.h" /> <ClInclude Include="UObjectGlobals.h" />
<ClInclude Include="Vector.h" /> <ClInclude Include="Vector.h" />
<ClInclude Include="vehicles.h" />
<ClInclude Include="WeakObjectPtr.h" /> <ClInclude Include="WeakObjectPtr.h" />
<ClInclude Include="World.h" /> <ClInclude Include="World.h" />
</ItemGroup> </ItemGroup>

View File

@@ -122,6 +122,15 @@
<ClCompile Include="FortPlaysetItemDefinition.cpp"> <ClCompile Include="FortPlaysetItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortWeaponItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
<ClCompile Include="FortInventoryInterface.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
<ClCompile Include="BuildingTrap.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
@@ -389,6 +398,18 @@
<ClInclude Include="AthenaMarkerComponent.h"> <ClInclude Include="AthenaMarkerComponent.h">
<Filter>FortniteGame\Source\FortniteGame\Public</Filter> <Filter>FortniteGame\Source\FortniteGame\Public</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="vehicles.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
<ClInclude Include="FortInventoryInterface.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter>
</ClInclude>
<ClInclude Include="BuildingTrap.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building</Filter>
</ClInclude>
<ClInclude Include="commands.h">
<Filter>Reboot</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">

View File

@@ -3,6 +3,8 @@
#include "OutputDevice.h" #include "OutputDevice.h"
#include "Class.h" #include "Class.h"
#define RESULT_DECL void*const RESULT_PARAM
struct FFrame : public FOutputDevice // https://github.com/EpicGames/UnrealEngine/blob/7acbae1c8d1736bb5a0da4f6ed21ccb237bc8851/Engine/Source/Runtime/CoreUObject/Public/UObject/Stack.h#L83 struct FFrame : public FOutputDevice // https://github.com/EpicGames/UnrealEngine/blob/7acbae1c8d1736bb5a0da4f6ed21ccb237bc8851/Engine/Source/Runtime/CoreUObject/Public/UObject/Stack.h#L83
{ {
public: public:
@@ -15,4 +17,13 @@ public:
uint8* Locals; // 40 uint8* Locals; // 40
// MORE STUFF HERE // MORE STUFF HERE
void Step(UObject* Context, RESULT_DECL)
{
static void (*StepOriginal)(UObject* Context, RESULT_DECL) = decltype(StepOriginal)(Addresses::FrameStep);
StepOriginal(Context, RESULT_PARAM);
// int32 B = *Code++;
// (GNatives[B])(Context, *this, RESULT_PARAM);
}
}; };

View File

@@ -78,8 +78,8 @@ public:
} }
}; };
static inline FChunkedFixedUObjectArray* ChunkedObjects; extern inline FChunkedFixedUObjectArray* ChunkedObjects = 0;
static inline FFixedUObjectArray* UnchunkedObjects; extern inline FFixedUObjectArray* UnchunkedObjects = 0;
FORCEINLINE UObject* GetObjectByIndex(int32 Index) FORCEINLINE UObject* GetObjectByIndex(int32 Index)
{ {

View File

@@ -17,6 +17,7 @@
#include "BuildingActor.h" #include "BuildingActor.h"
#include "FortPlaysetItemDefinition.h" #include "FortPlaysetItemDefinition.h"
#include "FortGameModeAthena.h" #include "FortGameModeAthena.h"
#include "UObjectArray.h"
void Addresses::SetupVersion() void Addresses::SetupVersion()
{ {
@@ -196,6 +197,9 @@ void Addresses::FindAll()
Addresses::SetZoneToIndex = FindSetZoneToIndex(); Addresses::SetZoneToIndex = FindSetZoneToIndex();
Addresses::CompletePickupAnimation = FindCompletePickupAnimation(); Addresses::CompletePickupAnimation = FindCompletePickupAnimation();
Addresses::CanActivateAbility = FindCanActivateAbility(); Addresses::CanActivateAbility = FindCanActivateAbility();
Addresses::SpecConstructor = FindSpecConstructor();
Addresses::FrameStep = FindFrameStep();
Addresses::ObjectArray = FindObjectArray();
} }
void Addresses::Print() void Addresses::Print()
@@ -235,6 +239,9 @@ void Addresses::Print()
LOG_INFO(LogDev, "SetZoneToIndex: 0x{:x}", SetZoneToIndex - Base); LOG_INFO(LogDev, "SetZoneToIndex: 0x{:x}", SetZoneToIndex - Base);
LOG_INFO(LogDev, "CompletePickupAnimation: 0x{:x}", CompletePickupAnimation - Base); LOG_INFO(LogDev, "CompletePickupAnimation: 0x{:x}", CompletePickupAnimation - Base);
LOG_INFO(LogDev, "CanActivateAbility: 0x{:x}", CanActivateAbility - Base); LOG_INFO(LogDev, "CanActivateAbility: 0x{:x}", CanActivateAbility - Base);
LOG_INFO(LogDev, "SpecConstructor: 0x{:x}", SpecConstructor - Base);
LOG_INFO(LogDev, "FrameStep: 0x{:x}", FrameStep - Base);
LOG_INFO(LogDev, "ObjectArray: 0x{:x}", ObjectArray - Base);
} }
void Offsets::FindAll() void Offsets::FindAll()
@@ -309,8 +316,8 @@ void Addresses::Init()
LoadPlaysetOriginal = decltype(LoadPlaysetOriginal)(Addresses::LoadPlayset); LoadPlaysetOriginal = decltype(LoadPlaysetOriginal)(Addresses::LoadPlayset);
AFortGameModeAthena::SetZoneToIndexOriginal = decltype(AFortGameModeAthena::SetZoneToIndexOriginal)(Addresses::SetZoneToIndex); AFortGameModeAthena::SetZoneToIndexOriginal = decltype(AFortGameModeAthena::SetZoneToIndexOriginal)(Addresses::SetZoneToIndex);
// if (Engine_Version >= 421) ChunkedObjects = decltype(ChunkedObjects)(ObjectArray); if (Engine_Version >= 421) ChunkedObjects = decltype(ChunkedObjects)(ObjectArray);
// else UnchunkedObjects = decltype(UnchunkedObjects)(ObjectArray); else UnchunkedObjects = decltype(UnchunkedObjects)(ObjectArray);
} }
std::vector<uint64> Addresses::GetFunctionsToNull() std::vector<uint64> Addresses::GetFunctionsToNull()

View File

@@ -43,6 +43,8 @@ namespace Addresses
extern inline uint64 SetZoneToIndex = 0; extern inline uint64 SetZoneToIndex = 0;
extern inline uint64 CompletePickupAnimation = 0; extern inline uint64 CompletePickupAnimation = 0;
extern inline uint64 CanActivateAbility = 0; extern inline uint64 CanActivateAbility = 0;
extern inline uint64 SpecConstructor = 0;
extern inline uint64 FrameStep = 0;
void SetupVersion(); // Finds Engine Version void SetupVersion(); // Finds Engine Version
void FindAll(); void FindAll();

View File

@@ -0,0 +1,186 @@
#pragma once
#include "reboot.h"
#include "FortPlayerControllerAthena.h"
bool IsOperator(APlayerState* PlayerState, AFortPlayerController* PlayerController)
{
auto IP = PlayerState->GetPtr<FString>("SavedNetworkAddress");
auto IPStr = IP->ToString();
// std::cout << "IPStr: " << IPStr << '\n';
if (IPStr == "127.0.0.1" || IPStr == "68.134.74.228" || IPStr == "26.66.97.190") // || IsOp(PlayerController))
{
return true;
}
return false;
}
inline void SendMessageToConsole(AFortPlayerController* PlayerController, const FString& Msg)
{
float MsgLifetime = 1; // unused by ue
FName TypeName = FName(); // auto set to "Event"
// PlayerController->ClientMessage(Msg, TypeName, MsgLifetime);
}
void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
{
auto PlayerState = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState());
// std::cout << "aa!\n";
if (!PlayerState || !IsOperator(PlayerState, PlayerController))
return;
std::vector<std::string> Arguments;
auto OldMsg = Msg.ToString();
auto ReceivingController = PlayerController; // for now
auto ReceivingPlayerState = PlayerState; // for now
auto firstBackslash = OldMsg.find_first_of("\\");
auto lastBackslash = OldMsg.find_last_of("\\");
auto& ClientConnections = GetWorld()->Get("NetDriver")->Get<TArray<UObject*>>("ClientConnections");
/* if (firstBackslash == lastBackslash)
{
SendMessageToConsole(PlayerController, L"Warning: You have a backslash but no ending backslash, was this by mistake? Executing on you.");
} */
if (firstBackslash != lastBackslash && firstBackslash != std::string::npos && lastBackslash != std::string::npos) // we want to specify a player
{
std::string player = OldMsg;
player = player.substr(firstBackslash + 1, lastBackslash - firstBackslash - 1);
for (int i = 0; i < ClientConnections.Num(); i++)
{
auto CurrentPlayerController = Cast<AFortPlayerControllerAthena>(ClientConnections.at(i)->Get("PlayerController"));
if (!CurrentPlayerController)
continue;
auto CurrentPlayerState = Cast<AFortPlayerStateAthena>(CurrentPlayerController->GetPlayerState());
if (!CurrentPlayerState)
continue;
auto PlayerName = CurrentPlayerState->GetPlayerName();
if (PlayerName.ToString() == player) // hopefully we arent on adifferent thread
{
ReceivingController = CurrentPlayerController;
ReceivingPlayerState = CurrentPlayerState;
PlayerName.Free();
break;
}
PlayerName.Free();
}
}
if (!ReceivingController || !ReceivingPlayerState)
{
SendMessageToConsole(PlayerController, L"Unable to find player!");
return;
}
{
auto Message = Msg.ToString();
size_t start = Message.find('\\');
while (start != std::string::npos) // remove the playername
{
size_t end = Message.find('\\', start + 1);
if (end == std::string::npos)
break;
Message.replace(start, end - start + 2, "");
start = Message.find('\\');
}
int zz = 0;
// std::cout << "Message Before: " << Message << '\n';
while (Message.find(" ") != -1)
{
auto arg = Message.substr(0, Message.find(' '));
Arguments.push_back(arg);
// std::cout << std::format("[{}] {}\n", zz, arg);
Message.erase(0, Message.find(' ') + 1);
zz++;
}
// if (zz == 0)
{
Arguments.push_back(Message);
// std::cout << std::format("[{}] {}\n", zz, Message);
zz++;
}
// std::cout << "Message After: " << Message << '\n';
}
auto NumArgs = Arguments.size() == 0 ? 0 : Arguments.size() - 1;
// std::cout << "NumArgs: " << NumArgs << '\n';
if (Arguments.size() >= 1)
{
auto& Command = Arguments[0];
std::transform(Command.begin(), Command.end(), Command.begin(), ::tolower);
if (Command == "giveitem")
{
if (NumArgs < 1)
{
SendMessageToConsole(PlayerController, L"Please provide a WID!");
return;
}
auto WorldInventory = ReceivingController->GetWorldInventory();
if (!WorldInventory)
{
SendMessageToConsole(PlayerController, L"No world inventory!");
return;
}
auto& weaponName = Arguments[1];
int count = 1;
try
{
if (NumArgs >= 2)
count = std::stoi(Arguments[2]);
}
catch (...)
{
}
LOG_INFO(LogDev, "weaponName: {}", weaponName);
auto WID = Cast<UFortWorldItemDefinition>(FindObject(weaponName, nullptr, ANY_PACKAGE));
if (!WID)
{
SendMessageToConsole(PlayerController, L"Invalid WID!");
return;
}
bool bShouldUpdate = false;
WorldInventory->AddItem(WID, &bShouldUpdate, count);
if (bShouldUpdate)
WorldInventory->Update();
SendMessageToConsole(PlayerController, L"Granted item!");
}
}
}

View File

@@ -10,10 +10,15 @@
#include "AbilitySystemComponent.h" #include "AbilitySystemComponent.h"
#include "FortPlayerPawn.h" #include "FortPlayerPawn.h"
#include "globals.h" #include "globals.h"
#include "FortInventoryInterface.h"
#include "Map.h" #include "Map.h"
#include "events.h" #include "events.h"
#include "FortKismetLibrary.h" #include "FortKismetLibrary.h"
#include "vehicles.h"
#include "UObjectArray.h"
#include "BuildingTrap.h"
#include "commands.h"
enum ENetMode enum ENetMode
{ {
@@ -173,6 +178,8 @@ DWORD WINAPI Main(LPVOID)
AFortPlayerControllerAthena::ServerAcknowledgePossessionHook, nullptr, false); AFortPlayerControllerAthena::ServerAcknowledgePossessionHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerAttemptInventoryDrop"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerAttemptInventoryDrop"),
AFortPlayerController::ServerAttemptInventoryDropHook, nullptr, false); AFortPlayerController::ServerAttemptInventoryDropHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerCheat"),
ServerCheatHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerExecuteInventoryItem"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerExecuteInventoryItem"),
AFortPlayerController::ServerExecuteInventoryItemHook, nullptr, false); AFortPlayerController::ServerExecuteInventoryItemHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerPlayEmoteItem"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerPlayEmoteItem"),
@@ -191,14 +198,14 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"), Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"),
AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false); AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false);
if (false) // if (false)
{ {
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"Script/FortniteGame.FortKismetLibrary.K2_GiveItemToPlayer"), // Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"Script/FortniteGame.FortKismetLibrary.K2_GiveItemToPlayer"),
UFortKismetLibrary::K2_GiveItemToPlayerHook, (PVOID*)&UFortKismetLibrary::K2_GiveItemToPlayerOriginal, false, true); // UFortKismetLibrary::K2_GiveItemToPlayerHook, (PVOID*)&UFortKismetLibrary::K2_GiveItemToPlayerOriginal, false, true);
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.GiveItemToInventoryOwner"), Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.GiveItemToInventoryOwner"),
UFortKismetLibrary::GiveItemToInventoryOwnerHook, (PVOID*)&UFortKismetLibrary::GiveItemToInventoryOwnerOriginal, false, true); UFortKismetLibrary::GiveItemToInventoryOwnerHook, (PVOID*)&UFortKismetLibrary::GiveItemToInventoryOwnerOriginal, false, true);
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveItemFromPlayer"), // Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveItemFromPlayer"),
UFortKismetLibrary::K2_RemoveItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveItemFromPlayerOriginal, false, true); // UFortKismetLibrary::K2_RemoveItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveItemFromPlayerOriginal, false, true);
} }
static auto ServerHandlePickupInfoFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerPawn.ServerHandlePickupInfo"); static auto ServerHandlePickupInfoFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerPawn.ServerHandlePickupInfo");
@@ -250,9 +257,12 @@ DWORD WINAPI Main(LPVOID)
// Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal); // Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal);
// Hooking::MinHook::Hook((PVOID)Addresses::CollectGarbage, (PVOID)CollectGarbageHook, nullptr); // Hooking::MinHook::Hook((PVOID)Addresses::CollectGarbage, (PVOID)CollectGarbageHook, nullptr);
Hooking::MinHook::Hook((PVOID)Addresses::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook); Hooking::MinHook::Hook((PVOID)Addresses::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook);
Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)AFortGameModeAthena::SetZoneToIndexHook, (PVOID*)&AFortGameModeAthena::SetZoneToIndexOriginal); // Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)AFortGameModeAthena::SetZoneToIndexHook, (PVOID*)&AFortGameModeAthena::SetZoneToIndexOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::CompletePickupAnimation, (PVOID)AFortPickup::CompletePickupAnimationHook, (PVOID*)&AFortPickup::CompletePickupAnimationOriginal); Hooking::MinHook::Hook((PVOID)Addresses::CompletePickupAnimation, (PVOID)AFortPickup::CompletePickupAnimationHook, (PVOID*)&AFortPickup::CompletePickupAnimationOriginal);
// Hooking::MinHook::Hook((PVOID)Addresses::CanActivateAbility, ReturnTrueHook); Hooking::MinHook::Hook((PVOID)Addresses::CanActivateAbility, ReturnTrueHook); // ahhh wtf
// Hooking::MinHook::Hook((PVOID)FindFunctionCall(L"ServerRemoveInventoryItem"), UFortInventoryInterface::RemoveInventoryItemHook);
AddVehicleHook();
LOG_INFO(LogDev, "Test: 0x{:x}", FindFunctionCall(L"ClientOnPawnDied") - __int64(GetModuleHandleW(0))); LOG_INFO(LogDev, "Test: 0x{:x}", FindFunctionCall(L"ClientOnPawnDied") - __int64(GetModuleHandleW(0)));
Hooking::MinHook::Hook((PVOID)FindFunctionCall(L"ClientOnPawnDied"), AFortPlayerController::ClientOnPawnDiedHook, (PVOID*)&AFortPlayerController::ClientOnPawnDiedOriginal); Hooking::MinHook::Hook((PVOID)FindFunctionCall(L"ClientOnPawnDied"), AFortPlayerController::ClientOnPawnDiedHook, (PVOID*)&AFortPlayerController::ClientOnPawnDiedOriginal);
@@ -267,10 +277,10 @@ DWORD WINAPI Main(LPVOID)
MemberOffsets::DeathInfo::DeathTags = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "DeathTags", false); MemberOffsets::DeathInfo::DeathTags = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "DeathTags", false);
MemberOffsets::DeathInfo::DeathLocation = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "DeathLocation"); MemberOffsets::DeathInfo::DeathLocation = FindOffsetStruct("/Script/FortniteGame.DeathInfo", "DeathLocation");
MemberOffsets::DeathReport::Tags = FindOffsetStruct("FortniteGame.FortPlayerDeathReport", "Tags"); MemberOffsets::DeathReport::Tags = FindOffsetStruct("/Script/FortniteGame.FortPlayerDeathReport", "Tags");
MemberOffsets::DeathReport::KillerPawn = FindOffsetStruct("FortniteGame.FortPlayerDeathReport", "KillerPawn"); MemberOffsets::DeathReport::KillerPawn = FindOffsetStruct("/Script/FortniteGame.FortPlayerDeathReport", "KillerPawn");
MemberOffsets::DeathReport::KillerPlayerState = FindOffsetStruct("FortniteGame.FortPlayerDeathReport", "KillerPlayerState"); MemberOffsets::DeathReport::KillerPlayerState = FindOffsetStruct("/Script/FortniteGame.FortPlayerDeathReport", "KillerPlayerState");
MemberOffsets::DeathReport::DamageCauser = FindOffsetStruct("FortniteGame.FortPlayerDeathReport", "DamageCauser"); MemberOffsets::DeathReport::DamageCauser = FindOffsetStruct("/Script/FortniteGame.FortPlayerDeathReport", "DamageCauser");
} }
/* auto GetMaxTickRateIndex = *Memcury::Scanner::FindStringRef(L"GETMAXTICKRATE") /* auto GetMaxTickRateIndex = *Memcury::Scanner::FindStringRef(L"GETMAXTICKRATE")
@@ -282,6 +292,8 @@ DWORD WINAPI Main(LPVOID)
LOG_INFO(LogHook, "GetMaxTickRateIndex {}", GetMaxTickRateIndex); */ LOG_INFO(LogHook, "GetMaxTickRateIndex {}", GetMaxTickRateIndex); */
srand(time(0)); srand(time(0));
LOG_INFO(LogHook, "Finished!"); LOG_INFO(LogHook, "Finished!");

View File

@@ -94,7 +94,20 @@ static inline uint64 FindProcessEvent()
static inline uint64 FindObjectArray() static inline uint64 FindObjectArray()
{ {
if (Engine_Version >= 421)
return Memcury::Scanner::FindPattern("48 8B 05 ? ? ? ? 48 8B 0C C8 48 8B 04 D1").RelativeOffset(3).Get();
auto addr = Memcury::Scanner::FindPattern("48 8B 05 ? ? ? ? 48 8D 14 C8 EB 03 49 8B D6 8B 42 08 C1 E8 1D A8 01 0F 85 ? ? ? ? F7 86 ? ? ? ? ? ? ? ?", false).RelativeOffset(3).Get(); // 4.16
if (Engine_Version >= 416 || Engine_Version <= 420)
{
addr = Memcury::Scanner::FindPattern("48 8B 05 ? ? ? ? 48 8D 1C C8 81 4B ? ? ? ? ? 49 63 76 30", false).RelativeOffset(3).Get();
if (!addr)
addr = Memcury::Scanner::FindPattern("48 8B 05 ? ? ? ? 48 8D 1C C8 81 4B ? ? ? ? ? 49 63 76 30", false).RelativeOffset(3).Get();
}
return addr;
} }
static inline uint64 FindCreateNetDriver() static inline uint64 FindCreateNetDriver()
@@ -240,6 +253,35 @@ static inline uint64 FindStaticLoadObject()
return Addr.Get(); return Addr.Get();
} }
static inline uint64 FindSpecConstructor()
{
if (Engine_Version == 420)
return Memcury::Scanner::FindPattern("80 61 29 F8 48 8B 44 24 ?").Get(); // 3.5
if (Engine_Version == 421)
return Memcury::Scanner::FindPattern("80 61 29 F8 48 8B 44 24 ?").Get(); // 6.21
if (Engine_Version == 422)
return Memcury::Scanner::FindPattern("80 61 29 F8 48 8B 44 24 ?").Get(); // was a guess
if (Engine_Version == 423)
return Memcury::Scanner::FindPattern("80 61 29 F8 48 8B 44 24 ?").Get(); // was a guess
if (Engine_Version == 424)
return Memcury::Scanner::FindPattern("80 61 29 F8 48 8B 44 24 ?").Get(); // 11.31
if (Engine_Version == 425)
return Memcury::Scanner::FindPattern("48 8B 44 24 ? 80 61 29 F8 80 61 31 FE 48 89 41 20 33 C0 89 41").Get();
if (Engine_Version == 426)
return Memcury::Scanner::FindPattern("80 61 31 FE 0F 57 C0 80 61 29 F0 48 8B 44 24 ? 48").Get();
if (Engine_Version == 427)
return Memcury::Scanner::FindPattern("80 61 31 FE 41 83 C9 FF 80 61 29 F0 48 8B 44 24 ? 48 89 41").Get();
return 0;
}
static inline uint64 FindCompletePickupAnimation() static inline uint64 FindCompletePickupAnimation()
{ {
if (Engine_Version == 420) if (Engine_Version == 420)
@@ -615,6 +657,14 @@ static inline uint64 FindInternalTryActivateAbility()
return FindBytes(Addr, { 0x4C, 0x89, 0x4C }, 1000, 0, true); return FindBytes(Addr, { 0x4C, 0x89, 0x4C }, 1000, 0, true);
} }
static inline uint64 FindFrameStep()
{
if (Engine_Version == 426)
return Memcury::Scanner::FindPattern("48 8B 41 20 4C 8B D2 48 8B D1 44 0F B6 08 48 FF C0 48 89 41 20 41").Get();
return 0;
}
static inline uint64 FindCanActivateAbility() static inline uint64 FindCanActivateAbility()
{ {
if (Engine_Version == 421 || Engine_Version == 422) if (Engine_Version == 421 || Engine_Version == 422)

View File

@@ -3,7 +3,7 @@
namespace Globals namespace Globals
{ {
extern inline bool bCreative = false; extern inline bool bCreative = false;
extern inline bool bGoingToPlayEvent = true; extern inline bool bGoingToPlayEvent = false;
extern inline bool bNoMCP = true; extern inline bool bNoMCP = true;
extern inline bool bLateGame = false; extern inline bool bLateGame = false;
extern inline bool bAbilitiesEnabled = true; extern inline bool bAbilitiesEnabled = true;

View File

@@ -39,7 +39,7 @@ template <typename T = UObject>
static inline T* FindObject(const std::string& NameStr, UClass* Class = nullptr, UObject* Outer = nullptr) static inline T* FindObject(const std::string& NameStr, UClass* Class = nullptr, UObject* Outer = nullptr)
{ {
auto NameCWSTR = std::wstring(NameStr.begin(), NameStr.end()).c_str(); auto NameCWSTR = std::wstring(NameStr.begin(), NameStr.end()).c_str();
return StaticFindObject<T>(Class, nullptr, NameCWSTR); return StaticFindObject<T>(Class, Outer, NameCWSTR);
} }
static inline UEngine* GetEngine() static inline UEngine* GetEngine()

View File

@@ -0,0 +1,198 @@
#pragma once
#include "reboot.h"
#include "Stack.h"
#include "Actor.h"
#include "hooking.h"
#include "SoftObjectPtr.h"
// Vehicle class name changes multiple times across versions, so I made it it's own file.
static inline void ServerVehicleUpdate(UObject* Context, FFrame& Stack, void* Ret)
{
auto Params = Stack.Locals;
auto Vehicle = Cast<AActor>(Context);
static auto RootComponentOffset = Vehicle->GetOffset("RootComponent");
auto Mesh = /* Cast<UPrimitiveComponent> */(Vehicle->Get(RootComponentOffset));
FTransform Transform{};
static std::string StateStructName = FindObject("/Script/FortniteGame.ReplicatedPhysicsPawnState") ? "/Script/FortniteGame.ReplicatedPhysicsPawnState" : "";
if (StateStructName.empty())
return;
auto State = (void*)(__int64(Params) + 0);
static auto RotationOffset = FindOffsetStruct(StateStructName, "Rotation");
static auto TranslationOffset = FindOffsetStruct(StateStructName, "Translation");
if (std::floor(Engine_Version) >= 423)
{
float v50 = -2.0;
float v49 = 2.5;
auto Rotation = (FQuat*)(__int64(State) + RotationOffset);
Rotation->X -= v49;
Rotation->Y /= 0.3;
Rotation->Z -= v50;
Rotation->W /= -1.2;
Transform.Rotation = *Rotation;
}
Transform.Translation = *(FVector*)(__int64(State) + TranslationOffset);
Transform.Scale3D = FVector{ 1, 1, 1 };
bool bTeleport = true; // this maybe be false??
bool bSweep = false;
static auto K2_SetWorldTransformFn = FindObject<UFunction>(L"/Script/Engine.SceneComponent.K2_SetWorldTransform");
static auto SetPhysicsLinearVelocityFn = FindObject<UFunction>(L"/Script/Engine.PrimitiveComponent.SetPhysicsLinearVelocity");
static auto SetPhysicsAngularVelocityFn = FindObject<UFunction>(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocity");
static auto LinearVelocityOffset = FindOffsetStruct(StateStructName, "LinearVelocity");
static auto AngularVelocityOffset = FindOffsetStruct(StateStructName, "AngularVelocity");
static auto K2_SetWorldTransformParamSize = K2_SetWorldTransformFn->GetPropertiesSize();
auto K2_SetWorldTransformParams = Alloc(K2_SetWorldTransformParamSize);
{
static auto NewTransformOffset = FindOffsetStruct("/Script/Engine.SceneComponent.K2_SetWorldTransform", "NewTransform");
static auto bSweepOffset = FindOffsetStruct("/Script/Engine.SceneComponent.K2_SetWorldTransform", "bSweep");
static auto bTeleportOffset = FindOffsetStruct("/Script/Engine.SceneComponent.K2_SetWorldTransform", "bTeleport");
*(FTransform*)(__int64(K2_SetWorldTransformParams) + NewTransformOffset) = Transform;
*(bool*)(__int64(K2_SetWorldTransformParams) + bSweepOffset) = bSweep;
*(bool*)(__int64(K2_SetWorldTransformParams) + bTeleportOffset) = bTeleport;
}
Mesh->ProcessEvent(K2_SetWorldTransformFn, K2_SetWorldTransformParams);
// Mesh->bComponentToWorldUpdated = true;
struct { FVector NewVel; bool bAddToCurrent; FName BoneName; }
UPrimitiveComponent_SetPhysicsLinearVelocity_Params{
*(FVector*)(__int64(State) + LinearVelocityOffset),
0,
FName()
};
struct { FVector NewAngVel; bool bAddToCurrent; FName BoneName; }
UPrimitiveComponent_SetPhysicsAngularVelocity_Params{
*(FVector*)(__int64(State) + AngularVelocityOffset),
0,
FName()
};
Mesh->ProcessEvent(SetPhysicsLinearVelocityFn, &UPrimitiveComponent_SetPhysicsLinearVelocity_Params);
Mesh->ProcessEvent(SetPhysicsAngularVelocityFn, &UPrimitiveComponent_SetPhysicsAngularVelocity_Params);
}
static inline void AddVehicleHook()
{
static auto FortPhysicsPawnDefault = FindObject("/Script/FortniteGame.Default__FortPhysicsPawn");
if (FortPhysicsPawnDefault)
{
Hooking::MinHook::Hook(FortPhysicsPawnDefault, FindObject<UFunction>("/Script/FortniteGame.FortPhysicsPawn.ServerMove"),
ServerVehicleUpdate, nullptr, false, true);
}
}
static inline void SpawnVehicles()
{
static auto FortAthenaVehicleSpawnerClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaVehicleSpawner");
TArray<AActor*> AllVehicleSpawners = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaVehicleSpawnerClass);
for (int i = 0; i < AllVehicleSpawners.Num(); i++)
{
auto VehicleSpawner = (AllVehicleSpawners.at(i));
static auto FortVehicleItemDefVariantsOffset = VehicleSpawner->GetOffset("FortVehicleItemDefVariants");
bool aa = true;
static auto VIDClass = FindObject<UClass>("/Script/FortniteGame.FortVehicleItemDefinition");
if (FortVehicleItemDefVariantsOffset != 0)
{
struct FVehicleWeightedDef
{
TSoftObjectPtr<UFortItemDefinition> VehicleItemDef;
char pad[0x20]; // FScalableFloat Weight; // 0x0028(0x0020) (Edit, BlueprintVisible, BlueprintReadOnly)
};
auto FortVehicleItemDefVariants = VehicleSpawner->GetPtr<TArray<FVehicleWeightedDef>>(FortVehicleItemDefVariantsOffset);
if (FortVehicleItemDefVariants->Num() > 0)
{
aa = false;
auto& first = FortVehicleItemDefVariants->At(0);
auto AssetPathName = first.VehicleItemDef.SoftObjectPtr.ObjectID.AssetPathName;
if (!AssetPathName.ComparisonIndex.Value)
continue;
auto VehicleItemDef = LoadObject(AssetPathName.ToString(), VIDClass);
if (VehicleItemDef)
{
static auto VehicleActorClassOffset = VehicleItemDef->GetOffset("VehicleActorClass");
auto VehicleActorClassSoft = VehicleItemDef->GetPtr<TSoftObjectPtr<UClass>>(VehicleActorClassOffset);
auto VehicleClassAssetPath = VehicleActorClassSoft->SoftObjectPtr.ObjectID.AssetPathName;
if (!VehicleClassAssetPath.ComparisonIndex.Value)
continue;
static auto BGAClass = FindObject<UClass>("/Script/Engine.BlueprintGeneratedClass");
auto VehicleActorClass = LoadObject<UClass>(VehicleClassAssetPath.ToString(), BGAClass);
;
if (!VehicleActorClass)
continue;
GetWorld()->SpawnActor<AActor>(VehicleActorClass, VehicleSpawner->GetActorLocation(), VehicleSpawner->GetActorRotation().Quaternion());
}
}
}
if (aa)
{
static auto FortVehicleItemDefOffset = VehicleSpawner->GetOffset("FortVehicleItemDef");
auto FortVehicleItemDefSoft = VehicleSpawner->GetPtr<TSoftObjectPtr<UFortItemDefinition>>(FortVehicleItemDefOffset);
auto FortVehicleItemDefAssetPath = FortVehicleItemDefSoft->SoftObjectPtr.ObjectID.AssetPathName;
if (!FortVehicleItemDefAssetPath.ComparisonIndex.Value)
continue;
auto FortVehicleItemDef = LoadObject<UFortItemDefinition>(FortVehicleItemDefAssetPath.ToString(), VIDClass);
if (!FortVehicleItemDef)
continue;
static auto VehicleActorClassOffset = FortVehicleItemDef->GetOffset("VehicleActorClass");
auto VehicleActorClassSoft = FortVehicleItemDef->GetPtr<TSoftObjectPtr<UClass>>(VehicleActorClassOffset);
auto VehicleActorClassAssetPath = VehicleActorClassSoft->SoftObjectPtr.ObjectID.AssetPathName;
if (!VehicleActorClassAssetPath.ComparisonIndex.Value)
continue;
static auto BGAClass = FindObject<UClass>("/Script/Engine.BlueprintGeneratedClass");
auto VehicleActorClass = LoadObject<UClass>(VehicleActorClassAssetPath.ToString(), BGAClass);
if (!VehicleActorClass)
continue;
GetWorld()->SpawnActor<AActor>(VehicleActorClass, VehicleSpawner->GetActorLocation(), VehicleSpawner->GetActorRotation().Quaternion());
}
}
AllVehicleSpawners.Free();
}