public static void EquipItem <T>(int itemObjectId) where T : IEntityInventory { var inventory = Get <T>(); var item = ItemManager.GetItem <IItem>(itemObjectId); var equipped = GetEquippedItems <IEntityInventory>(); if (item is not null && item is not MiscItem) { if (equipped.All(i => i.ObjectId != item.ObjectId)) { if (item.GetType() == typeof(WeaponItem)) { inventory.CurrentWeapon = (WeaponItem)item; } else if (item.GetType() == typeof(HeadItem)) { inventory.CurrentHeadItem = (HeadItem)item; } else if (item.GetType() == typeof(BodyItem)) { inventory.CurrentBodyItem = (BodyItem)item; } else if (item.GetType() == typeof(LegsItem)) { inventory.CurrentLegsItem = (LegsItem)item; } MessageManager.AddItemEquipped(item.Name); } else { MessageManager.AddDefault("You have already equipped this item."); } } }