ManaPlus
Functions | Variables
EAthena::CharServerRecv Namespace Reference

Functions

void readPlayerData (Net::MessageIn &msg, Net::Character *const character)
 
void processPincodeStatus (Net::MessageIn &msg)
 
void processPincodeStatus2 (Net::MessageIn &msg)
 
void processPincodeMakeStatus (Net::MessageIn &msg)
 
void processPincodeEditStatus (Net::MessageIn &msg)
 
void processCharLogin2 (Net::MessageIn &msg)
 
void processCharCreate (Net::MessageIn &msg)
 
void processCharCheckRename (Net::MessageIn &msg)
 
void processCharRename (Net::MessageIn &msg)
 
void processCharChangeSlot (Net::MessageIn &msg)
 
void processCharDeleteFailed (Net::MessageIn &msg)
 
void processCharCaptchaNotSupported (Net::MessageIn &msg)
 
void processCharDelete2Ack (Net::MessageIn &msg)
 
void processCharDelete2AcceptActual (Net::MessageIn &msg)
 
void processCharDelete2CancelAck (Net::MessageIn &msg)
 
void processCharCharacters (Net::MessageIn &msg)
 
void processCharBanCharList (Net::MessageIn &msg)
 
void processCharLogin (Net::MessageIn &msg)
 
void processCharMapInfo (Net::MessageIn &msg)
 
void processChangeMapServer (Net::MessageIn &msg)
 

Variables

std::string mNewName
 
BeingId mRenameId = BeingId_zero
 

Function Documentation

◆ processChangeMapServer()

void EAthena::CharServerRecv::processChangeMapServer ( Net::MessageIn msg)

Definition at line 310 of file charserverrecv.cpp.

311 {
312  Network *const network = Network::mInstance;
313  ServerInfo &server = mapServer;
314  BLOCK_START("CharServerRecv::processChangeMapServer")
315  if (network == nullptr)
316  {
317  BLOCK_END("CharServerRecv::processChangeMapServer")
318  return;
319  }
320  GameHandler::setMap(msg.readString(16, "map name"));
321  const int x = msg.readInt16("x");
322  const int y = msg.readInt16("y");
323  if (config.getBoolValue("usePersistentIP") || settings.persistentIp)
324  {
325  msg.readInt32("host");
326  server.hostname = settings.serverName;
327  }
328  else
329  {
330  server.hostname = ipToString(msg.readInt32("host"));
331  }
332  server.port = msg.readInt16("port");
333  if (msg.getVersion() >= 20170315)
334  {
335  for (int f = 0; f < 32; f ++)
336  msg.readInt32("unknown");
337  }
338 
339  network->disconnect();
341  if (localPlayer != nullptr)
342  {
344  localPlayer->setMap(nullptr);
345  }
346  BLOCK_END("CharServerRecv::processChangeMapServer")
347 }
void setState(const StateT state)
Definition: client.h:66
void setTileCoords(const int x, const int y)
void setMap(Map *const map)
std::string hostname
Definition: serverinfo.h:45
uint16_t port
Definition: serverinfo.h:58
std::string serverName
Definition: settings.h:114
Configuration config
Client * client
Definition: client.cpp:118
if(!vert) return
LocalPlayer * localPlayer
bool msg(InputEvent &event)
Definition: chat.cpp:39
ServerInfo mapServer
@ CHANGE_MAP
Definition: state.h:50
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79
Settings settings
Definition: settings.cpp:32
const char * ipToString(const uint32_t address)
Definition: stringutils.cpp:86

References BLOCK_END, BLOCK_START, State::CHANGE_MAP, client, config, Ea::Network::disconnect(), Configuration::getBoolValue(), ServerInfo::hostname, ipToString(), localPlayer, EAthena::mapServer, EAthena::Network::mInstance, Actions::msg(), Settings::persistentIp, ServerInfo::port, Settings::serverName, Ea::GameHandler::setMap(), LocalPlayer::setMap(), Client::setState(), LocalPlayer::setTileCoords(), settings, x, and y.

