Endstar LUA API Documentation
Loading...
Searching...
No Matches
Inventory Class Reference

Public Member Functions

List< InventoryItemDescription > GetItems ()
 Gets a list of InventoryItemDescriptions.
 
void SetInventorySize (int size)
 Sets the size of the player's inventory. Players will drop excess items.
 
bool ContainsItem (InventoryLibraryReference inventoryLibraryReference)
 Checks if the player's inventory contains the item.
 
bool ContainsQuantity (InventoryLibraryReference inventoryLibraryReference, int quantity)
 Checks if the player's inventory contains the quantity of the item.
 
int GetQuantity (InventoryLibraryReference inventoryLibraryReference)
 Gets the quantity of the provided item in the player's inventory.
 
bool TryAddItem (InventoryLibraryReference item)
 Tries to add the item to the player's inventory.
 
bool TryAddItem (InventoryLibraryReference item, int quantity)
 Tries to add the item to the player's inventory.
 
bool TryAddItem (InventoryLibraryReference item, bool lockItem)
 Tries to add the item to the player's inventory.
 
bool TryAddItem (InventoryLibraryReference item, bool lockItem, int quantity)
 Tries to add the item to the player's inventory.
 
bool TryRemoveItem (InventoryLibraryReference item)
 Tries to remove the item from the player's inventory.
 
bool TryRemoveItem (InventoryLibraryReference item, int quantity)
 Tries to remove the item from the player's inventory.
 
void RemoveAll (InventoryLibraryReference item)
 Removes all of an item from the player's inventory.
 
void RemoveAllItems (bool includeLockedItems)
 Removes all equippable items from the player's inventory.
 
void RemoveAllResources ()
 Removes all resources from the player.
 

Member Function Documentation

◆ ContainsItem()

bool ContainsItem ( InventoryLibraryReference inventoryLibraryReference)

Checks if the player's inventory contains the item.

Parameters
inventoryLibraryReferenceThe item to check for.
Returns
True if the player's inventory contains the item, false otherwise.

◆ ContainsQuantity()

bool ContainsQuantity ( InventoryLibraryReference inventoryLibraryReference,
int quantity )

Checks if the player's inventory contains the quantity of the item.

Parameters
inventoryLibraryReferenceThe item to check.
quantityThe quantity to check for.
Returns
True if the player's inventory contains the quantity of the item.

◆ GetItems()

List< InventoryItemDescription > GetItems ( )

Gets a list of InventoryItemDescriptions.

Returns
A list of InventoryItemDescriptions.

◆ GetQuantity()

int GetQuantity ( InventoryLibraryReference inventoryLibraryReference)

Gets the quantity of the provided item in the player's inventory.

Parameters
inventoryLibraryReferenceThe item to get the quantity for.
Returns
The quantity of the item in the player's inventory.

◆ RemoveAll()

void RemoveAll ( InventoryLibraryReference item)

Removes all of an item from the player's inventory.

Parameters
itemThe item to remove.

◆ RemoveAllItems()

void RemoveAllItems ( bool includeLockedItems)

Removes all equippable items from the player's inventory.

Parameters
includeLockedItems

◆ RemoveAllResources()

void RemoveAllResources ( )

Removes all resources from the player.

◆ SetInventorySize()

void SetInventorySize ( int size)

Sets the size of the player's inventory. Players will drop excess items.

Parameters
sizeThe new size of the player's inventory.

◆ TryAddItem() [1/4]

bool TryAddItem ( InventoryLibraryReference item)

Tries to add the item to the player's inventory.

Parameters
itemThe item to add to the player's inventory.
Returns
True if the item was successfully added to the player's inventory.

◆ TryAddItem() [2/4]

bool TryAddItem ( InventoryLibraryReference item,
bool lockItem )

Tries to add the item to the player's inventory.

Parameters
itemThe item to add to the player's inventory.
lockItemShould the item be locked after adding it.
Returns
True if the item was successfully added to the player's inventory.

◆ TryAddItem() [3/4]

bool TryAddItem ( InventoryLibraryReference item,
bool lockItem,
int quantity )

Tries to add the item to the player's inventory.

Parameters
itemThe item to add to the player's inventory.
lockItemShould the item be locked after adding it.
quantityThe quantity of the item to add.
Returns
True if the item was successfully added to the player's inventory.

◆ TryAddItem() [4/4]

bool TryAddItem ( InventoryLibraryReference item,
int quantity )

Tries to add the item to the player's inventory.

Parameters
itemThe item to add to the player's inventory.
quantityThe quantity of the item to add.
Returns
True if the items were successfully added to the player's inventory.

◆ TryRemoveItem() [1/2]

bool TryRemoveItem ( InventoryLibraryReference item)

Tries to remove the item from the player's inventory.

Parameters
itemThe item to remove.
Returns
True if the item was successfully removed.

◆ TryRemoveItem() [2/2]

bool TryRemoveItem ( InventoryLibraryReference item,
int quantity )

Tries to remove the item from the player's inventory.

Parameters
itemThe item to remove.
quantityThe quantity of items to remove.
Returns
True if the item was successfully removed.