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

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

エンティティ

Deploy処理で操作する対象リソース

Namespace

ネームスペース

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

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

有効化条件必須デフォルト値の制限説明
namespaceIdstring
✓*
~ 1024文字ネームスペース GRN
※ サーバー側で自動的に設定
namestring
~ 128文字ネームスペース名
descriptionstring~ 1024文字説明文
transactionSettingTransactionSetting
トランザクション設定
enhanceScriptScriptSetting強化時に実行するスクリプト
logSettingLogSettingログの出力設定
createdAtlong
✓*
現在時刻作成日時
UNIX 時間・ミリ秒
※ サーバー側で自動的に設定
updatedAtlong
✓*
現在時刻最終更新日時
UNIX 時間・ミリ秒
※ サーバー側で自動的に設定
revisionlong00 ~ 9223372036854775805リビジョン

GetAttr

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

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

実装例

Type: GS2::Enhance::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: 
    EnableAutoRun: true
    QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
  EnhanceScript: 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/enhance"
    "github.com/openlyinc/pointy"
)

SampleStack := core.NewStack()
enhance.NewNamespace(
    &SampleStack,
    "namespace-0001",
    enhance.NamespaceOptions{
        TransactionSetting: core.NewTransactionSetting(
            core.TransactionSettingOptions{
                QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
            },
        ),
        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\Enhance\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Enhance\Model\Options\NamespaceOptions(
                transactionSetting: new \Gs2Cdk\Core\Model\TransactionSetting(
                    new \Gs2Cdk\Core\Model\TransactionSettingOptions(
                        queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
                    )
                ),
                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.enhance.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.enhance.model.options.NamespaceOptions()
                        .withTransactionSetting(new io.gs2.cdk.core.model.TransactionSetting(
                            new io.gs2.cdk.core.model.options.TransactionSettingOptions()
                                .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
                        ))
                        .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.Gs2Enhance.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Enhance.Model.Options.NamespaceOptions
            {
                transactionSetting = new Gs2Cdk.Core.Model.TransactionSetting(
                    options: new Gs2Cdk.Core.Model.TransactionSettingOptions
                    {
                        queueNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
                    }
                ),
                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 enhance from "@/gs2cdk/enhance";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new enhance.model.Namespace(
            this,
            "namespace-0001",
            {
                transactionSetting: new core.TransactionSetting(
                    {
                        queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-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, enhance

class SampleStack(Stack):

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

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

TransactionSetting

トランザクション設定

トランザクション設定は、トランザクションの実行方法・整合性・非同期処理・競合回避の仕組みを制御する設定です。
自動実行(AutoRun)、アトミック実行(AtomicCommit)、非同期実行(Distributor)、スクリプト結果の一括適用、JobQueue による入手アクションの非同期化などを組み合わせ、ゲームロジックに応じた堅牢なトランザクション管理を可能にします。

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

ScriptSetting

スクリプト設定

GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。
このモデルは、スクリプトの実行をトリガーするための設定を保持します。

スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。
代わりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることができます。

一方、非同期実行ではスクリプトの完了を待つために処理がブロックされることはありません。
ただし、スクリプトの実行結果を利用して API の実行を停止したり、API の応答内容を変更することはできません。
非同期実行は API の応答フローに影響を与えないため、原則として非同期実行を推奨します。

非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。

有効化条件必須デフォルト値の制限説明
triggerScriptIdstring~ 1024文字同期実行スクリプトの GS2-Script のスクリプト GRN
「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。
doneTriggerTargetType文字列列挙型
enum {
  “none”,
  “gs2_script”,
  “aws”
}
“none”非同期スクリプトの実行方法
非同期実行で使用するスクリプトの種類を指定します。
「非同期実行のスクリプトを使用しない(none)」「GS2-Scriptを使用する(gs2_script)」「Amazon EventBridgeを使用する(aws)」が選択できます。
定義説明
“none”なし
“gs2_script”GS2-Script
“aws”Amazon EventBridge
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024文字非同期実行スクリプトの GS2-Script のスクリプト GRN
「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。

※ doneTriggerTargetType が “gs2_script” であれば 有効
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024文字非同期実行スクリプトを実行する GS2-JobQueue ネームスペース GRN
非同期実行スクリプトを直接実行するのではなく、GS2-JobQueue を経由する場合は GS2-JobQueue のネームスペースGRN を指定します。
GS2-JobQueue を利用する理由は多くはありませんので、特に理由がなければ指定する必要はありません。

※ doneTriggerTargetType が “gs2_script” であれば 有効

LogSetting

ログの書き出し設定

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

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

CurrentRateMaster

現在アクティブなマスターデータ

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

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

有効化条件必須デフォルト値の制限説明
namespaceIdstring
✓*
~ 1024文字ネームスペース GRN
※ サーバー側で自動的に設定
settingsstring
~ 5242880 バイト (5MB)マスターデータ

GetAttr

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

説明
ItemCurrentRateMaster更新した現在アクティブなレートモデルのマスターデータ

実装例

Type: GS2::Enhance::CurrentRateMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2020-08-22",
    "rateModels": [
      {
        "name": "character-friendly",
        "targetInventoryModelId": "grn:inventory:character",
        "acquireExperienceSuffix": ":friendly",
        "materialInventoryModelId": "grn:inventory:sweet",
        "experienceModelId": "grn:experience:friendly",
        "metadata": "CHARACTER_FRIENDLY",
        "acquireExperienceHierarchy": [
          "taste"
        ],
        "bonusRates": [
          {
            "rate": 1,
            "weight": 90
          }
        ]
      },
      {
        "name": "character-level",
        "targetInventoryModelId": "grn:inventory:character",
        "acquireExperienceSuffix": ":level",
        "materialInventoryModelId": "grn:inventory:material",
        "experienceModelId": "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
        "metadata": "CHARACTER_LEVEL",
        "acquireExperienceHierarchy": [
          "experience"
        ],
        "bonusRates": [
          {
            "rate": 1,
            "weight": 90
          },
          {
            "rate": 1.5,
            "weight": 9
          },
          {
            "rate": 2,
            "weight": 1
          }
        ]
      }
    ],
    "unleashRateModels": [
    ]
  }
  UploadToken: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/enhance"
    "github.com/openlyinc/pointy"
)

SampleStack := core.NewStack()
enhance.NewNamespace(
    &SampleStack,
    "namespace-0001",
    enhance.NamespaceOptions{},
).MasterData(
    []enhance.RateModel{
        enhance.NewRateModel(
            "character-friendly",
            "grn:inventory:character",
            ":friendly",
            "grn:inventory:sweet",
            "grn:experience:friendly",
            enhance.RateModelOptions{
                Metadata: pointy.String("CHARACTER_FRIENDLY"),
                AcquireExperienceHierarchy: []string{
                    "taste",
                },
                BonusRates: []enhance.BonusRate{
                    enhance.NewBonusRate(
                        1,
                        90,
                        enhance.BonusRateOptions{},
                    ),
                },
            },
        ),
        enhance.NewRateModel(
            "character-level",
            "grn:inventory:character",
            ":level",
            "grn:inventory:material",
            "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
            enhance.RateModelOptions{
                Metadata: pointy.String("CHARACTER_LEVEL"),
                AcquireExperienceHierarchy: []string{
                    "experience",
                },
                BonusRates: []enhance.BonusRate{
                    enhance.NewBonusRate(
                        1,
                        90,
                        enhance.BonusRateOptions{},
                    ),
                    enhance.NewBonusRate(
                        1.5,
                        9,
                        enhance.BonusRateOptions{},
                    ),
                    enhance.NewBonusRate(
                        2,
                        1,
                        enhance.BonusRateOptions{},
                    ),
                },
            },
        ),
    },
    []enhance.UnleashRateModel{
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Enhance\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Enhance\Model\RateModel(
                    name:"character-friendly",
                    targetInventoryModelId:"grn:inventory:character",
                    acquireExperienceSuffix:":friendly",
                    materialInventoryModelId:"grn:inventory:sweet",
                    experienceModelId:"grn:experience:friendly",
                    options: new \Gs2Cdk\Enhance\Model\Options\RateModelOptions(
                        metadata:"CHARACTER_FRIENDLY",
                        acquireExperienceHierarchy:[
                            "taste",
                        ],
                        bonusRates:[
                            new \Gs2Cdk\Enhance\Model\BonusRate(
                                rate: 1,
                                weight: 90,    
                            ),
                        ]
                    )
                ),
                new \Gs2Cdk\Enhance\Model\RateModel(
                    name:"character-level",
                    targetInventoryModelId:"grn:inventory:character",
                    acquireExperienceSuffix:":level",
                    materialInventoryModelId:"grn:inventory:material",
                    experienceModelId:"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
                    options: new \Gs2Cdk\Enhance\Model\Options\RateModelOptions(
                        metadata:"CHARACTER_LEVEL",
                        acquireExperienceHierarchy:[
                            "experience",
                        ],
                        bonusRates:[
                            new \Gs2Cdk\Enhance\Model\BonusRate(
                                rate: 1,
                                weight: 90,    
                            ),
                            new \Gs2Cdk\Enhance\Model\BonusRate(
                                rate: 1.5,
                                weight: 9,    
                            ),
                            new \Gs2Cdk\Enhance\Model\BonusRate(
                                rate: 2,
                                weight: 1,    
                            ),
                        ]
                    )
                )
            ],
            [
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.enhance.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.enhance.model.RateModel(
                    "character-friendly",
                    "grn:inventory:character",
                    ":friendly",
                    "grn:inventory:sweet",
                    "grn:experience:friendly",
                    new io.gs2.cdk.enhance.model.options.RateModelOptions()
                        .withMetadata("CHARACTER_FRIENDLY")
                        .withAcquireExperienceHierarchy(Arrays.asList(
                            "taste"
                        ))
                        .withBonusRates(Arrays.asList(
                            new io.gs2.cdk.enhance.model.BonusRate(
                                1f,
                                90        
                            )
                        ))
                ),
                new io.gs2.cdk.enhance.model.RateModel(
                    "character-level",
                    "grn:inventory:character",
                    ":level",
                    "grn:inventory:material",
                    "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
                    new io.gs2.cdk.enhance.model.options.RateModelOptions()
                        .withMetadata("CHARACTER_LEVEL")
                        .withAcquireExperienceHierarchy(Arrays.asList(
                            "experience"
                        ))
                        .withBonusRates(Arrays.asList(
                            new io.gs2.cdk.enhance.model.BonusRate(
                                1f,
                                90        
                            ),
                            new io.gs2.cdk.enhance.model.BonusRate(
                                1.5f,
                                9        
                            ),
                            new io.gs2.cdk.enhance.model.BonusRate(
                                2f,
                                1        
                            )
                        ))
                )
            ),
            Arrays.asList(
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Enhance.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Enhance.Model.RateModel[] {
                new Gs2Cdk.Gs2Enhance.Model.RateModel(
                    name: "character-friendly",
                    targetInventoryModelId: "grn:inventory:character",
                    acquireExperienceSuffix: ":friendly",
                    materialInventoryModelId: "grn:inventory:sweet",
                    experienceModelId: "grn:experience:friendly",
                    options: new Gs2Cdk.Gs2Enhance.Model.Options.RateModelOptions
                    {
                        metadata = "CHARACTER_FRIENDLY",
                        acquireExperienceHierarchy = new string[]
                        {
                            "taste"
                        },
                        bonusRates = new Gs2Cdk.Gs2Enhance.Model.BonusRate[]
                        {
                            new Gs2Cdk.Gs2Enhance.Model.BonusRate(
                                rate: 1f,
                                weight: 90    
                            )
                        }
                    }
                ),
                new Gs2Cdk.Gs2Enhance.Model.RateModel(
                    name: "character-level",
                    targetInventoryModelId: "grn:inventory:character",
                    acquireExperienceSuffix: ":level",
                    materialInventoryModelId: "grn:inventory:material",
                    experienceModelId: "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
                    options: new Gs2Cdk.Gs2Enhance.Model.Options.RateModelOptions
                    {
                        metadata = "CHARACTER_LEVEL",
                        acquireExperienceHierarchy = new string[]
                        {
                            "experience"
                        },
                        bonusRates = new Gs2Cdk.Gs2Enhance.Model.BonusRate[]
                        {
                            new Gs2Cdk.Gs2Enhance.Model.BonusRate(
                                rate: 1f,
                                weight: 90    
                            ),
                            new Gs2Cdk.Gs2Enhance.Model.BonusRate(
                                rate: 1.5f,
                                weight: 9    
                            ),
                            new Gs2Cdk.Gs2Enhance.Model.BonusRate(
                                rate: 2f,
                                weight: 1    
                            )
                        }
                    }
                )
            },
            new Gs2Cdk.Gs2Enhance.Model.UnleashRateModel[] {
            }
        );
    }
}

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

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new enhance.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new enhance.model.RateModel(
                    "character-friendly",
                    "grn:inventory:character",
                    ":friendly",
                    "grn:inventory:sweet",
                    "grn:experience:friendly",
                    {
                        metadata: "CHARACTER_FRIENDLY",
                        acquireExperienceHierarchy: [
                            "taste",
                        ],
                        bonusRates: [
                            new enhance.model.BonusRate(
                                1,
                                90        
                            ),
                        ]
                    }
                ),
                new enhance.model.RateModel(
                    "character-level",
                    "grn:inventory:character",
                    ":level",
                    "grn:inventory:material",
                    "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
                    {
                        metadata: "CHARACTER_LEVEL",
                        acquireExperienceHierarchy: [
                            "experience",
                        ],
                        bonusRates: [
                            new enhance.model.BonusRate(
                                1,
                                90        
                            ),
                            new enhance.model.BonusRate(
                                1.5,
                                9        
                            ),
                            new enhance.model.BonusRate(
                                2,
                                1        
                            ),
                        ]
                    }
                )
            ],
            [
            ]
        );
    }
}

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

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        enhance.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            rate_models=[
                enhance.RateModel(
                    name='character-friendly',
                    target_inventory_model_id='grn:inventory:character',
                    acquire_experience_suffix=':friendly',
                    material_inventory_model_id='grn:inventory:sweet',
                    experience_model_id='grn:experience:friendly',
                    options=enhance.RateModelOptions(
                        metadata = 'CHARACTER_FRIENDLY',
                        acquire_experience_hierarchy = [
                            'taste',
                        ],
                        bonus_rates = [
                            enhance.BonusRate(
                                rate=1,
                                weight=90,        
                            ),
                        ]
                    ),
                ),
                enhance.RateModel(
                    name='character-level',
                    target_inventory_model_id='grn:inventory:character',
                    acquire_experience_suffix=':level',
                    material_inventory_model_id='grn:inventory:material',
                    experience_model_id='grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level',
                    options=enhance.RateModelOptions(
                        metadata = 'CHARACTER_LEVEL',
                        acquire_experience_hierarchy = [
                            'experience',
                        ],
                        bonus_rates = [
                            enhance.BonusRate(
                                rate=1,
                                weight=90,        
                            ),
                            enhance.BonusRate(
                                rate=1.5,
                                weight=9,        
                            ),
                            enhance.BonusRate(
                                rate=2,
                                weight=1,        
                            ),
                        ]
                    ),
                ),
            ],
            unleash_rate_models=[
            ],
        )

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

