1.0.0 • Published 3 years ago

snakes-and-ladder-game-logic-plugin v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

snakes and ladder battle logic

changelog

v1.0 - initial document

v1.1 - moveCoin function updated with snakeBite,ladderClimb,endPosition params

v1.2 - added gameToss and changed snakes and ladder position as array of array

version 1.2

  1. Errors

  2. Lobby Messages

  1. Table Messages

Errors

All error messages have this basic form:

{
   "type" : "error",
   "data" : {
      "errorCode" : "SHORT_ERROR_CODE",
      "errorInfo" : "Longer error description"
   }
}

If type is error you should show some kind of an error popup with errorInfo field as its text.

lobby Messages

request

This section contains lobby requests

init

Send this request to get initialization data, like list of table configurations.

  • type string :: must be "init"
  • data object :: empty object

Sample request:

{
  "type": "init",
  "data": {}
}

Response

  • type string :: "init" or "error" in case of an error
  • data object :: main object
    • configurations object<string, object> an object where table configuration ids are mapped to table configuration objects (see sample response below) -id number :: id of the table -entryFee number :: entry fee of the table -isActive number :: status of the table - 0 for inactive and 1 for active

Sample response:

{
    "type": "init",
    "data": {
        "configurations": {
            "3": {
                "reserve_timer": 20,
                "dealt_waitingTimer": 5,
                "skipConsecutiveTurnsForDrop": 3,
                "status": "Seating",
                "secondId": 1,
                "numberOfJokers": 1,
                "withSecondJokers": true,
                "presencePromptTimer": 10,
                "startNextGameAfter": 10,
                "dropCost": [
                    20,
                    40,
                    80
                ],
                "state": "waiting_for_players",
                "gameId": 0,
                "nextGameStartTimer": 10,
                "animationTimer": 30,
                "halfCountIfNotPlayed": true,
                "serverId": 1,
                "id": 3,
                "sendId": "1:3",
                "game": "RUMMY",
                "isActive": 1,
                "coinTypeId": 1,
                "min_players": 2,
                "max_players": 2,
                "min_bet": 2400,
                "max_bet": 24000,
                "rakePercent": 0.05,
                "rakeFixed": 0,
                "prizeStructure": 2,
                "playerTimer": 0.2,
                "extraTimer": 0.1,
                "extraTimerSlots": [
                    0.1
                ],
                "entryFee": 0,
                "showTimer": 0.2,
                "declarationTimer": 30,
                "decks": 1,
                "cards_in_hand": 13,
                "firstPlayerTimer": 45,
                "afterSkipTurnPlayerTimer": [
                    30
                ],
                "winnings": 0,
                "title": "PointsRummy_03",
                "point_value": 30,
                "winningsShareForWinners": [
                    1
                ],
                "disconnectTime": null,
                "isRebuy": 0,
                "rebuyIn": 0,
                "rebuyEntryFee": 0,
                "rebuyChips": 0,
                "numberOfWinners": 2,
                "gameVariations": "JOKER",
                "afterSkipTurnExtraTimer": [
                    0
                ],
                "prizeCoinTypeId": 1,
                "prizeBalanceTypeId": 3,
                "game_type": "points",
                "gameStartTimer": 0.2,
                "cash": true,
                "winningsDivision": [
                    0
                ],
                "completeTimeout": 500
            },
            "4": {
                "reserve_timer": 20,
                "dealt_waitingTimer": 5,
                "skipConsecutiveTurnsForDrop": 3,
                "status": "Seating",
                "secondId": 1,
                "numberOfJokers": 1,
                "withSecondJokers": true,
                "presencePromptTimer": 10,
                "startNextGameAfter": 10,
                "dropCost": [
                    20,
                    40,
                    80
                ],
                "state": "waiting_for_players",
                "gameId": 0,
                "nextGameStartTimer": 10,
                "animationTimer": 30,
                "halfCountIfNotPlayed": true,
                "serverId": 1,
                "id": 4,
                "sendId": "1:4",
                "game": "RUMMY",
                "isActive": 1,
                "coinTypeId": 1,
                "min_players": 2,
                "max_players": 6,
                "min_bet": 800,
                "max_bet": 8000,
                "rakePercent": 0.05,
                "rakeFixed": 0,
                "prizeStructure": 2,
                "playerTimer": 0.2,
                "extraTimer": 0.1,
                "extraTimerSlots": [
                    0.1
                ],
                "entryFee": 0,
                "showTimer": 0.2,
                "declarationTimer": 30,
                "decks": 2,
                "cards_in_hand": 13,
                "firstPlayerTimer": 45,
                "afterSkipTurnPlayerTimer": [
                    30
                ],
                "winnings": 0,
                "title": "pointsRummy_05",
                "point_value": 10,
                "winningsShareForWinners": [
                    1
                ],
                "disconnectTime": null,
                "isRebuy": 0,
                "rebuyIn": 0,
                "rebuyEntryFee": 0,
                "rebuyChips": 0,
                "numberOfWinners": 0,
                "gameVariations": "JOKER",
                "afterSkipTurnExtraTimer": [
                    0
                ],
                "prizeCoinTypeId": 1,
                "prizeBalanceTypeId": 3,
                "game_type": "points",
                "gameStartTimer": 0.2,
                "cash": true,
                "winningsDivision": [
                    0
                ],
                "completeTimeout": 500
            },
            "9": {
                "reserve_timer": 20,
                "dealt_waitingTimer": 5,
                "skipConsecutiveTurnsForDrop": 3,
                "status": "Seating",
                "secondId": 1,
                "numberOfJokers": 1,
                "withSecondJokers": true,
                "presencePromptTimer": 10,
                "startNextGameAfter": 10,
                "dropCost": [
                    20,
                    40,
                    80
                ],
                "state": "waiting_for_players",
                "gameId": 0,
                "nextGameStartTimer": 10,
                "animationTimer": 30,
                "halfCountIfNotPlayed": true,
                "serverId": 1,
                "id": 9,
                "sendId": "1:9",
                "game": "RUMMY",
                "isActive": 1,
                "coinTypeId": 1,
                "min_players": 2,
                "max_players": 2,
                "min_bet": 100,
                "max_bet": 100,
                "rakePercent": 0.05,
                "rakeFixed": 0,
                "prizeStructure": 2,
                "playerTimer": 0.2,
                "extraTimer": 0.1,
                "extraTimerSlots": [
                    0.1
                ],
                "entryFee": 100,
                "showTimer": 0.2,
                "declarationTimer": 0.2,
                "decks": 1,
                "cards_in_hand": 13,
                "firstPlayerTimer": 0.1,
                "afterSkipTurnPlayerTimer": [
                    0.1
                ],
                "winnings": 190,
                "title": "poolRummy",
                "point_value": 1,
                "winningsShareForWinners": [
                    1
                ],
                "disconnectTime": null,
                "isRebuy": 0,
                "rebuyIn": 0,
                "rebuyEntryFee": 0,
                "rebuyChips": 0,
                "numberOfWinners": 1,
                "gameVariations": "101",
                "afterSkipTurnExtraTimer": [
                    0
                ],
                "prizeCoinTypeId": 1,
                "prizeBalanceTypeId": 3,
                "game_type": "pool",
                "pointsMax": 101,
                "gameStartTimer": 0.2,
                "cash": true,
                "winningsDivision": [
                    190
                ],
                "completeTimeout": 500
            }
        },
        "info": {
            "gamesInProgress": null
        }
    }
}

