Example #1
0
        public bool CheckIfInventoryIsPopulated(int inventory)
        {
            CharacterInventoryType inventorySlot = GetInventoryById(inventory);

            if (inventorySlot != null && inventorySlot.Items.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        public CharacterInventoryType GetInventoryById(int inventoryId)
        {
            CharacterInventoryType inv = _inventoryList.Find(tmp => tmp.InventoryType == inventoryId);

            if (inv == null)
            {
                inv = new CharacterInventoryType(inventoryId);
                _inventoryList.Add(inv);
            }

            return(inv);
        }
Example #3
0
        public CharacterInventory(UnitObject unitObject, FileManager fileManager)
            : base(unitObject, fileManager)
        {
            _inventoryList = new List <CharacterInventoryType>();

            foreach (UnitObject unit in unitObject.Items)
            {
                CharacterItems item = new CharacterItems(unit, fileManager);

                // get the matching inventory entry
                CharacterInventoryType inv = _inventoryList.Find(tmp => tmp.InventoryType == (int)item.InventoryType);

                if (inv == null)
                {
                    inv = new CharacterInventoryType((int)item.InventoryType);
                    _inventoryList.Add(inv);
                }

                inv.Items.Add(item);
            }
        }
Example #4
0
 public void Set(CharacterInventoryType inventory)
 {
     int index = _inventoryList.FindIndex(tmp => tmp.InventoryType == inventory.InventoryType);
     _inventoryList[index] = inventory;
 }
Example #5
0
        public CharacterInventoryType GetInventoryById(int inventoryId)
        {
            CharacterInventoryType inv = _inventoryList.Find(tmp => tmp.InventoryType == inventoryId);

            if (inv == null)
            {
                inv = new CharacterInventoryType(inventoryId);
                _inventoryList.Add(inv);
            }

            return inv;
        }
Example #6
0
        public CharacterInventory(UnitObject unitObject, FileManager fileManager)
            : base(unitObject, fileManager)
        {
            _inventoryList = new List<CharacterInventoryType>();

            foreach (UnitObject unit in unitObject.Items)
            {
                CharacterItems item = new CharacterItems(unit, fileManager);

                // get the matching inventory entry
                CharacterInventoryType inv = _inventoryList.Find(tmp => tmp.InventoryType == (int)item.InventoryType);

                if (inv == null)
                {
                    inv = new CharacterInventoryType((int)item.InventoryType);
                    _inventoryList.Add(inv);
                }

                inv.Items.Add(item);
            }
        }
Example #7
0
        public void Set(CharacterInventoryType inventory)
        {
            int index = _inventoryList.FindIndex(tmp => tmp.InventoryType == inventory.InventoryType);

            _inventoryList[index] = inventory;
        }