[Commands] Cleanup #oocmute Command. (#2191)

- Cleanup messages and logic.
- Add ServerOOCMute_Struct for cleanliness.
This commit is contained in:
Kinglykrab 2022-05-27 14:38:40 -04:00 committed by GitHub
parent 49d751b3d5
commit f9191d4ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 10 deletions

View File

@ -1788,6 +1788,10 @@ struct ServerFlagUpdate_Struct {
int16 admin;
};
struct ServerOOCMute_Struct {
bool is_muted;
};
#pragma pack()
#endif

View File

@ -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) ||

View File

@ -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()
);
}

View File

@ -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: {