mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9389] Cleanup config data. Use proper names and expected types.
This commit is contained in:
parent
58d188f21a
commit
ebfb0f9835
63 changed files with 1591 additions and 967 deletions
|
|
@ -2224,7 +2224,7 @@ void ObjectMgr::LoadPetLevelInfo()
|
|||
}
|
||||
|
||||
uint32 current_level = fields[1].GetUInt32();
|
||||
if(current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if(current_level > sWorld.getConfig(CONFIG_UINT32_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);
|
||||
|
|
@ -2244,7 +2244,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.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)];
|
||||
|
||||
// data for level 1 stored in [0] array element, ...
|
||||
PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1];
|
||||
|
|
@ -2282,7 +2282,7 @@ void ObjectMgr::LoadPetLevelInfo()
|
|||
}
|
||||
|
||||
// fill level gaps
|
||||
for (uint32 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
for (uint32 level = 1; level < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); ++level)
|
||||
{
|
||||
if(pInfo[level].health == 0)
|
||||
{
|
||||
|
|
@ -2295,8 +2295,8 @@ void ObjectMgr::LoadPetLevelInfo()
|
|||
|
||||
PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint32 level) const
|
||||
{
|
||||
if(level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
level = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
if(level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
|
||||
level = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL);
|
||||
|
||||
PetLevelInfoMap::const_iterator itr = petInfo.find(creature_id);
|
||||
if(itr == petInfo.end())
|
||||
|
|
@ -2622,7 +2622,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
sLog.outErrorDb("Wrong level %u in `player_classlevelstats` table, ignoring.",current_level);
|
||||
continue;
|
||||
}
|
||||
else if(current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
else if(current_level > sWorld.getConfig(CONFIG_UINT32_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);
|
||||
|
|
@ -2637,7 +2637,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.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)];
|
||||
|
||||
PlayerClassLevelInfo* pClassLevelInfo = &pClassInfo->levelInfo[current_level-1];
|
||||
|
||||
|
|
@ -2672,7 +2672,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
}
|
||||
|
||||
// fill level gaps
|
||||
for (uint32 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
for (uint32 level = 1; level < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); ++level)
|
||||
{
|
||||
if(pClassInfo->levelInfo[level].basehealth == 0)
|
||||
{
|
||||
|
|
@ -2720,7 +2720,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
}
|
||||
|
||||
uint32 current_level = fields[2].GetUInt32();
|
||||
if(current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if(current_level > sWorld.getConfig(CONFIG_UINT32_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);
|
||||
|
|
@ -2735,7 +2735,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.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)];
|
||||
|
||||
PlayerLevelInfo* pLevelInfo = &pInfo->levelInfo[current_level-1];
|
||||
|
||||
|
|
@ -2775,11 +2775,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.getConfig(CONFIG_UINT32_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.getConfig(CONFIG_UINT32_EXPANSION) < 2 && class_ == CLASS_DEATH_KNIGHT)
|
||||
continue;
|
||||
|
||||
// fatal error if no level 1 data
|
||||
|
|
@ -2790,7 +2790,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
}
|
||||
|
||||
// fill level gaps
|
||||
for (uint32 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
for (uint32 level = 1; level < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); ++level)
|
||||
{
|
||||
if(pInfo->levelInfo[level].stats[0] == 0)
|
||||
{
|
||||
|
|
@ -2803,8 +2803,8 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
|
||||
// Loading xp per level data
|
||||
{
|
||||
mPlayerXPperLevel.resize(sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||
for (uint32 level = 0; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
mPlayerXPperLevel.resize(sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL));
|
||||
for (uint32 level = 0; level < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); ++level)
|
||||
mPlayerXPperLevel[level] = 0;
|
||||
|
||||
// 0 1
|
||||
|
|
@ -2831,7 +2831,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.getConfig(CONFIG_UINT32_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);
|
||||
|
|
@ -2856,7 +2856,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
}
|
||||
|
||||
// fill level gaps
|
||||
for (uint32 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
|
||||
for (uint32 level = 1; level < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); ++level)
|
||||
{
|
||||
if( mPlayerXPperLevel[level] == 0)
|
||||
{
|
||||
|
|
@ -2873,8 +2873,8 @@ void ObjectMgr::GetPlayerClassLevelInfo(uint32 class_, uint32 level, PlayerClass
|
|||
|
||||
PlayerClassInfo const* pInfo = &playerClassInfo[class_];
|
||||
|
||||
if(level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
level = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
if(level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
|
||||
level = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL);
|
||||
|
||||
*info = pInfo->levelInfo[level-1];
|
||||
}
|
||||
|
|
@ -2888,7 +2888,7 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, Pla
|
|||
if(pInfo->displayId_m==0 || pInfo->displayId_f==0)
|
||||
return;
|
||||
|
||||
if(level <= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if(level <= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
|
||||
*info = pInfo->levelInfo[level-1];
|
||||
else
|
||||
BuildPlayerLevelInfo(race,class_,level,info);
|
||||
|
|
@ -2897,9 +2897,9 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, Pla
|
|||
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.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)-1];
|
||||
|
||||
for(int lvl = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
|
||||
for(int lvl = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
|
||||
{
|
||||
switch(_class)
|
||||
{
|
||||
|
|
@ -3044,9 +3044,9 @@ void ObjectMgr::LoadGuilds()
|
|||
delete guildBankTabRightsResult;
|
||||
|
||||
//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));
|
||||
//you can comment these lines if you don't plan to change CONFIG_UINT32_GUILD_EVENT_LOG_COUNT and CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT
|
||||
CharacterDatabase.PQuery("DELETE FROM guild_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT));
|
||||
CharacterDatabase.PQuery("DELETE FROM guild_bank_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT));
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u guild definitions", count );
|
||||
|
|
@ -6939,7 +6939,7 @@ enum LanguageType
|
|||
|
||||
static LanguageType GetRealmLanguageType(bool create)
|
||||
{
|
||||
switch(sWorld.getConfig(CONFIG_REALM_ZONE))
|
||||
switch(sWorld.getConfig(CONFIG_UINT32_REALM_ZONE))
|
||||
{
|
||||
case REALM_ZONE_UNKNOWN: // any language
|
||||
case REALM_ZONE_DEVELOPMENT:
|
||||
|
|
@ -7010,11 +7010,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.getConfig(CONFIG_UINT32_MIN_PLAYER_NAME);
|
||||
if(wname.size() < minName)
|
||||
return CHAR_NAME_TOO_SHORT;
|
||||
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PLAYER_NAMES);
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_UINT32_STRICT_PLAYER_NAMES);
|
||||
if(!isValidString(wname,strictMask,false,create))
|
||||
return CHAR_NAME_MIXED_LANGUAGES;
|
||||
|
||||
|
|
@ -7030,11 +7030,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.getConfig(CONFIG_UINT32_MIN_CHARTER_NAME);
|
||||
if(wname.size() < minName)
|
||||
return false;
|
||||
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_CHARTER_NAMES);
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_UINT32_STRICT_CHARTER_NAMES);
|
||||
|
||||
return isValidString(wname,strictMask,true);
|
||||
}
|
||||
|
|
@ -7048,11 +7048,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.getConfig(CONFIG_UINT32_MIN_PET_NAME);
|
||||
if(wname.size() < minName)
|
||||
return PET_NAME_TOO_SHORT;
|
||||
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PET_NAMES);
|
||||
uint32 strictMask = sWorld.getConfig(CONFIG_UINT32_STRICT_PET_NAMES);
|
||||
if(!isValidString(wname,strictMask,false))
|
||||
return PET_NAME_MIXED_LANGUAGES;
|
||||
|
||||
|
|
@ -7620,7 +7620,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
|
|||
}
|
||||
case CONDITION_LEVEL:
|
||||
{
|
||||
if (!value1 || value1 > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (!value1 || value1 > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
sLog.outErrorDb("Level condition has invalid level %u, skipped", value1);
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue