GS2-Inventory Master Data Reference

Reference for the master data format and the models to be imported

Master Data Format

{
  "version": "2019-02-05",
  "inventoryModels": [
    {
      "name": "[string]Inventory Model name",
      "metadata": "[string?]Metadata",
      "initialCapacity": "[int]Initial Capacity",
      "maxCapacity": "[int]Maximum Capacity",
      "protectReferencedItem": "[bool?]Protect Referenced Items",
      "itemModels": [
        {
          "itemModelId": "[string]Item Model GRN",
          "name": "[string]Item Model name",
          "metadata": "[string?]Metadata",
          "stackingLimit": "[long]Maximum Stackable Quantity",
          "allowMultipleStacks": "[bool]Allow Multiple Stacks",
          "sortValue": "[int]Display Order"
        }
      ]
    }
  ],
  "simpleInventoryModels": [
    {
      "name": "[string]Simple Inventory Model name",
      "metadata": "[string?]Metadata",
      "simpleItemModels": [
        {
          "itemModelId": "[string]Simple Item Model GRN",
          "name": "[string]Simple Item Model name",
          "metadata": "[string?]Metadata"
        }
      ]
    }
  ],
  "bigInventoryModels": [
    {
      "name": "[string]Big Inventory Model name",
      "metadata": "[string?]Metadata",
      "bigItemModels": [
        {
          "itemModelId": "[string]Big Item Model GRN",
          "name": "[string]Big Item Model name",
          "metadata": "[string?]Metadata"
        }
      ]
    }
  ]
}
Type Condition Required Default Value Limits Description
version string
2019-02-05 Format version of master data
inventoryModels List<InventoryModel> ~ 50 items Inventory Model
Inventory is like a bag that stores items owned by game players.
Inventory can have a set capacity and cannot be owned beyond its capacity.
simpleInventoryModels List<SimpleInventoryModel> ~ 50 items Simple Inventory Model
In a normal InventoryModel, you could limit the amount of items that could be stored in your inventory.
Simple Inventory, however, has no such functionality and simply stores the number of items in the inventory.

However, the Simple Inventory provides APIs that allow increasing or decreasing multiple items in a single operation.
bigInventoryModels List<BigInventoryModel> ~ 50 items Big Inventory Model
In the normal InventoryModel and SimpleInventoryModel, the number of items that can be stored in the inventory is limited to the range of int64.
In inflationary games, you may need a wider range of values.

In the Big Inventory Model, the number of items that can be stored in the inventory can have an integer value of 1024 digits.

Models

InventoryModel

Inventory Model

Inventory is like a bag that stores items owned by game players. Inventory can have a set capacity and cannot be owned beyond its capacity.

Type Condition Required Default Value Limits Description
inventoryModelId string
*
~ 1024 chars Inventory Model GRN
* Set automatically by the server
name string
~ 128 chars Inventory Model name
Inventory Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 2048 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
initialCapacity int
0 ~ 2147483646 Initial Capacity
The number of inventory slots available to a user when the inventory is first created. Each slot can hold one item stack. Users can expand their capacity up to maxCapacity through gameplay actions.
maxCapacity int
0 ~ 2147483646 Maximum Capacity
The upper limit of inventory slots that a user can expand to. Capacity cannot be increased beyond this value. When all slots are occupied and items cannot be stacked further, acquisition attempts will fail unless the overflow script handles the excess.
protectReferencedItem bool? false Protect Referenced Items
When enabled, item sets that have references registered (via the referenceOf mechanism) cannot be consumed or deleted. This prevents items that are in use by other systems (e.g., equipped gear, items bound to formations) from being accidentally removed.
itemModels List<ItemModel> [] 1 ~ 1000 items List of Item Models
The item types that can be stored in this inventory. Each item model defines the stacking and acquisition behavior for one type of item. Up to 1000 item models per inventory model.

ItemModel

Item Model

