diff options
author | Chaz Brown <iamparadox@netscape.net> | 2009-08-29 05:17:55 -0400 |
---|---|---|
committer | Chaz Brown <iamparadox@netscape.net> | 2009-08-29 05:17:55 -0400 |
commit | 2345c5ca8d431f897d90b290974bc9cdb002a66f (patch) | |
tree | 23a39b3bf476ed5d4adcc9d2ba0b05802327654c /src | |
parent | 594a1f8a36c5f7c5f7292348942d3753fcd8e2dd (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')
-rw-r--r-- | src/game/World.cpp | 43 | ||||
-rw-r--r-- | src/game/World.h | 3 | ||||
-rw-r--r-- | src/trinityrealm/AuthSocket.cpp | 6 |
3 files changed, 41 insertions, 11 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() diff --git a/src/game/World.h b/src/game/World.h index e78bd35e10a..8c2692fa4d6 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -461,7 +461,7 @@ class World /// Get the active session server limit (or security level limitations) uint32 GetPlayerAmountLimit() const { return m_playerLimit >= 0 ? m_playerLimit : 0; } - AccountTypes GetPlayerSecurityLimit() const { return m_playerLimit <= 0 ? AccountTypes(-m_playerLimit) : SEC_PLAYER; } + AccountTypes GetPlayerSecurityLimit() const { return m_allowedSecurityLevel < 0 ? SEC_PLAYER : m_allowedSecurityLevel; } /// Set the active session server limit (or security level limitation) void SetPlayerLimit(int32 limit, bool needUpdate = false); @@ -649,6 +649,7 @@ class World float rate_values[MAX_RATES]; uint32 m_configs[CONFIG_VALUE_COUNT]; int32 m_playerLimit; + AccountTypes m_allowedSecurityLevel; LocaleConstant m_defaultDbcLocale; // from config for one from loaded DBC locales uint32 m_availableDbcLocaleMask; // by loaded DBC void DetectDBCLang(); diff --git a/src/trinityrealm/AuthSocket.cpp b/src/trinityrealm/AuthSocket.cpp index 06c55f4955e..14dadb1f2e2 100644 --- a/src/trinityrealm/AuthSocket.cpp +++ b/src/trinityrealm/AuthSocket.cpp @@ -473,13 +473,13 @@ bool AuthSocket::_HandleLogonChallenge() uint8 securityFlags = 0; pkt << uint8(securityFlags); // security flags (0x0...0x04) - if(securityFlags & 0x01) // PIN input + if(securityFlags & REALM_AUTH_FAILURE) // PIN input { pkt << uint32(0); pkt << uint64(0) << uint64(0); // 16 bytes hash? } - if(securityFlags & 0x02) // Matrix input + if(securityFlags & REALM_AUTH_UNKNOWN1) // Matrix input { pkt << uint8(0); pkt << uint8(0); @@ -488,7 +488,7 @@ bool AuthSocket::_HandleLogonChallenge() pkt << uint64(0); } - if(securityFlags & 0x04) // Security token input + if(securityFlags & REALM_AUTH_NO_MATCH) // Security token input { pkt << uint8(1); } |