Inventory #

Read more about the Inventory system in Hiro here.

List items #

List all inventory items defined in the codex, optionally filtered by category.

1
2
3
4
5
const request = new InventoryListRequest();
request.item_category = "weapons";

const inventoryList = await hiroClient.inventoryList(session, request);
console.log(inventoryList);

List user inventory items #

List all inventory items owned by the player, optionally filtered by category.

1
2
3
4
5
const request = new InventoryListRequest();
request.item_category = "weapons";

const inventoryList = await hiroClient.inventoryListInventory(session, request);
console.log(inventoryList);

Consume inventory items #

Consume one or more inventory items owned by the player.

1
2
3
4
5
6
7
const request = new InventoryConsumeRequest();
request.items = {
    "health_potion": "1"
};

const consumeRewards = hiroClient.inventoryConsume(session, request);
console.log(consumeRewards);

Grant inventory items #

Grant one or more inventory items to the player.

1
2
3
4
5
6
7
const request = new InventoryGrantRequest();
request.items = {
    "bronze_sword": "1"
};

const grantRewards = await hiroClient.inventoryGrant(session, request);
console.log(grantRewards);

Update inventory items #

Update the properties on one or more inventory items owned by the player.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
const request = new InventoryUpdateItemsRequest();
request.item_updates = {
    "bronze_sword": {
        string_properties: {
            "example_property": "example_value"
        },
        numeric_properties: {
            "numeric_properties": 10
        }
    }
};

const updateAck = await hiroClient.inventoryUpdate(session, request);
console.log(updateAck);