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
This commit is contained in:
Chaz Brown
2009-08-29 05:17:55 -04:00
parent 594a1f8a36
commit 2345c5ca8d
3 changed files with 41 additions and 11 deletions

View File

@@ -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()

View File

@@ -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();

View File

@@ -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);
}