Core/Spells:

* Implemented on CheckCast spell script hook
* Added possibility to send SPELL_FAILED_CUSTOM_ERROR and added enum with all possible options for it

Scripts/Spells:
* Added example script for CheckCast hook with SPELL_FAILED_CUSTOM_ERROR (profession research and Book of Glyph Mastery)
This commit is contained in:
Shauren
2011-03-04 21:18:38 +01:00
parent a9582964d3
commit 7120f1eff8
12 changed files with 262 additions and 8 deletions

View File

@@ -146,6 +146,16 @@ std::string _SpellScript::EffectAuraNameCheck::ToString()
}
}
SpellScript::CheckCastHandler::CheckCastHandler(SpellCheckCastFnType checkCastHandlerScript)
{
_checkCastHandlerScript = checkCastHandlerScript;
}
SpellCastResult SpellScript::CheckCastHandler::Call(SpellScript* spellScript)
{
return (spellScript->*_checkCastHandlerScript)();
}
SpellScript::EffectHandler::EffectHandler(SpellEffectFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
: _SpellScript::EffectNameCheck(_effName), _SpellScript::EffectHook(_effIndex)
{
@@ -445,6 +455,17 @@ void SpellScript::FinishCast(SpellCastResult result)
m_spell->finish(result == SPELL_CAST_OK);
}
void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result)
{
if (!IsInCheckCastHook())
{
sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_spell->m_customError = result;
}
bool AuraScript::_Validate(SpellEntry const * entry)
{
for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)