aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Examples
diff options
context:
space:
mode:
authorQAston <qaston@gmail.com>2011-05-31 20:02:55 +0200
committerQAston <qaston@gmail.com>2011-05-31 20:24:44 +0200
commit7b5b95966e8a101c84ccef8b9d37740062eefa4c (patch)
treeb7a44e189ffd8a9ef850649f14fee19ba8104a38 /src/server/scripts/Examples
parent4ccb21e51a16a7eeb19760562730f890825a0a62 (diff)
Core/AuraScript: Add DoCheckAreaTarget hook to allow explicit area aura target selection.
Diffstat (limited to 'src/server/scripts/Examples')
-rw-r--r--src/server/scripts/Examples/example_spell.cpp33
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