[Commands] Cleanup #zonebootup and #zoneshutdown Commands (#3729)

# Notes
- Cleanup messages and logic.
This commit is contained in:
Alex King
2023-12-03 12:40:54 -05:00
committed by GitHub
parent e719aa43cf
commit 11a81d8e8a
6 changed files with 123 additions and 90 deletions
+10 -10
View File
@@ -578,25 +578,25 @@ void ConsoleZoneShutdown(
strcpy(&tmpname[1], connection->UserName().c_str());
auto pack = new ServerPacket;
pack->size = sizeof(ServerZoneStateChange_struct);
pack->size = sizeof(ServerZoneStateChange_Struct);
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, sizeof(ServerZoneStateChange_struct));
ServerZoneStateChange_struct *s = (ServerZoneStateChange_struct *) pack->pBuffer;
memset(pack->pBuffer, 0, sizeof(ServerZoneStateChange_Struct));
auto *s = (ServerZoneStateChange_Struct *) pack->pBuffer;
pack->opcode = ServerOP_ZoneShutdown;
strcpy(s->adminname, tmpname);
strcpy(s->admin_name, tmpname);
if (Strings::IsNumber(args[0])) {
s->ZoneServerID = Strings::ToInt(args[0]);
s->zone_server_id = Strings::ToInt(args[0]);
}
else {
s->zoneid = ZoneID(args[0].c_str());
s->zone_id = ZoneID(args[0].c_str());
}
ZoneServer *zs = 0;
if (s->ZoneServerID != 0) {
zs = zoneserver_list.FindByID(s->ZoneServerID);
if (s->zone_server_id != 0) {
zs = zoneserver_list.FindByID(s->zone_server_id);
}
else if (s->zoneid != 0) {
zs = zoneserver_list.FindByName(ZoneName(s->zoneid));
else if (s->zone_id != 0) {
zs = zoneserver_list.FindByName(ZoneName(s->zone_id));
}
else {
connection->SendLine("Error: ZoneShutdown: neither ID nor name specified");