Inventool Documentation
  • Inventool Documentation
  • đŸ•šī¸Quick Start
    • Installation
    • Start Creating
  • 💡General
    • Running the Demo
    • Menu Options
    • UI Updates
    • UI Customizations
      • uGUI
      • UI Toolkit
    • Custom Item Drops
  • 🎓Tutorials
    • Demo Walkthrough
  • âœī¸Editors
    • Inventool
      • Inventory
      • Equipment
      • Items
      • Currencies
      • Crafting
      • Dismantling
      • Enchanting
      • Stats
        • Stat IDs
        • Attributes
      • Settings
    • Item Type Manager
    • Localization Editor
    • Stats Editor
    • Merchants
      • Shopkeeper
      • Craftsman
      • Enchanter
    • Storage
    • Loot
      • Loot Box
      • Item Pouch
      • Currency Pouch
    • Components
      • Initializer
      • UI
        • uGUI
          • Inventool Window
          • Split UI
            • Inventory Window UGUI
            • Equipment Window UGUI
            • Key Items Window UGUI
            • Crafting Window UGUI
            • Enchanting Window UGUI
            • Storage Window UGUI
            • Shop Window UGUI
            • Selector UGUI
          • Action Menu UGUI
          • Hover Details UGUI
          • Confirm Prompt UGUI
          • Quantity Prompt UGUI
          • Character Viewer Element UGUI
        • UI Toolkit
          • Inventool Window
          • Split UI
            • Inventory Window
            • Equipment Window
            • Key Items Window
            • Crafting Window
            • Enchanting Window
            • Storage Window
            • Shop Window
          • Action Menu
          • Hover Details
          • Confirm Prompt
          • Quantity Prompt
        • Character Viewer
      • Overworld Merchant
      • Storage Keeper
      • Item Drop
      • Item Spawner
      • Input
        • Cross Input Support
        • Cross Input Support UGUI
          • Target Selectable
  • 📄Scripting API
    • Initialization
    • Inventory
    • Equipment
      • Equipment Slot
    • Items
      • Item
      • Item Type
      • Item Stack
      • Item Drop
      • Item Spawner
      • Loot Box
      • Item Pouch
    • Currencies
      • Currency Identity
      • Currency
        • Value
      • Currency Pouch
    • Crafting
      • Craft
      • Crafter
    • Enchanting
      • Enchantment
    • Stats
      • Stat Identity
      • Attribute
      • Stat
        • Stat Value
          • Value
        • Effectiveness
      • Stat Profile
    • Storing
      • Storage
      • Storage Keeper
    • Settings
    • Merchants
      • Shopkeeper
      • Craftsman
      • Enchanter
      • Overworld Merchant
    • UI
      • uGUI
        • Inventool Window UGUI
        • Split UI
          • Draggable Window UGUI
            • Inventory Window UGUI
            • Equipment Window UGUI
            • Key Items Window UGUI
            • Crafting Window UGUI
            • Enchanting Window UGUI
            • Storage Window UGUI
            • Shop Window UGUI
          • Selector UGUI
        • Action Menu UGUI
        • Hover Details UGUI
        • Confirm Prompt UGUI
        • Quantity Prompt UGUI
        • Draggable Element UGUI
          • Equipment Slot Element UGUI
          • Item Slot Element UGUI
          • Item Stack Element UGUI
        • Action Menu Option UGUI
        • Currency Element UGUI
        • Inventory Filter UGUI
        • Inventory Slot UGUI
        • Key Item Element UGUI
        • Shop Item Element UGUI
        • Storage Currency Element UGUI
        • Stat Element UGUI
      • UI Toolkit
        • Inventool Window
        • Split UI
          • Draggable Window
            • Inventory Window
            • Equipment Window
            • Key Items Window
            • Crafting Window
            • Enchanting Window
            • Storage Window
            • Shop Window
        • Action Menu
        • Hover Details
        • Confirm Prompt
        • Quantity Prompt
        • Item Elements
          • Item Stack Element
          • Equipment Slot Element
          • Item Slot Element
          • Shop Item Element
      • Action Menu Option
      • Character Viewer
    • Events
    • Sounds
    • Saving & Loading
      • Inventory & Equipment
      • Storage
    • Input
      • Cross Input Support
      • Cross Input Support UGUI
    • Localization
      • Localization Settings
      • Localizer
  • đŸ› ī¸Support
    • Getting Help
  • 📚Changelogs
    • Latest Releases
    • Future Plans
  • ⭐Rate Me?
Powered by GitBook
On this page
  • Fields & Properties
  • Items
  • Setting Items
  • Depositing Items
  • Remove Items
  • Getting Items
  • Checking Items
  • Drop Items
  • Currencies
  • Depositing a Currency
  • Withdrawing a Currency
  • Resetting
  • Pages & Organization
  • Reorganization
  • Filters
  • Page Sizes
  • Pagination
  • Customize Accepted Items
  1. Scripting API
  2. Storing

Storage

Scripting with the Storage class.

Fields & Properties

Name
Description
Type
Access

navigation

The navigation type.

Navigation

public

isInfinite

If the vault is infinite.

bool

public

pages