startGame

Use this request to start a game in a table with a selected configuration. Once success response is received, client should connect to the requested table.

Request

  • type string :: must be "startGame"
  • data object :: data object
    • id number :: table configuration id where we want to join
    • buyInAmount number :: how much you want to buy in. may be left undefined for points rummy.

Sample request

{
  "type": "startGame",
  "data": {
    "id": 1,
    "buyInAmount": 100
  }
}

Response

  • type string :: must be "startGame"
  • data object :: data object
    • sendid string :: table id where player need to join
    • groupId string :: table groupId
    • ip string :: ip of player

Sample response:

{
  "type": "startGame",
  "data": {
      "sendId": "96099ec0-4805-11e9-a26b-ebf05331a7b9",
      "ip": "145.107.12.68",
      "groupId": "62b3864c-ac1c-435f-8767-2b0eb62d27a6"
  }
}

Autoresponse

This section contains all auto responses received from lobby

tableConfigUpdate

Sent to all players in the lobby when a table config changes.

  • type string :: must be "tableConfigUpdate"
  • data object
    • configs object[] array of table configurations which changed (object with same fields that is received in init response)

Sample Response:

{
  "type": "tableConfigUpdate",
  "data": {
    "configs": [
      "3": {
        "reserve_timer": 20,
        "dealt_waitingTimer": 5,
        "skipConsecutiveTurnsForDrop": 3,
        "status": "Seating",
        "secondId": 1,
        "numberOfJokers": 1,
        "withSecondJokers": true,
        "presencePromptTimer": 10,
        "startNextGameAfter": 10,
        "dropCost": [
            20,
            40,
            80
        ],
        "state": "waiting_for_players",
        "gameId": 0,
        "nextGameStartTimer": 10,
        "animationTimer": 30,
        "halfCountIfNotPlayed": true,
        "serverId": 1,
        "id": 3,
        "sendId": "1:3",
        "game": "RUMMY",
        "isActive": 1,
        "coinTypeId": 1,
        "min_players": 2,
        "max_players": 2,
        "min_bet": 2400,
        "max_bet": 24000,
        "rakePercent": 0.05,
        "rakeFixed": 0,
        "prizeStructure": 2,
        "playerTimer": 0.2,
        "extraTimer": 0.1,
        "extraTimerSlots": [
            0.1
        ],
        "entryFee": 0,
        "showTimer": 0.2,
        "declarationTimer": 30,
        "decks": 1,
        "cards_in_hand": 13,
        "firstPlayerTimer": 45,
        "afterSkipTurnPlayerTimer": [
            30
        ],
        "winnings": 0,
        "title": "PointsRummy_03",
        "point_value": 30,
        "winningsShareForWinners": [
            1
        ],
        "disconnectTime": null,
        "isRebuy": 0,
        "rebuyIn": 0,
        "rebuyEntryFee": 0,
        "rebuyChips": 0,
        "numberOfWinners": 2,
        "gameVariations": "JOKER",
        "afterSkipTurnExtraTimer": [
            0
        ],
        "prizeCoinTypeId": 1,
        "prizeBalanceTypeId": 3,
        "game_type": "points",
        "gameStartTimer": 0.2,
        "cash": true,
        "winningsDivision": [
            0
        ],
        "completeTimeout": 500
      },
      "4": {
        "reserve_timer": 20,
        "dealt_waitingTimer": 5,
        "skipConsecutiveTurnsForDrop": 3,
        "status": "Seating",
        "secondId": 1,
        "numberOfJokers": 1,
        "withSecondJokers": true,
        "presencePromptTimer": 10,
        "startNextGameAfter": 10,
        "dropCost": [
            20,
            40,
            80
        ],
        "state": "waiting_for_players",
        "gameId": 0,
        "nextGameStartTimer": 10,
        "animationTimer": 30,
        "halfCountIfNotPlayed": true,
        "serverId": 1,
        "id": 4,
        "sendId": "1:4",
        "game": "RUMMY",
        "isActive": 1,
        "coinTypeId": 1,
        "min_players": 2,
        "max_players": 6,
        "min_bet": 800,
        "max_bet": 8000,
        "rakePercent": 0.05,
        "rakeFixed": 0,
        "prizeStructure": 2,
        "playerTimer": 0.2,
        "extraTimer": 0.1,
        "extraTimerSlots": [
            0.1
        ],
        "entryFee": 0,
        "showTimer": 0.2,
        "declarationTimer": 30,
        "decks": 2,
        "cards_in_hand": 13,
        "firstPlayerTimer": 45,
        "afterSkipTurnPlayerTimer": [
            30
        ],
        "winnings": 0,
        "title": "pointsRummy_05",
        "point_value": 10,
        "winningsShareForWinners": [
            1
        ],
        "disconnectTime": null,
        "isRebuy": 0,
        "rebuyIn": 0,
        "rebuyEntryFee": 0,
        "rebuyChips": 0,
        "numberOfWinners": 0,
        "gameVariations": "JOKER",
        "afterSkipTurnExtraTimer": [
            0
        ],
        "prizeCoinTypeId": 1,
        "prizeBalanceTypeId": 3,
        "game_type": "points",
        "gameStartTimer": 0.2,
        "cash": true,
        "winningsDivision": [
            0
        ],
        "completeTimeout": 500
      }
    ]
  }
}

