Trigger Reference of GS2-Inventory Script
acquire
Event trigger to call GS2-Script before an 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 an 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 an 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 an 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 = {
}