*Show online players numbers in command server info.
--HG-- branch : trunk
This commit is contained in:
+2
-1
@@ -85,7 +85,8 @@ enum TrinityStrings
|
||||
LANG_USING_WORLD_DB = 57,
|
||||
LANG_USING_SCRIPT_LIB = 58,
|
||||
LANG_USING_EVENT_AI = 59,
|
||||
// Room for more level 0 60-99 not used
|
||||
LANG_CONNECTED_PLAYERS = 60,
|
||||
// Room for more level 0 61-99 not used
|
||||
|
||||
// level 1 chat
|
||||
LANG_GLOBAL_NOTIFY = 100,
|
||||
|
||||
+5
-2
@@ -86,11 +86,13 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
|
||||
|
||||
bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
||||
{
|
||||
uint32 PlayersNum = sWorld.GetPlayerCount();
|
||||
uint32 MaxPlayersNum = sWorld.GetMaxPlayerCount();
|
||||
uint32 activeClientsNum = sWorld.GetActiveSessionCount();
|
||||
uint32 queuedClientsNum = sWorld.GetQueuedSessionCount();
|
||||
uint32 maxActiveClientsNum = sWorld.GetMaxActiveSessionCount();
|
||||
uint32 maxQueuedClientsNum = sWorld.GetMaxQueuedSessionCount();
|
||||
std::string str = secsToTimeString(sWorld.GetUptime());
|
||||
std::string uptime = secsToTimeString(sWorld.GetUptime());
|
||||
uint32 updateTime = sWorld.GetUpdateTime();
|
||||
|
||||
PSendSysMessage(_FULLVERSION);
|
||||
@@ -103,8 +105,9 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
||||
//PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion());
|
||||
//PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
|
||||
//PSendSysMessage(LANG_USING_EVENT_AI,sWorld.GetCreatureEventAIVersion());
|
||||
PSendSysMessage(LANG_CONNECTED_PLAYERS, PlayersNum, MaxPlayersNum);
|
||||
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
||||
PSendSysMessage(LANG_UPTIME, str.c_str());
|
||||
PSendSysMessage(LANG_UPTIME, uptime.c_str());
|
||||
PSendSysMessage("Update time diff: %u.", updateTime);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -476,6 +476,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
|
||||
m_lastFallZ = 0;
|
||||
|
||||
m_ControlledByPlayer = true;
|
||||
|
||||
sWorld.IncreasePlayerCount();
|
||||
}
|
||||
|
||||
Player::~Player ()
|
||||
@@ -508,6 +510,8 @@ Player::~Player ()
|
||||
|
||||
delete m_declinedname;
|
||||
delete m_runes;
|
||||
|
||||
sWorld.DecreasePlayerCount();
|
||||
}
|
||||
|
||||
void Player::CleanupsBeforeDelete()
|
||||
|
||||
@@ -102,6 +102,8 @@ World::World()
|
||||
m_startTime=m_gameTime;
|
||||
m_maxActiveSessionCount = 0;
|
||||
m_maxQueuedSessionCount = 0;
|
||||
m_PlayerCount = 0;
|
||||
m_MaxPlayerCount = 0;
|
||||
m_resultQueue = NULL;
|
||||
m_NextDailyQuestReset = 0;
|
||||
|
||||
|
||||
+13
-1
@@ -424,8 +424,18 @@ class World
|
||||
/// Get the maximum number of parallel sessions on the server since last reboot
|
||||
uint32 GetMaxQueuedSessionCount() const { return m_maxQueuedSessionCount; }
|
||||
uint32 GetMaxActiveSessionCount() const { return m_maxActiveSessionCount; }
|
||||
Player* FindPlayerInZone(uint32 zone);
|
||||
/// Get number of players
|
||||
inline uint32 GetPlayerCount() const { return m_PlayerCount; }
|
||||
inline uint32 GetMaxPlayerCount() const { return m_MaxPlayerCount; }
|
||||
/// Increase/Decrease number of players
|
||||
inline void IncreasePlayerCount()
|
||||
{
|
||||
m_PlayerCount++;
|
||||
m_MaxPlayerCount = std::max(m_MaxPlayerCount, m_PlayerCount);
|
||||
}
|
||||
inline void DecreasePlayerCount() { m_PlayerCount--; }
|
||||
|
||||
Player* FindPlayerInZone(uint32 zone);
|
||||
Weather* FindWeather(uint32 id) const;
|
||||
Weather* AddWeather(uint32 zone_id);
|
||||
void RemoveWeather(uint32 zone_id);
|
||||
@@ -613,6 +623,8 @@ class World
|
||||
DisconnectMap m_disconnects;
|
||||
uint32 m_maxActiveSessionCount;
|
||||
uint32 m_maxQueuedSessionCount;
|
||||
uint32 m_PlayerCount;
|
||||
uint32 m_MaxPlayerCount;
|
||||
|
||||
std::multimap<time_t, ScriptAction> m_scriptSchedule;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user