tableConfigRemoved

response send to all players connected with lobby namespace when table is disabled from BO

-type string :: type of response must be string "tableConfigRemoved" -data object :: data object -configs Array :: array contains table ids which are disabled in BO.

{
  "type": "tableConfigRemoved",
  "data": {
    "configs": [ tableConfig.id ]
  }
}

Table Messages

Requests

This section lists requests sent by players (via request) and related individual callback responses and common responses sent via tableResponse.

InitAction

Sent by the user on connection. Response contains data needed to fully reconstruct current state of the game.

request

  • type string :: must be "InitAction"
  • data object :: data object

Example Request:

{
  "type":"InitAction",
  "data":{}
}

response

  • type string :: must be "InitAction"
  • players object :: contains players detail
    • userId number :: id of user
    • userName string :: name of user
    • seatStatus string :: status of the seat
    • userStatus string :: current status of the user
    • seatIndex number :: index of seat in table
    • userImage string :: url for profile picture of user
    • coinPosition Number :: coin position in board (0 for rest position)
    • lives number :: number of lives
  • data object :: data object
    • type string :: type of timer
    • time number :: number of seconds
    • startTime number :: time countdown started at this time in server
    • playerId number :: seat index of current player
    • userId number :: user Id of the current player
  • board number :: type of board used for game play
  • snakesPosition Array :: array contains array of snakes positions
  • ladderPosition Array :: array contains array of ladder positions
  • first boolean :: is it first init or not
  • timestamp string :: time in milliseconds
  • gameId string :: current gameId
  • requestId string :: request Id
  • winnerDetails array :: array contains object of winner details
    • userId number :: Id of the user
    • userName string :: name of the user
    • userStatus string :: user game status
    • winner boolean :: mention either winner or not
    • winAmount number :: amount own by user
    • seatIndex number :: seat position of user in table
    • userTempBalance number :: balance of user
    • serverUserStatus object :: contains user connection status
    • score number :: high score got by user in game - here always it should be 0
    • previousBalance number :: previous balance of user

