diff options
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/World/World.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/World/World.h | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 6018ff9a607..ab8a1acc5f4 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2592,7 +2592,7 @@ void World::_UpdateGameTime() } /// Shutdown the server -void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode) +void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode, const std::string& reason) { // ignore if server shutdown at next tick if (IsStopped()) @@ -2613,14 +2613,14 @@ void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode) else { m_ShutdownTimer = time; - ShutdownMsg(true); + ShutdownMsg(true, nullptr, reason); } sScriptMgr->OnShutdownInitiate(ShutdownExitCode(exitcode), ShutdownMask(options)); } /// Display a shutdown message to the user(s) -void World::ShutdownMsg(bool show, Player* player) +void World::ShutdownMsg(bool show, Player* player, const std::string& reason) { // not show messages for idle shutdown mode if (m_ShutdownMask & SHUTDOWN_MASK_IDLE) @@ -2635,6 +2635,8 @@ void World::ShutdownMsg(bool show, Player* player) (m_ShutdownTimer > 12 * HOUR && (m_ShutdownTimer % (12 * HOUR)) == 0)) // > 12 h ; every 12 h { std::string str = secsToTimeString(m_ShutdownTimer); + if (!reason.empty()) + str += " - " + reason; ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME; diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index aac434482c6..6523ade972a 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -656,9 +656,9 @@ class World /// Are we in the middle of a shutdown? bool IsShuttingDown() const { return m_ShutdownTimer > 0; } uint32 GetShutDownTimeLeft() const { return m_ShutdownTimer; } - void ShutdownServ(uint32 time, uint32 options, uint8 exitcode); + void ShutdownServ(uint32 time, uint32 options, uint8 exitcode, const std::string& reason = std::string()); void ShutdownCancel(); - void ShutdownMsg(bool show = false, Player* player = NULL); + void ShutdownMsg(bool show = false, Player* player = NULL, const std::string& reason = std::string()); static uint8 GetExitCode() { return m_ExitCode; } static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; } static bool IsStopped() { return m_stopEvent; } |
