public bool CheckIfInventoryIsPopulated(int inventory) { CharacterInventoryType inventorySlot = GetInventoryById(inventory); if (inventorySlot != null && inventorySlot.Items.Count > 0) { return(true); } return(false); }
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); }
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); } }
public void Set(CharacterInventoryType inventory) { int index = _inventoryList.FindIndex(tmp => tmp.InventoryType == inventory.InventoryType); _inventoryList[index] = inventory; }
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; }
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); } }