diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 69 |
1 files changed, 6 insertions, 63 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index f42826a04e4..df7a3a65dd8 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2899,73 +2899,16 @@ void ObjectMgr::LoadPlayerInfo() { uint32 oldMSTime = getMSTime(); - QueryResult result = WorldDatabase.PQuery("SELECT raceMask, classMask, skill, rank FROM playercreateinfo_skills"); - - if (!result) - { - TC_LOG_ERROR("server.loading", ">> Loaded 0 player create skills. DB table `playercreateinfo_skills` is empty."); - } - else - { - uint32 count = 0; - - do - { - Field* fields = result->Fetch(); - uint32 raceMask = fields[0].GetUInt32(); - uint32 classMask = fields[1].GetUInt32(); - PlayerCreateInfoSkill skill; - skill.SkillId = fields[2].GetUInt16(); - skill.Rank = fields[3].GetUInt16(); - - if (skill.Rank >= MAX_SKILL_STEP) - { - TC_LOG_ERROR("sql.sql", "Skill rank value %hu set for skill %hu raceMask %u classMask %u is too high, max allowed value is %d", skill.Rank, skill.SkillId, raceMask, classMask, MAX_SKILL_STEP); - continue; - } - - if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE)) - { - TC_LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_skills` table, ignoring.", raceMask); - continue; - } - - if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE)) - { - TC_LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_skills` table, ignoring.", classMask); - continue; - } - - if (!sSkillLineStore.LookupEntry(skill.SkillId)) - { - TC_LOG_ERROR("sql.sql", "Wrong skill id %u in `playercreateinfo_skills` table, ignoring.", skill.SkillId); - continue; - } - + for (SkillRaceClassInfoEntry const* rcInfo : sSkillRaceClassInfoStore) + if (rcInfo->Availability == 1) for (uint32 raceIndex = RACE_HUMAN; raceIndex < MAX_RACES; ++raceIndex) - { - if (raceMask == 0 || ((1 << (raceIndex - 1)) & raceMask)) - { + if (rcInfo->RaceMask == -1 || ((1 << (raceIndex - 1)) & rcInfo->RaceMask)) for (uint32 classIndex = CLASS_WARRIOR; classIndex < MAX_CLASSES; ++classIndex) - { - if (classMask == 0 || ((1 << (classIndex - 1)) & classMask)) - { - if (!GetSkillRaceClassInfo(skill.SkillId, raceIndex, classIndex)) - continue; - + if (rcInfo->ClassMask == -1 || ((1 << (classIndex - 1)) & rcInfo->ClassMask)) if (PlayerInfo* info = _playerInfo[raceIndex][classIndex]) - { - info->skills.push_back(skill); - ++count; - } - } - } - } - } - } while (result->NextRow()); + info->skills.push_back(rcInfo); - TC_LOG_INFO("server.loading", ">> Loaded %u player create skills in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } + TC_LOG_INFO("server.loading", ">> Loaded player create skills in %u ms", GetMSTimeDiffToNow(oldMSTime)); } // Load playercreate custom spells |