diff --git a/Project Reboot 3.0/BuildingGameplayActor.h b/Project Reboot 3.0/BuildingGameplayActor.h new file mode 100644 index 0000000..8cb62fa --- /dev/null +++ b/Project Reboot 3.0/BuildingGameplayActor.h @@ -0,0 +1,8 @@ +#pragma once + +#include "BuildingActor.h" + +class ABuildingGameplayActor : public ABuildingActor +{ +public: +}; \ No newline at end of file diff --git a/Project Reboot 3.0/FortAthenaCreativePortal.cpp b/Project Reboot 3.0/FortAthenaCreativePortal.cpp new file mode 100644 index 0000000..73ecc82 --- /dev/null +++ b/Project Reboot 3.0/FortAthenaCreativePortal.cpp @@ -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(bReturnToCreativeHubOffset); + + LOG_INFO(LogDev, "bReturnToCreativeHub: {}", bReturnToCreativeHub); + + if (bReturnToCreativeHub) + { + auto Controller = Cast(PlayerPawn->GetController()); + + if (!Controller) + return TeleportPlayerOriginal(Context, Stack, Ret); + + AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook(Controller); + } + else + { + static auto TeleportLocationOffset = Portal->GetOffset("TeleportLocation"); + auto& TeleportLocation = Portal->Get(TeleportLocationOffset); + PlayerPawn->TeleportTo(TeleportLocation, TeleportRotation); + } + + return TeleportPlayerOriginal(Context, Stack, Ret); +} \ No newline at end of file diff --git a/Project Reboot 3.0/FortAthenaCreativePortal.h b/Project Reboot 3.0/FortAthenaCreativePortal.h index 0cdf5c1..248e554 100644 --- a/Project Reboot 3.0/FortAthenaCreativePortal.h +++ b/Project Reboot 3.0/FortAthenaCreativePortal.h @@ -1,6 +1,8 @@ #pragma once #include "BuildingActor.h" +#include "FortVolume.h" +#include "Stack.h" struct FCreativeLoadedLinkData { @@ -10,6 +12,9 @@ struct FCreativeLoadedLinkData class AFortAthenaCreativePortal : public ABuildingActor // ABuildingGameplayActor { public: + static inline void (*TeleportPlayerToLinkedVolumeOriginal)(UObject* Context, FFrame& Stack, void* Ret); + static inline void (*TeleportPlayerOriginal)(UObject* Context, FFrame& Stack, void* Ret); + FCreativeLoadedLinkData* GetIslandInfo() { static auto CreativeLoadedLinkDataStruct = FindObject("/Script/FortniteGame.CreativeLoadedLinkData"); @@ -23,7 +28,11 @@ public: void* GetOwningPlayer() { - static auto OwningPlayerOffset = GetOffset("OwningPlayer"); + static auto OwningPlayerOffset = GetOffset("OwningPlayer", false); + + if (OwningPlayerOffset == 0) + return nullptr; + return GetPtr(OwningPlayerOffset); } @@ -63,4 +72,8 @@ public: static auto CreatorNameOffset = FindOffsetStruct("/Script/FortniteGame.CreativeLoadedLinkData", "CreatorName"); 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 }; \ No newline at end of file diff --git a/Project Reboot 3.0/FortAthenaSupplyDrop.cpp b/Project Reboot 3.0/FortAthenaSupplyDrop.cpp new file mode 100644 index 0000000..1a680d6 --- /dev/null +++ b/Project Reboot 3.0/FortAthenaSupplyDrop.cpp @@ -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; +} \ No newline at end of file diff --git a/Project Reboot 3.0/FortAthenaSupplyDrop.h b/Project Reboot 3.0/FortAthenaSupplyDrop.h new file mode 100644 index 0000000..ff19ae7 --- /dev/null +++ b/Project Reboot 3.0/FortAthenaSupplyDrop.h @@ -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); +}; \ No newline at end of file diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 479f355..e6abc6c 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -458,15 +458,18 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game } } - static auto FortPlayerStartWarmupClass = FindObject("/Script/FortniteGame.FortPlayerStartWarmup"); - TArray Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartWarmupClass); + if (!Globals::bCreative) + { + static auto FortPlayerStartWarmupClass = FindObject("/Script/FortniteGame.FortPlayerStartWarmup"); + TArray Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartWarmupClass); - int ActorsNum = Actors.Num(); + int ActorsNum = Actors.Num(); - Actors.Free(); + Actors.Free(); - if (ActorsNum == 0) - return false; + if (ActorsNum == 0) + return false; + } 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) { @@ -835,12 +838,20 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena if (AvailablePortalsOffset != 0) { auto& AvailablePortals = CreativePortalManager->Get>(AvailablePortalsOffset); - Portal = (AFortAthenaCreativePortal*)AvailablePortals.at(0); - AvailablePortals.Remove(0); - static auto UsedPortalsOffset = CreativePortalManager->GetOffset("UsedPortals"); - auto& UsedPortals = CreativePortalManager->Get>(UsedPortalsOffset); - UsedPortals.Add(Portal); + if (AvailablePortals.Num() > 0) + { + Portal = (AFortAthenaCreativePortal*)AvailablePortals.at(0); + AvailablePortals.Remove(0); + + static auto UsedPortalsOffset = CreativePortalManager->GetOffset("UsedPortals"); + auto& UsedPortals = CreativePortalManager->Get>(UsedPortalsOffset); + UsedPortals.Add(Portal); + } + else + { + LOG_WARN(LogCreative, "AvaliablePortals size is 0!"); + } } else { @@ -863,12 +874,20 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena { // Portal->GetCreatorName() = PlayerStateAthena->GetPlayerName(); - *(FUniqueNetIdReplExperimental*)Portal->GetOwningPlayer() = PlayerStateUniqueId; + auto OwningPlayer = Portal->GetOwningPlayer(); + + if (OwningPlayer != nullptr) + *(FUniqueNetIdReplExperimental*)OwningPlayer = PlayerStateUniqueId; + Portal->GetPortalOpen() = true; static auto PlayersReadyOffset = Portal->GetOffset("PlayersReady"); - auto& PlayersReady = Portal->Get>(PlayersReadyOffset); - PlayersReady.Add(PlayerStateUniqueId); + + if (PlayersReadyOffset != 0) + { + auto& PlayersReady = Portal->Get>(PlayersReadyOffset); + PlayersReady.Add(PlayerStateUniqueId); + } Portal->GetUserInitiatedLoad() = true; Portal->GetInErrorState() = false; diff --git a/Project Reboot 3.0/FortInventory.cpp b/Project Reboot 3.0/FortInventory.cpp index 7b2dba6..fff4fcd 100644 --- a/Project Reboot 3.0/FortInventory.cpp +++ b/Project Reboot 3.0/FortInventory.cpp @@ -14,6 +14,9 @@ UFortItem* CreateItemInstance(AFortPlayerController* PlayerController, UFortItem std::pair, std::vector> AFortInventory::AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count, int LoadedAmmo, bool bShouldAddToStateValues) { + if (!ItemDefinition) + return std::pair, std::vector>(); + if (bShouldUpdate) *bShouldUpdate = false; @@ -225,6 +228,23 @@ void AFortInventory::ModifyCount(UFortItem* ItemInstance, int New, bool bRemove, } } +UFortItem* AFortInventory::GetPickaxeInstance() +{ + static auto FortWeaponMeleeItemDefinitionClass = FindObject("/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) { auto& ItemInstances = GetItemList().GetItemInstances(); diff --git a/Project Reboot 3.0/FortInventory.h b/Project Reboot 3.0/FortInventory.h index 6252a55..e353e85 100644 --- a/Project Reboot 3.0/FortInventory.h +++ b/Project Reboot 3.0/FortInventory.h @@ -95,6 +95,7 @@ public: bool RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count); void ModifyCount(UFortItem* ItemInstance, int New, bool bRemove = false, std::pair* outEntries = nullptr, bool bUpdate = true); + UFortItem* GetPickaxeInstance(); UFortItem* FindItemInstance(UFortItemDefinition* ItemDefinition); UFortItem* FindItemInstance(const FGuid& Guid); diff --git a/Project Reboot 3.0/FortKismetLibrary.cpp b/Project Reboot 3.0/FortKismetLibrary.cpp index 354271e..c0cd096 100644 --- a/Project Reboot 3.0/FortKismetLibrary.cpp +++ b/Project Reboot 3.0/FortKismetLibrary.cpp @@ -283,6 +283,11 @@ AFortPickup* UFortKismetLibrary::K2_SpawnPickupInWorldHook(UObject* Context, FFr return *Ret; } +bool UFortKismetLibrary::PickLootDropsHook(UObject* Context, FFrame& Stack, bool* Ret) +{ + return PickLootDropsOriginal(Context, Stack, Ret); +} + UClass* UFortKismetLibrary::StaticClass() { static auto ptr = FindObject(L"/Script/FortniteGame.FortKismetLibrary"); diff --git a/Project Reboot 3.0/FortKismetLibrary.h b/Project Reboot 3.0/FortKismetLibrary.h index 7129c43..ab34a1e 100644 --- a/Project Reboot 3.0/FortKismetLibrary.h +++ b/Project Reboot 3.0/FortKismetLibrary.h @@ -18,6 +18,7 @@ public: static inline void (*GiveItemToInventoryOwnerOriginal)(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 bool (*PickLootDropsOriginal)(UObject* Context, FFrame& Stack, bool* Ret); static UFortResourceItemDefinition* K2_GetResourceItemDefinition(EFortResourceType ResourceType); static void ApplyCharacterCosmetics(UObject* WorldContextObject, const TArray& CharacterParts, UObject* PlayerState, bool* bSuccess); @@ -28,6 +29,7 @@ public: static void K2_GiveItemToPlayerHook(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 bool PickLootDropsHook(UObject* Context, FFrame& Stack, bool* Ret); static UClass* StaticClass(); }; \ No newline at end of file diff --git a/Project Reboot 3.0/FortMinigame.cpp b/Project Reboot 3.0/FortMinigame.cpp new file mode 100644 index 0000000..88ef0f0 --- /dev/null +++ b/Project Reboot 3.0/FortMinigame.cpp @@ -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); +} \ No newline at end of file diff --git a/Project Reboot 3.0/FortMinigame.h b/Project Reboot 3.0/FortMinigame.h new file mode 100644 index 0000000..342e7d6 --- /dev/null +++ b/Project Reboot 3.0/FortMinigame.h @@ -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); +}; \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.cpp b/Project Reboot 3.0/FortPlayerControllerAthena.cpp index 8b9fe2c..1878ea4 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.cpp +++ b/Project Reboot 3.0/FortPlayerControllerAthena.cpp @@ -4,6 +4,7 @@ #include "SoftObjectPtr.h" #include "globals.h" +#include "GameplayStatics.h" 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("/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(PlayerStartTagsOffset).Contains("Playground.LobbyIsland.Spawn"); + + if (!bHasSpawnTag) + continue; + + Pawn->TeleportTo(CurrentPlayerStart->GetActorLocation(), Pawn->GetActorRotation()); + } + + AllCreativePlayerStarts.Free(); +} + void AFortPlayerControllerAthena::ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn) { static auto AcknowledgedPawnOffset = Controller->GetOffset("AcknowledgedPawn"); diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.h b/Project Reboot 3.0/FortPlayerControllerAthena.h index e3f28dd..32e0617 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.h +++ b/Project Reboot 3.0/FortPlayerControllerAthena.h @@ -13,6 +13,7 @@ public: return (AFortPlayerStateAthena*)GetPlayerState(); } + static void ServerTeleportToPlaygroundLobbyIslandHook(AFortPlayerControllerAthena* Controller); static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn); static void ServerPlaySquadQuickChatMessage(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID); static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation); diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index f46239a..ea43271 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -27,33 +27,36 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll { auto WorldInventory = NewPlayerAsAthena->GetWorldInventory(); - auto CosmeticLoadoutPickaxe = NewPlayerAsAthena->GetCosmeticLoadout()->GetPickaxe(); - static auto WeaponDefinitionOffset = FindOffsetStruct("/Script/FortniteGame.AthenaPickaxeItemDefinition", "WeaponDefinition"); + if (!WorldInventory->GetPickaxeInstance()) + { + auto CosmeticLoadoutPickaxe = NewPlayerAsAthena->GetCosmeticLoadout()->GetPickaxe(); + static auto WeaponDefinitionOffset = FindOffsetStruct("/Script/FortniteGame.AthenaPickaxeItemDefinition", "WeaponDefinition"); - auto Pickaxe = CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get(WeaponDefinitionOffset) - : FindObject(L"/Game/Athena/Items/Weapons/WID_Harvest_Pickaxe_Athena_C_T01.WID_Harvest_Pickaxe_Athena_C_T01"); + auto Pickaxe = CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get(WeaponDefinitionOffset) + : FindObject(L"/Game/Athena/Items/Weapons/WID_Harvest_Pickaxe_Athena_C_T01.WID_Harvest_Pickaxe_Athena_C_T01"); - static UFortItemDefinition* EditToolItemDefinition = FindObject(L"/Game/Items/Weapons/BuildingTools/EditTool.EditTool"); - static UFortItemDefinition* PickaxeDefinition = Pickaxe; - static UFortItemDefinition* BuildingItemData_Wall = FindObject(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Wall.BuildingItemData_Wall"); - static UFortItemDefinition* BuildingItemData_Floor = FindObject(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Floor.BuildingItemData_Floor"); - static UFortItemDefinition* BuildingItemData_Stair_W = FindObject(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Stair_W.BuildingItemData_Stair_W"); - static UFortItemDefinition* BuildingItemData_RoofS = FindObject(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_RoofS.BuildingItemData_RoofS"); - static UFortItemDefinition* WoodItemData = FindObject(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); - static UFortItemDefinition* DamageTrap = FindObject(L"/Game/Athena/Items/Traps/TID_ContextTrap_Athena.TID_ContextTrap_Athena"); + static UFortItemDefinition* EditToolItemDefinition = FindObject(L"/Game/Items/Weapons/BuildingTools/EditTool.EditTool"); + static UFortItemDefinition* PickaxeDefinition = Pickaxe; + static UFortItemDefinition* BuildingItemData_Wall = FindObject(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Wall.BuildingItemData_Wall"); + static UFortItemDefinition* BuildingItemData_Floor = FindObject(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Floor.BuildingItemData_Floor"); + static UFortItemDefinition* BuildingItemData_Stair_W = FindObject(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Stair_W.BuildingItemData_Stair_W"); + static UFortItemDefinition* BuildingItemData_RoofS = FindObject(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_RoofS.BuildingItemData_RoofS"); + static UFortItemDefinition* WoodItemData = FindObject(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); + static UFortItemDefinition* DamageTrap = FindObject(L"/Game/Athena/Items/Traps/TID_ContextTrap_Athena.TID_ContextTrap_Athena"); - WorldInventory->AddItem(EditToolItemDefinition, nullptr); - WorldInventory->AddItem(BuildingItemData_Wall, nullptr); - WorldInventory->AddItem(BuildingItemData_Floor, nullptr); - WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr); - WorldInventory->AddItem(BuildingItemData_RoofS, nullptr); - WorldInventory->AddItem(PickaxeDefinition, nullptr); - WorldInventory->AddItem(WoodItemData, nullptr, 100); - WorldInventory->AddItem(DamageTrap, nullptr); - // WorldInventory->AddItem(FindObject(L"/ParallelGameplay/Items/WestSausage/WID_WestSausage_Parallel.WID_WestSausage_Parallel"), nullptr, 1, 1000); - WorldInventory->AddItem(FindObject(L"/Game/Athena/Items/Consumables/HappyGhost/WID_Athena_HappyGhost.WID_Athena_HappyGhost"), nullptr); + WorldInventory->AddItem(EditToolItemDefinition, nullptr); + WorldInventory->AddItem(BuildingItemData_Wall, nullptr); + WorldInventory->AddItem(BuildingItemData_Floor, nullptr); + WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr); + WorldInventory->AddItem(BuildingItemData_RoofS, nullptr); + WorldInventory->AddItem(PickaxeDefinition, nullptr); + WorldInventory->AddItem(WoodItemData, nullptr, 100); + WorldInventory->AddItem(DamageTrap, nullptr); + // WorldInventory->AddItem(FindObject(L"/ParallelGameplay/Items/WestSausage/WID_WestSausage_Parallel.WID_WestSausage_Parallel"), nullptr, 1, 1000); + // WorldInventory->AddItem(FindObject(L"/Game/Athena/Items/Consumables/HappyGhost/WID_Athena_HappyGhost.WID_Athena_HappyGhost"), nullptr); - WorldInventory->Update(true); + WorldInventory->Update(true); + } } } diff --git a/Project Reboot 3.0/NetSerialization.h b/Project Reboot 3.0/NetSerialization.h index cc1fbea..6aac683 100644 --- a/Project Reboot 3.0/NetSerialization.h +++ b/Project Reboot 3.0/NetSerialization.h @@ -110,8 +110,8 @@ struct FFastArraySerializer void MarkArrayDirty() { - ((FFastArraySerializer2*)this)->MarkArrayDirty(); - return; + // ((FFastArraySerializer2*)this)->MarkArrayDirty(); + // return; // ItemMap.Reset(); // This allows to clients to add predictive elements to arrays without affecting replication. GetArrayReplicationKey()++; diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj b/Project Reboot 3.0/Project Reboot 3.0.vcxproj index 5b6b769..88cc6c2 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj @@ -176,6 +176,8 @@ + + @@ -187,6 +189,7 @@ + @@ -220,6 +223,7 @@ + @@ -235,6 +239,7 @@ + @@ -246,6 +251,7 @@ + diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters index cfc75e6..1239cd4 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -131,6 +131,15 @@ FortniteGame\Source\FortniteGame\Private\Building + + FortniteGame\Source\FortniteGame\Private\Creative + + + FortniteGame\Source\FortniteGame\Private\Building\GameplayActors + + + FortniteGame\Source\FortniteGame\Private\Creative\Minigame + @@ -410,6 +419,15 @@ Reboot + + FortniteGame\Source\FortniteGame\Public\Building\GameplayActors + + + FortniteGame\Source\FortniteGame\Public\Building + + + FortniteGame\Source\FortniteGame\Public\Creative\Minigame + @@ -577,6 +595,21 @@ {51b57917-fec7-41b7-bdc8-ad284a5385a4} + + {d48c31c9-7283-4102-b951-dc0165e91836} + + + {ec38a50b-6bc9-440b-adf1-2291094b700f} + + + {18a41ed2-b864-4a36-9396-cb0672b8464d} + + + {a28fab04-cc3c-4032-ac3e-22c6b9379312} + + + {7905895d-5ebf-4313-a9de-06f507c35113} + diff --git a/Project Reboot 3.0/commands.h b/Project Reboot 3.0/commands.h index 1f389c3..0e3ffbf 100644 --- a/Project Reboot 3.0/commands.h +++ b/Project Reboot 3.0/commands.h @@ -24,6 +24,8 @@ inline void SendMessageToConsole(AFortPlayerController* PlayerController, const FName TypeName = FName(); // auto set to "Event" // PlayerController->ClientMessage(Msg, TypeName, MsgLifetime); + auto brah = Msg.ToString(); + LOG_INFO(LogDev, "{}", brah); } void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) @@ -182,6 +184,29 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) SendMessageToConsole(PlayerController, L"Granted item!"); } + else if (Command == "testspawn") + { + auto Pawn = Cast(ReceivingController->GetPawn()); + + if (!Pawn) + { + SendMessageToConsole(PlayerController, L"No pawn to teleport!"); + return; + } + + auto Class = FindObject("/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(Class, PawnLocation); + SendMessageToConsole(PlayerController, L"Spawned!"); + } else if (Command == "bugitgo") { if (Arguments.size() <= 3) diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 7416340..777ad88 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -18,7 +18,10 @@ #include "vehicles.h" #include "UObjectArray.h" #include "BuildingTrap.h" +#include "FortAthenaCreativePortal.h" #include "commands.h" +#include "FortAthenaSupplyDrop.h" +#include "FortMinigame.h" enum ENetMode { @@ -194,12 +197,13 @@ DWORD WINAPI Main(LPVOID) AFortPlayerController::ServerEndEditingBuildingActorHook, nullptr, false); Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"), AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessage, nullptr, false); + Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"), + AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false); Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"), AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false); - // if (false) - if (Addresses::FrameStep) + if (Addresses::FrameStep) // put all exec hooks in this scope { Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject(L"Script/FortniteGame.FortKismetLibrary.K2_GiveItemToPlayer"), 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); Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject(L"/Script/FortniteGame.FortKismetLibrary.K2_SpawnPickupInWorld"), UFortKismetLibrary::K2_SpawnPickupInWorldHook, (PVOID*)&UFortKismetLibrary::K2_SpawnPickupInWorldOriginal, false, true); + + static auto FortAthenaSupplyDropDefault = FindObject("/Script/FortniteGame.Default__FortAthenaSupplyDrop"); + + Hooking::MinHook::Hook(FortAthenaSupplyDropDefault, FindObject(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(L"/Script/FortniteGame.FortAthenaCreativePortal.TeleportPlayerToLinkedVolume"), + AFortAthenaCreativePortal::TeleportPlayerToLinkedVolumeHook, (PVOID*)&AFortAthenaCreativePortal::TeleportPlayerToLinkedVolumeOriginal, false, true); + Hooking::MinHook::Hook(FortAthenaCreativePortalDefault, FindObject(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(L"/Script/FortniteGame.FortMinigame.ClearPlayerInventory"), + AFortMinigame::ClearPlayerInventoryHook, (PVOID*)&AFortMinigame::ClearPlayerInventoryOriginal, false, true); } static auto ServerHandlePickupInfoFn = FindObject("/Script/FortniteGame.FortPlayerPawn.ServerHandlePickupInfo"); diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index aa5d54b..f394a12 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -659,6 +659,10 @@ static inline uint64 FindInternalTryActivateAbility() 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) 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(); diff --git a/Project Reboot 3.0/globals.h b/Project Reboot 3.0/globals.h index 9c301c7..50ebbc7 100644 --- a/Project Reboot 3.0/globals.h +++ b/Project Reboot 3.0/globals.h @@ -4,7 +4,7 @@ namespace Globals { extern inline bool bCreative = false; extern inline bool bGoingToPlayEvent = false; - extern inline bool bNoMCP = true; + extern inline bool bNoMCP = false; extern inline bool bLateGame = false; extern inline bool bAbilitiesEnabled = true; } \ No newline at end of file diff --git a/Project Reboot 3.0/vehicles.h b/Project Reboot 3.0/vehicles.h index b242839..44434b7 100644 --- a/Project Reboot 3.0/vehicles.h +++ b/Project Reboot 3.0/vehicles.h @@ -109,7 +109,7 @@ static inline void SpawnVehicles() { auto VehicleSpawner = (AllVehicleSpawners.at(i)); - static auto FortVehicleItemDefVariantsOffset = VehicleSpawner->GetOffset("FortVehicleItemDefVariants"); + static auto FortVehicleItemDefVariantsOffset = VehicleSpawner->GetOffset("FortVehicleItemDefVariants", false); bool aa = true;