GS2-Deploy/CDK Reference of GS2-Stamina

Entities

Namespace

Namespace

Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.

Therefore, it is necessary to create a namespace before starting to use each service.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
overflowTriggerScriptstring~ 1024 charsGS2-Script to handle overflow stamina during recovery process
logSettingLogSettingLog output settings

GetAttr

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Stamina::Namespace
Properties:
  Name: namespace1
  Description: null
  OverflowTriggerScript: grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1
from gs2_cdk import Stack, core, stamina

class SampleStack(Stack):

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

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Stamina\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Stamina\Model\Options\NamespaceOptions(
                overflowTriggerScript: "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script",
                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.stamina.model.Namespace(
            this,
            "namespace-0001",
            new io.gs2.cdk.stamina.model.options.NamespaceOptions() {
                {
                    overflowTriggerScript = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script";
                    logSetting = new io.gs2.cdk.core.model.LogSetting(
                        loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                    );
                }
            }
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
import core from "@/gs2cdk/core";
import stamina from "@/gs2cdk/stamina";

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

console.log(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Stamina.Model.Namespace(
            this,
            "namespace-0001",
            new Gs2Cdk.Gs2Stamina.Model.Options.NamespaceOptions {
                overflowTriggerScript = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script",
                logSetting = new Gs2Cdk.Core.Model.LogSetting(
                    LoggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

CurrentStaminaMaster

Currently available master data

GS2 uses JSON format files for master data management. By uploading the file, you can actually reflect the settings on the server.

We provide a master data editor on the management console as a way to create JSON files, but you can also create JSON files using the The service can also be used by creating a tool more appropriate for game management and exporting a JSON file in the appropriate format.

Please refer to the documentation for the format of the JSON file.

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
settingsstring~ 5242880 charsMaster data

GetAttr

TypeDescription
ItemCurrentStaminaMasterUpdated and currently available Stamina Master

Implementation Example

Type: GS2::Stamina::CurrentStaminaMaster
Properties:
  NamespaceName: namespace1
  Settings: {
    "version": "2019-02-14",
    "staminaModels": [
      {
        "name": "quest",
        "recoverIntervalMinutes": 15,
        "recoverValue": 1,
        "initialCapacity": 50,
        "isOverflow": true,
        "metadata": "QUEST",
        "maxCapacity": 999,
        "maxStaminaTable":
          {
            "name": "playerLevel",
            "metadata": "PLAYER_LEVEL",
            "experienceModelId": "playerLevel",
            "values": [
              51,
              52,
              53,
              54,
              55,
              56,
              57,
              58,
              59,
              60,
              61,
              62,
              63,
              64,
              65,
              66,
              67,
              68,
              69,
              70,
              71,
              72,
              73,
              74,
              75,
              76,
              77,
              78,
              79,
              80,
              81,
              82,
              83,
              84,
              85,
              86,
              87,
              88,
              89,
              90,
              91,
              92,
              93,
              94,
              95,
              96,
              97,
              98,
              99,
              100,
              101,
              102,
              103,
              104,
              105,
              106,
              107,
              108,
              109,
              110,
              111,
              112,
              113,
              114,
              115,
              116,
              117,
              118,
              119,
              120,
              121,
              122,
              123,
              124,
              125,
              126,
              127,
              128,
              129
            ]
          },
        "recoverIntervalTable":
          {
            "name": "staminaRecoverInterval",
            "metadata": "STAMINA_RECOVER_INTERVAL",
            "experienceModelId": "playerLevel",
            "values": [
              41,
              42,
              43,
              44,
              45,
              46,
              47,
              48,
              49,
              50,
              51,
              52,
              53,
              54,
              55,
              56,
              57,
              58,
              59,
              60,
              61,
              62,
              63,
              64,
              65,
              66,
              67,
              68,
              69,
              70,
              71,
              72,
              73,
              74,
              75,
              76,
              77,
              78,
              79,
              80,
              81,
              82,
              83,
              84,
              85,
              86,
              87,
              88,
              89,
              90,
              91,
              92,
              93,
              94,
              95,
              96,
              97,
              98,
              99,
              100,
              101,
              102,
              103,
              104,
              105,
              106,
              107,
              108,
              109,
              110,
              111,
              112,
              113,
              114,
              115,
              116,
              117,
              118,
              119
            ]
          },
        "recoverValueTable":
          {
            "name": "staminaRecoverValue",
            "metadata": "STAMINA_RECOVER_VALUE",
            "experienceModelId": "playerLevel",
            "values": [
              31,
              32,
              33,
              34,
              35,
              36,
              37,
              38,
              39,
              40,
              41,
              42,
              43,
              44,
              45,
              46,
              47,
              48,
              49,
              50,
              51,
              52,
              53,
              54,
              55,
              56,
              57,
              58,
              59,
              60,
              61,
              62,
              63,
              64,
              65,
              66,
              67,
              68,
              69,
              70,
              71,
              72,
              73,
              74,
              75,
              76,
              77,
              78,
              79,
              80,
              81,
              82,
              83,
              84,
              85,
              86,
              87,
              88,
              89,
              90,
              91,
              92,
              93,
              94,
              95,
              96,
              97,
              98,
              99,
              100,
              101,
              102,
              103,
              104,
              105,
              106,
              107,
              108,
              109
            ]
          }
      },
      {
        "name": "raidBattle",
        "recoverIntervalMinutes": 60,
        "recoverValue": 1,
        "initialCapacity": 10,
        "metadata": "RAID_BATTLE"
      },
      {
        "name": "special",
        "recoverIntervalMinutes": 30,
        "recoverValue": 3,
        "initialCapacity": 100,
        "isOverflow": true,
        "metadata": "SPECIAL",
        "maxCapacity": 999,
        "maxStaminaTable":
          {
            "name": "special",
            "metadata": "SPECIAL",
            "experienceModelId": "special",
            "values": [
              102,
              104,
              106,
              108,
              110,
              112,
              114,
              116,
              118,
              120,
              122,
              124,
              126,
              128,
              130,
              132,
              134,
              136,
              138,
              140,
              142,
              144,
              146,
              148,
              150,
              152,
              154,
              156,
              158,
              160,
              162,
              164,
              166,
              168,
              170,
              172,
              174,
              176,
              178,
              180,
              182,
              184,
              186,
              188,
              190,
              192,
              194,
              196,
              198,
              200,
              202,
              204,
              206,
              208,
              210,
              212,
              214,
              216,
              218,
              220,
              222,
              224,
              226,
              228,
              230,
              232,
              234,
              236,
              238,
              240,
              242,
              244,
              246,
              248,
              250,
              252,
              254,
              256,
              258
            ]
          }
      }
    ]
  }
from gs2_cdk import Stack, core, stamina

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        stamina.Namespace(
            stack=self,
            # omission
        ).master_data(
            stamina_models=[
                stamina.StaminaModel(
                    name='quest',
                    recover_interval_minutes=15,
                    recover_value=1,
                    initial_capacity=50,
                    is_overflow=True,
                    options=stamina.StaminaModelOptions(
                        metadata='QUEST',
                        max_capacity=999,
                        max_stamina_table=stamina.MaxStaminaTable(
                            name='playerLevel',
                            metadata='PLAYER_LEVEL',
                            experience_model_id='playerLevel',
                            values=[
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109,
                                110,
                                111,
                                112,
                                113,
                                114,
                                115,
                                116,
                                117,
                                118,
                                119,
                                120,
                                121,
                                122,
                                123,
                                124,
                                125,
                                126,
                                127,
                                128,
                                129
                            ]
                        ),
                        recover_interval_table=stamina.RecoverIntervalTable(
                            name='staminaRecoverInterval',
                            metadata='STAMINA_RECOVER_INTERVAL',
                            experience_model_id='playerLevel',
                            values=[
                                41,
                                42,
                                43,
                                44,
                                45,
                                46,
                                47,
                                48,
                                49,
                                50,
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109,
                                110,
                                111,
                                112,
                                113,
                                114,
                                115,
                                116,
                                117,
                                118,
                                119
                            ]
                        ),
                        recover_value_table=stamina.RecoverValueTable(
                            name='staminaRecoverValue',
                            metadata='STAMINA_RECOVER_VALUE',
                            experience_model_id='playerLevel',
                            values=[
                                31,
                                32,
                                33,
                                34,
                                35,
                                36,
                                37,
                                38,
                                39,
                                40,
                                41,
                                42,
                                43,
                                44,
                                45,
                                46,
                                47,
                                48,
                                49,
                                50,
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109
                            ]
                        ),
                    ),
                ),
                stamina.StaminaModel(
                    name='raidBattle',
                    recover_interval_minutes=60,
                    recover_value=1,
                    initial_capacity=10,
                    options=stamina.StaminaModelOptions(
                        metadata='RAID_BATTLE',
                    ),
                ),
                stamina.StaminaModel(
                    name='special',
                    recover_interval_minutes=30,
                    recover_value=3,
                    initial_capacity=100,
                    is_overflow=True,
                    options=stamina.StaminaModelOptions(
                        metadata='SPECIAL',
                        max_capacity=999,
                        max_stamina_table=stamina.MaxStaminaTable(
                            name='special',
                            metadata='SPECIAL',
                            experience_model_id='special',
                            values=[
                                102,
                                104,
                                106,
                                108,
                                110,
                                112,
                                114,
                                116,
                                118,
                                120,
                                122,
                                124,
                                126,
                                128,
                                130,
                                132,
                                134,
                                136,
                                138,
                                140,
                                142,
                                144,
                                146,
                                148,
                                150,
                                152,
                                154,
                                156,
                                158,
                                160,
                                162,
                                164,
                                166,
                                168,
                                170,
                                172,
                                174,
                                176,
                                178,
                                180,
                                182,
                                184,
                                186,
                                188,
                                190,
                                192,
                                194,
                                196,
                                198,
                                200,
                                202,
                                204,
                                206,
                                208,
                                210,
                                212,
                                214,
                                216,
                                218,
                                220,
                                222,
                                224,
                                226,
                                228,
                                230,
                                232,
                                234,
                                236,
                                238,
                                240,
                                242,
                                244,
                                246,
                                248,
                                250,
                                252,
                                254,
                                256,
                                258
                            ]
                        ),
                    ),
                ),
            ],
        )

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Stamina\Model\Namespace_(
            stack: $this,
            // omission
        ))->masterData(
            [
                new \Gs2Cdk\Stamina\Model\StaminaModel(
                    name:"quest",
                    recoverIntervalMinutes:15,
                    recoverValue:1,
                    initialCapacity:50,
                    isOverflow:True,
                    options: new \Gs2Cdk\Stamina\Model\Options\StaminaModelOptions(
                        metadata:"QUEST",
                        maxCapacity:999,
                        maxStaminaTable:new \Gs2Cdk\Stamina\Model\MaxStaminaTable(
                            name: "playerLevel",
                            metadata: "PLAYER_LEVEL",
                            experienceModelId: "playerLevel",
                            values: [
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109,
                                110,
                                111,
                                112,
                                113,
                                114,
                                115,
                                116,
                                117,
                                118,
                                119,
                                120,
                                121,
                                122,
                                123,
                                124,
                                125,
                                126,
                                127,
                                128,
                                129
                            ]
                        ),
                        recoverIntervalTable:new \Gs2Cdk\Stamina\Model\RecoverIntervalTable(
                            name: "staminaRecoverInterval",
                            metadata: "STAMINA_RECOVER_INTERVAL",
                            experienceModelId: "playerLevel",
                            values: [
                                41,
                                42,
                                43,
                                44,
                                45,
                                46,
                                47,
                                48,
                                49,
                                50,
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109,
                                110,
                                111,
                                112,
                                113,
                                114,
                                115,
                                116,
                                117,
                                118,
                                119
                            ]
                        ),
                        recoverValueTable:new \Gs2Cdk\Stamina\Model\RecoverValueTable(
                            name: "staminaRecoverValue",
                            metadata: "STAMINA_RECOVER_VALUE",
                            experienceModelId: "playerLevel",
                            values: [
                                31,
                                32,
                                33,
                                34,
                                35,
                                36,
                                37,
                                38,
                                39,
                                40,
                                41,
                                42,
                                43,
                                44,
                                45,
                                46,
                                47,
                                48,
                                49,
                                50,
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109
                            ]
                        )
                    )
                ),
                new \Gs2Cdk\Stamina\Model\StaminaModel(
                    name:"raidBattle",
                    recoverIntervalMinutes:60,
                    recoverValue:1,
                    initialCapacity:10,
                    options: new \Gs2Cdk\Stamina\Model\Options\StaminaModelOptions(
                        metadata:"RAID_BATTLE"
                    )
                ),
                new \Gs2Cdk\Stamina\Model\StaminaModel(
                    name:"special",
                    recoverIntervalMinutes:30,
                    recoverValue:3,
                    initialCapacity:100,
                    isOverflow:True,
                    options: new \Gs2Cdk\Stamina\Model\Options\StaminaModelOptions(
                        metadata:"SPECIAL",
                        maxCapacity:999,
                        maxStaminaTable:new \Gs2Cdk\Stamina\Model\MaxStaminaTable(
                            name: "special",
                            metadata: "SPECIAL",
                            experienceModelId: "special",
                            values: [
                                102,
                                104,
                                106,
                                108,
                                110,
                                112,
                                114,
                                116,
                                118,
                                120,
                                122,
                                124,
                                126,
                                128,
                                130,
                                132,
                                134,
                                136,
                                138,
                                140,
                                142,
                                144,
                                146,
                                148,
                                150,
                                152,
                                154,
                                156,
                                158,
                                160,
                                162,
                                164,
                                166,
                                168,
                                170,
                                172,
                                174,
                                176,
                                178,
                                180,
                                182,
                                184,
                                186,
                                188,
                                190,
                                192,
                                194,
                                196,
                                198,
                                200,
                                202,
                                204,
                                206,
                                208,
                                210,
                                212,
                                214,
                                216,
                                218,
                                220,
                                222,
                                224,
                                226,
                                228,
                                230,
                                232,
                                234,
                                236,
                                238,
                                240,
                                242,
                                244,
                                246,
                                248,
                                250,
                                252,
                                254,
                                256,
                                258
                            ]
                        )
                    )
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.stamina.model.Namespace(
            this,
            // omission
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.stamina.model.StaminaModel(
                    "quest",
                    15,
                    1,
                    50,
                    true,
                    new io.gs2.cdk.stamina.model.options.StaminaModelOptions() {
                        {
                            metadata: "QUEST";
                            maxCapacity: 999;
                            maxStaminaTable: new io.gs2.cdk.stamina.model.MaxStaminaTable(
                                "playerLevel",
                                "PLAYER_LEVEL",
                                "playerLevel",
                                Arrays.asList(
                                    51,
                                    52,
                                    53,
                                    54,
                                    55,
                                    56,
                                    57,
                                    58,
                                    59,
                                    60,
                                    61,
                                    62,
                                    63,
                                    64,
                                    65,
                                    66,
                                    67,
                                    68,
                                    69,
                                    70,
                                    71,
                                    72,
                                    73,
                                    74,
                                    75,
                                    76,
                                    77,
                                    78,
                                    79,
                                    80,
                                    81,
                                    82,
                                    83,
                                    84,
                                    85,
                                    86,
                                    87,
                                    88,
                                    89,
                                    90,
                                    91,
                                    92,
                                    93,
                                    94,
                                    95,
                                    96,
                                    97,
                                    98,
                                    99,
                                    100,
                                    101,
                                    102,
                                    103,
                                    104,
                                    105,
                                    106,
                                    107,
                                    108,
                                    109,
                                    110,
                                    111,
                                    112,
                                    113,
                                    114,
                                    115,
                                    116,
                                    117,
                                    118,
                                    119,
                                    120,
                                    121,
                                    122,
                                    123,
                                    124,
                                    125,
                                    126,
                                    127,
                                    128,
                                    129
                                )
                            );
                            recoverIntervalTable: new io.gs2.cdk.stamina.model.RecoverIntervalTable(
                                "staminaRecoverInterval",
                                "STAMINA_RECOVER_INTERVAL",
                                "playerLevel",
                                Arrays.asList(
                                    41,
                                    42,
                                    43,
                                    44,
                                    45,
                                    46,
                                    47,
                                    48,
                                    49,
                                    50,
                                    51,
                                    52,
                                    53,
                                    54,
                                    55,
                                    56,
                                    57,
                                    58,
                                    59,
                                    60,
                                    61,
                                    62,
                                    63,
                                    64,
                                    65,
                                    66,
                                    67,
                                    68,
                                    69,
                                    70,
                                    71,
                                    72,
                                    73,
                                    74,
                                    75,
                                    76,
                                    77,
                                    78,
                                    79,
                                    80,
                                    81,
                                    82,
                                    83,
                                    84,
                                    85,
                                    86,
                                    87,
                                    88,
                                    89,
                                    90,
                                    91,
                                    92,
                                    93,
                                    94,
                                    95,
                                    96,
                                    97,
                                    98,
                                    99,
                                    100,
                                    101,
                                    102,
                                    103,
                                    104,
                                    105,
                                    106,
                                    107,
                                    108,
                                    109,
                                    110,
                                    111,
                                    112,
                                    113,
                                    114,
                                    115,
                                    116,
                                    117,
                                    118,
                                    119
                                )
                            );
                            recoverValueTable: new io.gs2.cdk.stamina.model.RecoverValueTable(
                                "staminaRecoverValue",
                                "STAMINA_RECOVER_VALUE",
                                "playerLevel",
                                Arrays.asList(
                                    31,
                                    32,
                                    33,
                                    34,
                                    35,
                                    36,
                                    37,
                                    38,
                                    39,
                                    40,
                                    41,
                                    42,
                                    43,
                                    44,
                                    45,
                                    46,
                                    47,
                                    48,
                                    49,
                                    50,
                                    51,
                                    52,
                                    53,
                                    54,
                                    55,
                                    56,
                                    57,
                                    58,
                                    59,
                                    60,
                                    61,
                                    62,
                                    63,
                                    64,
                                    65,
                                    66,
                                    67,
                                    68,
                                    69,
                                    70,
                                    71,
                                    72,
                                    73,
                                    74,
                                    75,
                                    76,
                                    77,
                                    78,
                                    79,
                                    80,
                                    81,
                                    82,
                                    83,
                                    84,
                                    85,
                                    86,
                                    87,
                                    88,
                                    89,
                                    90,
                                    91,
                                    92,
                                    93,
                                    94,
                                    95,
                                    96,
                                    97,
                                    98,
                                    99,
                                    100,
                                    101,
                                    102,
                                    103,
                                    104,
                                    105,
                                    106,
                                    107,
                                    108,
                                    109
                                )
                            );
                        }
                    }
                ),
                new io.gs2.cdk.stamina.model.StaminaModel(
                    "raidBattle",
                    60,
                    1,
                    10,
                    new io.gs2.cdk.stamina.model.options.StaminaModelOptions() {
                        {
                            metadata: "RAID_BATTLE";
                        }
                    }
                ),
                new io.gs2.cdk.stamina.model.StaminaModel(
                    "special",
                    30,
                    3,
                    100,
                    true,
                    new io.gs2.cdk.stamina.model.options.StaminaModelOptions() {
                        {
                            metadata: "SPECIAL";
                            maxCapacity: 999;
                            maxStaminaTable: new io.gs2.cdk.stamina.model.MaxStaminaTable(
                                "special",
                                "SPECIAL",
                                "special",
                                Arrays.asList(
                                    102,
                                    104,
                                    106,
                                    108,
                                    110,
                                    112,
                                    114,
                                    116,
                                    118,
                                    120,
                                    122,
                                    124,
                                    126,
                                    128,
                                    130,
                                    132,
                                    134,
                                    136,
                                    138,
                                    140,
                                    142,
                                    144,
                                    146,
                                    148,
                                    150,
                                    152,
                                    154,
                                    156,
                                    158,
                                    160,
                                    162,
                                    164,
                                    166,
                                    168,
                                    170,
                                    172,
                                    174,
                                    176,
                                    178,
                                    180,
                                    182,
                                    184,
                                    186,
                                    188,
                                    190,
                                    192,
                                    194,
                                    196,
                                    198,
                                    200,
                                    202,
                                    204,
                                    206,
                                    208,
                                    210,
                                    212,
                                    214,
                                    216,
                                    218,
                                    220,
                                    222,
                                    224,
                                    226,
                                    228,
                                    230,
                                    232,
                                    234,
                                    236,
                                    238,
                                    240,
                                    242,
                                    244,
                                    246,
                                    248,
                                    250,
                                    252,
                                    254,
                                    256,
                                    258
                                )
                            );
                        }
                    }
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
import core from "@/gs2cdk/core";
import stamina from "@/gs2cdk/stamina";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new stamina.model.Namespace(
            this,
            // omission
        ).masterData(
            [
                new stamina.model.StaminaModel(
                    "quest",
                    15,
                    1,
                    50,
                    true,
                    {
                        metadata: "QUEST",
                        maxCapacity: 999,
                        maxStaminaTable: new stamina.model.MaxStaminaTable(
                            "playerLevel",
                            "PLAYER_LEVEL",
                            "playerLevel",
                            new number[
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109,
                                110,
                                111,
                                112,
                                113,
                                114,
                                115,
                                116,
                                117,
                                118,
                                119,
                                120,
                                121,
                                122,
                                123,
                                124,
                                125,
                                126,
                                127,
                                128,
                                129
                            ]
                        ),
                        recoverIntervalTable: new stamina.model.RecoverIntervalTable(
                            "staminaRecoverInterval",
                            "STAMINA_RECOVER_INTERVAL",
                            "playerLevel",
                            new number[
                                41,
                                42,
                                43,
                                44,
                                45,
                                46,
                                47,
                                48,
                                49,
                                50,
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109,
                                110,
                                111,
                                112,
                                113,
                                114,
                                115,
                                116,
                                117,
                                118,
                                119
                            ]
                        ),
                        recoverValueTable: new stamina.model.RecoverValueTable(
                            "staminaRecoverValue",
                            "STAMINA_RECOVER_VALUE",
                            "playerLevel",
                            new number[
                                31,
                                32,
                                33,
                                34,
                                35,
                                36,
                                37,
                                38,
                                39,
                                40,
                                41,
                                42,
                                43,
                                44,
                                45,
                                46,
                                47,
                                48,
                                49,
                                50,
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109
                            ]
                        )
                    }
                ),
                new stamina.model.StaminaModel(
                    "raidBattle",
                    60,
                    1,
                    10,
                    {
                        metadata: "RAID_BATTLE"
                    }
                ),
                new stamina.model.StaminaModel(
                    "special",
                    30,
                    3,
                    100,
                    true,
                    {
                        metadata: "SPECIAL",
                        maxCapacity: 999,
                        maxStaminaTable: new stamina.model.MaxStaminaTable(
                            "special",
                            "SPECIAL",
                            "special",
                            new number[
                                102,
                                104,
                                106,
                                108,
                                110,
                                112,
                                114,
                                116,
                                118,
                                120,
                                122,
                                124,
                                126,
                                128,
                                130,
                                132,
                                134,
                                136,
                                138,
                                140,
                                142,
                                144,
                                146,
                                148,
                                150,
                                152,
                                154,
                                156,
                                158,
                                160,
                                162,
                                164,
                                166,
                                168,
                                170,
                                172,
                                174,
                                176,
                                178,
                                180,
                                182,
                                184,
                                186,
                                188,
                                190,
                                192,
                                194,
                                196,
                                198,
                                200,
                                202,
                                204,
                                206,
                                208,
                                210,
                                212,
                                214,
                                216,
                                218,
                                220,
                                222,
                                224,
                                226,
                                228,
                                230,
                                232,
                                234,
                                236,
                                238,
                                240,
                                242,
                                244,
                                246,
                                248,
                                250,
                                252,
                                254,
                                256,
                                258
                            ]
                        )
                    }
                )
            ]
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Stamina.Model.Namespace(
            this,
            // omission
        ).MasterData(
            new [] {
                new Gs2Cdk.Gs2Stamina.Model.StaminaModel(
                    "quest",
                    15,
                    1,
                    50,
                    true,
                    new Gs2Cdk.Gs2Stamina.Model.Options.StaminaModelOptions {
                        metadata = "QUEST",
                        maxCapacity = 999,
                        maxStaminaTable = new Gs2Cdk.Gs2Stamina.Model.MaxStaminaTable(
                            name: "playerLevel",
                            metadata: "PLAYER_LEVEL",
                            experienceModelId: "playerLevel",
                            values: new int[] {
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109,
                                110,
                                111,
                                112,
                                113,
                                114,
                                115,
                                116,
                                117,
                                118,
                                119,
                                120,
                                121,
                                122,
                                123,
                                124,
                                125,
                                126,
                                127,
                                128,
                                129
                            }
                        ),
                        recoverIntervalTable = new Gs2Cdk.Gs2Stamina.Model.RecoverIntervalTable(
                            name: "staminaRecoverInterval",
                            metadata: "STAMINA_RECOVER_INTERVAL",
                            experienceModelId: "playerLevel",
                            values: new int[] {
                                41,
                                42,
                                43,
                                44,
                                45,
                                46,
                                47,
                                48,
                                49,
                                50,
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109,
                                110,
                                111,
                                112,
                                113,
                                114,
                                115,
                                116,
                                117,
                                118,
                                119
                            }
                        ),
                        recoverValueTable = new Gs2Cdk.Gs2Stamina.Model.RecoverValueTable(
                            name: "staminaRecoverValue",
                            metadata: "STAMINA_RECOVER_VALUE",
                            experienceModelId: "playerLevel",
                            values: new int[] {
                                31,
                                32,
                                33,
                                34,
                                35,
                                36,
                                37,
                                38,
                                39,
                                40,
                                41,
                                42,
                                43,
                                44,
                                45,
                                46,
                                47,
                                48,
                                49,
                                50,
                                51,
                                52,
                                53,
                                54,
                                55,
                                56,
                                57,
                                58,
                                59,
                                60,
                                61,
                                62,
                                63,
                                64,
                                65,
                                66,
                                67,
                                68,
                                69,
                                70,
                                71,
                                72,
                                73,
                                74,
                                75,
                                76,
                                77,
                                78,
                                79,
                                80,
                                81,
                                82,
                                83,
                                84,
                                85,
                                86,
                                87,
                                88,
                                89,
                                90,
                                91,
                                92,
                                93,
                                94,
                                95,
                                96,
                                97,
                                98,
                                99,
                                100,
                                101,
                                102,
                                103,
                                104,
                                105,
                                106,
                                107,
                                108,
                                109
                            }
                        )
                    }
                ),
                new Gs2Cdk.Gs2Stamina.Model.StaminaModel(
                    "raidBattle",
                    60,
                    1,
                    10,
                    new Gs2Cdk.Gs2Stamina.Model.Options.StaminaModelOptions {
                        metadata = "RAID_BATTLE"
                    }
                ),
                new Gs2Cdk.Gs2Stamina.Model.StaminaModel(
                    "special",
                    30,
                    3,
                    100,
                    true,
                    new Gs2Cdk.Gs2Stamina.Model.Options.StaminaModelOptions {
                        metadata = "SPECIAL",
                        maxCapacity = 999,
                        maxStaminaTable = new Gs2Cdk.Gs2Stamina.Model.MaxStaminaTable(
                            name: "special",
                            metadata: "SPECIAL",
                            experienceModelId: "special",
                            values: new int[] {
                                102,
                                104,
                                106,
                                108,
                                110,
                                112,
                                114,
                                116,
                                118,
                                120,
                                122,
                                124,
                                126,
                                128,
                                130,
                                132,
                                134,
                                136,
                                138,
                                140,
                                142,
                                144,
                                146,
                                148,
                                150,
                                152,
                                154,
                                156,
                                158,
                                160,
                                162,
                                164,
                                166,
                                168,
                                170,
                                172,
                                174,
                                176,
                                178,
                                180,
                                182,
                                184,
                                186,
                                188,
                                190,
                                192,
                                194,
                                196,
                                198,
                                200,
                                202,
                                204,
                                206,
                                208,
                                210,
                                212,
                                214,
                                216,
                                218,
                                220,
                                222,
                                224,
                                226,
                                228,
                                230,
                                232,
                                234,
                                236,
                                238,
                                240,
                                242,
                                244,
                                246,
                                248,
                                250,
                                252,
                                254,
                                256,
                                258
                            }
                        )
                    }
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

GitHubCheckoutSetting

Setup to check out master data from GitHub

TypeRequireDefaultLimitationDescription
apiKeyIdstring~ 1024 charsGitHub API key GRN
repositoryNamestring~ 1024 charsRepository Name
sourcePathstring~ 1024 charsSource code file path
referenceTypeenum [
“commit_hash”,
“branch”,
“tag”
]
~ 128 charsSource of code
commitHashstring{referenceType} == “commit_hash”~ 1024 charsCommit hash
branchNamestring{referenceType} == “branch”~ 1024 charsBranch Name
tagNamestring{referenceType} == “tag”~ 1024 charsTag Name

LogSetting

Log setting

This type manages log output settings. This type holds the identifier of the log namespace used to output log data. The log namespace ID specifies the GS2-Log namespace to aggregate and store the log data. Through this setting, API request and response log data under this namespace will be output to the target GS2-Log. GS2-Log provides logs in real time, which can be used for system monitoring, analysis, debugging, etc.

TypeRequireDefaultLimitationDescription
loggingNamespaceIdstring~ 1024 charsNamespace GRN

ScriptSetting

Script settings

In GS2, you can associate custom scripts with microservice events and execute them. This model holds the settings for triggering script execution.

There are two main ways to execute a script: synchronous execution and asynchronous execution. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API.

On the other hand, asynchronous execution does not block processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API. However, asynchronous execution does not block processing until the script has finished executing, so it is generally recommended to use asynchronous execution.

There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.

TypeRequireDefaultLimitationDescription
triggerScriptIdstring~ 1024 charsScript GRN
doneTriggerTargetTypeenum [
“none”,
“gs2_script”,
“aws”
]
“none”~ 128 charsNotification of Completion
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsScript GRN
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsNamespace GRN