mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[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:
parent
c3c0098361
commit
e55a14b96d
2 changed files with 10 additions and 25 deletions
|
|
@ -5477,11 +5477,11 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::UpdateWeaponSkill (WeaponAttackType attType)
|
void Player::UpdateWeaponSkill(WeaponAttackType attType)
|
||||||
{
|
{
|
||||||
// no skill gain in pvp
|
// no skill gain in pvp
|
||||||
Unit *pVictim = getVictim();
|
Unit* pVictim = getVictim();
|
||||||
if(pVictim && pVictim->IsCharmerOrOwnerPlayerOrPlayerItself())
|
if (pVictim && pVictim->IsCharmerOrOwnerPlayerOrPlayerItself())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (IsInFeralForm())
|
if (IsInFeralForm())
|
||||||
|
|
@ -5490,29 +5490,14 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
|
||||||
if (GetShapeshiftForm() == FORM_TREE)
|
if (GetShapeshiftForm() == FORM_TREE)
|
||||||
return; // use weapon but not skill up
|
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)
|
Item* pWeapon = GetWeaponForAttack(attType, true, true);
|
||||||
{
|
if (pWeapon && pWeapon->GetProto()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
|
||||||
case BASE_ATTACK:
|
UpdateSkill(pWeapon->GetSkill(), weaponSkillGain);
|
||||||
{
|
else if (!pWeapon && attType == BASE_ATTACK)
|
||||||
Item *tmpitem = GetWeaponForAttack(attType,true,true);
|
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();
|
UpdateAllCritPercentages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11837"
|
#define REVISION_NR "11838"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue