#include <Account.h>
Public Member Functions | ||||
Account (Connection *con) | ||||
Create a new Account object : currently only one is assumed, but multiple Accounts might be supported in the future. | ||||
Result | login (const std::string &uname, const std::string &pwd) | |||
This is the basic way of logging into an existing account. | ||||
Result | createAccount (const std::string &uname, const std::string &fullName, const std::string &pwd) | |||
Attempt to create a new account on the server and log into it. | ||||
Result | logout () | |||
Initiate a clean disconnection from the server. | ||||
bool | isLoggedIn () const | |||
Many operations will produce errors if the account is not logged in. | ||||
const std::vector< std::string > & | getCharacterTypes (void) const | |||
Returns a container of character types that the client is allowed to create. | ||||
const CharacterMap & | getCharacters () | |||
Note you should call refreshCharacterInfo, and wait for the GotAllCharacters signal, prior to the initial call : otherwise, it will return an empty or incomplete list. | ||||
Result | refreshCharacterInfo () | |||
Update the charcter list (based on changes to play). | ||||
Result | takeCharacter (const std::string &id) | |||
| ||||
Result | createCharacter (const Atlas::Objects::Entity::RootEntity &character) | |||
enter the game using a new character | ||||
bool | canCreateCharacter () | |||
returns true if the game has defined a character creation dialog | ||||
const ActiveCharacterMap & | getActiveCharacters () const | |||
Result | deactivateCharacter (Avatar *av) | |||
Request de-activation of a character. | ||||
const std::string & | getId () const | |||
returns the account ID if logged in | ||||
const std::string & | getUsername () const | |||
Return the username of this account. | ||||
Connection * | getConnection () const | |||
Access the underlying Connection for this account. | ||||
Public Attributes | ||||
sigc::signal< void, const Atlas::Objects::Entity::RootEntity & > | GotCharacterInfo | |||
emitted when a character has been retrived from the server | ||||
sigc::signal< void > | GotAllCharacters | |||
emitted when the entire character list had been updated | ||||
sigc::signal< void, const std::string & > | LoginFailure | |||
The argument is an error message from the server - hopefully this will become something more useful such as an enum code, in the future. | ||||
sigc::signal< void > | LoginSuccess | |||
Emitted when login or character creation is successful. | ||||
sigc::signal< void, bool > | LogoutComplete | |||
Depending on whether the logout completed with a positive server acknowledgement or just timedout, the argument will be either true (success, clean logout) or false (failure, timeout or other problem). | ||||
sigc::signal< void, Avatar * > | AvatarSuccess | |||
Emitted when creating a character or taking an existing one succeeds. | ||||
sigc::signal< void, const std::string & > | AvatarFailure | |||
Emitted when creating or taking a character fails for some reason. | ||||
sigc::signal< void, Avatar * > | AvatarDeactivated | |||
Emitted when an active avatar is deactivated. | ||||
Protected Types | ||||
enum | Status { DISCONNECTED = 0, LOGGING_IN, LOGGED_IN, LOGGING_OUT, TAKING_CHAR, CREATING_CHAR } | |||
Protected Member Functions | ||||
void | sightCharacter (const Atlas::Objects::Operation::RootOperation &op) | |||
void | loginComplete (const Atlas::Objects::Entity::Account &p) | |||
void | loginError (const Atlas::Objects::Operation::Error &err) | |||
Result | 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 | loginResponse (const Atlas::Objects::Operation::RootOperation &op) | |||
void | logoutResponse (const Atlas::Objects::Operation::RootOperation &op) | |||
void | avatarResponse (const Atlas::Objects::Operation::RootOperation &op) | |||
void | avatarLogoutResponse (const Atlas::Objects::Operation::RootOperation &op) | |||
void | handleLogoutTimeout () | |||
void | handleLoginTimeout () | |||
void | internalDeactivateCharacter (Avatar *av) | |||
void | updateFromObject (const Atlas::Objects::Entity::Account &p) | |||
Friends | ||||
class | AccountRouter | |||
class | Avatar |
Future versions of Eris will support multiple Account objects per Connection, allowing various configurations of interface, proxies and so forth.
Account is also the mechanism by which Lobby and Avatars objects are made available to the client, in response to login / create operations
enum Eris::Account::Status [protected] |
Eris::Account::Account | ( | Connection * | con | ) |
Create a new Account object : currently only one is assumed, but multiple Accounts might be supported in the future.
con | A valid (but not necessarily connected) Connection instance |
Result Eris::Account::login | ( | const std::string & | uname, | |
const std::string & | pwd | |||
) |
This is the basic way of logging into an existing account.
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.
uname | The username of the account | |
pwd | The correct password for the account |
Result Eris::Account::logout | ( | ) |
Initiate a clean disconnection from the server.
The LogoutComplete signal will be emitted when the process completes. Calling this on an Account which is not logged in will produce an error.
Result Eris::Account::refreshCharacterInfo | ( | ) |
Update the charcter list (based on changes to play).
The intention here is that clients will call this method for some kind of'choose character' interface or menu, and wait for the GotAllCharacters signal before displaying the list. Alternatively, you can display the UI immediatley, and add character entries based on the GotCharacterInfo signal, which will be emitted once for each character.
Result Eris::Account::takeCharacter | ( | const std::string & | id | ) |
id | The id of the game entity to activate; this must be owned by the account. |
Result Eris::Account::deactivateCharacter | ( | Avatar * | av | ) |
Request de-activation of a character.
The 'AvatarDeactivated' signal will be emitted when the deactivation completes.
sigc::signal<void, const std::string &> Eris::Account::AvatarFailure |
Emitted when creating or taking a character fails for some reason.
String argument is the error messgae from the server.
sigc::signal<void, Avatar*> Eris::Account::AvatarDeactivated |