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"
        }
      ]
    }
  ]
}
TypeConditionRequiredDefaultValue LimitsDescription
versionstring
2019-02-05Format version of master data
inventoryModelsList<InventoryModel>~ 50 itemsInventory 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.
simpleInventoryModelsList<SimpleInventoryModel>~ 50 itemsSimple 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.
bigInventoryModelsList<BigInventoryModel>~ 50 itemsBig 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.

Model

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.

TypeConditionRequiredDefaultValue LimitsDescription
inventoryModelIdstring
*
~ 1024 charsInventory Model GRN
* Set automatically by the server
namestring
~ 128 charsInventory Model name
Inventory Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 2048 charsMetadata
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.
initialCapacityint
0 ~ 2147483646Initial 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.
maxCapacityint
0 ~ 2147483646Maximum 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.
protectReferencedItembool?falseProtect 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.
itemModelsList<ItemModel>[]1 ~ 1000 itemsList 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
TypeConditionRequiredDefaultValue LimitsDescription
itemModelIdstring
*
~ 1024 charsItem Model GRN
* Set automatically by the server
namestring
~ 128 charsItem Model name
Item Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 2048 charsMetadata
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.
stackingLimitlong
1 ~ 9223372036854775805Maximum 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.
allowMultipleStacksbool
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.
sortValueint
0 ~ 2147483646Display 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.

TypeConditionRequiredDefaultValue LimitsDescription
inventoryModelIdstring
*
~ 1024 charsSimple Inventory Model GRN
* Set automatically by the server
namestring
~ 128 charsSimple Inventory Model name
Simple Inventory Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 2048 charsMetadata
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.
simpleItemModelsList<SimpleItemModel>[]1 ~ 1000 itemsList 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.

TypeConditionRequiredDefaultValue LimitsDescription
itemModelIdstring
*
~ 1024 charsSimple Item Model GRN
* Set automatically by the server
namestring
~ 128 charsSimple Item Model name
Simple Item Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 2048 charsMetadata
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.

TypeConditionRequiredDefaultValue LimitsDescription
inventoryModelIdstring
*
~ 1024 charsBig Inventory Model GRN
* Set automatically by the server
namestring
~ 128 charsBig Inventory Model name
Big Inventory Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 2048 charsMetadata
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.
bigItemModelsList<BigItemModel>[]1 ~ 1000 itemsList 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.

TypeConditionRequiredDefaultValue LimitsDescription
itemModelIdstring
*
~ 1024 charsBig Item Model GRN
* Set automatically by the server
namestring
~ 128 charsBig Item Model name
Big Item Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 2048 charsMetadata
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.