[Commands] Cleanup #worldshutdown Command. (#1694)

- Cleanup system messages and magic numbers.
This commit is contained in:
Kinglykrab
2021-11-07 17:21:42 -05:00
committed by GitHub
parent bf92845a4a
commit 90871cb3d9
4 changed files with 84 additions and 29 deletions
+8 -2
View File
@@ -778,8 +778,14 @@ void ConsoleWorldShutdown(
zoneserver_list.WorldShutDown(0, 0);
}
else if (strcasecmp(args[0].c_str(), "disable") == 0) {
connection->SendLine("<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World shutdown aborted.");
zoneserver_list.SendEmoteMessage(0, 0, 0, 15, "<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World shutdown aborted.");
connection->SendLine("[SYSTEM] World shutdown has been aborted.");
zoneserver_list.SendEmoteMessage(
0,
0,
0,
Chat::Yellow,
"[SYSTEM] World shutdown has been aborted."
);
zoneserver_list.shutdowntimer->Disable();
zoneserver_list.reminder->Disable();
}
+14 -2
View File
@@ -750,8 +750,20 @@ void Console::ProcessCommand(const char* command) {
zoneserver_list.WorldShutDown(0, 0);
}
else if(strcasecmp(sep.arg[1], "disable") == 0) {
SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World shutdown aborted.");
zoneserver_list.SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World shutdown aborted.");
SendEmoteMessage(
0,
0,
0,
Chat::Yellow,
"[SYSTEM] World shutdown has been aborted."
);
zoneserver_list.SendEmoteMessage(
0,
0,
0,
Chat::Yellow,
"[SYSTEM] World shutdown has been aborted."
);
zoneserver_list.shutdowntimer->Disable();
zoneserver_list.reminder->Disable();
}
+21 -3
View File
@@ -110,7 +110,16 @@ void ZSList::Process() {
}
if (reminder && reminder->Check() && shutdowntimer) {
SendEmoteMessage(0, 0, 0, 15, "<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down, everyone log out now. World will shut down in %i minutes...", ((shutdowntimer->GetRemainingTime() / 1000) / 60));
SendEmoteMessage(
0,
0,
0,
Chat::Yellow,
fmt::format(
"[SYSTEM] World will be shutting down in {} minutes.",
((shutdowntimer->GetRemainingTime() / 1000) / 60)
).c_str()
);
}
}
@@ -677,7 +686,16 @@ void ZSList::UpdateUCSServerAvailable(bool ucss_available) {
void ZSList::WorldShutDown(uint32 time, uint32 interval)
{
if (time > 0) {
SendEmoteMessage(0, 0, 0, 15, "<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down in %i minutes, everyone log out before this time.", (time / 60));
SendEmoteMessage(
0,
0,
0,
Chat::Yellow,
fmt::format(
"[SYSTEM] World will be shutting down in {} minutes.",
(time / 60)
).c_str()
);
time *= 1000;
interval *= 1000;
@@ -690,7 +708,7 @@ void ZSList::WorldShutDown(uint32 time, uint32 interval)
reminder->Start();
}
else {
SendEmoteMessage(0, 0, 0, 15, "<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down, everyone log out now.");
SendEmoteMessage(0, 0, 0, 15, "[SYSTEM] World is shutting down.");
auto pack = new ServerPacket;
pack->opcode = ServerOP_ShutdownAll;
pack->size = 0;