aboutsummaryrefslogtreecommitdiff
path: root/src/game/World.cpp
diff options
context:
space:
mode:
authorChaz Brown <iamparadox@netscape.net>2009-08-29 05:17:55 -0400
committerChaz Brown <iamparadox@netscape.net>2009-08-29 05:17:55 -0400
commit2345c5ca8d431f897d90b290974bc9cdb002a66f (patch)
tree23a39b3bf476ed5d4adcc9d2ba0b05802327654c /src/game/World.cpp
parent594a1f8a36c5f7c5f7292348942d3753fcd8e2dd (diff)
Change default MOTD text in load from conf (how did this get overlooked?) comment out some nonsense in SetPlayerLimit that was causing the allowedSecurityLevel in realmd to be reset. (I think someone got confused between setting a limit on number of players allowed and the allowed security limit...) You can now Block Players from connecting to certain realms by setting the allowedSecurityLevel in the realmlist - Thanks, raczman for nudging me in the right direction
--HG-- branch : trunk
Diffstat (limited to 'src/game/World.cpp')
-rw-r--r--src/game/World.cpp43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 22cfebf8911..0d80b9033f0 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -87,6 +87,7 @@ float World::m_VisibleObjectGreyDistance = 0;
World::World()
{
m_playerLimit = 0;
+ m_allowedSecurityLevel = SEC_PLAYER;
m_allowMovement = true;
m_ShutdownMask = 0;
m_ShutdownTimer = 0;
@@ -426,7 +427,7 @@ 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." ) );
+ SetMotd( sConfig.GetStringDefault("Motd", "Welcome to a Trinity Core Server." ) );
///- Get string for new logins (newly created characters)
SetNewCharString(sConfig.GetStringDefault("PlayerStart.String", ""));
@@ -2510,16 +2511,44 @@ void World::ResetDailyQuests()
void World::SetPlayerLimit( int32 limit, bool needUpdate )
{
- if(limit < -SEC_ADMINISTRATOR)
- limit = -SEC_ADMINISTRATOR;
-
+ //if(limit < -SEC_ADMINISTRATOR)
+ //limit = -SEC_ADMINISTRATOR;
+
// lock update need
- bool db_update_need = needUpdate || (limit < 0) != (m_playerLimit < 0) || (limit < 0 && m_playerLimit < 0 && limit != m_playerLimit);
+ //bool db_update_need = needUpdate || (limit < 0) != (m_playerLimit < 0) || (limit < 0 && m_playerLimit < 0 && limit != m_playerLimit);
m_playerLimit = limit;
+ QueryResult *result = loginDatabase.PQuery("SELECT allowedSecurityLevel from realmlist WHERE id = '%d'", realmID);
+ if (result)
+ {
+ switch (result->Fetch()->GetUInt8())
+ {
+ case SEC_ADMINISTRATOR:
+ {
+ m_allowedSecurityLevel = SEC_ADMINISTRATOR;
+ }
+ case SEC_MODERATOR:
+ {
+ m_allowedSecurityLevel = SEC_MODERATOR;
+ }
+ case SEC_GAMEMASTER:
+ {
+ m_allowedSecurityLevel = SEC_GAMEMASTER;
+ }
+ case SEC_PLAYER:
+ {
+ m_allowedSecurityLevel = SEC_PLAYER;
+ }
+ default:
+ {
+ m_allowedSecurityLevel = SEC_ADMINISTRATOR;
+ }
+ }
+ delete result;
+ }
- if(db_update_need)
- loginDatabase.PExecute("UPDATE realmlist SET allowedSecurityLevel = '%u' WHERE id = '%d'",uint8(GetPlayerSecurityLimit()),realmID);
+ //if(db_update_need)
+ //loginDatabase.PExecute("UPDATE realmlist SET allowedSecurityLevel = '%u' WHERE id = '%d'",uint8(GetPlayerSecurityLimit()),realmID);
}
void World::UpdateMaxSessionCounters()