Endgame WS messages & docs

This commit is contained in:
Eden Kirin
2023-05-11 19:36:16 +02:00
parent 76ee207bce
commit d660845d30
6 changed files with 47 additions and 115 deletions

117
README.md
View File

@ -234,8 +234,8 @@ loop #lightyellow Product select countdown timer (60s)
Game ->o WS: Timer timeout
activate Game
activate WS #coral
WS o-> Client1: Cancel selection
WS o-> Client2: Cancel selection
WS o-> Client1: Selection timeout
WS o-> Client2: Selection timeout
deactivate WS
Game -> Game: Unlock game
deactivate Game
@ -400,6 +400,8 @@ Response body:
### Game state structure
Direction: Game server -> Clients
Message: `game_dump`
Data:
@ -503,109 +505,42 @@ Data:
}
```
### Product purchase start
### Player reached destination
Message: `product_purchase_start`
Direction: Game server -> Clients
Message: `player_reached_destination`
Data:
```json
{
"player": {
"id": "test-player-pero",
"name": "Pero",
"id": "2e0f1a50-eaa6-4efd-b0c3-adbf7000eec2",
"name": "Joso",
"active": true,
"position": {
"x": 10,
"y": 10
"x": 5,
"y": 5
},
"move_count": 1,
"move_attempt_count": 1,
"state": "ON_DESTINATION"
},
"products": [
{
"name": "CocaCola",
"id": "cocacola-id",
"description": null
},
{
"name": "Pepsi",
"id": "pepsi-id",
"description": null
},
{
"name": "Fanta",
"id": "fanta-id",
"description": null
},
{
"name": "Snickers",
"id": "snickers-id",
"description": null
},
{
"name": "Mars",
"id": "mars-id",
"description": null
},
{
"name": "Burek",
"id": "burek-id",
"description": null
}
],
"timeout": 5
}
```
### Product purchase timer tick
Message: `product_purchase_timer_tick`
Data:
```json
{
"time_left": 4,
"player": {
"id": "test-player-pero",
"name": "Pero",
"active": true,
"position": {
"x": 10,
"y": 10
},
"move_count": 1,
"move_attempt_count": 1,
"move_count": 6,
"move_attempt_count": 6,
"state": "ON_DESTINATION"
}
}
```
### Product purchase timer done
### Product selection timeout
Message: `product_purchase_done`
Direction: Game server -> Clients
Data:
```json
{
"player": {
"id": "test-player-pero",
"name": "Pero",
"active": true,
"position": {
"x": 10,
"y": 10
},
"move_count": 1,
"move_attempt_count": 1,
"state": "ON_DESTINATION"
},
"product": {
"name": "CocaCola",
"id": "cocacola-id",
"description": null
}
}
```
Message: `product_selection_timeout`
If product selection timeout occured, product will be null.
Data: `null`
### Product selection done
Message: `product_selection_done`
Direction: Client -> Game server, Game server -> Clients
Data: `null`