Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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.

CharacterList 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

const std::string & getAccountID () const
 returns the account ID if logged in, or throws and exception


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)


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 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 ()

Protected Attributes

Connection_con
 underlying connection instance

std::string _account
 account ID (the username, at present)

CharacterList _characters
 charatcers belonging to this player

StringList _charIds
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 Thu May 22 08:01:12 2003 for Eris by doxygen1.3-rc3