RateModel

強化レートモデル

強化レートは強化に使用する素材と強化対象を定義したデータです。

素材データ、強化対象データは共に GS2-Inventory で管理されている必要があります。
強化で得られる経験値は GS2-Inventory のメタデータにJSON形式で記録します。
ここではメタデータのどの階層に経験値の値が格納されているかを記載する必要があります。

強化時に一定の確率で 大成功 といった形で入手できる経験値量に補正値をかけることができます。
その抽選確率もこのエンティティで定義します。

有効化条件必須デフォルト値の制限説明
rateModelIdstring
✓*
~ 1024文字強化レートモデル GRN
※ サーバー側で自動的に設定
namestring
~ 128文字強化レート名
descriptionstring~ 1024文字説明文
metadatastring~ 2048文字メタデータ
targetInventoryModelIdstring
~ 1024文字強化対象に使用できるインベントリモデルの GRN
acquireExperienceSuffixstring
~ 1024文字GS2-Experience で入手した経験値を格納する プロパティID に付与するサフィックス
materialInventoryModelIdstring
~ 1024文字強化の素材に使用できるインベントリの GRN
acquireExperienceHierarchyList<string>0 ~ 10 itemsItemModelのメタデータに格納する、入手経験値を定義するJSONデータの階層構造の定義
GS2-EnhanceにはGS2-Inventoryと連携して強化を行う仕組みがあり、ItemModelのメタデータにJSON形式で、強化素材として使用した場合の経験値量を設定します。
例えば、{ “aaa”: { “bbb”: { “experienceValue”: 100 } } } というような構造のデータ定義でメタデータに設定したい場合は、[ “aaa”, “bbb”, “experienceValue” ] のように指定します。
詳細は マイクロサービス紹介 / GS2-Enhance の項で解説しています。
experienceModelIdstring
~ 1024文字経験値モデル GRN
bonusRatesList<BonusRate>0 ~ 1000 items経験値獲得量ボーナス

BonusRate

経験値獲得量ボーナス

有効化条件必須デフォルト値の制限説明
ratefloat
1.00 ~ 10000経験値ボーナスの倍率(1.0=ボーナスなし)
weightint
10 ~ 2147483645抽選重み

UnleashRateModel

限界突破レート

限界突破レートは限界突破の対象と GS2-Grade 限界突破モデルを定義したデータです。
限界突破の対象データは GS2-Inventory で管理されている必要があります。

有効化条件必須デフォルト値の制限説明
unleashRateModelIdstring
✓*
~ 1024文字限界突破レートモデル GRN
※ サーバー側で自動的に設定
namestring
~ 128文字限界突破レート名
descriptionstring~ 1024文字説明文
metadatastring~ 2048文字メタデータ
targetInventoryModelIdstring
~ 1024文字限界突破対象に使用できるインベントリ
gradeModelIdstring
~ 1024文字グレードモデル
gradeEntriesList<UnleashRateEntryModel>
1 ~ 1000 itemsグレードエントリリスト

UnleashRateEntryModel

限界突破レートエントリモデル

有効化条件必須デフォルト値の制限説明
gradeValuelong
1 ~ 1000対象グレード
needCountint
1 ~ 1000同種のアイテムを何個消費するか