From f8cd5846fc190fd91d92b637361e7818ceeddf1d Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 9 Jan 2022 14:14:29 -0500 Subject: [PATCH] Core/Auras: Implemented SPELL_AURA_TRIGGER_SPELL_ON_EXPIRE Port From (https://github.com/TrinityCore/TrinityCore/commit/792dab8f052f7cfb018ba2bafb68a3fe8154b764) --- Source/Framework/Constants/Spells/SpellAuraConst.cs | 2 +- Source/Game/Spells/Auras/AuraEffect.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/Framework/Constants/Spells/SpellAuraConst.cs b/Source/Framework/Constants/Spells/SpellAuraConst.cs index d7cf86a74..8915bcf7a 100644 --- a/Source/Framework/Constants/Spells/SpellAuraConst.cs +++ b/Source/Framework/Constants/Spells/SpellAuraConst.cs @@ -516,7 +516,7 @@ namespace Framework.Constants Unk492 = 492, Unk493 = 493, SetPowerPointCharge = 494, // NYI - TriggerSpellOnExpire = 495, // NYI + TriggerSpellOnExpire = 495, AllowChangingEquipmentInTorghast = 496, // NYI ModAnimaGain = 497, // NYI CurrencyLossPctOnDeath = 498, // NYI diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index a88338070..24281c98e 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -4711,6 +4711,15 @@ namespace Game.Spells target.CastSpell(target, triggerSpell, new CastSpellExtraArgs(this)); } + [AuraEffectHandler(AuraType.TriggerSpellOnExpire)] + void HandleTriggerSpellOnExpire(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) + { + if (!mode.HasFlag(AuraEffectHandleModes.Real) || apply || aurApp.GetRemoveMode() != AuraRemoveMode.Expire) + return; + + aurApp.GetTarget().CastSpell(aurApp.GetTarget(), GetSpellEffectInfo().TriggerSpell, new CastSpellExtraArgs(this)); + } + [AuraEffectHandler(AuraType.OpenStable)] void HandleAuraOpenStable(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) {