Core/Commands: Show time left until shutdown in .server info. (Aokromes' Suggestions)--;
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
DELETE FROM `trinity_string` WHERE `entry` IN(19,20); # unused entries
|
||||||
|
INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES
|
||||||
|
(19,'Update time diff: %u.'),
|
||||||
|
(20,'Time left until shutdown/restart: %s');
|
||||||
@@ -84,8 +84,8 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
|
|||||||
|
|
||||||
bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
||||||
{
|
{
|
||||||
uint32 PlayersNum = sWorld->GetPlayerCount();
|
uint32 playersNum = sWorld->GetPlayerCount();
|
||||||
uint32 MaxPlayersNum = sWorld->GetMaxPlayerCount();
|
uint32 maxPlayersNum = sWorld->GetMaxPlayerCount();
|
||||||
uint32 activeClientsNum = sWorld->GetActiveSessionCount();
|
uint32 activeClientsNum = sWorld->GetActiveSessionCount();
|
||||||
uint32 queuedClientsNum = sWorld->GetQueuedSessionCount();
|
uint32 queuedClientsNum = sWorld->GetQueuedSessionCount();
|
||||||
uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount();
|
uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount();
|
||||||
@@ -94,10 +94,13 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
|||||||
uint32 updateTime = sWorld->GetUpdateTime();
|
uint32 updateTime = sWorld->GetUpdateTime();
|
||||||
|
|
||||||
SendSysMessage(_FULLVERSION);
|
SendSysMessage(_FULLVERSION);
|
||||||
PSendSysMessage(LANG_CONNECTED_PLAYERS, PlayersNum, MaxPlayersNum);
|
PSendSysMessage(LANG_CONNECTED_PLAYERS, playersNum, maxPlayersNum);
|
||||||
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
||||||
PSendSysMessage(LANG_UPTIME, uptime.c_str());
|
PSendSysMessage(LANG_UPTIME, uptime.c_str());
|
||||||
PSendSysMessage("Update time diff: %u.", updateTime);
|
PSendSysMessage(LANG_UPDATE_DIFF, updateTime);
|
||||||
|
//! Can't use sWorld->ShutdownMsg here in case of console command
|
||||||
|
if (sWorld->IsShuttingDown())
|
||||||
|
PSendSysMessage(LANG_SHUTDOWN_TIMELEFT, secsToTimeString(sWorld->GetShutDownTimeLeft()).c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ enum TrinityStrings
|
|||||||
LANG_GMS_ON_SRV = 16,
|
LANG_GMS_ON_SRV = 16,
|
||||||
LANG_GMS_NOT_LOGGED = 17,
|
LANG_GMS_NOT_LOGGED = 17,
|
||||||
LANG_YOU_IN_FLIGHT = 18,
|
LANG_YOU_IN_FLIGHT = 18,
|
||||||
//LANG_YOU_IN_BATTLEGROUND = 19, not used
|
LANG_UPDATE_DIFF = 19,
|
||||||
//LANG_TARGET_IN_FLIGHT = 20, not used
|
LANG_SHUTDOWN_TIMELEFT = 20,
|
||||||
LANG_CHAR_IN_FLIGHT = 21,
|
LANG_CHAR_IN_FLIGHT = 21,
|
||||||
LANG_CHAR_NON_MOUNTED = 22,
|
LANG_CHAR_NON_MOUNTED = 22,
|
||||||
LANG_YOU_IN_COMBAT = 23,
|
LANG_YOU_IN_COMBAT = 23,
|
||||||
|
|||||||
@@ -997,7 +997,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|||||||
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
|
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
|
||||||
|
|
||||||
// show time before shutdown if shutdown planned.
|
// show time before shutdown if shutdown planned.
|
||||||
if (sWorld->IsShutdowning())
|
if (sWorld->IsShuttingDown())
|
||||||
sWorld->ShutdownMsg(true, pCurrChar);
|
sWorld->ShutdownMsg(true, pCurrChar);
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ALL_TAXI_PATHS))
|
if (sWorld->getBoolConfig(CONFIG_ALL_TAXI_PATHS))
|
||||||
|
|||||||
@@ -634,7 +634,8 @@ class World
|
|||||||
void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = NULL);
|
void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = NULL);
|
||||||
|
|
||||||
/// Are we in the middle of a shutdown?
|
/// Are we in the middle of a shutdown?
|
||||||
bool IsShutdowning() const { return m_ShutdownTimer > 0; }
|
bool IsShuttingDown() const { return m_ShutdownTimer > 0; }
|
||||||
|
uint32 const GetShutDownTimeLeft() { return m_ShutdownTimer; }
|
||||||
void ShutdownServ(uint32 time, uint32 options, uint8 exitcode);
|
void ShutdownServ(uint32 time, uint32 options, uint8 exitcode);
|
||||||
void ShutdownCancel();
|
void ShutdownCancel();
|
||||||
void ShutdownMsg(bool show = false, Player* player = NULL);
|
void ShutdownMsg(bool show = false, Player* player = NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user