Created
February 8, 2010 16:53
-
-
Save Emtec/298341 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sql/mangos.sql b/sql/mangos.sql | |
index c26a0d2..15ad515 100644 | |
--- a/sql/mangos.sql | |
+++ b/sql/mangos.sql | |
@@ -2920,7 +2920,7 @@ INSERT INTO `mangos_string` VALUES | |
(9,'Commands available to you:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), | |
(10,'Incorrect syntax.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), | |
(11,'Your account level is: %i',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), | |
-(12,'Online players: %u (max: %u) Queued players: %u (max: %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), | |
+(12,'Online players: %u (max: %u) Queued players: %u (max: %u) Player Limit: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), | |
(13,'Server uptime: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), | |
(14,'Player saved.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), | |
(15,'All players saved.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), | |
diff --git a/sql/new.sql b/sql/new.sql | |
index 16f56a6..5aada8e 100644 | |
--- a/sql/new.sql | |
+++ b/sql/new.sql | |
@@ -1 +1,2 @@ | |
-ALTER TABLE `realmlist` ADD `plimit` INT( 32 ) NOT NULL DEFAULT '200'; | |
\ No newline at end of file | |
+ALTER TABLE `realmlist` ADD `plimit` INT( 32 ) NOT NULL DEFAULT '200'; | |
+UPDATE `mangos_string` SET `content_default` = 'Online players: %u (max: %u) Queued players: %u (max: %u) Player Limit: %u' WHERE `entry` = 12; | |
\ No newline at end of file | |
diff --git a/sql/realmd.sql b/sql/realmd.sql | |
index 267b882..2f9004e 100644 | |
--- a/sql/realmd.sql | |
+++ b/sql/realmd.sql | |
@@ -162,6 +162,7 @@ CREATE TABLE `realmlist` ( | |
`allowedSecurityLevel` tinyint(3) unsigned NOT NULL default '0', | |
`population` float unsigned NOT NULL default '0', | |
`realmbuilds` varchar(64) NOT NULL default '', | |
+ `plimit` int(32) NOT NULL DEFAULT '200', | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `idx_name` (`name`) | |
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm System'; | |
diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp | |
index 178ae48..61e8e6b 100644 | |
--- a/src/game/Level0.cpp | |
+++ b/src/game/Level0.cpp | |
@@ -102,7 +102,7 @@ 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_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum); | |
+ PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum, sWorld.GetRealmLimit()); | |
PSendSysMessage(LANG_UPTIME, str.c_str()); | |
return true; | |
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp | |
index 71203fc..0ea2af8 100644 | |
--- a/src/game/Level3.cpp | |
+++ b/src/game/Level3.cpp | |
@@ -5691,7 +5691,7 @@ bool ChatHandler::HandleServerPLimitCommand(const char *args) | |
else if(strncmp(param,"administrator",l) == 0 ) | |
sWorld.SetPlayerLimit(-SEC_ADMINISTRATOR); | |
else if(strncmp(param,"reset",l) == 0 ) | |
- sWorld.SetPlayerLimit( sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT) ); | |
+ sWorld.SetPlayerLimit(DEFAULT_PLAYER_LIMIT); | |
else | |
{ | |
int val = atoi(param); | |
@@ -5718,6 +5718,7 @@ bool ChatHandler::HandleServerPLimitCommand(const char *args) | |
} | |
PSendSysMessage("Player limits: amount %u, min. security level %s.",pLimit,secName); | |
+ loginDatabase.PQuery("UPDATE realmlist SET plimit = '%d' WHERE id = '%d'", pLimit, realmID); | |
return true; | |
} | |
diff --git a/src/game/World.cpp b/src/game/World.cpp | |
index 1dddef0..f8811d2 100644 | |
--- a/src/game/World.cpp | |
+++ b/src/game/World.cpp | |
@@ -427,8 +427,6 @@ void World::LoadConfigSettings(bool reload) | |
} | |
} | |
- ///- Read the player limit and the Message of the day from the config file | |
- SetPlayerLimit( sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT), true ); | |
SetMotd( sConfig.GetStringDefault("Motd", "Welcome to the Massive Network Game Object Server." ) ); | |
///- Read all rates from the config file | |
@@ -1146,6 +1144,11 @@ void World::SetInitialWorldSettings() | |
///- Update the realm entry in the database with the realm type from the config file | |
//No SQL injection as values are treated as integers | |
+ | |
+ // Load realm limit player from realmlist table | |
+ sLog.outString("Load realm player limit..."); | |
+ LoadRealmLimit(); | |
+ | |
// not send custom type REALM_FFA_PVP to realm list | |
uint32 server_type = IsFFAPvPRealm() ? REALM_TYPE_PVP : getConfig(CONFIG_GAME_TYPE); | |
uint32 realm_zone = getConfig(CONFIG_REALM_ZONE); | |
@@ -2257,6 +2260,28 @@ void World::SetPlayerLimit( int32 limit, bool needUpdate ) | |
loginDatabase.PExecute("UPDATE realmlist SET allowedSecurityLevel = '%u' WHERE id = '%d'",uint8(GetPlayerSecurityLimit()),realmID); | |
} | |
+void World::LoadRealmLimit() | |
+{ | |
+ QueryResult* result = loginDatabase.PQuery("SELECT plimit FROM realmlist WHERE id = '%d' LIMIT 1", realmID); | |
+ | |
+ if(result) | |
+ { | |
+ Field* fields = result->Fetch(); | |
+ uint32 plimit = fields[0].GetInt32(); | |
+ | |
+ SetPlayerLimit(limit); | |
+ }else{ | |
+ SetPlayerLimit(DEFAULT_PLAYER_LIMIT); | |
+ } | |
+ | |
+ delete result; | |
+} | |
+ | |
+void World::GetRealmLimit() | |
+{ | |
+ return m_playerLimit; | |
+} | |
+ | |
void World::UpdateMaxSessionCounters() | |
{ | |
m_maxActiveSessionCount = std::max(m_maxActiveSessionCount,uint32(m_sessions.size()-m_QueuedPlayer.size())); | |
diff --git a/src/game/World.h b/src/game/World.h | |
index a0e2507..67f60f2 100644 | |
--- a/src/game/World.h | |
+++ b/src/game/World.h | |
@@ -408,6 +408,8 @@ class World | |
/// Set the active session server limit (or security level limitation) | |
void SetPlayerLimit(int32 limit, bool needUpdate = false); | |
+ void LoadRealmLimit(); | |
+ void GetRealmLimit(); | |
//player Queue | |
typedef std::list<WorldSession*> Queue; | |
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in | |
index 030d8f5..99feaf9 100644 | |
--- a/src/mangosd/mangosd.conf.dist.in | |
+++ b/src/mangosd/mangosd.conf.dist.in | |
@@ -74,14 +74,6 @@ BindIP = "0.0.0.0" | |
# Default: 1 (speed) | |
# 9 (best compression) | |
# | |
-# PlayerLimit | |
-# Maximum number of players in the world. Excluding Mods, GM's and Admins | |
-# Default: 100 | |
-# 0 (for infinite players) | |
-# -1 (for Mods, GM's and Admins only) | |
-# -2 (for GM's and Admins only) | |
-# -3 (for Admins only) | |
-# | |
# SaveRespawnTimeImmediately | |
# Save respawn time for creatures at death and for gameobjects at use/open | |
# Default: 1 (save creature/gameobject respawn time without waiting grid unload) | |
@@ -164,7 +156,6 @@ BindIP = "0.0.0.0" | |
UseProcessors = 0 | |
ProcessPriority = 1 | |
Compression = 1 | |
-PlayerLimit = 100 | |
SaveRespawnTimeImmediately = 1 | |
MaxOverspeedPings = 2 | |
GridUnload = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment