GS2-Deploy/CDK Reference of GS2-Lottery
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.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 32 chars | Namespace name | |
description | string | ~ 1024 chars | description of Namespace | ||
transactionSetting | TransactionSetting | ✓ | Transaction settings | ||
lotteryTriggerScriptId | string | ~ 1024 chars | GS2-Script scripts to be called when the lottery is executed | ||
choicePrizeTableScriptId | string | ~ 1024 chars | GS2-Script script for dynamically determining lottery probability tables | ||
logSetting | LogSetting | Log output settings |
GetAttr
Type | Description | |
---|---|---|
Item | Namespace | Namespace created |
Implementation Example
Type: GS2::Lottery::Namespace
Properties:
Name: namespace1
Description: null
TransactionSetting:
EnableAutoRun: false
QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
KeyId: grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001
LotteryTriggerScriptId: null
ChoicePrizeTableScriptId: null
LogSetting:
LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1
from gs2_cdk import Stack, core, lottery
class SampleStack(Stack):
def __init__(self):
super().__init__()
lottery.Namespace(
stack=self,
name="namespace-0001",
transaction_setting=core.TransactionSetting(
enable_auto_run=False,
options=core.TransactionSettingOptions(
distributor_namespace_id=,
key_id='grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001',
queue_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001',
)
),
options=lottery.NamespaceOptions(
log_setting=core.LogSetting(
logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
),
),
)
print(SampleStack().yaml()) # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Lottery\Model\Namespace_(
stack: $this,
name: "namespace-0001",
transactionSetting: new \Gs2Cdk\Core\Model\TransactionSetting(
enableAutoRun: False,
options: new \Gs2Cdk\Core\Model\Options\TransactionSettingOptions(
distributorNamespaceId: ,
keyId: "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001",
queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
)
),
options: new \Gs2Cdk\Lottery\Model\Options\NamespaceOptions(
logSetting: new \Gs2Cdk\Core\Model\LogSetting(
loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
),
),
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.lottery.model.Namespace(
this,
"namespace-0001",
new io.gs2.cdk.core.model.TransactionSetting(
false,
new io.gs2.cdk.core.model.options.TransactionSettingOptions(
,
"grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001",
"grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
)
),
new io.gs2.cdk.lottery.model.options.NamespaceOptions() {
{
logSetting = new io.gs2.cdk.core.model.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
);
}
}
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Template
import core from "@/gs2cdk/core";
import lottery from "@/gs2cdk/lottery";
class SampleStack extends core.Stack
{
public constructor() {
super();
new lottery.model.Namespace(
this,
"namespace-0001",
new core.TransactionSetting(
false,
{
,
"grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001",
"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
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Lottery.Model.Namespace(
this,
"namespace-0001",
new Gs2Cdk.Core.Model.TransactionSetting(
false,
new Gs2Cdk.Core.Model.Options.TransactionSettingOptions(
DistributorNamespaceId = ,
KeyId = "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001",
QueueNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
}
),
new Gs2Cdk.Gs2Lottery.Model.Options.NamespaceOptions {
logSetting = new Gs2Cdk.Core.Model.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
),
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Template
CurrentLotteryMaster
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.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
settings | string | ✓ | ~ 5242880 chars | Master data |
GetAttr
Type | Description | |
---|---|---|
Item | CurrentLotteryMaster | Updated, currently available lottery settings |
Implementation Example
Type: GS2::Lottery::CurrentLotteryMaster
Properties:
NamespaceName: namespace1
Settings: {
"version": "2019-02-21",
"lotteryModels": [
{
"name": "gacha",
"metadata": "GACHA",
"mode": "normal",
"method": "prize_table",
"prizeTableName": "gacha"
},
{
"name": "gacha_ssr",
"metadata": "SSR",
"mode": "normal",
"method": "prize_table",
"prizeTableName": "gacha-ssr"
},
{
"name": "gacha_sr",
"metadata": "SR",
"mode": "normal",
"method": "prize_table",
"prizeTableName": "gacha-sr"
},
{
"name": "gacha_r",
"metadata": "R",
"mode": "normal",
"method": "prize_table",
"prizeTableName": "gacha-r"
},
{
"name": "box",
"metadata": "BOX",
"mode": "box",
"method": "prize_table",
"prizeTableName": "box"
}
],
"prizeTables": [
{
"name": "gacha",
"metadata": "SSR",
"prizes": [
{
"prizeId": "prize-1",
"type": "prize_table",
"prizeTableName": "gacha-ssr",
"weight": 5
},
{
"prizeId": "prize-2",
"type": "prize_table",
"prizeTableName": "gacha-sr",
"weight": 15
},
{
"prizeId": "prize-3",
"type": "prize_table",
"prizeTableName": "gacha-r",
"weight": 80
}
]
},
{
"name": "gacha-ssr",
"metadata": "SSR",
"prizes": [
{
"prizeId": "prize-4",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 1
},
{
"prizeId": "prize-5",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 2
},
{
"prizeId": "prize-6",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 3
}
]
},
{
"name": "gacha-sr",
"metadata": "SR",
"prizes": [
{
"prizeId": "prize-7",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 10
},
{
"prizeId": "prize-8",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 20
},
{
"prizeId": "prize-9",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 30
}
]
},
{
"name": "gacha-r",
"metadata": "R",
"prizes": [
{
"prizeId": "prize-10",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 100
},
{
"prizeId": "prize-11",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 200
},
{
"prizeId": "prize-12",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 300
}
]
},
{
"name": "box",
"metadata": "BOX",
"prizes": [
{
"prizeId": "prize-13",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 30
},
{
"prizeId": "prize-14",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 20
},
{
"prizeId": "prize-15",
"type": "action",
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": "{\\"count\\": 1}"
}
],
"weight": 10
}
]
}
]
}
from gs2_cdk import Stack, core, lottery
class SampleStack(Stack):
def __init__(self):
super().__init__()
lottery.Namespace(
stack=self,
# omission
).master_data(
[
lottery.LotteryModel(
name='gacha',
mode='normal',
method='prize_table',
options=lottery.LotteryModelOptions(
metadata='GACHA',
prize_table_name='gacha',
),
),
lottery.LotteryModel(
name='gacha_ssr',
mode='normal',
method='prize_table',
options=lottery.LotteryModelOptions(
metadata='SSR',
prize_table_name='gacha-ssr',
),
),
lottery.LotteryModel(
name='gacha_sr',
mode='normal',
method='prize_table',
options=lottery.LotteryModelOptions(
metadata='SR',
prize_table_name='gacha-sr',
),
),
lottery.LotteryModel(
name='gacha_r',
mode='normal',
method='prize_table',
options=lottery.LotteryModelOptions(
metadata='R',
prize_table_name='gacha-r',
),
),
lottery.LotteryModel(
name='box',
mode='box',
method='prize_table',
options=lottery.LotteryModelOptions(
metadata='BOX',
prize_table_name='box',
),
),
],
[
lottery.PrizeTable(
name='gacha',
prizes=[ {'prizeId': 'prize-1', 'type': 'prize_table', 'prizeTableName': 'gacha-ssr', 'weight': 5},
{'prizeId': 'prize-2', 'type': 'prize_table', 'prizeTableName': 'gacha-sr', 'weight': 15},
{'prizeId': 'prize-3', 'type': 'prize_table', 'prizeTableName': 'gacha-r', 'weight': 80},
],
options=lottery.PrizeTableOptions(
metadata='SSR',
),
),
lottery.PrizeTable(
name='gacha-ssr',
prizes=[ {'prizeId': 'prize-4', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 1},
{'prizeId': 'prize-5', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 2},
{'prizeId': 'prize-6', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 3},
],
options=lottery.PrizeTableOptions(
metadata='SSR',
),
),
lottery.PrizeTable(
name='gacha-sr',
prizes=[ {'prizeId': 'prize-7', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10},
{'prizeId': 'prize-8', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-9', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30},
],
options=lottery.PrizeTableOptions(
metadata='SR',
),
),
lottery.PrizeTable(
name='gacha-r',
prizes=[ {'prizeId': 'prize-10', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 100},
{'prizeId': 'prize-11', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 200},
{'prizeId': 'prize-12', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 300},
],
options=lottery.PrizeTableOptions(
metadata='R',
),
),
lottery.PrizeTable(
name='box',
prizes=[ {'prizeId': 'prize-13', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30},
{'prizeId': 'prize-14', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-15', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10},
],
options=lottery.PrizeTableOptions(
metadata='BOX',
),
),
],
)
print(SampleStack().yaml()) # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
(new \Gs2Cdk\Lottery\Model\Namespace_(
stack: $this,
// omission
))->masterData(
[
new \Gs2Cdk\Lottery\Model\LotteryModel(
name:"gacha",
mode: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMode::NORMAL
method: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMethod::PRIZE_TABLE
options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
metadata:"GACHA",
prizeTableName:"gacha",
),
),
new \Gs2Cdk\Lottery\Model\LotteryModel(
name:"gacha_ssr",
mode: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMode::NORMAL
method: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMethod::PRIZE_TABLE
options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
metadata:"SSR",
prizeTableName:"gacha-ssr",
),
),
new \Gs2Cdk\Lottery\Model\LotteryModel(
name:"gacha_sr",
mode: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMode::NORMAL
method: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMethod::PRIZE_TABLE
options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
metadata:"SR",
prizeTableName:"gacha-sr",
),
),
new \Gs2Cdk\Lottery\Model\LotteryModel(
name:"gacha_r",
mode: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMode::NORMAL
method: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMethod::PRIZE_TABLE
options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
metadata:"R",
prizeTableName:"gacha-r",
),
),
new \Gs2Cdk\Lottery\Model\LotteryModel(
name:"box",
mode: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMode::BOX
method: \Gs2Cdk\Lottery\Model\Enums\CurrentLotteryMasterMethod::PRIZE_TABLE
options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
metadata:"BOX",
prizeTableName:"box",
),
),
],
[
new \Gs2Cdk\Lottery\Model\PrizeTable(
name:"gacha",
prizes:[ {'prizeId': 'prize-1', 'type': 'prize_table', 'prizeTableName': 'gacha-ssr', 'weight': 5},
{'prizeId': 'prize-2', 'type': 'prize_table', 'prizeTableName': 'gacha-sr', 'weight': 15},
{'prizeId': 'prize-3', 'type': 'prize_table', 'prizeTableName': 'gacha-r', 'weight': 80},
],
options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
metadata:"SSR",
),
),
new \Gs2Cdk\Lottery\Model\PrizeTable(
name:"gacha-ssr",
prizes:[ {'prizeId': 'prize-4', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 1},
{'prizeId': 'prize-5', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 2},
{'prizeId': 'prize-6', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 3},
],
options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
metadata:"SSR",
),
),
new \Gs2Cdk\Lottery\Model\PrizeTable(
name:"gacha-sr",
prizes:[ {'prizeId': 'prize-7', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10},
{'prizeId': 'prize-8', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-9', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30},
],
options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
metadata:"SR",
),
),
new \Gs2Cdk\Lottery\Model\PrizeTable(
name:"gacha-r",
prizes:[ {'prizeId': 'prize-10', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 100},
{'prizeId': 'prize-11', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 200},
{'prizeId': 'prize-12', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 300},
],
options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
metadata:"R",
),
),
new \Gs2Cdk\Lottery\Model\PrizeTable(
name:"box",
prizes:[ {'prizeId': 'prize-13', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30},
{'prizeId': 'prize-14', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-15', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10},
],
options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
metadata:"BOX",
),
),
],
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.lottery.model.Namespace(
this,
// omission
).masterData(
Arrays.asList(
new io.gs2.cdk.lottery.model.LotteryModel(
"gacha",
Normal,
PrizeTable,
new io.gs2.cdk.lottery.model.options.LotteryModelOptions() {
{
metadata: "GACHA";
prizeTableName: "gacha";
}
}
),
new io.gs2.cdk.lottery.model.LotteryModel(
"gacha_ssr",
Normal,
PrizeTable,
new io.gs2.cdk.lottery.model.options.LotteryModelOptions() {
{
metadata: "SSR";
prizeTableName: "gacha-ssr";
}
}
),
new io.gs2.cdk.lottery.model.LotteryModel(
"gacha_sr",
Normal,
PrizeTable,
new io.gs2.cdk.lottery.model.options.LotteryModelOptions() {
{
metadata: "SR";
prizeTableName: "gacha-sr";
}
}
),
new io.gs2.cdk.lottery.model.LotteryModel(
"gacha_r",
Normal,
PrizeTable,
new io.gs2.cdk.lottery.model.options.LotteryModelOptions() {
{
metadata: "R";
prizeTableName: "gacha-r";
}
}
),
new io.gs2.cdk.lottery.model.LotteryModel(
"box",
Box,
PrizeTable,
new io.gs2.cdk.lottery.model.options.LotteryModelOptions() {
{
metadata: "BOX";
prizeTableName: "box";
}
}
)
),
Arrays.asList(
new io.gs2.cdk.lottery.model.PrizeTable(
"gacha",
Arrays.asList(
{'prizeId': 'prize-1', 'type': 'prize_table', 'prizeTableName': 'gacha-ssr', 'weight': 5},
{'prizeId': 'prize-2', 'type': 'prize_table', 'prizeTableName': 'gacha-sr', 'weight': 15},
{'prizeId': 'prize-3', 'type': 'prize_table', 'prizeTableName': 'gacha-r', 'weight': 80}
),
new io.gs2.cdk.lottery.model.options.PrizeTableOptions() {
{
metadata: "SSR";
}
}
),
new io.gs2.cdk.lottery.model.PrizeTable(
"gacha-ssr",
Arrays.asList(
{'prizeId': 'prize-4', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 1},
{'prizeId': 'prize-5', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 2},
{'prizeId': 'prize-6', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 3}
),
new io.gs2.cdk.lottery.model.options.PrizeTableOptions() {
{
metadata: "SSR";
}
}
),
new io.gs2.cdk.lottery.model.PrizeTable(
"gacha-sr",
Arrays.asList(
{'prizeId': 'prize-7', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10},
{'prizeId': 'prize-8', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-9', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30}
),
new io.gs2.cdk.lottery.model.options.PrizeTableOptions() {
{
metadata: "SR";
}
}
),
new io.gs2.cdk.lottery.model.PrizeTable(
"gacha-r",
Arrays.asList(
{'prizeId': 'prize-10', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 100},
{'prizeId': 'prize-11', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 200},
{'prizeId': 'prize-12', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 300}
),
new io.gs2.cdk.lottery.model.options.PrizeTableOptions() {
{
metadata: "R";
}
}
),
new io.gs2.cdk.lottery.model.PrizeTable(
"box",
Arrays.asList(
{'prizeId': 'prize-13', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30},
{'prizeId': 'prize-14', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-15', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10}
),
new io.gs2.cdk.lottery.model.options.PrizeTableOptions() {
{
metadata: "BOX";
}
}
)
)
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Template
import core from "@/gs2cdk/core";
import lottery from "@/gs2cdk/lottery";
class SampleStack extends core.Stack
{
public constructor() {
super();
new lottery.model.Namespace(
this,
// omission
).masterData(
[
new lottery.model.LotteryModel(
"gacha",
lottery.model.CurrentLotteryMasterMode.NORMAL,
lottery.model.CurrentLotteryMasterMethod.PRIZE_TABLE,
{
metadata: "GACHA",
prizeTableName: "gacha"
}
),
new lottery.model.LotteryModel(
"gacha_ssr",
lottery.model.CurrentLotteryMasterMode.NORMAL,
lottery.model.CurrentLotteryMasterMethod.PRIZE_TABLE,
{
metadata: "SSR",
prizeTableName: "gacha-ssr"
}
),
new lottery.model.LotteryModel(
"gacha_sr",
lottery.model.CurrentLotteryMasterMode.NORMAL,
lottery.model.CurrentLotteryMasterMethod.PRIZE_TABLE,
{
metadata: "SR",
prizeTableName: "gacha-sr"
}
),
new lottery.model.LotteryModel(
"gacha_r",
lottery.model.CurrentLotteryMasterMode.NORMAL,
lottery.model.CurrentLotteryMasterMethod.PRIZE_TABLE,
{
metadata: "R",
prizeTableName: "gacha-r"
}
),
new lottery.model.LotteryModel(
"box",
lottery.model.CurrentLotteryMasterMode.BOX,
lottery.model.CurrentLotteryMasterMethod.PRIZE_TABLE,
{
metadata: "BOX",
prizeTableName: "box"
}
)
],
[
new lottery.model.PrizeTable(
"gacha",
[
{'prizeId': 'prize-1', 'type': 'prize_table', 'prizeTableName': 'gacha-ssr', 'weight': 5},
{'prizeId': 'prize-2', 'type': 'prize_table', 'prizeTableName': 'gacha-sr', 'weight': 15},
{'prizeId': 'prize-3', 'type': 'prize_table', 'prizeTableName': 'gacha-r', 'weight': 80}
],
{
metadata: "SSR"
}
),
new lottery.model.PrizeTable(
"gacha-ssr",
[
{'prizeId': 'prize-4', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 1},
{'prizeId': 'prize-5', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 2},
{'prizeId': 'prize-6', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 3}
],
{
metadata: "SSR"
}
),
new lottery.model.PrizeTable(
"gacha-sr",
[
{'prizeId': 'prize-7', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10},
{'prizeId': 'prize-8', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-9', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30}
],
{
metadata: "SR"
}
),
new lottery.model.PrizeTable(
"gacha-r",
[
{'prizeId': 'prize-10', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 100},
{'prizeId': 'prize-11', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 200},
{'prizeId': 'prize-12', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 300}
],
{
metadata: "R"
}
),
new lottery.model.PrizeTable(
"box",
[
{'prizeId': 'prize-13', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30},
{'prizeId': 'prize-14', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-15', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10}
],
{
metadata: "BOX"
}
)
]
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Lottery.Model.Namespace(
this,
// omission
).MasterData(
new [] {
new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
"gacha",
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMode.Normal,
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMethod.PrizeTable,
new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions {
metadata = "GACHA",
prizeTableName = "gacha",
}
),
new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
"gacha_ssr",
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMode.Normal,
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMethod.PrizeTable,
new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions {
metadata = "SSR",
prizeTableName = "gacha-ssr",
}
),
new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
"gacha_sr",
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMode.Normal,
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMethod.PrizeTable,
new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions {
metadata = "SR",
prizeTableName = "gacha-sr",
}
),
new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
"gacha_r",
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMode.Normal,
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMethod.PrizeTable,
new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions {
metadata = "R",
prizeTableName = "gacha-r",
}
),
new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
"box",
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMode.Box,
Gs2Cdk.Gs2Lottery.Model.Enums.CurrentLotteryMasterMethod.PrizeTable,
new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions {
metadata = "BOX",
prizeTableName = "box",
}
)
},
new [] {
new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
"gacha",
new Gs2Cdk.Gs2Lottery.Model.Prize[] {
{'prizeId': 'prize-1', 'type': 'prize_table', 'prizeTableName': 'gacha-ssr', 'weight': 5},
{'prizeId': 'prize-2', 'type': 'prize_table', 'prizeTableName': 'gacha-sr', 'weight': 15},
{'prizeId': 'prize-3', 'type': 'prize_table', 'prizeTableName': 'gacha-r', 'weight': 80}
},
new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions {
metadata = "SSR",
}
),
new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
"gacha-ssr",
new Gs2Cdk.Gs2Lottery.Model.Prize[] {
{'prizeId': 'prize-4', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 1},
{'prizeId': 'prize-5', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 2},
{'prizeId': 'prize-6', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 3}
},
new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions {
metadata = "SSR",
}
),
new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
"gacha-sr",
new Gs2Cdk.Gs2Lottery.Model.Prize[] {
{'prizeId': 'prize-7', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10},
{'prizeId': 'prize-8', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-9', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30}
},
new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions {
metadata = "SR",
}
),
new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
"gacha-r",
new Gs2Cdk.Gs2Lottery.Model.Prize[] {
{'prizeId': 'prize-10', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 100},
{'prizeId': 'prize-11', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 200},
{'prizeId': 'prize-12', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 300}
},
new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions {
metadata = "R",
}
),
new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
"box",
new Gs2Cdk.Gs2Lottery.Model.Prize[] {
{'prizeId': 'prize-13', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 30},
{'prizeId': 'prize-14', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 20},
{'prizeId': 'prize-15', 'type': 'action', 'acquireActions': [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}], 'weight': 10}
},
new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions {
metadata = "BOX",
}
)
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Template
Probability
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
prize | DrawnPrize | ✓ | Type of prize | ||
rate | float | ✓ | ~ 1.0 | Emission probability (0.0-1.0) |
Prize
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
prizeId | string | ✓ | UUID | ~ 36 chars | Prize ID |
type | enum [‘action’, ‘prize_table’] | ✓ | ~ 128 chars | Type of prize | |
acquireActions | List<AcquireAction> | {type} == “action” | [] | 1 ~ 100 items | List of Acquire Action |
drawnLimit | int | {type} == “action” | 1 ~ 100000 | Maximum number of draws | |
limitFailOverPrizeId | string | {type} == “action” and {drawnLimit} > 0 | ~ 32 chars | Prize ID to be discharged instead when the maximum number of drawn has been reached. | |
prizeTableName | string | {type} == “prize_table” | ~ 128 chars | Name of prize table | |
weight | int | ✓ | 1 ~ 2147483646 | Emission Weight |
DrawnPrize
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
prizeId | string | ✓ | ~ 36 chars | Prize ID | |
acquireActions | List<AcquireAction> | ~ 100 items | List of Acquire Actions |
BoxItem
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
prizeId | string | ✓ | ~ 128 chars | Prize Id | |
acquireActions | List<AcquireAction> | ~ 100 items | List of Acquire Action | ||
remaining | int | ✓ | ~ 2147483646 | Remaining quantity | |
initial | int | ✓ | ~ 2147483646 | Initial quantity |
AcquireAction
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
action | enum [] | ✓ | ~ 128 chars | Types of actions to be performed in the stamp sheet | |
request | string | ✓ | ~ 1048576 chars | JSON of request |
Config
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
key | string | ✓ | ~ 64 chars | Name | |
value | string | ~ 51200 chars | Value |
GitHubCheckoutSetting
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
apiKeyId | string | ✓ | ~ 1024 chars | GitHub API key GRN | |
repositoryName | string | ✓ | ~ 1024 chars | Repository Name | |
sourcePath | string | ✓ | ~ 1024 chars | Source code file path | |
referenceType | enum [‘commit_hash’, ‘branch’, ’tag’] | ✓ | ~ 128 chars | Source of code | |
commitHash | string | {referenceType} == “commit_hash” | ~ 1024 chars | Commit hash | |
branchName | string | {referenceType} == “branch” | ~ 1024 chars | Branch Name | |
tagName | string | {referenceType} == “tag” | ~ 1024 chars | Tag Name |
LogSetting
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024 chars | Namespace GRN |
TransactionSetting
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
enableAutoRun | bool | ✓ | false | Automatically run issued stamp sheets on the server side, or | |
distributorNamespaceId | string | {enableAutoRun} | ~ 1024 chars | GS2-Distributor namespace used for stamp sheet execution | |
keyId | string | !{enableAutoRun} | ~ 1024 chars | GS2-Key encryption key used to sign the stamp sheet | |
queueNamespaceId | string | ~ 1024 chars | Namespace in GS2-JobQueue used to run the stamp sheet |