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

View File

@@ -459,16 +459,27 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
auto& weaponName = Arguments[1]; auto& weaponName = Arguments[1];
int count = 1; int count = 1;
int amount = 1;
try try
{ {
if (NumArgs >= 2) if (NumArgs >= 2)
count = std::stoi(Arguments[2]); count = std::stoi(Arguments[2]);
if (NumArgs >= 3)
amount = std::stoi(Arguments[3]);
} }
catch (...) 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); // LOG_INFO(LogDev, "weaponName: {}", weaponName);
auto WID = Cast<UFortWorldItemDefinition>(FindObject(weaponName, nullptr, ANY_PACKAGE)); auto WID = Cast<UFortWorldItemDefinition>(FindObject(weaponName, nullptr, ANY_PACKAGE));
@@ -488,8 +499,11 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
CreateData.SpawnLocation = Location; CreateData.SpawnLocation = Location;
CreateData.bShouldFreeItemEntryWhenDeconstructed = true; CreateData.bShouldFreeItemEntryWhenDeconstructed = true;
for (int i = 0; i < amount; i++)
{
AFortPickup::SpawnPickup(CreateData); AFortPickup::SpawnPickup(CreateData);
} }
}
else if (Command == "listplayers") else if (Command == "listplayers")
{ {
std::string PlayerNames; std::string PlayerNames;
@@ -875,7 +889,7 @@ cheat pausesafezone - Pauses the zone.
cheat sethealth <Health=100.f> - Sets executing player's health. cheat sethealth <Health=100.f> - Sets executing player's health.
cheat setshield <Shield=0.f> - Sets executing player's shield. cheat setshield <Shield=0.f> - Sets executing player's shield.
cheat applycid <CIDShortName> - Sets a player's character. 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 teleport - Teleports to what the player is looking at.
cheat spawnbot <Amount=1> - Spawns a bot at the player (experimental). cheat spawnbot <Amount=1> - Spawns a bot at the player (experimental).
cheat setpickaxe <PickaxeID> - Set player's pickaxe. 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))); 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 Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501
? L"open Asteria_Terrain" ? L"open Asteria_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain" : Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Artemis_Terrain" : L"open Artemis_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_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"Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501
? L"Asteria_Terrain" ? L"Asteria_Terrain"
: Globals::bCreative ? L"Creative_NoApollo_Terrain" : Globals::bCreative ? L"Creative_NoApollo_Terrain"
: L"Artemis_Terrain" : L"Artemis_Terrain"
: Globals::bCreative ? L"Creative_NoApollo_Terrain" : Globals::bCreative ? L"Creative_NoApollo_Terrain"
: L"Apollo_Terrain"; : L"Apollo_Terrain");
LOG_INFO(LogDev, "Using {}.", bUseSwitchLevel ? Level.ToString() : LevelB.ToString());
if (bUseSwitchLevel) if (bUseSwitchLevel)
{ {

View File

@@ -61,6 +61,8 @@
#define LOADOUT_PLAYERTAB 4 #define LOADOUT_PLAYERTAB 4
#define FUN_PLAYERTAB 5 #define FUN_PLAYERTAB 5
extern inline bool bUseCustomMap = false;
extern inline std::string CustomMapName = "";
extern inline int AmountToSubtractIndex = 1; extern inline int AmountToSubtractIndex = 1;
extern inline int SecondsUntilTravel = 5; extern inline int SecondsUntilTravel = 5;
extern inline bool bSwitchedInitialLevel = false; extern inline bool bSwitchedInitialLevel = false;
@@ -1291,7 +1293,16 @@ static inline void PregameUI()
} }
if (!bSwitchedInitialLevel) 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); ImGui::SliderInt("Seconds until load into map", &SecondsUntilTravel, 1, 100);
}
if (!Globals::bCreative) if (!Globals::bCreative)
ImGui::InputText("Playlist", &PlaylistName); ImGui::InputText("Playlist", &PlaylistName);