From 6714feb3ee95fbc2967f7ea11c837d3caac90d3a Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 21 Aug 2010 20:18:54 +0200 Subject: *Add script hooks for SpellScript class - now you can use BeforeHit, OnHit, AfterHit hook lists. --HG-- branch : trunk --- src/server/scripts/Examples/example_spell.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/server/scripts/Examples') diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 3063f6f6d8b..d5ba5b4a5ba 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -45,6 +45,21 @@ class spell_ex_49375 : public SpellHandlerScript GetCaster()->CastSpell(target, 70522, true); }; + void HandleBeforeHit() + { + sLog.outError("Spell is about to hit target!"); + } + + void HandleOnHit() + { + sLog.outError("Spell just hit target!"); + } + + void HandleAfterHit() + { + sLog.outError("Spell just finished hitting target!"); + } + void Register() { // we're registering our function here @@ -56,6 +71,12 @@ class spell_ex_49375 : public SpellHandlerScript //EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_ANY); // this will make HandleDummy function to be called on all != 0 effect of spell 49375 //EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY); + // bind handler to BeforeHit event of the spell + BeforeHit += HitHandlerFn(spell_ex_49375SpellScript::HandleBeforeHit); + // bind handler to OnHit event of the spell + OnHit += HitHandlerFn(spell_ex_49375SpellScript::HandleOnHit); + // bind handler to AfterHit event of the spell + AfterHit += HitHandlerFn(spell_ex_49375SpellScript::HandleAfterHit); }; // function called on server startup -- cgit v1.2.3