GS2-Lottery Deploy/CDK リファレンス

GS2-Deployのスタックを作成する際に使用するテンプレートのフォーマットと、CDKによる各種言語のテンプレート出力の実装例

エンティティ

Deploy処理で操作の対象となるリソース

Namespace

ネームスペース

ネームスペースは、一つのプロジェクト内で同じサービスを異なる用途で複数利用するためのエンティティです。
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。

そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。

Request

リソースの生成・更新リクエスト

型有効化条件必須デフォルト値の制限説明
namestring
✓
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
descriptionstring~ 1024文字説明文
transactionSettingV2TransactionSettingV2トランザクション設定(V2)
このネームスペースが発行するトランザクションをどのように実行するかを決める設定です。設定する項目は、実行に使用する GS2-Distributor のネームスペースと、トランザクションに含まれるアクションを 1 件ずつ実行して先に実行されたアクションの結果を後続のアクションから使えるようにするか、まとめて同時に実行してレスポンスタイムを短くするか、の 2 つだけです。
新しく作成するネームスペースではこちらを設定してください。これに置き換えられて非推奨となった transactionSetting は、こちらが設定されていない間だけ使用されます。
lotteryTriggerScriptIdstring~ 1024文字抽選を実行した際に呼び出される GS2-Script のスクリプト GRN
Script トリガーリファレンス - lottery
logSettingLogSettingログの出力設定
抽選操作のAPIリクエスト・レスポンスログを出力するためのGS2-Logネームスペースを指定します。デバッグや分析のために抽選結果、景品配布、ボックスガチャの状態追跡に便利です。

GetAttr

!GetAttrタグで取得可能なリソースの生成結果

型説明
ItemNamespace作成したネームスペース

実装例

Type: GS2::Lottery::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSettingV2: null
  LotteryTriggerScriptId: null
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/lottery"
)


