GS2-Inventory Script トリガー リファレンス

拡張スクリプトを呼び出す イベントトリガー のリファレンス

トリガー

acquire

アイテム入手

同期実行スクリプト

アイテム入手処理の前に、スクリプトが同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryInventoryインベントリ
itemSetsItemSet[]アイテムセットのリスト
acquireItemNamestring入手したアイテムモデル名
userIdstringユーザーID
acquireCountlong入手数量
expiresAtlong有効期限
UNIX 時間・ミリ秒
Result
必須デフォルト値の制限説明
permitbool
アイテム入手を許可するか
overrideAcquireCountint0 ~ 2147483645実際に適用する入手量
実装例
-- Request
local namespace = args.namespace
local inventory = args.inventory
local itemSets = args.itemSets
local acquireItemName = args.acquireItemName
local userId = args.userId
local acquireCount = args.acquireCount
local expiresAt = args.expiresAt

-- Business logic:
local permit = true
local overrideAcquireCount = 0

-- Result
result = {
  permit=permit,
  overrideAcquireCount=overrideAcquireCount
}

非同期実行スクリプト

アイテム入手処理の後に、スクリプトが非同期実行されます。

Request
説明
namespaceNamespaceネームスペース
oldInventoryInventory更新前のインベントリ
oldItemSetsItemSet[]更新前のアイテムセットリスト
newInventoryInventory更新後のインベントリ
newItemSetsItemSet[]更新後のアイテムセットのリスト
acquireItemNamestring入手したアイテムモデル名
userIdstringユーザーID
acquireCountlong入手数量
overflowValuelong溢れた量
expiresAtlong有効期限
UNIX 時間・ミリ秒
実装例
-- Request
local namespace = args.namespace
local oldInventory = args.oldInventory
local oldItemSets = args.oldItemSets
local newInventory = args.newInventory
local newItemSets = args.newItemSets
local acquireItemName = args.acquireItemName
local userId = args.userId
local acquireCount = args.acquireCount
local overflowValue = args.overflowValue
local expiresAt = args.expiresAt

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

overflowDone

アイテム数が入手上限に当たり、入手できなかった数量の通知完了

同期実行スクリプト

アイテム数が入手上限に当たり、入手できなかった数量の通知完了処理の前に、スクリプトが同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryInventoryインベントリ
itemModelItemModelアイテムモデル
userIdstringユーザーID
overflowValuelong溢れた量
実装例
-- Request
local namespace = args.namespace
local inventory = args.inventory
local itemModel = args.itemModel
local userId = args.userId
local overflowValue = args.overflowValue

-- Business logic:

-- Result
result = {
}

consume

アイテム消費

同期実行スクリプト

アイテム消費処理の前に、スクリプトが同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryInventoryインベントリ
itemSetsItemSet[]アイテムセットのリスト
consumeItemNamestring消費したアイテムモデル名
userIdstringユーザーID
consumeCountlong消費数量
Result
必須デフォルト値の制限説明
permitbool
アイテム消費を許可するか
overrideConsumeCountint0 ~ 2147483645実際に適用する消費量
実装例
-- Request
local namespace = args.namespace
local inventory = args.inventory
local itemSets = args.itemSets
local consumeItemName = args.consumeItemName
local userId = args.userId
local consumeCount = args.consumeCount

-- Business logic:
local permit = true
local overrideConsumeCount = 0

-- Result
result = {
  permit=permit,
  overrideConsumeCount=overrideConsumeCount
}

非同期実行スクリプト

アイテム消費処理の後に、スクリプトが非同期実行されます。

Request
説明
namespaceNamespaceネームスペース
oldInventoryInventory消費前のインベントリ
oldItemSetsItemSet[]消費前のアイテムセットのリスト
newInventoryInventory消費後のインベントリ
newItemSetsItemSet[]消費後のアイテムセットのリスト
consumeItemNamestring消費したアイテムモデル名
userIdstringユーザーID
consumeCountlong消費数量
実装例
-- Request
local namespace = args.namespace
local oldInventory = args.oldInventory
local oldItemSets = args.oldItemSets
local newInventory = args.newInventory
local newItemSets = args.newItemSets
local consumeItemName = args.consumeItemName
local userId = args.userId
local consumeCount = args.consumeCount

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

simpleItemAcquire

シンプルアイテム入手

同期実行スクリプト

シンプルアイテム入手処理の前に、スクリプトが同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryNamestringシンプルインベントリモデル名
このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。
simpleItemsSimpleItem[]シンプルアイテムのリスト
userIdstringユーザーID
acquireCountsAcquireCount[]シンプルアイテムの入手数量リスト
Result
必須デフォルト値の制限説明
permitbool
シンプルアイテム入手を許可するか
overrideAcquireCountsAcquireCount[]0 ~ 100 itemsシンプルアイテムの入手数量リスト
実装例
-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local simpleItems = args.simpleItems
local userId = args.userId
local acquireCounts = args.acquireCounts

-- Business logic:
local permit = true
local overrideAcquireCounts = {}

