Replace World::getConfig with World::getFloatConfig, World::getIntConfig, and World::getBoolConfig.
Also fix a warning from a previous commit. --HG-- branch : trunk
This commit is contained in:
@@ -161,7 +161,7 @@ void Channel::Join(uint64 p, const char *pass)
|
||||
if (plr)
|
||||
{
|
||||
if (HasFlag(CHANNEL_FLAG_LFG) &&
|
||||
sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && plr->GetGroup())
|
||||
sWorld.getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && plr->GetGroup())
|
||||
{
|
||||
MakeNotInLfg(&data);
|
||||
SendToOne(&data, p);
|
||||
@@ -171,7 +171,7 @@ void Channel::Join(uint64 p, const char *pass)
|
||||
plr->JoinedChannel(this);
|
||||
}
|
||||
|
||||
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
{
|
||||
MakeJoined(&data, p);
|
||||
SendToAll(&data);
|
||||
@@ -231,7 +231,7 @@ void Channel::Leave(uint64 p, bool send)
|
||||
bool changeowner = players[p].IsOwner();
|
||||
|
||||
players.erase(p);
|
||||
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeLeft(&data, p);
|
||||
@@ -439,7 +439,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
|
||||
// allow make moderator from another team only if both is GMs
|
||||
// at this moment this only way to show channel post for GM from another team
|
||||
if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
|
||||
plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
plr->GetTeam() != newp->GetTeam() && !sWorld.getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakePlayerNotFound(&data, p2n);
|
||||
@@ -495,7 +495,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
|
||||
return;
|
||||
}
|
||||
|
||||
if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
if (newp->GetTeam() != plr->GetTeam() && !sWorld.getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakePlayerNotFound(&data, newname);
|
||||
@@ -543,7 +543,7 @@ void Channel::List(Player* player)
|
||||
size_t pos = data.wpos();
|
||||
data << uint32(0); // size of list, placeholder
|
||||
|
||||
uint32 gmLevelInWhoList = sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
||||
uint32 gmLevelInWhoList = sWorld.getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
||||
|
||||
uint32 count = 0;
|
||||
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
|
||||
@@ -640,7 +640,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
|
||||
{
|
||||
if (!what)
|
||||
return;
|
||||
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
if (sWorld.getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
lang = LANG_UNIVERSAL;
|
||||
|
||||
uint32 sec = 0;
|
||||
@@ -716,7 +716,7 @@ void Channel::Invite(uint64 p, const char *newname)
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
if (newp->GetTeam() != plr->GetTeam() && !sWorld.getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeInviteWrongFaction(&data);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
ChannelMgr* channelMgr(uint32 team)
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
if (sWorld.getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction
|
||||
|
||||
if (team == ALLIANCE)
|
||||
|
||||
@@ -837,7 +837,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
|
||||
return false;
|
||||
|
||||
// ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
|
||||
if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld.getConfig(CONFIG_GM_LOWER_SECURITY))
|
||||
if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld.getBoolConfig(CONFIG_GM_LOWER_SECURITY))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
@@ -1102,7 +1102,7 @@ int ChatHandler::ParseCommands(const char* text)
|
||||
|
||||
std::string fullcmd = text;
|
||||
|
||||
if (m_session && m_session->GetSecurity() <= SEC_PLAYER && sWorld.getConfig(CONFIG_ALLOW_PLAYER_COMMANDS) == 0)
|
||||
if (m_session && m_session->GetSecurity() <= SEC_PLAYER && sWorld.getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS) == 0)
|
||||
return 0;
|
||||
|
||||
/// chat case (.command or !command format)
|
||||
@@ -1163,7 +1163,7 @@ valid examples:
|
||||
const char* validSequenceIterator = validSequence;
|
||||
|
||||
// more simple checks
|
||||
if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) < 3)
|
||||
if (sWorld.getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) < 3)
|
||||
{
|
||||
const std::string validCommands = "cHhr|";
|
||||
|
||||
@@ -1182,7 +1182,7 @@ valid examples:
|
||||
|
||||
++message;
|
||||
// validate sequence
|
||||
if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) == 2)
|
||||
if (sWorld.getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) == 2)
|
||||
{
|
||||
if (commandChar == *validSequenceIterator)
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
|
||||
}
|
||||
|
||||
// save if the player has last been saved over 20 seconds ago
|
||||
uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE);
|
||||
uint32 save_interval = sWorld.getIntConfig(CONFIG_INTERVAL_SAVE);
|
||||
if (save_interval == 0 || (save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
|
||||
player->SaveToDB();
|
||||
|
||||
@@ -162,7 +162,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
|
||||
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= AccountTypes(sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
|
||||
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= AccountTypes(sWorld.getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
|
||||
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
|
||||
{
|
||||
if (first)
|
||||
@@ -252,7 +252,7 @@ bool ChatHandler::HandleAccountAddonCommand(const char* args)
|
||||
uint32 account_id = m_session->GetAccountId();
|
||||
|
||||
int expansion = atoi(szExp); //get int anyway (0 if error)
|
||||
if (expansion < 0 || uint8(expansion) > sWorld.getConfig(CONFIG_EXPANSION))
|
||||
if (expansion < 0 || uint8(expansion) > sWorld.getIntConfig(CONFIG_EXPANSION))
|
||||
{
|
||||
SendSysMessage(LANG_IMPROPER_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
||||
@@ -1199,7 +1199,7 @@ bool ChatHandler::HandleNpcChangeLevelCommand(const char* args)
|
||||
return false;
|
||||
|
||||
uint8 lvl = (uint8) atoi((char*)args);
|
||||
if (lvl < 1 || lvl > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) + 3)
|
||||
if (lvl < 1 || lvl > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL) + 3)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
@@ -2042,7 +2042,7 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||
if (HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
|
||||
if (sWorld.getIntConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
|
||||
{
|
||||
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str());
|
||||
}
|
||||
@@ -2089,7 +2089,7 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||
|
||||
if (sWorld.KickPlayer(name))
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
|
||||
if (sWorld.getIntConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
|
||||
{
|
||||
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, nameLink.c_str(), kicker.c_str(), reason.c_str());
|
||||
}
|
||||
|
||||
@@ -3947,7 +3947,7 @@ bool ChatHandler::HandleDieCommand(const char* /*args*/)
|
||||
|
||||
if (target->isAlive())
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_DIE_COMMAND_MODE))
|
||||
if (sWorld.getBoolConfig(CONFIG_DIE_COMMAND_MODE))
|
||||
m_session->GetPlayer()->Kill(target);
|
||||
else
|
||||
m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
@@ -4668,7 +4668,7 @@ bool ChatHandler::HandleChangeWeather(const char *args)
|
||||
return false;
|
||||
|
||||
//Weather is OFF
|
||||
if (!sWorld.getConfig(CONFIG_WEATHER))
|
||||
if (!sWorld.getBoolConfig(CONFIG_WEATHER))
|
||||
{
|
||||
SendSysMessage(LANG_WEATHER_DISABLED);
|
||||
SetSentErrorMessage(true);
|
||||
@@ -4941,8 +4941,8 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
|
||||
|
||||
// set starting level
|
||||
uint32 start_level = target->getClass() != CLASS_DEATH_KNIGHT
|
||||
? sWorld.getConfig(CONFIG_START_PLAYER_LEVEL)
|
||||
: sWorld.getConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
|
||||
? sWorld.getIntConfig(CONFIG_START_PLAYER_LEVEL)
|
||||
: sWorld.getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
|
||||
|
||||
sScriptMgr.OnPlayerLevelChanged(target, start_level);
|
||||
|
||||
@@ -6727,7 +6727,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char *args)
|
||||
return false;
|
||||
|
||||
int expansion = atoi(szExp); //get int anyway (0 if error)
|
||||
if (expansion < 0 || uint8(expansion) > sWorld.getConfig(CONFIG_EXPANSION))
|
||||
if (expansion < 0 || uint8(expansion) > sWorld.getIntConfig(CONFIG_EXPANSION))
|
||||
return false;
|
||||
|
||||
// No SQL injection
|
||||
|
||||
Reference in New Issue
Block a user