9
3

PacketHeaders.cpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. */
  6. #include "PacketHeaders.h"
  7. #include "../common/MiscFunctions.h"
  8. #include "LoginDatabase.h"
  9. #include "LWorld.h"
  10. extern LWorldList world_list;
  11. extern LoginDatabase database;
  12. void LS_DeleteCharacterRequest::loadData(EQApplicationPacket* packet){
  13. InitializeLoadData(packet->pBuffer, packet->size);
  14. LoadData(character_number);
  15. LoadData(server_id);
  16. LoadData(spacer);
  17. LoadDataString(name);
  18. }
  19. EQ2Packet* LS_CharSelectList::serialize(int16 version){
  20. Clear();
  21. AddData(num_characters);
  22. AddData(char_data);
  23. if (version <= 561) {
  24. LS_CharListAccountInfoEarlyClient account_info;
  25. account_info.account_id = account_id;
  26. account_info.unknown1 = 0xFFFFFFFF;
  27. account_info.unknown2 = 0;
  28. account_info.maxchars = 7; //live has a max of 7 on gold accounts base.
  29. account_info.unknown4 = 0;
  30. AddData(account_info);
  31. }
  32. else {
  33. LS_CharListAccountInfo account_info;
  34. account_info.account_id = account_id;
  35. account_info.unknown1 = 0xFFFFFFFF;
  36. account_info.unknown2 = 0;
  37. account_info.maxchars = database.GetMaxCharsSetting();
  38. account_info.vet_adv_bonus = database.GetAccountBonus(account_id);
  39. account_info.vet_trade_bonus = 0;
  40. account_info.unknown4 = 0;
  41. for (int i = 0; i < 3; i++)
  42. account_info.unknown5[i] = 0xFFFFFFFF;
  43. account_info.unknown5[3] = 0;
  44. AddData(account_info);
  45. }
  46. return new EQ2Packet(OP_AllCharactersDescReplyMsg, getData(), getDataSize());
  47. }
  48. void LS_CharSelectList::addChar(uchar* data, int16 size){
  49. char_data.append((char*)data, size);
  50. }
  51. void LS_CharSelectList::loadData(int32 account, vector<CharSelectProfile*> charlist, int16 version){
  52. vector<CharSelectProfile*>::iterator itr;
  53. account_id = account;
  54. num_characters = 0;
  55. char_data = "";
  56. CharSelectProfile* character = 0;
  57. for(itr = charlist.begin();itr != charlist.end();itr++){
  58. character = *itr;
  59. int32 serverID = character->packet->getType_int32_ByName("server_id");
  60. if(character->deleted) { // workaround for old clients <= 561 that crash if you delete a char (Doesn't refresh the char panel correctly)
  61. character->packet->setDataByName("name", "(deleted)");
  62. character->packet->setDataByName("charid", 0xFFFFFFFF);
  63. character->packet->setDataByName("name", 0xFFFFFFFF);
  64. character->packet->setDataByName("server_id", 0xFFFFFFFF);
  65. character->packet->setDataByName("created_date", 0xFFFFFFFF);
  66. character->packet->setDataByName("unknown1", 0xFFFFFFFF);
  67. character->packet->setDataByName("unknown2", 0xFFFFFFFF);
  68. character->packet->setDataByName("flags", 0xFF);
  69. }
  70. else if(serverID == 0 || !world_list.FindByID(serverID))
  71. continue;
  72. num_characters++;
  73. character->SaveData(version);
  74. addChar(character->getData(), character->getDataSize());
  75. }
  76. }
  77. void CharSelectProfile::SaveData(int16 in_version){
  78. Clear();
  79. AddData(*packet->serializeString());
  80. }