Core/Spells: Correctly give skill bonus provided by spells on cast, fixes Mining/Herbalism (and similar) exploits that allowed players to mine/gather anything with any skill

This commit is contained in:
Shocker
2011-03-01 17:47:53 +02:00
parent 1618afc5d1
commit 43240f8c3d
+4 -4
View File
@@ -6967,16 +6967,16 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
if (skillId != SKILL_NONE)
{
// skill bonus provided by casting spell (mostly item spells)
// add the damage modifier from the spell casted (cheat lock / skeleton key etc.)
uint32 spellSkillBonus = uint32(CalculateDamage(effIndex, NULL));
reqSkillValue = lockInfo->Skill[j];
// castitem check: rogue using skeleton keys. the skill values should not be added in this case.
skillValue = m_CastItem || m_caster->GetTypeId()!= TYPEID_PLAYER ?
0 : m_caster->ToPlayer()->GetSkillValue(skillId);
skillValue += spellSkillBonus;
// skill bonus provided by casting spell (mostly item spells)
// add the damage modifier from the spell casted (cheat lock / skeleton key etc.)
if (m_spellInfo->EffectImplicitTargetA[effIndex] == TARGET_GAMEOBJECT_ITEM || m_spellInfo->EffectImplicitTargetB[effIndex] == TARGET_GAMEOBJECT_ITEM)
skillValue += uint32(CalculateDamage(effIndex, NULL));
if (skillValue < reqSkillValue)
return SPELL_FAILED_LOW_CASTLEVEL;