aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Examples
diff options
context:
space:
mode:
authorQAston <none@none>2010-08-21 20:18:54 +0200
committerQAston <none@none>2010-08-21 20:18:54 +0200
commit6714feb3ee95fbc2967f7ea11c837d3caac90d3a (patch)
tree6c848ba8bc21472d351a9cde6cfd274f08153417 /src/server/scripts/Examples
parent3febdd7884305d5b9ff427a5295f9aae95533782 (diff)
*Add script hooks for SpellScript class - now you can use BeforeHit, OnHit, AfterHit hook lists.
--HG-- branch : trunk
Diffstat (limited to 'src/server/scripts/Examples')
-rw-r--r--src/server/scripts/Examples/example_spell.cpp21
1 files changed, 21 insertions, 0 deletions
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