creative stuff

This commit is contained in:
Milxnor
2023-03-13 22:03:18 -04:00
parent 2fd7f3b23f
commit 818bc8119b
23 changed files with 393 additions and 45 deletions

View File

@@ -0,0 +1,8 @@
#pragma once
#include "BuildingActor.h"
class ABuildingGameplayActor : public ABuildingActor
{
public:
};

View File

@@ -0,0 +1,78 @@
#include "FortAthenaCreativePortal.h"
#include "FortPlayerPawn.h"
#include "FortPlayerControllerAthena.h"
void AFortAthenaCreativePortal::TeleportPlayerToLinkedVolumeHook(UObject* Context, FFrame& Stack, void* Ret)
{
auto Portal = (AFortAthenaCreativePortal*)Context; // Cast?
if (!Portal)
return TeleportPlayerToLinkedVolumeOriginal(Context, Stack, Ret);
AFortPlayerPawn* PlayerPawn = nullptr;
bool bUseSpawnTags;
Stack.Step(Stack.Object, &PlayerPawn);
Stack.Step(Stack.Object, &bUseSpawnTags);
LOG_INFO(LogDev, "PlayerPawn: {}", __int64(PlayerPawn));
if (!PlayerPawn)
return TeleportPlayerToLinkedVolumeOriginal(Context, Stack, Ret);
auto LinkedVolume = Portal->GetLinkedVolume();
LOG_INFO(LogDev, "LinkedVolume: {}", __int64(LinkedVolume));
if (!LinkedVolume)
return TeleportPlayerToLinkedVolumeOriginal(Context, Stack, Ret);
auto Location = LinkedVolume->GetActorLocation();
Location.Z -= 1000; // proper 1:1
PlayerPawn->TeleportTo(Location, FRotator());
return TeleportPlayerToLinkedVolumeOriginal(Context, Stack, Ret);
}
void AFortAthenaCreativePortal::TeleportPlayerHook(UObject* Context, FFrame& Stack, void* Ret)
{
auto Portal = (AFortAthenaCreativePortal*)Context; // Cast?
if (!Portal)
return TeleportPlayerOriginal(Context, Stack, Ret);
AFortPlayerPawn* PlayerPawn = nullptr;
FRotator TeleportRotation;
Stack.Step(Stack.Object, &PlayerPawn);
Stack.Step(Stack.Object, &TeleportRotation);
LOG_INFO(LogDev, "PlayerPawn: {}", __int64(PlayerPawn));
if (!PlayerPawn)
return TeleportPlayerOriginal(Context, Stack, Ret);
static auto bReturnToCreativeHubOffset = Portal->GetOffset("bReturnToCreativeHub");
auto bReturnToCreativeHub = Portal->Get<bool>(bReturnToCreativeHubOffset);
LOG_INFO(LogDev, "bReturnToCreativeHub: {}", bReturnToCreativeHub);
if (bReturnToCreativeHub)
{
auto Controller = Cast<AFortPlayerControllerAthena>(PlayerPawn->GetController());
if (!Controller)
return TeleportPlayerOriginal(Context, Stack, Ret);
AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook(Controller);
}
else
{
static auto TeleportLocationOffset = Portal->GetOffset("TeleportLocation");
auto& TeleportLocation = Portal->Get<FVector>(TeleportLocationOffset);
PlayerPawn->TeleportTo(TeleportLocation, TeleportRotation);
}
return TeleportPlayerOriginal(Context, Stack, Ret);
}

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include "BuildingActor.h" #include "BuildingActor.h"
#include "FortVolume.h"
#include "Stack.h"
struct FCreativeLoadedLinkData struct FCreativeLoadedLinkData
{ {
@@ -10,6 +12,9 @@ struct FCreativeLoadedLinkData
class AFortAthenaCreativePortal : public ABuildingActor // ABuildingGameplayActor class AFortAthenaCreativePortal : public ABuildingActor // ABuildingGameplayActor
{ {
public: public:
static inline void (*TeleportPlayerToLinkedVolumeOriginal)(UObject* Context, FFrame& Stack, void* Ret);
static inline void (*TeleportPlayerOriginal)(UObject* Context, FFrame& Stack, void* Ret);
FCreativeLoadedLinkData* GetIslandInfo() FCreativeLoadedLinkData* GetIslandInfo()
{ {
static auto CreativeLoadedLinkDataStruct = FindObject<UStruct>("/Script/FortniteGame.CreativeLoadedLinkData"); static auto CreativeLoadedLinkDataStruct = FindObject<UStruct>("/Script/FortniteGame.CreativeLoadedLinkData");
@@ -23,7 +28,11 @@ public:
void* GetOwningPlayer() void* GetOwningPlayer()
{ {
static auto OwningPlayerOffset = GetOffset("OwningPlayer"); static auto OwningPlayerOffset = GetOffset("OwningPlayer", false);
if (OwningPlayerOffset == 0)
return nullptr;
return GetPtr<void>(OwningPlayerOffset); return GetPtr<void>(OwningPlayerOffset);
} }
@@ -63,4 +72,8 @@ public:
static auto CreatorNameOffset = FindOffsetStruct("/Script/FortniteGame.CreativeLoadedLinkData", "CreatorName"); static auto CreatorNameOffset = FindOffsetStruct("/Script/FortniteGame.CreativeLoadedLinkData", "CreatorName");
return *(FString*)(__int64(IslandInfo) + CreatorNameOffset); return *(FString*)(__int64(IslandInfo) + CreatorNameOffset);
} }
static void TeleportPlayerToLinkedVolumeHook(UObject* Context, FFrame& Stack, void* Ret);
static void TeleportPlayerHook(UObject* Context, FFrame& Stack, void* Ret);
// hook TeleportPlayer ?? but do what with it
}; };

View File

@@ -0,0 +1,24 @@
#include "FortAthenaSupplyDrop.h"
AFortPickup* AFortAthenaSupplyDrop::SpawnPickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret)
{
UFortWorldItemDefinition* ItemDefinition = nullptr; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, 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; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
Stack.Step(Stack.Object, &ItemDefinition);
Stack.Step(Stack.Object, &NumberToSpawn);
Stack.Step(Stack.Object, &TriggeringPawn);
Stack.Step(Stack.Object, &Position);
Stack.Step(Stack.Object, &Direction);
SpawnPickupOriginal(Context, Stack, Ret);
if (!ItemDefinition)
return nullptr;
*Ret = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource::SupplyDrop, -1, TriggeringPawn);
return *Ret;
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include "BuildingGameplayActor.h"
#include "FortPickup.h"
#include "Stack.h"
class AFortAthenaSupplyDrop : public ABuildingGameplayActor
{
public:
static inline AFortPickup* (*SpawnPickupOriginal)(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static AFortPickup* SpawnPickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret);
};

View File

@@ -458,15 +458,18 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
} }
static auto FortPlayerStartWarmupClass = FindObject<UClass>("/Script/FortniteGame.FortPlayerStartWarmup"); if (!Globals::bCreative)
TArray<AActor*> Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartWarmupClass); {
static auto FortPlayerStartWarmupClass = FindObject<UClass>("/Script/FortniteGame.FortPlayerStartWarmup");
TArray<AActor*> Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartWarmupClass);
int ActorsNum = Actors.Num(); int ActorsNum = Actors.Num();
Actors.Free(); Actors.Free();
if (ActorsNum == 0) if (ActorsNum == 0)
return false; return false;
}
static int LastNum9 = 1; static int LastNum9 = 1;
@@ -671,7 +674,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
} }
} }
static bool bSpawnedVehicles = Engine_Version < 423; static bool bSpawnedVehicles = Engine_Version < 424; // todo fix
if (!bSpawnedVehicles) if (!bSpawnedVehicles)
{ {
@@ -835,12 +838,20 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
if (AvailablePortalsOffset != 0) if (AvailablePortalsOffset != 0)
{ {
auto& AvailablePortals = CreativePortalManager->Get<TArray<AActor*>>(AvailablePortalsOffset); auto& AvailablePortals = CreativePortalManager->Get<TArray<AActor*>>(AvailablePortalsOffset);
Portal = (AFortAthenaCreativePortal*)AvailablePortals.at(0);
AvailablePortals.Remove(0);
static auto UsedPortalsOffset = CreativePortalManager->GetOffset("UsedPortals"); if (AvailablePortals.Num() > 0)
auto& UsedPortals = CreativePortalManager->Get<TArray<AActor*>>(UsedPortalsOffset); {
UsedPortals.Add(Portal); Portal = (AFortAthenaCreativePortal*)AvailablePortals.at(0);
AvailablePortals.Remove(0);
static auto UsedPortalsOffset = CreativePortalManager->GetOffset("UsedPortals");
auto& UsedPortals = CreativePortalManager->Get<TArray<AActor*>>(UsedPortalsOffset);
UsedPortals.Add(Portal);
}
else
{
LOG_WARN(LogCreative, "AvaliablePortals size is 0!");
}
} }
else else
{ {
@@ -863,12 +874,20 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
{ {
// Portal->GetCreatorName() = PlayerStateAthena->GetPlayerName(); // Portal->GetCreatorName() = PlayerStateAthena->GetPlayerName();
*(FUniqueNetIdReplExperimental*)Portal->GetOwningPlayer() = PlayerStateUniqueId; auto OwningPlayer = Portal->GetOwningPlayer();
if (OwningPlayer != nullptr)
*(FUniqueNetIdReplExperimental*)OwningPlayer = PlayerStateUniqueId;
Portal->GetPortalOpen() = true; Portal->GetPortalOpen() = true;
static auto PlayersReadyOffset = Portal->GetOffset("PlayersReady"); static auto PlayersReadyOffset = Portal->GetOffset("PlayersReady");
auto& PlayersReady = Portal->Get<TArray<FUniqueNetIdReplExperimental>>(PlayersReadyOffset);
PlayersReady.Add(PlayerStateUniqueId); if (PlayersReadyOffset != 0)
{
auto& PlayersReady = Portal->Get<TArray<FUniqueNetIdReplExperimental>>(PlayersReadyOffset);
PlayersReady.Add(PlayerStateUniqueId);
}
Portal->GetUserInitiatedLoad() = true; Portal->GetUserInitiatedLoad() = true;
Portal->GetInErrorState() = false; Portal->GetInErrorState() = false;

View File

@@ -14,6 +14,9 @@ UFortItem* CreateItemInstance(AFortPlayerController* PlayerController, UFortItem
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count, int LoadedAmmo, bool bShouldAddToStateValues) std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count, int LoadedAmmo, bool bShouldAddToStateValues)
{ {
if (!ItemDefinition)
return std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>>();
if (bShouldUpdate) if (bShouldUpdate)
*bShouldUpdate = false; *bShouldUpdate = false;
@@ -225,6 +228,23 @@ void AFortInventory::ModifyCount(UFortItem* ItemInstance, int New, bool bRemove,
} }
} }
UFortItem* AFortInventory::GetPickaxeInstance()
{
static auto FortWeaponMeleeItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.FortWeaponMeleeItemDefinition");
auto& ItemInstances = GetItemList().GetItemInstances();
for (int i = 0; i < ItemInstances.Num(); i++)
{
auto ItemInstance = ItemInstances.At(i);
if (ItemInstance->GetItemEntry()->GetItemDefinition()->IsA(FortWeaponMeleeItemDefinitionClass))
return ItemInstance;
}
return nullptr;
}
UFortItem* AFortInventory::FindItemInstance(UFortItemDefinition* ItemDefinition) UFortItem* AFortInventory::FindItemInstance(UFortItemDefinition* ItemDefinition)
{ {
auto& ItemInstances = GetItemList().GetItemInstances(); auto& ItemInstances = GetItemList().GetItemInstances();

View File

@@ -95,6 +95,7 @@ public:
bool RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count); bool RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count);
void ModifyCount(UFortItem* ItemInstance, int New, bool bRemove = false, std::pair<FFortItemEntry*, FFortItemEntry*>* outEntries = nullptr, bool bUpdate = true); void ModifyCount(UFortItem* ItemInstance, int New, bool bRemove = false, std::pair<FFortItemEntry*, FFortItemEntry*>* outEntries = nullptr, bool bUpdate = true);
UFortItem* GetPickaxeInstance();
UFortItem* FindItemInstance(UFortItemDefinition* ItemDefinition); UFortItem* FindItemInstance(UFortItemDefinition* ItemDefinition);
UFortItem* FindItemInstance(const FGuid& Guid); UFortItem* FindItemInstance(const FGuid& Guid);

View File

@@ -283,6 +283,11 @@ AFortPickup* UFortKismetLibrary::K2_SpawnPickupInWorldHook(UObject* Context, FFr
return *Ret; return *Ret;
} }
bool UFortKismetLibrary::PickLootDropsHook(UObject* Context, FFrame& Stack, bool* Ret)
{
return PickLootDropsOriginal(Context, Stack, Ret);
}
UClass* UFortKismetLibrary::StaticClass() UClass* UFortKismetLibrary::StaticClass()
{ {
static auto ptr = FindObject<UClass>(L"/Script/FortniteGame.FortKismetLibrary"); static auto ptr = FindObject<UClass>(L"/Script/FortniteGame.FortKismetLibrary");

View File

@@ -18,6 +18,7 @@ public:
static inline void (*GiveItemToInventoryOwnerOriginal)(UObject* Context, FFrame& Stack, void* Ret); static inline void (*GiveItemToInventoryOwnerOriginal)(UObject* Context, FFrame& Stack, void* Ret);
static inline void (*K2_RemoveFortItemFromPlayerOriginal)(UObject* Context, FFrame& Stack, void* Ret); static inline void (*K2_RemoveFortItemFromPlayerOriginal)(UObject* Context, FFrame& Stack, void* Ret);
static inline AFortPickup* (*K2_SpawnPickupInWorldOriginal)(UObject* Context, FFrame& Stack, AFortPickup** Ret); static inline AFortPickup* (*K2_SpawnPickupInWorldOriginal)(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static inline bool (*PickLootDropsOriginal)(UObject* Context, FFrame& Stack, bool* Ret);
static UFortResourceItemDefinition* K2_GetResourceItemDefinition(EFortResourceType ResourceType); static UFortResourceItemDefinition* K2_GetResourceItemDefinition(EFortResourceType ResourceType);
static void ApplyCharacterCosmetics(UObject* WorldContextObject, const TArray<UObject*>& CharacterParts, UObject* PlayerState, bool* bSuccess); static void ApplyCharacterCosmetics(UObject* WorldContextObject, const TArray<UObject*>& CharacterParts, UObject* PlayerState, bool* bSuccess);
@@ -28,6 +29,7 @@ public:
static void K2_GiveItemToPlayerHook(UObject* Context, FFrame& Stack, void* Ret); static void K2_GiveItemToPlayerHook(UObject* Context, FFrame& Stack, void* Ret);
static void K2_RemoveFortItemFromPlayerHook(UObject* Context, FFrame& Stack, void* Ret); static void K2_RemoveFortItemFromPlayerHook(UObject* Context, FFrame& Stack, void* Ret);
static AFortPickup* K2_SpawnPickupInWorldHook(UObject* Context, FFrame& Stack, AFortPickup** Ret); static AFortPickup* K2_SpawnPickupInWorldHook(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static bool PickLootDropsHook(UObject* Context, FFrame& Stack, bool* Ret);
static UClass* StaticClass(); static UClass* StaticClass();
}; };

View File

@@ -0,0 +1,30 @@
#include "FortMinigame.h"
#include "FortPlayerControllerAthena.h"
void AFortMinigame::ClearPlayerInventoryHook(UObject* Context, FFrame& Stack, void* Ret)
{
auto Minigame = (AFortMinigame*)Context;
if (!Minigame)
return;
AFortPlayerControllerAthena* PlayerController = nullptr;
Stack.Step(Stack.Object, &PlayerController);
if (!PlayerController)
return;
auto& ItemInstances = PlayerController->GetWorldInventory()->GetItemList().GetItemInstances();
for (int i = 0; i < ItemInstances.Num(); i++)
{
auto ItemInstance = ItemInstances.at(i);
PlayerController->GetWorldInventory()->RemoveItem(ItemInstance->GetItemEntry()->GetItemGuid(), nullptr, ItemInstance->GetItemEntry()->GetCount());
}
PlayerController->GetWorldInventory()->Update();
return ClearPlayerInventoryOriginal(Context, Stack, Ret);
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include "reboot.h"
#include "Actor.h"
#include "Stack.h"
class AFortMinigame : public AActor // AInfo
{
public:
static inline void (*ClearPlayerInventoryOriginal)(UObject* Context, FFrame& Stack, void* Ret);
static void ClearPlayerInventoryHook(UObject* Context, FFrame& Stack, void* Ret);
};

View File

@@ -4,6 +4,7 @@
#include "SoftObjectPtr.h" #include "SoftObjectPtr.h"
#include "globals.h" #include "globals.h"
#include "GameplayStatics.h"
void ApplyCID(AFortPlayerPawn* Pawn, UObject* CID) void ApplyCID(AFortPlayerPawn* Pawn, UObject* CID)
{ {
@@ -51,6 +52,32 @@ void ApplyCID(AFortPlayerPawn* Pawn, UObject* CID)
} }
} }
void AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook(AFortPlayerControllerAthena* Controller)
{
auto Pawn = Controller->GetMyFortPawn();
if (!Pawn)
return;
static auto FortPlayerStartCreativeClass = FindObject<UClass>("/Script/FortniteGame.FortPlayerStartCreative");
auto AllCreativePlayerStarts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartCreativeClass);
for (int i = 0; i < AllCreativePlayerStarts.Num(); i++)
{
auto CurrentPlayerStart = AllCreativePlayerStarts.at(i);
static auto PlayerStartTagsOffset = CurrentPlayerStart->GetOffset("PlayerStartTags");
auto bHasSpawnTag = CurrentPlayerStart->Get<FGameplayTagContainer>(PlayerStartTagsOffset).Contains("Playground.LobbyIsland.Spawn");
if (!bHasSpawnTag)
continue;
Pawn->TeleportTo(CurrentPlayerStart->GetActorLocation(), Pawn->GetActorRotation());
}
AllCreativePlayerStarts.Free();
}
void AFortPlayerControllerAthena::ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn) void AFortPlayerControllerAthena::ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn)
{ {
static auto AcknowledgedPawnOffset = Controller->GetOffset("AcknowledgedPawn"); static auto AcknowledgedPawnOffset = Controller->GetOffset("AcknowledgedPawn");

View File

@@ -13,6 +13,7 @@ public:
return (AFortPlayerStateAthena*)GetPlayerState(); return (AFortPlayerStateAthena*)GetPlayerState();
} }
static void ServerTeleportToPlaygroundLobbyIslandHook(AFortPlayerControllerAthena* Controller);
static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn); static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn);
static void ServerPlaySquadQuickChatMessage(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID); static void ServerPlaySquadQuickChatMessage(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID);
static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation); static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation);

