Make CDUmper formatting better and change the way random name works

This commit is contained in:
LightCat 2019-04-18 22:23:07 +02:00
parent a27734eb88
commit 43f207bc35
4 changed files with 19 additions and 8 deletions

View File

@ -70,7 +70,7 @@ public:
for (int j = 0; j < iLevel; j++)
{
m_file << "\t";
m_file << " ";
}
m_file << pTable->GetName() << "\n";
@ -96,7 +96,7 @@ public:
}
for (int j = 0; j < iLevel; j++)
m_file << "\t";
m_file << " ";
int offset = pProp->GetOffset();
SendPropType type = pProp->GetType();

View File

@ -9,6 +9,7 @@
static settings::String ipc_name{ "name.ipc", "" };
settings::String force_name{ "name.custom", "" };
std::string name_forced = "";
static settings::Int namesteal{ "name.namesteal", "0" };
static std::string stolen_name;
@ -142,6 +143,13 @@ const char *GetNamestealName(CSteamID steam_id)
return new_name.c_str();
}
if (name_forced.size() > 1 && steam_id == g_ISteamUser->GetSteamID())
{
auto new_name = name_forced;
ReplaceSpecials(new_name);
return new_name.c_str();
}
return nullptr;
}
namespace hooked_methods

View File

@ -16,6 +16,7 @@ static settings::Bool halloween_mode{ "misc.force-halloween", "false" };
static settings::Int skybox_changer{ "misc.skybox-override", "0" };
extern settings::Bool random_name;
extern settings::String force_name;
extern std::string name_forced;
const char *skynum[] = { "", "sky_tf2_04", "sky_upward", "sky_dustbowl_01", "sky_goldrush_01", "sky_granary_01", "sky_well_01", "sky_gravel_01", "sky_badlands_01", "sky_hydro_01", "sky_night_01", "sky_nightfall_01", "sky_trainyard_01", "sky_stormfront_01", "sky_morningsnow_01", "sky_alpinestorm_01", "sky_harvest_01", "sky_harvest_night_01", "sky_halloween", "sky_halloween_night_01", "sky_halloween_night2014_01", "sky_island_01", "sky_jungle_01", "sky_invasion2fort_01", "sky_well_02", "sky_outpost_01", "sky_coastal_01", "sky_rainbow_01", "sky_badlands_pyroland_01", "sky_pyroland_01", "sky_pyroland_02", "sky_pyroland_03" };
@ -61,14 +62,13 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_connected = time(nullptr);
}
#endif
if (*random_name && *force_name == "")
if (*random_name)
{
static TextFile file;
if (file.TryLoad("names.txt"))
{
force_name = file.lines.at(rand() % file.lines.size());
g_IEngine->ClientCmd_Unrestricted("retry");
}
name_forced = file.lines.at(rand() % file.lines.size());
}
else
name_forced = "";
}
} // namespace hooked_methods

View File

@ -12,6 +12,7 @@ static settings::Bool autoabandon{ "misc.auto-abandon", "false" };
static settings::String custom_disconnect_reason{ "misc.disconnect-reason", "" };
settings::Bool random_name{ "misc.random-name", "false" };
extern settings::String force_name;
extern std::string name_forced;
namespace hooked_methods
{
@ -48,8 +49,10 @@ DEFINE_HOOKED_METHOD(Shutdown, void, INetChannel *this_, const char *reason)
static TextFile file;
if (file.TryLoad("names.txt"))
{
force_name = file.lines.at(rand() % file.lines.size());
name_forced = file.lines.at(rand() % file.lines.size());
}
}
else
name_forced = "";
}
} // namespace hooked_methods