aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellScript.h
diff options
context:
space:
mode:
authorQAston <none@none>2010-10-04 19:12:20 +0200
committerQAston <none@none>2010-10-04 19:12:20 +0200
commit69057dcaeb27daaa7bb1ecb06c22103b0a168e28 (patch)
treed7be8e8de24342a1cee33007eeea1b3faf0ca684 /src/server/game/Spells/SpellScript.h
parentcaaa77deb285d65b1bc3a0c6f7b5f88ec3508d0c (diff)
Core/ScriptSystem/SpellScripts: Runtime checks for functions working only during spell hit phase
--HG-- branch : trunk
Diffstat (limited to 'src/server/game/Spells/SpellScript.h')
-rw-r--r--src/server/game/Spells/SpellScript.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index f152fe28e98..c33c2471a45 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -113,6 +113,20 @@ class _SpellScript
virtual void Unload() {};
};
+// SpellScript interface - enum used for runtime checks of script function calls
+enum SpellScriptHookType
+{
+ SPELL_SCRIPT_HOOK_EFFECT = SPELL_SCRIPT_STATE_END,
+ SPELL_SCRIPT_HOOK_BEFORE_HIT,
+ SPELL_SCRIPT_HOOK_HIT,
+ SPELL_SCRIPT_HOOK_AFTER_HIT,
+};
+#define HOOK_SPELL_HIT_START SPELL_SCRIPT_HOOK_EFFECT
+#define HOOK_SPELL_HIT_END SPELL_SCRIPT_HOOK_AFTER_HIT + 1
+#define HOOK_SPELL_START SPELL_SCRIPT_HOOK_EFFECT
+#define HOOK_SPELL_END SPELL_SCRIPT_HOOK_AFTER_HIT + 1
+#define HOOK_SPELL_COUNT HOOK_SPELL_END - HOOK_SPELL_START
+
class SpellScript : public _SpellScript
{
// internal use classes & functions
@@ -138,6 +152,8 @@ class SpellScript : public _SpellScript
void _InitHit();
bool _IsEffectPrevented(SpellEffIndex effIndex) {return m_hitPreventEffectMask & (1<<effIndex);};
bool _IsDefaultEffectPrevented(SpellEffIndex effIndex) {return m_hitPreventDefaultEffectMask & (1<<effIndex);};
+ bool IsInHitPhase() { return (m_currentScriptState >= HOOK_SPELL_HIT_START && m_currentScriptState < HOOK_SPELL_HIT_END); };
+ bool IsInEffectHook() { return (m_currentScriptState == SPELL_SCRIPT_HOOK_EFFECT); };
private:
Spell * m_spell;
uint8 m_hitPreventEffectMask;
@@ -226,7 +242,7 @@ class SpellScript : public _SpellScript
void CreateItem(uint32 effIndex, uint32 itemId);
};
-// AuraScript interface - enum used for manipulations on hooks by their type
+// AuraScript interface - enum used for runtime checks of script function calls
enum AuraScriptHookType
{
AURA_SCRIPT_HOOK_EFFECT_APPLY = SPELL_SCRIPT_STATE_END,