View File

@@ -27,33 +27,36 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
{ {
auto WorldInventory = NewPlayerAsAthena->GetWorldInventory(); auto WorldInventory = NewPlayerAsAthena->GetWorldInventory();
auto CosmeticLoadoutPickaxe = NewPlayerAsAthena->GetCosmeticLoadout()->GetPickaxe(); if (!WorldInventory->GetPickaxeInstance())
static auto WeaponDefinitionOffset = FindOffsetStruct("/Script/FortniteGame.AthenaPickaxeItemDefinition", "WeaponDefinition"); {
auto CosmeticLoadoutPickaxe = NewPlayerAsAthena->GetCosmeticLoadout()->GetPickaxe();
static auto WeaponDefinitionOffset = FindOffsetStruct("/Script/FortniteGame.AthenaPickaxeItemDefinition", "WeaponDefinition");
auto Pickaxe = CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get<UFortItemDefinition*>(WeaponDefinitionOffset) auto Pickaxe = CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get<UFortItemDefinition*>(WeaponDefinitionOffset)
: FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Harvest_Pickaxe_Athena_C_T01.WID_Harvest_Pickaxe_Athena_C_T01"); : FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Harvest_Pickaxe_Athena_C_T01.WID_Harvest_Pickaxe_Athena_C_T01");
static UFortItemDefinition* EditToolItemDefinition = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/EditTool.EditTool"); static UFortItemDefinition* EditToolItemDefinition = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/EditTool.EditTool");
static UFortItemDefinition* PickaxeDefinition = Pickaxe; static UFortItemDefinition* PickaxeDefinition = Pickaxe;
static UFortItemDefinition* BuildingItemData_Wall = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Wall.BuildingItemData_Wall"); static UFortItemDefinition* BuildingItemData_Wall = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Wall.BuildingItemData_Wall");
static UFortItemDefinition* BuildingItemData_Floor = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Floor.BuildingItemData_Floor"); static UFortItemDefinition* BuildingItemData_Floor = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Floor.BuildingItemData_Floor");
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"); 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);
WorldInventory->AddItem(BuildingItemData_Floor, nullptr); WorldInventory->AddItem(BuildingItemData_Floor, nullptr);
WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr); WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr);
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(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->AddItem(FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Consumables/HappyGhost/WID_Athena_HappyGhost.WID_Athena_HappyGhost"), nullptr); // WorldInventory->AddItem(FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Consumables/HappyGhost/WID_Athena_HappyGhost.WID_Athena_HappyGhost"), nullptr);
WorldInventory->Update(true); WorldInventory->Update(true);
}
} }
} }

