Trigger Reference of GS2-Inventory Script
Trigger
acquire
Item is acquired
Synchronous Execution Script
Script and Item is acquired are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventory | Inventory | Inventory |
| itemSets | ItemSet[] | List of Quantity of items held per expiration date |
| acquireItemName | string | Name of item model acquired |
| userId | string | User ID |
| acquireCount | long | Quantity acquired |
| expiresAt | long | Expiration date |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow item acquisition | ||
| overrideAcquireCount | int | 0 ~ 2147483645 | Actual amount obtained to be applied |
Implementation Example
namespace = args.namespace
inventory = args.inventory
itemSets = args.itemSets
acquireItemName = args.acquireItemName
userId = args.userId
acquireCount = args.acquireCount
expiresAt = args.expiresAt
result = {
permit=permit,
overrideAcquireCount=overrideAcquireCount
}Asynchronous Execution Script
The script will run after the Item is acquired is executed.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| oldInventory | Inventory | Inventory before update |
| oldItemSets | ItemSet[] | List of Quantity of items held per expiration date before renewal |
| newInventory | Inventory | Inventory after update |
| newItemSets | ItemSet[] | List of Quantity of items held per renewal expiration date |
| acquireItemName | string | Name of item model acquired |
| userId | string | User ID |
| acquireCount | long | Quantity acquired |
| overflowValue | long | Amount of overflow |
| expiresAt | long | Expiration date |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
oldInventory = args.oldInventory
oldItemSets = args.oldItemSets
newInventory = args.newInventory
newItemSets = args.newItemSets
acquireItemName = args.acquireItemName
userId = args.userId
acquireCount = args.acquireCount
overflowValue = args.overflowValue
expiresAt = args.expiresAt
result = {
}overflowDone
the number of items hits the acquisition limit and notification of the quantity not obtained is completed
Synchronous Execution Script
Script and the number of items hits the acquisition limit and notification of the quantity not obtained is completed are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventory | Inventory | Inventory |
| itemModel | ItemModel | Item Model |
| userId | string | User ID |
| overflowValue | long | Amount of overflow |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
inventory = args.inventory
itemModel = args.itemModel
userId = args.userId
overflowValue = args.overflowValue
result = {
}consume
Item is consumed
Synchronous Execution Script
Script and Item is consumed are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventory | Inventory | Inventory |
| itemSets | ItemSet[] | List of Quantity of items held per expiration date |
| consumeItemName | string | Name of item model consumed |
| userId | string | User ID |
| consumeCount | long | Quantity consumed |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow item consumption | ||
| overrideConsumeCount | int | 0 ~ 2147483645 | Actual consumption to be applied |
Implementation Example
namespace = args.namespace
inventory = args.inventory
itemSets = args.itemSets
consumeItemName = args.consumeItemName
userId = args.userId
consumeCount = args.consumeCount
result = {
permit=permit,
overrideConsumeCount=overrideConsumeCount
}Asynchronous Execution Script
The script will run after the Item is consumed is executed.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| oldInventory | Inventory | Inventory before consumption |
| oldItemSets | ItemSet[] | List of Quantity of items held per expiration date before consumption |
| newInventory | Inventory | Inventory after consumption |
| newItemSets | ItemSet[] | List of Quantity of items held per post-consumption expiration date |
| consumeItemName | string | Name of item model consumed |
| userId | string | User ID |
| consumeCount | long | Quantity consumed |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
oldInventory = args.oldInventory
oldItemSets = args.oldItemSets
newInventory = args.newInventory
newItemSets = args.newItemSets
consumeItemName = args.consumeItemName
userId = args.userId
consumeCount = args.consumeCount
result = {
}simpleItemAcquire
Simple item is acquired
Synchronous Execution Script
Script and Simple item is acquired are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Simple Inventory Model Name |
| simpleItems | SimpleItem[] | List of Quantity of items held per expiration date |
| userId | string | User ID |
| acquireCounts | AcquireCount[] | List of quantity of items to be obtained |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow item acquisition | ||
| overrideAcquireCounts | AcquireCount[] | 0 ~ 100 items | List of quantity of items to be obtained |
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
simpleItems = args.simpleItems
userId = args.userId
acquireCounts = args.acquireCounts
result = {
permit=permit,
overrideAcquireCounts=overrideAcquireCounts
}Asynchronous Execution Script
The script will run after the Simple item is acquired is executed.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Simple Inventory Model Name |
| oldSimpleItems | SimpleItem[] | List of Quantity of items held per expiration date |
| newSimpleItems | SimpleItem[] | List of Quantity of items held per expiration date |
| userId | string | User ID |
| acquireCounts | AcquireCount[] | List of quantity of items to be obtained |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
oldSimpleItems = args.oldSimpleItems
newSimpleItems = args.newSimpleItems
userId = args.userId
acquireCounts = args.acquireCounts
result = {
}simpleItemConsume
Simple item is consumed
Synchronous Execution Script
Script and Simple item is consumed are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Simple Inventory Model Name |
| simpleItems | SimpleItem[] | List of Simple Item |
| userId | string | User ID |
| consumeCounts | ConsumeCount[] | List of quantity of items to be consumed |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow item consumption | ||
| overrideConsumeCounts | ConsumeCount[] | 0 ~ 100 items | List of quantity of items to be consumed |
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
simpleItems = args.simpleItems
userId = args.userId
consumeCounts = args.consumeCounts
result = {
permit=permit,
overrideConsumeCounts=overrideConsumeCounts
}Asynchronous Execution Script
The script will run after the Simple item is consumed is executed.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Simple Inventory Model Name |
| oldSimpleItems | SimpleItem[] | List of Before update Simple Item |
| newSimpleItems | SimpleItem[] | List of After update Simple Item |
| userId | string | User ID |
| consumeCounts | ConsumeCount[] | List of quantity of items to be consumed |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
oldSimpleItems = args.oldSimpleItems
newSimpleItems = args.newSimpleItems
userId = args.userId
consumeCounts = args.consumeCounts
result = {
}bigItemAcquire
Big item is consumed
Synchronous Execution Script
Script and Big item is consumed are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Big Inventory Model Name |
| itemName | string | Big Item Model Name |
| item | BigItem | Simple Item |
| userId | string | User ID |
| acquireCount | string | List of quantity of items to be obtained |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow item acquisition | ||
| rate | float | 1.0 | 0 ~ 1000 | Acquisition quantity rate |
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
itemName = args.itemName
item = args.item
userId = args.userId
acquireCount = args.acquireCount
result = {
permit=permit,
rate=rate
}Asynchronous Execution Script
The script will run after the Big item is consumed is executed.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Big Inventory Model Name |
| itemName | string | Big Item Model Name |
| oldItem | BigItem | Before update Simple Item |
| newItem | BigItem | After update Simple Item |
| userId | string | User ID |
| acquireCount | string | List of quantity of items to be obtained |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
itemName = args.itemName
oldItem = args.oldItem
newItem = args.newItem
userId = args.userId
acquireCount = args.acquireCount
result = {
}bigItemConsume
Big item is consumed
Synchronous Execution Script
Script and Big item is consumed are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Big Inventory Model Name |
| itemName | string | Big Item Model Name |
| item | BigItem | Simple Item |
| userId | string | User ID |
| consumeCount | string | List of quantity of items to be consumed |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow item consumption | ||
| rate | float | 1.0 | 0 ~ 1000 | Consume quantity rate |
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
itemName = args.itemName
item = args.item
userId = args.userId
consumeCount = args.consumeCount
result = {
permit=permit,
rate=rate
}Asynchronous Execution Script
The script will run after the Big item is consumed is executed.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Big Inventory Model Name |
| itemName | string | Big Item Model Name |
| oldItem | BigItem | Before update Simple Item |
| newItem | BigItem | After update Simple Item |
| userId | string | User ID |
| consumeCount | string | List of quantity of items to be consumed |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
itemName = args.itemName
oldItem = args.oldItem
newItem = args.newItem
userId = args.userId
consumeCount = args.consumeCount
result = {
}