diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 90 |
1 files changed, 42 insertions, 48 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index a01251af433..040c9600852 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3270,17 +3270,16 @@ void ObjectMgr::LoadPlayerInfo() } } - - // Load playercreate skills - TC_LOG_INFO("server.loading", "Loading Player Create Skill Data..."); + // Load playercreate spells + TC_LOG_INFO("server.loading", "Loading Player Create Spell Data..."); { uint32 oldMSTime = getMSTime(); - QueryResult result = WorldDatabase.PQuery("SELECT raceMask, classMask, skill, rank FROM playercreateinfo_skills"); + QueryResult result = WorldDatabase.PQuery("SELECT racemask, classmask, Spell FROM playercreateinfo_spell"); if (!result) { - TC_LOG_ERROR("server.loading", ">> Loaded 0 player create skills. DB table `playercreateinfo_skills` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 player create spells. DB table `playercreateinfo_spell` is empty."); } else { @@ -3291,31 +3290,17 @@ void ObjectMgr::LoadPlayerInfo() 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; - } + uint32 spellId = fields[2].GetUInt32(); if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE)) { - TC_LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_skills` table, ignoring.", raceMask); + TC_LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_spell` 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); + TC_LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_spell` table, ignoring.", classMask); continue; } @@ -3327,26 +3312,28 @@ void ObjectMgr::LoadPlayerInfo() { if (classMask == 0 || ((1 << (classIndex - 1)) & classMask)) { - if (!GetSkillRaceClassInfo(skill.SkillId, raceIndex, classIndex)) - continue; - if (PlayerInfo* info = _playerInfo[raceIndex][classIndex]) { - info->skills.push_back(skill); + info->spells.push_back(spellId); ++count; } + // We need something better here, the check is not accounting for spells used by multiple races/classes but not all of them. + // Either split the masks per class, or per race, which kind of kills the point yet. + // else if (raceMask != 0 && classMask != 0) + // TC_LOG_ERROR("sql.sql", "Racemask/classmask (%u/%u) combination was found containing an invalid race/class combination (%u/%u) in `%s` (Spell %u), ignoring.", raceMask, classMask, raceIndex, classIndex, tableName.c_str(), spellId); } } } } - } while (result->NextRow()); + } + while (result->NextRow()); - TC_LOG_INFO("server.loading", ">> Loaded %u player create skills in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - // Load playercreate spells - TC_LOG_INFO("server.loading", "Loading Player Create Spell Data..."); + // Load playercreate custom spells + TC_LOG_INFO("server.loading", "Loading Player Create Custom Spell Data..."); { uint32 oldMSTime = getMSTime(); @@ -3354,7 +3341,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - TC_LOG_ERROR("server.loading", ">> Loaded 0 player create spells. DB table `playercreateinfo_spell_custom` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 player create custom spells. DB table `playercreateinfo_spell_custom` is empty."); } else { @@ -7850,27 +7837,34 @@ int32 ObjectMgr::GetBaseReputationOf(FactionEntry const* factionEntry, uint8 rac return 0; } -SkillRangeType GetSkillRangeType(SkillRaceClassInfoEntry const* rcEntry) +SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial) { - SkillLineEntry const* skill = sSkillLineStore.LookupEntry(rcEntry->SkillID); - if (!skill) - return SKILL_RANGE_NONE; - - if (sSkillTiersStore.LookupEntry(rcEntry->SkillTierID)) - return SKILL_RANGE_RANK; - - if (rcEntry->SkillID == SKILL_RUNEFORGING) - return SKILL_RANGE_MONO; - - switch (skill->CategoryID) + switch (pSkill->CategoryID) { - case SKILL_CATEGORY_ARMOR: - return SKILL_RANGE_MONO; case SKILL_CATEGORY_LANGUAGES: return SKILL_RANGE_LANGUAGE; + case SKILL_CATEGORY_WEAPON: + return SKILL_RANGE_LEVEL; + case SKILL_CATEGORY_ARMOR: + case SKILL_CATEGORY_CLASS: + if (pSkill->ID != SKILL_LOCKPICKING) + return SKILL_RANGE_MONO; + else + return SKILL_RANGE_LEVEL; + case SKILL_CATEGORY_SECONDARY: + case SKILL_CATEGORY_PROFESSION: + // not set skills for professions and racial abilities + if (IsProfessionSkill(pSkill->ID)) + return SKILL_RANGE_RANK; + else if (racial) + return SKILL_RANGE_NONE; + else + return SKILL_RANGE_MONO; + default: + case SKILL_CATEGORY_ATTRIBUTES: //not found in dbc + case SKILL_CATEGORY_GENERIC: //only GENERIC(DND) + return SKILL_RANGE_NONE; } - - return SKILL_RANGE_LEVEL; } void ObjectMgr::LoadGameTele() @@ -9367,4 +9361,4 @@ std::string ObjectMgr::GetRealmName(uint32 realm) const { RealmNameContainer::const_iterator iter = _realmNameStore.find(realm); return iter != _realmNameStore.end() ? iter->second : ""; -} +}
\ No newline at end of file |