diff options
author | Shauren <shauren.trinity@gmail.com> | 2011-03-04 21:18:38 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2011-03-04 21:19:43 +0100 |
commit | 7120f1eff80c9f057a40831a10d8975c0a8a7439 (patch) | |
tree | e77c66ff87570d1484b2cf81be6920ad5cd5e7fd /src/server/game/Spells/SpellScript.cpp | |
parent | a9582964d3ca140a1ec1d5894b79e72ed15a65a6 (diff) |
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)
Diffstat (limited to 'src/server/game/Spells/SpellScript.cpp')
-rwxr-xr-x | src/server/game/Spells/SpellScript.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 52a06bd1f2e..fcb3bef7e30 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -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) |