mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 13:46:24 +00:00
fix(Core/Spells): always select correct item on weapon skill update (#7135)
- Closes #6158
This commit is contained in:
@@ -1955,8 +1955,8 @@ public:
|
||||
void UpdateLocalChannels(uint32 newZone);
|
||||
|
||||
void UpdateDefense();
|
||||
void UpdateWeaponSkill(Unit* victim, WeaponAttackType attType);
|
||||
void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence);
|
||||
void UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* item = nullptr);
|
||||
void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item = nullptr);
|
||||
|
||||
void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal);
|
||||
[[nodiscard]] uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus
|
||||
|
||||
@@ -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