diff options
Diffstat (limited to 'src/server/scripts/Examples')
-rw-r--r-- | src/server/scripts/Examples/example_spell.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 212c6d767bd..82808bb79c3 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -292,6 +292,9 @@ class spell_ex_66244 : public SpellScriptLoader } }; +// example usage of OnEffectManaShield and AfterEffectManaShield hooks +// see spell_ex_absorb_aura, these hooks work the same as OnEffectAbsorb and AfterEffectAbsorb + // example usage of OnEffectAbsorb and AfterEffectAbsorb hooks class spell_ex_absorb_aura : public SpellScriptLoader { @@ -329,8 +332,33 @@ class spell_ex_absorb_aura : public SpellScriptLoader } }; -// example usage of OnEffectManaShield and AfterEffectManaShield hooks -// see spell_ex_absorb_aura, these hooks work the same as OnEffectAbsorb and AfterEffectAbsorb +class spell_ex_463 : public SpellScriptLoader +{ + public: + spell_ex_463() : SpellScriptLoader("spell_ex_463") { } + + class spell_ex_463AuraScript : public AuraScript + { + PrepareAuraScript(spell_ex_463AuraScript); + + bool CheckAreaTarget(Unit* target) + { + sLog->outString("Area aura checks if unit is a valid target for it!"); + // in our script we allow only players to be affected + return target->GetTypeId == TYPEID_PLAYER; + } + void Register() + { + DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_ex_463AuraScript::CheckAreaTarget); + } + }; + + // function which creates AuraScript + AuraScript* GetAuraScript() const + { + return new spell_ex_463AuraScript(); + } +}; // this function has to be added to function set in ScriptLoader.cpp void AddSC_example_spell_scripts() @@ -338,6 +366,7 @@ void AddSC_example_spell_scripts() new spell_ex_5581; new spell_ex_66244; new spell_ex_absorb_aura; + new spell_ex_463; } /* empty script for copypasting |