Skip to main content

Game Actions

All game actions are defined by the ActionTypeCode enum:

ActionTypeCode Enum

enum ActionTypeCode {
DistributedTiles = 0, // Tiles distributed
JoinRoom = 1, // Joined room
LeaveRoom = 2, // Left room
RejoinRoom = 3, // Rejoined room
KickedRoom = 4, // Kicked from room
Timeout = 5, // Timeout
StartGame = 6, // Game started
DiscardTile = 7, // Discarded tile
DrawFromMiddle = 8, // Drew from middle
DrawFromDiscard = 9, // Drew from discard
OpenSet = 10, // Opened set
MergeSet = 11, // Added tile to set
FinishGame = 12, // Finished game
FinishGameWithOkey = 13, // Finished game with okey
DistributedTilesPairs = 14, // Tiles distributed for pairs
OpenSetPairs = 15, // Opened pair set
UndoTiles = 16, // Undid tile drawn from discard
TileMove = 17, // Tile moved (UI only)
AutoMergeSet = 18, // Automatic set merge
AutoMergeSetPairs = 19, // Automatic pair set merge
UndoActions = 20, // Undid actions
StartNewGame = 1000, // Start new game
GetWinningHand = 99999, // Get winning hand
GetWinningHandPairs = 999999 // Get winning hand for pairs
}

Action Details

1. DiscardTile (7) - Discard Tile

Sent:

{
"type": "move",
"token": "...",
"userName": "...",
"content": {
"moveType": 7,
"tile": {
"uniqueID": "tile-123",
"number": 5,
"color": 1
},
"timestamp": 1704067200000
}
}

Received:

  • Updated game state via gameState message

2. DrawFromMiddle (8) - Draw from Middle

Sent:

{
"type": "move",
"token": "...",
"userName": "...",
"content": {
"moveType": 8,
"timestamp": 1704067200000
}
}

Received:

  • Updated game state via gameState message (new tile added to tileBag)

3. DrawFromDiscard (9) - Draw from Discard

Sent:

{
"type": "move",
"token": "...",
"userName": "...",
"content": {
"moveType": 9,
"timestamp": 1704067200000
}
}

Received:

  • Updated game state via gameState message

4. OpenSet (10) - Open Set

Sent:

{
"type": "move",
"token": "...",
"userName": "...",
"content": {
"moveType": 10,
"tiles": [
{
"uniqueID": "tile-1",
"number": 1,
"color": 1
},
{
"uniqueID": "tile-2",
"number": 2,
"color": 1
},
{
"uniqueID": "tile-3",
"number": 3,
"color": 1
}
],
"timestamp": 1704067200000
}
}

Received:

  • Updated game state via gameState message (openSeries updated)

5. MergeSet (11) - Add Tile to Set

Sent:

{
"type": "move",
"token": "...",
"userName": "...",
"content": {
"moveType": 11,
"groupId": 1,
"playerId": "player-123",
"tile": {
"uniqueID": "tile-123",
"number": 4,
"color": 1
},
"frontOrEnd": 0,
"timestamp": 1704067200000
}
}

Parameters:

  • groupId: Group ID of the set
  • playerId: ID of the player who owns the set
  • tile: Tile to add
  • frontOrEnd: 0 = add to front, 1 = add to end (for joker)

Received:

  • Updated game state via gameState message

6. FinishGame (12) - Finish Game

Sent:

{
"type": "move",
"token": "...",
"userName": "...",
"content": {
"moveType": 12,
"timestamp": 1704067200000
}
}

Received:

  • Game end state via endRound message

7. UndoTiles (16) - Undo Tile Drawn from Discard

Sent:

{
"type": "move",
"token": "...",
"userName": "...",
"content": {
"moveType": 16,
"timestamp": 1704067200000
}
}

Received:

  • Updated game state via gameState message