aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/World.cpp43
-rw-r--r--src/game/World.h3
-rw-r--r--src/trinityrealm/AuthSocket.cpp6
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);
}