[Performance] Server Reload Overhaul (#4689)

* [Performance] Server Reload Overhaul

* Client::SendReloadCommandMessages

* Remove global buffs
This commit is contained in:
Chris Miles
2025-02-18 00:54:37 -06:00
committed by GitHub
parent 49cf97ae9c
commit 1bd281c8f2
24 changed files with 607 additions and 1258 deletions
+1
View File
@@ -645,6 +645,7 @@ SET(common_headers
server_event_scheduler.h
serverinfo.h
servertalk.h
server_reload_types.h
shared_tasks.h
shareddb.h
skills.h
+143
View File
@@ -0,0 +1,143 @@
#ifndef EQEMU_SERVER_RELOAD_TYPES_H
#define EQEMU_SERVER_RELOAD_TYPES_H
#include <string>
#include <vector>
#include <cstdint>
namespace ServerReload {
enum Type {
ReloadTypeNone = 0,
AAData,
AlternateCurrencies,
BaseData,
BlockedSpells,
Commands,
ContentFlags,
DataBucketsCache,
Doors,
DzTemplates,
Factions,
GroundSpawns,
LevelEXPMods,
Logs,
Loot,
Merchants,
NPCEmotes,
NPCSpells,
Objects,
Opcodes,
PerlExportSettings,
Quests,
QuestsTimerReset,
Rules,
SkillCaps,
StaticZoneData,
Tasks,
Titles,
Traps,
Variables,
VeteranRewards,
WorldRepop,
WorldWithRespawn,
ZoneData,
ZonePoints,
Max
};
static const char *Name[ServerReload::Max] = {
"None",
"AA Data",
"Alternate Currencies",
"Base Data",
"Blocked Spells",
"Commands",
"Content Flags",
"Data Buckets Cache",
"Doors",
"DZ Templates",
"Factions",
"Ground Spawns",
"Level EXP Mods",
"Logs",
"Loot",
"Merchants",
"NPC Emotes",
"NPC Spells",
"Objects",
"Opcodes",
"Perl Event Export Settings",
"Quests",
"Quests With Timer (Resets timer events)",
"Rules",
"Skill Caps",
"Static Zone Data",
"Tasks",
"Titles",
"Traps",
"Variables",
"Veteran Rewards",
"World Repop",
"World Repop Timers (Clear Respawn Timers)",
"Zone Data",
"Zone Points"
};
inline std::string GetName(int reload_type)
{
if (reload_type < 0 || reload_type >= ServerReload::Type::Max) {
return "Unknown";
}
return ServerReload::Name[reload_type];
}
// Get a clean name without spaces or special characters
inline std::string GetNameClean(int reload_type)
{
if (reload_type < 0 || reload_type >= ServerReload::Type::Max) {
return "Unknown";
}
// get the name before parentheses
std::string name = ServerReload::Name[reload_type];
size_t pos = name.find('(');
if (pos != std::string::npos) {
name = name.substr(0, pos);
}
// Trim leading spaces
size_t start = name.find_first_not_of(' ');
if (start == std::string::npos) {
return ""; // If all spaces, return empty string
}
// Trim trailing spaces
size_t end = name.find_last_not_of(' ');
// Extract trimmed substring
return name.substr(start, end - start + 1);
return name;
}
inline std::vector<ServerReload::Type> GetTypes()
{
std::vector<ServerReload::Type> types;
types.reserve(ServerReload::Type::Max);
for (int i = 1; i < ServerReload::Type::Max; i++) {
types.push_back(static_cast<ServerReload::Type>(i));
}
return types;
}
struct Request {
int type = 0;
bool requires_zone_booted = false;
int64 reload_at_unix = 0;
int32 opt_param = 0;
uint32_t zone_server_id = 0;
};
}
#endif //EQEMU_SERVER_RELOAD_TYPES_H
+1 -31
View File
@@ -248,37 +248,7 @@
#define ServerOP_UpdateSchedulerEvents 0x4007
#define ServerOP_DiscordWebhookMessage 0x4008
#define ServerOP_ReloadAAData 0x4100
#define ServerOP_ReloadAlternateCurrencies 0x4101
#define ServerOP_ReloadBlockedSpells 0x4102
#define ServerOP_ReloadCommands 0x4103
#define ServerOP_ReloadContentFlags 0x4104
#define ServerOP_ReloadDoors 0x4105
#define ServerOP_ReloadGroundSpawns 0x4106
#define ServerOP_ReloadLevelEXPMods 0x4107
#define ServerOP_ReloadLogs 0x4108
#define ServerOP_ReloadMerchants 0x4109
#define ServerOP_ReloadNPCEmotes 0x4110
#define ServerOP_ReloadObjects 0x4111
#define ServerOP_ReloadOpcodes 0x4112
#define ServerOP_ReloadPerlExportSettings 0x4113
#define ServerOP_ReloadRules 0x4114
#define ServerOP_ReloadStaticZoneData 0x4115
#define ServerOP_ReloadTasks 0x4116
#define ServerOP_ReloadTitles 0x4117
#define ServerOP_ReloadTraps 0x4118
#define ServerOP_ReloadVariables 0x4119
#define ServerOP_ReloadVeteranRewards 0x4120
#define ServerOP_ReloadWorld 0x4121
#define ServerOP_ReloadZonePoints 0x4122
#define ServerOP_ReloadDzTemplates 0x4123
#define ServerOP_ReloadZoneData 0x4124
#define ServerOP_ReloadDataBucketsCache 0x4125
#define ServerOP_ReloadFactions 0x4126
#define ServerOP_ReloadLoot 0x4127
#define ServerOP_ReloadBaseData 0x4128
#define ServerOP_ReloadSkillCaps 0x4129
#define ServerOP_ReloadNPCSpells 0x4130
#define ServerOP_ServerReloadRequest 0x4100
#define ServerOP_CZDialogueWindow 0x4500
#define ServerOP_CZLDoNUpdate 0x4501
+24
View File
@@ -912,3 +912,27 @@ std::string Strings::ZoneTime(const uint8 hours, const uint8 minutes)
hours >= 13 ? "PM" : "AM"
);
}
std::string Strings::Slugify(const std::string& input, const std::string& separator) {
std::string slug;
bool last_was_hyphen = false;
for (char c : input) {
if (std::isalnum(c)) {
slug += std::tolower(c);
last_was_hyphen = false;
} else if (c == ' ' || c == '_' || c == '-') {
if (!last_was_hyphen && !slug.empty()) {
slug += separator;
last_was_hyphen = true;
}
}
}
// Remove trailing hyphen if present
if (!slug.empty() && slug.back() == '-') {
slug.pop_back();
}
return slug;
}
+2
View File
@@ -186,6 +186,8 @@ public:
value = strtod(tmp_str.data(), nullptr);
return res;
}
static std::string Slugify(const std::string &input, const std::string &separator = "-");
};
const std::string StringFormat(const char *format, ...);