NAV
GS2-Script

GS2-Inventory

Reference for event triggers that call GS2-Script

GS2-Script Reference

Trigger

acquire

acquire

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
}

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 ~ 2147483646 Actual amount obtained to be applied

acquireDone

acquireDone

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 = {
}

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

overflowDone

overflowDone

namespace = args.namespace
inventory = args.inventory
itemModel = args.itemModel
userId = args.userId
overflowValue = args.overflowValue

result = {
}

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

consume

consume

namespace = args.namespace
inventory = args.inventory
itemSets = args.itemSets
consumeItemName = args.consumeItemName
userId = args.userId
consumeCount = args.consumeCount

result = {
  permit=permit,
  overrideConsumeCount=overrideConsumeCount
}

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 ~ 2147483646 Actual consumption to be applied

consumeDone

consumeDone

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 = {
}

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