A list of grid pages.

List<Grid>

private

currentPage

The current page number.

int

public

pageSize

The size of each page. This is only relevant if navigation is not set to scrolling and the vault is not infinite.

Vector2Int

public

minPageSize

The minimum size of the page. This is only relevant if navigation is set to scrolling and the vault is infinite.

Vector2Int

public

pageSizeRuntime

The number of pages calculated at runtime.

Vector2Int

public

maxPages

The max number of pages. This is only relevant if the navigation type is set to pagination and the vault is not infinite.

int

public

itemStacks

A list of all items stacks in the vault. For storage, use the Deposit and Withdraw methods to change the list instead of editing the list itself.

List<ItemStack>

public

filteredItemStacks

The item stacks with the active item type filter applied.

List<ItemStack>

public

currencies

A list of stored currencies.

List<Currency>

public

activeItemTypeFilter

The active item type filter.

ItemType

public

canAcceptItem

A function that can be used to limit the items that the storage can accept.

Func<ItemStack, bool>

public

PageCount

The number of pages calculated at runtime.

int

public

PageSlotCount

The total number of slots on a single page.

int

public

SlotCount

The total number of slots.

int

public

id

The storage ID.

string

public

AllowItemDropping

If item dropping should be allowed. Taken from the inventory.

bool

public

ShowSubtypes

If item subtypes should be displayed in the storage filter list. Taken from the inventory.

bool

public

DeleteItemsOnDrop

If the item should be deleted on drop. Taken from the inventory.

bool

public

NoFilterIcon

The icon of the no filter button. Taken from the inventory.

Sprite

public

NoFilterIconColorTint

The color tint of the no filter icon. Taken from the inventory.

Color

public

Items

Setting Items

You can set items with the SetItems method. This will remove all previous items in the inventory.

myStorage.SetItems(myItemStackList);

Depositing Items

With the Deposit method, you can add a single or a list of item stacks to the storage. This will remove the item(s) from the inventory.

myStorage.Deposit(myItemStack);

Remove Items

With the Withdraw method, you can remove a single or a list of item stacks from the storage. This will add the item(s) to the inventory.

myStorage.Withdraw(myItemStack);

Getting Items

You can get the full list of items with the itemStacks and keyItems fields.

Get All Items in a Specific Page

// Get item stacks in the first page (page numbers start at 0)
var itemStacks = myStorage.GetAllItemsInPage(0);

Get All Items in the Current Page

var itemStacks = myStorage.GetAllItemsInCurrentPage();

Checking If An Item Can Fit

You can check if an item will fit in the storage with the HasSpaceForItem method.

bool result = Inventool.Inventory.HasSpaceForItem(myItem);

Checking Items

You can use the Contains method to check and see if the player has an instance of an item in their storage. You can use an Item object, the item ID, or the item name to perform this check.

// Check if the player has an item called 'Door Key'
bool result = myStorage.Contains("Door Key");

Drop Items

To drop a specific item (remove it from the storage), use the DropItem method. This may create an instance of an Item Drop in the game world.

myStorage.DropItem(itemStackToDrop);

Currencies

In the examples below, amount is a Currency. You can access the full list of currencies with the myStorage.currencies field.

Depositing a Currency

A currency can be deposited with the Deposit method.

myStorage.Deposit(myCurrency);

Withdrawing a Currency

A currency can be withdrawn from the storage with the Withdraw method.

myStorage.Withdraw(myCurrency);

Resetting

You can reset all currencies to their starting values with the ResetCurrencies method.

myStorage.ResetCurrencies();

Pages & Organization

Storage items are organized in grid-based pages. Whether your inventory 1 page or 100, the logic is the same.

Reorganization

You can reorganize the storage with the Reorganize method. This will also recreate all pages.

myStorage.Reorganize();

If you'd only like to regroup item stacks, use the Regroup method.

myStorage.Regroup();

Filters

Storage items can be filtered with Item Type. Items that don't match the filter will not be returned when using the GetAllItemsInPage or GetAllItemsInCurrentPage methods. If the ItemType is a parent, items with the parent type or any of it's child types will not be filtered out.

Set the Item Filter

myStorage.SetItemFilter(ItemType);

Remove Item Filter

myStorage.RemoveItemFilter();

Page Sizes

Setting the Size

You can set the page size by editing the minPageSize or pageSize fields. When these are changed, the storage may need to be reorganized.

// 6x6 inventory grid
myStorage.pageSize = new Vector2Int(6, 6);
myStorage.Reorganize();

Pagination

Current Page

The current page number is stored in the currentPage field.

You can flip to the next page with the NextPage method.

myStorage.NextPage();

Similarly, you can flip to the previous page with PreviousPage method.

myStorage.PreviousPage();

Alternatively, you can set the current page (page numbers start at 0).

myStorage.SetPage(0);

Customize Accepted Items

You can customize the items accepted with the canAcceptItem function.

Example

myStorage.canAcceptItem = itemStack =>
{
    if (itemStack.item.itemType.displayName == "My Item Type")
    {
        return true;
    }

    return false;
};
PreviousStoringNextStorage Keeper

Last updated 19 days ago

📄