diff options
11 files changed, 34 insertions, 7 deletions
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 7600b24a8d6..09ef73c37c0 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -360,6 +360,17 @@ class AuraScript : public _SpellScript AuraEffectApplicationModeFnType pEffectHandlerScript; AuraEffectHandleModes mode; }; + + #define AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \ + class EffectPeriodicHandlerFunction : public AuraScript::EffectPeriodicHandler { public: EffectPeriodicHandlerFunction(AuraEffectPeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName) : AuraScript::EffectPeriodicHandler((AuraScript::AuraEffectPeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \ + class EffectUpdatePeriodicHandlerFunction : public AuraScript::EffectUpdatePeriodicHandler { public: EffectUpdatePeriodicHandlerFunction(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName) : AuraScript::EffectUpdatePeriodicHandler((AuraScript::AuraEffectUpdatePeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \ + class EffectCalcAmountHandlerFunction : public AuraScript::EffectCalcAmountHandler { public: EffectCalcAmountHandlerFunction(AuraEffectCalcAmountFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcAmountHandler((AuraScript::AuraEffectCalcAmountFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \ + class EffectCalcPeriodicHandlerFunction : public AuraScript::EffectCalcPeriodicHandler { public: EffectCalcPeriodicHandlerFunction(AuraEffectCalcPeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcPeriodicHandler((AuraScript::AuraEffectCalcPeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \ + class EffectCalcSpellModHandlerFunction : public AuraScript::EffectCalcSpellModHandler { public: EffectCalcSpellModHandlerFunction(AuraEffectCalcSpellModFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcSpellModHandler((AuraScript::AuraEffectCalcSpellModFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \ + class EffectApplyHandlerFunction : public AuraScript::EffectApplyHandler { public: EffectApplyHandlerFunction(AuraEffectApplicationModeFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode) : AuraScript::EffectApplyHandler((AuraScript::AuraEffectApplicationModeFnType)_pEffectHandlerScript, _effIndex, _effName, _mode) {} }; \ + + #define PrepareAuraScript(CLASSNAME) AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) + public: bool _Validate(SpellEntry const * entry); bool _Load(Aura * aura); @@ -377,43 +388,43 @@ class AuraScript : public _SpellScript // executed when periodic aura effect is applied with specified mode to target // example: OnEffectApply += AuraEffectApplyFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); HookList<EffectApplyHandler> OnEffectApply; - #define AuraEffectApplyFn(F, I, N, M) EffectApplyHandler((AuraEffectApplicationModeFnType)&F, I, N, M) + #define AuraEffectApplyFn(F, I, N, M) EffectApplyHandlerFunction((AuraEffectApplicationModeFnType)&F, I, N, M) // executed when periodic aura effect is removed with specified mode from target // example: OnEffectRemove += AuraEffectRemoveFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); // where function is: void function (AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode); HookList<EffectApplyHandler> OnEffectRemove; - #define AuraEffectRemoveFn(F, I, N, M) EffectApplyHandler((AuraEffectApplicationModeFnType)&F, I, N, M) + #define AuraEffectRemoveFn(F, I, N, M) EffectApplyHandlerFunction((AuraEffectApplicationModeFnType)&F, I, N, M) // executed when periodic aura effect ticks on target // example: OnEffectPeriodic += AuraEffectPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode); HookList<EffectPeriodicHandler> OnEffectPeriodic; - #define AuraEffectPeriodicFn(F, I, N) EffectPeriodicHandler((AuraEffectPeriodicFnType)&F, I, N) + #define AuraEffectPeriodicFn(F, I, N) EffectPeriodicHandlerFunction((AuraEffectPeriodicFnType)&F, I, N) // executed when periodic aura effect is updated // example: OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect const * aurEff, AuraApplication const * aurApp); HookList<EffectUpdatePeriodicHandler> OnEffectUpdatePeriodic; - #define AuraEffectUpdatePeriodicFn(F, I, N) EffectUpdatePeriodicHandler((AuraEffectUpdatePeriodicFnType)&F, I, N) + #define AuraEffectUpdatePeriodicFn(F, I, N) EffectUpdatePeriodicHandlerFunction((AuraEffectUpdatePeriodicFnType)&F, I, N) // executed when aura effect calculates amount // example: OnEffectCalcAmount += AuraEffectCalcAmounFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect * aurEff, int32 & amount, bool & canBeRecalculated); HookList<EffectCalcAmountHandler> OnEffectCalcAmount; - #define AuraEffectCalcAmountFn(F, I, N) EffectCalcAmountHandler((AuraEffectCalcAmountFnType)&F, I, N) + #define AuraEffectCalcAmountFn(F, I, N) EffectCalcAmountHandlerFunction((AuraEffectCalcAmountFnType)&F, I, N) // executed when aura effect calculates periodic data // example: OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect const * aurEff, bool & isPeriodic, int32 & amplitude); HookList<EffectCalcPeriodicHandler> OnEffectCalcPeriodic; - #define AuraEffectCalcPeriodicFn(F, I, N) EffectCalcPeriodicHandler((AuraEffectCalcPeriodicFnType)&F, I, N) + #define AuraEffectCalcPeriodicFn(F, I, N) EffectCalcPeriodicHandlerFunction((AuraEffectCalcPeriodicFnType)&F, I, N) // executed when aura effect calculates spellmod // example: OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect const * aurEff, SpellModifier *& spellMod); HookList<EffectCalcSpellModHandler> OnEffectCalcSpellMod; - #define AuraEffectCalcSpellModFn(F, I, N) EffectCalcSpellModHandler((AuraEffectCalcSpellModFnType)&F, I, N) + #define AuraEffectCalcSpellModFn(F, I, N) EffectCalcSpellModHandlerFunction((AuraEffectCalcSpellModFnType)&F, I, N) // AuraScript interface - hook/effect execution manipulators diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 5397cd161d8..695cf65c6c7 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -135,6 +135,7 @@ class spell_ex_66244 : public SpellScriptLoader class spell_ex_66244AuraScript : public AuraScript { + PrepareAuraScript(spell_ex_66244AuraScript) enum Spells { SPELL_TRIGGERED = 18282 @@ -297,6 +298,7 @@ class spell_ex : public SpellScriptLoader class spell_ex_AuraScript : public AuraScript { + PrepareAuraScript(spell_ex) //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 a339326987f..a66767ccf6d 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -949,6 +949,7 @@ class spell_deathbringer_blood_link_aura : public SpellScriptLoader class spell_deathbringer_blood_link_AuraScript : public AuraScript { + PrepareAuraScript(spell_deathbringer_blood_link_AuraScript) bool Validate(SpellEntry const* /*spellInfo*/) { if (!sSpellStore.LookupEntry(SPELL_MARK_OF_THE_FALLEN_CHAMPION)) @@ -1006,6 +1007,7 @@ class spell_deathbringer_blood_power : public SpellScriptLoader class spell_deathbringer_blood_power_AuraScript : public AuraScript { + PrepareAuraScript(spell_deathbringer_blood_power_AuraScript) void RecalculateHook(AuraEffect const* /*aurEffect*/, int32& amount, bool& canBeRecalculated) { amount = GetUnitOwner()->GetPower(POWER_ENERGY); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index a93be6094e8..a6f4cc32eca 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -400,6 +400,7 @@ class spell_festergut_blighted_spores : public SpellScriptLoader class spell_festergut_blighted_spores_AuraScript : public AuraScript { + PrepareAuraScript(spell_festergut_blighted_spores_AuraScript) void ExtraEffect(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) { if (!GetCaster()->IsAIEnabled || GetCaster()->GetTypeId() != TYPEID_UNIT) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 35b02b559a8..70abca40bc6 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -747,6 +747,7 @@ class spell_deathwhisper_mana_barrier : public SpellScriptLoader class spell_deathwhisper_mana_barrier_AuraScript : public AuraScript { + PrepareAuraScript(spell_deathwhisper_mana_barrier_AuraScript) void HandlePeriodicTick(AuraEffect const * /*aurEff*/, AuraApplication const * /*aurApp*/) { Unit* caster = GetCaster(); diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp index 875b9c1ef98..e9c09d03b21 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp @@ -439,6 +439,7 @@ class spell_ignis_slag_pot : public SpellScriptLoader class spell_ignis_slag_pot_AuraScript : public AuraScript { + PrepareAuraScript(spell_ignis_slag_pot_AuraScript) bool Validate(SpellEntry const * /*spellEntry*/) { if (!sSpellStore.LookupEntry(SPELL_SLAG_POT_DAMAGE)) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 05dd0ba0822..0c81e29af75 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -33,6 +33,7 @@ public: class spell_gen_aura_of_anger_AuraScript : public AuraScript { + PrepareAuraScript(spell_gen_aura_of_anger_AuraScript) void HandleEffectPeriodicUpdate(AuraEffect * aurEff) { if (AuraEffect * aurEff1 = aurEff->GetBase()->GetEffect(EFFECT_1)) @@ -60,6 +61,7 @@ public: class spell_gen_burn_brutallus_AuraScript : public AuraScript { + PrepareAuraScript(spell_gen_burn_brutallus_AuraScript) void HandleEffectPeriodicUpdate(AuraEffect * aurEff) { if (aurEff->GetTickNumber() % 11 == 0) @@ -92,6 +94,7 @@ public: class spell_gen_parachute_AuraScript : public AuraScript { + PrepareAuraScript(spell_gen_parachute_AuraScript) bool Validate(SpellEntry const * /*spellEntry*/) { if (!sSpellStore.LookupEntry(SPELL_PARACHUTE)) @@ -231,6 +234,7 @@ public: class spell_gen_leeching_swarm_AuraScript : public AuraScript { + PrepareAuraScript(spell_gen_leeching_swarm_AuraScript) bool Validate(SpellEntry const * /*spellEntry*/) { if (!sSpellStore.LookupEntry(SPELL_LEECHING_SWARM_DMG)) @@ -400,6 +404,7 @@ class spell_creature_permanent_feign_death : public SpellScriptLoader class spell_creature_permanent_feign_deathAuraScript : public AuraScript { + PrepareAuraScript(spell_creature_permanent_feign_deathAuraScript) void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) { Unit* pTarget = aurApp->GetTarget(); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 458e02a171d..094a6367c8e 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -345,6 +345,7 @@ public: class spell_hun_sniper_training_AuraScript : public AuraScript { + PrepareAuraScript(spell_hun_sniper_training_AuraScript) bool Validate(SpellEntry const * /*entry*/) { if (!sSpellStore.LookupEntry(SPELL_SNIPER_TRAINING_R1)) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 82b977a6cdd..f543a2baaa0 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -684,6 +684,7 @@ public: class spell_item_shadowmourne_AuraScript : public AuraScript { public: + PrepareAuraScript(spell_item_shadowmourne_AuraScript) spell_item_shadowmourne_AuraScript() : AuraScript() { } bool Validate(SpellEntry const* /*spellEntry*/) diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 75fa04a79a0..f0ccb58d2f5 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -100,6 +100,7 @@ public: class spell_pal_blessing_of_sanctuary_AuraScript : public AuraScript { + PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript) bool Validate(SpellEntry const* /*entry*/) { if (!sSpellStore.LookupEntry(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF)) diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index ba282a9f7e6..7a0d6204aa8 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -101,6 +101,7 @@ public: class spell_rog_prey_on_the_weak_AuraScript : public AuraScript { + PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript) bool Validate(SpellEntry const * /*spellEntry*/) { if (!sSpellStore.LookupEntry(ROGUE_SPELL_PREY_ON_THE_WEAK)) |