Items can be held in groups within a single inventory slot, such as Potion ×99. This grouping of multiple items into one slot is called “stacking,” and a maximum stack size can be set for each item.

The behavior when the stack limit is reached can also be set for each item. Specifically, you can choose one of the following:

  • Add a new inventory slot to allow further acquisition
  • Prevent further acquisition once the limit is reached
Type Condition Required Default Value Limits Description
itemModelId string
*
~ 1024 chars Item Model GRN
* Set automatically by the server
name string
~ 128 chars Item Model name
Item Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 2048 chars Metadata
GS2-Enhance features a mechanism that works in conjunction with GS2-Inventory to perform enhancements. It sets the experience value when used as enhancement material in JSON format within the ItemModel metadata.
Details are explained in the Microservices Introduction / GS2-Enhance section.
stackingLimit long
1 ~ 9223372036854775805 Maximum Stackable Quantity
The maximum number of this item that can be held in a single inventory slot (stack). When this limit is reached, the behavior depends on the allowMultipleStacks setting: either a new slot is allocated or further acquisition is blocked.
allowMultipleStacks bool
Allow Multiple Stacks
When enabled, if the stacking limit is reached, a new inventory slot is automatically allocated to store additional quantities of this item (consuming additional capacity). When disabled, acquisition is blocked once the stacking limit is reached in the existing slot.
sortValue int
0 ~ 2147483646 Display Order
A numeric value used to sort items within the inventory for display purposes. Lower values are displayed first. This value is also copied to ItemSet records to enable consistent ordering of possessed items.

SimpleInventoryModel

Simple Inventory Model

In a normal InventoryModel, you could limit the amount of items that could be stored in your inventory. Simple Inventory, however, has no such functionality and simply stores the number of items in the inventory.

However, the Simple Inventory provides APIs that allow increasing or decreasing multiple items in a single operation.

Type Condition Required Default Value Limits Description
inventoryModelId string
*
~ 1024 chars Simple Inventory Model GRN
* Set automatically by the server
name string
~ 128 chars Simple Inventory Model name
Simple Inventory Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 2048 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
simpleItemModels List<SimpleItemModel> [] 1 ~ 1000 items List of Simple Item Models
The item types that can be stored in this simple inventory. Unlike standard inventory, simple items have no stacking limits or capacity constraints. Up to 1000 item models per simple inventory model.

SimpleItemModel

Simple Item Model

ItemModel allowed setting a maximum stackable quantity, enabling implementation where items exceeding a certain number could be split into multiple stacks. SimpleItem does not have such a function and simply stores the number of items in the possession of the item.

Type Condition Required Default Value Limits Description
itemModelId string
*
~ 1024 chars Simple Item Model GRN
* Set automatically by the server
name string
~ 128 chars Simple Item Model name
Simple Item Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 2048 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.

BigInventoryModel

Big Inventory Model

In the normal InventoryModel and SimpleInventoryModel, the number of items that can be stored in the inventory is limited to the range of int64. In inflationary games, you may need a wider range of values.

In the Big Inventory Model, the number of items that can be stored in the inventory can have an integer value of 1024 digits.

Type Condition Required Default Value Limits Description
inventoryModelId string
*
~ 1024 chars Big Inventory Model GRN
* Set automatically by the server
name string
~ 128 chars Big Inventory Model name
Big Inventory Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 2048 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
bigItemModels List<BigItemModel> [] 1 ~ 1000 items List of Big Item Models
The item types that can be stored in this big inventory. Each big item model can hold quantities represented as integer strings up to 1024 digits. Up to 1000 item models per big inventory model.

BigItemModel

Big Item Model

The Big Item Model defines items stored in a Big Inventory Model. Big Items can hold quantities that exceed the range of int64.

Type Condition Required Default Value Limits Description
itemModelId string
*
~ 1024 chars Big Item Model GRN
* Set automatically by the server
name string
~ 128 chars Big Item Model name
Big Item Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 2048 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.