aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2010-10-08 21:33:44 +0200
committerQAston <none@none>2010-10-08 21:33:44 +0200
commit1760e42e2caa99d3de0038d1b52f64a1daeb665a (patch)
tree9d95c4a73c675b3fb59724a1b0a908e5c9c3a490 /src
parente5e53498cede475ae0d80623e89c4a3cbec39b62 (diff)
Core/ScriptSystem: Add compile time type check of function assigned to hooks - prevents incorrect function calls. Since this rev you have to put PrepareSpellScript(<yourscriptclassnamehere>) at the beginning of every spell script. Yes, i know it's unhandy, but unfortunately C++ preprocessor is very limited, so you have to do that extra work each time you write a script:(.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp6
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h2
-rwxr-xr-xsrc/server/game/Spells/SpellScript.cpp10
-rwxr-xr-xsrc/server/game/Spells/SpellScript.h43
-rw-r--r--src/server/scripts/Examples/example_spell.cpp6
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp4
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp2
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp1
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp3
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp1
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp3
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp1
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp5
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp8
-rw-r--r--src/server/scripts/Spells/spell_item.cpp11
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp4
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp4
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp3
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp9
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp2
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp2
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp3
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp2
23 files changed, 120 insertions, 15 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index b7c8049e1e4..6e4ead80a2e 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -7242,7 +7242,7 @@ void Spell::CallScriptBeforeHitHandlers()
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin();
for(; hookItr != hookItrEnd ; ++hookItr)
{
- ((*scritr)->*(*hookItr))();
+ (*hookItr).Call(*scritr);
}
(*scritr)->_FinishScriptCall();
}
@@ -7256,7 +7256,7 @@ void Spell::CallScriptOnHitHandlers()
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin();
for(; hookItr != hookItrEnd ; ++hookItr)
{
- ((*scritr)->*(*hookItr))();
+ (*hookItr).Call(*scritr);
}
(*scritr)->_FinishScriptCall();
}
@@ -7270,7 +7270,7 @@ void Spell::CallScriptAfterHitHandlers()
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin();
for(; hookItr != hookItrEnd ; ++hookItr)
{
- ((*scritr)->*(*hookItr))();
+ (*hookItr).Call(*scritr);
}
(*scritr)->_FinishScriptCall();
}
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index 628c89af20a..2d394d9860b 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -559,7 +559,7 @@ enum ProcFlags
PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK = 0x00000008, // 03 Taken melee auto attack
PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS = 0x00000010, // 04 Done attack by Spell that has dmg class melee
- PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS = 0x00000020, // 05 Taken damage by Spell that has dmg class melee
+ PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS = 0x00000020, // 05 Taken attack by Spell that has dmg class melee
PROC_FLAG_DONE_RANGED_AUTO_ATTACK = 0x00000040, // 06 Done ranged auto attack
PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK = 0x00000080, // 07 Taken ranged auto attack
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 355da664f42..ee2c7836f62 100755
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -167,6 +167,16 @@ void SpellScript::EffectHandler::Call(SpellScript * spellScript, SpellEffIndex e
(spellScript->*pEffectHandlerScript)(effIndex);
}
+SpellScript::HitHandler::HitHandler(SpellHitFnType _pHitHandlerScript)
+{
+ pHitHandlerScript = _pHitHandlerScript;
+}
+
+void SpellScript::HitHandler::Call(SpellScript * spellScript)
+{
+ (spellScript->*pHitHandlerScript)();
+}
+
bool SpellScript::_Validate(SpellEntry const * entry)
{
for (std::list<EffectHandler>::iterator itr = OnEffect.begin(); itr != OnEffect.end(); ++itr)
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index e4c9fd42fd3..7600b24a8d6 100755
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -131,8 +131,11 @@ class SpellScript : public _SpellScript
// internal use classes & functions
// DO NOT OVERRIDE THESE IN SCRIPTS
public:
- typedef void(SpellScript::*SpellEffectFnType)(SpellEffIndex);
- typedef void(SpellScript::*SpellHitFnType)();
+ #define SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) \
+ typedef void(CLASSNAME::*SpellEffectFnType)(SpellEffIndex); \
+ typedef void(CLASSNAME::*SpellHitFnType)(); \
+
+ SPELLSCRIPT_FUNCTION_TYPE_DEFINES(SpellScript)
class EffectHandler : public _SpellScript::EffectNameCheck, public _SpellScript::EffectHook
{
@@ -144,7 +147,21 @@ class SpellScript : public _SpellScript
private:
SpellEffectFnType pEffectHandlerScript;
};
- typedef SpellHitFnType HitHandler;
+
+ class HitHandler
+ {
+ public:
+ HitHandler(SpellHitFnType _pHitHandlerScript);
+ void Call(SpellScript * spellScript);
+ private:
+ SpellHitFnType pHitHandlerScript;
+ };
+
+ #define SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \
+ class EffectHandlerFunction : public SpellScript::EffectHandler { public: EffectHandlerFunction(SpellEffectFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName) : SpellScript::EffectHandler((SpellScript::SpellEffectFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
+ class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) {} }; \
+
+ #define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
public:
bool _Validate(SpellEntry const * entry);
bool _Load(Spell * spell);
@@ -167,7 +184,7 @@ class SpellScript : public _SpellScript
// example: OnEffect += SpellEffectFn(class::function, EffectIndexSpecifier, EffectNameSpecifier);
// where function is void function(SpellEffIndex effIndex)
HookList<EffectHandler> OnEffect;
- #define SpellEffectFn(F, I, N) EffectHandler((SpellEffectFnType)&F, I, N)
+ #define SpellEffectFn(F, I, N) EffectHandlerFunction(&F, I, N)
// example: BeforeHit += SpellHitFn(class::function);
HookList<HitHandler> BeforeHit;
@@ -176,7 +193,7 @@ class SpellScript : public _SpellScript
// example: AfterHit += SpellHitFn(class::function);
HookList<HitHandler> AfterHit;
// where function is: void function()
- #define SpellHitFn(F) (SpellHitFnType)&F
+ #define SpellHitFn(F) HitHandlerFunction(&F)
// hooks are executed in following order, at specified event of spell:
// 1. BeforeHit - executed just before spell hits a target
@@ -276,12 +293,16 @@ class AuraScript : public _SpellScript
// internal use classes & functions
// DO NOT OVERRIDE THESE IN SCRIPTS
public:
- typedef void(AuraScript::*AuraEffectApplicationModeFnType)(AuraEffect const *, AuraApplication const *, AuraEffectHandleModes mode);
- typedef void(AuraScript::*AuraEffectPeriodicFnType)(AuraEffect const *, AuraApplication const *);
- typedef void(AuraScript::*AuraEffectUpdatePeriodicFnType)(AuraEffect *);
- typedef void(AuraScript::*AuraEffectCalcAmountFnType)(AuraEffect const *, int32 &, bool &);
- typedef void(AuraScript::*AuraEffectCalcPeriodicFnType)(AuraEffect const *, bool &, int32 &);
- typedef void(AuraScript::*AuraEffectCalcSpellModFnType)(AuraEffect const *, SpellModifier *&);
+
+ #define AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) \
+ typedef void(CLASSNAME::*AuraEffectApplicationModeFnType)(AuraEffect const *, AuraApplication const *, AuraEffectHandleModes mode); \
+ typedef void(CLASSNAME::*AuraEffectPeriodicFnType)(AuraEffect const *, AuraApplication const *); \
+ typedef void(CLASSNAME::*AuraEffectUpdatePeriodicFnType)(AuraEffect *); \
+ typedef void(CLASSNAME::*AuraEffectCalcAmountFnType)(AuraEffect const *, int32 &, bool &); \
+ typedef void(CLASSNAME::*AuraEffectCalcPeriodicFnType)(AuraEffect const *, bool &, int32 &); \
+ typedef void(CLASSNAME::*AuraEffectCalcSpellModFnType)(AuraEffect const *, SpellModifier *&); \
+
+ AURASCRIPT_FUNCTION_TYPE_DEFINES(AuraScript)
class EffectBase : public _SpellScript::EffectAuraNameCheck, public _SpellScript::EffectHook
{
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index 42126c953c3..5397cd161d8 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -33,6 +33,10 @@ class spell_ex_5581 : public SpellScriptLoader
class spell_ex_5581SpellScript : public SpellScript
{
+ // initialize script, this macro does compile time check for type of the function - prevents possible issues
+ // if you have assigned wrong type of function to a hook you'll receive type conversion error during build
+ // this line is required, otherwise you'll get XXXHandlerFunction - identifier not found errors
+ PrepareSpellScript(spell_ex_5581SpellScript)
enum Spells
{
SPELL_TRIGGERED = 18282
@@ -100,6 +104,7 @@ class spell_ex_5581 : public SpellScriptLoader
{
// we're registering our function here
// function HandleDummy will be called when unit is hit by spell, just before default effect 0 handler
+ //OnEffect += SpellEffectFn(spell_ex_5581SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnEffect += SpellEffectFn(spell_ex_5581SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
// this will prompt an error on startup because effect 0 of spell 49375 is set to SPELL_EFFECT_DUMMY, not SPELL_EFFECT_APPLY_AURA
//OnEffect += SpellEffectFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
@@ -265,6 +270,7 @@ class spell_ex : public SpellScriptLoader
class spell_ex_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_ex_SpellScript)
//bool Validate(SpellEntry const * spellEntry){return true;}
//bool Load(){return true;}
//void Unload(){}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index a0ee8eb061e..a339326987f 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -903,6 +903,7 @@ class spell_deathbringer_blood_link : public SpellScriptLoader
class spell_deathbringer_blood_link_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_deathbringer_blood_link_SpellScript)
bool Validate(SpellEntry const* /*spellInfo*/)
{
if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_POWER))
@@ -990,6 +991,7 @@ class spell_deathbringer_blood_power : public SpellScriptLoader
class spell_deathbringer_blood_power_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_deathbringer_blood_power_SpellScript)
void ModAuraValue()
{
if (Aura* aura = GetHitAura())
@@ -1042,6 +1044,7 @@ class spell_deathbringer_rune_of_blood : public SpellScriptLoader
class spell_deathbringer_rune_of_blood_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_deathbringer_rune_of_blood_SpellScript)
bool Validate(SpellEntry const* /*spellInfo*/)
{
if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_DUMMY))
@@ -1075,6 +1078,7 @@ class spell_deathbringer_blood_nova : public SpellScriptLoader
class spell_deathbringer_blood_nova_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_deathbringer_blood_nova_SpellScript)
bool Validate(SpellEntry const* /*spellInfo*/)
{
if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_DUMMY))
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
index 8ccb34a1499..a93be6094e8 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
@@ -328,6 +328,7 @@ class spell_festergut_pungent_blight : public SpellScriptLoader
class spell_festergut_pungent_blight_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_festergut_pungent_blight_SpellScript)
void HandleScript(SpellEffIndex /*effIndex*/)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(GetEffectValue());
@@ -361,6 +362,7 @@ class spell_festergut_gastric_bloat : public SpellScriptLoader
class spell_festergut_gastric_bloat_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_festergut_gastric_bloat_SpellScript)
void HandleScript(SpellEffIndex /*effIndex*/)
{
Aura const* aura = GetHitUnit()->GetAura(GetSpellInfo()->Id);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index f10a3369609..35b02b559a8 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -775,6 +775,7 @@ class spell_cultist_dark_martyrdom : public SpellScriptLoader
class spell_cultist_dark_martyrdom_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_cultist_dark_martyrdom_SpellScript)
bool Validate(SpellEntry const* /*spellEntry*/)
{
if (uint32 scriptId = sObjectMgr.GetScriptId("boss_lady_deathwhisper"))
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index 7c294db9d3f..a97d6f6f136 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -406,6 +406,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader
class spell_marrowgar_coldflame_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_marrowgar_coldflame_SpellScript)
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
@@ -443,6 +444,7 @@ class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
class spell_marrowgar_bone_spike_graveyard_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_marrowgar_bone_spike_graveyard_SpellScript)
void HandleApplyAura(SpellEffIndex /*effIndex*/)
{
CreatureAI* marrowgarAI = GetCaster()->ToCreature()->AI();
@@ -492,6 +494,7 @@ class spell_marrowgar_bone_storm : public SpellScriptLoader
class spell_marrowgar_bone_storm_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_marrowgar_bone_storm_SpellScript)
void RecalculateDamage(SpellEffIndex /*effIndex*/)
{
int32 dmg = GetHitDamage();
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index d248ab5a9ae..913c62caf02 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -182,6 +182,7 @@ class spell_stinky_precious_decimate : public SpellScriptLoader
class spell_stinky_precious_decimate_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_stinky_precious_decimate_SpellScript)
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (GetHitUnit()->GetHealthPct() > float(GetEffectValue()))
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 32a22260ed4..766ff5acb4f 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -40,6 +40,7 @@ public:
class spell_dk_corpse_explosion_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_dk_corpse_explosion_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED))
@@ -86,6 +87,7 @@ public:
class spell_dk_runic_power_feed_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_dk_runic_power_feed_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(DK_SPELL_SUMMON_GARGOYLE))
@@ -125,6 +127,7 @@ public:
class spell_dk_scourge_strike_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_dk_scourge_strike_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(DK_SPELL_SCOURGE_STRIKE_TRIGGERED))
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 6238e6c5871..717bf093349 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -38,6 +38,7 @@ public:
class spell_dru_glyph_of_starfire_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_dru_glyph_of_starfire_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(DRUID_INCREASED_MOONFIRE_DURATION))
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index bcd9960a8c5..05dd0ba0822 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -138,6 +138,7 @@ public:
class spell_gen_pet_summonedSpellScript : public SpellScript
{
+ PrepareSpellScript(spell_gen_pet_summonedSpellScript)
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit *caster = GetCaster();
@@ -194,6 +195,7 @@ public:
class spell_gen_remove_flight_auras_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_gen_remove_flight_auras_SpellScript)
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit *target = GetHitUnit();
@@ -287,6 +289,7 @@ public:
class spell_gen_trick_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_gen_trick_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_PIRATE_COSTUME_MALE))
@@ -357,6 +360,7 @@ public:
class spell_gen_trick_or_treat_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_gen_trick_or_treat_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_TRICK))
@@ -431,6 +435,7 @@ public:
class spell_pvp_trinket_wotf_shared_cd_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_pvp_trinket_wotf_shared_cd_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER))
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index d78588e3094..458e02a171d 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -48,6 +48,7 @@ public:
class spell_hun_chimera_shot_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_hun_chimera_shot_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(HUNTER_SPELL_CHIMERA_SHOT_SERPENT))
@@ -143,6 +144,7 @@ public:
class spell_hun_invigoration_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_hun_invigoration_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(HUNTER_SPELL_INVIGORATION_TRIGGERED))
@@ -177,6 +179,7 @@ public:
class spell_hun_last_stand_pet_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_hun_last_stand_pet_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
@@ -211,6 +214,7 @@ public:
class spell_hun_masters_call_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_hun_masters_call_SpellScript)
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(HUNTER_SPELL_MASTERS_CALL_TRIGGERED))
@@ -258,6 +262,7 @@ public:
class spell_hun_readiness_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_hun_readiness_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit *caster = GetCaster();
@@ -301,6 +306,7 @@ public:
class spell_hun_scatter_shot_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_hun_scatter_shot_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
@@ -398,6 +404,7 @@ public:
class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED))
@@ -443,6 +450,7 @@ public:
class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 40243c9751e..82b977a6cdd 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -34,6 +34,7 @@ public:
class spell_item_trigger_spell_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_item_trigger_spell_SpellScript)
private:
uint32 _triggeredSpellId;
@@ -83,6 +84,7 @@ public:
class spell_item_deviate_fish_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_item_deviate_fish_SpellScript)
public:
bool Validate(SpellEntry const * /*spellEntry*/)
{
@@ -131,6 +133,7 @@ public:
class spell_item_flask_of_the_north_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_item_flask_of_the_north_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_FLASK_OF_THE_NORTH_SP))
@@ -206,6 +209,7 @@ public:
class spell_item_gnomish_death_ray_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_item_gnomish_death_ray_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_GNOMISH_DEATH_RAY_SELF))
@@ -258,6 +262,7 @@ public:
class spell_item_make_a_wish_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_item_make_a_wish_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_MR_PINCHYS_BLESSING))
@@ -311,6 +316,7 @@ public:
class spell_item_mingos_fortune_generator_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_item_mingos_fortune_generator_SpellScript)
void HandleDummy(SpellEffIndex effIndex)
{
// Selecting one from Bloodstained Fortune item
@@ -373,6 +379,7 @@ public:
class spell_item_net_o_matic_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_item_net_o_matic_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_NET_O_MATIC_TRIGGERED1))
@@ -428,6 +435,7 @@ public:
class spell_item_noggenfogger_elixir_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_item_noggenfogger_elixir_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1))
@@ -485,6 +493,7 @@ public:
class spell_item_savory_deviate_delight_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_item_savory_deviate_delight_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
for (uint32 spellId = SPELL_FLIP_OUT_MALE; spellId <= SPELL_YAAARRRR_FEMALE; ++spellId)
@@ -542,6 +551,7 @@ public:
class spell_item_six_demon_bag_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_item_six_demon_bag_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_FROSTBOLT))
@@ -620,6 +630,7 @@ public:
class spell_item_underbelly_elixir_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_item_underbelly_elixir_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_UNDERBELLY_ELIXIR_TRIGGERED1))
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 24433669136..901f36a3065 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -45,6 +45,7 @@ class spell_mage_cold_snap : public SpellScriptLoader
class spell_mage_cold_snap_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_mage_cold_snap_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit *caster = GetCaster();
@@ -89,6 +90,7 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader
class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript)
static const uint32 spell_list[6];
bool Validate(SpellEntry const * /*spellEntry*/)
@@ -137,6 +139,7 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
class spell_mage_summon_water_elemental_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_mage_summon_water_elemental_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
@@ -180,6 +183,7 @@ class spell_mage_blast_wave : public SpellScriptLoader
class spell_mage_blast_wave_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_mage_blast_wave_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_MAGE_GLYPH_OF_BLAST_WAVE))
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index 9bdfa43a324..75fa04a79a0 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -46,6 +46,7 @@ public:
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
@@ -141,6 +142,7 @@ public:
class spell_pal_guarded_by_the_light_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(PALADIN_SPELL_DIVINE_PLEA))
@@ -174,6 +176,7 @@ public:
class spell_pal_holy_shock_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_pal_holy_shock_SpellScript)
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1))
@@ -227,6 +230,7 @@ public:
class spell_pal_judgement_of_command_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_pal_judgement_of_command_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit *unitTarget = GetHitUnit())
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index c22e55e77a7..5359cbaf252 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -38,6 +38,7 @@ class spell_pri_mana_burn : public SpellScriptLoader
class spell_pri_mana_burn_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_pri_mana_burn_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
return true;
@@ -72,6 +73,7 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader
// 47948 Pain and Suffering (proc)
class spell_pri_pain_and_suffering_proc_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_pri_pain_and_suffering_proc_SpellScript)
void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/)
{
// Refresh Shadow Word: Pain on target
@@ -99,6 +101,7 @@ class spell_pri_penance : public SpellScriptLoader
class spell_pri_penance_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_pri_penance_SpellScript)
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(PRIEST_SPELL_PENANCE_R1))
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index ac04c096721..f99835a09f5 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -25,6 +25,7 @@
class spell_generic_quest_update_entry_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_generic_quest_update_entry_SpellScript)
private:
uint32 _spellEffect;
uint8 _effIndex;
@@ -92,6 +93,7 @@ public:
class spell_q5206_test_fetid_skull_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_q5206_test_fetid_skull_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_CREATE_RESONATING_SKULL))
@@ -142,6 +144,7 @@ public:
class spell_q6124_6129_apply_salve_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_q6124_6129_apply_salve_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (GetCastItem())
@@ -234,6 +237,7 @@ public:
class spell_q11587_arcane_prisoner_rescue_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_q11587_arcane_prisoner_rescue_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_SUMMON_ARCANE_PRISONER_MALE))
@@ -294,6 +298,7 @@ public:
class spell_q11730_ultrasonic_screwdriver_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_q11730_ultrasonic_screwdriver_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_SUMMON_SCAVENGEBOT_004A8))
@@ -375,6 +380,7 @@ public:
class spell_q12459_seeds_of_natures_wrath_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_q12459_seeds_of_natures_wrath_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Creature* pCreatureTarget = GetHitCreature())
@@ -421,6 +427,7 @@ public:
class spell_q12634_despawn_fruit_tosser_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_q12634_despawn_fruit_tosser_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_BANANAS_FALL_TO_GROUND))
@@ -470,6 +477,7 @@ public:
class spell_q12683_take_sputum_sample_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_q12683_take_sputum_sample_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
uint32 reqAuraId = SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 1);
@@ -510,6 +518,7 @@ public:
class spell_q12937_relief_for_the_fallen_SpellScript : public SpellScript
{
public:
+ PrepareSpellScript(spell_q12937_relief_for_the_fallen_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_TRIGGER_AID_OF_THE_EARTHEN))
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index 8ad97c135ca..ba282a9f7e6 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -37,6 +37,7 @@ class spell_rog_preparation : public SpellScriptLoader
class spell_rog_preparation_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_rog_preparation_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_GLYPH_OF_PREPARATION))
@@ -145,6 +146,7 @@ class spell_rog_shiv : public SpellScriptLoader
class spell_rog_shiv_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_rog_shiv_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_SHIV_TRIGGERED))
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 3c69ae72fdc..a745514f195 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -40,6 +40,7 @@ public:
class spell_sha_fire_nova_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_sha_fire_nova_SpellScript)
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(SHAMAN_SPELL_FIRE_NOVA_R1))
@@ -89,6 +90,7 @@ public:
class spell_sha_mana_tide_totem_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_sha_mana_tide_totem_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE))
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 64dc02425df..e0ea676e764 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -44,6 +44,7 @@ public:
class spell_warl_demonic_empowerment_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_warl_demonic_empowerment_SpellScript)
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS))
@@ -113,6 +114,7 @@ public:
class spell_warl_everlasting_affliction_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_warl_everlasting_affliction_SpellScript)
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
@@ -141,6 +143,7 @@ public:
class spell_warl_create_healthstone_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_warl_create_healthstone_SpellScript)
static uint32 const iTypes[8][3];
bool Validate(SpellEntry const * /*spellEntry*/)
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index 85c7c57ad05..62fecde89fe 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -35,6 +35,8 @@ class spell_warr_last_stand : public SpellScriptLoader
class spell_warr_last_stand_SpellScript : public SpellScript
{
+ PrepareSpellScript(spell_warr_last_stand_SpellScript)
+
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_LAST_STAND_TRIGGERED))