0
0
Fork 0
Phantom-Ink-Online/server/events.md
2020-12-16 18:23:31 -07:00

6.9 KiB

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
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.



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.



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.



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



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.



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.



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"



RemoveCard:

Description:

This event is sent from the server when a guesser sends a card to the spirit, it's purpose is to keep the other medium's hands in sync.

Request Payload:

This event is only sent by the server.

Response Payload: (RemoveCard)

Property Type Description
card String The card to remove the player's hand.
team Integer The team to remove the card from. This will be either 1, or 2.





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.



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.



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.



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.



``:

Description:

Request Payload:

Property Type Description

Response Payload: (``)

Property Type Description