GS2-Lottery Script Trigger Reference
Reference of event triggers that call extended scripts
Trigger
lottery
Lottery
Synchronous Execution Script
The script is executed synchronously before the lottery process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| lotteryModel | LotteryModel | Lottery Model name |
| drawnPrizes | DrawnPrize[] | List of Drawn Prizes |
| boxItems | BoxItems | List of items taken out of the box |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow lottery | ||
| overrideDrawnPrizes | DrawnPrize[] | 0 ~ 1000 items | List of Drawn Prizes |
Implementation Example
-- Request
local namespace = args.namespace
local lotteryModel = args.lotteryModel
local drawnPrizes = args.drawnPrizes
local boxItems = args.boxItems
-- Business logic:
local permit = true
local overrideDrawnPrizes = {}
-- Result
result = {
permit=permit,
overrideDrawnPrizes=overrideDrawnPrizes
}choicePrizeTable
A script that dynamically changes the lottery table
Synchronous Execution Script
The script is executed synchronously before the a script that dynamically changes the lottery table process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| lotteryModel | LotteryModel | Lottery Model for dynamically selecting lottery tables |
| userId | string | User ID |
| count | int | Number of draws |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| prizeTableNames | string[] | ✓ | 1 ~ 1000 items | List of prize table names to be used for the lottery Up to 10 prize tables can be responded to when drawing 10 times. If you respond with less than 10 prize tables, the responded prize tables will be used in order, and the remaining draws will be made with the last responded prize table. For example, if you respond with 3 prize tables, the 1st and 2nd draws will use the 1st prize table, the 3rd and 4th draws will use the 2nd prize table, and the 5th to 10th draws will use the 3rd prize table. |
Implementation Example
-- Request
local namespace = args.namespace
local lotteryModel = args.lotteryModel
local userId = args.userId
local count = args.count
-- Business logic:
local prizeTableNames = {}
-- Result
result = {
prizeTableNames=prizeTableNames
}