Sample Response

{
  "players": [
    {
      "userId": 2,
      "userName": "Player 2",
      "seatIndex": 0,
      "userStatus": "active",
      "seatStatus": "seatTaken",
      "userImage": 'none',
      "coinPosition":6,
      "lives" : 2
    },
    {
      "userId": 1,
      "userName": "Player 1",
      "seatIndex": 1,
      "userStatus": "active",
      "seatStatus": "seatTaken",
      "userImage": 'none',
      "avatarId": "2",
      "coinPosition":34,
      "lives":3
      }
  ],
  "data":{
    "type":"game_start_timer",
    "time":15,
    "startTime":12234636787634,
    "playerId":0,
    "userId":0
  },
  "board":2,
  "snakesPositions":[[45,5],[53,9],[95,34]],
  "ladderPositions": [[4,35],[13,34],[38,88]]
  "first": false,
  "timestamp": 12351264512645,
  "gameId":"5654312763471265",
  "requestId":"47326187461327",
  "winnerDetails": [
      {
        "userId": 1,
        "userName": "Player 1",
        "userStatus": "wrongShow",
        "winner": false,
        "winAmount": -80,
        "seatIndex": 0,
        "userTempBalance": 80,
        "serverUserStatus": {
          "dropped": true,
          "disconnected": false,
          "playing": true,
          "waiting": false,
          "boughtIn": true,
          "left": false,
          "eliminated": false,
          "participating": false,
          "qualifyStatus": false,
          "wasParticipating": true
        },
        "score": 100,
        "previousBalance": 160
      },
      {
        "userId": 2,
        "userName": "Player 2",
        "userStatus": "won",
        "winner": true,
        "count": 0,
        "winAmount": 80,
        "seatIndex": 1,
        "userTempBalance": 240,
        "serverUserStatus": {
          "dropped": false,
          "disconnected": false,
          "playing": true,
          "waiting": false,
          "boughtIn": true,
          "left": false,
          "eliminated": false,
          "participating": false,
          "qualifyStatus": false,
          "wasParticipating": true
        },
        "score": 180,
        "previousBalance": 160
      }
    ]
    "status":"move_coin",
    "diceCount":4
}

rematchOfferResponse

sent by the user on next game timer if player want to play again the same battle.