◆ processCharBanCharList()

void EAthena::CharServerRecv::processCharBanCharList ( Net::MessageIn msg)

Definition at line 569 of file charserverrecv.cpp.

570 {
572  const int count = (msg.readInt16("len") - 4) / 24;
573  for (int f = 0; f < count; f ++)
574  {
575  msg.readInt32("char id");
576  msg.readString(20, "unbun time");
577  }
578 }
#define UNIMPLEMENTEDPACKET
Definition: logger.h:56

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processCharCaptchaNotSupported()

void EAthena::CharServerRecv::processCharCaptchaNotSupported ( Net::MessageIn msg)

Definition at line 512 of file charserverrecv.cpp.

513 {
515  msg.readInt16("5");
516  msg.readUInt8("1");
517 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processCharChangeSlot()

void EAthena::CharServerRecv::processCharChangeSlot ( Net::MessageIn msg)

Definition at line 484 of file charserverrecv.cpp.

485 {
487  msg.readInt16("len");
488  msg.readInt16("flag"); // 0 - ok, 1 - error
489  msg.readInt16("unused");
490 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processCharCharacters()

void EAthena::CharServerRecv::processCharCharacters ( Net::MessageIn msg)

Definition at line 543 of file charserverrecv.cpp.

544 {
545  msg.readInt16("packet len");
546 
549 
550  // Derive number of characters from message length
551  const int count = (msg.getLength() - 4)
552  / (106 + 4 + 2 + 16 + 4 + 4 + 4 + 4);
553 
554  for (int i = 0; i < count; ++i)
555  {
556  Net::Character *const character = new Net::Character;
557  readPlayerData(msg, character);
558  Net::CharServerHandler::mCharacters.push_back(character);
559  if (character->dummy != nullptr)
560  {
561  logger->log("CharServer: Player: %s (%d)",
562  character->dummy->getName().c_str(), character->slot);
563  }
564  }
565 
567 }
const std::string & getName() const
Definition: being.h:232
void log(const char *const log_text,...)
Definition: logger.cpp:269
static Net::Characters mCharacters
void delete_all(Container &c)
Definition: dtor.h:56
Logger * logger
Definition: logger.cpp:89
void readPlayerData(Net::MessageIn &msg, Net::Character *const character)
@ CHAR_SELECT
Definition: state.h:47
LocalPlayer * dummy
Definition: character.h:56
uint16_t slot
Definition: character.h:58

References State::CHAR_SELECT, client, delete_all(), Net::Character::dummy, Being::getName(), Logger::log(), logger, Net::CharServerHandler::mCharacters, Actions::msg(), readPlayerData(), Client::setState(), and Net::Character::slot.

◆ processCharCheckRename()

void EAthena::CharServerRecv::processCharCheckRename ( Net::MessageIn msg)

Definition at line 402 of file charserverrecv.cpp.

403 {
404  if (msg.readInt16("flag") != 0)
405  {
406  createOutPacket(CMSG_CHAR_RENAME);
407  outMsg.writeBeingId(mRenameId, "char id");
408  }
409  else
410  {
412  // TRANSLATORS: error header
413  _("Error"),
414  // TRANSLATORS: error message
415  _("Character rename error."),
416  // TRANSLATORS: ok dialog button
417  _("Error"),
419  Modal_true,
421  nullptr,
422  260);
423  }
424 }
#define CREATEWIDGET(type,...)
Definition: createwidget.h:29
#define _(s)
Definition: gettext.h:35
#define createOutPacket(name)
Definition: messageout.h:37
const bool Modal_true
Definition: modal.h:30
const bool ShowCenter_true
Definition: showcenter.h:30

References _, createOutPacket, CREATEWIDGET, DialogType::ERROR, Modal_true, mRenameId, Actions::msg(), and ShowCenter_true.

◆ processCharCreate()

void EAthena::CharServerRecv::processCharCreate ( Net::MessageIn msg)

Definition at line 387 of file charserverrecv.cpp.

388 {
389  BLOCK_START("CharServerRecv::processCharCreate")
390  Net::Character *const character = new Net::Character;
391  readPlayerData(msg, character);
392  Net::CharServerHandler::mCharacters.push_back(character);
393 
394  Net::CharServerHandler::updateCharSelectDialog();
395 
396  // Close the character create dialog
397  Net::CharServerHandler::mCharCreateDialog->scheduleDelete();
398  Net::CharServerHandler::mCharCreateDialog = nullptr;
399  BLOCK_END("CharServerRecv::processCharCreate")
400 }
#define new
Definition: debug_new.h:147
void processCharCreate(Net::MessageIn &msg)
void scheduleDelete(SDL_Surface *const surface)

References BLOCK_END, BLOCK_START, Net::CharServerHandler::mCharacters, Net::CharServerHandler::mCharCreateDialog, Actions::msg(), readPlayerData(), Window::scheduleDelete(), and Net::CharServerHandler::updateCharSelectDialog().

◆ processCharDelete2AcceptActual()

void EAthena::CharServerRecv::processCharDelete2AcceptActual ( Net::MessageIn msg)

Definition at line 529 of file charserverrecv.cpp.

530 {
532  msg.readInt32("char id");
533  msg.readInt32("result");
534 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processCharDelete2Ack()

void EAthena::CharServerRecv::processCharDelete2Ack ( Net::MessageIn msg)

Definition at line 519 of file charserverrecv.cpp.

520 {
522  msg.readInt32("char id");
523  msg.readInt32("result");
524  // for packets before 20130000, this is raw time
525  // in other case raw time - time(NULL)
526  msg.readInt32("time");
527 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processCharDelete2CancelAck()

void EAthena::CharServerRecv::processCharDelete2CancelAck ( Net::MessageIn msg)

Definition at line 536 of file charserverrecv.cpp.

537 {
539  msg.readInt32("char id");
540  msg.readInt32("result");
541 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processCharDeleteFailed()

void EAthena::CharServerRecv::processCharDeleteFailed ( Net::MessageIn msg)

Definition at line 492 of file charserverrecv.cpp.

493 {
494  BLOCK_START("CharServerRecv::processCharDeleteFailed")
495  Net::CharServerHandler::unlockCharSelectDialog();
496  msg.readUInt8("error");
498  // TRANSLATORS: error header
499  _("Error"),
500  // TRANSLATORS: error message
501  _("Failed to delete character."),
502  // TRANSLATORS: ok dialog button
503  _("OK"),
504  DialogType::ERROR,
505  Modal_true,
507  nullptr,
508  260);
509  BLOCK_END("CharServerRecv::processCharDeleteFailed")
510 }
bool error(InputEvent &event) __attribute__((noreturn))
Definition: actions.cpp:82
void processCharDeleteFailed(Net::MessageIn &msg)

References _, BLOCK_END, BLOCK_START, CREATEWIDGET, DialogType::ERROR, Modal_true, Actions::msg(), ShowCenter_true, and Net::CharServerHandler::unlockCharSelectDialog().

◆ processCharLogin()

void EAthena::CharServerRecv::processCharLogin ( Net::MessageIn msg)

Definition at line 219 of file charserverrecv.cpp.

220 {
221  msg.readInt16("packet len");
222  int slots = 9;
223  int offset = 0;
224  if (packetVersion >= 20100413)
225  {
226  slots = msg.readInt8("MAX_CHARS");
227  msg.readInt8("sd->char_slots");
228  msg.readInt8("MAX_CHARS");
229  offset = 3;
230  }
232 
233  msg.skip(20, "unused 0");
234 
237 
238  // Derive number of characters from message length
239  const int count = (msg.getLength() - 24 - offset)
240  / (106 + 4 + 2 + 16 + 4 + 4 + 4 + 4);
241 
242  for (int i = 0; i < count; ++i)
243  {
244  Net::Character *const character = new Net::Character;
245  readPlayerData(msg, character);
246  Net::CharServerHandler::mCharacters.push_back(character);
247  if (character->dummy != nullptr)
248  {
249  logger->log("CharServer: Player: %s (%d)",
250  character->dummy->getName().c_str(), character->slot);
251  }
252  }
253 
255 }
#define CAST_U16
Definition: cast.h:29
uint16_t characterSlots
Definition: logindata.h:77
int packetVersion
Definition: client.cpp:125
LoginData loginData
Definition: client.cpp:185

References CAST_U16, State::CHAR_SELECT, LoginData::characterSlots, client, delete_all(), Net::Character::dummy, Being::getName(), Logger::log(), logger, loginData, Net::CharServerHandler::mCharacters, Actions::msg(), packetVersion, readPlayerData(), Client::setState(), and Net::Character::slot.

◆ processCharLogin2()

void EAthena::CharServerRecv::processCharLogin2 ( Net::MessageIn msg)

Definition at line 257 of file charserverrecv.cpp.

258 {
259  // ignored
260  msg.readInt16("len");
261  msg.readUInt8("char slots");
262  msg.readUInt8("left slots");
263  msg.readUInt8("left slots");
264  msg.readUInt8("char slots");
265  msg.readUInt8("char slots");
266  msg.skip(20, "unused");
267 }

References Actions::msg().

◆ processCharMapInfo()

void EAthena::CharServerRecv::processCharMapInfo ( Net::MessageIn msg)

Definition at line 269 of file charserverrecv.cpp.

270 {
271  Network *const network = Network::mInstance;
272  ServerInfo &server = mapServer;
273  BLOCK_START("CharServerRecv::processCharMapInfo")
274  PlayerInfo::setCharId(msg.readInt32("char id"));
275  GameHandler::setMap(msg.readString(16, "map name"));
276  if (config.getBoolValue("usePersistentIP") || settings.persistentIp)
277  {
278  msg.readInt32("map ip address");
279  server.hostname = settings.serverName;
280  }
281  else
282  {
283  server.hostname = ipToString(msg.readInt32("map ip address"));
284  }
285  server.port = msg.readInt16("map ip port");
286  if (msg.getVersion() >= 20170329)
287  {
288  for (int f = 0; f < 32; f ++)
289  msg.readInt32("unused");
290  }
291 
292  // Prevent the selected local player from being deleted
297  Notify_true);
298 
300 
303 
304  if (network != nullptr)
305  network->disconnect();
307  BLOCK_END("CharServerRecv::processCharMapInfo")
308 }
Net::CharServerHandler * charServerHandler
Definition: net.cpp:85
static void updateCharSelectDialog()
virtual void clear() const =0
static Net::Character * mSelectedCharacter
virtual int getDefaultWalkSpeed() const =0
uint32_t data
@ PLAYER_WALK_SPEED
Definition: attributes.h:53
void setBackend(const PlayerInfoBackend &backend)
Definition: playerinfo.cpp:376
void setStatBase(const AttributesT id, const int value, const Notify notify)
Definition: playerinfo.cpp:143
void setCharId(const int charId)
Definition: playerinfo.cpp:381
@ CONNECT_GAME
Definition: state.h:48
Net::PlayerHandler * playerHandler
Definition: net.cpp:96
const bool Notify_true
Definition: notify.h:30

References BLOCK_END, BLOCK_START, charServerHandler, Net::CharServerHandler::clear(), client, config, State::CONNECT_GAME, data, Ea::Network::disconnect(), Net::Character::dummy, Configuration::getBoolValue(), Net::PlayerHandler::getDefaultWalkSpeed(), ServerInfo::hostname, ipToString(), localPlayer, EAthena::mapServer, EAthena::Network::mInstance, Net::CharServerHandler::mSelectedCharacter, Actions::msg(), Notify_true, Settings::persistentIp, Attributes::PLAYER_WALK_SPEED, playerHandler, ServerInfo::port, Settings::serverName, PlayerInfo::setBackend(), PlayerInfo::setCharId(), Ea::GameHandler::setMap(), PlayerInfo::setStatBase(), Client::setState(), settings, and Net::CharServerHandler::updateCharSelectDialog().

◆ processCharRename()

void EAthena::CharServerRecv::processCharRename ( Net::MessageIn msg)

Definition at line 426 of file charserverrecv.cpp.

427 {
428  const int flag = msg.readInt16("flag");
429  if (flag == 0)
430  {
432  mRenameId,
433  mNewName);
435  // TRANSLATORS: info header
436  _("Info"),
437  // TRANSLATORS: info message
438  _("Character renamed."),
439  // TRANSLATORS: ok dialog button
440  _("OK"),
442  Modal_true,
444  nullptr,
445  260);
446  }
447  else
448  {
449  std::string message;
450  switch (flag)
451  {
452  case 1:
453  // TRANSLATORS: char rename error
454  message = _("Rename not allowed.");
455  break;
456  case 2:
457  // TRANSLATORS: char rename error
458  message = _("New name is not set.");
459  break;
460  case 3:
461  default:
462  // TRANSLATORS: char rename error
463  message = _("Character rename error.");
464  break;
465  case 4:
466  // TRANSLATORS: char rename error
467  message = _("Character not found.");
468  break;
469  }
471  // TRANSLATORS: info message
472  _("Info"),
473  message,
474  // TRANSLATORS: ok dialog button
475  _("OK"),
477  Modal_true,
479  nullptr,
480  260);
481  }
482 }
void setName(const BeingId id, const std::string &newName)
static CharSelectDialog * mCharSelectDialog

