6 #include "TransferInfo.h" 8 #include <Atlas/Objects/ObjectsFwd.h> 10 #include <sigc++/signal.h> 29 typedef std::map<std::string, Atlas::Objects::Entity::RootEntity>
CharacterMap;
31 typedef std::map<std::string, std::unique_ptr<Avatar>> ActiveCharacterMap;
42 class Account :
virtual public sigc::trackable {
64 Result login(
const std::string &uname,
const std::string &pwd);
78 const std::string &fullName,
79 const std::string &pwd);
139 Result createCharacterThroughOperation(
const Atlas::Objects::Operation::Create &c);
160 const std::string &
getId()
const;
236 void sightCharacter(
const Atlas::Objects::Operation::RootOperation &op);
238 void loginComplete(
const Atlas::Objects::Entity::Account &p);
240 void loginError(
const Atlas::Objects::Operation::Error &err);
242 Result internalLogin(
const std::string &unm,
const std::string &pwd);
244 void internalLogout(
bool clean);
252 void netFailure(
const std::string &msg);
254 void loginResponse(
const Atlas::Objects::Operation::RootOperation &op);
256 void logoutResponse(
const Atlas::Objects::Operation::RootOperation &op);
258 void possessResponse(
const Atlas::Objects::Operation::RootOperation &op);
260 void avatarCreateResponse(
const Atlas::Objects::Operation::RootOperation &op);
262 void avatarLogoutResponse(
const Atlas::Objects::Operation::RootOperation &op);
274 void handleLogoutTimeout();
277 void handleLoginTimeout();
290 void internalDeactivateCharacter(
const std::string& avatarId);
292 virtual void updateFromObject(
const Atlas::Objects::Entity::Account &p);
296 std::unique_ptr<AccountRouter> m_router;
302 std::string m_parent;
304 std::set<std::string> m_characterIds;
307 ActiveCharacterMap m_activeAvatars;
308 std::unique_ptr<TimedEvent> m_timeout;
322 return m_activeAvatars;
sigc::signal< void, const std::string & > AvatarDeactivated
Result takeCharacter(const std::string &id)
Enter the game using an existing character.
void avatarLogoutRequested(Avatar *avatar)
Called when a logout of the avatar has been requested by the server.
a character was created, we now need to possess it
Result refreshCharacterInfo()
sigc::signal< void, const std::string & > AvatarFailure
Account(Connection &con)
Create a new Account associated with a Connection object.
const std::string & getId() const
returns the account ID if logged in
sigc::signal< void, const Atlas::Objects::Entity::RootEntity & > GotCharacterInfo
emitted when a character has been retrieved from the server
Default state, no server account active.
sent a LOOK op for a character, awaiting INFO response
sigc::signal< void > GotAllCharacters
emitted when the entire character list had been updated
void destroyAvatar(const std::string &avatarId)
Destroys the avatar with the specified id, if available.
sigc::signal< void > LoginSuccess
Result login(const std::string &uname, const std::string &pwd)
Login to the server using user-supplied account information.
const std::string & getUsername() const
sigc::signal< void, const std::string & > ErrorMessage
CharacterMap _characters
characters belonging to this player
Status m_status
what the Player is currently doing
bool canCreateCharacter()
pop up the game's character creation dialog, if present
Result createCharacterThroughEntity(const Atlas::Objects::Entity::RootEntity &character)
enter the game using a new character
Login sent, waiting for initial INFO response.
Connection & getConnection() const
Access the underlying Connection for this account.
Fully logged into a server-side account.
const std::vector< SpawnPoint > & getSpawnPoints() const
Gets the available spawn points from where the client can create new characters.
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.
bool m_doingCharacterRefresh
set if we're refreshing character data
Encapsulates all the state of an Atlas Account, and methods that operation on that state...
std::string m_username
The player's username ( != account object's ID)
std::string m_accountId
the account ID
Sent a logout op, waiting for the INFO response.
std::vector< SpawnPoint > m_spawnPoints
A map of available spawn points. These are points from which a new avatar can be created.
const std::string & getParent() const
Gets the parent type of the account.
Connection & m_con
underlying connection instance
std::map< std::string, Atlas::Objects::Entity::RootEntity > CharacterMap
sigc::signal< void, const std::string & > LoginFailure
Emitted when a server-side error occurs during account creation / login.
Result logout()
Request logout from the server.
const ActiveCharacterMap & getActiveCharacters() const
Gets a list of active characters, i.e. entities on the server which the account can control...
Result takeTransferredCharacter(const std::string &id, const std::string &key)
Transfer all characters to this account and then do all steps in takeCharacter()
Represents a possible spawn point as described by the server. When a new character is created on the ...
void netConnected()
Callback for network re-establishment.
const CharacterMap & getCharacters()
Get the characters owned by this account.
sigc::signal< void, Avatar * > AvatarSuccess
bool isLoggedIn() const
Check if the account is logged in.
sigc::signal< void, bool > LogoutComplete
Emitted when a logout completes.
send a character CREATE op, awaiting INFO response
bool netDisconnecting()
help! the plug is being pulled!