mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-18 07:11:29 +00:00
[Commands] Cleanup #worldshutdown Command. (#1694)
- Cleanup system messages and magic numbers.
This commit is contained in:
parent
bf92845a4a
commit
90871cb3d9
@ -778,8 +778,14 @@ void ConsoleWorldShutdown(
|
|||||||
zoneserver_list.WorldShutDown(0, 0);
|
zoneserver_list.WorldShutDown(0, 0);
|
||||||
}
|
}
|
||||||
else if (strcasecmp(args[0].c_str(), "disable") == 0) {
|
else if (strcasecmp(args[0].c_str(), "disable") == 0) {
|
||||||
connection->SendLine("<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World shutdown aborted.");
|
connection->SendLine("[SYSTEM] World shutdown has been aborted.");
|
||||||
zoneserver_list.SendEmoteMessage(0, 0, 0, 15, "<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World shutdown aborted.");
|
zoneserver_list.SendEmoteMessage(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Chat::Yellow,
|
||||||
|
"[SYSTEM] World shutdown has been aborted."
|
||||||
|
);
|
||||||
zoneserver_list.shutdowntimer->Disable();
|
zoneserver_list.shutdowntimer->Disable();
|
||||||
zoneserver_list.reminder->Disable();
|
zoneserver_list.reminder->Disable();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -750,8 +750,20 @@ void Console::ProcessCommand(const char* command) {
|
|||||||
zoneserver_list.WorldShutDown(0, 0);
|
zoneserver_list.WorldShutDown(0, 0);
|
||||||
}
|
}
|
||||||
else if(strcasecmp(sep.arg[1], "disable") == 0) {
|
else if(strcasecmp(sep.arg[1], "disable") == 0) {
|
||||||
SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World shutdown aborted.");
|
SendEmoteMessage(
|
||||||
zoneserver_list.SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World shutdown aborted.");
|
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.shutdowntimer->Disable();
|
||||||
zoneserver_list.reminder->Disable();
|
zoneserver_list.reminder->Disable();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,7 +110,16 @@ void ZSList::Process() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reminder && reminder->Check() && shutdowntimer) {
|
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)
|
void ZSList::WorldShutDown(uint32 time, uint32 interval)
|
||||||
{
|
{
|
||||||
if (time > 0) {
|
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;
|
time *= 1000;
|
||||||
interval *= 1000;
|
interval *= 1000;
|
||||||
@ -690,7 +708,7 @@ void ZSList::WorldShutDown(uint32 time, uint32 interval)
|
|||||||
reminder->Start();
|
reminder->Start();
|
||||||
}
|
}
|
||||||
else {
|
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;
|
auto pack = new ServerPacket;
|
||||||
pack->opcode = ServerOP_ShutdownAll;
|
pack->opcode = ServerOP_ShutdownAll;
|
||||||
pack->size = 0;
|
pack->size = 0;
|
||||||
|
|||||||
@ -3200,43 +3200,62 @@ void command_worldshutdown(Client *c, const Seperator *sep)
|
|||||||
uint32 time = 0;
|
uint32 time = 0;
|
||||||
uint32 interval = 0;
|
uint32 interval = 0;
|
||||||
if (worldserver.Connected()) {
|
if (worldserver.Connected()) {
|
||||||
if(sep->IsNumber(1) && sep->IsNumber(2) && ((time=atoi(sep->arg[1]))>0) && ((interval=atoi(sep->arg[2]))>0)) {
|
if (
|
||||||
worldserver.SendEmoteMessage(0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down in %i minutes, everyone log out before this time.", (time / 60 ));
|
sep->IsNumber(1) &&
|
||||||
c->Message(Chat::White, "Sending shutdown packet now, World will shutdown in: %i minutes with an interval of: %i seconds", (time / 60), interval);
|
sep->IsNumber(2) &&
|
||||||
|
(time = std::stoi(sep->arg[1]) > 0) &&
|
||||||
|
(interval = std::stoi(sep->arg[2]) > 0)
|
||||||
|
) {
|
||||||
|
int time_minutes = (time / 60);
|
||||||
|
quest_manager.WorldWideMessage(
|
||||||
|
Chat::Yellow,
|
||||||
|
fmt::format(
|
||||||
|
"[SYSTEM] World will be shutting down in {} minutes.",
|
||||||
|
time_minutes
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"World will be shutting down in {} minutes, notifying every {} seconds",
|
||||||
|
time_minutes,
|
||||||
|
interval
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
auto pack = new ServerPacket(ServerOP_ShutdownAll, sizeof(WorldShutDown_Struct));
|
auto pack = new ServerPacket(ServerOP_ShutdownAll, sizeof(WorldShutDown_Struct));
|
||||||
WorldShutDown_Struct* wsd = (WorldShutDown_Struct*)pack->pBuffer;
|
WorldShutDown_Struct* wsd = (WorldShutDown_Struct*)pack->pBuffer;
|
||||||
wsd->time=time*1000;
|
wsd->time = (time * 1000);
|
||||||
wsd->interval = (interval * 1000);
|
wsd->interval = (interval * 1000);
|
||||||
worldserver.SendPacket(pack);
|
worldserver.SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
} else if (!strcasecmp(sep->arg[1], "now")){
|
||||||
else if(strcasecmp(sep->arg[1], "now") == 0){
|
quest_manager.WorldWideMessage(
|
||||||
worldserver.SendEmoteMessage(0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down, everyone log out now.");
|
Chat::Yellow,
|
||||||
c->Message(Chat::White, "Sending shutdown packet");
|
"[SYSTEM] World is shutting down now."
|
||||||
|
);
|
||||||
|
c->Message(Chat::White, "World is shutting down now.");
|
||||||
auto pack = new ServerPacket;
|
auto pack = new ServerPacket;
|
||||||
pack->opcode = ServerOP_ShutdownAll;
|
pack->opcode = ServerOP_ShutdownAll;
|
||||||
pack->size = 0;
|
pack->size = 0;
|
||||||
worldserver.SendPacket(pack);
|
worldserver.SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
} else if (!strcasecmp(sep->arg[1], "disable")) {
|
||||||
else if(strcasecmp(sep->arg[1], "disable") == 0){
|
c->Message(Chat::White, "World shutdown has been aborted.");
|
||||||
c->Message(Chat::White, "Shutdown prevented, next time I may not be so forgiving...");
|
|
||||||
auto pack = new ServerPacket(ServerOP_ShutdownAll, sizeof(WorldShutDown_Struct));
|
auto pack = new ServerPacket(ServerOP_ShutdownAll, sizeof(WorldShutDown_Struct));
|
||||||
WorldShutDown_Struct* wsd = (WorldShutDown_Struct*)pack->pBuffer;
|
WorldShutDown_Struct* wsd = (WorldShutDown_Struct*)pack->pBuffer;
|
||||||
wsd->time = 0;
|
wsd->time = 0;
|
||||||
wsd->interval = 0;
|
wsd->interval = 0;
|
||||||
worldserver.SendPacket(pack);
|
worldserver.SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
c->Message(Chat::White,"#worldshutdown - Shuts down the server and all zones.");
|
c->Message(Chat::White,"#worldshutdown - Shuts down the server and all zones.");
|
||||||
c->Message(Chat::White,"Usage: #worldshutdown now - Shuts down the server and all zones immediately.");
|
c->Message(Chat::White,"Usage: #worldshutdown now - Shuts down the server and all zones immediately.");
|
||||||
c->Message(Chat::White,"Usage: #worldshutdown disable - Stops the server from a previously scheduled shut down.");
|
c->Message(Chat::White,"Usage: #worldshutdown disable - Stops the server from a previously scheduled shut down.");
|
||||||
c->Message(Chat::White,"Usage: #worldshutdown [timer] [interval] - Shuts down the server and all zones after [timer] seconds and sends warning every [interval] seconds.");
|
c->Message(Chat::White,"Usage: #worldshutdown [timer] [interval] - Shuts down the server and all zones after [timer] seconds and notifies players every [interval] seconds.");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
c->Message(Chat::White, "Error: World server is disconnected.");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
c->Message(Chat::White, "Error: World server disconnected");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_sendzonespawns(Client *c, const Seperator *sep)
|
void command_sendzonespawns(Client *c, const Seperator *sep)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user