mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/AuraScript: Add DoCheckAreaTarget hook to allow explicit area aura target selection.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "Spell.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
bool _SpellScript::_Validate(SpellEntry const* entry)
|
||||
{
|
||||
@@ -468,6 +469,10 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result)
|
||||
|
||||
bool AuraScript::_Validate(SpellEntry const * entry)
|
||||
{
|
||||
for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr)
|
||||
if (!HasAreaAuraEffect(entry))
|
||||
sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
|
||||
|
||||
for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)
|
||||
if (!(*itr).GetAffectedEffectsMask(entry))
|
||||
sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
|
||||
@@ -523,6 +528,16 @@ bool AuraScript::_Validate(SpellEntry const * entry)
|
||||
return _SpellScript::_Validate(entry);
|
||||
}
|
||||
|
||||
AuraScript::CheckAreaTargetHandler::CheckAreaTargetHandler(AuraCheckAreaTargetFnType _pHandlerScript)
|
||||
{
|
||||
pHandlerScript = _pHandlerScript;
|
||||
}
|
||||
|
||||
bool AuraScript::CheckAreaTargetHandler::Call(AuraScript* auraScript, Unit * _target)
|
||||
{
|
||||
return (auraScript->*pHandlerScript)(_target);
|
||||
}
|
||||
|
||||
AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
|
||||
: _SpellScript::EffectAuraNameCheck(_effName), _SpellScript::EffectHook(_effIndex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user