58 static const Uint16 _messages[] = {
86 const int count = (msg.
getLength() - 24) / 106;
88 for (
int i = 0; i < count; ++i)
94 character->dummy->getName().c_str(), character->slot);
106 "too many players on this server.");
136 new OkDialog(
_(
"Error"),
_(
"Failed to create character. Most "
137 "likely the name is already taken."));
148 new OkDialog(
_(
"Info"),
_(
"Character deleted."));
153 new OkDialog(
_(
"Error"),
_(
"Failed to delete character."));
201 y * tileHeight + tileHeight / 2));
261 character->
dummy = tempPlayer;
263 for (
int i = 0; i < 6; i++)
283 std::vector<std::string> attributes;
284 attributes.emplace_back(
_(
"Strength:"));
285 attributes.emplace_back(
_(
"Agility:"));
286 attributes.emplace_back(
_(
"Vitality:"));
287 attributes.emplace_back(
_(
"Intelligence:"));
288 attributes.emplace_back(
_(
"Dexterity:"));
289 attributes.emplace_back(
_(
"Luck:"));
325 Gender ,
int hairstyle,
int hairColor,
326 const std::vector<int> &stats)
330 for (
int i = 0; i < 6; i++)
378 return max ? max : 11;
384 return max ? max : 19;
Net::CharHandler * charHandler
void setPosition(const Vector &pos) final
Sets the pixel position of this actor.
void setMap(Map *map) final
Character creation dialog.
void setAttributes(const std::vector< std::string > &labels, unsigned available, unsigned min, unsigned max)
void setDefaultGender(Gender gender)
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.
int getTileHeight() const
Returns the tile height used by this map.
int getTileWidth() const
Returns the tile width of this map.
CharSelectDialog * mCharSelectDialog
Net::Characters mCharacters
The list of available characters.
Net::Character * mSelectedCharacter
The selected character.
void unlockCharSelectDialog()
CharCreateDialog * mCharCreateDialog
void updateCharSelectDialog()
const uint16_t * handledMessages
int getCharCreateMaxHairStyleId() const override
Returns the max permitted hair style Id at character creation time, or 0 if no limit should be applie...
void deleteCharacter(Net::Character *character) override
unsigned int baseSprite() const override
static void readPlayerData(MessageIn &msg, Net::Character *character)
void setCharSelectDialog(CharSelectDialog *window) override
void newCharacter(const std::string &name, int slot, Gender gender, int hairstyle, int hairColor, const std::vector< int > &stats) override
int getCharCreateMaxHairColorId() const override
Returns the max permitted hair color Id at character creation time, or 0 if no limit should be applie...
unsigned int hairSprite() const override
void setCharCreateDialog(CharCreateDialog *window) override
Sets the character create dialog.
int getCharCreateMinHairColorId() const override
Returns the min permitted hair color Id at character creation time, or 0 if there is no minimum.
void requestCharacters() override
void switchCharacter() override
unsigned int maxSprite() const override
void chooseCharacter(Net::Character *character) override
void handleMessage(MessageIn &msg) override
void setMap(const std::string &map)
Used for parsing an incoming message from eAthena.
std::string readString(int length=-1)
Reads a string.
void skip(unsigned int length)
Skips a given number of bytes.
uint16_t readInt16()
Reads an unsigned 16-bit integer from the message.
uint8_t readInt8()
Reads an unsigned 8-bit integer from the message.
uint16_t getId() const
Returns the message ID.
uint32_t readInt32()
Reads an unsigned 32-bit integer from the message.
unsigned int getLength() const
Returns the message length.
Used for building an outgoing message to eAthena.
void writeInt32(uint32_t value)
Writes an unsigned 32-bit integer to the message.
void writeInt8(uint8_t value)
Writes an unsigned 8-bit integer to the message.
void writeInt16(uint16_t value)
Writes an unsigned 16-bit integer to the message.
void writeString(const std::string &string, int length=-1)
Writes a string.
bool connect(const ServerInfo &server)
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
unsigned int getAttributeMaximum()
Give the maximum attribute point possible at character's creation.
unsigned int getCreationPoints()
Give the attribute points given to a character at its creation.
unsigned int getAttributeMinimum()
Give the minimum attribute point possible at character's creation.
unsigned getMaxHairStyle()
unsigned getMaxHairColor()
unsigned getMinHairColor()
void info(const char *log_text,...) LOG_PRINTF_ATTR
LoginHandler * getLoginHandler()
GameHandler * getGameHandler()
void setBackend(const PlayerInfoBackend &backend)
Changes the internal PlayerInfoBackend reference;.
Warning: buffers and other variables are shared, so there can be only one connection active at a time...
@ SMSG_CHAR_DELETE_SUCCEEDED
@ SMSG_CHAR_CREATE_SUCCEEDED
@ SMSG_CHAR_DELETE_FAILED
@ SMSG_CHAR_CREATE_FAILED
@ CMSG_CHAR_SERVER_CONNECT
Gender sexToGender(SEX sex)
const char * ipToString(int address)
Converts the given IP address to a string.
A structure to hold information about a character.
LocalPlayer * dummy
A dummy representing this character.
int slot
The index in the list of characters.
std::map< int, Stat > mStats
std::map< int, int > mAttributes
#define CLIENT_PROTOCOL_VERSION
Protocol version, reported to the eAthena char and mapserver who can adjust the protocol accordingly.