aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Language.h3
-rw-r--r--src/game/Level0.cpp7
-rw-r--r--src/game/Player.cpp4
-rw-r--r--src/game/World.cpp2
-rw-r--r--src/game/World.h14
5 files changed, 26 insertions, 4 deletions
diff --git a/src/game/Language.h b/src/game/Language.h
index 33ad0421ea7..215c160b5bc 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -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,
diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp
index c4f6935bced..f5fd5ec2626 100644
--- a/src/game/Level0.cpp
+++ b/src/game/Level0.cpp
@@ -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;
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 84cb5f93064..b81cf574b1e 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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()
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 2fa90e6c148..8750c5417bb 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -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;
diff --git a/src/game/World.h b/src/game/World.h
index f254782c4eb..e1985aa55a4 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -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;