Core/Player: only call _ApplyWeaponDamage for actual weapons

Closes #21308

(cherry picked from commit 8e0af1b93bed87753e89aebefba3fbb085f40565)
This commit is contained in:
ariel-
2021-06-16 21:32:53 +02:00
committed by Shauren
parent d0f4310c44
commit 905112b2a6
+5 -8
View File
@@ -7770,7 +7770,7 @@ void Player::_ApplyItemBonuses(Item* item, uint8 slot, bool apply)
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ShieldBlock), apply ? int32(armor * 2.5f) : 0);
}
WeaponAttackType attType = GetAttackBySlot(slot, proto->GetInventoryType());
WeaponAttackType attType = Player::GetAttackBySlot(slot, proto->GetInventoryType());
if (attType != MAX_ATTACK && CanUseAttackType(attType))
_ApplyWeaponDamage(slot, item, apply);
}
@@ -7778,14 +7778,11 @@ void Player::_ApplyItemBonuses(Item* item, uint8 slot, bool apply)
void Player::_ApplyWeaponDamage(uint8 slot, Item* item, bool apply)
{
ItemTemplate const* proto = item->GetTemplate();
WeaponAttackType attType = BASE_ATTACK;
WeaponAttackType attType = Player::GetAttackBySlot(slot, proto->GetInventoryType());
if (attType == MAX_ATTACK)
return;
float damage = 0.0f;
if (slot == EQUIPMENT_SLOT_MAINHAND && (proto->GetInventoryType() == INVTYPE_RANGED || proto->GetInventoryType() == INVTYPE_RANGEDRIGHT))
attType = RANGED_ATTACK;
else if (slot == EQUIPMENT_SLOT_OFFHAND)
attType = OFF_ATTACK;
uint32 itemLevel = item->GetItemLevel(this);
float minDamage, maxDamage;
proto->GetDamage(itemLevel, minDamage, maxDamage);