63 static const Uint16 _messages[] = {
115 int equipmentCount = msg.
readInt8();
116 while (equipmentCount--)
118 auto &slot = info.equipment.emplace_back();
123 int attributeCount = msg.
readInt8();
124 while (attributeCount--)
174 "is out of the permitted range: (%u - %u)."),
220 new OkDialog(
_(
"Info"),
_(
"Player deleted."));
281 "error message %i."), errMsg);
335 const std::vector<int> &stats)
345 for (
int stat : stats)
395 character->
slot = info.slot;
402 for (
auto &slot : info.equipment)
410 character->data.mAttributes[
CHAR_POINTS] = info.characterPoints;
411 character->data.mAttributes[
CORR_POINTS] = info.correctionPoints;
413 for (
const auto &[
id, attr] : info.attributes)
416 if (playerInfoId > -1)
418 character->data.mAttributes[playerInfoId] = attr.mod;
422 character->data.mStats[id].base = attr.base;
423 character->data.mStats[id].mod = attr.mod;
void setSprite(unsigned slot, int id, const std::string &color=std::string(), bool isWeapon=false)
Sets visible equipments for this being.
void setName(const std::string &name)
Sets the name for the being.
void setGender(Gender gender)
Sets the gender of this being.
Character creation dialog.
void setAttributes(const std::vector< std::string > &labels, unsigned available, unsigned min, unsigned max)
void unlock()
Unlocks the dialog, enabling the create character button again.
Character selection dialog.
static void setState(State state)
const std::string & getHairColor(int id) const
The local player character.
unsigned int hairSprite() const override
void newCharacter(const std::string &name, int slot, Gender gender, int hairstyle, int hairColor, const std::vector< int > &stats) override
void deleteCharacter(Net::Character *character) override
void handleCharacterCreateResponse(MessageIn &msg)
unsigned int baseSprite() const override
unsigned int maxSprite() const override
void requestCharacters() override
void handleMessage(MessageIn &msg) override
void handleCharacterInfo(MessageIn &msg)
void switchCharacter() override
void setCharSelectDialog(CharSelectDialog *window) override
void handleCharacterDeleteResponse(MessageIn &msg)
void setCharCreateDialog(CharCreateDialog *window) override
Sets the character create dialog.
void handleCharacterSelectResponse(MessageIn &msg)
void chooseCharacter(Net::Character *character) override
std::vector< CachedCharacterInfo > mCachedCharacterInfos
Cached character information.
bool isConnected()
Returns whether the server is connected.
void send(const ManaServ::MessageOut &msg)
Sends a message.
void quit(bool reconnectAccount)
Used for parsing an incoming message from manaserv.
uint16_t readInt16()
Reads an unsigned 16-bit integer from the message.
unsigned int getUnreadLength() const
Returns the length of unread data.
std::string readString(int length=-1)
Reads a string.
uint16_t getId() const
Returns the message ID.
uint32_t readInt32()
Reads an unsigned 32-bit integer from the message.
uint8_t readInt8()
Reads an unsigned 8-bit integer from the message.
Used for building an outgoing message to manaserv.
void writeInt16(uint16_t value)
Writes an unsigned 16-bit integer to the message.
void writeInt8(uint8_t value)
Writes an unsigned 8-bit integer to the message.
void writeString(const std::string &string, int length=-1)
Writes a string.
CharSelectDialog * mCharSelectDialog
Net::Characters mCharacters
The list of available characters.
Net::Character * mSelectedCharacter
The selected character.
void unlockCharSelectDialog()
CharCreateDialog * mCharCreateDialog
void updateCharSelectDialog()
virtual unsigned int getVisibleSlotsNumber() const
virtual bool isWeaponSlot(unsigned int slotTypeId) const =0
const uint16_t * handledMessages
void scheduleDelete()
Schedule this window for deletion.
HairDB hairDB
Hair styles and colors info database.
void delete_all(Container &c)
LocalPlayer * local_player
Net::CharHandler * charHandler
ManaServ::GameHandler * gameHandler
unsigned int getAttributeMaximum()
Give the maximum attribute point possible at character's creation.
std::vector< std::string > & getLabels()
Returns the list of base attribute labels.
unsigned int getCreationPoints()
Give the attribute points given to a character at its creation.
int getPlayerInfoIdFromAttrId(int attrId)
Give back the corresponding playerinfo Id from the attribute id defined in the xml file.
unsigned int getAttributeMinimum()
Give the minimum attribute point possible at character's creation.
void info(const char *log_text,...) LOG_PRINTF_ATTR
@ FIXED_SPRITE_LAYER_SIZE
@ CREATE_ATTRIBUTES_TOO_HIGH
@ CREATE_INVALID_HAIRSTYLE
@ CREATE_ATTRIBUTES_OUT_OF_RANGE
@ CREATE_TOO_MUCH_CHARACTERS
@ CREATE_ATTRIBUTES_TOO_LOW
@ CREATE_INVALID_HAIRCOLOR
Connection * gameServerConnection
Connection * chatServerConnection
Connection * accountServerConnection
Gender getGender(int gender)
Helper function for getting gender by int.
@ ERRMSG_INVALID_ARGUMENT
@ APMSG_CHAR_CREATE_RESPONSE
@ APMSG_CHAR_SELECT_RESPONSE
@ APMSG_CHAR_DELETE_RESPONSE
LoginHandler * getLoginHandler()
InventoryHandler * getInventoryHandler()
void setBackend(const PlayerInfoBackend &backend)
Changes the internal PlayerInfoBackend reference;.
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.
Character information needs to be cached since we receive it before we have loaded the dynamic data,...
A structure to hold information about a character.
LocalPlayer * dummy
A dummy representing this character.
int slot
The index in the list of characters.