#include <accountconnection.hpp>
Public Member Functions | |
AccountConnection () | |
Constructor. | |
~AccountConnection () | |
Destructor. | |
bool | start () |
Initializes a connection to the account server described in the configuration file. | |
void | sendCharacterData (Character *) |
Sends data of a given character. | |
void | playerReconnectAccount (int id, const std::string &magic_token) |
Prepares the account server for a reconnecting player. | |
void | requestQuestVar (Character *, const std::string &) |
Requests the value of a quest variable from the database. | |
void | updateQuestVar (Character *, const std::string &name, const std::string &value) |
Pushes a new quest value to the database. | |
void | banCharacter (Character *, int) |
Sends ban message. | |
void | sendStatistics () |
Gathers statistics and sends them. | |
void | sendPost (Character *, MessageIn &) |
Send letter. | |
void | getPost (Character *) |
Get post. | |
void | changeAccountLevel (Character *, int) |
Change Account Level. | |
void | syncChanges (bool force=false) |
Sends all changed player data to the account server to minimize dataloss due to failure of one server component. | |
void | updateCharacterPoints (int charId, int charPoints, int corrPoints, int attribId, int attribValue) |
Write a modification message about character points to the sync buffer. | |
void | updateExperience (int charId, int skillId, int skillValue) |
Write a modification message about character skills to the sync buffer. | |
void | updateOnlineStatus (int charId, bool online) |
Update the status of a character to online (true) or offline (false). | |
void | sendTransaction (int id, int action, const std::string &message) |
Send transaction to account server. | |
Protected Member Functions | |
virtual void | processMessage (MessageIn &) |
Processes server messages. |
Definition at line 49 of file accountconnection.hpp.
bool AccountConnection::start | ( | ) |
Initializes a connection to the account server described in the configuration file.
Registers the maps known by MapManager.
Definition at line 51 of file accountconnection.cpp.
References Connection::send(), Connection::start(), MessageOut::writeLong(), MessageOut::writeShort(), and MessageOut::writeString().
void AccountConnection::syncChanges | ( | bool | force = false |
) |
Sends all changed player data to the account server to minimize dataloss due to failure of one server component.
The gameserver holds a buffer with all changes made by a character.
force | Send changes even if buffer hasn't reached its size or message limit. (used to send in timed schedules) |
The sync buffer is sent when:
Definition at line 315 of file accountconnection.cpp.
References MessageOut::getLength(), Connection::send(), and MessageOut::writeByte().
Referenced by updateCharacterPoints(), updateExperience(), and updateOnlineStatus().
void AccountConnection::updateCharacterPoints | ( | int | charId, | |
int | charPoints, | |||
int | corrPoints, | |||
int | attribId, | |||
int | attribValue | |||
) |
Write a modification message about character points to the sync buffer.
charId | ID of the character | |
charPoints | character points left for the character | |
corrPoints | correction points left for the character | |
attribId | ID of the modified attribute | |
attribValue | New value of the modified attribute |
Definition at line 346 of file accountconnection.cpp.
References syncChanges(), MessageOut::writeByte(), and MessageOut::writeLong().
Referenced by GameHandler::processMessage().
void AccountConnection::updateExperience | ( | int | charId, | |
int | skillId, | |||
int | skillValue | |||
) |
Write a modification message about character skills to the sync buffer.
charId | ID of the character | |
skillId | ID of the skill | |
skillValue | new skill points |
Definition at line 361 of file accountconnection.cpp.
References syncChanges(), MessageOut::writeByte(), and MessageOut::writeLong().
Referenced by Character::receiveExperience().
void AccountConnection::updateOnlineStatus | ( | int | charId, | |
bool | online | |||
) |
Update the status of a character to online (true) or offline (false).
charId | Id of the character. | |
online | True to flag the character as being online. |
Definition at line 372 of file accountconnection.cpp.
References syncChanges(), MessageOut::writeByte(), and MessageOut::writeLong().