aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMeji <alvaro.megias@outlook.com>2025-04-13 00:38:21 +0200
committerOvahlord <dreadkiller@gmx.de>2025-04-13 19:21:51 +0200
commitbe288044ab010687e6497b876de2e0a3d19aaca7 (patch)
treef7784f4c2f3b25a46972e62bca6af993f8b5487a /src
parent1be6ce0da74160bd1032daa8646f7c9110576bb2 (diff)
Scripts/Spells: Implemented generic script to update phases on aura application/removal
(cherry picked from commit 7ed15235327fa3ba2351f81324a272d29b0af51d) # Conflicts: # src/server/scripts/Spells/spell_generic.cpp
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 07188d3956b..ae3615e29a1 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -39,6 +39,7 @@
#include "NPCPackets.h"
#include "ObjectMgr.h"
#include "Pet.h"
+#include "PhasingHandler.h"
#include "ReputationMgr.h"
#include "SkillDiscovery.h"
#include "SpellAuraEffects.h"
@@ -5395,6 +5396,25 @@ private:
uint64 _health;
};
+class spell_gen_force_phase_update : public AuraScript
+{
+ void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
+ {
+ PhasingHandler::OnConditionChange(GetTarget());
+ }
+
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
+ {
+ PhasingHandler::OnConditionChange(GetTarget());
+ }
+
+ void Register() override
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_gen_force_phase_update::AfterApply, EFFECT_FIRST_FOUND, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_gen_force_phase_update::AfterRemove, EFFECT_FIRST_FOUND, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
+ }
+};
+
void AddSC_generic_spell_scripts()
{
RegisterSpellScript(spell_gen_absorb0_hitlimit1);
@@ -5575,4 +5595,5 @@ void AddSC_generic_spell_scripts()
RegisterSpellScriptWithArgs(spell_gen_set_health, "spell_gen_set_health_1", 1);
RegisterSpellScriptWithArgs(spell_gen_set_health, "spell_gen_set_health_100", 100);
RegisterSpellScriptWithArgs(spell_gen_set_health, "spell_gen_set_health_500", 500);
+ RegisterSpellScript(spell_gen_force_phase_update);
}