Core/Auras: Implement caster selection of SPELL_AURA_TRIGGER_SPELL_ON_EXPIRE (stored in MiscValue)

Port From (https://github.com/TrinityCore/TrinityCore/commit/5787c0173b738302f996f11a70db634253fb18c1)
This commit is contained in:
hondacrx
2023-03-14 04:24:59 -04:00
parent bc453f7198
commit 4879533cb1
+11 -1
View File
@@ -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)]