From 7b5b95966e8a101c84ccef8b9d37740062eefa4c Mon Sep 17 00:00:00 2001 From: QAston Date: Tue, 31 May 2011 20:02:55 +0200 Subject: Core/AuraScript: Add DoCheckAreaTarget hook to allow explicit area aura target selection. --- src/server/scripts/Examples/example_spell.cpp | 33 +++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/server/scripts/Examples') 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 -- cgit v1.2.3