Request

  • type string :: must be "rematchOfferResponse"
  • data object :: data object
    • accept boolean :: true if player accepted rematch

Sample request

{
  "type": "rematchOfferResponse",
  "data": {
    "accept": true
  }
}

Callback response

Error object or null if successful.

skipClientTurn

sent by user when they were unable to move any coin

  • type string ::must be skipClientTurn
  • data object :: data object
    • playerId number :: Id of the player

sample request

{
"type":"skipClientTurn",
"data":{
  "playerId":1
  }
}

rotateDice

Sent by the player during dice rotate here response should be null

request

  • type string :: must be "rotateDice"
  • data object :: data object

    • playerId number :: id of the player

    Sample request

{
  "type": "rotateDice", 
  "data": {
    "playerId": 2,
  }
}

moveCoin

sent by player for move the coin here response is null

  • type string :: must be "moveCoin"
  • data object :: data object

    • diceCount number :: dice count got by player
    • playerId number :: id of the player - seat index of the player
{
  "type": "moveCoin", 
  "data": {
    "diceCount": 1,
    "playerId": 0,
  }
}

moveCoinCompleted

sent by player once move coin completed. (This is unnecessary for server. but handled this due to client side animation requirements ) here response is null

  • type string :: must be "moveCoinCompleted"
  • data object :: data object
    • playerId number :: id of the player
    • coinId number :: selected Coin Id
{
  "type": "moveCoinCompleted", 
  "data": {
    "playerId": 0,
    "coinId": 2,
  }
}

Autoresponses

This section lists messages sent automatically via tableResponse or playerResponse

start_current_game_timer

Sent via tableResponse. Used to tell the client current game start time.

response

  • type string :: type of the response 'must be start_current_game_timer'
  • data object :: contains following fields
    • startTime number :: time in milliseconds
  • gameId string :: Id of the game
{
  "type": "start_current_game_timer",
  "data": {
    "startTime": 1476891713780
  },
  "gameId": "147689169717189"
}

gameToss

This auto response is sent when both player where join and begins to start. it contains necessary things for game to start.

response

  • type string :: type of the response 'must be gameToss'
  • data object :; data object contains following things
    • tossInfo array :: array contains toss info for game
      • userId number :: id of the user
      • userName string :: name of the user
      • seatIndex number :: seatIndex of the user in game table( 0 means 1st players and 1 means 2nd player)
      • userImage string :: url of the user image
      • toss_winner number:: mention either he is the winner of toss or not (not used in this game)
      • position number :: position and seatindex are same(we are not gonna use this in this game)
    • seatRearrange array :: array contains seat arrangements
      • userId number :: id of the user
      • userName string :: name of the user
      • seatIndex number :: seatIndex of the user in game table( 0 means 1st players and 1 means 2nd player)
      • userImage string :: url of the user image
      • dealer number ::mention it waqs dealer or not (not used for this game)
    • board number :: indicate which type of board is used,
    • snakesPositions array :: array contains array of snakes positions
    • ladderPositions array :: array contains array of ladder positions
  • gameId string :: id of the game
  • timestamp number :: time in milli seconds when response is send

sample response

{
  "type":"game_toss",
  "data":{ 
    "tossInfo":[{
      "userId":20001,
      "userName":"AleXander0001",
      "seatIndex":0,
      "userImage":"none",
      "toss_winner":0,
      "position":0
      },
      {
      "userId":20004,
      "userName":"AleXander0001",
      "seatIndex":1,
      "userImage":"none",
      "toss_winner":1,
      "position":1
      }],
    "seatRearrange":[{
      "userId":20004,
      "userName":"AleXander0001",
      "seatIndex":0,
      "userImage":"none",
      "dealer":0
    },
    {
      "userId":20001,
      "userName":"AleXander0001",
      "seatIndex":1,
      "userImage":"none",
      "dealer":1
    }], 
    "board":1,
    "snakesPositions":[[34,4],[78,54],[99.55]],
    "ladderPositions":[[5,56],[56,78],[10,23]]
    },
  "gameId":"162071451266451",
  "timestamp": 1620714591823
}

winnerDetails

This auto response is sent after game ends to list winners, cards players shown etc.

