Core/AuraScript: Add DoCheckAreaTarget hook to allow explicit area aura target selection.

This commit is contained in:
QAston
2011-05-31 20:02:55 +02:00
parent 4ccb21e51a
commit 7b5b95966e
6 changed files with 91 additions and 41 deletions

View File

@@ -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)
{