using System.Collections.Generic;
namespace DFEngine.Content.Items
{
///
/// Class that holds a collection of item instances.
///
public class Inventory
{
///
/// The items inside of the inventory.
///
public List- Items { get; set; }
///
/// The inventory's type.
///
public InventoryType Type { get; set; }
///
/// The maximum number of items this inventory can store.
///
private int _capacity;
///
/// Creates a new instance of the class.
///
/// The type of the inventory.
/// The maximum number of items the inventory can contain.
public Inventory(InventoryType type, int capacity)
{
Items = new List
- (capacity);
Type = type;
_capacity = capacity;
}
///
/// Returns the item at the specified inventory position.
///
/// The item's position.
public Item this[byte slot] => Items.First(i => i.Slot == (ItemSlot)slot);
public byte Flags
{
get
{
switch (Type)
{
case InventoryType.EQUIPPED:
return 115;
case InventoryType.CHAR_INVENTORY:
return 91;
case InventoryType.MINIHOUSE_SKIN:
return 63;
case InventoryType.ACTION_BOX:
return 61;
default:
return 0;
}
}
}
}
}