Core/Player: only call _ApplyWeaponDamage for actual weapons
Port From (https://github.com/TrinityCore/TrinityCore/commit/905112b2a61c5b3999f936d957e10a3ee6258751)
This commit is contained in:
@@ -291,17 +291,14 @@ namespace Game.Entities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _ApplyWeaponDamage(uint slot, Item item, bool apply)
|
public void _ApplyWeaponDamage(byte slot, Item item, bool apply)
|
||||||
{
|
{
|
||||||
ItemTemplate proto = item.GetTemplate();
|
ItemTemplate proto = item.GetTemplate();
|
||||||
WeaponAttackType attType = WeaponAttackType.BaseAttack;
|
WeaponAttackType attType = GetAttackBySlot(slot, proto.GetInventoryType());
|
||||||
|
if (attType == WeaponAttackType.Max)
|
||||||
|
return;
|
||||||
|
|
||||||
float damage = 0.0f;
|
float damage = 0.0f;
|
||||||
|
|
||||||
if (slot == EquipmentSlot.MainHand && (proto.GetInventoryType() == InventoryType.Ranged || proto.GetInventoryType() == InventoryType.RangedRight))
|
|
||||||
attType = WeaponAttackType.RangedAttack;
|
|
||||||
else if (slot == EquipmentSlot.OffHand)
|
|
||||||
attType = WeaponAttackType.OffAttack;
|
|
||||||
|
|
||||||
uint itemLevel = item.GetItemLevel(this);
|
uint itemLevel = item.GetItemLevel(this);
|
||||||
float minDamage, maxDamage;
|
float minDamage, maxDamage;
|
||||||
proto.GetDamage(itemLevel, out minDamage, out maxDamage);
|
proto.GetDamage(itemLevel, out minDamage, out maxDamage);
|
||||||
|
|||||||
@@ -1702,7 +1702,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
Action<Unit> flagAddFn = null;
|
Action<Unit> flagAddFn = null;
|
||||||
Action<Unit> flagRemoveFn = null;
|
Action<Unit> flagRemoveFn = null;
|
||||||
uint slot;
|
byte slot;
|
||||||
WeaponAttackType attType;
|
WeaponAttackType attType;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@@ -1742,10 +1742,10 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
Player player = target.ToPlayer();
|
Player player = target.ToPlayer();
|
||||||
|
|
||||||
Item item = player.GetItemByPos(InventorySlots.Bag0, (byte)slot);
|
Item item = player.GetItemByPos(InventorySlots.Bag0, slot);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
WeaponAttackType attackType = Player.GetAttackBySlot((byte)slot, item.GetTemplate().GetInventoryType());
|
WeaponAttackType attackType = Player.GetAttackBySlot(slot, item.GetTemplate().GetInventoryType());
|
||||||
|
|
||||||
player.ApplyItemDependentAuras(item, !apply);
|
player.ApplyItemDependentAuras(item, !apply);
|
||||||
if (attackType < WeaponAttackType.Max)
|
if (attackType < WeaponAttackType.Max)
|
||||||
|
|||||||
Reference in New Issue
Block a user