Example #1
0
        internal void EquipItem(RolledEquipment item, Slot?slot = null)
        {
            SlotMap slotMap = Slots.Get(item.Base.EquipmentType);

            if (slot == null)
            {
                if (slotMap.Occupies != null)
                {
                    slot = slotMap.Occupies[0];
                }
                else if (slotMap.ValidIn != null && slotMap.ValidIn.Count == 1)
                {
                    slot = slotMap.ValidIn[0];
                }
                else
                {
                    throw new Exception("Slot not provided and could not infer");
                }
            }

            if (slotMap.Occupies != null)
            {
                foreach (Slot checkSlot in slotMap.Occupies)
                {
                    if (slots[checkSlot] != null)
                    {
                        throw new Exception("Required slot not empty");
                    }
                }
            }

            if (slots[(Slot)slot] != null)
            {
                throw new Exception("Specified slot not empty");
            }

            // todo: any other requirement checks

            slots[(Slot)slot] = item;
        }
Example #2
0
 public void EquipItem(RolledEquipment item, Slot?slot = null) => equipmentManager.EquipItem(item, slot);