mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 11:55:43 +00:00
fix(Core/Player): Weapon skill gain (#5961)
This commit is contained in:
@@ -6511,29 +6511,40 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Player::UpdateWeaponSkill(WeaponAttackType attType)
|
||||
void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType)
|
||||
{
|
||||
// no skill gain in pvp
|
||||
Unit* victim = GetVictim();
|
||||
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (IsInFeralForm())
|
||||
return; // always maximized SKILL_FERAL_COMBAT in fact
|
||||
|
||||
if (GetShapeshiftForm() == FORM_TREE)
|
||||
return; // use weapon but not skill up
|
||||
|
||||
if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILL_GAINS))
|
||||
if (victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILL_GAINS))
|
||||
return;
|
||||
|
||||
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
|
||||
|
||||
Item* tmpitem = GetWeaponForAttack(attType, true);
|
||||
if (!tmpitem && attType == BASE_ATTACK)
|
||||
{
|
||||
// Keep unarmed & fist weapon skills in sync
|
||||
UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
|
||||
else if (tmpitem && tmpitem->GetTemplate()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
|
||||
UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
|
||||
UpdateSkill(SKILL_FIST_WEAPONS, weapon_skill_gain);
|
||||
}
|
||||
else if (tmpitem)
|
||||
{
|
||||
switch (tmpitem->GetTemplate()->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_WEAPON_FISHING_POLE:
|
||||
break;
|
||||
case ITEM_SUBCLASS_WEAPON_FIST:
|
||||
UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
|
||||
[[fallthrough]];
|
||||
default:
|
||||
UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAllCritPercentages();
|
||||
}
|
||||
@@ -6569,7 +6580,7 @@ void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool def
|
||||
if (defence)
|
||||
UpdateDefense();
|
||||
else
|
||||
UpdateWeaponSkill(attType);
|
||||
UpdateWeaponSkill(victim, attType);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user