AngeliA
Search Results for

    Show / Hide Table of Contents

    Class Inventory

    Core system to handle storage of items

    Properties

    PoolReady

    True if the system is read to use

    Declaration
    public static bool PoolReady { get; }

    Methods

    AddItemAt(int, int, int)

    Add "count" to the given item

    Declaration
    public static int AddItemAt(int inventoryID, int itemIndex, int count = 1)
    Returns
    Type Description
    int

    How many items has been added. 0 means no item added. "count" means all items added.

    CollectItem(int, int, int, bool, bool, bool)

    Add item into given inventory to first free slot founded.

    Declaration
    public static int CollectItem(int inventoryID, int item, int count = 1, bool ignoreEquipment = true, bool ignoreInventory = false, bool dontCollectIntoEmptyEquipmentSlot = false)
    int item

    ID of the item

    int count

    Count of the item

    bool ignoreEquipment

    True if do not add into equipment part

    bool ignoreInventory

    True if do not add into inventory part (non-equipment part)

    bool dontCollectIntoEmptyEquipmentSlot

    True if do not add item into empty slot of equipment part

    Returns
    Type Description
    int

    How many items has been collected. 0 means no item collected. "count" means all items collected.

    CollectItem(int, int, out int, int, bool, bool, bool)

    Add item into given inventory to first free slot founded.

    Declaration
    public static int CollectItem(int inventoryID, int item, out int collectIndex, int count = 1, bool ignoreEquipment = true, bool ignoreInventory = false, bool dontCollectIntoEmptyEquipmentSlot = false)
    int item

    ID of the item

    int collectIndex

    Index of which slot collect the item. -1 if not collected.

    int count

    Count of the item

    bool ignoreEquipment

    True if do not add into equipment part

    bool ignoreInventory

    True if do not add into inventory part (non-equipment part)

    bool dontCollectIntoEmptyEquipmentSlot

    True if do not add item into empty slot of equipment part

    Returns
    Type Description
    int

    How many items has been collected. 0 means no item collected. "count" means all items collected.

    FillEquipmentFromInventory(int, EquipmentType)

    Make items with same ID inside inventory part stack onto equipment part

    Declaration
    public static void FillEquipmentFromInventory(int inventoryID, EquipmentType type)

    FindAndAddItem(int, int, int, bool)

    Find given item and add "count" to the item

    Declaration
    public static int FindAndAddItem(int inventoryID, int targetItemID, int count = 1, bool ignoreEquipment = true)
    bool ignoreEquipment

    True if do not search for equipment part

    Returns
    Type Description
    int

    How many items has been added. 0 means no item added. "count" means all items added.

    FindAndTakeItem(int, int, int)

    Take "count" items with "targetItemID" from given inventory

    Declaration
    public static int FindAndTakeItem(int inventoryID, int targetItemID, int count = 1)
    Returns
    Type Description
    int

    How many items has been taken. 0 means no item taken. "count" means all items taken.

    GetEquipment(int, EquipmentType, out int)

    Get ID of equipment for given inventory

    Declaration
    public static int GetEquipment(int inventoryID, EquipmentType type, out int equipmentCount)
    EquipmentType type

    Type of the equipment

    int equipmentCount

    Stack count of the equipment

    GetInventoryCapacity(int)

    Get the item count limit for target inventory

    Declaration
    public static int GetInventoryCapacity(int inventoryID)

    GetInventoryIdFromBasicIdAndPos(int, string, Int3)

    Calculate inventory ID based of the given information

    Declaration
    public static int GetInventoryIdFromBasicIdAndPos(int basicID, string baseName, Int3 mapPos)
    Parameters
    Type Name Description
    int basicID

    ID of the holder

    string baseName

    Name of the holder

    Int3 mapPos

    Original position in unit space for the map-type inventory. (int.MinValue, int.MinValue, int.MinValue) for other type inventory.

    GetInventoryMapPosFromName(string, out string)

    Calculate the original holder position from the given inventory file name

    Declaration
    public static Int3 GetInventoryMapPosFromName(string invNameWithoutExt, out string basicName)

    GetItemAt(int, int)

    Get ID of the item inside given inventory

    Declaration
    public static int GetItemAt(int inventoryID, int itemIndex)
    int itemIndex

    Index of the item

    GetItemAt(int, int, out int)

    Get ID of the item inside given inventory

    Declaration
    public static int GetItemAt(int inventoryID, int itemIndex, out int count)
    int itemIndex

    Index of the item

    int count

    Count of the item

    GetItemCount(int, int)

    Get count of the given item

    Declaration
    public static int GetItemCount(int inventoryID, int itemIndex)
    int itemIndex

    Index of the item

    Returns
    Type Description
    int

    Count of the item

    GiveItemToTarget(Entity, int, int, bool)

    Add target item to inventory of target entity

    Declaration
    public static bool GiveItemToTarget(Entity target, int itemID, int count = 1, bool spawnWhenInventoryFull = true)
    bool spawnWhenInventoryFull

    True if spawn an ItemHolder entity to hold the item

    Returns
    Type Description
    bool

    True if the item is given

    HasEnoughRoomToCollect(int, int, int)

    True if the inventory have enough room to contain all the target items

    Declaration
    public static bool HasEnoughRoomToCollect(int inventoryID, int item, int count)

    HasInventory(int)

    True if the given ID refers to a valid inventory

    Declaration
    public static bool HasInventory(int inventoryID)

    HasItem(int, int, bool)

    True if the given item founded in the target inventory.

    Declaration
    public static bool HasItem(int inventoryID, int itemID, bool includeEquipment = true)
    bool includeEquipment

    True if search inside equipment part

    IndexOfItem(int, int)

    Find index of the target item inside given inventory

    Declaration
    public static int IndexOfItem(int inventoryID, int itemID)
    Returns
    Type Description
    int

    Index of the item. -1 when not found.

    InitializeInventoryData(int, string, int, Int3, bool)

    Initialize an inventory data for the system

    Declaration
    public static int InitializeInventoryData(int basicID, string basicName, int capacity, Int3 mapUnitPos, bool hasEquipment = false)
    Parameters
    Type Name Description
    int basicID

    ID of the holder

    string basicName

    Name of the holder

    int capacity

    Maximal item count the inventory can hold

    Int3 mapUnitPos

    Original position in unit space for the map-type inventory. (int.MinValue, int.MinValue, int.MinValue) for other type inventory.

    bool hasEquipment

    True if this inventory requires equipment part.

    Returns
    Type Description
    int

    Inventory ID

    InitializeInventoryData(int, string, int, bool)

    Declaration
    public static int InitializeInventoryData(int basicID, string basicName, int capacity, bool hasEquipment = false)

    InitializeInventoryData(string, int, Int3, bool)

    Declaration
    public static int InitializeInventoryData(string basicName, int capacity, Int3 mapUnitPos, bool hasEquipment = false)

    InitializeInventoryData(string, int, bool)

    Declaration
    public static int InitializeInventoryData(string basicName, int capacity, bool hasEquipment = false)

    ItemTotalCount(int, int, bool)

    How many target items are currently inside the inventory

    Declaration
    public static int ItemTotalCount(int inventoryID, int itemID, bool ignoreStack = false)
    bool ignoreStack

    True if stacked items count as one

    ItemTotalCount(int, int, int, out int, bool)

    How many target items are currently inside the inventory

    Declaration
    public static int ItemTotalCount(int inventoryID, int itemID, int targetIndex, out int targetOrder, bool ignoreStack = false)
    int targetIndex

    Index of the special target

    int targetOrder

    Order of the special target between all items inside the inventory with same ID

    bool ignoreStack

    True if stacked items count as one

    ItemTotalCount<I>(int, bool)

    How many target items are currently inside the inventory

    Declaration
    public static int ItemTotalCount<I>(int inventoryID, bool ignoreStack = false) where I : Item
    bool ignoreStack

    True if stacked items count as one

    ItemTotalCount<I>(int, int, out int, bool)

    How many target items are currently inside the inventory

    Declaration
    public static int ItemTotalCount<I>(int inventoryID, int targetIndex, out int targetOrder, bool ignoreStack = false) where I : Item
    int targetIndex

    Index of the special target

    int targetOrder

    Order of the special target between all items inside the inventory with same ID

    bool ignoreStack

    True if stacked items count as one

    ReduceEquipmentCount(int, int, EquipmentType)

    Remove equipment count by "delta" (set delta to 1 means remove 1)

    Declaration
    public static void ReduceEquipmentCount(int inventoryID, int delta, EquipmentType type)

    RepositionInventory(int, Int3)

    Reset the map position for the inventory into a new value

    Declaration
    public static void RepositionInventory(int inventoryID, Int3 newMapUnitPosition)

    ResizeInventory(int, int)

    Set capacity of the inventory without changing the content. (items will be clip out if the capacity is not enough to hold)

    Declaration
    public static void ResizeInventory(int inventoryID, int newSize)

    SetEquipment(int, EquipmentType, int, int)

    Set ID of equipment for given inventory

    Declaration
    public static bool SetEquipment(int inventoryID, EquipmentType type, int equipmentID, int equipmentCount)
    EquipmentType type

    Type of the equipment

    int equipmentCount

    Stack count of the equipment

    Returns
    Type Description
    bool

    True if the value successfuly setted

    SetItemAt(int, int, int, int)

    Set item ID at index of the given inventory

    Declaration
    public static void SetItemAt(int inventoryID, int itemIndex, int newItem, int newCount)
    int itemIndex

    Index of the item

    int newItem

    ID of the item

    int newCount

    Count of the item

    TakeItemAt(int, int, int)

    Take "count" items at given index for target inventory

    Declaration
    public static int TakeItemAt(int inventoryID, int itemIndex, int count = 1)
    Returns
    Type Description
    int

    How many items has been taken. 0 means no item taken. "count" means all items taken.

    UnlockAllItemsInside(int)

    Unlock all items inside given inventory for player

    Declaration
    public static void UnlockAllItemsInside(int inventoryID)
    Back to top ๐Ÿ„๐Ÿฆโ€โฌ›๐Ÿงฆ๐Ÿˆ๐ŸŽƒ๐Ÿ’“๐ŸŒนโ˜•๐Ÿดโ€โ˜ ๏ธ๐Ÿค