From 4879533cb1cf17e25ad63f2a00f6e7f94e0dd321 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 14 Mar 2023 04:24:59 -0400 Subject: [PATCH] Core/Auras: Implement caster selection of SPELL_AURA_TRIGGER_SPELL_ON_EXPIRE (stored in MiscValue) Port From (https://github.com/TrinityCore/TrinityCore/commit/5787c0173b738302f996f11a70db634253fb18c1) --- Source/Game/Spells/Auras/AuraEffect.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index bea364875..4b8a1912b 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -4787,7 +4787,17 @@ namespace Game.Spells if (!mode.HasFlag(AuraEffectHandleModes.Real) || apply || aurApp.GetRemoveMode() != AuraRemoveMode.Expire) return; - aurApp.GetTarget().CastSpell(aurApp.GetTarget(), GetSpellEffectInfo().TriggerSpell, new CastSpellExtraArgs(this)); + Unit caster = aurApp.GetTarget(); + + // MiscValue (Caster): + // 0 - Aura target + // 1 - Aura caster + // 2 - ? Aura target is always TARGET_UNIT_CASTER so we consider the same behavior as MiscValue 1 + uint casterType = (uint)GetMiscValue(); + if (casterType > 0) + caster = GetCaster(); + + caster?.CastSpell(aurApp.GetTarget(), GetSpellEffectInfo().TriggerSpell, new CastSpellExtraArgs(this)); } [AuraEffectHandler(AuraType.OpenStable)]