Core/Spells: Fix pick lock - thanks to cyberbrest for pointing the reason of this issue.

This commit is contained in:
QAston
2011-09-03 20:16:15 +02:00
3 changed files with 6 additions and 4 deletions

View File

@@ -4756,7 +4756,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
{
SpellCastResult castResult = m_spellInfo->CheckExplicitTarget(m_caster, m_targets.GetObjectTarget());
SpellCastResult castResult = m_spellInfo->CheckExplicitTarget(m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());
if (castResult != SPELL_CAST_OK)
return castResult;
}

View File

@@ -1721,13 +1721,14 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, Unit const* target, b
return SPELL_CAST_OK;
}
SpellCastResult SpellInfo::CheckExplicitTarget(Unit const* caster, WorldObject const* target) const
SpellCastResult SpellInfo::CheckExplicitTarget(Unit const* caster, WorldObject const* target, Item const* itemTarget) const
{
uint32 neededTargets = GetExplicitTargetMask();
if (!target)
{
if (neededTargets & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_GAMEOBJECT_MASK | TARGET_FLAG_CORPSE_MASK))
return SPELL_FAILED_BAD_TARGETS;
if (!(neededTargets & TARGET_FLAG_GAMEOBJECT_ITEM) || !itemTarget)
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}

View File

@@ -24,6 +24,7 @@
class Unit;
class Player;
class Item;
class Spell;
class SpellInfo;
struct SpellChainNode;
@@ -442,7 +443,7 @@ public:
SpellCastResult CheckShapeshift(uint32 form) const;
SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL) const;
SpellCastResult CheckTarget(Unit const* caster, Unit const* target, bool implicit = true) const;
SpellCastResult CheckExplicitTarget(Unit const* caster, WorldObject const* target) const;
SpellCastResult CheckExplicitTarget(Unit const* caster, WorldObject const* target, Item const* itemTarget = NULL) const;
bool CheckTargetCreatureType(Unit const* target) const;
SpellSchoolMask GetSchoolMask() const;