mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Commands] Add Instance Support to #zoneshutdown (#4807)
* [Commands] Add Instance Support to #zoneshutdown * Update zoneserver.cpp * Update zoneshutdown.cpp
This commit is contained in:
parent
49664cc1a0
commit
b040571427
@ -729,13 +729,15 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
zs = zoneserver_list.FindByID(s->zone_server_id);
|
zs = zoneserver_list.FindByID(s->zone_server_id);
|
||||||
} else if (s->zone_id) {
|
} else if (s->zone_id) {
|
||||||
zs = zoneserver_list.FindByName(ZoneName(s->zone_id));
|
zs = zoneserver_list.FindByName(ZoneName(s->zone_id));
|
||||||
|
} else if (s->instance_id) {
|
||||||
|
zs = zoneserver_list.FindByInstanceID(s->instance_id);
|
||||||
} else {
|
} else {
|
||||||
zoneserver_list.SendEmoteMessage(
|
zoneserver_list.SendEmoteMessage(
|
||||||
s->admin_name,
|
s->admin_name,
|
||||||
0,
|
0,
|
||||||
AccountStatus::Player,
|
AccountStatus::Player,
|
||||||
Chat::White,
|
Chat::White,
|
||||||
"Error: SOP_ZoneShutdown: neither ID nor name specified"
|
"Error: SOP_ZoneShutdown: Zone ID, Instance ID, nor Zone Short Name specified"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -245,7 +245,7 @@ int command_init(void)
|
|||||||
command_add("zonebootup", "[ZoneServerID] [shortname] - Make a zone server boot a specific zone", AccountStatus::GMLeadAdmin, command_zonebootup) ||
|
command_add("zonebootup", "[ZoneServerID] [shortname] - Make a zone server boot a specific zone", AccountStatus::GMLeadAdmin, command_zonebootup) ||
|
||||||
command_add("zoneinstance", "[Instance ID] [X] [Y] [Z] - Teleport to specified Instance by ID (coordinates are optional)", AccountStatus::Guide, command_zone_instance) ||
|
command_add("zoneinstance", "[Instance ID] [X] [Y] [Z] - Teleport to specified Instance by ID (coordinates are optional)", AccountStatus::Guide, command_zone_instance) ||
|
||||||
command_add("zoneshard", "[zone] [instance_id] - Teleport explicitly to a zone shard", AccountStatus::Player, command_zone_shard) ||
|
command_add("zoneshard", "[zone] [instance_id] - Teleport explicitly to a zone shard", AccountStatus::Player, command_zone_shard) ||
|
||||||
command_add("zoneshutdown", "[shortname] - Shut down a zone server", AccountStatus::GMLeadAdmin, command_zoneshutdown) ||
|
command_add("zoneshutdown", "[instance|zone] [Instance ID|Zone ID|Zone Short Name] - Shut down a zone server by Instance ID, Zone ID, or Zone Short Name", AccountStatus::GMLeadAdmin, command_zoneshutdown) ||
|
||||||
command_add("zsave", " Saves zheader to the database", AccountStatus::QuestTroupe, command_zsave)
|
command_add("zsave", " Saves zheader to the database", AccountStatus::QuestTroupe, command_zsave)
|
||||||
) {
|
) {
|
||||||
command_deinit();
|
command_deinit();
|
||||||
|
|||||||
@ -6,8 +6,18 @@ extern WorldServer worldserver;
|
|||||||
void command_zoneshutdown(Client *c, const Seperator *sep)
|
void command_zoneshutdown(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
const int arguments = sep->argnum;
|
const int arguments = sep->argnum;
|
||||||
if (!arguments) {
|
if (arguments < 2) {
|
||||||
c->Message(Chat::White, "Usage: #zoneshutdown [Zone ID|Zone Short Name]");
|
c->Message(Chat::White, "Usage: #zoneshutdown instance [Instance ID]");
|
||||||
|
c->Message(Chat::White, "Usage: #zoneshutdown zone [Zone ID|Zone Short Name]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_instance = !strcasecmp(sep->arg[1], "instance");
|
||||||
|
bool is_zone = !strcasecmp(sep->arg[1], "zone");
|
||||||
|
|
||||||
|
if (!is_instance && !is_zone) {
|
||||||
|
c->Message(Chat::White, "Usage: #zoneshutdown instance [Instance ID]");
|
||||||
|
c->Message(Chat::White, "Usage: #zoneshutdown zone [Zone ID|Zone Short Name]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,23 +26,55 @@ void command_zoneshutdown(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32 zone_id = sep->IsNumber(1) ? Strings::ToUnsignedInt(sep->arg[1]) : ZoneID(sep->arg[1]);
|
uint32 zone_id = 0;
|
||||||
|
uint16 instance_id = 0;
|
||||||
|
std::string message = "";
|
||||||
|
|
||||||
if (!zone_id) {
|
if (is_instance) {
|
||||||
c->Message(
|
instance_id = sep->IsNumber(2) ? Strings::ToUnsignedInt(sep->arg[2]) : 0;
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
if (!database.CheckInstanceExists(instance_id)) {
|
||||||
"Zone '{}' does not exist.",
|
c->Message(
|
||||||
sep->arg[1]
|
Chat::White,
|
||||||
).c_str()
|
fmt::format(
|
||||||
);
|
"Instance ID '{}' does not exist.",
|
||||||
return;
|
instance_id
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = fmt::format("Instance ID {}", instance_id);
|
||||||
|
} else if (is_zone) {
|
||||||
|
zone_id = sep->IsNumber(2) ? Strings::ToUnsignedInt(sep->arg[2]) : ZoneID(sep->arg[2]);
|
||||||
|
|
||||||
|
if (!zone_id) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Zone '{}' does not exist.",
|
||||||
|
sep->arg[1]
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = fmt::format("{} (ID {})", ZoneLongName(zone_id), zone_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Attempting to shut down {}.",
|
||||||
|
message
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
auto pack = new ServerPacket(ServerOP_ZoneShutdown, sizeof(ServerZoneStateChange_Struct));
|
auto pack = new ServerPacket(ServerOP_ZoneShutdown, sizeof(ServerZoneStateChange_Struct));
|
||||||
auto *s = (ServerZoneStateChange_Struct *) pack->pBuffer;
|
auto *s = (ServerZoneStateChange_Struct *) pack->pBuffer;
|
||||||
|
|
||||||
s->zone_id = zone_id;
|
s->zone_id = zone_id;
|
||||||
|
s->instance_id = instance_id;
|
||||||
|
|
||||||
strn0cpy(s->admin_name, c->GetName(), sizeof(s->admin_name));
|
strn0cpy(s->admin_name, c->GetName(), sizeof(s->admin_name));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user