public static bool Contains(this EquipSlotCategory self, ItemSlots slot)
        {
            switch (slot)
            {
            case ItemSlots.MainHand: return(self.MainHand != 0);

            case ItemSlots.Head: return(self.Head != 0);

            case ItemSlots.Body: return(self.Body != 0);

            case ItemSlots.Hands: return(self.Gloves != 0);

            case ItemSlots.Waist: return(self.Waist != 0);

            case ItemSlots.Legs: return(self.Legs != 0);

            case ItemSlots.Feet: return(self.Feet != 0);

            case ItemSlots.OffHand: return(self.OffHand != 0);

            case ItemSlots.Ears: return(self.Ears != 0);

            case ItemSlots.Neck: return(self.Neck != 0);

            case ItemSlots.Wrists: return(self.Wrists != 0);

            case ItemSlots.RightRing: return(self.FingerR != 0);

            case ItemSlots.LeftRing: return(self.FingerL != 0);

            case ItemSlots.SoulCrystal: return(self.SoulCrystal != 0);
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// Equip a new item instance into it's first valid slot.
        /// </summary>
        public void EquipItem(uint itemId)
        {
            if (!GameTableManager.Items.TryGetValue(itemId, out SaintCoinach.Xiv.Item itemEntry))
            {
                throw new ArgumentException($"Invalid item id {itemId}!");
            }

            EquipSlotCategory equipSlotCategoryEntry = ((Equipment)itemEntry).EquipSlotCategory;

            if (equipSlotCategoryEntry == null)
            {
                throw new ArgumentException($"Item id {itemId} can't be equipped!");
            }

            // find first free slot for the item (some items such as rings can be equipped into multiple slots)
            Container container = GetContainer(ContainerType.Equipped);

            foreach (var equipSlot in equipSlotCategoryEntry.PossibleSlots)
            {
                if (container.GetItem((ushort)equipSlot.Key) != null)
                {
                    continue;
                }

                _EquipItem(new Item(owner, itemEntry, AssetManager.ItemId.DequeueValue()), (ushort)equipSlot.Key);
                break;
            }
        }
Example #3
0
        private void EquipItem(Item item, ushort slot)
        {
            EquipSlotCategory equipSlotCategoryEntry = ((Equipment)item.Entry).EquipSlotCategory;

            if (equipSlotCategoryEntry == null)
            {
                throw new ArgumentException($"Item id {item.Entry.Key} can't be equipped!");
            }

            if (equipSlotCategoryEntry.PossibleSlots.All(s => s.Key != slot))
            {
                throw new ArgumentException($"Item id {item.Entry.Key} can't be equipped into slot {slot}!");
            }

            _EquipItem(item, slot);
        }
Example #4
0
 public ItemWrapper(Item value)
     : base(value)
 {
     this.equipSlotCategory = this.Value.EquipSlotCategory;
 }