mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
add 2.2
code consistency, added 2.2, added cheat op and deop, proper loot tiers according to playlist, improved performance
This commit is contained in:
@@ -13,11 +13,7 @@ bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn)
|
||||
|
||||
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
|
||||
|
||||
static auto LootSpawnLocationOffset = this->GetOffset("LootSpawnLocation_Athena");
|
||||
|
||||
auto LSL = this->Get<FVector>(LootSpawnLocationOffset);
|
||||
|
||||
FVector LocationToSpawnLoot = this->GetActorLocation() + this->GetActorForwardVector() * LSL.X + this->GetActorRightVector() * LSL.Y + this->GetActorUpVector() * LSL.Z;
|
||||
FVector LocationToSpawnLoot = this->GetActorLocation() + this->GetActorForwardVector() * this->GetLootSpawnLocation_Athena().X + this->GetActorRightVector() * this->GetLootSpawnLocation_Athena().Y + this->GetActorUpVector() * this->GetLootSpawnLocation_Athena().Z;
|
||||
|
||||
static auto SearchLootTierGroupOffset = this->GetOffset("SearchLootTierGroup");
|
||||
auto RedirectedLootTier = GameMode->RedirectLootTier(this->Get<FName>(SearchLootTierGroupOffset));
|
||||
|
||||
@@ -20,6 +20,12 @@ public:
|
||||
return this->ReadBitfieldValue(bAlreadySearchedOffset, bAlreadySearchedFieldMask);
|
||||
}
|
||||
|
||||
FVector& GetLootSpawnLocation_Athena()
|
||||
{
|
||||
static auto LootSpawnLocation_AthenaOffset = this->GetOffset("LootSpawnLocation_Athena");
|
||||
return this->Get<FVector>(LootSpawnLocation_AthenaOffset);
|
||||
}
|
||||
|
||||
void SetAlreadySearched(bool bNewValue, bool bOnRep = true)
|
||||
{
|
||||
static auto bAlreadySearchedOffset = this->GetOffset("bAlreadySearched");
|
||||
|
||||
@@ -1 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
class UFortAthenaAIBotCharacterCustomization : public UObject
|
||||
{
|
||||
public:
|
||||
FFortAthenaLoadout* GetCustomizationLoadout()
|
||||
{
|
||||
static auto CustomizationLoadoutOffset = GetOffset("CustomizationLoadout");
|
||||
return GetPtr<FFortAthenaLoadout>(CustomizationLoadoutOffset);
|
||||
}
|
||||
};
|
||||
@@ -1,13 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "reboot.h"
|
||||
#include "FortAthenaAIBotCharacterCustomization.h"
|
||||
|
||||
class UFortAthenaAIBotCustomizationData : public UObject // UPrimaryDataAsset
|
||||
{
|
||||
public:
|
||||
UFortAthenaAIBotCharacterCustomization*& GetCharacterCustomization()
|
||||
{
|
||||
static auto CharacterCustomizationOffset = GetOffset("CharacterCustomization");
|
||||
return Get<UFortAthenaAIBotCharacterCustomization*>(CharacterCustomizationOffset);
|
||||
}
|
||||
|
||||
/* static void ApplyOverrideCharacterCustomizationHook(UFortAthenaAIBotCustomizationData* InBotData, AFortPlayerPawn* NewBot, __int64 idk)
|
||||
{
|
||||
LOG_INFO(LogDev, "ApplyOverrideCharacterCustomizationHook!");
|
||||
|
||||
auto CharacterCustomization = InBotData->GetCharacterCustomization();
|
||||
|
||||
NewBot->GetCosmeticLoadout()->GetCharacter() = CharacterCustomization->GetCustomizationLoadout()->GetCharacter();
|
||||
|
||||
NewBot->Get<bool>(0x1B30) = true; // idk this is like a initialize check
|
||||
} */
|
||||
|
||||
static UClass* StaticClass()
|
||||
{
|
||||
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortAthenaAIBotCustomizationData");
|
||||
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.FortAthenaAIBotCustomizationData");
|
||||
return Class;
|
||||
}
|
||||
};
|
||||
19
Project Reboot 3.0/FortDagwoodVehicle.h
Normal file
19
Project Reboot 3.0/FortDagwoodVehicle.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "FortAthenaVehicle.h"
|
||||
|
||||
class AFortDagwoodVehicle : public AFortAthenaVehicle // AFortAthenaSKMotorVehicle
|
||||
{
|
||||
public:
|
||||
void SetFuel(float NewFuel)
|
||||
{
|
||||
static auto SetFuelFn = FindObject<UFunction>(L"/Script/ValetRuntime.FortDagwoodVehicle.SetFuel");
|
||||
this->ProcessEvent(SetFuelFn, &NewFuel);
|
||||
}
|
||||
|
||||
static UClass* StaticClass()
|
||||
{
|
||||
static auto Class = FindObject<UClass>(L"/Script/ValetRuntime.FortDagwoodVehicle");
|
||||
return Class;
|
||||
}
|
||||
};
|
||||
@@ -118,7 +118,7 @@ FName AFortGameModeAthena::RedirectLootTier(const FName& LootTier)
|
||||
|
||||
UClass* AFortGameModeAthena::GetVehicleClassOverride(UClass* DefaultClass)
|
||||
{
|
||||
static auto GetVehicleClassOverrideFn = FindObject<UFunction>("/Script/FortniteGame.FortGameModeAthena.GetVehicleClassOverride");
|
||||
static auto GetVehicleClassOverrideFn = FindObject<UFunction>(L"/Script/FortniteGame.FortGameModeAthena.GetVehicleClassOverride");
|
||||
|
||||
if (!GetVehicleClassOverrideFn)
|
||||
return DefaultClass;
|
||||
@@ -593,7 +593,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
|
||||
float Duration = bShouldSkipAircraft ? 0 : 100000;
|
||||
float EarlyDuration = Duration;
|
||||
|
||||
float TimeSeconds = UGameplayStatics::GetTimeSeconds(GetWorld());
|
||||
float TimeSeconds = GameState->GetServerWorldTimeSeconds(); // UGameplayStatics::GetTimeSeconds(GetWorld());
|
||||
|
||||
static auto WarmupCountdownEndTimeOffset = GameState->GetOffset("WarmupCountdownEndTime");
|
||||
static auto WarmupCountdownStartTimeOffset = GameState->GetOffset("WarmupCountdownStartTime");
|
||||
@@ -656,22 +656,31 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
|
||||
|
||||
if (auto TeamsArrayContainer = GameState->GetTeamsArrayContainer())
|
||||
{
|
||||
TeamsArrayContainer->TeamIndexesArray.Free();
|
||||
GET_PLAYLIST(GameState);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
TeamsArrayContainer->TeamIndexesArray.Add(INT_MAX); // Bro what
|
||||
}
|
||||
int AllTeamsNum = Teams.Num(); // CurrentPlaylist ?
|
||||
|
||||
TeamsArrayContainer->SquadIdsArray.Free();
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
TeamsArrayContainer->SquadIdsArray.Add(INT_MAX); // Bro what
|
||||
}
|
||||
LOG_INFO(LogDev, "AllTeamsNum: {}", AllTeamsNum);
|
||||
|
||||
// We aren't "freeing", it's just not zero'd I guess?
|
||||
|
||||
LOG_INFO(LogDev, "TeamsArrayContainer->TeamsArray.Num() Before: {}", TeamsArrayContainer->TeamsArray.Num());
|
||||
LOG_INFO(LogDev, "TeamsArrayContainer->SquadsArray.Num() Before: {}", TeamsArrayContainer->SquadsArray.Num());
|
||||
|
||||
if (TeamsArrayContainer->TeamsArray.Num() != AllTeamsNum)
|
||||
{
|
||||
LOG_INFO(LogDev, "Filling TeamsArray!");
|
||||
TeamsArrayContainer->TeamsArray.Free();
|
||||
TeamsArrayContainer->TeamsArray.AddUninitialized(AllTeamsNum);
|
||||
}
|
||||
|
||||
if (TeamsArrayContainer->SquadsArray.Num() != AllTeamsNum)
|
||||
{
|
||||
LOG_INFO(LogDev, "Filling SquadsArray!");
|
||||
TeamsArrayContainer->SquadsArray.Free();
|
||||
TeamsArrayContainer->SquadsArray.AddUninitialized(AllTeamsNum);
|
||||
}
|
||||
|
||||
for (int i = 0; i < TeamsArrayContainer->TeamsArray.Num(); i++)
|
||||
{
|
||||
TeamsArrayContainer->TeamsArray.at(i).Free();
|
||||
@@ -681,6 +690,20 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
|
||||
{
|
||||
TeamsArrayContainer->SquadsArray.at(i).Free();
|
||||
}
|
||||
|
||||
TeamsArrayContainer->TeamIndexesArray.Free();
|
||||
|
||||
for (int i = 0; i < TeamsArrayContainer->TeamsArray.Num(); i++)
|
||||
{
|
||||
TeamsArrayContainer->TeamIndexesArray.Add(INT_MAX); // Bro what
|
||||
}
|
||||
|
||||
TeamsArrayContainer->SquadIdsArray.Free();
|
||||
|
||||
for (int i = 0; i < TeamsArrayContainer->SquadsArray.Num(); i++)
|
||||
{
|
||||
TeamsArrayContainer->SquadIdsArray.Add(INT_MAX); // Bro what
|
||||
}
|
||||
}
|
||||
|
||||
auto AllRebootVans = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ABuildingGameplayActorSpawnMachine::StaticClass());
|
||||
@@ -1132,9 +1155,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
|
||||
for (int i = 0; i < SpawnIsland_FloorLoot_Actors.Num(); i++)
|
||||
{
|
||||
ABuildingContainer* CurrentActor = (ABuildingContainer*)SpawnIsland_FloorLoot_Actors.at(i);
|
||||
static auto LootSpawnLocationOffset = CurrentActor->GetOffset("LootSpawnLocation_Athena");
|
||||
auto LSL = CurrentActor->Get<FVector>(LootSpawnLocationOffset);
|
||||
auto Location = CurrentActor->GetActorLocation() + CurrentActor->GetActorForwardVector() * LSL.X + CurrentActor->GetActorRightVector() * LSL.Y + CurrentActor->GetActorUpVector() * LSL.Z;
|
||||
auto Location = CurrentActor->GetActorLocation() + CurrentActor->GetActorForwardVector() * CurrentActor->GetLootSpawnLocation_Athena().X + CurrentActor->GetActorRightVector() * CurrentActor->GetLootSpawnLocation_Athena().Y + CurrentActor->GetActorUpVector() * CurrentActor->GetLootSpawnLocation_Athena().Z;
|
||||
|
||||
std::vector<LootDrop> LootDrops = PickLootDrops(SpawnIslandTierGroup, GameState->GetWorldLevel(), -1, bPrintWarmup);
|
||||
|
||||
@@ -1163,9 +1184,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
|
||||
{
|
||||
ABuildingContainer* CurrentActor = (ABuildingContainer*)BRIsland_FloorLoot_Actors.at(i);
|
||||
spawned++;
|
||||
static auto LootSpawnLocationOffset = CurrentActor->GetOffset("LootSpawnLocation_Athena");
|
||||
auto LSL = CurrentActor->Get<FVector>(LootSpawnLocationOffset);
|
||||
auto Location = CurrentActor->GetActorLocation() + CurrentActor->GetActorForwardVector() * LSL.X + CurrentActor->GetActorRightVector() * LSL.Y + CurrentActor->GetActorUpVector() * LSL.Z;
|
||||
|
||||
auto Location = CurrentActor->GetActorLocation() + CurrentActor->GetActorForwardVector() * CurrentActor->GetLootSpawnLocation_Athena().X + CurrentActor->GetActorRightVector() * CurrentActor->GetLootSpawnLocation_Athena().Y + CurrentActor->GetActorUpVector() * CurrentActor->GetLootSpawnLocation_Athena().Z;
|
||||
|
||||
std::vector<LootDrop> LootDrops = PickLootDrops(BRIslandTierGroup, GameState->GetWorldLevel(), -1, bPrint);
|
||||
|
||||
@@ -1214,7 +1234,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
|
||||
|
||||
static auto CharacterPartsOffset = PlayerStateAthena->GetOffset("CharacterParts", false);
|
||||
static auto CustomCharacterPartsStruct = FindObject<UStruct>(L"/Script/FortniteGame.CustomCharacterParts");
|
||||
auto CharacterParts = PlayerStateAthena->GetPtr<__int64>("CharacterParts");
|
||||
auto CharacterParts = PlayerStateAthena->GetPtr<__int64>(CharacterPartsOffset);
|
||||
|
||||
static auto PartsOffset = FindOffsetStruct("/Script/FortniteGame.CustomCharacterParts", "Parts", false);
|
||||
auto Parts = (UObject**)(__int64(CharacterParts) + PartsOffset); // UCustomCharacterPart* Parts[0x6]
|
||||
@@ -1252,6 +1272,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
|
||||
SquadArray.Add(WeakPlayerState);
|
||||
}
|
||||
|
||||
GameState->AddPlayerStateToGameMemberInfo(PlayerStateAthena);
|
||||
|
||||
LOG_INFO(LogDev, "New player going on TeamIndex {} with SquadId {}", PlayerStateAthena->GetTeamIndex(), SquadIdOffset != -1 ? PlayerStateAthena->GetSquadId() : -1);
|
||||
|
||||
// idk if this is needed
|
||||
@@ -1279,17 +1301,6 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
|
||||
PlayerAbilitySet->GiveToAbilitySystem(AbilitySystemComponent);
|
||||
}
|
||||
|
||||
struct FUniqueNetIdWrapper
|
||||
{
|
||||
unsigned char UnknownData00[0x1]; // 0x0000(0x0001) MISSED OFFSET
|
||||
};
|
||||
|
||||
struct FUniqueNetIdReplExperimental : public FUniqueNetIdWrapper
|
||||
{
|
||||
unsigned char UnknownData00[0x17]; // 0x0001(0x0017) MISSED OFFSET
|
||||
TArray<unsigned char> ReplicationBytes; // 0x0018(0x0010) (ZeroConstructor, Transient, Protected, NativeAccessSpecifierProtected)
|
||||
};
|
||||
|
||||
static auto PlayerCameraManagerOffset = NewPlayer->GetOffset("PlayerCameraManager");
|
||||
auto PlayerCameraManager = NewPlayer->Get(PlayerCameraManagerOffset);
|
||||
|
||||
@@ -1302,64 +1313,6 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
|
||||
PlayerCameraManager->Get<float>(ViewRollMaxOffset) = 0;
|
||||
}
|
||||
|
||||
static auto UniqueIdOffset = PlayerStateAthena->GetOffset("UniqueId");
|
||||
auto PlayerStateUniqueId = PlayerStateAthena->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset);
|
||||
|
||||
{
|
||||
static auto GameMemberInfoArrayOffset = GameState->GetOffset("GameMemberInfoArray", false);
|
||||
|
||||
// if (false)
|
||||
if (GameMemberInfoArrayOffset != -1)
|
||||
// if (Engine_Version >= 423)
|
||||
{
|
||||
struct FGameMemberInfo : public FFastArraySerializerItem
|
||||
{
|
||||
unsigned char SquadId; // 0x000C(0x0001) (ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
unsigned char TeamIndex; // 0x000D(0x0001) (ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
unsigned char UnknownData00[0x2]; // 0x000E(0x0002) MISSED OFFSET
|
||||
FUniqueNetIdReplExperimental MemberUniqueId; // 0x0010(0x0028) (HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
};
|
||||
|
||||
static auto GameMemberInfoStructSize = 0x38;
|
||||
// LOG_INFO(LogDev, "Compare: 0x{:x} 0x{:x}", GameMemberInfoStructSize, sizeof(FGameMemberInfo));
|
||||
|
||||
auto GameMemberInfo = Alloc<__int64>(GameMemberInfoStructSize);
|
||||
|
||||
((FFastArraySerializerItem*)GameMemberInfo)->MostRecentArrayReplicationKey = -1;
|
||||
((FFastArraySerializerItem*)GameMemberInfo)->ReplicationID = -1;
|
||||
((FFastArraySerializerItem*)GameMemberInfo)->ReplicationKey = -1;
|
||||
|
||||
if (false)
|
||||
{
|
||||
static auto GameMemberInfo_SquadIdOffset = 0x000C;
|
||||
static auto GameMemberInfo_TeamIndexOffset = 0x000D;
|
||||
static auto GameMemberInfo_MemberUniqueIdOffset = 0x0010;
|
||||
static auto UniqueIdSize = FUniqueNetIdRepl::GetSizeOfStruct();
|
||||
|
||||
*(uint8*)(__int64(GameMemberInfo) + GameMemberInfo_SquadIdOffset) = PlayerStateAthena->GetSquadId();
|
||||
*(uint8*)(__int64(GameMemberInfo) + GameMemberInfo_TeamIndexOffset) = PlayerStateAthena->GetTeamIndex();
|
||||
CopyStruct((void*)(__int64(GameMemberInfo) + GameMemberInfo_MemberUniqueIdOffset), PlayerStateUniqueId, UniqueIdSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
((FGameMemberInfo*)GameMemberInfo)->SquadId = PlayerStateAthena->GetSquadId();
|
||||
((FGameMemberInfo*)GameMemberInfo)->TeamIndex = PlayerStateAthena->GetTeamIndex();
|
||||
// GameMemberInfo->MemberUniqueId = PlayerStateUniqueId;
|
||||
((FUniqueNetIdRepl*)&((FGameMemberInfo*)GameMemberInfo)->MemberUniqueId)->CopyFromAnotherUniqueId(PlayerStateUniqueId);
|
||||
}
|
||||
|
||||
static auto GameMemberInfoArray_MembersOffset = FindOffsetStruct("/Script/FortniteGame.GameMemberInfoArray", "Members");
|
||||
|
||||
auto GameMemberInfoArray = GameState->GetPtr<FFastArraySerializer>(GameMemberInfoArrayOffset);
|
||||
|
||||
((TArray<FGameMemberInfo>*)(__int64(GameMemberInfoArray) + GameMemberInfoArray_MembersOffset))->AddPtr(
|
||||
(FGameMemberInfo*)GameMemberInfo, GameMemberInfoStructSize
|
||||
);
|
||||
|
||||
GameMemberInfoArray->MarkArrayDirty();
|
||||
}
|
||||
}
|
||||
|
||||
if (Globals::bCreative)
|
||||
{
|
||||
static auto CreativePortalManagerOffset = GameState->GetOffset("CreativePortalManager");
|
||||
@@ -1410,6 +1363,9 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
|
||||
|
||||
auto OwningPlayer = Portal->GetOwningPlayer();
|
||||
|
||||
static auto UniqueIdOffset = PlayerStateAthena->GetOffset("UniqueId");
|
||||
auto PlayerStateUniqueId = PlayerStateAthena->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset);
|
||||
|
||||
if (OwningPlayer != nullptr)
|
||||
{
|
||||
CopyStruct(OwningPlayer, PlayerStateUniqueId, FUniqueNetIdRepl::GetSizeOfStruct());
|
||||
|
||||
@@ -7,10 +7,72 @@
|
||||
#include "gui.h"
|
||||
#include "LevelStreamingDynamic.h"
|
||||
|
||||
/* void AFortGameStateAthena::AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState)
|
||||
void AFortGameStateAthena::AddPlayerStateToGameMemberInfo(AFortPlayerStateAthena* PlayerState)
|
||||
{
|
||||
static auto GameMemberInfoArrayOffset = this->GetOffset("GameMemberInfoArray", false);
|
||||
|
||||
} */
|
||||
if (GameMemberInfoArrayOffset == -1)
|
||||
return;
|
||||
|
||||
static auto UniqueIdOffset = PlayerState->GetOffset("UniqueId");
|
||||
auto PlayerStateUniqueId = PlayerState->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset);
|
||||
|
||||
struct FUniqueNetIdWrapper
|
||||
{
|
||||
unsigned char UnknownData00[0x1]; // 0x0000(0x0001) MISSED OFFSET
|
||||
};
|
||||
|
||||
struct FUniqueNetIdReplExperimental : public FUniqueNetIdWrapper
|
||||
{
|
||||
unsigned char UnknownData00[0x17]; // 0x0001(0x0017) MISSED OFFSET
|
||||
TArray<unsigned char> ReplicationBytes; // 0x0018(0x0010) (ZeroConstructor, Transient, Protected, NativeAccessSpecifierProtected)
|
||||
};
|
||||
|
||||
struct FGameMemberInfo : public FFastArraySerializerItem
|
||||
{
|
||||
unsigned char SquadId; // 0x000C(0x0001) (ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
unsigned char TeamIndex; // 0x000D(0x0001) (ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
unsigned char UnknownData00[0x2]; // 0x000E(0x0002) MISSED OFFSET
|
||||
FUniqueNetIdReplExperimental MemberUniqueId; // 0x0010(0x0028) (HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
};
|
||||
|
||||
static auto GameMemberInfoStructSize = 0x38;
|
||||
// LOG_INFO(LogDev, "Compare: 0x{:x} 0x{:x}", GameMemberInfoStructSize, sizeof(FGameMemberInfo));
|
||||
|
||||
auto GameMemberInfo = Alloc<__int64>(GameMemberInfoStructSize);
|
||||
|
||||
((FFastArraySerializerItem*)GameMemberInfo)->MostRecentArrayReplicationKey = -1;
|
||||
((FFastArraySerializerItem*)GameMemberInfo)->ReplicationID = -1;
|
||||
((FFastArraySerializerItem*)GameMemberInfo)->ReplicationKey = -1;
|
||||
|
||||
if (false)
|
||||
{
|
||||
static auto GameMemberInfo_SquadIdOffset = 0x000C;
|
||||
static auto GameMemberInfo_TeamIndexOffset = 0x000D;
|
||||
static auto GameMemberInfo_MemberUniqueIdOffset = 0x0010;
|
||||
static auto UniqueIdSize = FUniqueNetIdRepl::GetSizeOfStruct();
|
||||
|
||||
*(uint8*)(__int64(GameMemberInfo) + GameMemberInfo_SquadIdOffset) = PlayerState->GetSquadId();
|
||||
*(uint8*)(__int64(GameMemberInfo) + GameMemberInfo_TeamIndexOffset) = PlayerState->GetTeamIndex();
|
||||
CopyStruct((void*)(__int64(GameMemberInfo) + GameMemberInfo_MemberUniqueIdOffset), PlayerStateUniqueId, UniqueIdSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
((FGameMemberInfo*)GameMemberInfo)->SquadId = PlayerState->GetSquadId();
|
||||
((FGameMemberInfo*)GameMemberInfo)->TeamIndex = PlayerState->GetTeamIndex();
|
||||
((FGameMemberInfo*)GameMemberInfo)->MemberUniqueId = PlayerState->Get<FUniqueNetIdReplExperimental>(UniqueIdOffset);
|
||||
// ((FUniqueNetIdRepl*)&((FGameMemberInfo*)GameMemberInfo)->MemberUniqueId)->CopyFromAnotherUniqueId(PlayerStateUniqueId);
|
||||
}
|
||||
|
||||
static auto GameMemberInfoArray_MembersOffset = FindOffsetStruct("/Script/FortniteGame.GameMemberInfoArray", "Members");
|
||||
auto GameMemberInfoArray = this->GetPtr<FFastArraySerializer>(GameMemberInfoArrayOffset);
|
||||
|
||||
((TArray<FGameMemberInfo>*)(__int64(GameMemberInfoArray) + GameMemberInfoArray_MembersOffset))->AddPtr(
|
||||
(FGameMemberInfo*)GameMemberInfo, GameMemberInfoStructSize
|
||||
);
|
||||
|
||||
GameMemberInfoArray->MarkArrayDirty();
|
||||
}
|
||||
|
||||
TScriptInterface<UFortSafeZoneInterface> AFortGameStateAthena::GetSafeZoneInterface()
|
||||
{
|
||||
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
|
||||
bool IsResurrectionEnabled(AFortPlayerPawn* PlayerPawn)
|
||||
{
|
||||
static auto IsResurrectionEnabledFn = FindObject<UFunction>("/Script/FortniteGame.FortGameStateAthena.IsResurrectionEnabled");
|
||||
static auto IsResurrectionEnabledFn = FindObject<UFunction>(L"/Script/FortniteGame.FortGameStateAthena.IsResurrectionEnabled");
|
||||
struct { AFortPlayerPawn* PlayerPawn; bool Ret; } Params{PlayerPawn};
|
||||
this->ProcessEvent(IsResurrectionEnabledFn, &Params);
|
||||
return Params.Ret;
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
UFortPlaylist*& GetCurrentPlaylist();
|
||||
TScriptInterface<UFortSafeZoneInterface> GetSafeZoneInterface();
|
||||
|
||||
// void AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState);
|
||||
void AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState);
|
||||
|
||||
int GetAircraftIndex(AFortPlayerState* PlayerState);
|
||||
bool IsRespawningAllowed(AFortPlayerState* PlayerState); // actually in zone
|
||||
|
||||
@@ -169,7 +169,7 @@ FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, F
|
||||
// if (fabs(LootTier) <= 0.0000000099999999)
|
||||
// return 0;
|
||||
|
||||
int Multiplier = 1; // LootTier == -1 ? 1 : 1 LootTier // Idk i think we need to fill out the code above for this to work properly
|
||||
int Multiplier = LootTier == -1 ? 1 : LootTier; // Idk i think we need to fill out the code above for this to work properly maybe
|
||||
|
||||
LOOTING_MAP_TYPE<FName, FFortLootTierData*> TierGroupLTDs;
|
||||
|
||||
|
||||
@@ -36,10 +36,18 @@ AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
|
||||
if (PickupData.SourceType == -1)
|
||||
PickupData.SourceType = 0;
|
||||
|
||||
/* if (PickupData.bToss)
|
||||
if (PickupData.bToss)
|
||||
{
|
||||
PickupData.SourceType |= EFortPickupSourceTypeFlag::Tossed;
|
||||
} */
|
||||
auto TossedValue = EFortPickupSourceTypeFlag::GetTossedValue();
|
||||
|
||||
if (TossedValue != -1)
|
||||
{
|
||||
if ((PickupData.SourceType & TossedValue) == 0) // if it already has tossed flag we dont wanna add it again..
|
||||
{
|
||||
// PickupData.SourceType |= TossedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static auto FortPickupAthenaClass = FindObject<UClass>(L"/Script/FortniteGame.FortPickupAthena");
|
||||
auto PlayerState = PickupData.PawnOwner ? Cast<AFortPlayerState>(PickupData.PawnOwner->GetPlayerState()) : nullptr;
|
||||
@@ -52,7 +60,9 @@ AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
|
||||
static auto bRandomRotationOffset = Pickup->GetOffset("bRandomRotation", false);
|
||||
|
||||
if (bRandomRotationOffset != -1)
|
||||
{
|
||||
Pickup->Get<bool>(bRandomRotationOffset) = PickupData.bRandomRotation;
|
||||
}
|
||||
|
||||
static auto PawnWhoDroppedPickupOffset = Pickup->GetOffset("PawnWhoDroppedPickup");
|
||||
Pickup->Get<AFortPawn*>(PawnWhoDroppedPickupOffset) = PickupData.PawnOwner;
|
||||
@@ -145,7 +155,7 @@ AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
|
||||
|
||||
if (PickupSourceTypeFlagsOffset != -1)
|
||||
{
|
||||
// Pickup->Get<int32>(PickupSourceTypeFlagsOffset) |= (int)PickupData.SourceType; // Assuming its the same enum on older versions. // (it is not the same)
|
||||
// Pickup->Get<uint32>(PickupSourceTypeFlagsOffset) = (uint32)PickupData.SourceType; // Assuming its the same enum on older versions.
|
||||
}
|
||||
|
||||
if (Pickup->Get<AFortPawn*>(PawnWhoDroppedPickupOffset))
|
||||
@@ -208,7 +218,7 @@ AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
|
||||
Pickup->ForceNetUpdate();
|
||||
}
|
||||
|
||||
if (EFortPickupSourceTypeFlag::GetEnum() && PickupData.SourceType == EFortPickupSourceTypeFlag::GetContainerValue()) // crashes if we do this then tosspickup
|
||||
if (EFortPickupSourceTypeFlag::GetEnum() && ((PickupData.SourceType & EFortPickupSourceTypeFlag::GetContainerValue()) != 0)) // crashes if we do this then tosspickup
|
||||
{
|
||||
static auto bTossedFromContainerOffset = Pickup->GetOffset("bTossedFromContainer");
|
||||
Pickup->Get<bool>(bTossedFromContainerOffset) = true;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace EFortPickupSourceTypeFlag
|
||||
{
|
||||
static inline UEnum* GetEnum()
|
||||
{
|
||||
static auto Enum = FindObject<UEnum>("/Script/FortniteGame.EFortPickupSourceTypeFlag");
|
||||
static auto Enum = FindObject<UEnum>(L"/Script/FortniteGame.EFortPickupSourceTypeFlag");
|
||||
return Enum;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "AthenaMarkerComponent.h"
|
||||
#include "FortVolume.h"
|
||||
|
||||
static void ApplyHID(AFortPlayerPawn* Pawn, UObject* HeroDefinition)
|
||||
static void ApplyHID(AFortPlayerPawn* Pawn, UObject* HeroDefinition, bool bUseServerChoosePart = false)
|
||||
{
|
||||
using UFortHeroSpecialization = UObject;
|
||||
|
||||
@@ -21,7 +21,7 @@ static void ApplyHID(AFortPlayerPawn* Pawn, UObject* HeroDefinition)
|
||||
{
|
||||
auto& SpecializationSoft = Specializations.at(i);
|
||||
|
||||
static auto FortHeroSpecializationClass = FindObject<UClass>("/Script/FortniteGame.FortHeroSpecialization");
|
||||
static auto FortHeroSpecializationClass = FindObject<UClass>(L"/Script/FortniteGame.FortHeroSpecialization");
|
||||
auto Specialization = SpecializationSoft.Get(FortHeroSpecializationClass, true);
|
||||
|
||||
if (Specialization)
|
||||
@@ -29,9 +29,9 @@ static void ApplyHID(AFortPlayerPawn* Pawn, UObject* HeroDefinition)
|
||||
static auto Specialization_CharacterPartsOffset = Specialization->GetOffset("CharacterParts");
|
||||
auto& CharacterParts = Specialization->Get<TArray<TSoftObjectPtr<UObject>>>(Specialization_CharacterPartsOffset);
|
||||
|
||||
static auto CustomCharacterPartClass = FindObject<UClass>("/Script/FortniteGame.CustomCharacterPart");
|
||||
static auto CustomCharacterPartClass = FindObject<UClass>(L"/Script/FortniteGame.CustomCharacterPart");
|
||||
|
||||
/* if (bUseServerChoosePart)
|
||||
if (bUseServerChoosePart)
|
||||
{
|
||||
for (int z = 0; z < CharacterParts.Num(); z++)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ static void ApplyHID(AFortPlayerPawn* Pawn, UObject* HeroDefinition)
|
||||
}
|
||||
|
||||
continue; // hm?
|
||||
} */
|
||||
}
|
||||
|
||||
bool aa;
|
||||
|
||||
@@ -107,7 +107,7 @@ static bool ApplyCID(AFortPlayerPawn* Pawn, UObject* CID, bool bUseServerChooseP
|
||||
static auto HeroDefinitionOffset = CID->GetOffset("HeroDefinition");
|
||||
auto HeroDefinition = CID->Get(HeroDefinitionOffset);
|
||||
|
||||
ApplyHID(Pawn, HeroDefinition);
|
||||
ApplyHID(Pawn, HeroDefinition, bUseServerChoosePart);
|
||||
|
||||
// static auto HeroTypeOffset = PlayerState->GetOffset("HeroType");
|
||||
// PlayerState->Get(HeroTypeOffset) = HeroDefinition;
|
||||
|
||||
@@ -146,7 +146,7 @@ void AFortPlayerPawn::ServerHandlePickupWithRequestedSwapHook(UObject* Context,
|
||||
|
||||
void AFortPlayerPawn::ServerChoosePart(EFortCustomPartType Part, UObject* ChosenCharacterPart)
|
||||
{
|
||||
static auto fn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerPawn.ServerChoosePart");
|
||||
static auto fn = FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.ServerChoosePart");
|
||||
|
||||
struct
|
||||
{
|
||||
|
||||
51
Project Reboot 3.0/FortVehicleItemDefinition.h
Normal file
51
Project Reboot 3.0/FortVehicleItemDefinition.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include "SoftObjectPtr.h"
|
||||
#include "FortWorldItemDefinition.h"
|
||||
#include "GameplayAbilityTypes.h"
|
||||
|
||||
class UFortVehicleItemDefinition : public UFortWorldItemDefinition
|
||||
{
|
||||
public:
|
||||
FScalableFloat* GetMinPercentWithGas()
|
||||
{
|
||||
static auto MinPercentWithGasOffset = GetOffset("MinPercentWithGas");
|
||||
return GetPtr<FScalableFloat>(MinPercentWithGasOffset);
|
||||
}
|
||||
|
||||
FScalableFloat* GetMaxPercentWithGas()
|
||||
{
|
||||
static auto MaxPercentWithGasOffset = GetOffset("MaxPercentWithGas");
|
||||
return GetPtr<FScalableFloat>(MaxPercentWithGasOffset);
|
||||
}
|
||||
|
||||
FScalableFloat* GetVehicleMinSpawnPercent()
|
||||
{
|
||||
static auto VehicleMinSpawnPercentOffset = GetOffset("VehicleMinSpawnPercent");
|
||||
return GetPtr<FScalableFloat>(VehicleMinSpawnPercentOffset);
|
||||
}
|
||||
|
||||
FScalableFloat* GetVehicleMaxSpawnPercent()
|
||||
{
|
||||
static auto VehicleMaxSpawnPercentOffset = GetOffset("VehicleMaxSpawnPercent");
|
||||
return GetPtr<FScalableFloat>(VehicleMaxSpawnPercentOffset);
|
||||
}
|
||||
|
||||
TSoftObjectPtr<UClass>* GetVehicleActorClassSoft()
|
||||
{
|
||||
static auto VehicleActorClassOffset = GetOffset("VehicleActorClass");
|
||||
return GetPtr<TSoftObjectPtr<UClass>>(VehicleActorClassOffset);
|
||||
}
|
||||
|
||||
UClass* GetVehicleActorClass()
|
||||
{
|
||||
static auto BGAClass = FindObject<UClass>(L"/Script/Engine.BlueprintGeneratedClass");
|
||||
return GetVehicleActorClassSoft()->Get(BGAClass, true);
|
||||
}
|
||||
|
||||
static UClass* StaticClass()
|
||||
{
|
||||
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.FortVehicleItemDefinition");
|
||||
return Class;
|
||||
}
|
||||
};
|
||||
@@ -259,7 +259,7 @@ static UActorChannel* FindChannel(AActor * Actor, UNetConnection * Connection)
|
||||
static auto OpenChannelsOffset = Connection->GetOffset("OpenChannels");
|
||||
auto& OpenChannels = Connection->Get<TArray<UChannel*>>(OpenChannelsOffset);
|
||||
|
||||
static auto ActorChannelClass = FindObject<UClass>("/Script/Engine.ActorChannel");
|
||||
static auto ActorChannelClass = FindObject<UClass>(L"/Script/Engine.ActorChannel");
|
||||
|
||||
// LOG_INFO(LogReplication, "OpenChannels.Num(): {}", OpenChannels.Num());
|
||||
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
#include "reboot.h"
|
||||
|
||||
FString& APlayerState::GetSavedNetworkAddress()
|
||||
{
|
||||
static auto SavedNetworkAddressOffset = GetOffset("SavedNetworkAddress");
|
||||
return Get<FString>(SavedNetworkAddressOffset);
|
||||
}
|
||||
|
||||
FString APlayerState::GetPlayerName()
|
||||
{
|
||||
static auto GetPlayerNameFn = FindObject<UFunction>("/Script/Engine.PlayerState.GetPlayerName");
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
class APlayerState : public AActor
|
||||
{
|
||||
public:
|
||||
FString& GetSavedNetworkAddress();
|
||||
FString GetPlayerName();
|
||||
int& GetPlayerID(); // for future me to deal with (this is a short on some versions).
|
||||
bool IsBot();
|
||||
|
||||
@@ -194,7 +194,6 @@
|
||||
<ClCompile Include="DataTableFunctionLibrary.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="EngineTypes.cpp" />
|
||||
<ClCompile Include="events.cpp" />
|
||||
<ClCompile Include="FortAthenaCreativePortal.cpp" />
|
||||
<ClCompile Include="FortAthenaMapInfo.cpp" />
|
||||
<ClCompile Include="FortAthenaMutator_Barrier.cpp" />
|
||||
@@ -345,6 +344,7 @@
|
||||
<ClInclude Include="FortAthenaVehicle.h" />
|
||||
<ClInclude Include="FortAthenaVehicleSpawner.h" />
|
||||
<ClInclude Include="FortBotNameSettings.h" />
|
||||
<ClInclude Include="FortDagwoodVehicle.h" />
|
||||
<ClInclude Include="FortDecoItemDefinition.h" />
|
||||
<ClInclude Include="FortGadgetItemDefinition.h" />
|
||||
<ClInclude Include="FortGameMode.h" />
|
||||
@@ -377,6 +377,7 @@
|
||||
<ClInclude Include="FortQuickBars.h" />
|
||||
<ClInclude Include="FortResourceItemDefinition.h" />
|
||||
<ClInclude Include="FortSafeZoneIndicator.h" />
|
||||
<ClInclude Include="FortVehicleItemDefinition.h" />
|
||||
<ClInclude Include="FortVolume.h" />
|
||||
<ClInclude Include="FortWeapon.h" />
|
||||
<ClInclude Include="FortWeaponItemDefinition.h" />
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
<Filter>Engine\Source\Runtime\Engine\Private</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FortOctopusVehicle.cpp">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicles</Filter>
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicle</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BuildingStructuralSupportSystem.cpp">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private</Filter>
|
||||
@@ -212,10 +212,10 @@
|
||||
<Filter>Libaries\ImGUI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FortWeaponRangedMountedCannon.cpp">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicles</Filter>
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicle</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FortAthenaVehicle.cpp">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicles</Filter>
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicle</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CheatManager.cpp">
|
||||
<Filter>Engine\Source\Runtime\Engine\Private</Filter>
|
||||
@@ -242,7 +242,7 @@
|
||||
<Filter>Engine\Source\Runtime\CoreUObject\Private</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FortAthenaVehicleSpawner.cpp">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicles</Filter>
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicle</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BuildingContainer.cpp">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter>
|
||||
@@ -265,9 +265,6 @@
|
||||
<ClCompile Include="inc.cpp">
|
||||
<Filter>Reboot\Private</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="events.cpp">
|
||||
<Filter>Reboot\Private</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="reboot.cpp">
|
||||
<Filter>Reboot\Private</Filter>
|
||||
</ClCompile>
|
||||
@@ -936,6 +933,12 @@
|
||||
<ClInclude Include="discord.h">
|
||||
<Filter>Reboot\Public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FortVehicleItemDefinition.h">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Vehicle</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FortDagwoodVehicle.h">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Vehicle</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Engine">
|
||||
@@ -1124,9 +1127,6 @@
|
||||
<Filter Include="Engine\Source\Runtime\Core\Public\Internationalization">
|
||||
<UniqueIdentifier>{b00f4455-11e7-4fd9-aa6d-2d814788b544}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FortniteGame\Source\FortniteGame\Private\Vehicles">
|
||||
<UniqueIdentifier>{702a4ab1-e5e1-46e1-b8cd-2fab1c4fb48c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Engine\Source\Runtime\Core\Public\Algo">
|
||||
<UniqueIdentifier>{98f1bd0d-3eea-4d54-8bff-65ecf4ab1e73}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -1202,6 +1202,9 @@
|
||||
<Filter Include="Engine\Source\Developer\ScriptDisassembler\Private">
|
||||
<UniqueIdentifier>{45f601de-1a88-490c-a74a-5cf729b16dfb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FortniteGame\Source\FortniteGame\Private\Vehicle">
|
||||
<UniqueIdentifier>{702a4ab1-e5e1-46e1-b8cd-2fab1c4fb48c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="UnrealEngine.cpp">
|
||||
|
||||
@@ -98,6 +98,8 @@ void Addresses::SetupVersion()
|
||||
Fortnite_Version = 1.8;
|
||||
if (Fortnite_CL == 3757339)
|
||||
Fortnite_Version = 1.9;
|
||||
if (Fortnite_CL == 3841827)
|
||||
Fortnite_Version = 2.2;
|
||||
if (Fortnite_CL == 3870737)
|
||||
Fortnite_Version = 2.42;
|
||||
|
||||
@@ -436,6 +438,10 @@ void Offsets::FindAll()
|
||||
{
|
||||
Offsets::ClientWorldPackageName = 0x337B8;
|
||||
}
|
||||
if (Fortnite_Version == 2.20)
|
||||
{
|
||||
Offsets::ClientWorldPackageName = 0xA17A8;
|
||||
}
|
||||
if (Fortnite_Version == 2.42 || Fortnite_Version == 2.5)
|
||||
{
|
||||
Offsets::ClientWorldPackageName = 0x17F8;
|
||||
@@ -450,7 +456,7 @@ void Offsets::FindAll()
|
||||
Offsets::NetworkObjectList = 0x4F8;
|
||||
Offsets::ClientWorldPackageName = 0x1818;
|
||||
}
|
||||
if (Engine_Version == 419) // checked 2.4.2 & 1.11
|
||||
if (Engine_Version == 419) // checked 2.4.2 & 2.2 & 1.11
|
||||
{
|
||||
Offsets::NetworkObjectList = 0x490;
|
||||
Offsets::ReplicationFrame = 0x2C8;
|
||||
@@ -487,7 +493,7 @@ void Addresses::Init()
|
||||
ABuildingActor::OnDamageServerOriginal = decltype(ABuildingActor::OnDamageServerOriginal)(OnDamageServer);
|
||||
StaticLoadObjectOriginal = decltype(StaticLoadObjectOriginal)(StaticLoadObject);
|
||||
|
||||
static auto DefaultNetDriver = FindObject("/Script/Engine.Default__NetDriver");
|
||||
static auto DefaultNetDriver = FindObject(L"/Script/Engine.Default__NetDriver");
|
||||
Addresses::SetWorld = Engine_Version < 426 ? Addresses::SetWorld : __int64(DefaultNetDriver->VFTable[Addresses::SetWorld]);
|
||||
UNetDriver::SetWorldOriginal = decltype(UNetDriver::SetWorldOriginal)(SetWorld);
|
||||
|
||||
@@ -508,7 +514,7 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
|
||||
toNull.push_back(Memcury::Scanner::FindPattern("48 89 54 24 ? 48 89 4C 24 ? 55 53 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 8B 41 08 C1 E8 05").Get()); // Widget class
|
||||
}
|
||||
|
||||
if (Fortnite_Version == 1.11)
|
||||
if (Fortnite_Version == 1.11 || Fortnite_Version == 2.2)
|
||||
{
|
||||
toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 57 41 56 41 57 48 81 EC ? ? ? ? 48 8B 01 49 8B E9 45 0F B6 F8").Get()); // No Reserve
|
||||
}
|
||||
|
||||
@@ -18,20 +18,22 @@ public:
|
||||
static UClass* PawnClass = nullptr;
|
||||
static UClass* ControllerClass = nullptr;
|
||||
|
||||
bool bUsePhoebeClasses = false;
|
||||
|
||||
if (!PawnClass)
|
||||
{
|
||||
if (true)
|
||||
PawnClass = FindObject<UClass>("/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C");
|
||||
if (!bUsePhoebeClasses)
|
||||
PawnClass = FindObject<UClass>(L"/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C");
|
||||
else
|
||||
PawnClass = FindObject<UClass>("/Game/Athena/AI/Phoebe/BP_PlayerPawn_Athena_Phoebe.BP_PlayerPawn_Athena_Phoebe_C");
|
||||
PawnClass = FindObject<UClass>(L"/Game/Athena/AI/Phoebe/BP_PlayerPawn_Athena_Phoebe.BP_PlayerPawn_Athena_Phoebe_C");
|
||||
}
|
||||
|
||||
if (!ControllerClass)
|
||||
{
|
||||
if (true)
|
||||
if (!bUsePhoebeClasses)
|
||||
ControllerClass = AFortPlayerControllerAthena::StaticClass();
|
||||
else
|
||||
ControllerClass = FindObject<UClass>("/Game/Athena/AI/Phoebe/BP_PhoebePlayerController.BP_PhoebePlayerController_C");
|
||||
ControllerClass = FindObject<UClass>(L"/Game/Athena/AI/Phoebe/BP_PhoebePlayerController.BP_PhoebePlayerController_C");
|
||||
}
|
||||
|
||||
if (!ControllerClass || !PawnClass)
|
||||
@@ -40,7 +42,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
static auto FortAthenaAIBotControllerClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaAIBotController");
|
||||
static auto FortAthenaAIBotControllerClass = FindObject<UClass>(L"/Script/FortniteGame.FortAthenaAIBotController");
|
||||
|
||||
Controller = GetWorld()->SpawnActor<AController>(ControllerClass);
|
||||
AFortPlayerPawnAthena* Pawn = GetWorld()->SpawnActor<AFortPlayerPawnAthena>(PawnClass, SpawnTransform, CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn));
|
||||
@@ -49,11 +51,20 @@ public:
|
||||
if (!Pawn || !PlayerState)
|
||||
return;
|
||||
|
||||
static int CurrentBotNum = 1;
|
||||
bool bUseOverrideName = false;
|
||||
|
||||
auto BotNumWStr = std::to_wstring(CurrentBotNum++);
|
||||
FString NewName;
|
||||
|
||||
FString NewName = (L"RebootBot" + BotNumWStr).c_str();
|
||||
if (bUseOverrideName)
|
||||
{
|
||||
NewName = L"Override";
|
||||
}
|
||||
else
|
||||
{
|
||||
static int CurrentBotNum = 1;
|
||||
auto BotNumWStr = std::to_wstring(CurrentBotNum++);
|
||||
NewName = (L"RebootBot" + BotNumWStr).c_str();
|
||||
}
|
||||
|
||||
if (auto PlayerController = Cast<APlayerController>(Controller))
|
||||
PlayerController->ServerChangeName(NewName);
|
||||
@@ -65,7 +76,9 @@ public:
|
||||
static auto SquadIdOffset = PlayerState->GetOffset("SquadId", false);
|
||||
|
||||
if (SquadIdOffset != -1)
|
||||
PlayerState->GetSquadId() = PlayerState->GetTeamIndex() - 2;
|
||||
PlayerState->GetSquadId() = PlayerState->GetTeamIndex() - 2; // NumToSubtractFromSquadId;
|
||||
|
||||
GameState->AddPlayerStateToGameMemberInfo(PlayerState);
|
||||
|
||||
PlayerState->SetIsBot(true);
|
||||
|
||||
@@ -125,7 +138,7 @@ public:
|
||||
|
||||
FTransform InventorySpawnTransform{};
|
||||
|
||||
static auto FortInventoryClass = FindObject<UClass>("/Script/FortniteGame.FortInventory"); // AFortInventory::StaticClass()
|
||||
static auto FortInventoryClass = FindObject<UClass>(L"/Script/FortniteGame.FortInventory"); // AFortInventory::StaticClass()
|
||||
*Inventory = GetWorld()->SpawnActor<AFortInventory>(FortInventoryClass, InventorySpawnTransform, CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AlwaysSpawn, false, Controller));
|
||||
|
||||
if (!*Inventory)
|
||||
@@ -166,20 +179,12 @@ public:
|
||||
{
|
||||
FortPlayerController->ServerExecuteInventoryItemHook(FortPlayerController, PickaxeInstance->GetItemEntry()->GetItemGuid());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
(*Inventory)->Update();
|
||||
}
|
||||
}
|
||||
|
||||
/* static auto HeroType = FindObject(L"/Game/Athena/Heroes/HID_115_Athena_Commando_M_CarbideBlue.HID_115_Athena_Commando_M_CarbideBlue");
|
||||
|
||||
static auto HeroTypeOffset = PlayerState->GetOffset("HeroType");
|
||||
|
||||
if (HeroTypeOffset != -1)
|
||||
PlayerState->Get(HeroTypeOffset) = HeroType; */
|
||||
|
||||
auto PlayerAbilitySet = GetPlayerAbilitySet();
|
||||
auto AbilitySystemComponent = PlayerState->GetAbilitySystemComponent();
|
||||
|
||||
@@ -193,6 +198,56 @@ public:
|
||||
|
||||
// PlayerController->ApplyCosmeticLoadout();
|
||||
|
||||
/*
|
||||
|
||||
auto AllHeroTypes = GetAllObjectsOfClass(FindObject<UClass>(L"/Script/FortniteGame.FortHeroType"));
|
||||
std::vector<UFortItemDefinition*> AthenaHeroTypes;
|
||||
|
||||
UFortItemDefinition* HeroType = FindObject<UFortItemDefinition>(L"/Game/Athena/Heroes/HID_030_Athena_Commando_M_Halloween.HID_030_Athena_Commando_M_Halloween");
|
||||
|
||||
for (int i = 0; i < AllHeroTypes.size(); i++)
|
||||
{
|
||||
auto CurrentHeroType = (UFortItemDefinition*)AllHeroTypes.at(i);
|
||||
|
||||
if (CurrentHeroType->GetPathName().starts_with("/Game/Athena/Heroes/"))
|
||||
AthenaHeroTypes.push_back(CurrentHeroType);
|
||||
}
|
||||
|
||||
if (AthenaHeroTypes.size())
|
||||
{
|
||||
HeroType = AthenaHeroTypes.at(std::rand() % AthenaHeroTypes.size());
|
||||
}
|
||||
|
||||
static auto HeroTypeOffset = PlayerState->GetOffset("HeroType");
|
||||
|
||||
if (HeroTypeOffset != -1)
|
||||
PlayerState->Get(HeroTypeOffset) = HeroType;
|
||||
|
||||
static auto OwningGameInstanceOffset = GetWorld()->GetOffset("OwningGameInstance");
|
||||
auto OwningGameInstance = GetWorld()->Get(OwningGameInstanceOffset);
|
||||
|
||||
static auto RegisteredPlayersOffset = OwningGameInstance->GetOffset("RegisteredPlayers");
|
||||
auto& RegisteredPlayers = OwningGameInstance->Get<TArray<UObject*>>(RegisteredPlayersOffset);
|
||||
|
||||
static auto FortRegisteredPlayerInfoClass = FindObject<UClass>("/Script/FortniteGame.FortRegisteredPlayerInfo");
|
||||
|
||||
auto NewPlayerInfo = UGameplayStatics::SpawnObject(FortRegisteredPlayerInfoClass, Controller);
|
||||
static auto PlayerIDOffset = NewPlayerInfo->GetOffset("PlayerID");
|
||||
|
||||
static auto UniqueIdOffset = PlayerState->GetOffset("UniqueId");
|
||||
auto PlayerStateUniqueId = PlayerState->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset);
|
||||
|
||||
NewPlayerInfo->GetPtr<FUniqueNetIdRepl>(PlayerIDOffset)->CopyFromAnotherUniqueId(PlayerStateUniqueId);
|
||||
|
||||
static auto MyPlayerInfoOffset = Controller->GetOffset("MyPlayerInfo");
|
||||
Controller->Get(MyPlayerInfoOffset) = NewPlayerInfo;
|
||||
|
||||
RegisteredPlayers.Add(NewPlayerInfo);
|
||||
|
||||
ApplyHID(Pawn, HeroType, true);
|
||||
|
||||
*/
|
||||
|
||||
GameState->GetPlayersLeft()++;
|
||||
GameState->OnRep_PlayersLeft();
|
||||
|
||||
@@ -201,7 +256,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static std::vector<PlayerBot> AllPlayerBotsToTick;
|
||||
static inline std::vector<PlayerBot> AllPlayerBotsToTick;
|
||||
|
||||
namespace Bots
|
||||
{
|
||||
@@ -281,7 +336,7 @@ namespace Bots
|
||||
|
||||
if (CurrentPlayerState->IsInAircraft() && !CurrentPlayerState->HasThankedBusDriver())
|
||||
{
|
||||
static auto ServerThankBusDriverFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerAthena.ServerThankBusDriver");
|
||||
static auto ServerThankBusDriverFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerThankBusDriver");
|
||||
CurrentPlayer->ProcessEvent(ServerThankBusDriverFn);
|
||||
}
|
||||
|
||||
@@ -289,7 +344,7 @@ namespace Bots
|
||||
{
|
||||
if (PlayerBot.NextJumpTime <= UGameplayStatics::GetTimeSeconds(GetWorld()))
|
||||
{
|
||||
static auto JumpFn = FindObject<UFunction>("/Script/Engine.Character.Jump");
|
||||
static auto JumpFn = FindObject<UFunction>(L"/Script/Engine.Character.Jump");
|
||||
|
||||
CurrentPawn->ProcessEvent(JumpFn);
|
||||
PlayerBot.NextJumpTime = UGameplayStatics::GetTimeSeconds(GetWorld()) + (rand() % 4 + 3);
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Builder
|
||||
// NewActor->GetTeamIndex() = stuff[6];
|
||||
// NewActor->SetHealth(stuff[7]);
|
||||
|
||||
static auto FortActorOptionsComponentClass = FindObject<UClass>("/Script/FortniteGame.FortActorOptionsComponent");
|
||||
static auto FortActorOptionsComponentClass = FindObject<UClass>(L"/Script/FortniteGame.FortActorOptionsComponent");
|
||||
auto ActorOptionsComponent = FortActorOptionsComponentClass ? NewActor->GetComponentByClass(FortActorOptionsComponentClass) : nullptr;
|
||||
|
||||
// continue;
|
||||
|
||||
@@ -8,12 +8,12 @@ namespace Calendar
|
||||
{
|
||||
static inline bool HasSnowModification()
|
||||
{
|
||||
return Fortnite_Version == 7.30;
|
||||
return Fortnite_Version == 7.30 || Fortnite_Version == 11.31 || Fortnite_Version == 19.10;
|
||||
}
|
||||
|
||||
static inline UObject* GetSnowSetup()
|
||||
{
|
||||
auto Class = FindObject<UClass>("/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C");
|
||||
auto Class = FindObject<UClass>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C");
|
||||
auto Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), Class);
|
||||
|
||||
return Actors.Num() > 0 ? Actors.at(0) : nullptr;
|
||||
@@ -36,14 +36,14 @@ namespace Calendar
|
||||
|
||||
static inline void SetSnow(float NewValue)
|
||||
{
|
||||
static auto SetSnowFn = FindObject<UFunction>("/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow");
|
||||
static auto SetSnowFn = FindObject<UFunction>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow");
|
||||
auto SnowSetup = GetSnowSetup();
|
||||
|
||||
LOG_INFO(LogDev, "SnowSetup: {}", SnowSetup->IsValidLowLevel() ? SnowSetup->GetFullName() : "BadRead");
|
||||
|
||||
if (SnowSetup)
|
||||
{
|
||||
static auto OnReady_347B1F4D45630C357605FCB417D749A3Fn = FindObject<UFunction>("/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.OnReady_347B1F4D45630C357605FCB417D749A3");
|
||||
static auto OnReady_347B1F4D45630C357605FCB417D749A3Fn = FindObject<UFunction>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.OnReady_347B1F4D45630C357605FCB417D749A3");
|
||||
auto GameState = GetWorld()->GetGameState();
|
||||
SnowSetup->ProcessEvent(OnReady_347B1F4D45630C357605FCB417D749A3Fn, &GameState);
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
#include "bots.h"
|
||||
#include "FortAthenaMutator_Bots.h"
|
||||
#include "ai.h"
|
||||
#include "moderation.h"
|
||||
|
||||
bool IsOperator(APlayerState* PlayerState, AFortPlayerController* PlayerController)
|
||||
{
|
||||
static auto SavedNetworkAddressOffset = PlayerState->GetOffset("SavedNetworkAddress");
|
||||
auto IP = PlayerState->GetPtr<FString>(SavedNetworkAddressOffset);
|
||||
auto IPStr = IP->ToString();
|
||||
auto& IP = PlayerState->GetSavedNetworkAddress();
|
||||
auto IPStr = IP.ToString();
|
||||
|
||||
// std::cout << "IPStr: " << IPStr << '\n';
|
||||
|
||||
if (IPStr == "127.0.0.1" || IPStr == "68.134.74.228" || IPStr == "26.66.97.190") // || IsOp(PlayerController))
|
||||
if (IPStr == "127.0.0.1" || IPStr == "68.134.74.228" || IPStr == "26.66.97.190" || IsOp(PlayerController))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -303,6 +303,28 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
|
||||
);
|
||||
}
|
||||
} */
|
||||
else if (Command == "op")
|
||||
{
|
||||
if (IsOp(ReceivingController))
|
||||
{
|
||||
SendMessageToConsole(PlayerController, L"Player is already operator!");
|
||||
return;
|
||||
}
|
||||
|
||||
Op(ReceivingController);
|
||||
SendMessageToConsole(PlayerController, L"Granted operator to player!");
|
||||
}
|
||||
else if (Command == "deop")
|
||||
{
|
||||
if (!IsOp(ReceivingController))
|
||||
{
|
||||
SendMessageToConsole(PlayerController, L"Player is not operator!");
|
||||
return;
|
||||
}
|
||||
|
||||
Deop(ReceivingController);
|
||||
SendMessageToConsole(PlayerController, L"Removed operator from player!");
|
||||
}
|
||||
else if (Command == "setpickaxe")
|
||||
{
|
||||
if (NumArgs < 1)
|
||||
|
||||
@@ -316,6 +316,7 @@ DWORD WINAPI Main(LPVOID)
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortWorld VeryVerbose", nullptr);
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortPlayerRegistration VeryVerbose", nullptr);
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogBuilding VeryVerbose", nullptr);
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortTeams VeryVerbose", nullptr);
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortAI VeryVerbose", nullptr);
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortAIDirector VeryVerbose", nullptr);
|
||||
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortQuest VeryVerbose", nullptr);
|
||||
@@ -642,6 +643,11 @@ DWORD WINAPI Main(LPVOID)
|
||||
HookInstruction(Addresses::RebootingDelegate, (PVOID)ABuildingGameplayActorSpawnMachine::RebootingDelegateHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::LEA, FindObject("/Script/FortniteGame.Default__BuildingGameplayActorSpawnMachine"));
|
||||
}
|
||||
|
||||
if (Fortnite_Version == 13.40)
|
||||
{
|
||||
// HookInstruction(__int64(GetModuleHandleW(0)) + 0x1FC835D, (PVOID)UFortAthenaAIBotCustomizationData::ApplyOverrideCharacterCustomizationHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::CALL, nullptr);
|
||||
}
|
||||
|
||||
Hooking::MinHook::Hook(FortWeaponDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortWeapon.ServerReleaseWeaponAbility"),
|
||||
AFortWeapon::ServerReleaseWeaponAbilityHook, (PVOID*)&AFortWeapon::ServerReleaseWeaponAbilityOriginal, false, true);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#define LOADOUT_PLAYERTAB 4
|
||||
#define FUN_PLAYERTAB 5
|
||||
|
||||
extern inline int NumToSubtractFromSquadId = 2;
|
||||
extern inline int NumToSubtractFromSquadId = 0; // I think 2?
|
||||
extern inline int SecondsUntilTravel = 5;
|
||||
extern inline bool bSwitchedInitialLevel = false;
|
||||
extern inline bool bIsInAutoRestart = false;
|
||||
@@ -587,122 +587,125 @@ static inline void MainUI()
|
||||
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr);
|
||||
|
||||
auto GetAircrafts = [&]() -> TArray<AActor*>
|
||||
if (Globals::bLateGame.load())
|
||||
{
|
||||
static auto AircraftsOffset = GameState->GetOffset("Aircrafts", false);
|
||||
|
||||
if (AircraftsOffset == -1)
|
||||
auto GetAircrafts = [&]() -> TArray<AActor*>
|
||||
{
|
||||
// GameState->Aircraft
|
||||
static auto AircraftsOffset = GameState->GetOffset("Aircrafts", false);
|
||||
|
||||
static auto FortAthenaAircraftClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaAircraft");
|
||||
auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass);
|
||||
|
||||
return AllAircrafts;
|
||||
}
|
||||
|
||||
return GameState->Get<TArray<AActor*>>(AircraftsOffset);
|
||||
};
|
||||
|
||||
while (GetAircrafts().Num() <= 0) // hmm
|
||||
{
|
||||
Sleep(500);
|
||||
}
|
||||
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startsafezone", nullptr);
|
||||
|
||||
static auto SafeZoneIndicatorOffset = GameState->GetOffset("SafeZoneIndicator");
|
||||
|
||||
static auto SafeZonesStartTimeOffset = GameState->GetOffset("SafeZonesStartTime");
|
||||
GameState->Get<float>(SafeZonesStartTimeOffset) = 0;
|
||||
|
||||
while (!GameState->Get(SafeZoneIndicatorOffset))
|
||||
{
|
||||
Sleep(500);
|
||||
}
|
||||
|
||||
while (GetAircrafts().Num() <= 0) // hmm
|
||||
{
|
||||
Sleep(500);
|
||||
}
|
||||
|
||||
static auto NextNextCenterOffset = GameState->Get(SafeZoneIndicatorOffset)->GetOffset("NextNextCenter", false);
|
||||
static auto NextCenterOffset = GameState->Get(SafeZoneIndicatorOffset)->GetOffset("NextCenter");
|
||||
FVector LocationToStartAircraft = GameState->Get(SafeZoneIndicatorOffset)->Get<FVector>(NextNextCenterOffset == -1 ? NextCenterOffset : NextNextCenterOffset); // SafeZoneLocations.at(4);
|
||||
LocationToStartAircraft.Z += 10000;
|
||||
|
||||
for (int i = 0; i < GetAircrafts().Num(); i++)
|
||||
{
|
||||
auto CurrentAircraft = GetAircrafts().at(i);
|
||||
|
||||
CurrentAircraft->TeleportTo(LocationToStartAircraft, FRotator());
|
||||
|
||||
static auto FlightInfoOffset = CurrentAircraft->GetOffset("FlightInfo", false);
|
||||
|
||||
float FlightSpeed = 0.0f;
|
||||
|
||||
if (FlightInfoOffset == -1)
|
||||
{
|
||||
static auto FlightStartLocationOffset = CurrentAircraft->GetOffset("FlightStartLocation");
|
||||
static auto FlightSpeedOffset = CurrentAircraft->GetOffset("FlightSpeed");
|
||||
static auto DropStartTimeOffset = CurrentAircraft->GetOffset("DropStartTime");
|
||||
|
||||
CurrentAircraft->Get<FVector>(FlightStartLocationOffset) = LocationToStartAircraft;
|
||||
CurrentAircraft->Get<float>(FlightSpeedOffset) = FlightSpeed;
|
||||
CurrentAircraft->Get<float>(DropStartTimeOffset) = GameState->GetServerWorldTimeSeconds();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto FlightInfo = CurrentAircraft->GetPtr<FAircraftFlightInfo>(FlightInfoOffset);
|
||||
|
||||
FlightInfo->GetFlightSpeed() = FlightSpeed;
|
||||
FlightInfo->GetFlightStartLocation() = LocationToStartAircraft;
|
||||
FlightInfo->GetTimeTillDropStart() = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static auto MapInfoOffset = GameState->GetOffset("MapInfo");
|
||||
auto MapInfo = GameState->Get(MapInfoOffset);
|
||||
|
||||
if (MapInfo)
|
||||
{
|
||||
static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos", false);
|
||||
|
||||
if (FlightInfosOffset != -1)
|
||||
{
|
||||
auto& FlightInfos = MapInfo->Get<TArray<FAircraftFlightInfo>>(FlightInfosOffset);
|
||||
|
||||
LOG_INFO(LogDev, "FlightInfos.Num(): {}", FlightInfos.Num());
|
||||
|
||||
for (int i = 0; i < FlightInfos.Num(); i++)
|
||||
if (AircraftsOffset == -1)
|
||||
{
|
||||
auto FlightInfo = FlightInfos.AtPtr(i, FAircraftFlightInfo::GetStructSize());
|
||||
// GameState->Aircraft
|
||||
|
||||
FlightInfo->GetFlightSpeed() = 0;
|
||||
static auto FortAthenaAircraftClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaAircraft");
|
||||
auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass);
|
||||
|
||||
return AllAircrafts;
|
||||
}
|
||||
|
||||
return GameState->Get<TArray<AActor*>>(AircraftsOffset);
|
||||
};
|
||||
|
||||
while (GetAircrafts().Num() <= 0) // hmm
|
||||
{
|
||||
Sleep(500);
|
||||
}
|
||||
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startsafezone", nullptr);
|
||||
|
||||
static auto SafeZoneIndicatorOffset = GameState->GetOffset("SafeZoneIndicator");
|
||||
|
||||
static auto SafeZonesStartTimeOffset = GameState->GetOffset("SafeZonesStartTime");
|
||||
GameState->Get<float>(SafeZonesStartTimeOffset) = 0;
|
||||
|
||||
while (!GameState->Get(SafeZoneIndicatorOffset))
|
||||
{
|
||||
Sleep(500);
|
||||
}
|
||||
|
||||
while (GetAircrafts().Num() <= 0) // hmm
|
||||
{
|
||||
Sleep(500);
|
||||
}
|
||||
|
||||
static auto NextNextCenterOffset = GameState->Get(SafeZoneIndicatorOffset)->GetOffset("NextNextCenter", false);
|
||||
static auto NextCenterOffset = GameState->Get(SafeZoneIndicatorOffset)->GetOffset("NextCenter");
|
||||
FVector LocationToStartAircraft = GameState->Get(SafeZoneIndicatorOffset)->Get<FVector>(NextNextCenterOffset == -1 ? NextCenterOffset : NextNextCenterOffset); // SafeZoneLocations.at(4);
|
||||
LocationToStartAircraft.Z += 10000;
|
||||
|
||||
for (int i = 0; i < GetAircrafts().Num(); i++)
|
||||
{
|
||||
auto CurrentAircraft = GetAircrafts().at(i);
|
||||
|
||||
CurrentAircraft->TeleportTo(LocationToStartAircraft, FRotator());
|
||||
|
||||
static auto FlightInfoOffset = CurrentAircraft->GetOffset("FlightInfo", false);
|
||||
|
||||
float FlightSpeed = 0.0f;
|
||||
|
||||
if (FlightInfoOffset == -1)
|
||||
{
|
||||
static auto FlightStartLocationOffset = CurrentAircraft->GetOffset("FlightStartLocation");
|
||||
static auto FlightSpeedOffset = CurrentAircraft->GetOffset("FlightSpeed");
|
||||
static auto DropStartTimeOffset = CurrentAircraft->GetOffset("DropStartTime");
|
||||
|
||||
CurrentAircraft->Get<FVector>(FlightStartLocationOffset) = LocationToStartAircraft;
|
||||
CurrentAircraft->Get<float>(FlightSpeedOffset) = FlightSpeed;
|
||||
CurrentAircraft->Get<float>(DropStartTimeOffset) = GameState->GetServerWorldTimeSeconds();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto FlightInfo = CurrentAircraft->GetPtr<FAircraftFlightInfo>(FlightInfoOffset);
|
||||
|
||||
FlightInfo->GetFlightSpeed() = FlightSpeed;
|
||||
FlightInfo->GetFlightStartLocation() = LocationToStartAircraft;
|
||||
FlightInfo->GetTimeTillDropStart() = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static auto bAircraftIsLockedOffset = GameState->GetOffset("bAircraftIsLocked");
|
||||
static auto bAircraftIsLockedFieldMask = GetFieldMask(GameState->GetProperty("bAircraftIsLocked"));
|
||||
GameState->SetBitfieldValue(bAircraftIsLockedOffset, bAircraftIsLockedFieldMask, false);
|
||||
static auto MapInfoOffset = GameState->GetOffset("MapInfo");
|
||||
auto MapInfo = GameState->Get(MapInfoOffset);
|
||||
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr);
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipaircraft", nullptr);
|
||||
if (MapInfo)
|
||||
{
|
||||
static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos", false);
|
||||
|
||||
auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator();
|
||||
|
||||
if (SafeZoneIndicator)
|
||||
{
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
|
||||
SafeZoneIndicator->SkipShrinkSafeZone();
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
|
||||
SafeZoneIndicator->SkipShrinkSafeZone();
|
||||
if (FlightInfosOffset != -1)
|
||||
{
|
||||
auto& FlightInfos = MapInfo->Get<TArray<FAircraftFlightInfo>>(FlightInfosOffset);
|
||||
|
||||
// Sleep(1000);
|
||||
// SafeZoneIndicator->SkipShrinkSafeZone();
|
||||
LOG_INFO(LogDev, "FlightInfos.Num(): {}", FlightInfos.Num());
|
||||
|
||||
for (int i = 0; i < FlightInfos.Num(); i++)
|
||||
{
|
||||
auto FlightInfo = FlightInfos.AtPtr(i, FAircraftFlightInfo::GetStructSize());
|
||||
|
||||
FlightInfo->GetFlightSpeed() = 0;
|
||||
FlightInfo->GetFlightStartLocation() = LocationToStartAircraft;
|
||||
FlightInfo->GetTimeTillDropStart() = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static auto bAircraftIsLockedOffset = GameState->GetOffset("bAircraftIsLocked");
|
||||
static auto bAircraftIsLockedFieldMask = GetFieldMask(GameState->GetProperty("bAircraftIsLocked"));
|
||||
GameState->SetBitfieldValue(bAircraftIsLockedOffset, bAircraftIsLockedFieldMask, false);
|
||||
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr);
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipaircraft", nullptr);
|
||||
|
||||
auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator();
|
||||
|
||||
if (SafeZoneIndicator)
|
||||
{
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
|
||||
SafeZoneIndicator->SkipShrinkSafeZone();
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
|
||||
SafeZoneIndicator->SkipShrinkSafeZone();
|
||||
|
||||
// Sleep(1000);
|
||||
// SafeZoneIndicator->SkipShrinkSafeZone();
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO(LogDev, "Finished!");
|
||||
@@ -719,7 +722,7 @@ static inline void MainUI()
|
||||
|
||||
if (Fortnite_Version == 1.11)
|
||||
{
|
||||
static auto OverrideBattleBusSkin = FindObject("/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WinterBus.BBID_WinterBus");
|
||||
static auto OverrideBattleBusSkin = FindObject(L"/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WinterBus.BBID_WinterBus");
|
||||
LOG_INFO(LogDev, "OverrideBattleBusSkin: {}", __int64(OverrideBattleBusSkin));
|
||||
|
||||
if (OverrideBattleBusSkin)
|
||||
@@ -765,7 +768,21 @@ static inline void MainUI()
|
||||
}
|
||||
|
||||
static auto WarmupCountdownEndTimeOffset = GameState->GetOffset("WarmupCountdownEndTime");
|
||||
GameState->Get<float>(WarmupCountdownEndTimeOffset) = UGameplayStatics::GetTimeSeconds(GetWorld()) + 10;
|
||||
// GameState->Get<float>(WarmupCountdownEndTimeOffset) = UGameplayStatics::GetTimeSeconds(GetWorld()) + 10;
|
||||
|
||||
float TimeSeconds = GameState->GetServerWorldTimeSeconds(); // UGameplayStatics::GetTimeSeconds(GetWorld());
|
||||
float Duration = 10;
|
||||
float EarlyDuration = Duration;
|
||||
|
||||
static auto WarmupCountdownStartTimeOffset = GameState->GetOffset("WarmupCountdownStartTime");
|
||||
static auto WarmupCountdownDurationOffset = GameMode->GetOffset("WarmupCountdownDuration");
|
||||
static auto WarmupEarlyCountdownDurationOffset = GameMode->GetOffset("WarmupEarlyCountdownDuration");
|
||||
|
||||
GameState->Get<float>(WarmupCountdownEndTimeOffset) = TimeSeconds + Duration;
|
||||
GameMode->Get<float>(WarmupCountdownDurationOffset) = Duration;
|
||||
|
||||
// GameState->Get<float>(WarmupCountdownStartTimeOffset) = TimeSeconds;
|
||||
GameMode->Get<float>(WarmupEarlyCountdownDurationOffset) = EarlyDuration;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -788,7 +805,7 @@ static inline void MainUI()
|
||||
{
|
||||
if (ImGui::Button("Unvault DrumGun"))
|
||||
{
|
||||
static auto SetUnvaultItemNameFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/White/BP_SnowScripting.BP_SnowScripting_C.SetUnvaultItemName");
|
||||
static auto SetUnvaultItemNameFn = FindObject<UFunction>(L"/Game/Athena/Prototype/Blueprints/White/BP_SnowScripting.BP_SnowScripting_C.SetUnvaultItemName");
|
||||
auto EventScripting = GetEventScripting();
|
||||
|
||||
if (EventScripting)
|
||||
@@ -796,7 +813,7 @@ static inline void MainUI()
|
||||
FName Name = UKismetStringLibrary::Conv_StringToName(L"DrumGun");
|
||||
EventScripting->ProcessEvent(SetUnvaultItemNameFn, &Name);
|
||||
|
||||
static auto PillarsConcludedFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/White/BP_SnowScripting.BP_SnowScripting_C.PillarsConcluded");
|
||||
static auto PillarsConcludedFn = FindObject<UFunction>(L"/Game/Athena/Prototype/Blueprints/White/BP_SnowScripting.BP_SnowScripting_C.PillarsConcluded");
|
||||
EventScripting->ProcessEvent(PillarsConcludedFn, &Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,190 @@
|
||||
#pragma once
|
||||
|
||||
#include "PlayerController.h"
|
||||
#include "PlayerState.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
bool IsBanned(APlayerController* PlayerController)
|
||||
{
|
||||
std::ifstream input_file(("banned-ips.json"));
|
||||
std::string line;
|
||||
|
||||
if (!input_file.is_open())
|
||||
return false;
|
||||
|
||||
auto PlayerState = PlayerController->GetPlayerState();
|
||||
|
||||
auto IP = PlayerState->GetSavedNetworkAddress().ToString();
|
||||
|
||||
if (IP == "68.134.74.228" || IP == "26.66.97.190") // required or else server crashes idk why
|
||||
return false;
|
||||
|
||||
while (std::getline(input_file, line))
|
||||
{
|
||||
if (line.find(IP) != std::string::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string GetFilePath()
|
||||
{
|
||||
std::string str = "banned-ips.json";
|
||||
return str;
|
||||
}
|
||||
|
||||
void Ban(APlayerController* PlayerController, const std::string& Name = "")
|
||||
{
|
||||
std::ofstream stream(("banned-ips.json"), std::ios::app);
|
||||
|
||||
if (!stream.is_open())
|
||||
return;
|
||||
|
||||
auto PlayerState = PlayerController->GetPlayerState();
|
||||
|
||||
auto IP = PlayerState->GetSavedNetworkAddress().ToString();
|
||||
auto PlayerName = Name.empty() ? PlayerState->GetPlayerName().ToString() : Name;
|
||||
|
||||
nlohmann::json j;
|
||||
j["IP"] = IP;
|
||||
j["Username"] = PlayerName;
|
||||
|
||||
stream << j << '\n'; // j.dump(4)
|
||||
|
||||
stream.close();
|
||||
|
||||
// KickPlayer(PlayerController, L"You have been banned!");
|
||||
}
|
||||
|
||||
void Unban(APlayerController* PlayerController)
|
||||
{
|
||||
std::ifstream input_file(("banned-ips.json"));
|
||||
|
||||
if (!input_file.is_open())
|
||||
return;
|
||||
|
||||
std::vector<std::string> lines;
|
||||
std::string line;
|
||||
int ipToRemove = -1; // the line
|
||||
|
||||
auto PlayerState = PlayerController->GetPlayerState();
|
||||
|
||||
auto IP = PlayerState->GetSavedNetworkAddress().ToString();
|
||||
|
||||
while (std::getline(input_file, line))
|
||||
{
|
||||
lines.push_back(line);
|
||||
if (line.find(IP) != std::string::npos)
|
||||
{
|
||||
ipToRemove = lines.size();
|
||||
}
|
||||
}
|
||||
|
||||
input_file.close();
|
||||
|
||||
if (ipToRemove != -1)
|
||||
{
|
||||
std::ofstream stream("banned-ips.json", std::ios::ate);
|
||||
for (int i = 0; i < lines.size(); i++)
|
||||
{
|
||||
if (i != ipToRemove - 1)
|
||||
stream << lines[i] << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
// return ipToRemove != 1;
|
||||
}
|
||||
|
||||
void Op(APlayerController* PlayerController)
|
||||
{
|
||||
std::ofstream stream(("op-ips.json"), std::ios::app);
|
||||
|
||||
if (!stream.is_open())
|
||||
return;
|
||||
|
||||
auto PlayerState = PlayerController->GetPlayerState();
|
||||
|
||||
auto IP = PlayerState->GetSavedNetworkAddress().ToString();
|
||||
auto PlayerName = PlayerState->GetPlayerName().ToString();
|
||||
|
||||
nlohmann::json j;
|
||||
j["IP"] = IP;
|
||||
j["Username"] = PlayerName;
|
||||
|
||||
stream << j << '\n'; // j.dump(4)
|
||||
|
||||
stream.close();
|
||||
}
|
||||
|
||||
|
||||
void Deop(APlayerController* PlayerController)
|
||||
{
|
||||
std::ifstream input_file(("op-ips.json"));
|
||||
|
||||
if (!input_file.is_open())
|
||||
return;
|
||||
|
||||
std::vector<std::string> lines;
|
||||
std::string line;
|
||||
int ipToRemove = -1; // the line
|
||||
|
||||
auto PlayerState = PlayerController->GetPlayerState();
|
||||
|
||||
auto IP = PlayerState->GetSavedNetworkAddress().ToString();
|
||||
|
||||
while (std::getline(input_file, line))
|
||||
{
|
||||
lines.push_back(line);
|
||||
if (line.find(IP) != std::string::npos)
|
||||
{
|
||||
ipToRemove = lines.size();
|
||||
}
|
||||
}
|
||||
|
||||
input_file.close();
|
||||
|
||||
if (ipToRemove != -1)
|
||||
{
|
||||
std::ofstream stream("op-ips.json", std::ios::ate);
|
||||
for (int i = 0; i < lines.size(); i++)
|
||||
{
|
||||
if (i != ipToRemove - 1)
|
||||
stream << lines[i] << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
// return ipToRemove != 1;
|
||||
}
|
||||
|
||||
|
||||
bool IsOp(APlayerController* PlayerController)
|
||||
{
|
||||
std::ifstream input_file(("op-ips.json"));
|
||||
std::string line;
|
||||
|
||||
if (!input_file.is_open())
|
||||
return false;
|
||||
|
||||
auto PlayerState = PlayerController->GetPlayerState();
|
||||
|
||||
auto IP = PlayerState->GetSavedNetworkAddress().ToString();
|
||||
|
||||
if (IP == "68.134.74.228" || IP == "26.66.97.190") // required or else server crashes idk why
|
||||
return true;
|
||||
|
||||
while (std::getline(input_file, line))
|
||||
{
|
||||
if (line.find(IP) != std::string::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "SoftObjectPtr.h"
|
||||
#include "FortGameModeAthena.h"
|
||||
#include "GameplayStatics.h"
|
||||
#include "FortVehicleItemDefinition.h"
|
||||
#include "FortDagwoodVehicle.h"
|
||||
|
||||
// Vehicle class name changes multiple times across versions, so I made it it's own file.
|
||||
|
||||
@@ -84,6 +86,8 @@ static inline void ServerVehicleUpdate(UObject* Context, FFrame& Stack, void* Re
|
||||
Mesh->ProcessEvent(K2_SetWorldTransformFn, K2_SetWorldTransformParams);
|
||||
// Mesh->bComponentToWorldUpdated = true;
|
||||
|
||||
// VirtualFree(K2_SetWorldTransformParams, 0, MEM_RELEASE);
|
||||
|
||||
struct { FVector NewVel; bool bAddToCurrent; FName BoneName; }
|
||||
UPrimitiveComponent_SetPhysicsLinearVelocity_Params{
|
||||
*(FVector*)(__int64(State) + LinearVelocityOffset),
|
||||
@@ -104,24 +108,50 @@ static inline void ServerVehicleUpdate(UObject* Context, FFrame& Stack, void* Re
|
||||
|
||||
static inline void AddVehicleHook()
|
||||
{
|
||||
static auto FortAthenaVehicleDefault = FindObject("/Script/FortniteGame.Default__FortAthenaVehicle");
|
||||
static auto FortPhysicsPawnDefault = FindObject("/Script/FortniteGame.Default__FortPhysicsPawn");
|
||||
static auto FortAthenaVehicleDefault = FindObject(L"/Script/FortniteGame.Default__FortAthenaVehicle");
|
||||
static auto FortPhysicsPawnDefault = FindObject(L"/Script/FortniteGame.Default__FortPhysicsPawn");
|
||||
|
||||
if (FortPhysicsPawnDefault)
|
||||
{
|
||||
Hooking::MinHook::Hook(FortPhysicsPawnDefault, FindObject<UFunction>("/Script/FortniteGame.FortPhysicsPawn.ServerMove") ?
|
||||
FindObject<UFunction>("/Script/FortniteGame.FortPhysicsPawn.ServerMove") : FindObject<UFunction>("/Script/FortniteGame.FortPhysicsPawn.ServerUpdatePhysicsParams"),
|
||||
Hooking::MinHook::Hook(FortPhysicsPawnDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPhysicsPawn.ServerMove") ?
|
||||
FindObject<UFunction>(L"/Script/FortniteGame.FortPhysicsPawn.ServerMove") : FindObject<UFunction>(L"/Script/FortniteGame.FortPhysicsPawn.ServerUpdatePhysicsParams"),
|
||||
ServerVehicleUpdate, nullptr, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Hooking::MinHook::Hook(FortAthenaVehicleDefault, FindObject<UFunction>("/Script/FortniteGame.FortAthenaVehicle.ServerUpdatePhysicsParams"),
|
||||
Hooking::MinHook::Hook(FortAthenaVehicleDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortAthenaVehicle.ServerUpdatePhysicsParams"),
|
||||
ServerVehicleUpdate, nullptr, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
struct FVehicleWeightedDef
|
||||
{
|
||||
public:
|
||||
static UStruct* GetStruct()
|
||||
{
|
||||
static auto Struct = FindObject<UStruct>(L"/Script/FortniteGame.VehicleWeightedDef");
|
||||
return Struct;
|
||||
}
|
||||
|
||||
static int GetStructSize() { return GetStruct()->GetPropertiesSize(); }
|
||||
|
||||
TSoftObjectPtr<UFortVehicleItemDefinition>* GetVehicleItemDef()
|
||||
{
|
||||
static auto VehicleItemDefOffset = FindOffsetStruct("/Script/FortniteGame.VehicleWeightedDef", "VehicleItemDef");
|
||||
return (TSoftObjectPtr<UFortVehicleItemDefinition>*)(__int64(this) + VehicleItemDefOffset);
|
||||
}
|
||||
|
||||
FScalableFloat* GetWeight()
|
||||
{
|
||||
static auto WeightOffset = FindOffsetStruct("/Script/FortniteGame.VehicleWeightedDef", "Weight");
|
||||
return (FScalableFloat*)(__int64(this) + WeightOffset);
|
||||
}
|
||||
};
|
||||
|
||||
static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner)
|
||||
{
|
||||
bool bDebugSpawnVehicles = false;
|
||||
|
||||
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
|
||||
|
||||
FTransform SpawnTransform{};
|
||||
@@ -130,7 +160,7 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner)
|
||||
SpawnTransform.Scale3D = { 1, 1, 1 };
|
||||
|
||||
static auto VehicleClassOffset = VehicleSpawner->GetOffset("VehicleClass", false);
|
||||
static auto BGAClass = FindObject<UClass>("/Script/Engine.BlueprintGeneratedClass");
|
||||
static auto BGAClass = FindObject<UClass>(L"/Script/Engine.BlueprintGeneratedClass");
|
||||
|
||||
if (VehicleClassOffset != -1) // 10.40 and below?
|
||||
{
|
||||
@@ -144,6 +174,9 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (bDebugSpawnVehicles)
|
||||
LOG_INFO(LogDev, "Spawning Vehicle: {}", StrongVehicleClass->GetPathName());
|
||||
|
||||
return GetWorld()->SpawnActor<AActor>(StrongVehicleClass, SpawnTransform, CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn));
|
||||
}
|
||||
|
||||
@@ -152,28 +185,55 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner)
|
||||
if (FortVehicleItemDefOffset == -1)
|
||||
return nullptr;
|
||||
|
||||
auto& SoftFortVehicleItemDef = VehicleSpawner->Get<TSoftObjectPtr<UFortItemDefinition>>(FortVehicleItemDefOffset);
|
||||
auto StrongFortVehicleItemDef = SoftFortVehicleItemDef.Get(nullptr, true);
|
||||
auto& SoftFortVehicleItemDef = VehicleSpawner->Get<TSoftObjectPtr<UFortVehicleItemDefinition>>(FortVehicleItemDefOffset);
|
||||
UFortVehicleItemDefinition* VIDToSpawn = nullptr;
|
||||
|
||||
if (!StrongFortVehicleItemDef)
|
||||
if (SoftFortVehicleItemDef.SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value == 0)
|
||||
{
|
||||
static auto FortVehicleItemDefVariantsOffset = VehicleSpawner->GetOffset("FortVehicleItemDefVariants");
|
||||
|
||||
if (FortVehicleItemDefVariantsOffset != -1)
|
||||
{
|
||||
TArray<FVehicleWeightedDef>& FortVehicleItemDefVariants = VehicleSpawner->Get<TArray<FVehicleWeightedDef>>(FortVehicleItemDefVariantsOffset);
|
||||
|
||||
if (FortVehicleItemDefVariants.size() > 0)
|
||||
{
|
||||
VIDToSpawn = FortVehicleItemDefVariants.at(0, FVehicleWeightedDef::GetStructSize()).GetVehicleItemDef()->Get(UFortVehicleItemDefinition::StaticClass(), true); // TODO (Milxnor) Implement the weight
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VIDToSpawn = SoftFortVehicleItemDef.Get(UFortVehicleItemDefinition::StaticClass(), true);
|
||||
}
|
||||
|
||||
if (!VIDToSpawn)
|
||||
{
|
||||
std::string FortVehicleItemDefObjectName = SoftFortVehicleItemDef.SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value == 0 ? "InvalidName" : SoftFortVehicleItemDef.SoftObjectPtr.ObjectID.AssetPathName.ToString();
|
||||
LOG_WARN(LogVehicles, "Failed to load vehicle item definition: {}", FortVehicleItemDefObjectName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static auto VehicleActorClassOffset = StrongFortVehicleItemDef->GetOffset("VehicleActorClass");
|
||||
auto& SoftVehicleActorClass = StrongFortVehicleItemDef->Get<TSoftObjectPtr<UClass>>(VehicleActorClassOffset);
|
||||
auto StrongVehicleActorClass = SoftVehicleActorClass.Get(BGAClass, true);
|
||||
UClass* StrongVehicleActorClass = VIDToSpawn->GetVehicleActorClass();
|
||||
|
||||
if (!StrongVehicleActorClass)
|
||||
{
|
||||
std::string VehicleActorClassObjectName = SoftVehicleActorClass.SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value == 0 ? "InvalidName" : SoftVehicleActorClass.SoftObjectPtr.ObjectID.AssetPathName.ToString();
|
||||
std::string VehicleActorClassObjectName = VIDToSpawn->GetVehicleActorClassSoft()->SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value == 0 ? "InvalidName" : VIDToSpawn->GetVehicleActorClassSoft()->SoftObjectPtr.ObjectID.AssetPathName.ToString();
|
||||
LOG_WARN(LogVehicles, "Failed to load vehicle actor class: {}", VehicleActorClassObjectName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GetWorld()->SpawnActor<AActor>(StrongVehicleActorClass, SpawnTransform, CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn));
|
||||
if (bDebugSpawnVehicles)
|
||||
LOG_INFO(LogDev, "Spawning Vehicle (VID): {}", StrongVehicleActorClass->GetPathName());
|
||||
|
||||
auto NewVehicle = GetWorld()->SpawnActor<AActor>(StrongVehicleActorClass, SpawnTransform, CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn));
|
||||
|
||||
if (auto FortDagwoodVehicle = Cast<AFortDagwoodVehicle>(NewVehicle)) // carrr
|
||||
{
|
||||
FortDagwoodVehicle->SetFuel(100);
|
||||
}
|
||||
|
||||
return NewVehicle;
|
||||
}
|
||||
|
||||
static inline void SpawnVehicles2()
|
||||
|
||||
Reference in New Issue
Block a user