response

  • type string :: type of the response 'must be winnerDetails'
  • data object :: contains following fields
    • playersData object :: object contains player details
      • userId number :: Id of the user
      • userName string :: name of the user
      • userStatus string :: user game status
      • winner boolean :: mention either winner or not
      • winAmount number :: amount own by user
      • seatIndex number :: seat position of user in table
      • userTempBalance number :: balance of user
      • serverUserStatus object :: contains user connection status
      • score number :: high score got by user in game - here always it should be 0
      • previousBalance number :: previous balance of user
  • gameId string :: Id of the game
{
  "type": "winnerDetails",
  "data": {
    "playersData": [
      {
        "userId": 1,
        "userName": "Player 1",
        "userStatus": "wrongShow",
        "winner": false,
        "winAmount": -80,
        "seatIndex": 0,
        "userTempBalance": 80,
        "serverUserStatus": {
          "dropped": true,
          "disconnected": false,
          "playing": true,
          "waiting": false,
          "boughtIn": true,
          "left": false,
          "eliminated": false,
          "participating": false,
          "qualifyStatus": false,
          "wasParticipating": true
        },
        "score": 100,
        "previousBalance": 160
      },
      {
        "userId": 2,
        "userName": "Player 2",
        "userStatus": "won",
        "winner": true,
        "count": 0,
        "winAmount": 80,
        "seatIndex": 1,
        "userTempBalance": 240,
        "serverUserStatus": {
          "dropped": false,
          "disconnected": false,
          "playing": true,
          "waiting": false,
          "boughtIn": true,
          "left": false,
          "eliminated": false,
          "participating": false,
          "qualifyStatus": false,
          "wasParticipating": true
        },
        "score": 180,
        "previousBalance": 160
      }
    ],
  },
  "gameId": "147725106036311"
}

playerDisconnected

Used to notify all table players (via tableResponse) that a player has disconnected.

Sample auto response:

response

  • type string :: type of response 'must be playerDisconnected'
  • data object :: contains following details
  • userId number :: Id of the user
  • userName string :: name of the user
  • gameId string :: Id of the game
{
  "type": "playerDisconnected",
  "data": {
    "userId": 1,
    "userName": "xxx"
  },
  "gameId": "147725601297935"
}

playerReconnected

Used to notify all players that a player has just reconnected. Note, that playersData shouldn't be used, that's garbage which should actually be cleaned, but I'm not sure currently if the client uses it or not. To get data on reconnection, use InitAction. playerReconnected message is just to tell other players who reconnected. Please, just use data.reconnectedPlayer.

  • type string :: type of request,
  • data object :: data object contains following details
    • reconnectedPlayer object :: contains reconnected player details
      • userId number :: Id of the user
      • userName string :: name of the user
      • seatIndex number :: seat index where player seated
    • playersData object :: contains following player details
      • userId number :: Id of the user
      • userName string :: name of the user
      • seatIndex number :: seat index where player seated
      • seatStatus string :: status of player in table seat
      • disconnected boolean :: player current status either connected or not
      • userImage string :: url of user Image
      • score array :: player score ball wise
      • run number :: total score got by user
    • startTime number :: match start time in numbers
  • gameId string :: Id of the game
{
  "type": "playerReconnected",
  "data": {
    "reconnectedPlayer": {
      "userId": 2,
      "userName": "2",
      "seatIndex": 1
    },
    "playersData": [
      {
        "userId": 1,
        "userName": "1",
        "seatIndex": 0,
        "userStatus": "active",
        "seatStatus": "seatTaken",
        "disconnected": false,
        "score":0
        "userImage":"none"
      },
      {
        "userId": 2,
        "userName": "2",
        "seatIndex": 1,
        "userStatus": "active",
        "seatStatus": "seatTaken",
        "disconnected":false,
        "score":0
        "userImage":"none"
      },
      null,
      null,
      null,
      null
    ],
    "startTime": 1477256531394
  },
  "gameId": "147725601297935"
}

rotateDiceResponse

sent to table via tableResponse to inform table players about one start rotating dice.

response

  • type string :: must be rotateDice
  • data object :: data object contains following details playerId number :: id of the player

    sample response

    {
      "type":"rotateDice",
      "data":{
        "playerId":1
      }
    }

diceRotateResponse

sent to table via tableResponse dice number is send to all players

response

  • type string :: must be "diceRotate"
  • data object :: data object

    • diceCount number :: score of the player
    • playerId number :: id of the player

    Sample response

