Trigger Reference of GS2-Inventory Script
Reference for event triggers that call extended scripts, as defined in GS2-Inventory
acquire
Event trigger to call GS2-Script before Item is acquired.
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 | Effective date |
Result
| Type | Require | Default | Limitation | Description |
---|
permit | bool | ✓ | | | Allow item acquisition |
overrideAcquireCount | int | | | ~ 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
}
acquireDone
GS2-Script called after Item is acquired.
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 | Effective date |
Result
| Type | Require | Default | Limitation | 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
Event trigger to call GS2-Script when the number of items hits the acquisition limit and notification of the quantity not obtained is completed.
Request
| Type | Description |
---|
namespace | Namespace | Namespace |
inventory | Inventory | Inventory |
itemModel | ItemModel | Item Model |
userId | string | User Id |
overflowValue | long | Amount of overflow |
Result
| Type | Require | Default | Limitation | Description |
---|
Implementation Example
namespace = args.namespace
inventory = args.inventory
itemModel = args.itemModel
userId = args.userId
overflowValue = args.overflowValue
result = {
}
consume
Event trigger to call GS2-Script before Item is consumed.
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 | Require | Default | Limitation | Description |
---|
permit | bool | ✓ | | | Allow item consumption |
overrideConsumeCount | int | | | ~ 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
}
consumeDone
GS2-Script called after Item is consumed.
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 | Require | Default | Limitation | 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
Event trigger to call GS2-Script before Simple item is acquired.
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 | Require | Default | Limitation | Description |
---|
permit | bool | ✓ | | | Allow item acquisition |
overrideAcquireCounts | AcquireCount[] | | | ~ 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
}
simpleItemAcquireDone
GS2-Script called after Simple item is acquired.
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 | Require | Default | Limitation | Description |
---|
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
oldSimpleItems = args.oldSimpleItems
newSimpleItems = args.newSimpleItems
userId = args.userId
acquireCounts = args.acquireCounts
result = {
}
simpleItemConsume
Event trigger to call GS2-Script before Simple item is consumed.
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 | Require | Default | Limitation | Description |
---|
permit | bool | ✓ | | | Allow item consumption |
overrideConsumeCounts | ConsumeCount[] | | | ~ 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
}
simpleItemConsumeDone
GS2-Script called after Simple item is consumed.
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 | Require | Default | Limitation | Description |
---|
Implementation Example
namespace = args.namespace
inventoryName = args.inventoryName
oldSimpleItems = args.oldSimpleItems
newSimpleItems = args.newSimpleItems
userId = args.userId
consumeCounts = args.consumeCounts
result = {
}
bigItemAcquire
Event trigger to call GS2-Script before Big item is consumed.
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 | Require | Default | Limitation | Description |
---|
permit | bool | ✓ | | | Allow item acquisition |
rate | float | | 1.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
}
bigItemAcquireDone
GS2-Script called after Big item is consumed.
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 | Require | Default | Limitation | 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
Event trigger to call GS2-Script before Big item is consumed.
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 | Require | Default | Limitation | Description |
---|
permit | bool | ✓ | | | Allow item consumption |
rate | float | | 1.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
}
bigItemConsumeDone
GS2-Script called after Big item is consumed.
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 | Require | Default | Limitation | 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 = {
}