PacketHeaders.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.maxchars = 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.maxchars = 30; //devn00b:Corrected unknown and increased maxchars from 10 to 30.
  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. account_info.vet_adv_bonus = 1;
  41. account_info.vet_trade_bonus = 0;
  42. AddData(account_info);
  43. }
  44. return new EQ2Packet(OP_AllCharactersDescReplyMsg, getData(), getDataSize());
  45. }
  46. void LS_CharSelectList::addChar(uchar* data, int16 size){
  47. char_data.append((char*)data, size);
  48. }
  49. void LS_CharSelectList::loadData(int32 account, vector<CharSelectProfile*> charlist, int16 version){
  50. vector<CharSelectProfile*>::iterator itr;
  51. account_id = account;
  52. num_characters = 0;
  53. char_data = "";
  54. CharSelectProfile* character = 0;
  55. for(itr = charlist.begin();itr != charlist.end();itr++){
  56. character = *itr;
  57. int32 serverID = character->packet->getType_int32_ByName("server_id");
  58. if(serverID == 0 || !world_list.FindByID(serverID))
  59. continue;
  60. num_characters++;
  61. character->SaveData(version);
  62. addChar(character->getData(), character->getDataSize());
  63. }
  64. }
  65. void CharSelectProfile::SaveData(int16 in_version){
  66. Clear();
  67. AddData(*packet->serializeString());
  68. }