custom map support

This commit is contained in:
Milxnor
2023-06-17 22:33:44 -04:00
parent b944b40b36
commit 5f51e034b0
4 changed files with 50 additions and 20 deletions

View File

@@ -577,24 +577,24 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
}
}
// if (!Globals::bCreative) // ??
{
static auto FortPlayerStartCreativeClass = FindObject<UClass>(L"/Script/FortniteGame.FortPlayerStartCreative");
static auto FortPlayerStartWarmupClass = FindObject<UClass>(L"/Script/FortniteGame.FortPlayerStartWarmup");
TArray<AActor*> Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), Globals::bCreative ? FortPlayerStartCreativeClass : FortPlayerStartWarmupClass);
static auto FortPlayerStartCreativeClass = FindObject<UClass>(L"/Script/FortniteGame.FortPlayerStartCreative");
static auto FortPlayerStartWarmupClass = FindObject<UClass>(L"/Script/FortniteGame.FortPlayerStartWarmup");
TArray<AActor*> Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), Globals::bCreative ? FortPlayerStartCreativeClass : FortPlayerStartWarmupClass);
int ActorsNum = Actors.Num();
int ActorsNum = Actors.Num();
Actors.Free();
Actors.Free();
if (ActorsNum == 0)
return false;
}
if (ActorsNum == 0)
return false;
auto MapInfo = GameState->GetMapInfo();
if (!MapInfo && Engine_Version >= 421)
return false;
if (!bUseCustomMap)
{
if (!MapInfo && Engine_Version >= 421)
return false;
}
static int LastNum = 1;

View File

@@ -459,16 +459,27 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
auto& weaponName = Arguments[1];
int count = 1;
int amount = 1;
try
{
if (NumArgs >= 2)
count = std::stoi(Arguments[2]);
if (NumArgs >= 3)
amount = std::stoi(Arguments[3]);
}
catch (...)
{
}
constexpr int Max = 100;
if (amount > Max)
{
SendMessageToConsole(PlayerController, (std::wstring(L"You went over the limit! Only spawning ") + std::to_wstring(Max) + L".").c_str());
amount = Max;
}
// LOG_INFO(LogDev, "weaponName: {}", weaponName);
auto WID = Cast<UFortWorldItemDefinition>(FindObject(weaponName, nullptr, ANY_PACKAGE));
@@ -488,7 +499,10 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
CreateData.SpawnLocation = Location;
CreateData.bShouldFreeItemEntryWhenDeconstructed = true;
AFortPickup::SpawnPickup(CreateData);
for (int i = 0; i < amount; i++)
{
AFortPickup::SpawnPickup(CreateData);
}
}
else if (Command == "listplayers")
{
@@ -875,7 +889,7 @@ cheat pausesafezone - Pauses the zone.
cheat sethealth <Health=100.f> - Sets executing player's health.
cheat setshield <Shield=0.f> - Sets executing player's shield.
cheat applycid <CIDShortName> - Sets a player's character.
cheat spawnpickup <ShortWID> - Spawns a pickup at specified player.
cheat spawnpickup <ShortWID> <ItemCount=1> <PickupCount=1> - Spawns a pickup at specified player.
cheat teleport - Teleports to what the player is looking at.
cheat spawnbot <Amount=1> - Spawns a bot at the player (experimental).
cheat setpickaxe <PickaxeID> - Set player's pickaxe.

View File

@@ -258,21 +258,26 @@ void ChangeLevels()
LOG_INFO(LogDev, "FindGIsClient(): 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0)));
FString LevelB = Engine_Version < 424
// auto bruh = std::wstring(CustomMapName.begin(), CustomMapName.end());
// auto bruhh = (L"open " + bruh);
FString LevelB = /* bUseCustomMap ? bruhh.c_str() : */ (Engine_Version < 424
? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501
? L"open Asteria_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Artemis_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Apollo_Terrain";
: L"open Apollo_Terrain");
FString Level = Engine_Version < 424
FString Level = /* bUseCustomMap ? bruh.c_str() : */ (Engine_Version < 424
? L"Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501
? L"Asteria_Terrain"
: Globals::bCreative ? L"Creative_NoApollo_Terrain"
: L"Artemis_Terrain"
: Globals::bCreative ? L"Creative_NoApollo_Terrain"
: L"Apollo_Terrain";
: L"Apollo_Terrain");
LOG_INFO(LogDev, "Using {}.", bUseSwitchLevel ? Level.ToString() : LevelB.ToString());
if (bUseSwitchLevel)
{

View File

@@ -61,6 +61,8 @@
#define LOADOUT_PLAYERTAB 4
#define FUN_PLAYERTAB 5
extern inline bool bUseCustomMap = false;
extern inline std::string CustomMapName = "";
extern inline int AmountToSubtractIndex = 1;
extern inline int SecondsUntilTravel = 5;
extern inline bool bSwitchedInitialLevel = false;
@@ -1291,8 +1293,17 @@ static inline void PregameUI()
}
if (!bSwitchedInitialLevel)
{
ImGui::Checkbox("Use Custom Map", &bUseCustomMap);
if (bUseCustomMap)
{
// ImGui::InputText("Custom Map", &CustomMapName);
}
ImGui::SliderInt("Seconds until load into map", &SecondsUntilTravel, 1, 100);
}
if (!Globals::bCreative)
ImGui::InputText("Playlist", &PlaylistName);
}