[11838] Small code cleanup in Player::UpdateWeaponSkill

Thanks to stfx for providing the patch.

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
kaelima 2011-11-04 15:32:13 +01:00 committed by Schmoozerd
parent c3c0098361
commit e55a14b96d
2 changed files with 10 additions and 25 deletions

View file

@ -5477,11 +5477,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->IsCharmerOrOwnerPlayerOrPlayerItself())
Unit* pVictim = getVictim();
if (pVictim && pVictim->IsCharmerOrOwnerPlayerOrPlayerItself())
return;
if (IsInFeralForm())
@ -5490,29 +5490,14 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
if (GetShapeshiftForm() == FORM_TREE)
return; // use weapon but not skill up
uint32 weapon_skill_gain = sWorld.getConfig(CONFIG_UINT32_SKILL_GAIN_WEAPON);
uint32 weaponSkillGain = sWorld.getConfig(CONFIG_UINT32_SKILL_GAIN_WEAPON);
switch(attType)
{
case BASE_ATTACK:
{
Item *tmpitem = GetWeaponForAttack(attType,true,true);
Item* pWeapon = GetWeaponForAttack(attType, true, true);
if (pWeapon && pWeapon->GetProto()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
UpdateSkill(pWeapon->GetSkill(), weaponSkillGain);
else if (!pWeapon && attType == BASE_ATTACK)
UpdateSkill(SKILL_UNARMED, weaponSkillGain);
if (!tmpitem)
UpdateSkill(SKILL_UNARMED,weapon_skill_gain);
else if(tmpitem->GetProto()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
UpdateSkill(tmpitem->GetSkill(),weapon_skill_gain);
break;
}
case OFF_ATTACK:
case RANGED_ATTACK:
{
Item *tmpitem = GetWeaponForAttack(attType,true,true);
if (tmpitem)
UpdateSkill(tmpitem->GetSkill(),weapon_skill_gain);
break;
}
}
UpdateAllCritPercentages();
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11837"
#define REVISION_NR "11838"
#endif // __REVISION_NR_H__