9
3

client.cpp 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  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 "../common/debug.h"
  7. #ifdef WIN32
  8. #define WIN32_LEAN_AND_MEAN
  9. #include <windows.h>
  10. #include <winsock.h>
  11. #include <process.h>
  12. #else
  13. #include <sys/socket.h>
  14. #include <netinet/in.h>
  15. #include <arpa/inet.h>
  16. #include <unistd.h>
  17. #endif
  18. #include <string.h>
  19. #include <iomanip>
  20. #include <stdlib.h>
  21. #include <assert.h>
  22. #include "net.h"
  23. #include "client.h"
  24. #include "../common/EQStream.h"
  25. #include "../common/packet_dump.h"
  26. #include "../common/packet_functions.h"
  27. #include "../common/emu_opcodes.h"
  28. #include "../common/MiscFunctions.h"
  29. #include "LWorld.h"
  30. #include "LoginDatabase.h"
  31. #include "../common/ConfigReader.h"
  32. #include "../common/Log.h"
  33. extern NetConnection net;
  34. extern LWorldList world_list;
  35. extern ClientList client_list;
  36. extern LoginDatabase database;
  37. extern map<int16,OpcodeManager*>EQOpcodeManager;
  38. extern ConfigReader configReader;
  39. using namespace std;
  40. Client::Client(EQStream* ieqnc) {
  41. eqnc = ieqnc;
  42. ip = eqnc->GetrIP();
  43. port = ntohs(eqnc->GetrPort());
  44. account_id = 0;
  45. lsadmin = 0;
  46. worldadmin = 0;
  47. lsstatus = 0;
  48. origversion = version = 0;
  49. kicked = false;
  50. verified = false;
  51. memset(bannedreason, 0, sizeof(bannedreason));
  52. //worldresponse_timer = new Timer(10000);
  53. //worldresponse_timer->Disable();
  54. memset(key,0,10);
  55. LoginMode = None;
  56. num_updates = 0;
  57. updatetimer = new Timer(500);
  58. updatelisttimer = new Timer(10000);
  59. //keepalive = new Timer(5000);
  60. //logintimer = new Timer(500); // Give time for the servers to send updates
  61. //keepalive->Start();
  62. //updatetimer->Start();
  63. //logintimer->Disable();
  64. disconnectTimer = 0;
  65. memset(ClientSession,0,25);
  66. request_num = 0;
  67. login_account = 0;
  68. createRequest = 0;
  69. playWaitTimer = NULL;
  70. start = false;
  71. update_position = 0;
  72. update_packets = 0;
  73. needs_world_list = true;
  74. }
  75. Client::~Client() {
  76. //safe_delete(worldresponse_timer);
  77. //safe_delete(logintimer);
  78. safe_delete(login_account);
  79. eqnc->Close();
  80. safe_delete(playWaitTimer);
  81. safe_delete(createRequest);
  82. safe_delete(disconnectTimer);
  83. safe_delete(updatetimer);
  84. }
  85. bool Client::Process() {
  86. if(!start && !eqnc->CheckActive()){
  87. if(!playWaitTimer)
  88. playWaitTimer = new Timer(5000);
  89. else if(playWaitTimer->Check()){
  90. safe_delete(playWaitTimer);
  91. return false;
  92. }
  93. return true;
  94. }
  95. else if(!start){
  96. safe_delete(playWaitTimer);
  97. start = true;
  98. }
  99. //if(disconnectTimer && disconnectTimer->Check())
  100. // getConnection()->SendDisconnect();
  101. if (!kicked) {
  102. /************ Get all packets from packet manager out queue and process them ************/
  103. EQApplicationPacket *app = 0;
  104. /*if(logintimer && logintimer->Check())
  105. {
  106. database.LoadCharacters(GetLoginAccount());
  107. SendLoginAccepted();
  108. logintimer->Disable();
  109. }*/
  110. /*if(worldresponse_timer && worldresponse_timer->Check())
  111. {
  112. FatalError(WorldDownErrorMessage);
  113. worldresponse_timer->Disable();
  114. }*/
  115. if(playWaitTimer != NULL && playWaitTimer->Check ( ) )
  116. {
  117. SendPlayFailed(PLAY_ERROR_SERVER_TIMEOUT);
  118. safe_delete(playWaitTimer);
  119. }
  120. if(!needs_world_list && updatetimer && updatetimer->Check()){
  121. if(updatelisttimer && updatelisttimer->Check()){
  122. if(num_updates >= 180){ //30 minutes
  123. getConnection()->SendDisconnect();
  124. }
  125. else{
  126. vector<PacketStruct*>::iterator itr;
  127. if(update_packets){
  128. for(itr = update_packets->begin(); itr != update_packets->end(); itr++){
  129. safe_delete(*itr);
  130. }
  131. }
  132. safe_delete(update_packets);
  133. update_packets = world_list.GetServerListUpdate(version);
  134. }
  135. num_updates++;
  136. }
  137. else{
  138. if(!update_packets){
  139. update_packets = world_list.GetServerListUpdate(version);
  140. }
  141. else{
  142. if(update_position < update_packets->size()){
  143. QueuePacket(update_packets->at(update_position)->serialize());
  144. update_position++;
  145. }
  146. else
  147. update_position = 0;
  148. }
  149. }
  150. }
  151. while(app = eqnc->PopPacket())
  152. {
  153. switch(app->GetOpcode())
  154. {
  155. case OP_LoginRequestMsg:{
  156. // DumpPacket(app);
  157. PacketStruct* packet = configReader.getStruct("LS_LoginRequest", 1);
  158. if(packet->LoadPacketData(app->pBuffer,app->size)){
  159. version = packet->getType_int32_ByName("version");
  160. LogWrite(LOGIN__DEBUG, 0, "Login", "Client Version Provided: %i", version);
  161. // Image 2020 Notes
  162. // we keep the original version for special packets like char creation to pass to world server
  163. origversion = version;
  164. // forced version to 60085 for now since those structures seem to work best for steam AoM 12133L Aug 17 2015 11:19:13 build
  165. version = 60085;
  166. if (EQOpcodeManager.count(GetOpcodeVersion(version)) == 0) {
  167. LogWrite(LOGIN__ERROR, 0, "Login", "Incompatible client version provided: %i", version);
  168. SendLoginDenied();
  169. return false;
  170. }
  171. if(EQOpcodeManager.count(GetOpcodeVersion(version)) > 0 && getConnection()){
  172. getConnection()->SetClientVersion(GetOrigVersion());
  173. EQ2_16BitString username = packet->getType_EQ2_16BitString_ByName("username");
  174. EQ2_16BitString password = packet->getType_EQ2_16BitString_ByName("password");
  175. LoginAccount* acct = database.LoadAccount(username.data.c_str(),password.data.c_str());
  176. if(acct){
  177. Client* otherclient = client_list.FindByLSID(acct->getLoginAccountID());
  178. if(otherclient)
  179. otherclient->getConnection()->SendDisconnect(); // This person is already logged in, we don't want them logged in twice, kick the previous client as it might be a ghost
  180. }
  181. if(acct){
  182. SetAccountName(username.data.c_str());
  183. database.UpdateAccountIPAddress(acct->getLoginAccountID(), getConnection()->GetrIP());
  184. LogWrite(LOGIN__INFO, 0, "Login", "%s successfully logged in.", (char*)username.data.c_str());
  185. }
  186. else
  187. {
  188. if (username.size > 0)
  189. LogWrite(LOGIN__ERROR, 0, "Login", "%s login failed!", (char*)username.data.c_str());
  190. else
  191. LogWrite(LOGIN__ERROR, 0, "Login", "[UNKNOWN USER] login failed!");
  192. }
  193. if(!acct)
  194. SendLoginDenied();
  195. else{
  196. needs_world_list = true;
  197. SetLoginAccount(acct);
  198. SendLoginAccepted();
  199. }
  200. }
  201. else{
  202. cout << "Error bad version: " << version << endl;
  203. SendLoginDeniedBadVersion();
  204. }
  205. }
  206. else{
  207. cout << "Error loading LS_LoginRequest packet: \n";
  208. //DumpPacket(app);
  209. }
  210. safe_delete(packet);
  211. break;
  212. }
  213. case OP_KeymapLoadMsg:{
  214. // cout << "Received OP_KeymapNoneMsg\n";
  215. //dunno what this is for
  216. break;
  217. }
  218. case OP_AllWSDescRequestMsg:{
  219. SendWorldList();
  220. needs_world_list = false;
  221. database.LoadCharacters(GetLoginAccount(), GetOrigVersion());
  222. SendCharList();
  223. break;
  224. }
  225. case OP_LsClientCrashlogReplyMsg:{
  226. // DumpPacket(app);
  227. SaveErrorsToDB(app, "Crash Log");
  228. break;
  229. }
  230. case OP_LsClientVerifylogReplyMsg:{
  231. // DumpPacket(app);
  232. SaveErrorsToDB(app, "Verify Log");
  233. break;
  234. }
  235. case OP_LsClientAlertlogReplyMsg:{
  236. // DumpPacket(app);
  237. SaveErrorsToDB(app, "Alert Log");
  238. break;
  239. }
  240. case OP_LsClientBaselogReplyMsg:{
  241. // DumpPacket(app);
  242. SaveErrorsToDB(app, "Base Log");
  243. break;
  244. }
  245. case OP_AllCharactersDescRequestMsg:{
  246. break;
  247. }
  248. case OP_CreateCharacterRequestMsg:{
  249. PacketStruct* packet = configReader.getStruct("CreateCharacter", GetOrigVersion());
  250. playWaitTimer = new Timer ( 15000 );
  251. playWaitTimer->Start ( );
  252. cout << "Char Create Request From: " << GetAccountName() << "....";
  253. if(packet->LoadPacketData(app->pBuffer,app->size)){
  254. cout << "Loaded Successfully\n";
  255. packet->setDataByName("account_id",GetAccountID());
  256. LWorld* world_server = world_list.FindByID(packet->getType_int32_ByName("server_id"));
  257. if(!world_server)
  258. {
  259. cout << GetAccountName() << " attempted creation of character with an invalid server id of: " << packet->getType_int32_ByName("server_id") << "\n";
  260. break;
  261. }
  262. else
  263. {
  264. ServerPacket* outpack = new ServerPacket(ServerOP_CharacterCreate, app->size+sizeof(int16));
  265. int16 out_version = GetOrigVersion();
  266. memcpy(outpack->pBuffer, &out_version, sizeof(int16));
  267. memcpy(outpack->pBuffer + sizeof(int16), app->pBuffer, app->size);
  268. uchar* tmp = outpack->pBuffer;
  269. tmp+=7;
  270. int32 account_id = GetAccountID();
  271. memcpy(tmp, &account_id, sizeof(int32));
  272. world_server->SendPacket(outpack);
  273. safe_delete(outpack);
  274. createRequest = packet;
  275. }
  276. }
  277. else{
  278. cout << "Error loading Char Create Packet!!\n";
  279. safe_delete(packet);
  280. }
  281. // world_list.SendWorldChanged(create.profile.server_id, false, this);
  282. break;
  283. }
  284. case OP_PlayCharacterRequestMsg:{
  285. int32 char_id = 0;
  286. int32 server_id = 0;
  287. PacketStruct* request = configReader.getStruct("LS_PlayRequest",GetVersion());
  288. if(request && request->LoadPacketData(app->pBuffer,app->size)){
  289. char_id = request->getType_int32_ByName("char_id");
  290. server_id = request->getType_int32_ByName("server_id");
  291. LWorld* world = world_list.FindByID(server_id);
  292. string name = database.GetCharacterName(char_id,server_id);
  293. if(world && name.length() > 0){
  294. pending_play_char_id = char_id;
  295. ServerPacket* outpack = new ServerPacket(ServerOP_UsertoWorldReq, sizeof(UsertoWorldRequest_Struct));
  296. UsertoWorldRequest_Struct* req = (UsertoWorldRequest_Struct*)outpack->pBuffer;
  297. req->char_id = char_id;
  298. req->lsaccountid = GetAccountID();
  299. req->worldid = server_id;
  300. struct in_addr in;
  301. in.s_addr = GetIP();
  302. strcpy(req->ip_address, inet_ntoa(in));
  303. world->SendPacket(outpack);
  304. delete outpack;
  305. safe_delete(playWaitTimer);
  306. playWaitTimer = new Timer ( 5000 );
  307. playWaitTimer->Start ( );
  308. }
  309. else{
  310. cout << GetAccountName() << " sent invalid Play Request: \n";
  311. SendPlayFailed(PLAY_ERROR_PROBLEM);
  312. DumpPacket(app);
  313. }
  314. }
  315. safe_delete(request);
  316. break;
  317. }
  318. case OP_DeleteCharacterRequestMsg:{
  319. PacketStruct* request = configReader.getStruct("LS_DeleteCharacterRequest", GetVersion());
  320. PacketStruct* response = configReader.getStruct("LS_DeleteCharacterResponse", GetVersion());
  321. if(request && response && request->LoadPacketData(app->pBuffer,app->size)){
  322. EQ2_16BitString name = request->getType_EQ2_16BitString_ByName("name");
  323. int32 acct_id = GetAccountID();
  324. int32 char_id = request->getType_int32_ByName("char_id");
  325. int32 server_id = request->getType_int32_ByName("server_id");
  326. if(database.VerifyDelete(acct_id, char_id, name.data.c_str())){
  327. response->setDataByName("response", 1);
  328. GetLoginAccount()->removeCharacter((char*)name.data.c_str());
  329. LWorld* world_server = world_list.FindByID(server_id);
  330. if(world_server != NULL)
  331. world_server->SendDeleteCharacter ( char_id , acct_id );
  332. }
  333. else
  334. response->setDataByName("response", 0);
  335. response->setDataByName("server_id", server_id);
  336. response->setDataByName("char_id", char_id);
  337. response->setDataByName("account_id", account_id);
  338. response->setMediumStringByName("name", (char*)name.data.c_str());
  339. response->setDataByName("max_characters", 10);
  340. EQ2Packet* outapp = response->serialize();
  341. QueuePacket(outapp);
  342. }
  343. safe_delete(request);
  344. safe_delete(response);
  345. break;
  346. }
  347. default: {
  348. char* name = (char*)app->GetOpcodeName();
  349. if(name)
  350. cout << name;
  351. else
  352. cout << "Unknown";
  353. cout << " Packet: OPCode: 0x" << hex << setw(2) << setfill('0') << app->GetOpcode() << dec << ", size: " << setw(5) << setfill(' ') << app->Size() << " from " << GetAccountName() << endl;
  354. if (app->Size() < 128)
  355. DumpPacket(app);
  356. }
  357. }
  358. delete app;
  359. }
  360. }
  361. if (!eqnc->CheckActive()) {
  362. return false;
  363. }
  364. return true;
  365. }
  366. void Client::SaveErrorsToDB(EQApplicationPacket* app, char* type){
  367. int32 size = 0;
  368. memcpy(&size, app->pBuffer + sizeof(int32), sizeof(int32));
  369. size++;
  370. char* message = new char[size];
  371. memset(message, 0, size);
  372. z_stream zstream;
  373. int zerror = 0;
  374. zstream.next_in = app->pBuffer + 8;
  375. zstream.avail_in = app->size - 8;
  376. zstream.next_out = (BYTE*)message;
  377. zstream.avail_out = size;
  378. zstream.zalloc = Z_NULL;
  379. zstream.zfree = Z_NULL;
  380. zstream.opaque = Z_NULL;
  381. zerror = inflateInit( &zstream);
  382. if(zerror != Z_OK) {
  383. safe_delete_array(message);
  384. return;
  385. }
  386. zerror = inflate( &zstream, 0 );
  387. if(message && strlen(message) > 0)
  388. database.SaveClientLog(type, message, GetLoginAccount()->getLoginName(), GetVersion());
  389. safe_delete_array(message);
  390. }
  391. void Client::CharacterApproved(int32 server_id,int32 char_id)
  392. {
  393. if(createRequest && server_id == createRequest->getType_int32_ByName("server_id")){
  394. LWorld* world_server = world_list.FindByID(server_id);
  395. if(!world_server)
  396. return;
  397. PacketStruct* packet = configReader.getStruct("LS_CreateCharacterReply", GetVersion());
  398. if(packet){
  399. packet->setDataByName("account_id", GetAccountID());
  400. packet->setDataByName("response", CREATESUCCESS_REPLY);
  401. packet->setMediumStringByName("name", (char*)createRequest->getType_EQ2_16BitString_ByName("name").data.c_str());
  402. EQ2Packet* outapp = packet->serialize();
  403. QueuePacket(outapp);
  404. safe_delete(packet);
  405. database.SaveCharacter(createRequest, GetLoginAccount(),char_id);
  406. // refresh characters for this account
  407. database.LoadCharacters(GetLoginAccount(), GetVersion());
  408. SendCharList();
  409. }
  410. }
  411. else{
  412. cout << GetAccountName() << " received invalid CharacterApproval from server: " << server_id << endl;
  413. }
  414. safe_delete(createRequest);
  415. }
  416. void Client::CharacterRejected(int8 reason_number)
  417. {
  418. PacketStruct* packet = configReader.getStruct("LS_CreateCharacterReply", GetVersion());
  419. if(createRequest && packet){
  420. packet->setDataByName("account_id", GetAccountID());
  421. int8 clientReasonNum = reason_number;
  422. // reason numbers change and instead of updating the world server
  423. // the login server will hold the up to date #'s
  424. /*
  425. switch(reason_number)
  426. {
  427. // these error codes seem to be removed now, they shutdown the client rather immediately
  428. // for now we are just going to play a joke on them and say they can't create a new character.
  429. case INVALIDRACE_REPLY:
  430. case INVALIDGENDER_REPLY:
  431. clientReasonNum = 8;
  432. break;
  433. case BADNAMELENGTH_REPLY:
  434. clientReasonNum = 9;
  435. break;
  436. case NAMEINVALID_REPLY:
  437. clientReasonNum = 10;
  438. break;
  439. case NAMEFILTER_REPLY:
  440. clientReasonNum = 11;
  441. break;
  442. case NAMETAKEN_REPLY:
  443. clientReasonNum = 12;
  444. break;
  445. case OVERLOADEDSERVER_REPLY:
  446. clientReasonNum = 13;
  447. break;
  448. }
  449. */
  450. packet->setDataByName("response", clientReasonNum);
  451. packet->setMediumStringByName("name", "");
  452. EQ2Packet* outapp = packet->serialize();
  453. QueuePacket(outapp);
  454. safe_delete(packet);
  455. }
  456. /*LS_CreateCharacterReply reply(GetAccountID(), reason_number, create.profile.name.data);
  457. EQ2Packet* outapp = reply.serialize();
  458. QueuePacket(outapp);
  459. create.Clear();*/
  460. }
  461. void Client::SendCharList(){
  462. /*PacketStruct* packet = configReader.getStruct("LS_CreateCharacterReply");
  463. packet->setDataByName("account_id", GetAccountID());
  464. packet->setDataByName("response", reason_number);
  465. packet->setDataByName("name", &create.profile.name);
  466. EQ2Packet* outapp = packet->serialize();
  467. QueuePacket(outapp);
  468. safe_delete(packet);*/
  469. LogWrite(LOGIN__INFO, 0, "Login", "[%s] sending character list.", GetAccountName());
  470. LS_CharSelectList list;
  471. list.loadData(GetAccountID(), GetLoginAccount()->charlist, GetVersion());
  472. EQ2Packet* outapp = list.serialize(GetVersion());
  473. // DumpPacket(outapp);
  474. QueuePacket(outapp);
  475. }
  476. void Client::SendLoginDeniedBadVersion(){
  477. EQ2Packet* app = new EQ2Packet(OP_LoginReplyMsg, 0, sizeof(LS_LoginResponse));
  478. LS_LoginResponse* ls_response = (LS_LoginResponse*)app->pBuffer;
  479. ls_response->reply_code = 6;
  480. ls_response->unknown03 = 0xFFFFFFFF;
  481. ls_response->unknown04 = 0xFFFFFFFF;
  482. QueuePacket(app);
  483. }
  484. void Client::SendLoginDenied(){
  485. EQ2Packet* app = new EQ2Packet(OP_LoginReplyMsg, 0, sizeof(LS_LoginResponse));
  486. LS_LoginResponse* ls_response = (LS_LoginResponse*)app->pBuffer;
  487. ls_response->reply_code = 1;
  488. ls_response->unknown03 = 0xFFFFFFFF;
  489. ls_response->unknown04 = 0xFFFFFFFF;
  490. QueuePacket(app);
  491. }
  492. void Client::SendLoginAccepted(){ //all 0s are a success :)
  493. PacketStruct* packet = configReader.getStruct("LS_LoginReplyMsg",version);
  494. int i =0;
  495. if ( packet )
  496. {
  497. packet->setDataByName("account_id", 1);
  498. packet->setDataByName("login_response", 0);
  499. packet->setDataByName("reset_appearance", 0);
  500. packet->setDataByName("do_not_force_soga", 1);
  501. packet->setDataByName("race_unknown", 0x3F);
  502. packet->setDataByName("unknown11", 2); // can be 7
  503. packet->setDataByName("sub_level", 2);
  504. packet->setDataByName("race_flag", 0x1FFFFF);
  505. packet->setDataByName("class_flag", 0x7FFFFFE);
  506. packet->setMediumStringByName("username", GetAccountName());
  507. packet->setMediumStringByName("password", GetAccountName());
  508. packet->setDataByName("unknown5", 0x7C);
  509. packet->setDataByName("unknown7", 0xFF6FFFBF);
  510. // Image 2020 Notes
  511. // Login Server only supports AoM at current time, but we will need to keep in mind the structure for 60100 or later calls for additional custom fields
  512. // >=60100
  513. //packet->setDataByName("unknown7a", 0xFFFF);
  514. //packet->setDataByName("unknown8", 0xFF, 1);
  515. EQ2Packet* outapp = packet->serialize();
  516. QueuePacket(outapp);
  517. safe_delete(packet);
  518. }
  519. return;
  520. if(version >= 843){
  521. uchar login_accepted_packet[] ={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
  522. ,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x7C,0x00,0x00,0xBF,0xBF,0xED,0x03
  523. ,0x1F,0x00,0x00,0x00,0x00,0x01,0x18,0x03,0x05,0x3C,0x02,0x03,0x01,0x00,0xF4,0xF4
  524. ,0xF4,0xFF,0xFF,0xFF,0x3D,0x02,0x08,0x01,0x00,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,0x41
  525. ,0x02,0x07,0x01,0x00,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,0xAE,0x0C,0x00,0x00,0x00,0xFF
  526. ,0xFF,0xFF,0xFF,0xFF,0xFF,0x34,0x0F,0x10,0x01,0x01,0x93,0x62,0x44,0xCF,0xCF,0xAF
  527. ,0x04,0x06,0x3C,0x02,0x03,0x01,0x00,0xB6,0x36,0x36,0xFF,0xFF,0xFF,0x41,0x02,0x07
  528. ,0x01,0x00,0xB6,0x36,0x36,0xFF,0xFF,0xFF,0x3D,0x02,0x08,0x01,0x00,0xB6,0x36,0x36
  529. ,0xFF,0xFF,0xFF,0x0F,0x09,0x00,0x01,0x01,0x67,0x54,0x42,0xA0,0xA0,0x50,0x0F,0x09
  530. ,0x00,0x01,0x01,0x67,0x54,0x42,0xA0,0xA0,0x50,0x34,0x0F,0x10,0x01,0x01,0x93,0x62
  531. ,0x44,0xCF,0xCF,0xAF,0x06,0x06,0x31,0x00,0x00,0x01,0x01,0xF4,0xF4,0xF4,0xF4,0xF4
  532. ,0xF4,0x31,0x00,0x00,0x01,0x01,0xF4,0xF4,0xF4,0xF4,0xF4,0xF4,0xF3,0x02,0x03,0x00
  533. ,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x31,0x00,0x07,0x00,0x00,0xFF,0xFF,0xFF,0xFF
  534. ,0xFF,0xFF,0x31,0x00,0x08,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x0E,0x10
  535. ,0x01,0x01,0xFF,0xFF,0x00,0x80,0x80,0x00,0x07,0x06,0xE6,0x09,0x00,0x01,0x01,0xBA
  536. ,0x7B,0x42,0xBA,0x7B,0x42,0xE6,0x09,0x00,0x01,0x01,0xBA,0x7B,0x42,0xBA,0x7B,0x42
  537. ,0xA6,0x01,0x08,0x01,0x01,0x77,0x60,0x46,0x77,0x60,0x46,0xAA,0x01,0x07,0x01,0x01
  538. ,0x77,0x60,0x46,0x77,0x60,0x46,0xC7,0x0F,0x03,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF
  539. ,0xFF,0xB2,0x0C,0x10,0x01,0x01,0xFF,0xFF,0x00,0x80,0x80,0x00,0x09,0x05,0x33,0x02
  540. ,0x03,0x01,0x00,0x2D,0x2D,0x2D,0xFF,0xFF,0xFF,0x34,0x02,0x08,0x01,0x00,0x2D,0x2D
  541. ,0x2D,0xFF,0xFF,0xFF,0x38,0x02,0x07,0x01,0x00,0x2D,0x2D,0x2D,0xFF,0xFF,0xFF,0x69
  542. ,0x09,0x00,0x01,0x01,0x6D,0x1C,0x1C,0x93,0x6B,0x6B,0x34,0x0F,0x10,0x01,0x01,0x93
  543. ,0x62,0x44,0xCF,0xCF,0xAF,0x0A,0x05,0x69,0x09,0x00,0x01,0x01,0xA7,0xA7,0xEB,0xA7
  544. ,0xA7,0xEB,0x33,0x02,0x03,0x01,0x00,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,0x38,0x02,0x07
  545. ,0x01,0x00,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,0x34,0x02,0x08,0x01,0x00,0xF4,0xF4,0xF4
  546. ,0xFF,0xFF,0xFF,0x34,0x0F,0x10,0x01,0x01,0x93,0x62,0x44,0xCF,0xCF,0xAF,0x0D,0x04
  547. ,0xEA,0x09,0x00,0x01,0x01,0xDD,0xDD,0x8C,0xDD,0xDD,0x8C,0x95,0x02,0x08,0x01,0x00
  548. ,0xF4,0xF4,0x0A,0xFF,0xFF,0xFF,0x94,0x02,0x03,0x01,0x00,0xF4,0xF4,0x0A,0xFF,0xFF
  549. ,0xFF,0x99,0x02,0x07,0x01,0x00,0xF4,0xF4,0x0A,0xFF,0xFF,0xFF,0x0E,0x04,0xC6,0x02
  550. ,0x08,0x01,0x00,0x13,0x13,0x13,0xFF,0xFF,0xFF,0xC5,0x02,0x03,0x01,0x00,0x13,0x13
  551. ,0x13,0xFF,0xFF,0xFF,0xCA,0x02,0x07,0x01,0x00,0x13,0x13,0x13,0xFF,0xFF,0xFF,0x14
  552. ,0x09,0x00,0x01,0x01,0x9C,0x4F,0x4F,0x2B,0x15,0x15,0x10,0x04,0xDF,0x09,0x00,0x01
  553. ,0x01,0x70,0xBA,0x70,0xBA,0x7B,0x42,0x38,0x04,0x08,0x01,0x00,0xB6,0xCD,0x2F,0xFF
  554. ,0xFF,0xFF,0x37,0x04,0x03,0x01,0x00,0xB6,0xCD,0x2F,0xFF,0xFF,0xFF,0x3C,0x04,0x07
  555. ,0x01,0x00,0xB6,0xCD,0x2F,0xFF,0xFF,0xFF,0x11,0x04,0xDF,0x09,0x00,0x01,0x01,0xBA
  556. ,0x7B,0x42,0x62,0xB3,0x62,0x38,0x04,0x08,0x01,0x00,0x1A,0x41,0x1A,0xFF,0xFF,0xFF
  557. ,0x3C,0x04,0x07,0x01,0x00,0x1A,0x41,0x1A,0xFF,0xFF,0xFF,0x37,0x04,0x03,0x01,0x00
  558. ,0x1A,0x41,0x1A,0xFF,0xFF,0xFF,0x13,0x04,0x59,0x0E,0x00,0x01,0x01,0x3B,0x7C,0x3B
  559. ,0xE2,0xE2,0x85,0xB6,0x03,0x08,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xB5,0x03
  560. ,0x03,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xBA,0x03,0x07,0x00,0x00,0xFF,0xFF
  561. ,0xFF,0xFF,0xFF,0xFF,0x14,0x04,0x59,0x0E,0x00,0x01,0x01,0x2B,0x34,0x21,0xE2,0xE2
  562. ,0x85,0xA8,0x03,0x08,0x01,0x01,0x18,0x18,0x18,0x18,0x18,0x18,0xA7,0x03,0x03,0x01
  563. ,0x01,0x18,0x18,0x18,0x18,0x18,0x18,0xAC,0x03,0x07,0x01,0x01,0x18,0x18,0x18,0x18
  564. ,0x18,0x18,0x17,0x04,0x4B,0x0E,0x00,0x01,0x01,0xE6,0x95,0xE6,0xE6,0x95,0xE6,0xDA
  565. ,0x01,0x07,0x01,0x01,0x9E,0x9E,0xD8,0xA3,0x6B,0x80,0x92,0x17,0x03,0x01,0x01,0x66
  566. ,0x42,0x4B,0x9E,0x9E,0xD8,0xD6,0x01,0x08,0x01,0x01,0x9E,0x9E,0xD8,0xA3,0x6B,0x80
  567. ,0x18,0x04,0x4D,0x0E,0x00,0x01,0x01,0xCF,0x2F,0xCF,0xE6,0x95,0xE6,0x92,0x17,0x03
  568. ,0x01,0x01,0x70,0x70,0x70,0x67,0x2B,0x67,0xD6,0x01,0x08,0x01,0x01,0x67,0x2B,0x67
  569. ,0x50,0x50,0x50,0xDA,0x01,0x07,0x01,0x01,0x67,0x2B,0x67,0x50,0x50,0x50,0x1A,0x04
  570. ,0xE4,0x0C,0x00,0x01,0x01,0xBA,0xFF,0xBA,0xD4,0xE9,0xFF,0x92,0x17,0x03,0x01,0x01
  571. ,0xDA,0xDA,0xA5,0x60,0x60,0x9E,0xDA,0x01,0x07,0x01,0x01,0x60,0x60,0x9E,0xDA,0xDA
  572. ,0xA5,0xD6,0x01,0x08,0x01,0x01,0x60,0x60,0x9E,0xDA,0xDA,0xA5,0x1B,0x04,0x92,0x17
  573. ,0x03,0x01,0x01,0x99,0x48,0x48,0xF7,0xCF,0x82,0xDA,0x01,0x07,0x01,0x01,0xF7,0xCF
  574. ,0x82,0x99,0x48,0x48,0xD6,0x01,0x08,0x01,0x01,0xF7,0xCF,0x82,0x99,0x48,0x48,0xD7
  575. ,0x0E,0x00,0x01,0x01,0x8E,0x46,0x46,0x2B,0x15,0x15,0x1D,0x04,0xA9,0x08,0x00,0x01
  576. ,0x01,0xE8,0xB6,0x85,0xE8,0xB6,0x85,0x92,0x17,0x03,0x01,0x01,0x57,0x85,0xAE,0xD8
  577. ,0xE8,0xF4,0xD6,0x01,0x08,0x01,0x01,0xD8,0xE8,0xF4,0x95,0xB3,0xCD,0xDA,0x01,0x07
  578. ,0x01,0x01,0xD8,0xE8,0xF4,0x95,0xB3,0xCD,0x1E,0x04,0x92,0x17,0x03,0x01,0x01,0x62
  579. ,0x57,0x4D,0xA3,0x9E,0x9A,0xD6,0x01,0x08,0x01,0x01,0xFF,0xDA,0xB6,0x6B,0x57,0x44
  580. ,0xDA,0x01,0x07,0x01,0x01,0xFF,0xDA,0xB6,0x6B,0x57,0x44,0x3A,0x0E,0x00,0x01,0x01
  581. ,0x2B,0x54,0x54,0x2B,0x15,0x15,0x21,0x06,0x64,0x03,0x08,0x01,0x00,0x7E,0x4B,0x46
  582. ,0xFF,0xFF,0xFF,0x68,0x03,0x07,0x01,0x00,0x7E,0x4B,0x46,0xFF,0xFF,0xFF,0x63,0x03
  583. ,0x03,0x01,0x00,0x7E,0x4B,0x46,0xFF,0xFF,0xFF,0xA9,0x08,0x00,0x01,0x01,0x1F,0x3F
  584. ,0x60,0x62,0x62,0x62,0xA9,0x08,0x00,0x01,0x01,0x1F,0x3F,0x60,0x62,0x62,0x62,0x42
  585. ,0x0F,0x10,0x01,0x01,0xFF,0xFF,0x00,0x80,0x80,0x00,0x22,0x06,0xD6,0x0C,0x00,0x01
  586. ,0x01,0xE6,0x95,0xE6,0x1A,0x1A,0x70,0xD6,0x0C,0x00,0x01,0x01,0xE6,0x95,0xE6,0x1A
  587. ,0x1A,0x70,0x64,0x03,0x08,0x01,0x00,0x5D,0x42,0x5D,0xFF,0xFF,0xFF,0x68,0x03,0x07
  588. ,0x01,0x00,0x5D,0x42,0x5D,0xFF,0xFF,0xFF,0x63,0x03,0x03,0x01,0x00,0x5D,0x42,0x5D
  589. ,0xFF,0xFF,0xFF,0x42,0x0F,0x10,0x01,0x01,0xFF,0xFF,0x00,0x80,0x80,0x00,0x24,0x06
  590. ,0x63,0x03,0x03,0x01,0x00,0x99,0xC8,0xE2,0xFF,0xFF,0xFF,0x64,0x03,0x08,0x01,0x00
  591. ,0x99,0xC8,0xE2,0xFF,0xFF,0xFF,0x68,0x03,0x07,0x01,0x00,0x99,0xC8,0xE2,0xFF,0xFF
  592. ,0xFF,0xD6,0x0C,0x00,0x01,0x01,0x85,0x85,0xA7,0xD1,0xD1,0xAC,0xD6,0x0C,0x00,0x01
  593. ,0x01,0x85,0x85,0xA7,0xD1,0xD1,0xAC,0x34,0x0F,0x10,0x01,0x01,0x93,0x62,0x44,0xCF
  594. ,0xCF,0xAF,0x25,0x06,0x63,0x03,0x03,0x01,0x00,0xBF,0xA5,0x7E,0xFF,0xFF,0xFF,0x5C
  595. ,0x03,0x08,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x60,0x03,0x07,0x00,0x00,0xFF
  596. ,0xFF,0xFF,0xFF,0xFF,0xFF,0xB1,0x08,0x00,0x01,0x01,0x90,0x48,0x48,0x90,0x48,0x48
  597. ,0xB1,0x08,0x00,0x01,0x01,0x90,0x48,0x48,0x90,0x48,0x48,0x34,0x0F,0x10,0x01,0x01
  598. ,0x93,0x62,0x44,0xCF,0xCF,0xAF,0x27,0x06,0xB9,0x16,0x08,0x01,0x01,0x3D,0x54,0x3D
  599. ,0xBC,0xBC,0xBC,0xB8,0x16,0x03,0x01,0x01,0x3D,0x54,0x3D,0xBC,0xBC,0xBC,0xBD,0x16
  600. ,0x07,0x01,0x01,0x3D,0x54,0x3D,0xBC,0xBC,0xBC,0x34,0x0F,0x10,0x01,0x01,0x31,0x4D
  601. ,0x3F,0xCF,0xCF,0xAF,0xCD,0x08,0x00,0x01,0x01,0x2B,0x54,0x3F,0x3F,0x98,0x6B,0xCD
  602. ,0x08,0x00,0x01,0x01,0x2B,0x54,0x3F,0x3F,0x98,0x6B,0x28,0x06,0xB9,0x16,0x08,0x01
  603. ,0x01,0x21,0x21,0x31,0x3F,0x3F,0x3F,0xB8,0x16,0x03,0x01,0x01,0x21,0x21,0x31,0x3F
  604. ,0x3F,0x3F,0xBD,0x16,0x07,0x01,0x00,0x48,0x48,0x54,0xFF,0xFF,0xFF,0x34,0x0F,0x10
  605. ,0x01,0x01,0x31,0x4D,0x3F,0xCF,0xCF,0xAF,0xA9,0x08,0x00,0x01,0x01,0x1A,0x1A,0x70
  606. ,0xE6,0x95,0xE6,0xA9,0x08,0x00,0x01,0x01,0x1A,0x1A,0x70,0xE6,0x95,0xE6,0x0A,0xD1
  607. ,0x00,0x00,0x00,0xD0,0x00,0x00,0x00,0xCF,0x00,0x00,0x00,0x6E,0x00,0x00,0x00,0x70
  608. ,0x00,0x00,0x00,0x71,0x00,0x00,0x00,0x72,0x00,0x00,0x00,0x73,0x00,0x00,0x00,0x74
  609. ,0x00,0x00,0x00,0x76,0x00,0x00,0x00};
  610. memcpy(login_accepted_packet+16, &account_id, sizeof(int32));
  611. EQ2Packet* app = new EQ2Packet(OP_LoginReplyMsg, login_accepted_packet, sizeof(login_accepted_packet));
  612. QueuePacket(app);
  613. }
  614. else{
  615. uchar login_accepted_packet[] ={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
  616. ,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x40,0x18,0x00,0x00,0xff,0xde,0x0d
  617. ,0x00,0x00,0x01,0x18,0x03,0x05,0x3c,0x02,0x03,0x01,0x00,0xf4,0xf4,0xf4,0xff,0xff
  618. ,0xff,0x3d,0x02,0x08,0x01,0x00,0xf4,0xf4,0xf4,0xff,0xff,0xff,0x41,0x02,0x07,0x01
  619. ,0x00,0xf4,0xf4,0xf4,0xff,0xff,0xff,0xae,0x0c,0x00,0x00,0x00,0xff,0xff,0xff,0xff
  620. ,0xff,0xff,0x34,0x0f,0x00,0x01,0x01,0x93,0x62,0x44,0xcf,0xcf,0xaf,0x04,0x06,0x3c
  621. ,0x02,0x03,0x01,0x00,0xb6,0x36,0x36,0xff,0xff,0xff,0x41,0x02,0x07,0x01,0x00,0xb6
  622. ,0x36,0x36,0xff,0xff,0xff,0x3d,0x02,0x08,0x01,0x00,0xb6,0x36,0x36,0xff,0xff,0xff
  623. ,0x0f,0x09,0x00,0x01,0x01,0x67,0x54,0x42,0xa0,0xa0,0x50,0x0f,0x09,0x00,0x01,0x01
  624. ,0x67,0x54,0x42,0xa0,0xa0,0x50,0x34,0x0f,0x00,0x01,0x01,0x93,0x62,0x44,0xcf,0xcf
  625. ,0xaf,0x06,0x06,0x31,0x00,0x00,0x01,0x01,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0x31,0x00
  626. ,0x00,0x01,0x01,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf3,0x02,0x03,0x00,0x00,0xff,0xff
  627. ,0xff,0xff,0xff,0xff,0x31,0x00,0x07,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x31
  628. ,0x00,0x08,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x0e,0x00,0x01,0x01,0xff
  629. ,0xff,0x00,0x80,0x80,0x00,0x07,0x06,0xe6,0x09,0x00,0x01,0x01,0xba,0x7b,0x42,0xba
  630. ,0x7b,0x42,0xe6,0x09,0x00,0x01,0x01,0xba,0x7b,0x42,0xba,0x7b,0x42,0xa6,0x01,0x08
  631. ,0x01,0x01,0x77,0x60,0x46,0x77,0x60,0x46,0xaa,0x01,0x07,0x01,0x01,0x77,0x60,0x46
  632. ,0x77,0x60,0x46,0xc7,0x0f,0x03,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0x0c
  633. ,0x00,0x01,0x01,0xff,0xff,0x00,0x80,0x80,0x00,0x09,0x05,0x33,0x02,0x03,0x01,0x00
  634. ,0x2d,0x2d,0x2d,0xff,0xff,0xff,0x34,0x02,0x08,0x01,0x00,0x2d,0x2d,0x2d,0xff,0xff
  635. ,0xff,0x38,0x02,0x07,0x01,0x00,0x2d,0x2d,0x2d,0xff,0xff,0xff,0x69,0x09,0x00,0x01
  636. ,0x01,0x6d,0x1c,0x1c,0x93,0x6b,0x6b,0x34,0x0f,0x00,0x01,0x01,0x93,0x62,0x44,0xcf
  637. ,0xcf,0xaf,0x0a,0x05,0x69,0x09,0x00,0x01,0x01,0xa7,0xa7,0xeb,0xa7,0xa7,0xeb,0x33
  638. ,0x02,0x03,0x01,0x00,0xf4,0xf4,0xf4,0xff,0xff,0xff,0x38,0x02,0x07,0x01,0x00,0xf4
  639. ,0xf4,0xf4,0xff,0xff,0xff,0x34,0x02,0x08,0x01,0x00,0xf4,0xf4,0xf4,0xff,0xff,0xff
  640. ,0x34,0x0f,0x00,0x01,0x01,0x93,0x62,0x44,0xcf,0xcf,0xaf,0x0d,0x04,0xea,0x09,0x00
  641. ,0x01,0x01,0xdd,0xdd,0x8c,0xdd,0xdd,0x8c,0x95,0x02,0x08,0x01,0x00,0xf4,0xf4,0x0a
  642. ,0xff,0xff,0xff,0x94,0x02,0x03,0x01,0x00,0xf4,0xf4,0x0a,0xff,0xff,0xff,0x99,0x02
  643. ,0x07,0x01,0x00,0xf4,0xf4,0x0a,0xff,0xff,0xff,0x0e,0x04,0xc6,0x02,0x08,0x01,0x00
  644. ,0x13,0x13,0x13,0xff,0xff,0xff,0xc5,0x02,0x03,0x01,0x00,0x13,0x13,0x13,0xff,0xff
  645. ,0xff,0xca,0x02,0x07,0x01,0x00,0x13,0x13,0x13,0xff,0xff,0xff,0x14,0x09,0x00,0x01
  646. ,0x01,0x9c,0x4f,0x4f,0x2b,0x15,0x15,0x10,0x04,0xdf,0x09,0x00,0x01,0x01,0x70,0xba
  647. ,0x70,0xba,0x7b,0x42,0x38,0x04,0x08,0x01,0x00,0xb6,0xcd,0x2f,0xff,0xff,0xff,0x37
  648. ,0x04,0x03,0x01,0x00,0xb6,0xcd,0x2f,0xff,0xff,0xff,0x3c,0x04,0x07,0x01,0x00,0xb6
  649. ,0xcd,0x2f,0xff,0xff,0xff,0x11,0x04,0xdf,0x09,0x00,0x01,0x01,0xba,0x7b,0x42,0x62
  650. ,0xb3,0x62,0x38,0x04,0x08,0x01,0x00,0x1a,0x41,0x1a,0xff,0xff,0xff,0x3c,0x04,0x07
  651. ,0x01,0x00,0x1a,0x41,0x1a,0xff,0xff,0xff,0x37,0x04,0x03,0x01,0x00,0x1a,0x41,0x1a
  652. ,0xff,0xff,0xff,0x13,0x04,0x59,0x0e,0x00,0x01,0x01,0x3b,0x7c,0x3b,0xe2,0xe2,0x85
  653. ,0xb6,0x03,0x08,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xb5,0x03,0x03,0x00,0x00
  654. ,0xff,0xff,0xff,0xff,0xff,0xff,0xba,0x03,0x07,0x00,0x00,0xff,0xff,0xff,0xff,0xff
  655. ,0xff,0x14,0x04,0x59,0x0e,0x00,0x01,0x01,0x2b,0x34,0x21,0xe2,0xe2,0x85,0xa8,0x03
  656. ,0x08,0x01,0x01,0x18,0x18,0x18,0x18,0x18,0x18,0xa7,0x03,0x03,0x01,0x01,0x18,0x18
  657. ,0x18,0x18,0x18,0x18,0xac,0x03,0x07,0x01,0x01,0x18,0x18,0x18,0x18,0x18,0x18,0x17
  658. ,0x04,0x4b,0x0e,0x00,0x01,0x01,0xe6,0x95,0xe6,0xe6,0x95,0xe6,0xda,0x01,0x07,0x01
  659. ,0x01,0x9e,0x9e,0xd8,0xa3,0x6b,0x80,0x92,0x17,0x03,0x01,0x01,0x66,0x42,0x4b,0x9e
  660. ,0x9e,0xd8,0xd6,0x01,0x08,0x01,0x01,0x9e,0x9e,0xd8,0xa3,0x6b,0x80,0x18,0x04,0x4d
  661. ,0x0e,0x00,0x01,0x01,0xcf,0x2f,0xcf,0xe6,0x95,0xe6,0x92,0x17,0x03,0x01,0x01,0x70
  662. ,0x70,0x70,0x67,0x2b,0x67,0xd6,0x01,0x08,0x01,0x01,0x67,0x2b,0x67,0x50,0x50,0x50
  663. ,0xda,0x01,0x07,0x01,0x01,0x67,0x2b,0x67,0x50,0x50,0x50,0x1a,0x04,0xe4,0x0c,0x00
  664. ,0x01,0x01,0xba,0xff,0xba,0xd4,0xe9,0xff,0x92,0x17,0x03,0x01,0x01,0xda,0xda,0xa5
  665. ,0x60,0x60,0x9e,0xda,0x01,0x07,0x01,0x01,0x60,0x60,0x9e,0xda,0xda,0xa5,0xd6,0x01
  666. ,0x08,0x01,0x01,0x60,0x60,0x9e,0xda,0xda,0xa5,0x1b,0x04,0x92,0x17,0x03,0x01,0x01
  667. ,0x99,0x48,0x48,0xf7,0xcf,0x82,0xda,0x01,0x07,0x01,0x01,0xf7,0xcf,0x82,0x99,0x48
  668. ,0x48,0xd6,0x01,0x08,0x01,0x01,0xf7,0xcf,0x82,0x99,0x48,0x48,0xd7,0x0e,0x00,0x01
  669. ,0x01,0x8e,0x46,0x46,0x2b,0x15,0x15,0x1d,0x04,0xa9,0x08,0x00,0x01,0x01,0xe8,0xb6
  670. ,0x85,0xe8,0xb6,0x85,0x92,0x17,0x03,0x01,0x01,0x57,0x85,0xae,0xd8,0xe8,0xf4,0xd6
  671. ,0x01,0x08,0x01,0x01,0xd8,0xe8,0xf4,0x95,0xb3,0xcd,0xda,0x01,0x07,0x01,0x01,0xd8
  672. ,0xe8,0xf4,0x95,0xb3,0xcd,0x1e,0x04,0x92,0x17,0x03,0x01,0x01,0x62,0x57,0x4d,0xa3
  673. ,0x9e,0x9a,0xd6,0x01,0x08,0x01,0x01,0xff,0xda,0xb6,0x6b,0x57,0x44,0xda,0x01,0x07
  674. ,0x01,0x01,0xff,0xda,0xb6,0x6b,0x57,0x44,0x3a,0x0e,0x00,0x01,0x01,0x2b,0x54,0x54
  675. ,0x2b,0x15,0x15,0x21,0x06,0x64,0x03,0x08,0x01,0x00,0x7e,0x4b,0x46,0xff,0xff,0xff
  676. ,0x68,0x03,0x07,0x01,0x00,0x7e,0x4b,0x46,0xff,0xff,0xff,0x63,0x03,0x03,0x01,0x00
  677. ,0x7e,0x4b,0x46,0xff,0xff,0xff,0xa9,0x08,0x00,0x01,0x01,0x1f,0x3f,0x60,0x62,0x62
  678. ,0x62,0xa9,0x08,0x00,0x01,0x01,0x1f,0x3f,0x60,0x62,0x62,0x62,0x42,0x0f,0x00,0x01
  679. ,0x01,0xff,0xff,0x00,0x80,0x80,0x00,0x22,0x06,0xd6,0x0c,0x00,0x01,0x01,0xe6,0x95
  680. ,0xe6,0x1a,0x1a,0x70,0xd6,0x0c,0x00,0x01,0x01,0xe6,0x95,0xe6,0x1a,0x1a,0x70,0x64
  681. ,0x03,0x08,0x01,0x00,0x5d,0x42,0x5d,0xff,0xff,0xff,0x68,0x03,0x07,0x01,0x00,0x5d
  682. ,0x42,0x5d,0xff,0xff,0xff,0x63,0x03,0x03,0x01,0x00,0x5d,0x42,0x5d,0xff,0xff,0xff
  683. ,0x42,0x0f,0x00,0x01,0x01,0xff,0xff,0x00,0x80,0x80,0x00,0x24,0x06,0x63,0x03,0x03
  684. ,0x01,0x00,0x99,0xc8,0xe2,0xff,0xff,0xff,0x64,0x03,0x08,0x01,0x00,0x99,0xc8,0xe2
  685. ,0xff,0xff,0xff,0x68,0x03,0x07,0x01,0x00,0x99,0xc8,0xe2,0xff,0xff,0xff,0xd6,0x0c
  686. ,0x00,0x01,0x01,0x85,0x85,0xa7,0xd1,0xd1,0xac,0xd6,0x0c,0x00,0x01,0x01,0x85,0x85
  687. ,0xa7,0xd1,0xd1,0xac,0x34,0x0f,0x00,0x01,0x01,0x93,0x62,0x44,0xcf,0xcf,0xaf,0x25
  688. ,0x06,0x63,0x03,0x03,0x01,0x00,0xbf,0xa5,0x7e,0xff,0xff,0xff,0x5c,0x03,0x08,0x00
  689. ,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x60,0x03,0x07,0x00,0x00,0xff,0xff,0xff,0xff
  690. ,0xff,0xff,0xb1,0x08,0x00,0x01,0x01,0x90,0x48,0x48,0x90,0x48,0x48,0xb1,0x08,0x00
  691. ,0x01,0x01,0x90,0x48,0x48,0x90,0x48,0x48,0x34,0x0f,0x00,0x01,0x01,0x93,0x62,0x44
  692. ,0xcf,0xcf,0xaf,0x27,0x06,0xb9,0x16,0x08,0x01,0x01,0x3d,0x54,0x3d,0xbc,0xbc,0xbc
  693. ,0xb8,0x16,0x03,0x01,0x01,0x3d,0x54,0x3d,0xbc,0xbc,0xbc,0x68,0x03,0x07,0x01,0x00
  694. ,0x3d,0x54,0x3d,0xff,0xff,0xff,0x34,0x0f,0x00,0x01,0x01,0x31,0x4d,0x3f,0xcf,0xcf
  695. ,0xaf,0xcd,0x08,0x00,0x01,0x01,0x2b,0x54,0x3f,0x3f,0x98,0x6b,0xcd,0x08,0x00,0x01
  696. ,0x01,0x2b,0x54,0x3f,0x3f,0x98,0x6b,0x28,0x06,0xb9,0x16,0x08,0x01,0x01,0x21,0x21
  697. ,0x31,0x3f,0x3f,0x3f,0xb8,0x16,0x03,0x01,0x01,0x21,0x21,0x31,0x3f,0x3f,0x3f,0x68
  698. ,0x03,0x07,0x01,0x00,0x48,0x48,0x54,0xff,0xff,0xff,0x34,0x0f,0x00,0x01,0x01,0x31
  699. ,0x4d,0x3f,0xcf,0xcf,0xaf,0xa9,0x08,0x00,0x01,0x01,0x1a,0x1a,0x70,0xe6,0x95,0xe6
  700. ,0xa9,0x08,0x00,0x01,0x01,0x1a,0x1a,0x70,0xe6,0x95,0xe6,0x0a,0xd1,0x00,0x00,0x00
  701. ,0xd0,0x00,0x00,0x00,0xcf,0x00,0x00,0x00,0x6e,0x00,0x00,0x00,0x70,0x00,0x00,0x00
  702. ,0x71,0x00,0x00,0x00,0x72,0x00,0x00,0x00,0x73,0x00,0x00,0x00,0x74,0x00,0x00,0x00
  703. ,0x76,0x00,0x00,0x00};
  704. memcpy(login_accepted_packet+16, &account_id, sizeof(int32));
  705. EQ2Packet* app = new EQ2Packet(OP_LoginReplyMsg, login_accepted_packet, sizeof(login_accepted_packet));
  706. QueuePacket(app);
  707. }
  708. /*EQ2Packet* app = new EQ2Packet(OP_LoginReplyMsg, 0, sizeof(LS_LoginResponse));
  709. LS_LoginResponse* ls_response = (LS_LoginResponse*)app->pBuffer;
  710. ls_response->accountid = GetAccountID();
  711. QueuePacket(app);*/
  712. }
  713. void Client::SendWorldList(){
  714. EQ2Packet* pack = world_list.MakeServerListPacket(lsadmin, version);
  715. EQ2Packet* dupe = pack->Copy();
  716. DumpPacket(dupe->pBuffer,dupe->size);
  717. QueuePacket(dupe);
  718. return;
  719. }
  720. void Client::QueuePacket(EQ2Packet* app){
  721. eqnc->EQ2QueuePacket(app);
  722. }
  723. void Client::WorldResponse(int32 worldid, int8 response, char* ip_address, int32 port, int32 access_key)
  724. {
  725. LWorld* world = world_list.FindByID(worldid);
  726. if(world == 0) {
  727. FatalError(0);
  728. return;
  729. }
  730. if(response != 1){
  731. if(response == PLAY_ERROR_CHAR_NOT_LOADED){
  732. string pending_play_char_name = database.GetCharacterName(pending_play_char_id, worldid);
  733. if(database.VerifyDelete(GetAccountID(), pending_play_char_id, pending_play_char_name.c_str())){
  734. GetLoginAccount()->removeCharacter((char*)pending_play_char_name.c_str());
  735. }
  736. }
  737. FatalError(response);
  738. return;
  739. }
  740. PacketStruct* response_packet = configReader.getStruct("LS_PlayResponse", GetVersion());
  741. if(response_packet){
  742. safe_delete(playWaitTimer);
  743. response_packet->setDataByName("response", 1);
  744. response_packet->setSmallStringByName("server", ip_address);
  745. response_packet->setDataByName("port", port);
  746. response_packet->setDataByName("account_id", GetAccountID());
  747. response_packet->setDataByName("access_code", access_key);
  748. EQ2Packet* outapp = response_packet->serialize();
  749. QueuePacket(outapp);
  750. safe_delete(response_packet);
  751. disconnectTimer = new Timer(1000);
  752. disconnectTimer->Start();
  753. }
  754. return;
  755. }
  756. void Client::FatalError(int8 response) {
  757. safe_delete(playWaitTimer);
  758. SendPlayFailed(response);
  759. }
  760. void Client::SendPlayFailed(int8 response){
  761. PacketStruct* response_packet = configReader.getStruct("LS_PlayResponse", GetVersion());
  762. if(response_packet){
  763. response_packet->setDataByName("response", response);
  764. response_packet->setSmallStringByName("server", "");
  765. response_packet->setDataByName("port", 0);
  766. response_packet->setDataByName("account_id", GetAccountID());
  767. response_packet->setDataByName("access_code", 0);
  768. EQ2Packet* outapp = response_packet->serialize();
  769. QueuePacket(outapp);
  770. safe_delete(response_packet);
  771. }
  772. }
  773. void ClientList::Add(Client* client) {
  774. MClientList.writelock();
  775. client_list[client] = true;
  776. MClientList.releasewritelock();
  777. }
  778. Client* ClientList::Get(int32 ip, int16 port) {
  779. Client* ret = 0;
  780. map<Client*, bool>::iterator itr;
  781. MClientList.readlock();
  782. for(itr = client_list.begin(); itr != client_list.end(); itr++){
  783. if(itr->first->GetIP() == ip && itr->first->GetPort() == port){
  784. ret = itr->first;
  785. break;
  786. }
  787. }
  788. MClientList.releasereadlock();
  789. return ret;
  790. }
  791. void ClientList::FindByCreateRequest(){
  792. Client* client = 0;
  793. map<Client*, bool>::iterator itr;
  794. MClientList.readlock();
  795. for(itr = client_list.begin(); itr != client_list.end(); itr++){
  796. if(itr->first->AwaitingCharCreationRequest()){
  797. if(!client)
  798. client = itr->first;
  799. else{
  800. client = 0;//more than 1 character waiting, dont want to send rejection to wrong one
  801. break;
  802. }
  803. }
  804. }
  805. MClientList.releasereadlock();
  806. if(client)
  807. client->CharacterRejected(UNKNOWNERROR_REPLY);
  808. }
  809. Client* ClientList::FindByLSID(int32 lsaccountid) {
  810. Client* client = 0;
  811. map<Client*, bool>::iterator itr;
  812. MClientList.readlock();
  813. for(itr = client_list.begin(); itr != client_list.end(); itr++){
  814. if(itr->first->GetAccountID() == lsaccountid){
  815. client = itr->first;
  816. break;
  817. }
  818. }
  819. MClientList.releasereadlock();
  820. return client;
  821. }
  822. void ClientList::SendPacketToAllClients(EQ2Packet* app){
  823. Client* client = 0;
  824. map<Client*, bool>::iterator itr;
  825. MClientList.readlock();
  826. if(client_list.size() > 0){
  827. for(itr = client_list.begin(); itr != client_list.end(); itr++){
  828. itr->first->QueuePacket(app->Copy());
  829. }
  830. }
  831. safe_delete(app);
  832. MClientList.releasereadlock();
  833. }
  834. void ClientList::Process() {
  835. Client* client = 0;
  836. vector<Client*> erase_list;
  837. map<Client*, bool>::iterator itr;
  838. MClientList.readlock();
  839. for(itr = client_list.begin(); itr != client_list.end(); itr++){
  840. client = itr->first;
  841. if(!client->Process())
  842. erase_list.push_back(client);
  843. }
  844. MClientList.releasereadlock();
  845. if(erase_list.size() > 0){
  846. vector<Client*>::iterator erase_itr;
  847. MClientList.writelock();
  848. for(erase_itr = erase_list.begin(); erase_itr != erase_list.end(); erase_itr++){
  849. client = *erase_itr;
  850. struct in_addr in;
  851. in.s_addr = client->getConnection()->GetRemoteIP();
  852. net.numclients--;
  853. cout << Timer::GetCurrentTime2() << " Removing client from ip: " << inet_ntoa(in) << " port: " << ntohs(client->getConnection()->GetRemotePort()) << " Name: " << client->GetAccountName() << endl;
  854. client->getConnection()->SetState(CLOSED);
  855. net.UpdateWindowTitle();
  856. client_list.erase(client);
  857. }
  858. MClientList.releasewritelock();
  859. }
  860. }