SampleStack := core.NewStack()
lottery.NewNamespace(
    &SampleStack,
    "namespace-0001",
    lottery.NamespaceOptions{
        LogSetting: &core.LogSetting{
            LoggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
        },
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Lottery\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Lottery\Model\Options\NamespaceOptions(
                logSetting: new \Gs2Cdk\Core\Model\LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            )
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.lottery.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.lottery.model.options.NamespaceOptions()
                        .withLogSetting(new io.gs2.cdk.core.model.LogSetting(
                            "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                        ))
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Lottery.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Lottery.Model.Options.NamespaceOptions
            {
                logSetting = new Gs2Cdk.Core.Model.LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import lottery from "@/gs2cdk/lottery";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new lottery.model.Namespace(
            this,
            "namespace-0001",
            {
                logSetting: new core.LogSetting(
                    "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, lottery

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        lottery.Namespace(
            stack=self,
            name='namespace-0001',
            options=lottery.NamespaceOptions(
                log_setting=core.LogSetting(
                    logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
                ),
            ),
        )

print(SampleStack().yaml())  # Generate Template

TransactionSettingV2

トランザクション設定(V2)

トランザクション設定(V2)は、ネームスペースが発行するトランザクションをどのように実行するかを決める設定です。

設定する項目は次の 2 つだけです。

  • distributorNamespaceId: トランザクションの実行に使用する GS2-Distributor のネームスペース
  • enableParallelExecution: トランザクションに含まれるアクションを 1 件ずつ実行するか、まとめて同時に実行するか

どちらを選んでも、トランザクションは発行された時点でサーバーが実行し、成否はトランザクション全体でひとつになります。あるアクションが失敗した場合は、それまでに実行されたアクションもろとも取り消され、1 つも反映されません。トランザクションの実行方法に関するそれ以外の項目は推奨構成に固定されているため、設定する必要はありません。

1 件ずつ実行する場合(既定 / enableParallelExecution が false)、各アクションは先に実行されたアクションの書き込みを踏まえて動作します。アクションは verify・consume・acquire の順に実行され、次のことができます。

  • 1 つのトランザクションの中で、同じ行を複数のアクションから更新する(まとめて同時に実行する場合は失敗します)
  • 先に実行されたアクションの書き込みを読む。List や Query の結果でも、入れ子になったトランザクションの内側でも読めます
  • %{Gs2Xxx:ActionName.path[0].field} を使って、先に実行された verify や consume アクションの結果を、後続の verify・consume・acquire アクションの引数として渡す

代わりに、レスポンスタイムは各アクションの実行時間の合計になり、1 つのトランザクションに含められるアクションは最大 20 件になります。また、各フェーズの中での実行順はアクション名、次に対象リソースの順で決まるため、リクエストに並べた順序で実行順を指定することはできません。実行は最初に失敗したアクションで停止します。

まとめて同時に実行する場合(enableParallelExecution が true)、アクションは同一のデータスナップショットに対して並列に実行されるため、レスポンスタイムは最も遅いアクション 1 件分で済み、アクション数の上限もありません。

代わりに、あるアクションから他のアクションの書き込みを読むことはできず、同じ行を 2 つのアクションが書き換えるとトランザクションは database:transaction:same.resource(400)で失敗します。同一トランザクション内で同じデータを 2 つ以上のアクションが書き換えないことを保証できる場合にだけ選択してください。%{...} は先行するフェーズ(verify → consume → acquire の順)の結果だけを参照でき、同じフェーズ内のアクションへの参照は解決されずにそのまま残ります。%{...} を含むフェーズは先行するフェーズの完了を待ってから実行されるため、その分だけレスポンスタイムが伸びます。

トランザクション設定は、トランザクション設定(V2)に置き換えられた非推奨の設定で、トランザクション設定(V2)が存在しなかった頃に作成されたネームスペースのために残されています。トランザクション設定(V2)が設定されていない間だけ適用され、トランザクション設定(V2)を設定するとそちらが優先されます。トランザクション設定で可能だった、トランザクションをクライアント実行のスタンプシートとして実行する・GS2-Distributor による AutoRun の非同期実行を行う・入手アクションを GS2-JobQueue に畳み込む、という 3 つの挙動は、こちらではあえて提供していません。

型有効化条件必須デフォルト値の制限説明
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024文字トランザクションの実行に使用する GS2-Distributor ネームスペース GRN
enableParallelExecutionboolfalseアクションを直列ではなく並列に実行するか

LogSetting

ログの出力設定

ログデータの出力設定を管理します。この型は、ログデータを書き出すために使用される GS2-Log ネームスペースの識別子(Namespace ID)を保持します。
ログネームスペースID(loggingNamespaceId)には、ログデータを収集し保存する GS2-Log のネームスペースを、GRNの形式で指定します。
この設定をすることで、設定されたネームスペース内で発生したAPIリクエスト・レスポンスのログデータが、対象の GS2-Log ネームスペース側へ出力されるようになります。
GS2-Log ではリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。

型有効化条件必須デフォルト値の制限説明
loggingNamespaceIdstring
✓
~ 1024文字ログを出力する GS2-Log のネームスペース GRN
「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。

TransactionSetting

トランザクション設定

トランザクション設定は非推奨です。トランザクション設定(V2)がこれに置き換わります。トランザクション設定(V2)が存在しなかった頃に作成されたネームスペースのために残されており、トランザクション設定(V2)が設定されていない間だけ適用されます。新しく作成するネームスペースでは使用しないでください。

この設定は、トランザクションの実行に関わる要素――自動実行(AutoRun)、アトミック実行(AtomicCommit)、GS2-Distributor を利用した非同期実行、スクリプト結果の一括適用、GS2-JobQueue による入手アクションの非同期化、直列実行――をそれぞれ個別の項目として公開しているため、推奨構成以外の組み合わせも作れます。その推奨構成を 1 つの設定としてまとめたものがトランザクション設定(V2)です。トランザクション設定を使い続けるのは、トランザクション設定(V2)が提供しない挙動――トランザクションをクライアント実行のスタンプシートとして実行する、GS2-Distributor による AutoRun の非同期実行を行う、入手アクションを GS2-JobQueue に畳み込む――にすでに依存しているネームスペースに限ってください。

型有効化条件必須デフォルト値の制限説明
enableAutoRunboolfalse発行したトランザクションをサーバーサイドで自動的に実行するか
enableAtomicCommitbool{enableAutoRun} == truefalseトランザクションの実行をアトミックにコミットするか
※ enableAutoRun が true であれば 有効
transactionUseDistributorbool{enableAtomicCommit} == truefalseトランザクションを非同期処理で実行する
※ enableAtomicCommit が true であれば 有効
commitScriptResultInUseDistributorbool{transactionUseDistributor} == truefalseスクリプトの結果コミット処理を非同期処理で実行するか
※ transactionUseDistributor が true であれば 有効
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalse入手アクションを実行する際に GS2-JobQueue を使用するか
※ enableAtomicCommit が true であれば 有効
enableSequentialExecutionbool{enableAtomicCommit} == truefalseアトミックコミットのアクションを直列に実行し、同じ行を複数のアクションで更新できるようにするか
※ enableAtomicCommit が true であれば 有効
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024文字トランザクションの実行に使用する GS2-Distributor ネームスペース GRN
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024文字トランザクションの実行に使用する GS2-JobQueue のネームスペース GRN

CurrentLotteryMaster

現在アクティブな抽選モデルのマスターデータ

現在ネームスペース内で有効な、抽選モデルの定義を記述したマスターデータです。
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。

JSONファイルを作成する方法として、マネージメントコンソール内にマスターデータエディタを提供しています。
また、よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。

Request

リソースの生成・更新リクエスト

型有効化条件必須デフォルト値の制限説明
namespaceNamestring
✓
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
mode文字列列挙型
enum {
  “direct”,
  “preUpload”
}
“direct”更新モード
定義説明
directマスターデータを直接更新
preUploadマスターデータをアップロードしてから更新
settingsstring{mode} == “direct”
✓※
~ 5242880 バイト (5MB)マスターデータ
※ mode が “direct” であれば必須
uploadTokenstring{mode} == “preUpload”
✓※
~ 1024文字事前アップロードで取得したトークン
アップロードしたマスターデータを適用するために使用されます。
※ mode が “preUpload” であれば必須

GetAttr

!GetAttrタグで取得可能なリソースの生成結果

型説明
ItemCurrentLotteryMaster更新された現在アクティブな抽選モデルのマスターデータ

実装例

Type: GS2::Lottery::CurrentLotteryMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2019-02-21",
    "lotteryModels": [
      {
        "name": "gacha",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "GACHA",
        "prizeTableName": "gacha"
      },
      {
        "name": "gacha_ssr",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "SSR",
        "prizeTableName": "gacha-ssr"
      },
      {
        "name": "gacha_sr",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "SR",
        "prizeTableName": "gacha-sr"
      },
      {
        "name": "gacha_r",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "R",
        "prizeTableName": "gacha-r"
      },
      {
        "name": "box",
        "mode": "box",
        "method": "prize_table",
        "metadata": "BOX",
        "prizeTableName": "box"
      }
    ],
    "prizeTables": [
      {
        "name": "gacha",
        "prizes": [
          {
            "prizeId": "prize-1",
            "type": "prize_table",
            "prizeTableName": "gacha-ssr",
            "weight": 5
          },
          {
            "prizeId": "prize-2",
            "type": "prize_table",
            "prizeTableName": "gacha-sr",
            "weight": 15
          },
          {
            "prizeId": "prize-3",
            "type": "prize_table",
            "prizeTableName": "gacha-r",
            "weight": 80
          }
        ],
        "metadata": "SSR"
      },
      {
        "name": "gacha-ssr",
        "prizes": [
          {
            "prizeId": "prize-4",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 1
          },
          {
            "prizeId": "prize-5",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 2
          },
          {
            "prizeId": "prize-6",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 3
          }
        ],
        "metadata": "SSR"
      },
      {
        "name": "gacha-sr",
        "prizes": [
          {
            "prizeId": "prize-7",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 10
          },
          {
            "prizeId": "prize-8",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 20
          },
          {
            "prizeId": "prize-9",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 30
          }
        ],
        "metadata": "SR"
      },
      {
        "name": "gacha-r",
        "prizes": [
          {
            "prizeId": "prize-10",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 100
          },
          {
            "prizeId": "prize-11",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 200
          },
          {
            "prizeId": "prize-12",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 300
          }
        ],
        "metadata": "R"
      },
      {
        "name": "box",
        "prizes": [
          {
            "prizeId": "prize-13",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 30
          },
          {
            "prizeId": "prize-14",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 20
          },
          {
            "prizeId": "prize-15",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 10
          }
        ],
        "metadata": "BOX"
      }
    ]
  }
  UploadToken: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/lottery"
    "github.com/gs2io/gs2-golang-cdk/money"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
lottery.NewNamespace(
    &SampleStack,
    "namespace-0001",
    lottery.NamespaceOptions{},
).MasterData(
    []lottery.LotteryModel{
        lottery.NewLotteryModel(
            "gacha",
            lottery.LotteryModelModeNormal,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("GACHA"),
                PrizeTableName: pointy.String("gacha"),
            },
        ),
        lottery.NewLotteryModel(
            "gacha_ssr",
            lottery.LotteryModelModeNormal,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("SSR"),
                PrizeTableName: pointy.String("gacha-ssr"),
            },
        ),
        lottery.NewLotteryModel(
            "gacha_sr",
            lottery.LotteryModelModeNormal,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("SR"),
                PrizeTableName: pointy.String("gacha-sr"),
            },
        ),
        lottery.NewLotteryModel(
            "gacha_r",
            lottery.LotteryModelModeNormal,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("R"),
                PrizeTableName: pointy.String("gacha-r"),
            },
        ),
        lottery.NewLotteryModel(
            "box",
            lottery.LotteryModelModeBox,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("BOX"),
                PrizeTableName: pointy.String("box"),
            },
        ),
    },
    []lottery.PrizeTable{
        lottery.NewPrizeTable(
            "gacha",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-1",
                    lottery.PrizeTypePrizeTable,
                    5,
                    lottery.PrizeOptions{
                        PrizeTableName: pointy.String("gacha-ssr"),
                    },
                ),
                lottery.NewPrize(
                    "prize-2",
                    lottery.PrizeTypePrizeTable,
                    15,
                    lottery.PrizeOptions{
                        PrizeTableName: pointy.String("gacha-sr"),
                    },
                ),
                lottery.NewPrize(
                    "prize-3",
                    lottery.PrizeTypePrizeTable,
                    80,
                    lottery.PrizeOptions{
                        PrizeTableName: pointy.String("gacha-r"),
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("SSR"),
            },
        ),
        lottery.NewPrizeTable(
            "gacha-ssr",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-4",
                    lottery.PrizeTypeAction,
                    1,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-5",
                    lottery.PrizeTypeAction,
                    2,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-6",
                    lottery.PrizeTypeAction,
                    3,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("SSR"),
            },
        ),
        lottery.NewPrizeTable(
            "gacha-sr",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-7",
                    lottery.PrizeTypeAction,
                    10,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-8",
                    lottery.PrizeTypeAction,
                    20,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-9",
                    lottery.PrizeTypeAction,
                    30,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("SR"),
            },
        ),
        lottery.NewPrizeTable(
            "gacha-r",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-10",
                    lottery.PrizeTypeAction,
                    100,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-11",
                    lottery.PrizeTypeAction,
                    200,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-12",
                    lottery.PrizeTypeAction,
                    300,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("R"),
            },
        ),
        lottery.NewPrizeTable(
            "box",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-13",
                    lottery.PrizeTypeAction,
                    30,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-14",
                    lottery.PrizeTypeAction,
                    20,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-15",
                    lottery.PrizeTypeAction,
                    10,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("BOX"),
            },
        ),
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Lottery\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"GACHA",
                        prizeTableName:"gacha"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_ssr",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"SSR",
                        prizeTableName:"gacha-ssr"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_sr",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"SR",
                        prizeTableName:"gacha-sr"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_r",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"R",
                        prizeTableName:"gacha-r"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"box",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::BOX,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"BOX",
                        prizeTableName:"box"
                    )
                )
            ],
            [
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-1",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::PRIZE_TABLE,
                            weight: 5,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                prizeTableName: "gacha-ssr",
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-2",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::PRIZE_TABLE,
                            weight: 15,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                prizeTableName: "gacha-sr",
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-3",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::PRIZE_TABLE,
                            weight: 80,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                prizeTableName: "gacha-r",
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SSR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-ssr",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-4",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 1,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-5",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 2,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-6",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 3,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SSR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-sr",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-7",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 10,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-8",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 20,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-9",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 30,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-r",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-10",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 100,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-11",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 200,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-12",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 300,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"R"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"box",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-13",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 30,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-14",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 20,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-15",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 10,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"BOX"
                    )
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.lottery.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.NORMAL,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("GACHA")
                        .withPrizeTableName("gacha")
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_ssr",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.NORMAL,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("SSR")
                        .withPrizeTableName("gacha-ssr")
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_sr",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.NORMAL,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("SR")
                        .withPrizeTableName("gacha-sr")
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_r",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.NORMAL,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("R")
                        .withPrizeTableName("gacha-r")
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "box",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.BOX,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("BOX")
                        .withPrizeTableName("box")
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-1",
                            io.gs2.cdk.lottery.model.enums.PrizeType.PRIZE_TABLE,
                            5,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-ssr")
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-2",
                            io.gs2.cdk.lottery.model.enums.PrizeType.PRIZE_TABLE,
                            15,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-sr")
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-3",
                            io.gs2.cdk.lottery.model.enums.PrizeType.PRIZE_TABLE,
                            80,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-r")
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("SSR")
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-ssr",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-4",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            1,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-5",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            2,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-6",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            3,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("SSR")
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-sr",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-7",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            10,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-8",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            20,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-9",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            30,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("SR")
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-r",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-10",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            100,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-11",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            200,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-12",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            300,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("R")
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "box",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-13",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            30,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-14",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            20,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-15",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            10,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("BOX")
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Lottery.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Lottery.Model.LotteryModel[] {
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "gacha",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "GACHA",
                        prizeTableName = "gacha"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "gacha_ssr",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "SSR",
                        prizeTableName = "gacha-ssr"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "gacha_sr",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "SR",
                        prizeTableName = "gacha-sr"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "gacha_r",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "R",
                        prizeTableName = "gacha-r"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "box",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Box,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "BOX",
                        prizeTableName = "box"
                    }
                )
            },
            new Gs2Cdk.Gs2Lottery.Model.PrizeTable[] {
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "gacha",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-1",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.PrizeTable,
                            weight: 5,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                prizeTableName = "gacha-ssr"
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-2",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.PrizeTable,
                            weight: 15,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                prizeTableName = "gacha-sr"
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-3",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.PrizeTable,
                            weight: 80,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                prizeTableName = "gacha-r"
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "SSR"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "gacha-ssr",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-4",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 1,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-5",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 2,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-6",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 3,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "SSR"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "gacha-sr",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-7",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 10,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-8",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 20,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-9",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 30,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "SR"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "gacha-r",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-10",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 100,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-11",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 200,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-12",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 300,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "R"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "box",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-13",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 30,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-14",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 20,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-15",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 10,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "BOX"
                    }
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import lottery from "@/gs2cdk/lottery";
import money from "@/gs2cdk/money";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new lottery.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new lottery.model.LotteryModel(
                    "gacha",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "GACHA",
                        prizeTableName: "gacha"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_ssr",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "SSR",
                        prizeTableName: "gacha-ssr"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_sr",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "SR",
                        prizeTableName: "gacha-sr"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_r",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "R",
                        prizeTableName: "gacha-r"
                    }
                ),
                new lottery.model.LotteryModel(
                    "box",
                    lottery.model.LotteryModelMode.BOX,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "BOX",
                        prizeTableName: "box"
                    }
                )
            ],
            [
                new lottery.model.PrizeTable(
                    "gacha",
                    [
                        new lottery.model.Prize(
                            "prize-1",
                            lottery.model.PrizeType.PRIZE_TABLE,
                            5,
                            {
                                prizeTableName: "gacha-ssr"
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-2",
                            lottery.model.PrizeType.PRIZE_TABLE,
                            15,
                            {
                                prizeTableName: "gacha-sr"
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-3",
                            lottery.model.PrizeType.PRIZE_TABLE,
                            80,
                            {
                                prizeTableName: "gacha-r"
                            }
                        ),
                    ],
                    {
                        metadata: "SSR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-ssr",
                    [
                        new lottery.model.Prize(
                            "prize-4",
                            lottery.model.PrizeType.ACTION,
                            1,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-5",
                            lottery.model.PrizeType.ACTION,
                            2,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-6",
                            lottery.model.PrizeType.ACTION,
                            3,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                    ],
                    {
                        metadata: "SSR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-sr",
                    [
                        new lottery.model.Prize(
                            "prize-7",
                            lottery.model.PrizeType.ACTION,
                            10,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-8",
                            lottery.model.PrizeType.ACTION,
                            20,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-9",
                            lottery.model.PrizeType.ACTION,
                            30,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                    ],
                    {
                        metadata: "SR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-r",
                    [
                        new lottery.model.Prize(
                            "prize-10",
                            lottery.model.PrizeType.ACTION,
                            100,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-11",
                            lottery.model.PrizeType.ACTION,
                            200,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-12",
                            lottery.model.PrizeType.ACTION,
                            300,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                    ],
                    {
                        metadata: "R"
                    }
                ),
                new lottery.model.PrizeTable(
                    "box",
                    [
                        new lottery.model.Prize(
                            "prize-13",
                            lottery.model.PrizeType.ACTION,
                            30,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-14",
                            lottery.model.PrizeType.ACTION,
                            20,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-15",
                            lottery.model.PrizeType.ACTION,
                            10,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                    ],
                    {
                        metadata: "BOX"
                    }
                )
            ]
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, lottery, money

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        lottery.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            lottery_models=[
                lottery.LotteryModel(
                    name='gacha',
                    mode=lottery.LotteryModelMode.NORMAL,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'GACHA',
                        prize_table_name = 'gacha'
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_ssr',
                    mode=lottery.LotteryModelMode.NORMAL,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'SSR',
                        prize_table_name = 'gacha-ssr'
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_sr',
                    mode=lottery.LotteryModelMode.NORMAL,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'SR',
                        prize_table_name = 'gacha-sr'
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_r',
                    mode=lottery.LotteryModelMode.NORMAL,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'R',
                        prize_table_name = 'gacha-r'
                    ),
                ),
                lottery.LotteryModel(
                    name='box',
                    mode=lottery.LotteryModelMode.BOX,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'BOX',
                        prize_table_name = 'box'
                    ),
                ),
            ],
            prize_tables=[
                lottery.PrizeTable(
                    name='gacha',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-1',
                            type=lottery.PrizeType.PRIZE_TABLE,
                            weight=5,
                            options=lottery.PrizeOptions(
                                prize_table_name='gacha-ssr',
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-2',
                            type=lottery.PrizeType.PRIZE_TABLE,
                            weight=15,
                            options=lottery.PrizeOptions(
                                prize_table_name='gacha-sr',
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-3',
                            type=lottery.PrizeType.PRIZE_TABLE,
                            weight=80,
                            options=lottery.PrizeOptions(
                                prize_table_name='gacha-r',
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'SSR'
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-ssr',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-4',
                            type=lottery.PrizeType.ACTION,
                            weight=1,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-5',
                            type=lottery.PrizeType.ACTION,
                            weight=2,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-6',
                            type=lottery.PrizeType.ACTION,
                            weight=3,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'SSR'
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-sr',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-7',
                            type=lottery.PrizeType.ACTION,
                            weight=10,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-8',
                            type=lottery.PrizeType.ACTION,
                            weight=20,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-9',
                            type=lottery.PrizeType.ACTION,
                            weight=30,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'SR'
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-r',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-10',
                            type=lottery.PrizeType.ACTION,
                            weight=100,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-11',
                            type=lottery.PrizeType.ACTION,
                            weight=200,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-12',
                            type=lottery.PrizeType.ACTION,
                            weight=300,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'R'
                    ),
                ),
                lottery.PrizeTable(
                    name='box',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-13',
                            type=lottery.PrizeType.ACTION,
                            weight=30,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-14',
                            type=lottery.PrizeType.ACTION,
                            weight=20,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-15',
                            type=lottery.PrizeType.ACTION,
                            weight=10,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'BOX'
                    ),
                ),
            ],
        )

print(SampleStack().yaml())  # Generate Template

PrizeTable

排出確率テーブル

景品には、入手アクションを指定するか、別の排出確率テーブルを参照させることもできます。
排出確率テーブルを入れ子にすることで、たとえば 1段目で SSR / SR / R などのレアリティを抽選し、2段目でそのレアリティに対応した具体的なコンテンツを抽選するといった設定が可能です。
この仕組みにより、ゲーム全体としてのレアリティ別排出確率を調整しやすくなります。

型有効化条件必須デフォルト値の制限説明
prizeTableIdstring
※
~ 1024文字排出確率テーブル GRN
※ サーバーが自動で設定
namestring
✓
~ 128文字排出確率テーブル名
排出確率テーブル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
metadatastring~ 128文字メタデータ
メタデータには任意の値を設定できます。
これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。
prizesList<Prize>
✓
1 ~ 100 items景品リスト
この排出確率テーブル内の景品リストです。各景品は排出重み(確率)、排出時に実行するアクション、およびオプションの排出回数制限を定義します。各景品の実際の排出確率は、その重みをテーブル内の全景品の重みの合計で割って算出されます。

Prize

景品

排出確率テーブル内の単一の景品エントリです。
景品は入手アクション(アイテムや通貨の付与など)を直接指定するか、別の排出確率テーブルを参照してネストされた抽選を行えます。
各景品には排出重みがあり、排出される相対的な確率を決定します。

型有効化条件必須デフォルト値の制限説明
prizeIdstring
✓
UUID~ 36文字景品ID
排出確率テーブル内でこの景品を一意に識別するIDです。排出回数制限の追跡や、フェイルオーバー景品の指定時の参照に使用されます。
type文字列列挙型
enum {
  “action”,
  “prize_table”
}
✓
景品の種類
この景品が直接報酬を付与するか、別の排出確率テーブルに委譲するかを決定します。action は排出時に実行する入手アクションを指定します。prize_table は別の排出確率テーブルを参照してネストされた抽選を行います(例:1段目でレアリティを決定、2段目で具体的なアイテムを決定)。
定義説明
action景品の入手アクション
prize_table更に排出確率テーブルを指定して再抽選
acquireActionsList<AcquireAction>{type} == “action”[]1 ~ 100 items入手アクションリスト
この景品が排出された時に実行する入手アクションのリストです。複数のアクションを指定して、一度に複数の報酬を付与できます(例:アイテムと通貨を同時に付与)。
※ type が “action” であれば 有効
drawnLimitint{type} == “action”1 ~ 1000000最大排出数
この景品が全ユーザーを通じて排出される最大回数です。制限に達すると、代わりにフェイルオーバー景品(limitFailOverPrizeId)が排出されます。ジャックポットアイテムなどの数量限定景品の実装に使用されます。
※ type が “action” であれば 有効
limitFailOverPrizeIdstring{type} == “action” and {drawnLimit} > 0
✓※
~ 32文字制限時フェイルオーバー景品ID
この景品の排出回数制限(drawnLimit)に達した場合に代わりに排出する景品のIDです。同じ排出確率テーブル内の別の景品を参照する必要があります。
※ type が “action” で かつ drawnLimit が 0 より大きければ 必須
prizeTableNamestring{type} == “prize_table”
✓※
~ 128文字排出確率テーブルの名前
抽選を委譲する排出確率テーブルの名前です。景品タイプが prize_table の場合にネストされた抽選に使用されます。
※ type が “prize_table” であれば 必須
weightint
✓
1 ~ 2147483646排出重み
排出確率テーブル内でのこの景品の相対的な重みです。実際の排出確率は、この景品の重みをテーブル内の全景品の重みの合計で割って算出されます。例えば3つの景品の重みが70、20、10の場合、それぞれの排出確率は70%、20%、10%になります。

LotteryModel

抽選モデル

抽選モデルは排出方式や排出テーブルの参照方法を定義するエンティティです。

排出方式は2種類用意されており、通常抽選は毎回一定の確率で抽選をする方式、Box抽選は箱の中にあらかじめ定義された数量の景品が入っており、抽選するたびに箱から景品を取り出していく抽選方式です。

抽選処理を行うにあたって、排出確率テーブルを利用しますが、
GS2-Script を使用すれば複数回抽選を実行した際に排出確率テーブルを一部だけ異なるテーブルに差し替えることができます。
この仕組みを利用することで、10連ガチャで1回だけ異なる抽選確率テーブルを適用することが可能となります。

型有効化条件必須デフォルト値の制限説明
lotteryModelIdstring
※
~ 1024文字抽選モデル GRN
※ サーバーが自動で設定
namestring
✓
~ 128文字抽選モデル名
抽選モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
metadatastring~ 2048文字メタデータ
メタデータには任意の値を設定できます。
これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。
mode文字列列挙型
enum {
  “normal”,
  “box”
}
✓
抽選モード
景品の抽選方式を選択します。normal は毎回一定の確率で抽選を行います(景品は繰り返し排出されます)。box は仮想的な箱にあらかじめ定義された数量の景品を入れ、抽選するたびに箱から景品を取り出します(すべての景品が最終的に排出されることが保証されます)。
定義説明
normal通常抽選
boxボックス抽選
method文字列列挙型
enum {
  “prize_table”,
  “script”
}
✓
抽選方法
排出確率テーブルの参照方法を決定します。prize_table は静的に指定された排出確率テーブルを使用します。script はGS2-Scriptを使用して抽選時に動的に排出確率テーブルを選択し、10連ガチャで1回だけ異なる排出確率テーブルを適用するなどのシナリオを実現できます。
定義説明
prize_table静的な排出確率テーブル
scriptGS2-Script による動的な排出確率テーブル
prizeTableNamestring{method} == “prize_table”
✓※
~ 128文字排出確率テーブルの名前
この抽選モデルで使用する排出確率テーブルの名前です。抽選方法が prize_table の場合に必須です。
※ method が “prize_table” であれば 必須
choicePrizeTableScriptIdstring{method} == “script”
✓※
~ 1024文字排出確率テーブルを決定する GS2-Script のスクリプト GRN
Script トリガーリファレンス - choicePrizeTable
※ method が “script” であれば 必須

AcquireAction

入手アクション

型有効化条件必須デフォルト値の制限説明
action文字列列挙型
enum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Schedule:ExtendTriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
✓
入手アクションで実行するアクションの種類
requeststring
✓
~ 524288文字アクション実行時に使用されるリクエストのJSON文字列