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:
@@ -308,7 +308,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool /*insign
|
||||
// create the bones only if the map and the grid is loaded at the corpse's location
|
||||
// ignore bones creating option in case insignia
|
||||
if (map && (insignia ||
|
||||
(map->IsBattlegroundOrArena() ? sWorld.getConfig(CONFIG_DEATH_BONES_BG_OR_ARENA) : sWorld.getConfig(CONFIG_DEATH_BONES_WORLD))) &&
|
||||
(map->IsBattlegroundOrArena() ? sWorld.getIntConfig(CONFIG_DEATH_BONES_BG_OR_ARENA) : sWorld.getIntConfig(CONFIG_DEATH_BONES_WORLD))) &&
|
||||
!map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY()))
|
||||
{
|
||||
// Create bones, don't change Corpse
|
||||
|
||||
@@ -2698,7 +2698,7 @@ void ObjectMgr::LoadPetLevelInfo()
|
||||
}
|
||||
|
||||
uint32 current_level = fields[1].GetUInt32();
|
||||
if (current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (current_level > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
|
||||
sLog.outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
|
||||
@@ -2718,7 +2718,7 @@ void ObjectMgr::LoadPetLevelInfo()
|
||||
PetLevelInfo*& pInfoMapEntry = petInfo[creature_id];
|
||||
|
||||
if (pInfoMapEntry == NULL)
|
||||
pInfoMapEntry = new PetLevelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)];
|
||||
pInfoMapEntry = new PetLevelInfo[sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
|
||||
|
||||
// data for level 1 stored in [0] array element, ...
|
||||
PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1];
|
||||
@@ -2754,7 +2754,7 @@ void ObjectMgr::LoadPetLevelInfo()
|
||||
}
|
||||
|
||||
// fill level gaps
|
||||
for (uint8 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
{
|
||||
if (pInfo[level].health == 0)
|
||||
{
|
||||
@@ -2767,8 +2767,8 @@ void ObjectMgr::LoadPetLevelInfo()
|
||||
|
||||
PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const
|
||||
{
|
||||
if (level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
level = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
if (level > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
level = sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
|
||||
PetLevelInfoMap::const_iterator itr = petInfo.find(creature_id);
|
||||
if (itr == petInfo.end())
|
||||
@@ -2994,7 +2994,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
{
|
||||
|
||||
QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL);
|
||||
if (sWorld.getConfig(CONFIG_START_ALL_SPELLS))
|
||||
if (sWorld.getBoolConfig(CONFIG_START_ALL_SPELLS))
|
||||
result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom");
|
||||
else
|
||||
result = WorldDatabase.Query("SELECT race, class, Spell FROM playercreateinfo_spell");
|
||||
@@ -3137,7 +3137,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
}
|
||||
|
||||
uint8 current_level = fields[1].GetUInt8();
|
||||
if (current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (current_level > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
|
||||
sLog.outErrorDb("Wrong (> %u) level %u in `player_classlevelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
|
||||
@@ -3152,7 +3152,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
PlayerClassInfo* pClassInfo = &playerClassInfo[current_class];
|
||||
|
||||
if (!pClassInfo->levelInfo)
|
||||
pClassInfo->levelInfo = new PlayerClassLevelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)];
|
||||
pClassInfo->levelInfo = new PlayerClassLevelInfo[sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
|
||||
|
||||
PlayerClassLevelInfo* pClassLevelInfo = &pClassInfo->levelInfo[current_level-1];
|
||||
|
||||
@@ -3185,7 +3185,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
}
|
||||
|
||||
// fill level gaps
|
||||
for (uint8 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
{
|
||||
if (pClassInfo->levelInfo[level].basehealth == 0)
|
||||
{
|
||||
@@ -3234,7 +3234,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
}
|
||||
|
||||
uint32 current_level = fields[2].GetUInt32();
|
||||
if (current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (current_level > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
|
||||
sLog.outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
|
||||
@@ -3249,7 +3249,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
PlayerInfo* pInfo = &playerInfo[current_race][current_class];
|
||||
|
||||
if (!pInfo->levelInfo)
|
||||
pInfo->levelInfo = new PlayerLevelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)];
|
||||
pInfo->levelInfo = new PlayerLevelInfo[sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
|
||||
|
||||
PlayerLevelInfo* pLevelInfo = &pInfo->levelInfo[current_level-1];
|
||||
|
||||
@@ -3287,11 +3287,11 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
continue;
|
||||
|
||||
// skip expansion races if not playing with expansion
|
||||
if (sWorld.getConfig(CONFIG_EXPANSION) < 1 && (race == RACE_BLOODELF || race == RACE_DRAENEI))
|
||||
if (sWorld.getIntConfig(CONFIG_EXPANSION) < 1 && (race == RACE_BLOODELF || race == RACE_DRAENEI))
|
||||
continue;
|
||||
|
||||
// skip expansion classes if not playing with expansion
|
||||
if (sWorld.getConfig(CONFIG_EXPANSION) < 2 && class_ == CLASS_DEATH_KNIGHT)
|
||||
if (sWorld.getIntConfig(CONFIG_EXPANSION) < 2 && class_ == CLASS_DEATH_KNIGHT)
|
||||
continue;
|
||||
|
||||
// fatal error if no level 1 data
|
||||
@@ -3302,7 +3302,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
}
|
||||
|
||||
// fill level gaps
|
||||
for (uint8 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
{
|
||||
if (pInfo->levelInfo[level].stats[0] == 0)
|
||||
{
|
||||
@@ -3316,8 +3316,8 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
// Loading xp per level data
|
||||
sLog.outString("Loading Player Create XP Data...");
|
||||
{
|
||||
mPlayerXPperLevel.resize(sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||
for (uint8 level = 0; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
mPlayerXPperLevel.resize(sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||
for (uint8 level = 0; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
mPlayerXPperLevel[level] = 0;
|
||||
|
||||
// 0 1
|
||||
@@ -3344,7 +3344,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
uint32 current_level = fields[0].GetUInt32();
|
||||
uint32 current_xp = fields[1].GetUInt32();
|
||||
|
||||
if (current_level >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (current_level >= sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
|
||||
sLog.outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL,current_level);
|
||||
@@ -3367,7 +3367,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
}
|
||||
|
||||
// fill level gaps
|
||||
for (uint8 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
{
|
||||
if (mPlayerXPperLevel[level] == 0)
|
||||
{
|
||||
@@ -3384,8 +3384,8 @@ void ObjectMgr::GetPlayerClassLevelInfo(uint32 class_, uint8 level, PlayerClassL
|
||||
|
||||
PlayerClassInfo const* pInfo = &playerClassInfo[class_];
|
||||
|
||||
if (level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
level = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
if (level > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
level = sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
|
||||
*info = pInfo->levelInfo[level-1];
|
||||
}
|
||||
@@ -3399,7 +3399,7 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, Play
|
||||
if (pInfo->displayId_m == 0 || pInfo->displayId_f == 0)
|
||||
return;
|
||||
|
||||
if (level <= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (level <= sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
*info = pInfo->levelInfo[level-1];
|
||||
else
|
||||
BuildPlayerLevelInfo(race,class_,level,info);
|
||||
@@ -3408,10 +3408,10 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, Play
|
||||
void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const
|
||||
{
|
||||
// base data (last known level)
|
||||
*info = playerInfo[race][_class].levelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)-1];
|
||||
*info = playerInfo[race][_class].levelInfo[sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1];
|
||||
|
||||
// if conversion from uint32 to uint8 causes unexpected behaviour, change lvl to uint32
|
||||
for (uint8 lvl = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
|
||||
for (uint8 lvl = sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
|
||||
{
|
||||
switch(_class)
|
||||
{
|
||||
@@ -3553,8 +3553,8 @@ void ObjectMgr::LoadGuilds()
|
||||
|
||||
//delete unused LogGuid records in guild_eventlog and guild_bank_eventlog table
|
||||
//you can comment these lines if you don't plan to change CONFIG_GUILD_EVENT_LOG_COUNT and CONFIG_GUILD_BANK_EVENT_LOG_COUNT
|
||||
CharacterDatabase.PQuery("DELETE FROM guild_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_GUILD_EVENT_LOG_COUNT));
|
||||
CharacterDatabase.PQuery("DELETE FROM guild_bank_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
|
||||
CharacterDatabase.PQuery("DELETE FROM guild_eventlog WHERE LogGuid > '%u'", sWorld.getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT));
|
||||
CharacterDatabase.PQuery("DELETE FROM guild_bank_eventlog WHERE LogGuid > '%u'", sWorld.getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u guild definitions", count);
|
||||
@@ -7622,7 +7622,7 @@ enum LanguageType
|
||||
|
||||
static LanguageType GetRealmLanguageType(bool create)
|
||||
{
|
||||
switch(sWorld.getConfig(CONFIG_REALM_ZONE))
|
||||
switch(sWorld.getIntConfig(CONFIG_REALM_ZONE))
|
||||
{
|
||||
case REALM_ZONE_UNKNOWN: // any language
|
||||
case REALM_ZONE_DEVELOPMENT:
|
||||
@@ -7693,11 +7693,11 @@ uint8 ObjectMgr::CheckPlayerName(const std::string& name, bool create)
|
||||
if (wname.size() > MAX_PLAYER_NAME)
|
||||
return CHAR_NAME_TOO_LONG;
|
||||
|
||||
uint32 minName = sWorld.getConfig(CONFIG_MIN_PLAYER_NAME);
|
||||
uint32 minName = sWorld.getIntConfig(CONFIG_MIN_PLAYER_NAME);
|
||||
if (wname.size() < minName)
|
||||
return CHAR_NAME_TOO_SHORT;
|
||||
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PLAYER_NAMES);
|
||||
uint32 strictMask = sWorld.getIntConfig(CONFIG_STRICT_PLAYER_NAMES);
|
||||
if (!isValidString(wname,strictMask,false,create))
|
||||
return CHAR_NAME_MIXED_LANGUAGES;
|
||||
|
||||
@@ -7713,11 +7713,11 @@ bool ObjectMgr::IsValidCharterName(const std::string& name)
|
||||
if (wname.size() > MAX_CHARTER_NAME)
|
||||
return false;
|
||||
|
||||
uint32 minName = sWorld.getConfig(CONFIG_MIN_CHARTER_NAME);
|
||||
uint32 minName = sWorld.getIntConfig(CONFIG_MIN_CHARTER_NAME);
|
||||
if (wname.size() < minName)
|
||||
return false;
|
||||
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_CHARTER_NAMES);
|
||||
uint32 strictMask = sWorld.getIntConfig(CONFIG_STRICT_CHARTER_NAMES);
|
||||
|
||||
return isValidString(wname,strictMask,true);
|
||||
}
|
||||
@@ -7731,11 +7731,11 @@ PetNameInvalidReason ObjectMgr::CheckPetName(const std::string& name)
|
||||
if (wname.size() > MAX_PET_NAME)
|
||||
return PET_NAME_TOO_LONG;
|
||||
|
||||
uint32 minName = sWorld.getConfig(CONFIG_MIN_PET_NAME);
|
||||
uint32 minName = sWorld.getIntConfig(CONFIG_MIN_PET_NAME);
|
||||
if (wname.size() < minName)
|
||||
return PET_NAME_TOO_SHORT;
|
||||
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PET_NAMES);
|
||||
uint32 strictMask = sWorld.getIntConfig(CONFIG_STRICT_PET_NAMES);
|
||||
if (!isValidString(wname,strictMask,false))
|
||||
return PET_NAME_MIXED_LANGUAGES;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user