[11587] Use SkillRaceClassInfo.dbc data for check spell training.

* Show race/class specific min level in trainer list (for weapon master for example)
  and use it for check spell traing possibility.
* Hide for specific race/class some spells marked by flag  ABILITY_SKILL_NONTRAINABLE
  This possible in cases when spell available for race/class but learned from talent/etc
  and then don't must be show for race/calss pair in trainer list. Single case in 3.3.5a.
* Add to code tables for profession ranks for seelct correct rank related reqlevel
  and check DB side data for it. Note: DB reqlevel values redundant for profession rank
  spells now.
* Use for reqlevel selection (if DB value not provided) learned spell insteed cast-spell
  spellLevel field. This let in more cases select training reqlevel without provided DB value.
  For LogFilter_DbStrictedCheck = 0 mode output data about like redundant reqlevel values
  in traner tables.
This commit is contained in:
VladimirMangos 2011-06-02 09:17:08 +04:00
parent c2199e7030
commit 108a167c46
13 changed files with 179 additions and 29 deletions

View file

@ -2426,6 +2426,42 @@ bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId)
return IsPrimaryProfessionSkill(skill);
}
uint32 SpellMgr::GetProfessionSpellMinLevel(uint32 spellId)
{
uint32 s2l[8][3] =
{ // 0 - gather 1 - non-gather 2 - fish
/*0*/ { 0, 5, 5 },
/*1*/ { 0, 5, 5 },
/*2*/ { 0, 10, 10 },
/*3*/ { 10, 20, 10 },
/*4*/ { 25, 35, 10 },
/*5*/ { 40, 50, 10 },
/*6*/ { 55, 65, 10 },
/*7*/ { 75, 75, 10 },
};
uint32 rank = GetSpellRank(spellId);
if (rank >= 8)
return 0;
SkillLineAbilityMapBounds bounds = GetSkillLineAbilityMapBounds(spellId);
if (bounds.first == bounds.second)
return 0;
switch (bounds.first->second->skillId)
{
case SKILL_FISHING:
return s2l[rank][2];
case SKILL_HERBALISM:
case SKILL_MINING:
case SKILL_SKINNING:
return s2l[rank][0];
default:
return s2l[rank][1];
}
}
bool SpellMgr::IsPrimaryProfessionFirstRankSpell(uint32 spellId) const
{
return IsPrimaryProfessionSpell(spellId) && GetSpellRank(spellId)==1;
@ -3931,6 +3967,33 @@ void SpellMgr::LoadSkillLineAbilityMap()
sLog.outString(">> Loaded %u SkillLineAbility MultiMap Data", count);
}
void SpellMgr::LoadSkillRaceClassInfoMap()
{
mSkillRaceClassInfoMap.clear();
barGoLink bar( (int)sSkillRaceClassInfoStore.GetNumRows() );
uint32 count = 0;
for (uint32 i = 0; i < sSkillRaceClassInfoStore.GetNumRows(); ++i)
{
bar.step();
SkillRaceClassInfoEntry const *skillRCInfo = sSkillRaceClassInfoStore.LookupEntry(i);
if (!skillRCInfo)
continue;
// not all skills really listed in ability skills list
if (!sSkillLineStore.LookupEntry(skillRCInfo->skillId))
continue;
mSkillRaceClassInfoMap.insert(SkillRaceClassInfoMap::value_type(skillRCInfo->skillId,skillRCInfo));
++count;
}
sLog.outString();
sLog.outString(">> Loaded %u SkillRaceClassInfo MultiMap Data", count);
}
void SpellMgr::CheckUsedSpells(char const* table)
{
uint32 countSpells = 0;