Skip to content

Commit

Permalink
Fix skill upgrade for herbalism/mining/skinning
Browse files Browse the repository at this point in the history
When loot is générated for an game object we cannot be anymore able to gain skill point.

fix cmangos/issues#42
  • Loading branch information
cyberium committed Jan 13, 2017
1 parent 5363e82 commit 298d32e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/game/SpellEffects.cpp
Expand Up @@ -5310,10 +5310,8 @@ void Spell::EffectOpenLock(SpellEffectIndex eff_idx)
if (itemTarget)
itemTarget->SetFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_UNLOCKED);

SendLoot(guid, LOOT_SKINNING, LockType(m_spellInfo->EffectMiscValue[eff_idx]));

// not allow use skill grow at item base open
if (!m_CastItem && skillId != SKILL_NONE)
if (!m_CastItem && skillId != SKILL_NONE && !gameObjTarget->loot)
{
// update skill if really known
if (uint32 pureSkillValue = player->GetPureSkillValue(skillId))
Expand All @@ -5332,6 +5330,8 @@ void Spell::EffectOpenLock(SpellEffectIndex eff_idx)
}
}
}

SendLoot(guid, LOOT_SKINNING, LockType(m_spellInfo->EffectMiscValue[eff_idx]));
}

void Spell::EffectSummonChangeItem(SpellEffectIndex eff_idx)
Expand Down Expand Up @@ -11008,8 +11008,18 @@ void Spell::EffectSkinning(SpellEffectIndex /*eff_idx*/)
uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();

Loot*& loot = unitTarget->loot;

if (!loot)
{
loot = new Loot((Player*)m_caster, creature, LOOT_SKINNING);

int32 reqValue = targetLevel < 10 ? 0 : targetLevel < 20 ? (targetLevel - 10) * 10 : targetLevel * 5;

int32 skillValue = ((Player*)m_caster)->GetPureSkillValue(skill);

// Double chances for elites
((Player*)m_caster)->UpdateGatherSkill(skill, skillValue, reqValue, creature->IsElite() ? 2 : 1);
}
else
{
if (loot->GetLootType() != LOOT_SKINNING)
Expand All @@ -11021,13 +11031,6 @@ void Spell::EffectSkinning(SpellEffectIndex /*eff_idx*/)

loot->ShowContentTo((Player*)m_caster);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);

int32 reqValue = targetLevel < 10 ? 0 : targetLevel < 20 ? (targetLevel - 10) * 10 : targetLevel * 5;

int32 skillValue = ((Player*)m_caster)->GetPureSkillValue(skill);

// Double chances for elites
((Player*)m_caster)->UpdateGatherSkill(skill, skillValue, reqValue, creature->IsElite() ? 2 : 1);
}

void Spell::EffectCharge(SpellEffectIndex /*eff_idx*/)
Expand Down

0 comments on commit 298d32e

Please sign in to comment.