References _, CREATEWIDGET, Net::CharServerHandler::mCharSelectDialog, mNewName, Modal_true, mRenameId, Actions::msg(), DialogType::OK, CharSelectDialog::setName(), and ShowCenter_true.

◆ processPincodeEditStatus()

void EAthena::CharServerRecv::processPincodeEditStatus ( Net::MessageIn msg)

Definition at line 380 of file charserverrecv.cpp.

381 {
382  // UNIMPLEMENTEDPACKET
383  msg.readInt16("state");
384  msg.readInt32("seed");
385 }

References Actions::msg().

◆ processPincodeMakeStatus()

void EAthena::CharServerRecv::processPincodeMakeStatus ( Net::MessageIn msg)

Definition at line 373 of file charserverrecv.cpp.

374 {
375  // UNIMPLEMENTEDPACKET
376  msg.readInt16("state");
377  msg.readInt32("seed");
378 }

References Actions::msg().

◆ processPincodeStatus()

void EAthena::CharServerRecv::processPincodeStatus ( Net::MessageIn msg)

Definition at line 349 of file charserverrecv.cpp.

350 {
351  pincodeManager.setSeed(msg.readUInt32("pincode seed"));
352  pincodeManager.setAccountId(msg.readBeingId("account id"));
355  msg.readInt16("state"))) == false)
356  {
358  }
359 }
void setAccountId(const BeingId id)
void setPincodeLockFlag(const bool flag)
bool processPincodeStatus(const uint16_t state)
void setSeed(const uint32_t seed)
PincodeManager pincodeManager

