Script Trigger Reference of GS2-Inventory
Trigger
acquire
Item acquisition
Synchronous Execution Script
The script is executed synchronously before the item acquisition process.
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 Unix time, milliseconds |
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 executes asynchronously after the Item acquisition.
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 Unix time, milliseconds |
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
The script is executed synchronously before the the number of items hits the acquisition limit and notification of the quantity not obtained is completed process.
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 consumption
Synchronous Execution Script
The script is executed synchronously before the item consumption process.
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 executes asynchronously after the item consumption.
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 |
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 acquisition
Synchronous Execution Script
The script is executed synchronously before the simple item acquisition process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Simple Inventory Model Name |
| simpleItems | SimpleItem[] | List of Simple Items |
| userId | string | User ID |
| acquireCounts | AcquireCount[] | List of acquisition quantities for Simple Items |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow Simple Item acquisition | ||
| overrideAcquireCounts | AcquireCount[] | 0 ~ 100 items | List of acquisition quantities for Simple Items |
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 executes asynchronously after the Simple Item acquisition.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Simple Inventory Model Name |
| oldSimpleItems | SimpleItem[] | List of Simple Items before update |
| newSimpleItems | SimpleItem[] | List of Simple Items after Update |
| userId | string | User ID |
| acquireCounts | AcquireCount[] | List of Simple Items |
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
oldSimpleItems = args.oldSimpleItems
newSimpleItems = args.newSimpleItems
userId = args.userId
acquireCounts = args.acquireCounts
result = {
}simpleItemConsume
Simple Item consumption
Synchronous Execution Script
The script is executed synchronously before the simple item consumption process.
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 consumption quantities of Simple Items |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow Simple Item consumption | ||
| overrideConsumeCounts | ConsumeCount[] | 0 ~ 100 items | List of Simple Items |
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 executes asynchronously after the Simple Item consumption.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Simple Inventory Model Name |
| oldSimpleItems | SimpleItem[] | List of Before update Simple Items |
| newSimpleItems | SimpleItem[] | List of After update Simple Items |
| userId | string | User ID |
| consumeCounts | ConsumeCount[] | List of consumption quantities of Simple Items |
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
oldSimpleItems = args.oldSimpleItems
newSimpleItems = args.newSimpleItems
userId = args.userId
consumeCounts = args.consumeCounts
result = {
}bigItemAcquire
Big Item acquisition
Synchronous Execution Script
The script is executed synchronously before the big item acquisition process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Big Inventory Model Name |
| itemName | string | Big Item Model Name |
| item | BigItem | Big Item |
| userId | string | User ID |
| acquireCount | string | Acquisition quantities for Big Items Integer value strings up to 1024 digits |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow Big 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 executes asynchronously after the Big Item acquisition.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Big Inventory Model Name |
| itemName | string | Big Item Model Name |
| oldItem | BigItem | Before update Big Item |
| newItem | BigItem | After update Big Item |
| userId | string | User ID |
| acquireCount | string | Acquisition quantities for Big Items Integer value strings up to 1024 digits |
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 consumption
Synchronous Execution Script
The script is executed synchronously before the big item consumption process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Big Inventory Model Name |
| itemName | string | Big Item Model Name |
| item | BigItem | Big Item |
| userId | string | User ID |
| consumeCount | string | Consumption quantity of Big Item Integer value strings up to 1024 digits |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow Big 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 executes asynchronously after the big item consumption.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| inventoryName | string | Big Inventory Model Name |
| itemName | string | Big Item Model Name |
| oldItem | BigItem | Before update Big Item |
| newItem | BigItem | After update Big Item |
| userId | string | User ID |
| consumeCount | string | Consumption quantity of Big Items Integer value strings up to 1024 digits |
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
itemName = args.itemName
oldItem = args.oldItem
newItem = args.newItem
userId = args.userId
consumeCount = args.consumeCount
result = {
}