Script Trigger Reference of GS2-Inventory

Reference of event triggers that call extended scripts

Trigger

acquire

Item acquisition

Synchronous Execution Script

The script is executed synchronously before the item acquisition process.

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
Unix time, milliseconds
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 executes asynchronously after the Item acquisition.

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
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
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 consumption

Synchronous Execution Script

The script is executed synchronously before the item consumption process.

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 executes asynchronously after the item consumption.

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
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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringSimple Inventory Model Name
simpleItemsSimpleItem[]List of Simple Items
userIdstringUser ID
acquireCountsAcquireCount[]List of acquisition quantities for Simple Items
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow Simple Item acquisition
overrideAcquireCountsAcquireCount[]0 ~ 100 itemsList 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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringSimple Inventory Model Name
oldSimpleItemsSimpleItem[]List of Simple Items before update
newSimpleItemsSimpleItem[]List of Simple Items after Update
userIdstringUser ID
acquireCountsAcquireCount[]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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringSimple Inventory Model Name
simpleItemsSimpleItem[]List of Simple Item
userIdstringUser ID
consumeCountsConsumeCount[]List of consumption quantities of Simple Items
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow Simple Item consumption
overrideConsumeCountsConsumeCount[]0 ~ 100 itemsList 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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringSimple Inventory Model Name
oldSimpleItemsSimpleItem[]List of Before update Simple Items
newSimpleItemsSimpleItem[]List of After update Simple Items
userIdstringUser ID
consumeCountsConsumeCount[]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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringBig Inventory Model Name
itemNamestringBig Item Model Name
itemBigItemBig Item
userIdstringUser ID
acquireCountstringAcquisition quantities for Big Items
Integer value strings up to 1024 digits
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow Big 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 executes asynchronously after the Big Item acquisition.

Request
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringBig Inventory Model Name
itemNamestringBig Item Model Name
oldItemBigItemBefore update Big Item
newItemBigItemAfter update Big Item
userIdstringUser ID
acquireCountstringAcquisition 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
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringBig Inventory Model Name
itemNamestringBig Item Model Name
itemBigItemBig Item
userIdstringUser ID
consumeCountstringConsumption quantity of Big Item
Integer value strings up to 1024 digits
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow Big 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 executes asynchronously after the big item consumption.

Request
TypeDescription
namespaceNamespaceNamespace
inventoryNamestringBig Inventory Model Name
itemNamestringBig Item Model Name
oldItemBigItemBefore update Big Item
newItemBigItemAfter update Big Item
userIdstringUser ID
consumeCountstringConsumption 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 = {
}