Move event and type docs into their own files.
This commit is contained in:
parent
ce7e35cd53
commit
2ca4eef0a6
19 changed files with 213 additions and 261 deletions
15
server/docs/events/CreateGame.md
Normal file
15
server/docs/events/CreateGame.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# `CreateGame`:
|
||||
|
||||
## Description:
|
||||
Triggered when a user is creating a game.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The name of the person starting the game
|
||||
|
||||
## Response Payload: (`GameCreated`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| id | String | The user's game ID, this should be stored to permit users to re-join the game if they get disconnected.
|
||||
| game_code | String | The game's code that other players can use to connect to the game.
|
||||
6
server/docs/events/General_Response.md
Normal file
6
server/docs/events/General_Response.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Properties Of All Response Payloads
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| status | Integer | The response code of the server. This follows HTTP standards as described by [Mozilla's Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
||||
| message? | String | More information relating to the response. This is set iff `success` is a non 2XX value.
|
||||
| source? | String | The event name that caused this response to be sent. This is set iff is a non 2XX value.
|
||||
14
server/docs/events/GetPastQuestions.md
Normal file
14
server/docs/events/GetPastQuestions.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# `GetPastQuestions`:
|
||||
|
||||
## Description:
|
||||
This event is sent from the client to the server when it has the PastQuestions component visible.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team we are requesting the questions for. This can be one of `1`, or `2`, any other value will cause an error to be returned.
|
||||
|
||||
## Response Payload: (`PastQuestions`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| questions | String[] | All the previously chosen questions for the team.
|
||||
16
server/docs/events/JoinGame.md
Normal file
16
server/docs/events/JoinGame.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# `JoinGame`:
|
||||
|
||||
## Description:
|
||||
Triggered by the client when it attempts to connect to a game.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The user's name
|
||||
| game_code | String | The game code for the game the user is trying to join.
|
||||
| id? | String | The user's ID that was stored if they have already joined a game and not finished it.
|
||||
|
||||
## Response Payload: (`GameJoined`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| id | String | The user's game ID, if `id` is set in the payload, this is the same, otherwise it is a brand new ID.
|
||||
14
server/docs/events/JoinTeam.md
Normal file
14
server/docs/events/JoinTeam.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# `JoinTeam`:
|
||||
|
||||
## Description:
|
||||
This event is triggered by the client when the user attempts to join a team from the lobby.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | int | The team to join. Accepted values are: `1`, and `2`, any other value will throw an error.
|
||||
| role | String | The role the player is assuming. This can be `"writer"` or `"guesser"`, any other value will throw an error.
|
||||
|
||||
## Response Payload: (`JoinTeam`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
12
server/docs/events/NewHand.md
Normal file
12
server/docs/events/NewHand.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# `NewHand`:
|
||||
|
||||
## Description:
|
||||
This is the event client sends it requests a new 7 cards for the hand.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team that is requesting a new hand.
|
||||
|
||||
## Response Payload:
|
||||
This event's response comes in the form of the `UpdateHand` event with the mode set to `"replace"`
|
||||
13
server/docs/events/ObjectList.md
Normal file
13
server/docs/events/ObjectList.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# `ObjectList`:
|
||||
|
||||
## Description:
|
||||
This event is sent by the client when they are wanting to retrieve the list of
|
||||
objects that the spirits can pick from.
|
||||
|
||||
## Request Payload:
|
||||
No payload is read from for this event.
|
||||
|
||||
## Response Payload: (`ObjectList`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| objects | String[] | The objects that are on the chosen card.
|
||||
14
server/docs/events/SelectObject.md
Normal file
14
server/docs/events/SelectObject.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# `SelectObject`:
|
||||
|
||||
## Description:
|
||||
The event sent by the clients when they are selecting an object from the card.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| object | String | The name of the object that the spirits are selecting.
|
||||
|
||||
## Response Payload: (`ChosenObject`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| object | String | The object that has been selected.
|
||||
17
server/docs/events/SendCard.md
Normal file
17
server/docs/events/SendCard.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# `SendCard`:
|
||||
|
||||
## Description:
|
||||
Sends a card to the server, the server either then either forwards the card to the spirit or the past questions pile. The action that is taken is dependant on what the `from` property is set to.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| text | String | The text of the card that is being sent.
|
||||
| from | String | The source of where the card is being sent from. This can be one of `"writer"`, `"guesser"`, any other value will return an error.
|
||||
| team | Integer | The team that is sending the card. This can be either `1` or `2`, any other value will return an error.
|
||||
|
||||
## Response Payload: (`NewCards`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| cards | String[] | The text of the cards that was sent.
|
||||
| from | String | The source of the card(s). This will be one of `"deck"`, or `"guesser"`
|
||||
18
server/docs/events/UpdateAnswer.md
Normal file
18
server/docs/events/UpdateAnswer.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# `UpdateAnswer`:
|
||||
|
||||
## Description:
|
||||
This event is sent to and from the server when a spirit is typing into one of the text boxes.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team indicator number. This can be either `1`, or `2`, any other value will cause this event to return an error.
|
||||
| answer | Integer | The answer that is being updated. This can be any number between `1` and `8` (inclusive), any other value will cause this event return an error.
|
||||
| value | String | The new text for the input box.
|
||||
|
||||
## Response Payload: (`UpdateAnswer`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team indicator number. This can be either `1`, or `2`.
|
||||
| answer | Integer | The answer that is being updated. This can be any number between `1` and `8` (inclusive).
|
||||
| value | String | The new text for the input box.
|
||||
13
server/docs/events/UpdateHand.md
Normal file
13
server/docs/events/UpdateHand.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# `UpdateHand`:
|
||||
|
||||
## Description:
|
||||
Tells the client to update their hand, using one of the provided modes.
|
||||
|
||||
## Request Payload:
|
||||
This event is never sent to the server
|
||||
|
||||
## Response Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| questions | String[] | The cards that the operation for the hand will use.
|
||||
| mode | String | This is one of `"append"` or `"replace"`
|
||||
12
server/docs/events/UpdatePlayer.md
Normal file
12
server/docs/events/UpdatePlayer.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# `UpdatePlayer`:
|
||||
|
||||
## Description:
|
||||
This event is sent from the server and is a result of a player joining/changing team, this event is also fired when a new player joins the game.
|
||||
|
||||
## Request Payload:
|
||||
The client cannot send this event and only receives it.
|
||||
|
||||
## Response Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| player | Player | The player's new data.
|
||||
13
server/docs/events/_template.md
Normal file
13
server/docs/events/_template.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# ``:
|
||||
|
||||
## Description:
|
||||
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
|
||||
|
||||
## Response Payload: (``)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
7
server/docs/types/Deck.md
Normal file
7
server/docs/types/Deck.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
## Deck
|
||||
This represents a stack of cards that can be drawn from and discarded to.
|
||||
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| discard | String[] | The used cards
|
||||
| deck | String[] | The unused cards
|
||||
11
server/docs/types/Game.md
Normal file
11
server/docs/types/Game.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
## Game:
|
||||
This is a representation of the game and it's corresponding data.
|
||||
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| id | String | The game's ID to join with.
|
||||
| teams | Team[] | The teams that are a part of this game.
|
||||
| players | Player[] | All of the players that are in this game.
|
||||
| questons | Deck | The deck and discard of the question cards.
|
||||
| objects | Deck | The deck and discard of the object cards.
|
||||
| getObjects | String[] | Gets the objects that the game has chosen.
|
||||
8
server/docs/types/Player.md
Normal file
8
server/docs/types/Player.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
## Player:
|
||||
A player's information for the game.
|
||||
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The player's name.
|
||||
| id | String | The player's unique ID.
|
||||
| socket | Socket | The socket object used to send events directly to the player.
|
||||
10
server/docs/types/Team.md
Normal file
10
server/docs/types/Team.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
## Team
|
||||
A representation of a team, this consists of which player is the spirit and a complete list of all the players on the team,
|
||||
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| mediums | Player[] | All the Players that are on this team.
|
||||
| spirit | Player | The player that is acting as the team's spirit.
|
||||
| hand | String[] | The cards that are in the medium's hand.
|
||||
| questions | String[] | The questions that the mediums have asked the spirit. (This is not equivalent to the Spirit's hand)
|
||||
| answers | String[] | The answers that the spirit has given.
|
||||
232
server/events.md
232
server/events.md
|
|
@ -1,232 +0,0 @@
|
|||
# Properties Of All Response Payloads
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| status | Integer | The response code of the server. This follows HTTP standards as described by [Mozilla's Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
||||
| message? | String | More information relating to the response. This is set iff `success` is a non 2XX value.
|
||||
| source? | String | The event name that caused this response to be sent. This is set iff is a non 2XX value.
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `CreateGame`:
|
||||
|
||||
## Event Description:
|
||||
Triggered when a user is creating a game.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The name of the person starting the game
|
||||
|
||||
## Response Payload: (`GameCreated`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| id | String | The user's game ID, this should be stored to permit users to re-join the game if they get disconnected.
|
||||
| game_code | String | The game's code that other players can use to connect to the game.
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `JoinGame`:
|
||||
|
||||
## Description:
|
||||
Triggered by the client when it attempts to connect to a game.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The user's name
|
||||
| game_code | String | The game code for the game the user is trying to join.
|
||||
| id? | String | The user's ID that was stored if they have already joined a game and not finished it.
|
||||
|
||||
## Response Payload: (`GameJoined`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| id | String | The user's game ID, if `id` is set in the payload, this is the same, otherwise it is a brand new ID.
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `JoinTeam`:
|
||||
|
||||
## Description:
|
||||
This event is triggered by the client when the user attempts to join a team from the lobby.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | int | The team to join. Accepted values are: `1`, and `2`, any other value will throw an error.
|
||||
| role | String | The role the player is assuming. This can be `"writer"` or `"guesser"`, any other value will throw an error.
|
||||
|
||||
## Response Payload: (`JoinTeam`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `PlayerUpdate`:
|
||||
|
||||
## Description:
|
||||
This event is sent from the server and is a result of a player joining/changing team.
|
||||
|
||||
## Request Payload:
|
||||
The client cannot send this event and only receives it.
|
||||
|
||||
## Response Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| player | Player | The player's new data.
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `UpdateAnswer`:
|
||||
|
||||
## Description:
|
||||
This event is sent to and from the server when a spirit is typing into one of the text boxes.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team indicator number. This can be either `1`, or `2`, any other value will cause this event to return an error.
|
||||
| answer | Integer | The answer that is being updated. This can be any number between `1` and `8` (inclusive), any other value will cause this event return an error.
|
||||
| value | String | The new text for the input box.
|
||||
|
||||
## Response Payload: (`UpdateAnswer`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team indicator number. This can be either `1`, or `2`.
|
||||
| answer | Integer | The answer that is being updated. This can be any number between `1` and `8` (inclusive).
|
||||
| value | String | The new text for the input box.
|
||||
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `SendCard`:
|
||||
|
||||
## Description:
|
||||
Sends a card to the server, the server either then either forwards the card to the spirit or the past questions pile. The action that is taken is dependant on what the `from` property is set to.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| text | String | The text of the card that is being sent.
|
||||
| from | String | The source of where the card is being sent from. This can be one of `"writer"`, `"guesser"`, any other value will return an error.
|
||||
| team | Integer | The team that is sending the card. This can be either `1` or `2`, any other value will return an error.
|
||||
|
||||
## Response Payload: (`NewCards`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| cards | String[] | The text of the cards that was sent.
|
||||
| from | String | The source of the card(s). This will be one of `"deck"`, or `"guesser"`
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `UpdateHand`:
|
||||
|
||||
## Description:
|
||||
Tells the client to update their hand, using one of the provided modes.
|
||||
|
||||
## Request Payload:
|
||||
This event is never sent to the server
|
||||
|
||||
## Response Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| questions | String[] | The cards that the operation for the hand will use.
|
||||
| mode | String | This is one of `"append"` or `"replace"`
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `GetPastQuestions`:
|
||||
|
||||
## Description:
|
||||
This event is sent from the client to the server when it has the PastQuestions component visible.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team we are requesting the questions for. This can be one of `1`, or `2`, any other value will cause an error to be returned.
|
||||
|
||||
## Response Payload: (`PastQuestions`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| questions | String[] | All the previously chosen questions for the team.
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `SelectObject`:
|
||||
|
||||
## Description:
|
||||
The event sent by the clients when they are selecting an object from the card.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| object | String | The name of the object that the spirits are selecting.
|
||||
|
||||
## Response Payload: (`ChosenObject`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| object | String | The object that has been selected.
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `NewPlayer`:
|
||||
|
||||
## Description:
|
||||
This is sent by the server when a new player joins the game.
|
||||
|
||||
## Request Payload:
|
||||
This event cannot be requested by the clients.
|
||||
|
||||
## Response Payload: (``)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The player's name.
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# `NewHand`:
|
||||
|
||||
## Description:
|
||||
This is the event client sends it requests a new 7 cards for the hand.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team that is requesting a new hand.
|
||||
|
||||
## Response Payload: (`NewHand`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| by | String | The name of the player that triggered the `NewHand` event.
|
||||
| cards | String[] | An array containing all of the new cards for the team.
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
||||
# ``:
|
||||
|
||||
## Description:
|
||||
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
|
||||
|
||||
## Response Payload: (``)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
|
||||
|
||||
<br><br>
|
||||
---
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
## Player:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The player's name.
|
||||
| id | String | The player's unique ID.
|
||||
|
||||
## Deck
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| discard | String[] | The used cards
|
||||
| deck | String[] | The unused cards
|
||||
|
||||
## Game:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| id | String | The game's ID to join with.
|
||||
| teams | Team[] | The teams that are a part of this game.
|
||||
| players | Player[] | All of the players that are in this game.
|
||||
| questons | Deck | The deck and discard of the question cards.
|
||||
| objects | Deck | The deck and discard of the object cards.
|
||||
|
||||
## Team
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| players | Player[] | All the Players that are on this team.
|
||||
| spirit | Player | The player that is acting as the team's spirit.
|
||||
| hand | String[] | The cards that are in this team's hand.
|
||||
| questions | String[] | The questions that the mediums have asked the spirit.
|
||||
| answers | String[] | The answers that the spirit has given.
|
||||
Loading…
Add table
Add a link
Reference in a new issue