From c2690f748bcc42a1818b90336e81fb586588dd1e Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 21 Jan 2011 23:42:51 +0100 Subject: Scripts/Spells: Implemented UnitTargetHandler spell script hook, it can be used to filter area targeting spells --- src/server/scripts/Examples/example_spell.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (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 028d016330c..2ac16878d13 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -99,6 +99,12 @@ class spell_ex_5581 : public SpellScriptLoader sLog->outString("Spell just finished hitting target!"); } + void FilterTargets(std::list& /*targetList*/) + { + // usually you want this call for Area Target spells + sLog->outString("Spell is about to add targets from targetList to final targets!"); + } + // register functions used in spell script - names of these functions do not matter void Register() { @@ -118,6 +124,8 @@ class spell_ex_5581 : public SpellScriptLoader OnHit += SpellHitFn(spell_ex_5581SpellScript::HandleOnHit); // bind handler to AfterHit event of the spell AfterHit += SpellHitFn(spell_ex_5581SpellScript::HandleAfterHit); + // bind handler to OnUnitTargetSelect event of the spell + //OnUnitTargetSelect += SpellUnitTargetFn(spell_ex_5581SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER); } }; -- cgit v1.2.3