GS2-Idle Script トリガー リファレンス
拡張スクリプトを呼び出す イベントトリガー のリファレンス
トリガー
receive
報酬受け取り
同期実行スクリプト
報酬受け取り処理の前に、スクリプトが同期実行されます。
Request
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| category | CategoryModel | カテゴリーモデル |
| userId | string | 報酬受け取りを実行しているユーザーID |
| status | Status | ステータス |
| acquireActions | AcquireAction[] | 報酬 |
| config | Config[] | トランザクションの変数に適用する設定値 |
Result
| 型 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|
| permit | bool | ✓ | 報酬受け取りを許可するか | ||
| rate | float | 1.0 | 0 ~ 1000 | 入手量の倍率 |
実装例
-- Request
local namespace = args.namespace
local category = args.category
local userId = args.userId
local status = args.status
local acquireActions = args.acquireActions
local config = args.config
-- Business logic:
local permit = true
local rate = 0
-- Result
result = {
permit=permit,
rate=rate
}非同期実行スクリプト
報酬受け取り処理の後に、スクリプトが非同期実行されます。
Request
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| category | CategoryModel | カテゴリーモデル |
| userId | string | 報酬受け取りを実行しているユーザーID |
| oldStatus | Status | 報酬受け取り前のステータス |
| newStatus | Status | 報酬受け取り後のステータス |
| acquireActions | AcquireAction[] | 報酬 |
| config | Config[] | トランザクションの変数に適用する設定値 |
実装例
-- Request
local namespace = args.namespace
local category = args.category
local userId = args.userId
local oldStatus = args.oldStatus
local newStatus = args.newStatus
local acquireActions = args.acquireActions
local config = args.config
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}overrideAcquireActions
放置報酬の入手アクションを動的に決定するスクリプト
同期実行スクリプト
放置報酬の入手アクションを動的に決定するスクリプトを同期実行したのち、入手アクションが実行されます。
Request
| 型 | 説明 | |
|---|---|---|
| namespace | Namespace | ネームスペース |
| categoryModel | CategoryModel | カテゴリーモデル |
| userId | string | ユーザーID |
Result
| 型 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|
| acquireActions | AcquireActionList[] | ✓ | 1 ~ 100 items | 待機時間ごとに得られる入手アクションリスト 待機時間を「X分」だと仮定すると 「X / rewardIntervalMinutes」が報酬を受け取れる数になりますが、ここで指定した配列の要素をループすることで、待機時間ごとに異なる報酬を付与できます。 |
実装例
-- Request
local namespace = args.namespace
local categoryModel = args.categoryModel
local userId = args.userId
-- Business logic:
local acquireActions = {}
-- Result
result = {
acquireActions=acquireActions
}