References CAST_U16, Actions::msg(), pincodeManager, PincodeManager::processPincodeStatus(), PincodeManager::setAccountId(), PincodeManager::setPincodeLockFlag(), PincodeManager::setSeed(), and UNIMPLEMENTEDPACKET.

◆ processPincodeStatus2()

void EAthena::CharServerRecv::processPincodeStatus2 ( Net::MessageIn msg)

Definition at line 361 of file charserverrecv.cpp.

362 {
363  pincodeManager.setSeed(msg.readUInt32("pincode seed"));
364  pincodeManager.setAccountId(msg.readBeingId("account id"));
365  const uint16_t state = CAST_U16(msg.readInt16("state"));
366  pincodeManager.setPincodeLockFlag(msg.readInt16("flag") == 0);
367  if (pincodeManager.processPincodeStatus(state) == false)
368  {
370  }
371 }

References CAST_U16, Actions::msg(), pincodeManager, PincodeManager::processPincodeStatus(), PincodeManager::setAccountId(), PincodeManager::setPincodeLockFlag(), PincodeManager::setSeed(), and UNIMPLEMENTEDPACKET.

◆ readPlayerData()

void EAthena::CharServerRecv::readPlayerData ( Net::MessageIn msg,
Net::Character *const  character 
)

Definition at line 74 of file charserverrecv.cpp.

