eris  1.4.0
A WorldForge client library.
Eris::Lobby Class Reference

#include <Lobby.h>

Inheritance diagram for Eris::Lobby:
Collaboration diagram for Eris::Lobby:

Public Types

enum  RouterResult { IGNORED = 0, HANDLED }
 

Public Member Functions

 Lobby (Account &acc)
 
 ~Lobby () override
 
Roomjoin (const std::string &roomID)
 
PersongetPerson (const std::string &acc)
 obtain a person's info, given their account ID; may return nullptr More...
 
RoomgetRoom (const std::string &id)
 
AccountgetAccount () const
 Retrive the Account which this lobbby is bound to. More...
 
ConnectiongetConnection () const
 Helper method to access the underlying Connection from the Account. More...
 
void say (const std::string &tk)
 Send a piece of text to this room. More...
 
void emote (const std::string &em)
 
void leave ()
 
RoomcreateRoom (const std::string &name)
 
std::string getName () const
 Obtain the human-readable name of this room. More...
 
std::string getTopic () const
 
std::vector< Person * > getPeople () const
 obtain an array of pointers to everyone in this room More...
 
std::vector< Room * > getRooms () const
 Obtain a list of rooms within this room. More...
 
std::string getId () const
 
PersongetPersonByUID (const std::string &uid)
 
virtual RouterResult handleObject (const Atlas::Objects::Root &obj)
 
virtual RouterResult handleEntity (const Atlas::Objects::Entity::RootEntity &ent)
 

Public Attributes

sigc::signal< void, Person * > SightPerson
 Emitted when sight of a person is received. More...
 
sigc::signal< void, Person *, const std::string & > PrivateTalk
 
sigc::signal< void, Room * > Entered
 
sigc::signal< void, Room *, Person *, const std::string & > Speech
 
sigc::signal< void, Room *, Person *, const std::string & > Emote
 
sigc::signal< void, Room *, Person * > Appearance
 
sigc::signal< void, Room *, Person * > Disappearance
 Similarly, emitted when the specifed person leaves the room. More...
 

Protected Types

typedef std::unordered_map< std::string, std::unique_ptr< Person > > IdPersonMap
 

Protected Member Functions

void look (const std::string &id)
 
void sightPerson (const Atlas::Objects::Entity::Account &ac)
 
Router::RouterResult recvTalk (const Atlas::Objects::Operation::Talk &tk)
 
void recvInitialSight (const Atlas::Objects::Entity::RootEntity &ent)
 
void recvAppearance (const Atlas::Objects::Root &obj)
 
void recvDisappearance (const Atlas::Objects::Root &obj)
 
Router::RouterResult recvImaginary (const Atlas::Objects::Operation::Imaginary &im)
 
RouterResult handleOperation (const Atlas::Objects::Operation::RootOperation &op) override
 
void handleSoundTalk (Person *p, const std::string &speech)
 
void handleEmote (Person *p, const std::string &desc)
 

Protected Attributes

std::string m_roomId
 

Friends

class Room
 
class OOGRouter
 

Detailed Description

Lobby is the Out-of-Game session object, valid from connection to the server until disconnection. It manages the entire OOG structure, which consists of rooms and people. People can be in more than one room (this is the big difference to in-game). Note the entire OOG system remains live and valid even when an Avatar is active, it's up to the client to present some UI for accessing the OOG system if it wants.

Of course, nothing requries to create a Lobby at all, Account and the in-game structure will work perfectly well without one.

Definition at line 26 of file Lobby.h.

Constructor & Destructor Documentation

◆ Lobby()

Eris::Lobby::Lobby ( Account acc)
explicit

Create a Lobby for the specified account, and retrieve the initial OOG structure if the Account is logged in and connected.

Definition at line 120 of file Lobby.cpp.

References Eris::Account::isLoggedIn(), Eris::Account::LoginSuccess, and Eris::Account::LogoutComplete.

◆ ~Lobby()

Eris::Lobby::~Lobby ( )
override

Delete the Lobby, including all it's Rooms and Persons.

Definition at line 135 of file Lobby.cpp.

References getConnection(), Eris::Room::getId(), Eris::Account::getId(), Eris::getNewSerialno(), Eris::Account::isLoggedIn(), and Eris::Connection::send().

Member Function Documentation

◆ createRoom()

Room * Eris::Room::createRoom ( const std::string &  name)
inherited

create a child room of this one, with the specified name. Note that most attributes, including the ID will not be valid until the new room emits the 'Entered' signal. If you need a unique, referenceable indentifier earlier than that point, use the pointer value.

Definition at line 112 of file Room.cpp.

References getAccount(), getConnection(), Eris::Account::getId(), Eris::getNewSerialno(), getPerson(), Eris::BaseConnection::isConnected(), and Eris::Connection::send().

◆ emote()

void Eris::Room::emote ( const std::string &  em)
inherited

