Core/Player: partial revert of m_items handling as it's cause of a exploit

Port From (https://github.com/TrinityCore/TrinityCore/commit/3d1da4957cd7ee3320eed089ad213af09050ade1)
This commit is contained in:
hondacrx
2021-09-24 10:26:13 -04:00
parent 6cf76372ac
commit b2b482a1fe
2 changed files with 5 additions and 13 deletions
+1 -1
View File
@@ -295,7 +295,7 @@ namespace Game.Entities
{
ItemTemplate proto = item.GetTemplate();
WeaponAttackType attType = GetAttackBySlot(slot, proto.GetInventoryType());
if (attType == WeaponAttackType.Max)
if (!IsInFeralForm() && apply && !CanUseAttackType(attType))
return;
float damage = 0.0f;
+4 -12
View File
@@ -1873,8 +1873,6 @@ namespace Game.Entities
if (pProto != null && pProto.GetItemSet() != 0)
Item.RemoveItemsSetItem(this, pProto);
// remove here before _ApplyItemMods (for example to register correct damages of unequipped weapon)
m_items[slot] = null;
_ApplyItemMods(pItem, slot, false, update);
pItem.RemoveItemFlag2(ItemFieldFlags2.Equipped);
@@ -1897,9 +1895,8 @@ namespace Game.Entities
}
}
}
else
m_items[slot] = null;
m_items[slot] = null;
SetInvSlot(slot, ObjectGuid.Empty);
if (slot < EquipmentSlot.End)
@@ -3811,7 +3808,7 @@ namespace Game.Entities
}
WeaponAttackType attType = GetAttackBySlot(slot, proto.GetInventoryType());
if (attType != WeaponAttackType.Max && CanUseAttackType(attType))
if (attType != WeaponAttackType.Max)
_ApplyWeaponDamage(slot, item, apply);
}
@@ -5440,9 +5437,6 @@ namespace Game.Entities
if (pProto != null && pProto.GetItemSet() != 0)
Item.RemoveItemsSetItem(this, pProto);
// clear m_items so weapons for example can be registered as unequipped
m_items[slot] = null;
_ApplyItemMods(pItem, slot, false);
}
@@ -5467,10 +5461,8 @@ namespace Game.Entities
// equipment visual show
SetVisibleItemSlot(slot, null);
}
// clear for rest of items (ie nonequippable)
if (slot >= InventorySlots.BagEnd)
m_items[slot] = null;
m_items[slot] = null;
}
else if ((pBag = GetBagByPos(bag)) != null)
pBag.RemoveItem(slot, update);