From 7e6f7bf6e496e742fbb8dcdf4d7f4a0c7b59a740 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sat, 17 Jan 2009 17:15:48 +0300 Subject: [PATCH] Fix/prevent cast if client send incorrect target for some spells Signed-off-by: DiSlord --- src/game/Spell.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index a39c53b51..ee9bed1d8 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3639,6 +3639,20 @@ uint8 Spell::CanCast(bool strict) } } } + else if (m_caster->GetTypeId()==TYPEID_PLAYER) // Target - is player caster + { + // Additional check for some spells + // If 0 spell effect empty - client not send target data (need use selection) + // TODO: check it on next client version + if (m_targets.m_targetMask == TARGET_FLAG_SELF && + m_spellInfo->Effect[0] == 0 && m_spellInfo->EffectImplicitTargetA[1] != TARGET_SELF) + { + if (target = m_caster->GetUnit(*m_caster, ((Player *)m_caster)->GetSelection())) + m_targets.setUnitTarget(target); + else + return SPELL_FAILED_BAD_TARGETS; + } + } // check pet presents for(int j=0;j<3;j++)