Controller to handle all game related requests

Constructors

Methods

  • Convert the result of an action to a type of GameState.

    Parameters

    • OptionalactionResult: ActionResult

      Result of an action, can be undefined.

    Returns Promise<undefined | GameState>

    A type of GameState representing the result of the action or undefined when something went wrong.

  • Convert an action instance into an action reference for the client application

    Parameters

    • action: Action

      Action instance to convert

    Returns Promise<ActionReference>

    Action reference for the client application

  • Convert a game object instance into a game object reference for the client application

    Parameters

    • gameObject: GameObject

      Game object instance to convert

    Returns Promise<GameObjectReference>

    Game object reference for the client application

  • Convert a talk choice into an action reference for the client application

    Parameters

    Returns ActionReference

    Action reference for the client application

  • Execute the requested action and convert the result to a type of GameState.

    Parameters

    • actionAlias: string

      Alias of action to execute

    • OptionalgameObjectAliases: string[]

      Optional list of game object aliases to execute the action on

    Returns Promise<undefined | GameState>

    A type of GameState representing the result of the action or undefined when something went wrong.

  • Handle the request to execute an action for the current player

    Parameters

    • req: Request
    • res: Response

    Returns Promise<void>

    Response is a 200 with a GameState on success, otherwise a 500.

  • Handle the request to retrieve the game state for the current player

    Parameters

    • _: Request
    • res: Response

    Returns Promise<void>

    Response is a 200 with a GameState on success, otherwise a 500.