Trigger Reference of GS2-Inventory Script

Reference of event triggers that call extended scripts

Trigger

acquire

Item is acquired

Synchronous Execution Script

Script and Item is acquired are executed synchronously in that order.

Request
TypeDescription
namespaceNamespaceNamespace
inventoryInventoryInventory
itemSetsItemSet[]List of Quantity of items held per expiration date
acquireItemNamestringName of item model acquired
userIdstringUser ID
acquireCountlongQuantity acquired
expiresAtlongExpiration date
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow item acquisition
overrideAcquireCountint0 ~ 2147483645Actual 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
TypeDescription
namespaceNamespaceNamespace
oldInventoryInventoryInventory before update
oldItemSetsItemSet[]List of Quantity of items held per expiration date before renewal
newInventoryInventoryInventory after update
newItemSetsItemSet[]List of Quantity of items held per renewal expiration date
acquireItemNamestringName of item model acquired
userIdstringUser ID
acquireCountlongQuantity acquired
overflowValuelongAmount of overflow
expiresAtlongExpiration date
Result
TypeRequiredDefaultValue LimitsDescription
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
TypeDescription
namespaceNamespaceNamespace
inventoryInventoryInventory
itemModelItemModelItem Model
userIdstringUser ID
overflowValuelongAmount of overflow
Result
TypeRequiredDefaultValue LimitsDescription
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
TypeDescription
namespaceNamespaceNamespace
inventoryInventoryInventory
itemSetsItemSet[]List of Quantity of items held per expiration date
consumeItemNamestringName of item model consumed
userIdstringUser ID
consumeCountlongQuantity consumed
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow item consumption
overrideConsumeCountint0 ~ 2147483645Actual 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
TypeDescription
namespaceNamespaceNamespace
oldInventoryInventoryInventory before consumption
oldItemSetsItemSet[]List of Quantity of items held per expiration date before consumption
newInventoryInventoryInventory after consumption
newItemSetsItemSet[]List of Quantity of items held per post-consumption expiration date
consumeItemNamestringName of item model consumed
userIdstringUser ID
consumeCountlongQuantity consumed
Result
TypeRequiredDefaultValue LimitsDescription
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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringSimple Inventory Model Name
simpleItemsSimpleItem[]List of Quantity of items held per expiration date
userIdstringUser ID
acquireCountsAcquireCount[]List of quantity of items to be obtained
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow item acquisition
overrideAcquireCountsAcquireCount[]0 ~ 100 itemsList 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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringSimple Inventory Model Name
oldSimpleItemsSimpleItem[]List of Quantity of items held per expiration date
newSimpleItemsSimpleItem[]List of Quantity of items held per expiration date
userIdstringUser ID
acquireCountsAcquireCount[]List of quantity of items to be obtained
Result
TypeRequiredDefaultValue LimitsDescription
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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringSimple Inventory Model Name
simpleItemsSimpleItem[]List of Simple Item
userIdstringUser ID
consumeCountsConsumeCount[]List of quantity of items to be consumed
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow item consumption
overrideConsumeCountsConsumeCount[]0 ~ 100 itemsList 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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringSimple Inventory Model Name
oldSimpleItemsSimpleItem[]List of Before update Simple Item
newSimpleItemsSimpleItem[]List of After update Simple Item
userIdstringUser ID
consumeCountsConsumeCount[]List of quantity of items to be consumed
Result
TypeRequiredDefaultValue LimitsDescription
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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringBig Inventory Model Name
itemNamestringBig Item Model Name
itemBigItemSimple Item
userIdstringUser ID
acquireCountstringList of quantity of items to be obtained
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow item acquisition
ratefloat1.00 ~ 1000Acquisition 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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringBig Inventory Model Name
itemNamestringBig Item Model Name
oldItemBigItemBefore update Simple Item
newItemBigItemAfter update Simple Item
userIdstringUser ID
acquireCountstringList of quantity of items to be obtained
Result
TypeRequiredDefaultValue LimitsDescription
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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringBig Inventory Model Name
itemNamestringBig Item Model Name
itemBigItemSimple Item
userIdstringUser ID
consumeCountstringList of quantity of items to be consumed
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow item consumption
ratefloat1.00 ~ 1000Consume 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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringBig Inventory Model Name
itemNamestringBig Item Model Name
oldItemBigItemBefore update Simple Item
newItemBigItemAfter update Simple Item
userIdstringUser ID
consumeCountstringList of quantity of items to be consumed
Result
TypeRequiredDefaultValue LimitsDescription
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
itemName = args.itemName
oldItem = args.oldItem
newItem = args.newItem
userId = args.userId
consumeCount = args.consumeCount

result = {
}