76 {
77  if (character == nullptr)
78  return;
79 
80  const Token &token =
81  static_cast<LoginHandler*>(loginHandler)->getToken();
82 
83  LocalPlayer *const tempPlayer = new LocalPlayer(
84  msg.readBeingId("player id"), BeingTypeId_zero);
85  tempPlayer->setGender(token.sex);
86 
87  PlayerInfoBackend &data = character->data;
88  if (packetVersion >= 20170830)
89  data.mAttributes[Attributes::PLAYER_EXP] = msg.readInt64("exp");
90  else
91  data.mAttributes[Attributes::PLAYER_EXP] = msg.readInt32("exp");
92  data.mAttributes[Attributes::MONEY] = msg.readInt32("money");
93  if (packetVersion >= 20170830)
94  {
95  data.mAttributes[Attributes::PLAYER_JOB_EXP] =
96  msg.readInt64("job exp");
97  }
98  else
99  {
100  data.mAttributes[Attributes::PLAYER_JOB_EXP] =
101  msg.readInt32("job exp");
102  }
103  data.mAttributes[Attributes::PLAYER_JOB_LEVEL] =
104  msg.readInt32("job level");
105 
106  msg.readInt16("shoes?");
107  const int gloves = msg.readInt16("gloves");
108  const int cape = msg.readInt16("cape");
109  const int misc1 = msg.readInt16("misc1");
110 
111  msg.readInt32("option");
112  tempPlayer->setKarma(msg.readInt32("karma"));
113  tempPlayer->setManner(msg.readInt32("manner"));
114  msg.readInt16("left points");
115 
116  if (packetVersion >= 20081217)
117  {
118  data.mAttributes[Attributes::PLAYER_HP] = msg.readInt32("hp");
119  data.mAttributes[Attributes::PLAYER_MAX_HP] = msg.readInt32("max hp");
120  }
121  else
122  {
123  data.mAttributes[Attributes::PLAYER_HP] = msg.readInt16("hp");
124  data.mAttributes[Attributes::PLAYER_MAX_HP] = msg.readInt16("max hp");
125  }
126  data.mAttributes[Attributes::PLAYER_MP] = msg.readInt16("mp/sp");
127  data.mAttributes[Attributes::PLAYER_MAX_MP] = msg.readInt16("max mp/sp");
128 
129  msg.readInt16("speed");
130  const uint16_t race = msg.readInt16("class");
131 // tempPlayer->setSubtype(race, 0);
132  const int hairStyle = msg.readInt16("hair style");
133  if (packetVersion >= 20141022)
134  msg.readInt16("body");
135  const int option A_UNUSED = (msg.readInt16("weapon") | 1) ^ 1;
136  const int weapon = 0;
137 
138  tempPlayer->setSpriteId(SPRITE_BODY,
139  weapon);
140  tempPlayer->setWeaponId(weapon);
141 
142  data.mAttributes[Attributes::PLAYER_BASE_LEVEL] = msg.readInt16("level");
143 
144  msg.readInt16("skill points");
145  const int bottomClothes = msg.readInt16("head bottom");
146  const int shield = msg.readInt16("shild");
147  const int hat = msg.readInt16("head top");
148  const int topClothes = msg.readInt16("head mid");
149 
150  const ItemColor color = fromInt(msg.readInt16("hair color"), ItemColor);
151  tempPlayer->setHairColor(color);
152  if (hairStyle == 0)
153  {
154  tempPlayer->unSetSprite(SPRITE_HAIR_COLOR);
155  }
156  else
157  {
158  tempPlayer->setSpriteColor(SPRITE_HAIR_COLOR,
159  hairStyle * -1,
160  ItemDB::get(-hairStyle).getDyeColorsString(
161  color));
162  }
163 
164  const uint16_t look = msg.readInt16("clothes color");
165  tempPlayer->setSubtype(fromInt(race, BeingTypeId), look);
166  tempPlayer->setName(msg.readString(24, "name"));
167 
168  character->dummy = tempPlayer;
169 
170  character->data.mStats[Attributes::PLAYER_STR].base = msg.readUInt8("str");
171  character->data.mStats[Attributes::PLAYER_AGI].base = msg.readUInt8("agi");
172  character->data.mStats[Attributes::PLAYER_VIT].base = msg.readUInt8("vit");
173  character->data.mStats[Attributes::PLAYER_INT].base = msg.readUInt8("int");
174  character->data.mStats[Attributes::PLAYER_DEX].base = msg.readUInt8("dex");
175  character->data.mStats[Attributes::PLAYER_LUK].base = msg.readUInt8("luk");
176 
177  character->slot = msg.readInt16("character slot id");
178  if (packetVersion >= 20061023)
179  msg.readInt16("rename");
180  if (packetVersion >= 20100803)
181  {
182  msg.readString(16, "map name");
183  msg.readInt32("delete date");
184  }
185  int shoes = 0;
186  if (packetVersion >= 20110111)
187  shoes = msg.readInt32("robe");
188  if (serverVersion == 0)
189  {
190  tempPlayer->setSpriteId(SPRITE_HAIR,
191  shoes);
192  tempPlayer->setSpriteId(SPRITE_SHOES,
193  gloves);
194  tempPlayer->setSpriteId(SPRITE_SHIELD,
195  cape);
196  tempPlayer->setSpriteId(SPRITE_HEAD_TOP,
197  misc1);
198  tempPlayer->setSpriteId(SPRITE_WEAPON,
199  bottomClothes);
200  tempPlayer->setSpriteId(SPRITE_FLOOR,
201  shield);
202  tempPlayer->setSpriteId(SPRITE_CLOTHES_COLOR,
203  hat);
204  tempPlayer->setSpriteId(SPRITE_HEAD_BOTTOM,
205  topClothes);
206 // tempPlayer->setSprite(SPRITE_HEAD_MID, misc2);
207  }
208  if (packetVersion >= 20110928)
209  msg.readInt32("slot change");
210  if (packetVersion >= 20111025)
211  tempPlayer->setRename(msg.readInt32("rename (inverse)") != 0);
212  uint8_t gender = 99U;
213  if (packetVersion >= 20141016)
214  gender = CAST_U8(msg.readUInt8("gender"));
215  if (gender != 99)
216  tempPlayer->setGender(Being::intToGender(gender));
217 }
int BeingTypeId
Definition: beingtypeid.h:30
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:30
#define CAST_U8
Definition: cast.h:27
void setKarma(const int karma)
Definition: being.h:1031
void setWeaponId(const int id)
Definition: being.cpp:3135
static GenderT intToGender(const uint8_t sex) A_CONST
Definition: being.h:941
void setName(const std::string &name)
Definition: being.cpp:1136
void setSubtype(const BeingTypeId subtype, const uint16_t look)
Definition: being.cpp:371
void setHairColor(const unsigned int slot, const ItemColor color)
Definition: being.cpp:3389
void setSpriteId(const unsigned int slot, const int id)
Definition: being.cpp:2789
virtual void setGender(const GenderT gender)
Definition: being.cpp:3581
void unSetSprite(const unsigned int slot)
Definition: being.cpp:2861
void setManner(const int manner)
Definition: being.h:1037
void setSpriteColor(const unsigned int slot, const int id, const std::string &color)
Definition: being.cpp:2890
void setRename(const bool r)
Definition: localplayer.h:422
int serverVersion
Definition: client.cpp:124
#define fromInt(val, name)
Definition: intdefines.h:46
uint16_t ItemColor
Definition: itemcolor.h:30
#define A_UNUSED
Definition: localconsts.h:160
Net::LoginHandler * loginHandler
Definition: net.cpp:90
bool hat(InputEvent &event)
Definition: chat.cpp:62
@ PLAYER_MAX_MP
Definition: attributes.h:35
@ PLAYER_BASE_LEVEL
Definition: attributes.h:31
@ PLAYER_JOB_EXP
Definition: attributes.h:66
@ PLAYER_JOB_LEVEL
Definition: attributes.h:41
@ PLAYER_MAX_HP
Definition: attributes.h:33
const ItemInfo & get(const int id)
Definition: itemdb.cpp:792
@ SPRITE_HAIR_COLOR
Definition: sprite.h:35
@ SPRITE_WEAPON
Definition: sprite.h:31
@ SPRITE_FLOOR
Definition: sprite.h:40
@ SPRITE_HEAD_TOP
Definition: sprite.h:33
@ SPRITE_SHOES
Definition: sprite.h:38
@ SPRITE_SHIELD
Definition: sprite.h:37
@ SPRITE_BODY
Definition: sprite.h:39
@ SPRITE_CLOTHES_COLOR
Definition: sprite.h:36
@ SPRITE_HEAD_BOTTOM
Definition: sprite.h:32
PlayerInfoBackend data
Definition: character.h:57
Definition: token.h:31
GenderT sex
Definition: token.h:44

