mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 10:55:43 +00:00
fix(Core/Spells): Auras triggered by talents/glyphs should be removed on respec. (#8671)
Fixes #8543
This commit is contained in:
@@ -14179,6 +14179,8 @@ void Player::ActivateSpec(uint8 spec)
|
||||
SendActionButtons(2);
|
||||
uint8 oldSpec = GetActiveSpec();
|
||||
|
||||
std::unordered_set<uint32> removedSpecAuras;
|
||||
|
||||
// xinef: reset talent auras
|
||||
for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
|
||||
{
|
||||
@@ -14194,13 +14196,18 @@ void Player::ActivateSpec(uint8 spec)
|
||||
// pussywizard: was => isn't
|
||||
if (!itr->second->IsInSpec(spec) && !itr->second->inSpellBook)
|
||||
SendLearnPacket(itr->first, false);
|
||||
|
||||
removedSpecAuras.insert(itr->first);
|
||||
}
|
||||
|
||||
// xinef: remove glyph auras
|
||||
for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
|
||||
if (uint32 glyphId = m_Glyphs[GetActiveSpec()][slot])
|
||||
if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyphId))
|
||||
{
|
||||
RemoveAurasDueToSpell(glyphEntry->SpellId);
|
||||
removedSpecAuras.insert(glyphEntry->SpellId);
|
||||
}
|
||||
|
||||
// xinef: set active spec as new one
|
||||
SetActiveSpec(spec);
|
||||
@@ -14223,6 +14230,8 @@ void Player::ActivateSpec(uint8 spec)
|
||||
_addTalentAurasAndSpells(itr->first);
|
||||
TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first);
|
||||
spentTalents += talentPos->rank + 1;
|
||||
|
||||
removedSpecAuras.erase(itr->first);
|
||||
}
|
||||
|
||||
// pussywizard: remove spells that are in previous spec, but are not present in new one (or are in new spec, but not in the old one)
|
||||
@@ -14237,11 +14246,15 @@ void Player::ActivateSpec(uint8 spec)
|
||||
SendLearnPacket(itr->first, false);
|
||||
// We want to remove all auras of the unlearned spell
|
||||
_removeTalentAurasAndSpells(itr->first);
|
||||
|
||||
removedSpecAuras.insert(itr->first);
|
||||
}
|
||||
// pussywizard: wasn't => is
|
||||
else if (!itr->second->IsInSpec(oldSpec) && itr->second->IsInSpec(spec))
|
||||
{
|
||||
SendLearnPacket(itr->first, true);
|
||||
|
||||
removedSpecAuras.erase(itr->first);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14256,6 +14269,7 @@ void Player::ActivateSpec(uint8 spec)
|
||||
if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyphId))
|
||||
{
|
||||
CastSpell(this, glyphEntry->SpellId, TriggerCastFlags(TRIGGERED_FULL_MASK & ~(TRIGGERED_IGNORE_SHAPESHIFT | TRIGGERED_IGNORE_CASTER_AURASTATE)));
|
||||
removedSpecAuras.erase(glyphEntry->SpellId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14263,6 +14277,25 @@ void Player::ActivateSpec(uint8 spec)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove auras triggered/activated by talents/glyphs
|
||||
// Mostly explicit casts in dummy aura scripts
|
||||
if (!removedSpecAuras.empty())
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
|
||||
{
|
||||
Aura* aura = iter->second;
|
||||
if (SpellInfo const* triggeredByAuraSpellInfo = aura->GetTriggeredByAuraSpellInfo())
|
||||
{
|
||||
if (removedSpecAuras.find(triggeredByAuraSpellInfo->Id) != removedSpecAuras.end())
|
||||
{
|
||||
RemoveOwnedAura(iter);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
m_usedTalentCount = spentTalents;
|
||||
InitTalentForLevel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user