GS2-Inventory Script トリガー リファレンス
拡張スクリプトを呼び出す イベントトリガー のリファレンス
トリガー
acquire
アイテム入手
同期実行スクリプト
アイテム入手処理の前に、スクリプトが同期実行されます。
Request
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventory | Inventory | インベントリ |
| itemSets | ItemSet[] | アイテムセットのリスト |
| acquireItemName | string | 入手したアイテムモデル名 |
| userId | string | ユーザーID |
| acquireCount | long | 入手数量 |
| expiresAt | long | 有効期限 UNIX 時間・ミリ秒 |
Result
| 型 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|
| permit | bool | ✓ | アイテム入手を許可するか | ||
| overrideAcquireCount | int | 0 ~ 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| oldInventory | Inventory | 更新前のインベントリ |
| oldItemSets | ItemSet[] | 更新前のアイテムセットリスト |
| newInventory | Inventory | 更新後のインベントリ |
| newItemSets | ItemSet[] | 更新後のアイテムセットのリスト |
| acquireItemName | string | 入手したアイテムモデル名 |
| userId | string | ユーザーID |
| acquireCount | long | 入手数量 |
| overflowValue | long | 溢れた量 |
| expiresAt | long | 有効期限 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventory | Inventory | インベントリ |
| itemModel | ItemModel | アイテムモデル |
| userId | string | ユーザーID |
| overflowValue | long | 溢れた量 |
実装例
-- 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventory | Inventory | インベントリ |
| itemSets | ItemSet[] | アイテムセットのリスト |
| consumeItemName | string | 消費したアイテムモデル名 |
| userId | string | ユーザーID |
| consumeCount | long | 消費数量 |
Result
| 型 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|
| permit | bool | ✓ | アイテム消費を許可するか | ||
| overrideConsumeCount | int | 0 ~ 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| oldInventory | Inventory | 消費前のインベントリ |
| oldItemSets | ItemSet[] | 消費前のアイテムセットのリスト |
| newInventory | Inventory | 消費後のインベントリ |
| newItemSets | ItemSet[] | 消費後のアイテムセットのリスト |
| consumeItemName | string | 消費したアイテムモデル名 |
| userId | string | ユーザーID |
| consumeCount | long | 消費数量 |
実装例
-- 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventoryName | string | シンプルインベントリモデル名 このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。 |
| simpleItems | SimpleItem[] | シンプルアイテムのリスト |
| userId | string | ユーザーID |
| acquireCounts | AcquireCount[] | シンプルアイテムの入手数量リスト |
Result
| 型 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|
| permit | bool | ✓ | シンプルアイテム入手を許可するか | ||
| overrideAcquireCounts | AcquireCount[] | 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventoryName | string | シンプルインベントリモデル名 このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。 |
| oldSimpleItems | SimpleItem[] | 更新前のシンプルアイテムのリスト |
| newSimpleItems | SimpleItem[] | 更新後のシンプルアイテムのリスト |
| userId | string | ユーザーID |
| acquireCounts | AcquireCount[] | シンプルアイテムのリスト |
実装例
-- 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventoryName | string | シンプルインベントリモデル名 このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。 |
| simpleItems | SimpleItem[] | シンプルアイテムのリスト |
| userId | string | ユーザーID |
| consumeCounts | ConsumeCount[] | シンプルアイテムの消費数量のリスト |
Result
| 型 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|
| permit | bool | ✓ | シンプルアイテム消費を許可するか | ||
| overrideConsumeCounts | ConsumeCount[] | 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventoryName | string | シンプルインベントリモデル名 このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。 |
| oldSimpleItems | SimpleItem[] | 更新前のシンプルアイテムのリスト |
| newSimpleItems | SimpleItem[] | 更新後のシンプルアイテムのリスト |
| userId | string | ユーザーID |
| consumeCounts | ConsumeCount[] | シンプルアイテムの消費数量リスト |
実装例
-- 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventoryName | string | 巨大インベントリモデル名 このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。 |
| itemName | string | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 |
| item | BigItem | 巨大アイテム |
| userId | string | ユーザーID |
| acquireCount | string | 巨大アイテムの入手数量 最大1024桁までの整数値文字列 |
Result
| 型 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|
| permit | bool | ✓ | 巨大アイテム入手を許可するか | ||
| rate | float | 1.0 | 0 ~ 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventoryName | string | 巨大インベントリモデル名 このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。 |
| itemName | string | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 |
| oldItem | BigItem | 更新前の巨大アイテム |
| newItem | BigItem | 更新後の巨大アイテム |
| userId | string | ユーザーID |
| acquireCount | string | 巨大アイテムの入手数量 最大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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventoryName | string | 巨大インベントリモデル名 このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。 |
| itemName | string | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 |
| item | BigItem | 巨大アイテム |
| userId | string | ユーザーID |
| consumeCount | string | 巨大アイテムの消費数量 最大1024桁までの整数値文字列 |
Result
| 型 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|
| permit | bool | ✓ | 巨大アイテム消費を許可するか | ||
| rate | float | 1.0 | 0 ~ 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
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| inventoryName | string | 巨大インベントリモデル名 このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。 |
| itemName | string | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 |
| oldItem | BigItem | 更新前の巨大アイテム |
| newItem | BigItem | 更新後の巨大アイテム |
| userId | string | ユーザーID |
| consumeCount | string | 巨大アイテムの消費数量 最大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 = {
}