diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 6f3d506368b..02f751b1b86 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7547,20 +7547,8 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply if (proto->ArcaneRes) HandleStatFlatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(proto->ArcaneRes), apply); - WeaponAttackType attType = BASE_ATTACK; - - if (slot == EQUIPMENT_SLOT_RANGED && ( - proto->InventoryType == INVTYPE_RANGED || proto->InventoryType == INVTYPE_THROWN || - proto->InventoryType == INVTYPE_RANGEDRIGHT)) - { - attType = RANGED_ATTACK; - } - else if (slot == EQUIPMENT_SLOT_OFFHAND) - { - attType = OFF_ATTACK; - } - - if (CanUseAttackType(attType)) + WeaponAttackType attType = Player::GetAttackBySlot(slot); + if (attType != MAX_ATTACK && CanUseAttackType(attType)) _ApplyWeaponDamage(slot, proto, ssv, apply); // Druids get feral AP bonus from weapon dps (also use DPS from ScalingStatValue) @@ -7582,18 +7570,9 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply) { - WeaponAttackType attType = BASE_ATTACK; - - if (slot == EQUIPMENT_SLOT_RANGED && ( - proto->InventoryType == INVTYPE_RANGED || proto->InventoryType == INVTYPE_THROWN || - proto->InventoryType == INVTYPE_RANGEDRIGHT)) - { - attType = RANGED_ATTACK; - } - else if (slot == EQUIPMENT_SLOT_OFFHAND) - { - attType = OFF_ATTACK; - } + WeaponAttackType attType = Player::GetAttackBySlot(slot); + if (attType == MAX_ATTACK) + return; for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) { @@ -7649,7 +7628,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt UpdateDamagePhysical(attType); } -SpellSchoolMask Player::GetMeleeDamageSchoolMask(WeaponAttackType attackType /*=BASE_ATTACK*/, uint8 damageIndex /*= 0*/) const +SpellSchoolMask Player::GetMeleeDamageSchoolMask(WeaponAttackType attackType /*= BASE_ATTACK*/, uint8 damageIndex /*= 0*/) const { if (Item const* weapon = GetWeaponForAttack(attackType, true)) return SpellSchoolMask(1 << weapon->GetTemplate()->Damage[damageIndex].DamageType); |