Merge pull request #226 from MarvelcoOGFN/master

addes skins and names to bosses
This commit is contained in:
Gray
2025-08-08 21:48:16 -04:00
committed by GitHub
7 changed files with 82 additions and 10 deletions

View File

@@ -1,10 +1,60 @@
#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);
auto PC = Pawn->GetController();
auto PlayerState = Pawn->GetPlayerState();
auto BotNameSettings = InBotData->Get<UFortBotNameSettings*>(InBotData->GetOffset("BotNameSettings"));
Pawn->TeleportTo(InSpawnLocation, InSpawnRotation);//idfk????
auto SkinOverRide = InBotData->GetCharacterCustomization()->GetCustomizationLoadout()->GetCharacter();
if (SkinOverRide->GetName() == "CID_556_Athena_Commando_F_RebirthDefaultA")
{
if (InBotData->GetFullName().contains("Alter"))
{
SkinOverRide = LoadObject<UFortItemDefinition>("/Game/Athena/Items/Cosmetics/Characters/CID_NPC_Athena_Commando_M_HenchmanBad.CID_NPC_Athena_Commando_M_HenchmanBad");
}
else if (InBotData->GetFullName().contains("Ego"))
{
SkinOverRide = LoadObject<UFortItemDefinition>("/Game/Athena/Items/Cosmetics/Characters/CID_NPC_Athena_Commando_M_HenchmanGood.CID_NPC_Athena_Commando_M_HenchmanGood");
}
else if (InBotData->GetFullName().contains("Box")) //s13
{
SkinOverRide = LoadObject<UFortItemDefinition>("/Game/Athena/Items/Cosmetics/Characters/CID_NPC_Athena_Commando_M_Scrapyard.CID_NPC_Athena_Commando_M_Scrapyard");
}
}
else
{
if (InBotData->GetFullName().contains("Yatch") && Fortnite_Version >= 12.30 && Fortnite_Version <= 12.61)
{
SkinOverRide = LoadObject<UFortItemDefinition>("/Game/Athena/AI/MANG/BotData/BotData_MANG_POI_HDP.BotData_MANG_POI_HDP");
}
else
{
SkinOverRide = InBotData->GetCharacterCustomization()->GetCustomizationLoadout()->GetCharacter();
}
}
auto HeroDefinition = SkinOverRide->Get(SkinOverRide->GetOffset("HeroDefinition"));
ApplyHID(Pawn, HeroDefinition, true);
FString OverrideName = UKismetTextLibrary::Conv_TextToString(BotNameSettings->GetOverrideName());
*reinterpret_cast<FString*>(__int64(PlayerState) + PlayerState->GetOffset("PlayerNamePrivate")) = OverrideName;
PC->GetPlayerState()->OnRep_PlayerName();
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

@@ -69,6 +69,7 @@ static inline void InitBotNames()
PlayerBotNames.push_back(L"AllyJax"); PlayerBotNames.push_back(L"AllyJax");
PlayerBotNames.push_back(L"secret_pommes"); PlayerBotNames.push_back(L"secret_pommes");
PlayerBotNames.push_back(L"Twin1"); PlayerBotNames.push_back(L"Twin1");
PlayerBotNames.push_back(L"Marvelco");
std::shuffle(PlayerBotNames.begin(), PlayerBotNames.end(), std::default_random_engine((unsigned int)time(0))); std::shuffle(PlayerBotNames.begin(), PlayerBotNames.end(), std::default_random_engine((unsigned int)time(0)));
} }

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.00 && Fortnite_Version <= 13.40) // 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;
}

View File

@@ -1564,7 +1564,9 @@ static inline DWORD WINAPI GuiThread(LPVOID)
{ {
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"RebootClass", NULL }; WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"RebootClass", NULL };
::RegisterClassEx(&wc); ::RegisterClassEx(&wc);
HWND hwnd = ::CreateWindowExW(0L, wc.lpszClassName, (L"Project Reboot " + std::to_wstring(Fortnite_Version)).c_str(), (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX), 100, 100, Width, Height, NULL, NULL, wc.hInstance, NULL);
HWND hwnd = ::CreateWindowExW(0L,wc.lpszClassName,(L"Project Reboot " + ([](double v) { std::wstringstream ss; ss << std::fixed << std::setprecision(2) << v; return ss.str(); })(Fortnite_Version)).c_str(),(WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX), 100, 100, Width, Height, NULL, NULL, wc.hInstance, NULL);
if (hwnd == NULL) if (hwnd == NULL)
{ {