From 905112b2a61c5b3999f936d957e10a3ee6258751 Mon Sep 17 00:00:00 2001 From: ariel- Date: Wed, 24 Jan 2018 00:05:25 -0300 Subject: [PATCH] Core/Player: only call _ApplyWeaponDamage for actual weapons Closes #21308 (cherry picked from commit 8e0af1b93bed87753e89aebefba3fbb085f40565) --- src/server/game/Entities/Player/Player.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f79a2eacd2..0ef3551e0d 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -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);