This commit is contained in:
天鹭 2025-10-10 15:43:29 +08:00
parent 62d7b0c2e7
commit a34452106b
5 changed files with 11 additions and 9 deletions

View File

@ -2071,8 +2071,8 @@ public:
void UpdateLocalChannels(uint32 newZone);
void UpdateDefense();
void UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* item = nullptr);
void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item = nullptr);
void UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, ObjectGuid const itemGuid = ObjectGuid::Empty);
void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, ObjectGuid const itemGuid = ObjectGuid::Empty);
void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal);
[[nodiscard]] uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus

View File

@ -978,7 +978,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
return false;
}
void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* item /*= nullptr*/)
void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, ObjectGuid const itemGuid /*= ObjectGuid::Empty*/)
{
if (IsInFeralForm())
return; // always maximized SKILL_FERAL_COMBAT in fact
@ -992,6 +992,7 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* ite
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
Item* tmpitem = GetWeaponForAttack(attType, true);
Item* item = GetItemByGuid(itemGuid);
if (item && item != tmpitem && !item->IsBroken())
{
tmpitem = item;
@ -1022,7 +1023,7 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* ite
UpdateAllCritPercentages();
}
void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item /*= nullptr*/)
void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, ObjectGuid const itemGuid /*= ObjectGuid::Empty*/)
{
uint8 playerLevel = GetLevel();
uint16 currentSkillValue = defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType);
@ -1071,7 +1072,7 @@ void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool def
}
else
{
UpdateWeaponSkill(victim, attType, item);
UpdateWeaponSkill(victim, attType, itemGuid);
}
}
}

View File

@ -16165,7 +16165,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
// On melee based hit/miss/resist/parry/dodge need to update skill (for victim and attacker)
if (procExtra & (PROC_EX_NORMAL_HIT | PROC_EX_MISS | PROC_EX_RESIST | PROC_EX_PARRY | PROC_EX_DODGE))
{
ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItemGUID : ObjectGuid::Empty);
}
// Update defence if player is victim and we block - TODO: confirm that blocked attacks only have a chance to increase defence skill
else if (isVictim && procExtra & (PROC_EX_BLOCK))

View File

@ -687,7 +687,7 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags,
// xinef:
_spellTargetsSelected = false;
m_weaponItem = nullptr;
m_weaponItemGUID = ObjectGuid::Empty;
}
Spell::~Spell()
@ -7691,7 +7691,8 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND;
}
m_weaponItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true);
if (Item* weaponItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true))
m_weaponItemGUID = weaponItem->GetGUID();
}
return SPELL_CAST_OK;

View File

@ -530,7 +530,7 @@ public:
SpellInfo const* const m_spellInfo;
Item* m_CastItem;
Item* m_weaponItem;
ObjectGuid m_weaponItemGUID;
ObjectGuid m_castItemGUID;
uint8 m_cast_count;
uint32 m_glyphIndex;