Inventory
ZEPETO.Multiplay.Inventory.Inventory
Inventory manages operations associated with the player's in-World product inventory.
Methods
add
▸ add(productId
, quantity?
, reason?
): Promise
<boolean
>
Adds an in-World product to the player's inventory. Throws InventoryError.
Parameters
Name | Type | Description |
---|---|---|
productId | string | ID of the product to add. |
quantity? | number | Optional Quantity of the product to add. Defaults to 1 . |
reason? | string | Optional Optionally describes the reason for the addition. |
Returns
Promise
<boolean
>
Promise
resolved upon completion, indicating success (true
) or failure (false
).
get
▸ get(productId
): Promise
<InventoryRecord
>
Retrieves an in-World product from the player's inventory. Throws InventoryError.
Parameters
Name | Type | Description |
---|---|---|
productId | string | ID of the product to retrieve. |
Returns
Promise
<InventoryRecord
>
Promise
resolved upon completion, with the retrieved InventoryRecord object.
has
▸ has(productId
): Promise
<boolean
>
Checks the existence of an in-World product in the player's inventory.Throws InventoryError.
Parameters
Name | Type | Description |
---|---|---|
productId | string | ID of the product to check. |
Returns
Promise
<boolean
>
Promise
resolved upon completion, indicating exist (true
) or non-exist (false
).
list
▸ list(): Promise
<InventoryRecord
[]>
Retrieves all in-World products from the player's inventory. Throws InventoryError.
Returns
Promise
<InventoryRecord
[]>
Promise
resolved upon completion, with an array of the retrieved InventoryRecord objects.
madd
▸ madd(products
): Promise
<boolean
>
Adds multiple in-World products to the player's inventory. Throws InventoryError.
Parameters
Name | Type | Description |
---|---|---|
products | { }[] | Array of products to add. |
Returns
Promise
<boolean
>
Promise
resolved upon completion, indicating success (true
) or failure (false
).
remove
▸ remove(productId
): Promise
<boolean
>
Removes an in-World product from the player's inventory. Throws InventoryError.
Parameters
Name | Type | Description |
---|---|---|
productId | string | ID of the product to remove. |
Returns
Promise
<boolean
>
Promise
resolved upon completion, indicating success (true
) or failure (false
).
use
▸ use(productId
, quantity?
, reason?
): Promise
<boolean
>
Uses an in-World product from the player's inventory. Throws InventoryError.
Parameters
Name | Type | Description |
---|---|---|
productId | string | ID of the product to use. |
quantity? | number | Optional Quantity of the product to use. Defaults to 1 . |
reason? | string | Optional Optionally describes the reason for usage. |
Returns
Promise
<boolean
>
Promise
resolved upon completion, indicating success (true
) or failure (false
).