Core/Player: Fix gaining fishing skill of wielding fishing pole in offhand

Closes #3717
This commit is contained in:
kaelima
2011-10-29 15:07:08 +01:00
parent 2575b50b05
commit 0083290322
+12 -29
View File
@@ -6227,11 +6227,11 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
return false;
}
void Player::UpdateWeaponSkill (WeaponAttackType attType)
void Player::UpdateWeaponSkill(WeaponAttackType attType)
{
// no skill gain in pvp
Unit* pVictim = getVictim();
if (pVictim && pVictim->GetTypeId() == TYPEID_PLAYER)
Unit* victim = getVictim();
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
return;
if (IsInFeralForm())
@@ -6240,42 +6240,25 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
if (GetShapeshiftForm() == FORM_TREE)
return; // use weapon but not skill up
if (pVictim && pVictim->GetTypeId() == TYPEID_UNIT && (pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
return;
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
switch (attType)
{
case BASE_ATTACK:
{
Item* tmpitem = GetWeaponForAttack(attType, true);
Item* tmpitem = GetWeaponForAttack(attType, true);
if (!tmpitem && attType == BASE_ATTACK)
UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
else if (tmpitem->GetTemplate()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
if (!tmpitem)
UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
else if (tmpitem->GetTemplate()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
break;
}
case OFF_ATTACK:
case RANGED_ATTACK:
{
Item* tmpitem = GetWeaponForAttack(attType, true);
if (tmpitem)
UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
break;
}
default:
break;
}
UpdateAllCritPercentages();
}
void Player::UpdateCombatSkills(Unit* pVictim, WeaponAttackType attType, bool defence)
void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence)
{
uint8 plevel = getLevel(); // if defense than pVictim == attacker
uint8 plevel = getLevel(); // if defense than victim == attacker
uint8 greylevel = Trinity::XP::GetGrayLevel(plevel);
uint8 moblevel = pVictim->getLevelForTarget(this);
uint8 moblevel = victim->getLevelForTarget(this);
if (moblevel < greylevel)
return;