|
Adventure Creator 1.85.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2025
|
Public Member Functions | |||||
| InvCollection (int _maxSlots=0) | |||||
| The default Constructor. | |||||
| InvCollection (List< InvItem > invItems, int _maxSlots=0) | |||||
A Constructor that populates itself with default inventory data</sumary>
| |||||
| InvCollection (List< InvInstance > _invInstances, bool allowEmptySlots=false, int _maxSlots=0) | |||||
| A Constructor that populates itself based on an existing list of inventory item instances. | |||||
| InvCollection (Container container) | |||||
| void | Transfer (int invID, InvCollection fromCollection) | ||||
| Transfer all counts of a given inventory item from another collection. | |||||
| void | Transfer (InvInstance invInstance, InvCollection fromCollection) | ||||
| Transfer all counts of a given inventory item from another collection. | |||||
| void | Transfer (int invID, InvCollection fromCollection, int amount, bool matchPropertiesWhenMerging=true) | ||||
| Transfer a set count of a given inventory item from another collection. | |||||
| void | Transfer (InvInstance invInstance, InvCollection fromCollection, int amount, bool matchPropertiesWhenMerging=true) | ||||
| Transfer a set count of a given inventory item from another collection. | |||||
| void | TransferAll (InvCollection fromCollection) | ||||
| Transfers all items from another collection. | |||||
| InvInstance | Add (InvInstance addInstance, bool matchPropertiesWhenMerging=true) | ||||
| Adds an inventory item instance to the collection. If the item exists in another collection, it will be removed from there automatically. | |||||
| InvInstance | AddToEnd (InvInstance addInstance) | ||||
| Adds an inventory item instance to the end of the collection - or the first-available empty slot. If the item exists in another collection, it will be removed from there automatically. | |||||
| InvInstance | Insert (InvInstance addInstance, int index, OccupiedSlotBehaviour occupiedSlotBehaviour=OccupiedSlotBehaviour.ShiftItems, bool matchPropertiesWhenMerging=true) | ||||
| Inserts an inventory item instance into a specific index in the collection. If the item exists in another collection, it will be removed from there automatically. | |||||
| void | Delete (InvInstance invInstance) | ||||
| Deletes a given inventory item instance, provided it is a part of this collection. | |||||
| void | Delete (InvInstance invInstance, int amount) | ||||
| Deletes a given inventory item instance, provided it is a part of this collection. | |||||
| void | Delete (int itemID, int amount) | ||||
| Deletes a set number of inventory item instances. | |||||
| void | Delete (string itemName, int amount) | ||||
| Deletes a set number of inventory item instances. | |||||
| void | DeleteAtIndex (int index, int amount=-1) | ||||
| Deletes a set number of inventory item instances at a given index. | |||||
| void | DeleteAllOfType (int itemID) | ||||
| Deletes all inventory item instances associated with a given inventory item. | |||||
| void | DeleteAll () | ||||
| void | DeleteAllInCategory (int categoryID) | ||||
| Deletes all item instances in a specific category. | |||||
| void | DeleteRecipeIngredients (Recipe recipe) | ||||
| Deletes all item instances that make up a recipe's ingredients. | |||||
| int | IndexOf (InvInstance invInstance) | ||||
| string | GetSaveData () | ||||
| InvInstance | GetInstanceAtIndex (int index) | ||||
| Gets the inventory item instance in the collection at a given index. | |||||
| int | GetInstanceIndex (InvInstance invInstance) | ||||
| Gets the index that a given Inventory item instance is at in the collection. | |||||
| int | GetCount (int invID, bool includeMultipleInSameSlot=true) | ||||
| Gets the amount of instances in the collection that represent a given inventory item. | |||||
| int | GetCount (string itemName, bool includeMultipleInSameSlot=true) | ||||
| Gets the amount of instances in the collection that represent a given inventory item. | |||||
| int | GetCount (bool includeMultipleInSameSlot=true) | ||||
| Gets the amount of instances in the collection. | |||||
| int | GetCountInCategory (int categoryID, bool includeMultipleInSameSlot=true) | ||||
| Gets the amount of instances in the collection that represent an inventory item in a given category. | |||||
| bool | Contains (InvInstance invInstance) | ||||
| bool | Contains (int invID) | ||||
| InvInstance | GetFirstInstance (int invID) | ||||
| Gets the first-found inventory item instance in the collection that's associated with a specific inventory item. | |||||
| InvInstance | GetFirstInstance (string invName) | ||||
| Gets the first-found inventory item instance in the collection that's associated with a specific inventory item. | |||||
| InvInstance[] | GetAllInstances (int invID) | ||||
| Gets all inventory item instance in the collection that are associated with a specific inventory item. | |||||
| InvInstance[] | GetAllInstances (string invName) | ||||
| Gets all inventory item instance in the collection that are associated with a specific inventory item. | |||||
| int | GetTotalIntProperty (int propertyID) | ||||
| Gets the total value of all instances of an Integer inventory property (e.g. currency) within a set of inventory items. | |||||
| int | GetTotalIntProperty (string propertyName) | ||||
| Gets the total value of all instances of an Integer inventory property (e.g. currency) within a set of inventory items. | |||||
| float | GetTotalFloatProperty (int propertyID) | ||||
| Gets the total value of all instances of an Float inventory property (e.g. weight) within a set of inventory items. | |||||
| float | GetTotalFloatProperty (string propertyName) | ||||
| Gets the total value of all instances of an Float inventory property (e.g. weight) within a set of inventory items. | |||||
| InvVar | GetPropertyTotals (int propertyID) | ||||
| Gets the total amount of given integer or float inventory property, found in the current inventory. | |||||
| InvInstance[] | GetInstancesInCategory (int categoryID) | ||||
| Gets an array of all carried inventory items in a given category. | |||||
| bool | IsPlayerInventory () | ||||
| Container | GetSourceContainer () | ||||
Static Public Member Functions | |
| static List< InvInstance > | DataToInstances (string data) |
| static InvCollection | LoadData (string data, Container container=null) |
Properties | |
| List< InvInstance > | InvInstances [get] |
| List< InvItem > | InvItems [get] |
| int | MaxSlots [get, set] |
This class stores a list of InvInstance (inventory item instances), and has functions to manage them.
| AC.InvCollection.InvCollection | ( | int | _maxSlots = 0 | ) |
The default Constructor.
| maxSlots | If >0, the maximum number of slots |
| AC.InvCollection.InvCollection | ( | List< InvInstance > | _invInstances, |
| bool | allowEmptySlots = false, | ||
| int | _maxSlots = 0 ) |
A Constructor that populates itself based on an existing list of inventory item instances.
| _invInstances | A List of InvInstances that represent the items to be added |
| allowEmptySlots | If True, then invalid or empty entries in the _invInstances List will be included and used to add empty slots, rather than removed |
| maxSlots | If >0, the maximum number of slots |
| AC.InvCollection.InvCollection | ( | Container | container | ) |
A Constructor that populates itself based on a Container's default set of items
| InvInstance AC.InvCollection.Add | ( | InvInstance | addInstance, |
| bool | matchPropertiesWhenMerging = true ) |
Adds an inventory item instance to the collection. If the item exists in another collection, it will be removed from there automatically.
| addInstance | The inventory item instance to add |
| InvInstance AC.InvCollection.AddToEnd | ( | InvInstance | addInstance | ) |
Adds an inventory item instance to the end of the collection - or the first-available empty slot. If the item exists in another collection, it will be removed from there automatically.
| addInstance | The inventory item instance to add |
| bool AC.InvCollection.Contains | ( | int | invID | ) |
Checks if the collection contains an inventory instance associated with a given inventory item
| bool AC.InvCollection.Contains | ( | InvInstance | invInstance | ) |
Checks if the collection contains a given inventory instance
| void AC.InvCollection.Delete | ( | int | itemID, |
| int | amount ) |
Deletes a set number of inventory item instances.
| itemID | The ID of the inventory item to delete |
| amount | The amount to delete |
| void AC.InvCollection.Delete | ( | InvInstance | invInstance | ) |
Deletes a given inventory item instance, provided it is a part of this collection.
| invInstance | The inventory item instance to delete |
| void AC.InvCollection.Delete | ( | InvInstance | invInstance, |
| int | amount ) |
Deletes a given inventory item instance, provided it is a part of this collection.
| invInstance | The inventory item instance to delete |
| amount | The amount to delete |
| void AC.InvCollection.Delete | ( | string | itemName, |
| int | amount ) |
Deletes a set number of inventory item instances.
| itemName | The name of the inventory item to delete |
| amount | The amount to delete |
| void AC.InvCollection.DeleteAll | ( | ) |
Deletes all item instances in the collection
| void AC.InvCollection.DeleteAllInCategory | ( | int | categoryID | ) |
Deletes all item instances in a specific category.
| categoryID | The ID of the category to remove items from |
| void AC.InvCollection.DeleteAllOfType | ( | int | itemID | ) |
Deletes all inventory item instances associated with a given inventory item.
| itemID | The ID of the inventory item to delete |
| void AC.InvCollection.DeleteAtIndex | ( | int | index, |
| int | amount = -1 ) |
Deletes a set number of inventory item instances at a given index.
| index | The index to delete from |
| amount | The amount to delete, if non-negative. Otherwise, all will be deleted |
| void AC.InvCollection.DeleteRecipeIngredients | ( | Recipe | recipe | ) |
Deletes all item instances that make up a recipe's ingredients.
| recipe | The recipe to delete ingredients from |
| InvInstance[] AC.InvCollection.GetAllInstances | ( | int | invID | ) |
Gets all inventory item instance in the collection that are associated with a specific inventory item.
| invID | The ID of the inventory item |
| InvInstance[] AC.InvCollection.GetAllInstances | ( | string | invName | ) |
Gets all inventory item instance in the collection that are associated with a specific inventory item.
| invName | The nameof the inventory item |
| int AC.InvCollection.GetCount | ( | bool | includeMultipleInSameSlot = true | ) |
Gets the amount of instances in the collection.
| includeMultipleInSameSlot | If True, then the result will account for multiple amounts of an item in a single slot |
| int AC.InvCollection.GetCount | ( | int | invID, |
| bool | includeMultipleInSameSlot = true ) |
Gets the amount of instances in the collection that represent a given inventory item.
| invID | The inventory item's ID number |
| includeMultipleInSameSlot | If True, then the result will account for multiple amounts of the item in a single slot |
| int AC.InvCollection.GetCount | ( | string | itemName, |
| bool | includeMultipleInSameSlot = true ) |
Gets the amount of instances in the collection that represent a given inventory item.
| itemName | The inventory item's name |
| includeMultipleInSameSlot | If True, then the result will account for multiple amounts of the item in a single slot |
| int AC.InvCollection.GetCountInCategory | ( | int | categoryID, |
| bool | includeMultipleInSameSlot = true ) |
Gets the amount of instances in the collection that represent an inventory item in a given category.
| categoryID | The category's ID number. |
| includeMultipleInSameSlot | If True, then the result will account for multiple amounts of the item in a single slot |
| InvInstance AC.InvCollection.GetFirstInstance | ( | int | invID | ) |
Gets the first-found inventory item instance in the collection that's associated with a specific inventory item.
| invID | The ID number of the inventory item |
| InvInstance AC.InvCollection.GetFirstInstance | ( | string | invName | ) |
Gets the first-found inventory item instance in the collection that's associated with a specific inventory item.
| invName | The name of the inventory item |
| InvInstance AC.InvCollection.GetInstanceAtIndex | ( | int | index | ) |
Gets the inventory item instance in the collection at a given index.
| index | The index to get |
| int AC.InvCollection.GetInstanceIndex | ( | InvInstance | invInstance | ) |
Gets the index that a given Inventory item instance is at in the collection.
| invInstance | The Inventory item instance to get |
| InvInstance[] AC.InvCollection.GetInstancesInCategory | ( | int | categoryID | ) |
Gets an array of all carried inventory items in a given category.
| categoryID | The ID number of the category in question |
| InvVar AC.InvCollection.GetPropertyTotals | ( | int | propertyID | ) |
Gets the total amount of given integer or float inventory property, found in the current inventory.
| propertyID | The ID of the integer or float inventory property |
| string AC.InvCollection.GetSaveData | ( | ) |
Generates a single string that represents the class's saveable data
| Container AC.InvCollection.GetSourceContainer | ( | ) |
Gets the Container that this collection represents, if appropriate
| float AC.InvCollection.GetTotalFloatProperty | ( | int | propertyID | ) |
Gets the total value of all instances of an Float inventory property (e.g. weight) within a set of inventory items.
| propertyID | The ID number of the Inventory property (see InvVar) to get the total value of |
| float AC.InvCollection.GetTotalFloatProperty | ( | string | propertyName | ) |
Gets the total value of all instances of an Float inventory property (e.g. weight) within a set of inventory items.
| propertyName | The name of the Inventory property (see InvVar) to get the total value of |
| int AC.InvCollection.GetTotalIntProperty | ( | int | propertyID | ) |
Gets the total value of all instances of an Integer inventory property (e.g. currency) within a set of inventory items.
| propertyID | The ID number of the Inventory property (see InvVar) to get the total value of |
| int AC.InvCollection.GetTotalIntProperty | ( | string | propertyName | ) |
Gets the total value of all instances of an Integer inventory property (e.g. currency) within a set of inventory items.
| propertyName | The name of the Inventory property (see InvVar) to get the total value of |
| int AC.InvCollection.IndexOf | ( | InvInstance | invInstance | ) |
Gets the index of a given inventory item instance
| InvInstance AC.InvCollection.Insert | ( | InvInstance | addInstance, |
| int | index, | ||
| OccupiedSlotBehaviour | occupiedSlotBehaviour = OccupiedSlotBehaviour::ShiftItems, | ||
| bool | matchPropertiesWhenMerging = true ) |
Inserts an inventory item instance into a specific index in the collection. If the item exists in another collection, it will be removed from there automatically.
| addInstance | The inventory item instance to add |
| index | The index to insert the item at |
| occupiedSlotBehaviour | How to react if the intended index is already occupied by another item instance. |
| bool AC.InvCollection.IsPlayerInventory | ( | ) |
Checks if this collection represents the player's inventory
|
static |
Create a new class instance based on a serialised data string generated by the GetSaveData function
| void AC.InvCollection.Transfer | ( | int | invID, |
| InvCollection | fromCollection ) |
Transfer all counts of a given inventory item from another collection.
| invID | The ID of the inventory item (InvItem) to transfer |
| fromCollection | The collection to transfer from |
| void AC.InvCollection.Transfer | ( | int | invID, |
| InvCollection | fromCollection, | ||
| int | amount, | ||
| bool | matchPropertiesWhenMerging = true ) |
Transfer a set count of a given inventory item from another collection.
| invID | The ID of the inventory item (InvItem) to transfer |
| fromCollection | The collection to transfer from |
| amount | The amount of items to transfer |
| matchPropertiesWhenMerging | If True, then the property values of two slots that represent the same item must match for them to merge |
| void AC.InvCollection.Transfer | ( | InvInstance | invInstance, |
| InvCollection | fromCollection ) |
Transfer all counts of a given inventory item from another collection.
| invInstance | The instance of the inventory item (InvItem) to transfer |
| fromCollection | The collection to transfer from |
| void AC.InvCollection.Transfer | ( | InvInstance | invInstance, |
| InvCollection | fromCollection, | ||
| int | amount, | ||
| bool | matchPropertiesWhenMerging = true ) |
Transfer a set count of a given inventory item from another collection.
| invInstance | The instance of the inventory item to transfer |
| fromCollection | The collection to transfer from |
| amount | The amount of items to transfer |
| matchPropertiesWhenMerging | If True, then the property values of two slots that represent the same item must match for them to merge |
| void AC.InvCollection.TransferAll | ( | InvCollection | fromCollection | ) |
Transfers all items from another collection.
| fromCollection | The collection of inventory item instances to transfer from |
|
get |
All Inventory item instances in the collection
|
get |
A list of all Inventory Items represented in the collection.
|
getset |
If > 0, the maximum number of slots the collection has to store items