References A_UNUSED, BeingTypeId_zero, CAST_U8, Net::Character::data, data, Net::Character::dummy, fromInt, ItemDB::get(), Actions::hat(), Being::intToGender(), loginHandler, Attributes::MONEY, Actions::msg(), PlayerInfoBackend::mStats, packetVersion, Attributes::PLAYER_AGI, Attributes::PLAYER_BASE_LEVEL, Attributes::PLAYER_DEX, Attributes::PLAYER_EXP, Attributes::PLAYER_HP, Attributes::PLAYER_INT, Attributes::PLAYER_JOB_EXP, Attributes::PLAYER_JOB_LEVEL, Attributes::PLAYER_LUK, Attributes::PLAYER_MAX_HP, Attributes::PLAYER_MAX_MP, Attributes::PLAYER_MP, Attributes::PLAYER_STR, Attributes::PLAYER_VIT, serverVersion, Being::setGender(), Being::setHairColor(), Being::setKarma(), Being::setManner(), Being::setName(), LocalPlayer::setRename(), Being::setSpriteColor(), Being::setSpriteId(), Being::setSubtype(), Being::setWeaponId(), Token::sex, Net::Character::slot, SPRITE_BODY, SPRITE_CLOTHES_COLOR, SPRITE_FLOOR, ItemDbType::SPRITE_HAIR, SPRITE_HAIR_COLOR, SPRITE_HEAD_BOTTOM, SPRITE_HEAD_TOP, SPRITE_SHIELD, SPRITE_SHOES, SPRITE_WEAPON, and Being::unSetSprite().

Referenced by processCharCharacters(), processCharCreate(), TmwAthena::CharServerRecv::processCharCreate(), processCharLogin(), and TmwAthena::CharServerRecv::processCharLogin().

Variable Documentation

◆ mNewName

std::string EAthena::CharServerRecv::mNewName

◆ mRenameId

BeingId EAthena::CharServerRecv::mRenameId = BeingId_zero