init bosses

This commit is contained in:
Marvelco
2025-08-07 18:27:56 +03:00
parent a2afb47cfa
commit 3dbb83a96f
5 changed files with 40 additions and 9 deletions

View File

@@ -1,10 +1,22 @@
#include "FortServerBotManagerAthena.h" #include "FortServerBotManagerAthena.h"
#include "bots.h" #include "bots.h"
#include "ai.h"
#include "finder.h"
AFortPlayerPawnAthena* UFortServerBotManagerAthena::SpawnBotHook(UFortServerBotManagerAthena* BotManager, FVector& InSpawnLocation, FRotator& InSpawnRotation, AFortPlayerPawnAthena* UFortServerBotManagerAthena::SpawnBotHook(UFortServerBotManagerAthena* BotManager, FVector& InSpawnLocation, FRotator& InSpawnRotation,
UFortAthenaAIBotCustomizationData* InBotData, FFortAthenaAIBotRunTimeCustomizationData* InRuntimeBotData) UFortAthenaAIBotCustomizationData* InBotData, FFortAthenaAIBotRunTimeCustomizationData& InRuntimeBotData)
{ {
LOG_INFO(LogBots, "SpawnBotHook!"); LOG_INFO(LogBots, "SpawnBotHook!");
return nullptr; if (__int64(_ReturnAddress()) == SpawnBotRet()) {
return SpawnBotOriginal(BotManager, InSpawnLocation, InSpawnRotation, InBotData, InRuntimeBotData);
}
AActor* SpawnLocator = GetWorld()->SpawnActor<APawn>(APawn::StaticClass(), InSpawnLocation, InSpawnRotation.Quaternion());
auto PawnClass = InBotData->Get<UClass*>(InBotData->GetOffset("PawnClass"));
auto Pawn = BotMutator->SpawnBot(PawnClass , SpawnLocator, InSpawnLocation, InSpawnRotation, true);
Pawn->TeleportTo(InSpawnLocation, InSpawnRotation);//idfk????
return Pawn;
} }

View File

@@ -15,7 +15,7 @@ static inline void (*BotManagerSetupStuffIdk)(__int64 BotManaager, __int64 Pawn,
class UFortServerBotManagerAthena : public UObject class UFortServerBotManagerAthena : public UObject
{ {
public: 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() AFortAthenaMutator_Bots*& GetCachedBotMutator()
{ {
@@ -23,5 +23,5 @@ public:
return Get<AFortAthenaMutator_Bots*>(CachedBotMutatorOffset); return Get<AFortAthenaMutator_Bots*>(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);
}; };

View File

@@ -21,6 +21,7 @@ using UNavigationSystemConfig = UObject;
using AAthenaNavSystemConfigOverride = UObject; using AAthenaNavSystemConfigOverride = UObject;
using UAthenaNavSystem = UObject; using UAthenaNavSystem = UObject;
using UAthenaNavSystemConfig = UObject; using UAthenaNavSystemConfig = UObject;
inline AFortAthenaMutator_Bots* BotMutator = nullptr;
enum class EFNavigationSystemRunMode : uint8_t enum class EFNavigationSystemRunMode : uint8_t
{ {
@@ -111,14 +112,14 @@ static inline AFortAthenaMutator_Bots* SpawnBotMutator() //sets up all the class
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode()); auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
static auto BGAClass = FindObject<UClass>(L"/Script/Engine.BlueprintGeneratedClass"); static auto BGAClass = FindObject<UClass>(L"/Script/Engine.BlueprintGeneratedClass");
auto PhoebeMutatorClass = LoadObject<UClass>(L"/Game/Athena/AI/Phoebe/BP_Phoebe_Mutator.BP_Phoebe_Mutator_C", BGAClass); //auto PhoebeMutatorClass = LoadObject<UClass>(L"/Game/Athena/AI/Phoebe/BP_Phoebe_Mutator.BP_Phoebe_Mutator_C", BGAClass);
if (!PhoebeMutatorClass) if (!AFortAthenaMutator_Bots::StaticClass())
{ {
return nullptr; return nullptr;
} }
auto BotMutator = GetWorld()->SpawnActor<AFortAthenaMutator_Bots>(PhoebeMutatorClass); BotMutator = GetWorld()->SpawnActor<AFortAthenaMutator_Bots>(AFortAthenaMutator_Bots::StaticClass());
if (!BotMutator) if (!BotMutator)
{ {

View File

@@ -1308,8 +1308,11 @@ DWORD WINAPI Main(LPVOID)
(PVOID*)&AFortGameModeAthena::OnAircraftEnteredDropZoneOriginal, false, false, true, true); (PVOID*)&AFortGameModeAthena::OnAircraftEnteredDropZoneOriginal, false, false, true, true);
} }
// Hooking::MinHook::Hook(FindObject<UFortServerBotManagerAthena>(L"/Script/FortniteGame.Default__FortServerBotManagerAthena"), FindObject<UFunction>(L"/Script/FortniteGame.FortServerBotManagerAthena.SpawnBot"), if (Fortnite_Version >= 12 && Fortnite_Version <= 13) // you cant spawn bosses using spawnbot on s14 and above
// UFortServerBotManagerAthena::SpawnBotHook, (PVOID*)&UFortServerBotManagerAthena::SpawnBotOriginal, false); {
Hooking::MinHook::Hook(FindObject<UFortServerBotManagerAthena>(L"/Script/FortniteGame.Default__FortServerBotManagerAthena"), FindObject<UFunction>(L"/Script/FortniteGame.FortServerBotManagerAthena.SpawnBot"),
UFortServerBotManagerAthena::SpawnBotHook, (PVOID*)&UFortServerBotManagerAthena::SpawnBotOriginal, false);
}
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"),
AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); AGameModeBase::SpawnDefaultPawnForHook, nullptr, false);

View File

@@ -2053,3 +2053,18 @@ static inline uint64 FindClearAbility()
return 0; 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;
}