9
3

PacketHeaders.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. LS_CharListAccountInfoEarlyClient account_info;
  23. account_info.account_id = account_id;
  24. account_info.unknown1 = 0xFFFFFFFF;
  25. account_info.unknown2 = 0;
  26. account_info.unknown3 = 10;
  27. account_info.unknown4 = 0;
  28. AddData(account_info);
  29. }
  30. else {
  31. LS_CharListAccountInfo account_info;
  32. account_info.account_id = account_id;
  33. account_info.unknown1 = 0xFFFFFFFF;
  34. account_info.unknown2 = 0;
  35. account_info.unknown3 = 10;
  36. account_info.unknown4 = 0;
  37. for (int i = 0; i < 3; i++)
  38. account_info.unknown5[i] = 0xFFFFFFFF;
  39. account_info.unknown5[3] = 0;
  40. AddData(account_info);
  41. }
  42. return new EQ2Packet(OP_AllCharactersDescReplyMsg, getData(), getDataSize());
  43. }
  44. void LS_CharSelectList::addChar(uchar* data, int16 size){
  45. char_data.append((char*)data, size);
  46. }
  47. void LS_CharSelectList::loadData(int32 account, vector<CharSelectProfile*> charlist, int16 version){
  48. vector<CharSelectProfile*>::iterator itr;
  49. account_id = account;
  50. num_characters = 0;
  51. char_data = "";
  52. CharSelectProfile* character = 0;
  53. for(itr = charlist.begin();itr != charlist.end();itr++){
  54. character = *itr;
  55. int32 serverID = character->packet->getType_int32_ByName("server_id");
  56. if(serverID == 0 || !world_list.FindByID(serverID))
  57. continue;
  58. num_characters++;
  59. character->SaveData(version);
  60. addChar(character->getData(), character->getDataSize());
  61. }
  62. }
  63. void CharSelectProfile::SaveData(int16 in_version){
  64. Clear();
  65. AddData(*packet->serializeString());
  66. }