PacketHeaders.cpp 1.7 KB

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