Vault
🗃️ Vault Class
The base class for inventory and storage systems.
Namespace:
Esper.Inventool
Access:
public
Type:
class
Inherits:
ScriptableObject
📦 Fields
public
navigation
Navigation
The navigation type.
public
isInfinite
bool
If the vault is infinite.
public
currentPage
int
The current page number.
public
pageSize
Vector2Int
The size of each page. This is only relevant if navigation is not set to scrolling and the vault is not infinite.
public
minPageSize
Vector2Int
The minimum size of the page. This is only relevant if navigation is set to scrolling and the vault is infinite.
public
pageSizeRuntime
Vector2Int
The number of pages calculated at runtime.
public
maxPages
int
The max number of pages. This is only relevant if the navigation type is set to pagination and the vault is not infinite.
public
itemStacks
List<ItemStack>
A list of all items stacks in the vault. For the inventory, use SetItems, AddItems, or RemoveItems to change the list instead of editing the list itself. For storage, use the Deposit and Withdraw methods.
public
filteredItemStacks
List<ItemStack>
The item stacks with the active item type filter applied.
public
keyItems
List<ItemStack>
A list of key items separated from the main item stack list. This is only relevant if enableKeyItems is set to true (inventory).
public
currencies
List<Currency>
A list of stored currencies.
public
activeItemTypeFilter
ItemType
The active item type filter.
public
canAcceptItem
Func<ItemStack, bool>
A function that can be used to limit the items that the inventory/storage can accept.
🔧 Properties
public
PageCount
int
The number of pages calculated at runtime.
public
PageSlotCount
int
The total number of slots on a single page.
public
SlotCount
int
The total number of slots.
🧰 Methods
public
GetAllItemsInCurrentPage()
List<ItemStack>
Gets all item stacks with a placement in the current page.
public
GetAllItemsInPage(int page)
List<ItemStack>
Gets all item stacks with a placement in a specific page.
public
CreatePages()
void
Creates all required pages.
public
CanPlaceItem(ItemStack itemStack)
bool
Checks if the item can be placed in the vault. This is filter safe. Returns true if the item can be placed in the vault. Otherwise, false.
public
ApplyFilter()
void
Updates the filtered item stacks list by applying the active item type filter.
public
CalculateRequiredPageSize(List<ItemStack> itemStacks)
Vector2Int
Recalculates the page size required to fit all items. This will only do anything if navigation is set to scrolling and isInfinite is set to true. Returns the page size.
public
CalculateRequiredPages(List<ItemStack> itemStacks)
int
Recalculates the required max pages based on the navigation settings. The max page value will not be changed if it can be set from the Inventool/storage editor. Returns the required pages.
public
PlaceItem(ItemStack itemStack, bool test = false)
bool
Places an item stack in an available spot on the grid. Returns true if the item was successfully placed. Otherwise, false.
public
Reorganize()
void
Reorganizes all items, automatically placing them in pages efficiently.
protected
Degroup(ItemStack itemStack)
List<ItemStack>
Degroups an item stack that has exceeded the max capacity. Returns a list of item stacks created during the degrouping process.
public
Regroup()
void
Regroups item stacks by combining them with others.
public
AddPage()
void
Adds a page.
public
RemovePage()
void
Removes the last page.
public
CalculateSlotWidthAndHeight(float contentWidth)
float
Calculates the width and height of a single slot (used by all slots) with the width of the content container. Returns the value of both the width and height (equal because a single slot is square).
public
SetPage(int page)
void
Sets the page to a specific number.
public
NextPage()
void
Increments the page.
public
PreviousPage()
void
Decrements the page.
public
Contains(int id)
bool
Checks if the vault contains an instance of an item. Returns true if the vault contains the item. Otherwise, false.
public
Contains(string name)
bool
Checks if the vault contains an instance of an item. Returns true if the vault contains the item. Otherwise, false.
public
Contains(Item item)
bool
Checks if the vault contains an instance of an item. Returns true if the vault contains the item. Otherwise, false.
public
Contains(ItemStack itemStack)
bool
Checks if the vault contains a specific item stack. Returns true if the vault contains the item stack. Otherwise, false.
public
SetItemFilter(ItemType itemType)
void
Sets the item type filter.
public
RemoveItemFilter()
void
Removes the current item type filter.
public virtual
DropItem(ItemStack itemStack, int amount = 0, bool useTimeout = true)
void
This will drop a specific amount of an item stack. To make something happen when an item is dropped, use the onItemDropped event.
🧩 Nested Enums
Navigation
Navigation
Supported navigation behaviour types.
None
No navigation.
Scrolling
Enable only scrolling.
Pagination
Enable only pagination.
Both
Enable both scrolling and pagination.
Last updated