{
  "type": "diceRotate", 
  "data": {
    "diceCount": 1,
    "playerId": 20001,
  }
}

moveCoinResponse

sent to table via tableResponse when the player rotate dice

response

  • type string :: must be "moveCoin"
  • data object :: data object

    • diceCount number :: dice count got by player
    • playerId number :: id of the player
    • position number :: new Position of the coin
    • snakeBite boolean :: true if player coin reaches snake bite point
    • ladderClimb boolean :: true if player reaches ladder starting point
    • endingPoint number :: ending point of ladder or snake positions

    Sample response

{
  "type": "moveCoin", 
  "data": {
    "diceCount": 1,
    "playerId": 2,
    "position":56
    "snakeBite": true
    "ladderClimb":false
    "endingPoint":34
  }
}

buyIn

sent to table players via tableResponse when a player make game buyIn in table.

response

  • type string :: type of response 'must be buyIn'
  • data object :: contains following object details
  • userId number :: Id of the user
  • userName string :: name of the user
  • seatIndex number :: seat position of user in table
  • seatStatus string :: status of player in table seat
  • playerCount number :: number of players in table
  • avatarId string :: avatar Id of user
  • endTime number :: game end time in milliseconds
  • userStatus string :: status of user in current table
  • userImage string :: url of user Image
  • userTempBalance number :: balance of user
  • platform string :: platform used by user
  • gameId string :: Id of the game

Sample response:

{
  "type": "buyIn",
  "data": {
    "userId": 1,
    "userName": "Player 1",
    "seatIndex": 0,
    "seatStatus": "seatTaken",
    "playerCount": 1,
    "avatarId": "1",
    "userStatus": "active",
    "userImage": 'none',
    "userTempBalanace": 200,
    "platform": "web"
  },
  "gameId":1234567890
}

timer_start

sent to table players via tableResponse when a timer is triggered.

response

  • type string :: type of response 'must be timer_start'
  • data object :: contains following object details
  • userId number :: Id of the user
  • type _number__ :: type of timer
  • time number :: time in seconds
  • seatStatus string :: status of player in table seat
  • startTime number :: number of seconds in milliseconds
  • extraTimer number :: number of seconds in extra timer
  • singleSlotTime number :: mention number of extra slot timers
  • extraSlots number :: extra slots for extra timer
  • slotsLeft string :: remaining slots for extra timer
  • seatIndex number :: index of player in table
  • gameId string :: Id of the game

Sample response:

{
  "type": "timer_start",
  "data": {
    "type": "extra_timer", // must be extra_timer or turn_timer "
    "time": 10,
    "startTime": 1613466695295,
    "seatStatus": "none",
    "extraTimer": 10,
    "singleSlotTime": 10,
    "extraSlots": [10],
    "slotsLeft": 1,
    "userId": 20002,
    "seatIndex": 0
  },
  "gameId":1234567890,
  "timestamp":1613466695296
}
{
"type": "timer_start",
  "data": {
   "startTime": 1613537329599
   "time": 15
   "type": "game_start_timer"  // either "game_start_timer or next_game_timer 
  }
}

turn_skipped

sent to table players via tableResponse when a timer is triggered.

response

  • type string :: type of response 'must be turn_skipped'
  • data object :: contains following object details
  • userId number :: Id of the user
  • userName string :: name of the user
  • seatIndex number :: seat Index of the player in table
  • userImage string :: user profile image url
  • lives number :: number of lives available for user

Sample response:

{
  "type": "turn_skipped",
  "data": {
    "userName":"xxxxx",
    "userImage":"www.skil4win.com/profileurl",
    "userId": 20002,
    "seatIndex": 0,
    "lives":3
  },
}

timer_end

send via tableResponse when current timer is end

response

  • type string :: type of response timer_end
  • data object :: object contains following details
    • timer_type string :: type of the timer

Sample response:

{
  "type": "timer_end",
  "data": {
    "timer_type":"game_start_timer"
  },
}

timer_stopped

send via tableResponse when current timer is stopped manually

response

  • type string :: type of response timer_stopped
  • data object :: object contains following details
    • type string :: type of the timer

Sample response:

{
  "type": "timer_stopped",
  "data": {
    "type":"game_start_timer"
  },
}