diff --git a/common/servertalk.h b/common/servertalk.h index ee1ead831..3ad54d289 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -226,25 +226,26 @@ #define ServerOP_ReloadAAData 0x4100 #define ServerOP_ReloadAlternateCurrencies 0x4101 #define ServerOP_ReloadBlockedSpells 0x4102 -#define ServerOP_ReloadContentFlags 0x4103 -#define ServerOP_ReloadDoors 0x4104 -#define ServerOP_ReloadGroundSpawns 0x4105 -#define ServerOP_ReloadLevelEXPMods 0x4106 -#define ServerOP_ReloadLogs 0x4107 -#define ServerOP_ReloadMerchants 0x4108 -#define ServerOP_ReloadNPCEmotes 0x4109 -#define ServerOP_ReloadObjects 0x4110 -#define ServerOP_ReloadPerlExportSettings 0x4111 -#define ServerOP_ReloadRules 0x4112 -#define ServerOP_ReloadStaticZoneData 0x4113 -#define ServerOP_ReloadTasks 0x4114 -#define ServerOP_ReloadTitles 0x4115 -#define ServerOP_ReloadTraps 0x4116 -#define ServerOP_ReloadVariables 0x4117 -#define ServerOP_ReloadVeteranRewards 0x4118 -#define ServerOP_ReloadWorld 0x4119 -#define ServerOP_ReloadZonePoints 0x4120 -#define ServerOP_ReloadDzTemplates 0x4121 +#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_ReloadPerlExportSettings 0x4112 +#define ServerOP_ReloadRules 0x4113 +#define ServerOP_ReloadStaticZoneData 0x4114 +#define ServerOP_ReloadTasks 0x4115 +#define ServerOP_ReloadTitles 0x4116 +#define ServerOP_ReloadTraps 0x4117 +#define ServerOP_ReloadVariables 0x4118 +#define ServerOP_ReloadVeteranRewards 0x4119 +#define ServerOP_ReloadWorld 0x4120 +#define ServerOP_ReloadZonePoints 0x4121 +#define ServerOP_ReloadDzTemplates 0x4122 #define ServerOP_CZDialogueWindow 0x4500 #define ServerOP_CZLDoNUpdate 0x4501 diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 04549b5b8..2d22e4a55 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -1307,6 +1307,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) { case ServerOP_ReloadAAData: case ServerOP_ReloadAlternateCurrencies: case ServerOP_ReloadBlockedSpells: + case ServerOP_ReloadCommands: case ServerOP_ReloadDoors: case ServerOP_ReloadGroundSpawns: case ServerOP_ReloadLevelEXPMods: diff --git a/zone/client.cpp b/zone/client.cpp index 5de9f4c57..602df6f8a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -9533,6 +9533,7 @@ void Client::ShowDevToolsMenu() std::string menu_reload_six; std::string menu_reload_seven; std::string menu_reload_eight; + std::string menu_reload_nine; std::string menu_toggle; /** @@ -9558,33 +9559,35 @@ void Client::ShowDevToolsMenu() menu_reload_one += Saylink::Silent("#reload aa", "AAs"); menu_reload_one += " | " + Saylink::Silent("#reload alternate_currencies", "Alternate Currencies"); menu_reload_one += " | " + Saylink::Silent("#reload blocked_spells", "Blocked Spells"); - menu_reload_one += " | " + Saylink::Silent("#reload content_flags", "Content Flags"); - menu_reload_two += Saylink::Silent("#reload doors", "Doors"); - menu_reload_two += " | " + Saylink::Silent("#reload ground_spawns", "Ground Spawns"); + menu_reload_two += Saylink::Silent("#reload commands", "Commands"); + menu_reload_two += " | " + Saylink::Silent("#reload content_flags", "Content Flags"); - menu_reload_three += Saylink::Silent("#reload logs", "Level Based Experience Modifiers"); - menu_reload_three += " | " + Saylink::Silent("#reload logs", "Log Settings"); + menu_reload_three += Saylink::Silent("#reload doors", "Doors"); + menu_reload_three += " | " + Saylink::Silent("#reload ground_spawns", "Ground Spawns"); - menu_reload_four += Saylink::Silent("#reload merchants", "Merchants"); - menu_reload_four += " | " + Saylink::Silent("#reload npc_emotes", "NPC Emotes"); - menu_reload_four += " | " + Saylink::Silent("#reload objects", "Objects"); + menu_reload_four += Saylink::Silent("#reload logs", "Level Based Experience Modifiers"); + menu_reload_four += " | " + Saylink::Silent("#reload logs", "Log Settings"); - menu_reload_five += Saylink::Silent("#reload perl_export", "Perl Event Export Settings"); - menu_reload_five += " | " + Saylink::Silent("#reload quest", "Quests"); + menu_reload_five += Saylink::Silent("#reload merchants", "Merchants"); + menu_reload_five += " | " + Saylink::Silent("#reload npc_emotes", "NPC Emotes"); + menu_reload_five += " | " + Saylink::Silent("#reload objects", "Objects"); - menu_reload_six += Saylink::Silent("#reload rules", "Rules"); - menu_reload_six += " | " + Saylink::Silent("#reload static", "Static Zone Data"); - menu_reload_six += " | " + Saylink::Silent("#reload tasks", "Tasks"); + menu_reload_six += Saylink::Silent("#reload perl_export", "Perl Event Export Settings"); + menu_reload_six += " | " + Saylink::Silent("#reload quest", "Quests"); - menu_reload_seven += Saylink::Silent("#reload titles", "Titles"); - menu_reload_seven += " | " + Saylink::Silent("#reload traps 1", "Traps"); - menu_reload_seven += " | " + Saylink::Silent("#reload variables", "Variables"); - menu_reload_seven += " | " + Saylink::Silent("#reload veteran_rewards", "Veteran Rewards"); + menu_reload_seven += Saylink::Silent("#reload rules", "Rules"); + menu_reload_seven += " | " + Saylink::Silent("#reload static", "Static Zone Data"); + menu_reload_seven += " | " + Saylink::Silent("#reload tasks", "Tasks"); - menu_reload_eight += Saylink::Silent("#reload world", "World"); - menu_reload_eight += " | " + Saylink::Silent("#reload zone", "Zone"); - menu_reload_eight += " | " + Saylink::Silent("#reload zone_points", "Zone Points"); + menu_reload_eight += Saylink::Silent("#reload titles", "Titles"); + menu_reload_eight += " | " + Saylink::Silent("#reload traps 1", "Traps"); + menu_reload_eight += " | " + Saylink::Silent("#reload variables", "Variables"); + menu_reload_eight += " | " + Saylink::Silent("#reload veteran_rewards", "Veteran Rewards"); + + menu_reload_nine += Saylink::Silent("#reload world", "World"); + menu_reload_nine += " | " + Saylink::Silent("#reload zone", "Zone"); + menu_reload_nine += " | " + Saylink::Silent("#reload zone_points", "Zone Points"); /** * Show window status @@ -9613,7 +9616,7 @@ void Client::ShowDevToolsMenu() Chat::White, fmt::format( "Show Menu | {}", - Saylink::Silent("#dev", "#dev") + Saylink::Silent("#dev") ).c_str() ); @@ -9705,7 +9708,15 @@ void Client::ShowDevToolsMenu() ).c_str() ); - auto help_link = Saylink::Silent("#help", "#help"); + Message( + Chat::White, + fmt::format( + "Reload | {}", + menu_reload_nine + ).c_str() + ); + + auto help_link = Saylink::Silent("#help"); Message( Chat::White, @@ -11301,6 +11312,16 @@ void Client::SendReloadCommandMessages() { ).c_str() ); + auto commands_link = Saylink::Silent("#reload commands"); + + Message( + Chat::White, + fmt::format( + "Usage: {} - Reloads Commands globally", + commands_link + ).c_str() + ); + auto content_flags_link = Saylink::Silent("#reload content_flags"); Message( diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0f1159c79..69399ec4c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4265,7 +4265,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) fmt::format( "Door ({}) [{}]", currentdoor->GetEntityID(), - Saylink::Silent("#door edit", "#door edit") + Saylink::Silent("#door edit") ).c_str() ); } diff --git a/zone/command.cpp b/zone/command.cpp index 3773ad5dd..3558c7358 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -53,6 +53,7 @@ int (*command_dispatch)(Client *,std::string) = command_notavail; std::map commandlist; std::map commandaliases; std::vector command_delete_list; +std::map commands_map; /* * command_notavail @@ -82,7 +83,9 @@ int command_notavail(Client *c, std::string message) int command_init(void) { - commandaliases.clear(); + if (!commandaliases.empty()) { + command_deinit(); + } if ( command_add("acceptrules", "[acceptrules] - Accept the EQEmu Agreement", AccountStatus::Player, command_acceptrules) || @@ -469,8 +472,10 @@ int command_init(void) */ void command_deinit(void) { - for (auto &c : command_delete_list) + for (auto &c : command_delete_list) { delete c; + } + command_delete_list.clear(); commandlist.clear(); commandaliases.clear(); @@ -521,6 +526,8 @@ int command_add(std::string command_name, std::string description, uint8 admin, c->description = description; c->function = function; + commands_map[command_name] = admin; + commandlist[command_name] = c; commandaliases[command_name] = command_name; command_delete_list.push_back(c); @@ -529,6 +536,11 @@ int command_add(std::string command_name, std::string description, uint8 admin, return 0; } +uint8 GetCommandStatus(Client *c, std::string command_name) { + auto command_status = commands_map[command_name]; + return command_status; +} + /* * * command_realdispatch @@ -608,11 +620,6 @@ void command_help(Client *c, const Seperator *sep) } command_link = Saylink::Silent( - fmt::format( - "{}{}", - COMMAND_CHAR, - cur.first - ), fmt::format( "{}{}", COMMAND_CHAR, @@ -623,8 +630,9 @@ void command_help(Client *c, const Seperator *sep) c->Message( Chat::White, fmt::format( - "{} | {}", + "{} | Status: {} | {}", command_link, + cur.second->admin, !cur.second->description.empty() ? cur.second->description : "" ).c_str() ); @@ -689,11 +697,6 @@ void command_findaliases(Client *c, const Seperator *sep) } auto current_commmand_link = Saylink::Silent( - fmt::format( - "{}{}", - COMMAND_CHAR, - command_iter->first - ), fmt::format( "{}{}", COMMAND_CHAR, @@ -713,11 +716,6 @@ void command_findaliases(Client *c, const Seperator *sep) } alias_link = Saylink::Silent( - fmt::format( - "{}{}", - COMMAND_CHAR, - a.first - ), fmt::format( "{}{}", COMMAND_CHAR, diff --git a/zone/command.h b/zone/command.h index d0c39b3f0..3a0566973 100644 --- a/zone/command.h +++ b/zone/command.h @@ -27,6 +27,7 @@ int command_add(std::string command_name, std::string description, uint8 admin, int command_notavail(Client *c, std::string message); int command_realdispatch(Client *c, std::string message); void command_logcommand(Client *c, std::string message); +uint8 GetCommandStatus(Client *c, std::string command_name); // Commands void command_acceptrules(Client *c, const Seperator *sep); diff --git a/zone/gm_commands/reload.cpp b/zone/gm_commands/reload.cpp index 6ec0387cd..99d91ed6d 100644 --- a/zone/gm_commands/reload.cpp +++ b/zone/gm_commands/reload.cpp @@ -11,6 +11,7 @@ void command_reload(Client *c, const Seperator *sep) bool is_aa = !strcasecmp(sep->arg[1], "aa"); bool is_alternate_currencies = !strcasecmp(sep->arg[1], "alternate_currencies"); bool is_blocked_spells = !strcasecmp(sep->arg[1], "blocked_spells"); + bool is_commands = !strcasecmp(sep->arg[1], "commands"); bool is_content_flags = !strcasecmp(sep->arg[1], "content_flags"); bool is_doors = !strcasecmp(sep->arg[1], "doors"); bool is_dztemplates = !strcasecmp(sep->arg[1], "dztemplates"); @@ -37,6 +38,7 @@ void command_reload(Client *c, const Seperator *sep) !is_aa && !is_alternate_currencies && !is_blocked_spells && + !is_commands && !is_content_flags && !is_doors && !is_dztemplates && @@ -74,7 +76,10 @@ void command_reload(Client *c, const Seperator *sep) } else if (is_blocked_spells) { c->Message(Chat::White, "Attempting to reload Blocked Spells globally."); pack = new ServerPacket(ServerOP_ReloadBlockedSpells, 0); - } else if (is_content_flags) { + } else if (is_commands) { + c->Message(Chat::White, "Attempting to reload Commands globally."); + pack = new ServerPacket(ServerOP_ReloadCommands, 0); + } else if (is_content_flags) { c->Message(Chat::White, "Attempting to reload Content Flags globally."); pack = new ServerPacket(ServerOP_ReloadContentFlags, 0); } else if (is_doors) { diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 4e5ba9f97..099a4d50c 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -40,6 +40,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../common/profanity_manager.h" #include "client.h" +#include "command.h" #include "corpse.h" #include "entity.h" #include "expedition.h" @@ -1915,6 +1916,12 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) zone->LoadZoneBlockedSpells(); break; } + case ServerOP_ReloadCommands: + { + zone->SendReloadMessage("Commands"); + command_init(); + break; + } case ServerOP_ReloadContentFlags: { zone->SendReloadMessage("Content Flags");