mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-27 04:12:40 +01:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user