PacketHeaders.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 "LWorld.h"
  9. extern LWorldList world_list;
  10. void LS_DeleteCharacterRequest::loadData(EQApplicationPacket* packet){
  11. InitializeLoadData(packet->pBuffer, packet->size);
  12. LoadData(character_number);
  13. LoadData(server_id);
  14. LoadData(spacer);
  15. LoadDataString(name);
  16. }
  17. EQ2Packet* LS_CharSelectList::serialize(int16 version){
  18. Clear();
  19. AddData(num_characters);
  20. AddData(char_data);
  21. if (version == 546)
  22. {
  23. LS_CharListAccountInfoDoF account_info;
  24. account_info.account_id = account_id;
  25. account_info.unknown1 = 0xFFFFFFFF;
  26. account_info.unknown2 = 0;
  27. account_info.unknown3 = 10;
  28. AddData(account_info);
  29. }
  30. else
  31. {
  32. LS_CharListAccountInfo account_info;
  33. account_info.account_id = account_id;
  34. account_info.unknown1 = 0xFFFFFFFF;
  35. account_info.unknown2 = 0;
  36. account_info.unknown3 = 10;
  37. account_info.unknown4 = 0;
  38. for (int i = 0; i < 3; i++)
  39. account_info.unknown5[i] = 0xFFFFFFFF;
  40. account_info.unknown5[3] = 0;
  41. AddData(account_info);
  42. }
  43. return new EQ2Packet(OP_AllCharactersDescReplyMsg, getData(), getDataSize());
  44. }
  45. void LS_CharSelectList::addChar(uchar* data, int16 size){
  46. char_data.append((char*)data, size);
  47. }
  48. void LS_CharSelectList::loadData(int32 account, vector<CharSelectProfile*> charlist, int16 version){
  49. vector<CharSelectProfile*>::iterator itr;
  50. account_id = account;
  51. num_characters = 0;
  52. char_data = "";
  53. CharSelectProfile* character = 0;
  54. for(itr = charlist.begin();itr != charlist.end();itr++){
  55. character = *itr;
  56. int32 serverID = character->packet->getType_int32_ByName("server_id");
  57. if(serverID == 0 || !world_list.FindByID(serverID))
  58. continue;
  59. num_characters++;
  60. character->SaveData(version);
  61. addChar(character->getData(), character->getDataSize());
  62. }
  63. }
  64. void CharSelectProfile::SaveData(int16 in_version){
  65. Clear();
  66. AddData(*packet->serializeString());
  67. }