-- Result
result = {
  permit=permit,
  overrideAcquireCounts=overrideAcquireCounts
}

非同期実行スクリプト

シンプルアイテム入手処理の後に、スクリプトが非同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryNamestringシンプルインベントリモデル名
このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。
oldSimpleItemsSimpleItem[]更新前のシンプルアイテムのリスト
newSimpleItemsSimpleItem[]更新後のシンプルアイテムのリスト
userIdstringユーザーID
acquireCountsAcquireCount[]シンプルアイテムのリスト
実装例
-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local oldSimpleItems = args.oldSimpleItems
local newSimpleItems = args.newSimpleItems
local userId = args.userId
local acquireCounts = args.acquireCounts

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

simpleItemConsume

シンプルアイテム消費

同期実行スクリプト

シンプルアイテム消費処理の前に、スクリプトが同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryNamestringシンプルインベントリモデル名
このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。
simpleItemsSimpleItem[]シンプルアイテムのリスト
userIdstringユーザーID
consumeCountsConsumeCount[]シンプルアイテムの消費数量のリスト
Result
必須デフォルト値の制限説明
permitbool
シンプルアイテム消費を許可するか
overrideConsumeCountsConsumeCount[]0 ~ 100 itemsシンプルアイテムのリスト
実装例
-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local simpleItems = args.simpleItems
local userId = args.userId
local consumeCounts = args.consumeCounts

-- Business logic:
local permit = true
local overrideConsumeCounts = {}

-- Result
result = {
  permit=permit,
  overrideConsumeCounts=overrideConsumeCounts
}

非同期実行スクリプト

シンプルアイテム消費処理の後に、スクリプトが非同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryNamestringシンプルインベントリモデル名
このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。
oldSimpleItemsSimpleItem[]更新前のシンプルアイテムのリスト
newSimpleItemsSimpleItem[]更新後のシンプルアイテムのリスト
userIdstringユーザーID
consumeCountsConsumeCount[]シンプルアイテムの消費数量リスト
実装例
-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local oldSimpleItems = args.oldSimpleItems
local newSimpleItems = args.newSimpleItems
local userId = args.userId
local consumeCounts = args.consumeCounts

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

bigItemAcquire

巨大アイテム入手

同期実行スクリプト

巨大アイテム入手処理の前に、スクリプトが同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryNamestring巨大インベントリモデル名
このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。
itemNamestring巨大アイテムモデル名
このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。
itemBigItem巨大アイテム
userIdstringユーザーID
acquireCountstring巨大アイテムの入手数量
最大1024桁までの整数値文字列
Result
必須デフォルト値の制限説明
permitbool
巨大アイテム入手を許可するか
ratefloat1.00 ~ 1000入手量の倍率
実装例
-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local itemName = args.itemName
local item = args.item
local userId = args.userId
local acquireCount = args.acquireCount

-- Business logic:
local permit = true
local rate = 0

-- Result
result = {
  permit=permit,
  rate=rate
}

非同期実行スクリプト

巨大アイテム入手処理の後に、スクリプトが非同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryNamestring巨大インベントリモデル名
このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。
itemNamestring巨大アイテムモデル名
このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。
oldItemBigItem更新前の巨大アイテム
newItemBigItem更新後の巨大アイテム
userIdstringユーザーID
acquireCountstring巨大アイテムの入手数量
最大1024桁までの整数値文字列
実装例
-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local itemName = args.itemName
local oldItem = args.oldItem
local newItem = args.newItem
local userId = args.userId
local acquireCount = args.acquireCount

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

bigItemConsume

巨大アイテム消費

同期実行スクリプト

巨大アイテム消費処理の前に、スクリプトが同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryNamestring巨大インベントリモデル名
このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。
itemNamestring巨大アイテムモデル名
このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。
itemBigItem巨大アイテム
userIdstringユーザーID
consumeCountstring巨大アイテムの消費数量
最大1024桁までの整数値文字列
Result
必須デフォルト値の制限説明
permitbool
巨大アイテム消費を許可するか
ratefloat1.00 ~ 1000消費量の倍率
実装例
-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local itemName = args.itemName
local item = args.item
local userId = args.userId
local consumeCount = args.consumeCount

-- Business logic:
local permit = true
local rate = 0

-- Result
result = {
  permit=permit,
  rate=rate
}

非同期実行スクリプト

巨大アイテム消費処理の後に、スクリプトが非同期実行されます。

Request
説明
namespaceNamespaceネームスペース
inventoryNamestring巨大インベントリモデル名
このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。
itemNamestring巨大アイテムモデル名
このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。
oldItemBigItem更新前の巨大アイテム
newItemBigItem更新後の巨大アイテム
userIdstringユーザーID
consumeCountstring巨大アイテムの消費数量
最大1024桁までの整数値文字列
実装例
-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local itemName = args.itemName
local oldItem = args.oldItem
local newItem = args.newItem
local userId = args.userId
local consumeCount = args.consumeCount

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}