From f7b84f32ff32f17a13f68c97ada9657a1b94ece8 Mon Sep 17 00:00:00 2001 From: Ono Date: Wed, 28 Sep 2016 20:17:58 +0300 Subject: [PATCH] Fix Combustion exploit --- src/game/Player.cpp | 3 ++- src/game/Unit.cpp | 19 +++++++++++++++++++ src/game/Unit.h | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5b12827a902..e9239afb954 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3426,7 +3426,8 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo playerSpell.state = PLAYERSPELL_REMOVED; } - RemoveAurasDueToSpell(spell_id); + RemoveAurasByCasterSpell(spell_id, GetObjectGuid()); + RemoveAurasTriggeredBySpell(spell_id, GetObjectGuid()); // remove pet auras for (int i = 0; i < MAX_EFFECT_INDEX; ++i) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d27c7a610fd..92569751c85 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4686,6 +4686,25 @@ void Unit::RemoveAurasDueToSpellByCancel(uint32 spellId) } } +void Unit::RemoveAurasTriggeredBySpell(uint32 spellId, ObjectGuid casterGuid /*= ObjectGuid()*/) +{ + if (!spellId) + return; + + SpellAuraHolderMap& auras = GetSpellAuraHolderMap(); + for (SpellAuraHolderMap::iterator itr = auras.begin(); itr != auras.end();) + { + const SpellEntry* entry = itr->second->GetTriggeredBy(); + if ((entry && entry->Id == spellId) && (casterGuid.IsEmpty() || casterGuid == itr->second->GetCasterGuid())) + { + RemoveSpellAuraHolder(itr->second); + itr = auras.begin(); + } + else + ++itr; + } +} + void Unit::RemoveAurasWithDispelType(DispelType type, ObjectGuid casterGuid) { // Create dispel mask by dispel type diff --git a/src/game/Unit.h b/src/game/Unit.h index 18b0a4368ea..5c94f58251b 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1733,6 +1733,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void RemoveAurasByCasterSpell(uint32 spellId, ObjectGuid casterGuid); void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGuid, Unit* stealer); void RemoveAurasDueToSpellByCancel(uint32 spellId); + void RemoveAurasTriggeredBySpell(uint32 spellId, ObjectGuid casterGuid = ObjectGuid()); // removing unknown aura stacks by diff reasons and selections void RemoveNotOwnTrackedTargetAuras(uint32 newPhase = 0x0);