Skip to main content

InventoryPlugin.CheckAddItemStack

Declaration#

public virtual void CheckAddItemStack(GDTKItem item, Int32& count, Boolean& cancel)

Parameters#

NameDescription
itemItem to check
countRequested count which can be updated to reflect approved count
cancelSet true if count changes

Description#

Check if added new item stack is allowed

Usage#

using NullSave.GDTK.Inventory;using UnityEngine;
public class Example : MonoBehaviour{
    public void ExampleMethod(Inventory target)    {        int desiredCount = 999;        bool cancel = false;        foreach(InventoryPluginWrapper wrapper in target.plugins)        {            wrapper.plugin.CheckAddItemStack(InventoryDatabase.instance.items[0], ref desiredCount, ref cancel);            if(cancel)            {                Debug.Log("No items added.");                return;            }        }
        Debug.Log("Desired count: 999 :: Allowed Count: " + desiredCount);    }}