View File

@@ -110,8 +110,8 @@ struct FFastArraySerializer
void MarkArrayDirty() void MarkArrayDirty()
{ {
((FFastArraySerializer2*)this)->MarkArrayDirty(); // ((FFastArraySerializer2*)this)->MarkArrayDirty();
return; // return;
// ItemMap.Reset(); // This allows to clients to add predictive elements to arrays without affecting replication. // ItemMap.Reset(); // This allows to clients to add predictive elements to arrays without affecting replication.
GetArrayReplicationKey()++; GetArrayReplicationKey()++;

View File

@@ -176,6 +176,8 @@
<ClCompile Include="DataTableFunctionLibrary.cpp" /> <ClCompile Include="DataTableFunctionLibrary.cpp" />
<ClCompile Include="dllmain.cpp" /> <ClCompile Include="dllmain.cpp" />
<ClCompile Include="events.cpp" /> <ClCompile Include="events.cpp" />
<ClCompile Include="FortAthenaCreativePortal.cpp" />
<ClCompile Include="FortAthenaSupplyDrop.cpp" />
<ClCompile Include="FortDecoItemDefinition.cpp" /> <ClCompile Include="FortDecoItemDefinition.cpp" />
<ClCompile Include="FortGameModeAthena.cpp" /> <ClCompile Include="FortGameModeAthena.cpp" />
<ClCompile Include="FortGameModeZone.cpp" /> <ClCompile Include="FortGameModeZone.cpp" />
@@ -187,6 +189,7 @@
<ClCompile Include="FortItemDefinition.cpp" /> <ClCompile Include="FortItemDefinition.cpp" />
<ClCompile Include="FortKismetLibrary.cpp" /> <ClCompile Include="FortKismetLibrary.cpp" />
<ClCompile Include="FortLootPackage.cpp" /> <ClCompile Include="FortLootPackage.cpp" />
<ClCompile Include="FortMinigame.cpp" />
<ClCompile Include="FortPawn.cpp" /> <ClCompile Include="FortPawn.cpp" />
<ClCompile Include="FortPickup.cpp" /> <ClCompile Include="FortPickup.cpp" />
<ClCompile Include="FortPlayerController.cpp" /> <ClCompile Include="FortPlayerController.cpp" />
@@ -220,6 +223,7 @@
<ClInclude Include="BitArray.h" /> <ClInclude Include="BitArray.h" />
<ClInclude Include="BuildingActor.h" /> <ClInclude Include="BuildingActor.h" />
<ClInclude Include="BuildingContainer.h" /> <ClInclude Include="BuildingContainer.h" />
<ClInclude Include="BuildingGameplayActor.h" />
<ClInclude Include="BuildingSMActor.h" /> <ClInclude Include="BuildingSMActor.h" />
<ClInclude Include="BuildingTrap.h" /> <ClInclude Include="BuildingTrap.h" />
<ClInclude Include="calendar.h" /> <ClInclude Include="calendar.h" />
@@ -235,6 +239,7 @@
<ClInclude Include="events.h" /> <ClInclude Include="events.h" />
<ClInclude Include="finder.h" /> <ClInclude Include="finder.h" />
<ClInclude Include="FortAthenaCreativePortal.h" /> <ClInclude Include="FortAthenaCreativePortal.h" />
<ClInclude Include="FortAthenaSupplyDrop.h" />
<ClInclude Include="FortDecoItemDefinition.h" /> <ClInclude Include="FortDecoItemDefinition.h" />
<ClInclude Include="FortGameMode.h" /> <ClInclude Include="FortGameMode.h" />
<ClInclude Include="FortGameModeAthena.h" /> <ClInclude Include="FortGameModeAthena.h" />
@@ -246,6 +251,7 @@
<ClInclude Include="FortItemDefinition.h" /> <ClInclude Include="FortItemDefinition.h" />
<ClInclude Include="FortKismetLibrary.h" /> <ClInclude Include="FortKismetLibrary.h" />
<ClInclude Include="FortLootPackage.h" /> <ClInclude Include="FortLootPackage.h" />
<ClInclude Include="FortMinigame.h" />
<ClInclude Include="FortPawn.h" /> <ClInclude Include="FortPawn.h" />
<ClInclude Include="FortPickup.h" /> <ClInclude Include="FortPickup.h" />
<ClInclude Include="FortPlayerController.h" /> <ClInclude Include="FortPlayerController.h" />

View File

@@ -131,6 +131,15 @@
<ClCompile Include="BuildingTrap.cpp"> <ClCompile Include="BuildingTrap.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortAthenaCreativePortal.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Creative</Filter>
</ClCompile>
<ClCompile Include="FortAthenaSupplyDrop.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Building\GameplayActors</Filter>
</ClCompile>
<ClCompile Include="FortMinigame.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Creative\Minigame</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
@@ -410,6 +419,15 @@
<ClInclude Include="commands.h"> <ClInclude Include="commands.h">
<Filter>Reboot</Filter> <Filter>Reboot</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FortAthenaSupplyDrop.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building\GameplayActors</Filter>
</ClInclude>
<ClInclude Include="BuildingGameplayActor.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building</Filter>
</ClInclude>
<ClInclude Include="FortMinigame.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Creative\Minigame</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">
@@ -577,6 +595,21 @@
<Filter Include="FortniteGame\Source\FortniteGame\Public\Creative"> <Filter Include="FortniteGame\Source\FortniteGame\Public\Creative">
<UniqueIdentifier>{51b57917-fec7-41b7-bdc8-ad284a5385a4}</UniqueIdentifier> <UniqueIdentifier>{51b57917-fec7-41b7-bdc8-ad284a5385a4}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Creative">
<UniqueIdentifier>{d48c31c9-7283-4102-b951-dc0165e91836}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Building\GameplayActors">
<UniqueIdentifier>{ec38a50b-6bc9-440b-adf1-2291094b700f}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Building\GameplayActors">
<UniqueIdentifier>{18a41ed2-b864-4a36-9396-cb0672b8464d}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Creative\Minigame">
<UniqueIdentifier>{a28fab04-cc3c-4032-ac3e-22c6b9379312}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Creative\Minigame">
<UniqueIdentifier>{7905895d-5ebf-4313-a9de-06f507c35113}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="UnrealEngine.cpp"> <None Include="UnrealEngine.cpp">

View File

@@ -24,6 +24,8 @@ inline void SendMessageToConsole(AFortPlayerController* PlayerController, const
FName TypeName = FName(); // auto set to "Event" FName TypeName = FName(); // auto set to "Event"
// PlayerController->ClientMessage(Msg, TypeName, MsgLifetime); // PlayerController->ClientMessage(Msg, TypeName, MsgLifetime);
auto brah = Msg.ToString();
LOG_INFO(LogDev, "{}", brah);
} }
void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
@@ -182,6 +184,29 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
SendMessageToConsole(PlayerController, L"Granted item!"); SendMessageToConsole(PlayerController, L"Granted item!");
} }
else if (Command == "testspawn")
{
auto Pawn = Cast<APawn>(ReceivingController->GetPawn());
if (!Pawn)
{
SendMessageToConsole(PlayerController, L"No pawn to teleport!");
return;
}
auto Class = FindObject<UClass>("/Game/Athena/Items/Gameplay/MinigameSettingsControl/MinigameSettingsMachine.MinigameSettingsMachine_C");
if (!Class)
{
SendMessageToConsole(PlayerController, L"Failed to find Class!");
return;
}
auto PawnLocation = Pawn->GetActorLocation();
PawnLocation.Z += 250;
GetWorld()->SpawnActor<AActor>(Class, PawnLocation);
SendMessageToConsole(PlayerController, L"Spawned!");
}
else if (Command == "bugitgo") else if (Command == "bugitgo")
{ {
if (Arguments.size() <= 3) if (Arguments.size() <= 3)

View File

@@ -18,7 +18,10 @@
#include "vehicles.h" #include "vehicles.h"
#include "UObjectArray.h" #include "UObjectArray.h"
#include "BuildingTrap.h" #include "BuildingTrap.h"
#include "FortAthenaCreativePortal.h"
#include "commands.h" #include "commands.h"
#include "FortAthenaSupplyDrop.h"
#include "FortMinigame.h"
enum ENetMode enum ENetMode
{ {
@@ -194,12 +197,13 @@ DWORD WINAPI Main(LPVOID)
AFortPlayerController::ServerEndEditingBuildingActorHook, nullptr, false); AFortPlayerController::ServerEndEditingBuildingActorHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"),
AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessage, nullptr, false); AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessage, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"),
AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false);
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 (Addresses::FrameStep) // put all exec hooks in this scope
if (Addresses::FrameStep)
{ {
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);
@@ -213,6 +217,23 @@ DWORD WINAPI Main(LPVOID)
UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true); UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true);
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_SpawnPickupInWorld"), Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_SpawnPickupInWorld"),
UFortKismetLibrary::K2_SpawnPickupInWorldHook, (PVOID*)&UFortKismetLibrary::K2_SpawnPickupInWorldOriginal, false, true); UFortKismetLibrary::K2_SpawnPickupInWorldHook, (PVOID*)&UFortKismetLibrary::K2_SpawnPickupInWorldOriginal, false, true);
static auto FortAthenaSupplyDropDefault = FindObject("/Script/FortniteGame.Default__FortAthenaSupplyDrop");
Hooking::MinHook::Hook(FortAthenaSupplyDropDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaSupplyDrop.SpawnPickup"),
AFortAthenaSupplyDrop::SpawnPickupHook, (PVOID*)&AFortAthenaSupplyDrop::SpawnPickupOriginal, false, true);
static auto FortAthenaCreativePortalDefault = FindObject("/Script/FortniteGame.Default__FortAthenaCreativePortal");
Hooking::MinHook::Hook(FortAthenaCreativePortalDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaCreativePortal.TeleportPlayerToLinkedVolume"),
AFortAthenaCreativePortal::TeleportPlayerToLinkedVolumeHook, (PVOID*)&AFortAthenaCreativePortal::TeleportPlayerToLinkedVolumeOriginal, false, true);
Hooking::MinHook::Hook(FortAthenaCreativePortalDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaCreativePortal.TeleportPlayer"),
AFortAthenaCreativePortal::TeleportPlayerHook, (PVOID*)&AFortAthenaCreativePortal::TeleportPlayerOriginal, false, true);
static auto FortMinigameDefault = FindObject("/Script/FortniteGame.Default__FortMinigame");
Hooking::MinHook::Hook(FortMinigameDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortMinigame.ClearPlayerInventory"),
AFortMinigame::ClearPlayerInventoryHook, (PVOID*)&AFortMinigame::ClearPlayerInventoryOriginal, false, true);
} }
static auto ServerHandlePickupInfoFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerPawn.ServerHandlePickupInfo"); static auto ServerHandlePickupInfoFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerPawn.ServerHandlePickupInfo");

View File

@@ -659,6 +659,10 @@ static inline uint64 FindInternalTryActivateAbility()
static inline uint64 FindFrameStep() static inline uint64 FindFrameStep()
{ {
return Memcury::Scanner::FindPattern("48 8B 41 20 4C 8B D2 48 8B D1 44 0F B6 08 48 FF").Get();
if (Engine_Version == 423)
return Memcury::Scanner::FindPattern("48 8B 41 20 4C 8B D2 48 8B D1 44 0F B6 08 48 FF").Get();
if (Engine_Version == 426) 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 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();

View File

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

View File

@@ -109,7 +109,7 @@ static inline void SpawnVehicles()
{ {
auto VehicleSpawner = (AllVehicleSpawners.at(i)); auto VehicleSpawner = (AllVehicleSpawners.at(i));
static auto FortVehicleItemDefVariantsOffset = VehicleSpawner->GetOffset("FortVehicleItemDefVariants"); static auto FortVehicleItemDefVariantsOffset = VehicleSpawner->GetOffset("FortVehicleItemDefVariants", false);
bool aa = true; bool aa = true;