mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/AuraScript: Add DoCheckAreaTarget hook to allow explicit area aura target selection.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user