diff --git a/common/servertalk.h b/common/servertalk.h index b780175cb..092220e6b 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -1788,6 +1788,10 @@ struct ServerFlagUpdate_Struct { int16 admin; }; +struct ServerOOCMute_Struct { + bool is_muted; +}; + #pragma pack() #endif diff --git a/zone/command.cpp b/zone/command.cpp index 3f25dbd83..3a92f24d9 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -259,7 +259,7 @@ int command_init(void) command_add("nukebuffs", "[Beneficial|Detrimental|Help] - Strip all buffs by type on you or your target (no argument to remove all buffs)", AccountStatus::Guide, command_nukebuffs) || command_add("nukeitem", "[Item ID] - Removes the specified Item ID from you or your player target's inventory", AccountStatus::GMLeadAdmin, command_nukeitem) || command_add("object", "List|Add|Edit|Move|Rotate|Copy|Save|Undo|Delete - Manipulate static and tradeskill objects within the zone", AccountStatus::GMAdmin, command_object) || - command_add("oocmute", "[1/0] - Mutes OOC chat", AccountStatus::GMMgmt, command_oocmute) || + command_add("oocmute", "[0|1] - Enable or Disable Server OOC", AccountStatus::GMMgmt, command_oocmute) || command_add("opcode", "- opcode management", AccountStatus::GMImpossible, command_opcode) || command_add("path", "- view and edit pathing", AccountStatus::GMMgmt, command_path) || command_add("peekinv", "[equip/gen/cursor/poss/limbo/curlim/trib/bank/shbank/allbank/trade/world/all] - Print out contents of your player target's inventory", AccountStatus::GMAdmin, command_peekinv) || diff --git a/zone/gm_commands/oocmute.cpp b/zone/gm_commands/oocmute.cpp index a1e1199a2..a19f424ec 100755 --- a/zone/gm_commands/oocmute.cpp +++ b/zone/gm_commands/oocmute.cpp @@ -5,14 +5,24 @@ extern WorldServer worldserver; void command_oocmute(Client *c, const Seperator *sep) { - if (sep->arg[1][0] == 0 || !(sep->arg[1][0] == '1' || sep->arg[1][0] == '0')) { - c->Message(Chat::White, "Usage: #oocmute [1/0]"); - } - else { - auto outapp = new ServerPacket(ServerOP_OOCMute, 1); - *(outapp->pBuffer) = atoi(sep->arg[1]); - worldserver.SendPacket(outapp); - safe_delete(outapp); + if (!sep->IsNumber(1)) { + c->Message(Chat::White, "Usage: #oocmute [0|1] - Enable or Disable Server OOC"); + return; } + + bool is_muted = std::stoi(sep->arg[1]) ? true : false; + + ServerPacket pack(ServerOP_OOCMute, sizeof(ServerOOCMute_Struct)); + auto o = (ServerOOCMute_Struct*) pack.pBuffer; + o->is_muted = is_muted; + worldserver.SendPacket(&pack); + + c->Message( + Chat::White, + fmt::format( + "Server OOC is {} muted.", + is_muted ? "now" : "no longer" + ).c_str() + ); } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 4820b791a..dfd4166ae 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -958,7 +958,8 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) break; } case ServerOP_OOCMute: { - oocmuted = *(pack->pBuffer); + auto o = (ServerOOCMute_Struct *) pack->pBuffer; + oocmuted = o->is_muted; break; } case ServerOP_Revoke: {