fix(Core/Spells): Removed any triggered auras on glyph removal. (#12168)

* fix(Core/Spells): Removed any triggered auras on glyph removal.

Fixes #11939

* Update.
This commit is contained in:
UltraNix
2022-06-28 22:19:35 +02:00
committed by GitHub
parent 452686d273
commit 8c1b729375
2 changed files with 34 additions and 0 deletions

View File

@@ -1579,6 +1579,23 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData)
if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyph))
{
_player->RemoveAurasDueToSpell(glyphEntry->SpellId);
// Removed any triggered auras
Unit::AuraMap& ownedAuras = _player->GetOwnedAuras();
for (Unit::AuraMap::iterator iter = ownedAuras.begin(); iter != ownedAuras.end();)
{
Aura* aura = iter->second;
if (SpellInfo const* triggeredByAuraSpellInfo = aura->GetTriggeredByAuraSpellInfo())
{
if (triggeredByAuraSpellInfo->Id == glyphEntry->SpellId)
{
_player->RemoveOwnedAura(iter);
continue;
}
}
++iter;
}
_player->SendLearnPacket(glyphEntry->SpellId, false); // Send packet to properly handle client-side spell tooltips
_player->SetGlyph(slot, 0, true);
_player->SendTalentsInfoData(false);

View File

@@ -4401,6 +4401,23 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex)
if (GlyphPropertiesEntry const* oldGlyphEntry = sGlyphPropertiesStore.LookupEntry(oldGlyph))
{
player->RemoveAurasDueToSpell(oldGlyphEntry->SpellId);
// Removed any triggered auras
Unit::AuraMap& ownedAuras = player->GetOwnedAuras();
for (Unit::AuraMap::iterator iter = ownedAuras.begin(); iter != ownedAuras.end();)
{
Aura* aura = iter->second;
if (SpellInfo const* triggeredByAuraSpellInfo = aura->GetTriggeredByAuraSpellInfo())
{
if (triggeredByAuraSpellInfo->Id == oldGlyphEntry->SpellId)
{
player->RemoveOwnedAura(iter);
continue;
}
}
++iter;
}
player->SendLearnPacket(oldGlyphEntry->SpellId, false); // Send packet to properly handle client-side spell tooltips
}