mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
fix(Core/Spells): always select correct item on weapon skill update (#7135)
- Closes #6158
This commit is contained in:
@@ -935,7 +935,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType)
|
||||
void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* item /*= nullptr*/)
|
||||
{
|
||||
if (IsInFeralForm())
|
||||
return; // always maximized SKILL_FERAL_COMBAT in fact
|
||||
@@ -951,6 +951,11 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType)
|
||||
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
|
||||
|
||||
Item* tmpitem = GetWeaponForAttack(attType, true);
|
||||
if (item && item != tmpitem && !item->IsBroken())
|
||||
{
|
||||
tmpitem = item;
|
||||
}
|
||||
|
||||
if (!tmpitem && attType == BASE_ATTACK)
|
||||
{
|
||||
// Keep unarmed & fist weapon skills in sync
|
||||
@@ -976,8 +981,7 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType)
|
||||
UpdateAllCritPercentages();
|
||||
}
|
||||
|
||||
void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType,
|
||||
bool defence)
|
||||
void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item /*= nullptr*/)
|
||||
{
|
||||
uint8 plevel = getLevel(); // if defense than victim == attacker
|
||||
uint8 greylevel = Acore::XP::GetGrayLevel(plevel);
|
||||
@@ -1011,7 +1015,7 @@ void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType,
|
||||
if (defence)
|
||||
UpdateDefense();
|
||||
else
|
||||
UpdateWeaponSkill(victim, attType);
|
||||
UpdateWeaponSkill(victim, attType, item);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user