Core/Misc: Avoid some redundant checks in Player::ResetTalents
This commit is contained in:
@@ -4425,11 +4425,14 @@ bool Player::resetTalents(bool no_cost)
|
|||||||
// skip non-existant talent ranks
|
// skip non-existant talent ranks
|
||||||
if (talentInfo->RankID[rank] == 0)
|
if (talentInfo->RankID[rank] == 0)
|
||||||
continue;
|
continue;
|
||||||
|
const SpellInfo* _spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[rank]);
|
||||||
|
if (!_spellEntry)
|
||||||
|
continue;
|
||||||
removeSpell(talentInfo->RankID[rank], true);
|
removeSpell(talentInfo->RankID[rank], true);
|
||||||
if (const SpellInfo* _spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[rank]))
|
// search for spells that the talent teaches and unlearn them
|
||||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellInfo for valid trigger spells
|
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||||
if (_spellEntry->Effects[i].TriggerSpell > 0 && _spellEntry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
|
if (_spellEntry->Effects[i].TriggerSpell > 0 && _spellEntry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
|
||||||
removeSpell(_spellEntry->Effects[i].TriggerSpell, true); // and remove any spells that the talent teaches
|
removeSpell(_spellEntry->Effects[i].TriggerSpell, true);
|
||||||
// if this talent rank can be found in the PlayerTalentMap, mark the talent as removed so it gets deleted
|
// if this talent rank can be found in the PlayerTalentMap, mark the talent as removed so it gets deleted
|
||||||
PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->RankID[rank]);
|
PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->RankID[rank]);
|
||||||
if (plrTalent != m_talents[m_activeSpec]->end())
|
if (plrTalent != m_talents[m_activeSpec]->end())
|
||||||
|
|||||||
Reference in New Issue
Block a user