QI_Inventory

QI_Inventory stores a list of item stacks and represents an inventory, such as a backpack.

public string Name The name of the inventory, such as Main or Backpack.
public List<QI_ItemStack> Stacks The list of item stacks .
public Dictionary<string, int> Stock The dictionary used to find how much there is of an item.
public int MaxStacks The maximum number of stacks. Setting this to 0 means unlimited stacks.

Returns how much of an item there is.

string name The name of the item.
int stock = inventoryReference.GetStock("Sword");

Attempts to add an item to an existing stack, but otherwise creates a new stack.

QI_ItemData item The item to add.
int amount The amount to add.
inventoryReference.AddItem(swordReference, 1);

Attempts to remove an item from an existing stack, removing the stack if empty.

string name The name of the item to remove.
int amount The amount to remove.
inventoryReference.RemoveItem(swordReference, 1);

QI_ItemData

QI_ItemData stores data about an item.

public string Name The name of the item.
public string Description The description of the item.
public float Weight The weight of the item.
public float Price The price of the item.
public Sprite Icon The icon of the item.
public Transform ItemPrefab The prefab of the item for instantiating into the game world. This should have a QI_Item script on it.
public int MaxStack The maximum amount of the item in one stack.

QI_ItemDatabase

QI_ItemDatabase stores a list of item data.

public List<QI_ItemData> Items The list of items in this database.

Returns an item by the given name.

string name The name of the item.
QI_ItemData itemData = itemDBReference.GetItem("Sword");

QI_ItemStack

QI_ItemStack represents one stack of items in an inventory.

public QI_ItemData Item The item this stack is referencing.
public int Amount How much of this item there is.

QI_Item

QI_Item represents a single item in the game world, such as a sword or healing potion.

public QI_ItemData Data The data that this item represents.

QI_CraftingHandler

QI_CraftingHandler manages crafting queues of items waiting to be crafted.

public QI_Inventory Inventory The inventory that the items will go into when they are done crafting.
public QI_CraftingType Type How the items are crafted, either in order (consecutive), or all at the same time (simultaneous).
public List<QI_CraftingQueue> Queues The list of recipes queued for crafting.
public UnityEvent OnCrafted The event that is invoked when an item is done crafting.

Adds a queue to the list of items to craft, from the given recipe. Returns if it was able to craft, based on available materials. Also removes those materials.

QI_CraftingRecipe recipe The recipe to craft.
int amount How many times to craft this recipe.
handlerReference.Craft(recipeReference, 1);

QI_CraftingRecipe

QI_CraftingRecipe represents a list of crafting ingredients for making an item.

public string Name The name of the recipe/item.
public List<QI_CraftingIngredient> Ingredients The list of ingredients and amounts needed to craft the item.
public QI_CraftingIngredient Product The product item and how much to be made.
public float CraftingTime How long it takes to craft the item, in seconds.

QI_CraftingRecipeDatabase

QI_CraftingRecipeDatabase stores a list of crafting recipes.

public List<QI_CraftingRecipe> CraftingRecipes The list of crafting recipes in this database.

Returns a crafting recipe by the given name.

string name The name of the recipe.
QI_CraftingRecipe recipe = databaseReference.GetCraftingRecipe("Sword");

QI_CraftingIngredient

QI_CraftingIngredient represents a certain amount of an item in a crafting recipe.

public QI_ItemData Item The item needed.
public int Amount How much of the item is required.

QI_CraftingQueue

QI_CraftingQueue represent how long is left on crafting an item.

public QI_ItemData Item The item that is being crafted.
public int Amount How much of the item is being crafted.
public float Timer How much longer in seconds before the item is done.

QI_Vendor

QI_Vendor handles everything that a vendor would need: currency, items, and the ability to exchange between them.

public QI_Inventory Inventory The vendor's inventory, used in transactions.
public Dictionary<string, QI_CurrencyStash> Currencies The list of currencies used by the vendor, and how much they have.

Completes a transaction between a buyer and a seller.

QI_Vendor buyer The character buying the items.
QI_Vendor seller The character selling the items.
QI_ItemData item The item to buy.
string currencyName The name of the currency needed.
int amount The amount to buy.
bool transactionSuccessfull = QI_Vendor.Transaction(buyerReference, sellerReference, itemReference, "Coin", 1);

Returns if there is enough curreny for the vendor to buy the given item.

string currencyName The name of the currency required.
float itemCost The cost of the item.
int amount The amount to buy.
bool canBuy = buyerReference.CanBuy("Coin", 5, 1);

Returns if there is enough of an item for the vendor to sell.

string itemName The name of the item.
int amount The amount to sell.
bool canSell = sellerReference.CanSell("Sword", 1);

Returns how much of a currency the vendor has.

string name The name of the currency.
float currencyAmount = vendorReference.GetCurrency("Coin");

Adds currency to a stash, adding a new stash if it doesn't exist. Other overloads include: public void AddCurrency(QI_Currency currency), public void AddCurrency(string name, float amount)

QI_Currency currency The currency to add.
float amount The amount to add.
vendorReference.AddCurrency(coinReference, 1);

Removes currency from a stash. Other overloads include: public void RemoveCurrency(string name)

string name The name of the currency.
float amount The amount to remove.
vendorReference.RemoveCurrency("Coin", 1);

QI_Currency

QI_Currency represents any form of currency in the game.

public string Name The name of the currency.
public string Description The description of the currency.
public Sprite Icon The icon of the currency.

QI_CurrencyDatabase

QI_CurrencyDatabase stores a list of currencies.

public List<QI_Currency> Currencies The list of currencies in this database.

Returns a currency by the given name.

string name The name of the currency.
QI_Currency currency = databaseReference.GetCurrency("Coin");

QI_CurrencyStash

QI_CurrencyStash represents a certain amount of currency.

public QI_Currency Currency The currency being represented by the stash.
public float Amount How much of the currency is in the stash.