Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Eris::Player Class Reference

A Player object represents the encapsulation of a server account, and it's binding to a character in the game world. More...

#include <Player.h>

List of all members.

Public Member Functions

 Player (Connection *con)
 create a new Player object : currently only one is assumed, but multiple might be supported in the future
void login (const std::string &uname, const std::string &pwd)
 Server-side failures during the login process, such as the account being unknown or an incorrect password being supplied, will result in the 'LoginFailure' signal being emitted with some vaugely helpful error message, and an error code.
void createAccount (const std::string &uname, const std::string &name, const std::string &pwd)
void logout ()
 Initiate a clean disconnection from the server.
const CharacterMap & getCharacters ()
 access the characters currently owned by the player : note you should call refreshCharacterInfo, and wait for 'GotCharacters' signal, prior to the initial call : otherwise, it may return an empty or incomplete list.
void refreshCharacterInfo ()
 update the charcter list (based on changes to play).
Avatar * takeCharacter (const std::string &id)
 enter the game using an existing character
Avatar * createCharacter (const Atlas::Objects::Entity::GameEntity &character)
 enter the game using a new character
void createCharacter ()
 pop up the game's character creation dialog, if present
bool canCreateCharacter ()
 returns true if the game has defined a character creation dialog
const std::string & getAccountID () const
 returns the account ID if logged in, or throws and exception
ConnectiongetConnection () const

Public Attributes

SigC::Signal1< void, const
Atlas::Objects::Entity::GameEntity & > 
GotCharacterInfo
 emitted when a character has been retrived from the server
SigC::Signal0< void > GotAllCharacters
 emitted when the entire character list had been updated
SigC::Signal2< void, LoginFailureType,
const std::string & > 
LoginFailure
 emitted when a server-side error occurs during account creation / login
SigC::Signal0< void > LoginSuccess
SigC::Signal1< void, bool > LogoutComplete
 emitted when a LOGOUT operation completes; either cleanly (argument = true), indicating the LOGOUT was acknowledged by the server, or due to a timeout or other error (argument = false)
SigC::Signal1< void, Avatar * > NewCharacter
 emitted when a character is created by the zero-argument createCharacter()

Protected Member Functions

void recvOpError (const Atlas::Objects::Operation::Error &err)
void recvSightCharacter (const Atlas::Objects::Entity::GameEntity &ge)
void loginComplete (const Atlas::Objects::Entity::Player &p)
void internalLogin (const std::string &unm, const std::string &pwd)
void internalLogout (bool clean)
void netConnected ()
 Callback for network re-establishment.
bool netDisconnecting ()
 help! the plug is being pulled!
void netFailure (const std::string &msg)
void recvLogoutInfo (const Atlas::Objects::Operation::Logout &lo)
void handleLogoutTimeout ()
void recvRemoteLogout (const Atlas::Objects::Operation::Logout &lo)
void createCharacterHandler (long serialno)

Protected Attributes

Connection_con
 underlying connection instance
std::string _account
 account ID (the username, at present)
CharacterMap _characters
 charatcers belonging to this player
StringSet m_characterIds
bool m_doingCharacterRefresh
 set if we're refreshing character data
std::string _username
 The player's username ( != account object's ID).
std::string _pass
 The password; FIXME - clear text.
std::string _currentAction
 current action tracking (for error processing)
long _currentSerial
 serial no of the Atlas operation
Timeout_logoutTimeout
Lobby_lobby


Detailed Description

A Player object represents the encapsulation of a server account, and it's binding to a character in the game world.

Future versions of Eris will support mutliple Player objects per Connection, allowing various configurations of interface, proxies and so forth.
Player is also the mechanism by which Lobby and World objects are made available to the client, in response to login / create operations


Member Function Documentation

void Eris::Player::createAccount const std::string &  uname,
const std::string &  name,
const std::string &  pwd
 

Parameters:
uname The desired username of the account (eg 'bryceh')
name The real name of the user (e.g 'Bryce Harrington')
pwd The password for the new account

void Eris::Player::login const std::string &  uname,
const std::string &  pwd
 

Server-side failures during the login process, such as the account being unknown or an incorrect password being supplied, will result in the 'LoginFailure' signal being emitted with some vaugely helpful error message, and an error code.

The LoginSuccess signal will be emitted upon sucessful completion of the login process.

void Eris::Player::logout  ) 
 

Initiate a clean disconnection from the server.

The LogoutComplete signal will be emitted when the process completes

void Eris::Player::refreshCharacterInfo  ) 
 

update the charcter list (based on changes to play).

The intention here is that clients will call this method when the user invokes the 'choose character' command, and wait for the 'GotCharacters signal before displaying. Alternatively, you can display the UI immediatley, and add character entries based on the 'GotCharacterInfo' signal, which will be emitted once for each character.

Avatar * Eris::Player::takeCharacter const std::string &  id  ) 
 

enter the game using an existing character

Parameters:
id The Atlas-ID of the game entity to take-over; this must be owned by the player's account


The documentation for this class was generated from the following files:
Generated on Wed Nov 10 20:56:36 2004 for Eris by  doxygen 1.3.9.1