Send an emote ( /me ) to the room. This is transmitted as an IMAGINARY op in Atlas, with args[0]["id"] = "emote".

Definition at line 69 of file Room.cpp.

References getAccount(), getConnection(), Eris::Account::getId(), Eris::getNewSerialno(), Eris::BaseConnection::isConnected(), and Eris::Connection::send().

◆ getAccount()

Account& Eris::Lobby::getAccount ( ) const
inline

Retrive the Account which this lobbby is bound to.

Definition at line 50 of file Lobby.h.

References getConnection().

Referenced by Eris::Room::createRoom(), Eris::Room::emote(), Eris::Room::getPeople(), Eris::Room::leave(), Eris::Person::msg(), and Eris::Room::say().

◆ getConnection()

Connection & Eris::Lobby::getConnection ( ) const

◆ getId()

std::string Eris::Room::getId ( ) const
inlineinherited

Get the Atlas object ID of the Room; note that this may return an empty value if called prior to entering the Lobby

Definition at line 74 of file Room.h.

Referenced by ~Lobby().

◆ getName()

std::string Eris::Room::getName ( ) const
inlineinherited

Obtain the human-readable name of this room.

Definition at line 53 of file Room.h.

References Eris::Room::getPeople().

◆ getPeople()

std::vector< Person * > Eris::Room::getPeople ( ) const
inherited

◆ getPerson()

Person * Eris::Lobby::getPerson ( const std::string &  acc)

obtain a person's info, given their account ID; may return nullptr

Definition at line 197 of file Lobby.cpp.

Referenced by Eris::Room::createRoom(), and Eris::Room::getPeople().

◆ getRoom()

Room * Eris::Lobby::getRoom ( const std::string &  id)

Obtain a Room object, given the rooms' id. This will return nullptr if the id is invalid.

Definition at line 210 of file Lobby.cpp.

References Eris::Account::getConnection(), and SightPerson.

◆ getRooms()

std::vector<Room*> Eris::Room::getRooms ( ) const
inlineinherited

Obtain a list of rooms within this room.

Definition at line 67 of file Room.h.

◆ join()

Room * Eris::Lobby::join ( const std::string &  roomID)

Join the specified room, or return nullptr if an error occurs. Note the Room will not be valid until it emits the Entered signal.

Definition at line 165 of file Lobby.cpp.

References getConnection(), Eris::Account::getId(), Eris::getNewSerialno(), Eris::Account::isLoggedIn(), and Eris::Connection::send().

◆ leave()

void Eris::Room::leave ( )
inherited

Leave the room - no more signals will be emitted for this room again (validity of Room pointer after this call?)

Definition at line 92 of file Room.cpp.

References getAccount(), getConnection(), Eris::Account::getId(), Eris::getNewSerialno(), Eris::BaseConnection::isConnected(), and Eris::Connection::send().

◆ say()

void Eris::Room::say ( const std::string &  tk)
inherited

Member Data Documentation

◆ Appearance

sigc::signal<void, Room*, Person*> Eris::Room::Appearance
inherited

Emitted when a person enters the room; argument is the account ID. Note that Appearance is not generated for the local player when entering/leaving; use the Entered signal instead.

Definition at line 96 of file Room.h.

Referenced by Eris::Room::getPeople().

◆ Disappearance

sigc::signal<void, Room*, Person*> Eris::Room::Disappearance
inherited

Similarly, emitted when the specifed person leaves the room.

Definition at line 99 of file Room.h.

Referenced by Eris::Room::getPeople().

◆ Emote

sigc::signal<void, Room*, Person*, const std::string&> Eris::Room::Emote
inherited

Emote (/me) callback. The arguments are identical to those for Talk above

Definition at line 91 of file Room.h.

Referenced by Eris::Room::getPeople().

◆ Entered

sigc::signal<void, Room*> Eris::Room::Entered
inherited

Emitted when entry into the room (after a Join) is complete, i.e the user list has been transferred and resolved.

Definition at line 84 of file Room.h.

Referenced by Eris::Room::getPeople().

◆ PrivateTalk

sigc::signal<void, Person*, const std::string&> Eris::Lobby::PrivateTalk

Emitted when some person sends a private (one-to-one) chat message to the client's account. The first argument is the sender, which will always be a valid Person object, and the second is the message text.

Definition at line 67 of file Lobby.h.

◆ SightPerson

sigc::signal<void, Person*> Eris::Lobby::SightPerson

Emitted when sight of a person is received.

Definition at line 60 of file Lobby.h.

Referenced by Eris::Room::getPeople(), and getRoom().

◆ Speech

sigc::signal<void, Room*, Person*, const std::string&> Eris::Room::Speech
inherited

The primary talk callback. The arguments are the source room, the person talking, and the message itself

Definition at line 88 of file Room.h.

Referenced by Eris::Room::getPeople().


The documentation for this class was generated from the following files: