From e1f0de593f04d648ded2c75236ed23424adfe180 Mon Sep 17 00:00:00 2001 From: Foereaper Date: Mon, 29 Jan 2024 01:29:37 +0100 Subject: [PATCH] Add Spell Events Ideally we should deprecate the Player spell event at some point --- src/server/game/LuaEngine | 2 +- src/server/game/Spells/Spell.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/server/game/LuaEngine b/src/server/game/LuaEngine index 8fef1260ca..c952ad5596 160000 --- a/src/server/game/LuaEngine +++ b/src/server/game/LuaEngine @@ -1 +1 @@ -Subproject commit 8fef1260ca0cc27ca6e38256ab3233b3a71d72b7 +Subproject commit c952ad5596f5333dfa92e475537882cf838a7258 diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index db440a3d39..8bfdf4ecf5 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -62,7 +62,9 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" - +#ifdef ELUNA +#include "LuaEngine.h" +#endif extern SpellEffectHandlerFn SpellEffectHandlers[TOTAL_SPELL_EFFECTS]; SpellDestination::SpellDestination() @@ -3254,6 +3256,11 @@ void Spell::_cast(bool skipCheck) return; } +#ifdef ELUNA + if (Eluna* e = m_caster->GetEluna()) + e->OnSpellCast(this, skipCheck); +#endif + if (Player* playerCaster = m_caster->ToPlayer()) { // now that we've done the basic check, now run the scripts