PacketHeaders.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 <= 546) {
  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(serverID == 0 || !world_list.FindByID(serverID))
  61. continue;
  62. num_characters++;
  63. character->SaveData(version);
  64. addChar(character->getData(), character->getDataSize());
  65. }
  66. }
  67. void CharSelectProfile::SaveData(int16 in_version){
  68. Clear();
  69. AddData(*packet->serializeString());
  70. }