diff --git a/Project Reboot 3.0/FortServerBotManagerAthena.cpp b/Project Reboot 3.0/FortServerBotManagerAthena.cpp index a6be9fe..d284797 100644 --- a/Project Reboot 3.0/FortServerBotManagerAthena.cpp +++ b/Project Reboot 3.0/FortServerBotManagerAthena.cpp @@ -1,10 +1,22 @@ #include "FortServerBotManagerAthena.h" #include "bots.h" +#include "ai.h" +#include "finder.h" AFortPlayerPawnAthena* UFortServerBotManagerAthena::SpawnBotHook(UFortServerBotManagerAthena* BotManager, FVector& InSpawnLocation, FRotator& InSpawnRotation, - UFortAthenaAIBotCustomizationData* InBotData, FFortAthenaAIBotRunTimeCustomizationData* InRuntimeBotData) + UFortAthenaAIBotCustomizationData* InBotData, FFortAthenaAIBotRunTimeCustomizationData& InRuntimeBotData) { LOG_INFO(LogBots, "SpawnBotHook!"); - return nullptr; + if (__int64(_ReturnAddress()) == SpawnBotRet()) { + return SpawnBotOriginal(BotManager, InSpawnLocation, InSpawnRotation, InBotData, InRuntimeBotData); + } + + AActor* SpawnLocator = GetWorld()->SpawnActor(APawn::StaticClass(), InSpawnLocation, InSpawnRotation.Quaternion()); + auto PawnClass = InBotData->Get(InBotData->GetOffset("PawnClass")); + auto Pawn = BotMutator->SpawnBot(PawnClass , SpawnLocator, InSpawnLocation, InSpawnRotation, true); + + Pawn->TeleportTo(InSpawnLocation, InSpawnRotation);//idfk???? + + return Pawn; } \ No newline at end of file diff --git a/Project Reboot 3.0/FortServerBotManagerAthena.h b/Project Reboot 3.0/FortServerBotManagerAthena.h index 121595f..42f4887 100644 --- a/Project Reboot 3.0/FortServerBotManagerAthena.h +++ b/Project Reboot 3.0/FortServerBotManagerAthena.h @@ -15,7 +15,7 @@ static inline void (*BotManagerSetupStuffIdk)(__int64 BotManaager, __int64 Pawn, class UFortServerBotManagerAthena : public UObject { public: - static inline AFortPlayerPawnAthena* (*SpawnBotOriginal)(UFortServerBotManagerAthena* BotManager, FVector InSpawnLocation, FRotator InSpawnRotation, UFortAthenaAIBotCustomizationData* InBotData, FFortAthenaAIBotRunTimeCustomizationData InRuntimeBotData); + static inline AFortPlayerPawnAthena* (*SpawnBotOriginal)(UFortServerBotManagerAthena* BotManager, FVector InSpawnLocation, FRotator InSpawnRotation, UFortAthenaAIBotCustomizationData* InBotData, FFortAthenaAIBotRunTimeCustomizationData& InRuntimeBotData); AFortAthenaMutator_Bots*& GetCachedBotMutator() { @@ -23,5 +23,5 @@ public: return Get(CachedBotMutatorOffset); } - static AFortPlayerPawnAthena* SpawnBotHook(UFortServerBotManagerAthena* BotManager, FVector& InSpawnLocation, FRotator& InSpawnRotation, UFortAthenaAIBotCustomizationData* InBotData, FFortAthenaAIBotRunTimeCustomizationData* InRuntimeBotData); + static AFortPlayerPawnAthena* SpawnBotHook(UFortServerBotManagerAthena* BotManager, FVector& InSpawnLocation, FRotator& InSpawnRotation, UFortAthenaAIBotCustomizationData* InBotData, FFortAthenaAIBotRunTimeCustomizationData& InRuntimeBotData); }; \ No newline at end of file diff --git a/Project Reboot 3.0/ai.h b/Project Reboot 3.0/ai.h index 5892a94..51c340f 100644 --- a/Project Reboot 3.0/ai.h +++ b/Project Reboot 3.0/ai.h @@ -21,6 +21,7 @@ using UNavigationSystemConfig = UObject; using AAthenaNavSystemConfigOverride = UObject; using UAthenaNavSystem = UObject; using UAthenaNavSystemConfig = UObject; +inline AFortAthenaMutator_Bots* BotMutator = nullptr; enum class EFNavigationSystemRunMode : uint8_t { @@ -111,14 +112,14 @@ static inline AFortAthenaMutator_Bots* SpawnBotMutator() //sets up all the class auto GameMode = Cast(GetWorld()->GetGameMode()); static auto BGAClass = FindObject(L"/Script/Engine.BlueprintGeneratedClass"); - auto PhoebeMutatorClass = LoadObject(L"/Game/Athena/AI/Phoebe/BP_Phoebe_Mutator.BP_Phoebe_Mutator_C", BGAClass); + //auto PhoebeMutatorClass = LoadObject(L"/Game/Athena/AI/Phoebe/BP_Phoebe_Mutator.BP_Phoebe_Mutator_C", BGAClass); - if (!PhoebeMutatorClass) + if (!AFortAthenaMutator_Bots::StaticClass()) { return nullptr; } - auto BotMutator = GetWorld()->SpawnActor(PhoebeMutatorClass); + BotMutator = GetWorld()->SpawnActor(AFortAthenaMutator_Bots::StaticClass()); if (!BotMutator) { diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index bbf62d2..aab1c25 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -1308,8 +1308,11 @@ DWORD WINAPI Main(LPVOID) (PVOID*)&AFortGameModeAthena::OnAircraftEnteredDropZoneOriginal, false, false, true, true); } - // Hooking::MinHook::Hook(FindObject(L"/Script/FortniteGame.Default__FortServerBotManagerAthena"), FindObject(L"/Script/FortniteGame.FortServerBotManagerAthena.SpawnBot"), - // UFortServerBotManagerAthena::SpawnBotHook, (PVOID*)&UFortServerBotManagerAthena::SpawnBotOriginal, false); + if (Fortnite_Version >= 12 && Fortnite_Version <= 13) // you cant spawn bosses using spawnbot on s14 and above + { + Hooking::MinHook::Hook(FindObject(L"/Script/FortniteGame.Default__FortServerBotManagerAthena"), FindObject(L"/Script/FortniteGame.FortServerBotManagerAthena.SpawnBot"), + UFortServerBotManagerAthena::SpawnBotHook, (PVOID*)&UFortServerBotManagerAthena::SpawnBotOriginal, false); + } Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 6a55b7e..0a90299 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -2053,3 +2053,18 @@ static inline uint64 FindClearAbility() return 0; } + +static inline uint64 SpawnBotRet() +{ + auto String = Memcury::Scanner::FindStringRef(L"Unable to create UFortAthenaAIBotCustomizationData object. BotClass = %s", true, 0, false).Get(); + + for (int i = 0; i < 1000; i++) + { + if (*(uint8_t*)(String + i) == 0x48 && *(uint8_t*)(String + i + 1) == 0x8b && *(uint8_t*)(String + i + 2) == 0xd8) + { + return String + i; + } + } + + return 0; +}