mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2025-11-10 12:24:22 +08:00
Merge 618db3fcc935511238c2bf1291d4d5756ed5d707 into 5bef92d5eaca3e2ecc317f9d599312bc23eb71aa
This commit is contained in:
commit
1f89b5778f
@ -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
|
||||
|
||||
@ -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,9 +992,12 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* ite
|
||||
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
|
||||
|
||||
Item* tmpitem = GetWeaponForAttack(attType, true);
|
||||
if (item && item != tmpitem && !item->IsBroken())
|
||||
ObjectGuid tmpitemGUID = tmpitem ? tmpitem->GetGUID() : ObjectGuid::Empty;
|
||||
if (itemGuid != ObjectGuid::Empty && itemGuid != tmpitemGUID)
|
||||
{
|
||||
tmpitem = item;
|
||||
Item* item = GetItemByGuid(itemGuid);
|
||||
if (item && !item->IsBroken())
|
||||
tmpitem = item;
|
||||
}
|
||||
|
||||
if (!tmpitem && attType == BASE_ATTACK)
|
||||
@ -1022,7 +1025,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 +1074,7 @@ void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool def
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateWeaponSkill(victim, attType, item);
|
||||
UpdateWeaponSkill(victim, attType, itemGuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16085,7 +16085,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))
|
||||
|
||||
@ -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,10 @@ 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();
|
||||
else
|
||||
m_weaponItemGUID = ObjectGuid::Empty;
|
||||
}
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user