Core/Spells: Automatically generate spell rank info from SkillLineAbility

* This fixes weird spellbook/talent/glyph/profession ui behavior when knowing multiple spells to remove talent or glyph, or multiple spells to open profession ui
This commit is contained in:
Shauren
2016-06-15 16:20:43 +02:00
parent 8839369fc5
commit 5da217877b
5 changed files with 63 additions and 142 deletions

View File

@@ -1257,22 +1257,6 @@ bool SpellInfo::IsQuestTame() const
return effect0 && effect1 && effect0->Effect == SPELL_EFFECT_THREAT && effect1->Effect == SPELL_EFFECT_APPLY_AURA && effect1->ApplyAuraName == SPELL_AURA_DUMMY;
}
bool SpellInfo::IsProfessionOrRiding(uint32 difficulty) const
{
SpellEffectInfoVector effects = GetEffectsForDifficulty(difficulty);
for (SpellEffectInfo const* effect : effects)
{
if ((effect && effect->Effect == SPELL_EFFECT_SKILL))
{
uint32 skill = effect->MiscValue;
if (IsProfessionOrRidingSkill(skill))
return true;
}
}
return false;
}
bool SpellInfo::IsProfession(uint32 difficulty) const
{
SpellEffectInfoVector effects = GetEffectsForDifficulty(difficulty);
@@ -1310,23 +1294,6 @@ bool SpellInfo::IsPrimaryProfessionFirstRank(uint32 difficulty) const
return IsPrimaryProfession(difficulty) && GetRank() == 1;
}
bool SpellInfo::IsAbilityLearnedWithProfession() const
{
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(Id);
for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
{
SkillLineAbilityEntry const* pAbility = _spell_idx->second;
if (!pAbility || pAbility->AquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE)
continue;
if (pAbility->MinSkillLineRank > 0)
return true;
}
return false;
}
bool SpellInfo::IsAbilityOfSkillType(uint32 skillType) const
{
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(Id);
@@ -1425,12 +1392,6 @@ bool SpellInfo::IsStackableWithRanks() const
if (IsPassive())
return false;
if (IsProfessionOrRiding())
return false;
if (IsAbilityLearnedWithProfession())
return false;
// All stance spells. if any better way, change it.
SpellEffectInfoVector effects = GetEffectsForDifficulty(DIFFICULTY_NONE);
for (SpellEffectInfo const* effect : effects)