Kalevala.Character.Conn (kalevala v0.1.0) View Source

Struct for tracking data being processed in a controller or command

Link to this section Summary

Functions

Add to the assignment map on the conn

Get the character out of the conn

Send the foreman an in-game event

Get a value out of the session data

Mark the connection for termination

Creates an even to move from one room to another

Render a prompt to the conn

Request to publish a message to a channel

Put an action to be performed

Update the character in state

Put the new controller that the foreman should swap to

Update a key in a character's meta map

Put a value into the session data

Sends a request to drop an item into the room

Sends a request to get an item from the room

Request the room to move via the exit

Send a telnet option

Request to subscribe to a channel

Request to unsubscribe from a channel

Link to this section Types

Specs

t() :: %Kalevala.Character.Conn{
  assigns: term(),
  character: term(),
  events: term(),
  options: term(),
  output: term(),
  params: term(),
  private: term(),
  session: term()
}

Link to this section Functions

Link to this function

assign(conn, key, value)

View Source

Add to the assignment map on the conn

Link to this function

character(conn, opts \\ [])

View Source

Get the character out of the conn

If the character has been updated, this character will be returned

Link to this function

delay_event(conn, delay, topic, data \\ %{})

View Source

Delay an event

Link to this function

event(conn, topic, data \\ %{})

View Source

Send the foreman an in-game event

Get a value out of the session data

Mark the connection for termination

Link to this function

move(conn, direction, room_id, view, template, assigns)

View Source

Creates an even to move from one room to another

Link to this function

prompt(conn, view, template, assigns \\ %{})

View Source

Render a prompt to the conn

Link to this function

publish_message(conn, channel_name, text, options, error_fun)

View Source

Request to publish a message to a channel

Available options for altering the message, these also get passed along to the channel callbacks.

  • type, defaults to "speech"
  • meta, defaults to %{}
Link to this function

put_action(conn, action)

View Source

Put an action to be performed

This should be a Kalevala.Character.Action struct to save which action module should be run, along with any delay and params.

Link to this function

put_character(conn, character)

View Source

Update the character in state

Link to this function

put_controller(conn, controller)

View Source

Put the new controller that the foreman should swap to

Link to this function

put_meta(conn, key, value)

View Source

Update a key in a character's meta map

Link to this function

put_session(conn, key, value)

View Source

Put a value into the session data

Link to this function

render(conn, view, template, assigns \\ %{})

View Source

Render text to the conn

Link to this function

request_item_drop(conn, item_instance)

View Source

Sends a request to drop an item into the room

Link to this function

request_item_pickup(conn, item_name)

View Source

Sends a request to get an item from the room

Link to this function

request_movement(conn, exit_name)

View Source

Request the room to move via the exit

Link to this function

send_option(conn, name, value)

View Source

Send a telnet option

Link to this function

subscribe(conn, channel_name, options, error_fun)

View Source

Request to subscribe to a channel

Link to this function

unsubscribe(conn, channel_name, options, error_fun)

View Source

Request to unsubscribe from a channel