diff options
| author | Shocker <shocker@freakz.ro> | 2011-06-24 21:56:37 +0300 |
|---|---|---|
| committer | Shocker <shocker@freakz.ro> | 2011-06-24 21:56:37 +0300 |
| commit | 3de42791ee0343696586137d385f53bcc46ebd90 (patch) | |
| tree | 8c3513ebb9e2e3613f3c2c844a99ffe742ac312e /src | |
| parent | 14cb9496e3254b8a9e45471bcc7b69e5af1dc942 (diff) | |
Core/Spells: Partial revert of 5ddf90c5fe8e51a72697, use checkcast hook for disallowing spells to be casted directly
Closes #2108
Diffstat (limited to 'src')
| -rwxr-xr-x | src/server/game/Spells/Spell.cpp | 3 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 30 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 4357fb4bbc2..118f46cd701 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4652,9 +4652,6 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_spellInfo->AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS)) return SPELL_FAILED_SPELL_UNAVAILABLE; - if (m_castedClientside && m_spellInfo->Attributes & SPELL_ATTR0_HIDDEN_CLIENTSIDE && m_caster->GetTypeId() == TYPEID_PLAYER && !m_CastItem) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - // Check global cooldown if (strict && !m_IsTriggeredSpell && HasGlobalCooldown()) return SPELL_FAILED_NOT_READY; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 583e199979a..9de0ffa6f54 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1125,6 +1125,35 @@ class spell_gen_magic_rooster : public SpellScriptLoader } }; +class spell_gen_allow_cast_from_item_only : public SpellScriptLoader +{ +public: + spell_gen_allow_cast_from_item_only() : SpellScriptLoader("spell_gen_allow_cast_from_item_only") { } + + class spell_gen_allow_cast_from_item_only_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_allow_cast_from_item_only_SpellScript); + + SpellCastResult CheckRequirement() + { + if (!GetCastItem()) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_gen_allow_cast_from_item_only_SpellScript::CheckRequirement); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_allow_cast_from_item_only_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -1151,4 +1180,5 @@ void AddSC_generic_spell_scripts() new spell_gen_turkey_marker(); new spell_gen_lifeblood(); new spell_gen_magic_rooster(); + new spell_gen_allow_cast_by_item_only(); } |
