aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellScript.h
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/game/Spells/SpellScript.h
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/game/Spells/SpellScript.h')
-rw-r--r--src/server/game/Spells/SpellScript.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index fae3dfcbd58..081b8035ca1 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -34,6 +34,7 @@ class Item;
class WorldLocation;
typedef void(SpellScript::*EffectHandlerFnType)(SpellEffIndex);
+typedef void(SpellScript::*HitHandlerFnType)();
#define SPELL_EFFECT_ANY (uint16)-1
#define SPELL_AURA_ANY (uint16)-1
@@ -108,6 +109,7 @@ class SpellScript : public _SpellScript
private:
EffectHandlerFnType pEffectHandlerScript;
};
+ typedef HitHandlerFnType HitHandler;
public:
bool _Validate(SpellEntry const * entry, const char * scriptname);
bool _Load(Spell * spell);
@@ -127,6 +129,20 @@ class SpellScript : public _SpellScript
// allows more than one hook
// example EffectHandlers += EffectHandlerFn(class::function, EffectIndexSpecifier, EffectNameSpecifier);
HookList<EffectHandler> EffectHandlers;
+ // List of functions registered by HitHandlerFn
+ // allows more than one hook
+ // example: BeforeHit += HitHandlerFn(class::function);
+ HookList<HitHandler> BeforeHit;
+ // example: OnHit += HitHandlerFn(class::function);
+ HookList<HitHandler> OnHit;
+ // example: AfterHit += HitHandlerFn(class::function);
+ HookList<HitHandler> AfterHit;
+
+ // hooks are executed in following order, at specified event of spell:
+ // 1. BeforeHit - executed just before spell hits a target
+ // 2. EffectHandlers - executed just before specified effect handler call
+ // 3. OnHit - executed just before spell deals damage and procs auras
+ // 4. AfterHit - executed just after spell finishes all it's jobs for target
//
// methods allowing interaction with Spell object
@@ -196,6 +212,11 @@ class SpellScript : public _SpellScript
// parameters: function to call, EffectIndexSpecifier, EffectNameSpecifier
#define EffectHandlerFn(F, I, N) EffectHandler((EffectHandlerFnType)&F, I, N)
+// HitHandlerFn
+// called at: Spell hit on unit, before or after effect handlers, depends if bound to OnHit or AfterHit
+// parameters: function to call
+#define HitHandlerFn(F) (HitHandlerFnType)&F
+
//
// definitions:
//