Core/Spells: Completely remove spells which were taught by SPELL_EFFECT_LEARN_SPELL on talent reset or talent spec switch - instead of keeping them stored as disabled. Reason for this is that if the primary spell with effect SPELL_EFFECT_LEARN_SPELL is learnt again, a 'new' secondary spell will be taught while the old one was still around. The latter was the reason for primary key violations in character_spell that led to transaction failures and thus character rollbacks.

Closes #1231
Closes #480
This commit is contained in:
Machiavelli
2011-06-23 02:39:36 +02:00
parent 719a079464
commit 33f3397976

View File

@@ -4405,7 +4405,7 @@ bool Player::resetTalents(bool no_cost)
if (const SpellEntry *_spellEntry = sSpellStore.LookupEntry(talentInfo->RankID[rank]))
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellEntry for valid trigger spells
if (_spellEntry->EffectTriggerSpell[i] > 0 && _spellEntry->Effect[i] == SPELL_EFFECT_LEARN_SPELL)
removeSpell(_spellEntry->EffectTriggerSpell[i], true); // and remove any spells that the talent teaches
removeSpell(_spellEntry->EffectTriggerSpell[i]); // and remove any spells that the talent teaches
// 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]);
if (plrTalent != m_talents[m_activeSpec]->end())
@@ -24289,7 +24289,7 @@ void Player::ActivateSpec(uint8 spec)
if (const SpellEntry *_spellEntry = sSpellStore.LookupEntry(talentInfo->RankID[rank]))
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellEntry for valid trigger spells
if (_spellEntry->EffectTriggerSpell[i] > 0 && _spellEntry->Effect[i] == SPELL_EFFECT_LEARN_SPELL)
removeSpell(_spellEntry->EffectTriggerSpell[i], true); // and remove any spells that the talent teaches
removeSpell(_spellEntry->EffectTriggerSpell[i]); // and remove any spells that the talent teaches
// 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]);
//if (plrTalent != m_talents[m_activeSpec]->end())