From 7549fbbeeab1ba79f6c198288c20b2e1a0e581c1 Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Fri, 6 May 2022 22:31:17 -0400 Subject: [PATCH] [Commands] Cleanup #reloadlevelmods Command. (#2122) * [Commands] Cleanup #reloadlevelmods Command. - Cleanup messages and logic. - Make the reloading of modifiers global instead of zone-specific. * Remove unnecessary message. * Update worldserver.cpp * Update worldserver.cpp * Update worldserver.cpp --- common/servertalk.h | 1 + world/zoneserver.cpp | 5 +++++ zone/command.cpp | 2 +- zone/gm_commands/reloadlevelmods.cpp | 16 +++++++-------- zone/worldserver.cpp | 29 ++++++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 9 deletions(-) diff --git a/common/servertalk.h b/common/servertalk.h index 0e09091d1..a59bfae03 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -228,6 +228,7 @@ #define ServerOP_UpdateSchedulerEvents 0x4012 #define ServerOP_ReloadContentFlags 0x4013 #define ServerOP_ReloadVariablesWorld 0x4014 +#define ServerOP_ReloadLevelEXPMods 0x4015 #define ServerOP_ReloadMerchants 0x4016 #define ServerOP_ReloadAAData 0x4017 #define ServerOP_ReloadStaticZoneData 0x4020 diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 9173805f6..5a1641f81 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -889,6 +889,11 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) { zoneserver_list.SendPacket(pack); break; } + case ServerOP_ReloadLevelEXPMods: + { + zoneserver_list.SendPacket(pack); + break; + } case ServerOP_ReloadAAData: { zoneserver_list.SendPacket(pack); diff --git a/zone/command.cpp b/zone/command.cpp index 6550531ad..dcef4e6af 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -287,7 +287,7 @@ int command_init(void) command_add("reloadallrules", "Executes a reload of all rules globally.", AccountStatus::QuestTroupe, command_reloadallrules) || command_add("reloadcontentflags", "Executes a reload of all expansion and content flags", AccountStatus::QuestTroupe, command_reloadcontentflags) || command_add("reloademote", "Reloads NPC Emotes", AccountStatus::QuestTroupe, command_reloademote) || - command_add("reloadlevelmods", nullptr, AccountStatus::Max, command_reloadlevelmods) || + command_add("reloadlevelmods", "Reloads level based experience modifiers globally", AccountStatus::Max, command_reloadlevelmods) || command_add("reloadmerchants", "Reloads merchant lists globally", AccountStatus::Max, command_reloadmerchants) || command_add("reloadperlexportsettings", "Reloads Perl event export settings globally", AccountStatus::Max, command_reloadperlexportsettings) || command_add("reloadqst", " - Clear quest cache (any argument causes it to also stop all timers)", AccountStatus::GMLeadAdmin, command_reloadqst) || diff --git a/zone/gm_commands/reloadlevelmods.cpp b/zone/gm_commands/reloadlevelmods.cpp index 29ce28c11..87217744f 100755 --- a/zone/gm_commands/reloadlevelmods.cpp +++ b/zone/gm_commands/reloadlevelmods.cpp @@ -2,14 +2,14 @@ void command_reloadlevelmods(Client *c, const Seperator *sep) { - if (sep->arg[1][0] == 0) { - if (RuleB(Zone, LevelBasedEXPMods)) { - zone->LoadLevelEXPMods(); - c->Message(Chat::Yellow, "Level based EXP Mods have been reloaded zonewide"); - } - else { - c->Message(Chat::Yellow, "Level based EXP Mods are disabled in rules!"); - } + if (!RuleB(Zone, LevelBasedEXPMods)) { + c->Message(Chat::White, "Level based experience modifiers are disabled."); + return; } + + c->Message(Chat::White, "Attempted to reload level based experience modifiers globally."); + auto pack = new ServerPacket(ServerOP_ReloadLevelEXPMods, 0); + worldserver.SendPacket(pack); + safe_delete(pack); } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 06ce894b6..ded148c2d 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -2073,6 +2073,35 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) parse->LoadPerlEventExportSettings(parse->perl_event_export_settings); break; } + case ServerOP_ReloadLevelEXPMods: { + if (zone) { + worldserver.SendEmoteMessage( + 0, + 0, + AccountStatus::GMAdmin, + Chat::Yellow, + fmt::format( + "Level based experience modifiers reloaded for {}{}.", + fmt::format( + "{} ({})", + zone->GetLongName(), + zone->GetZoneID() + ), + ( + zone->GetInstanceID() ? + fmt::format( + " (Instance ID {})", + zone->GetInstanceID() + ) : + "" + ) + ).c_str() + ); + + zone->LoadLevelEXPMods(); + } + break; + } case ServerOP_ReloadAAData: { if (zone) { worldserver.SendEmoteMessage(