From d037c6b08634c5d0d4cc0462ae28e15baf8498bb Mon Sep 17 00:00:00 2001 From: Wyrserth <43747507+Wyrserth@users.noreply.github.com> Date: Sun, 2 Jun 2019 21:40:55 +0200 Subject: Core/SAI: add action_param3 to SMART_ACTION_REMOVEAURASFROMSPELL to allow it to remove only auras from spells that were cast by the entity itself. (#23345) (cherry picked from commit d365dd915715d4608ae69fa54f094ab65f02e984) --- src/server/game/AI/SmartScripts/SmartScript.cpp | 12 ++++++++++-- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index bc2ddfa8556..569f0bc2595 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -890,13 +890,21 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.removeAura.spell) { + ObjectGuid casterGUID; + if (e.action.removeAura.onlyOwnedAuras) + { + if (!me) + break; + casterGUID = me->GetGUID(); + } + if (e.action.removeAura.charges) { - if (Aura* aur = target->ToUnit()->GetAura(e.action.removeAura.spell)) + if (Aura* aur = target->ToUnit()->GetAura(e.action.removeAura.spell, casterGUID)) aur->ModCharges(-static_cast(e.action.removeAura.charges), AURA_REMOVE_BY_EXPIRE); } else - target->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell); + target->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell, casterGUID); } else target->ToUnit()->RemoveAllAuras(); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index d442dfd5469..62713df6331 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -752,6 +752,7 @@ struct SmartAction { uint32 spell; uint32 charges; + uint32 onlyOwnedAuras; } removeAura; struct -- cgit v1.2.3