servertalk.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  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. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef EQ_SOPCODES_H
  17. #define EQ_SOPCODES_H
  18. #define EQEMU_PROTOCOL_VERSION "0.5.0"
  19. #include "types.h"
  20. #include "packet_functions.h"
  21. #include <vector>
  22. #define SERVER_TIMEOUT 45000 // how often keepalive gets sent
  23. #define INTERSERVER_TIMER 10000
  24. #define LoginServer_StatusUpdateInterval 15000
  25. #define LoginServer_AuthStale 60000
  26. #define AUTHCHANGE_TIMEOUT 900 // in seconds
  27. #define ServerOP_KeepAlive 0x0001 // packet to test if port is still open
  28. #define ServerOP_ChannelMessage 0x0002 // broadcast/guildsay
  29. #define ServerOP_SetZone 0x0003 // client -> server zoneinfo
  30. #define ServerOP_ShutdownAll 0x0004 // exit(0);
  31. #define ServerOP_ZoneShutdown 0x0005 // unload all data, goto sleep mode
  32. #define ServerOP_ZoneBootup 0x0006 // come out of sleep mode and load zone specified
  33. #define ServerOP_ZoneStatus 0x0007 // Shows status of all zones
  34. #define ServerOP_SetConnectInfo 0x0008 // Tells server address and port #
  35. #define ServerOP_EmoteMessage 0x0009 // Worldfarts
  36. #define ServerOP_ClientList 0x000A // Update worldserver's client list, for #whos
  37. #define ServerOP_Who 0x000B // #who
  38. #define ServerOP_ZonePlayer 0x000C // #zone, or #summon
  39. #define ServerOP_KickPlayer 0x000D // #kick
  40. #define ServerOP_RefreshGuild 0x000E // Notice to all zoneservers to refresh their guild cache for ID# in packet
  41. #define ServerOP_GuildKickAll 0x000F // Remove all clients from this guild
  42. #define ServerOP_GuildInvite 0x0010
  43. #define ServerOP_GuildRemove 0x0011
  44. #define ServerOP_GuildPromote 0x0012
  45. #define ServerOP_GuildDemote 0x0013
  46. #define ServerOP_GuildLeader 0x0014
  47. #define ServerOP_GuildGMSet 0x0015
  48. #define ServerOP_GuildGMSetRank 0x0016
  49. #define ServerOP_FlagUpdate 0x0018 // GM Flag updated for character, refresh the memory cache
  50. #define ServerOP_GMGoto 0x0019
  51. #define ServerOP_MultiLineMsg 0x001A
  52. #define ServerOP_Lock 0x001B // For #lock/#unlock inside server
  53. #define ServerOP_Motd 0x001C // For changing MoTD inside server.
  54. #define ServerOP_Uptime 0x001D
  55. #define ServerOP_Petition 0x001E
  56. #define ServerOP_KillPlayer 0x001F
  57. #define ServerOP_UpdateGM 0x0020
  58. #define ServerOP_RezzPlayer 0x0021
  59. #define ServerOP_ZoneReboot 0x0022
  60. #define ServerOP_ZoneToZoneRequest 0x0023
  61. #define ServerOP_AcceptWorldEntrance 0x0024
  62. #define ServerOP_ZAAuth 0x0025
  63. #define ServerOP_ZAAuthFailed 0x0026
  64. #define ServerOP_ZoneIncClient 0x0027 // Incomming client
  65. #define ServerOP_ClientListKA 0x0028
  66. #define ServerOP_ChangeWID 0x0029
  67. #define ServerOP_IPLookup 0x002A
  68. #define ServerOP_LockZone 0x002B
  69. #define ServerOP_ItemStatus 0x002C
  70. #define ServerOP_OOCMute 0x002D
  71. #define ServerOP_Revoke 0x002E
  72. #define ServerOP_GuildJoin 0x002F
  73. #define ServerOP_GroupIDReq 0x0030
  74. #define ServerOP_GroupIDReply 0x0031
  75. #define ServerOP_GroupLeave 0x0032 // for disbanding out of zone folks
  76. #define ServerOP_RezzPlayerAccept 0x0033
  77. #define ServerOP_SpawnCondition 0x0034
  78. #define ServerOP_SpawnEvent 0x0035
  79. #define UpdateServerOP_Verified 0x5090
  80. #define UpdateServerOP_DisplayMsg 0x5091
  81. #define UpdateServerOP_Completed 0x5092
  82. #define ServerOP_LSInfo 0x1000
  83. #define ServerOP_LSStatus 0x1001
  84. #define ServerOP_LSClientAuth 0x1002
  85. #define ServerOP_LSFatalError 0x1003
  86. #define ServerOP_SystemwideMessage 0x1005
  87. #define ServerOP_ListWorlds 0x1006
  88. #define ServerOP_PeerConnect 0x1007
  89. #define ServerOP_LSZoneInfo 0x3001
  90. #define ServerOP_LSZoneStart 0x3002
  91. #define ServerOP_LSZoneBoot 0x3003
  92. #define ServerOP_LSZoneShutdown 0x3004
  93. #define ServerOP_LSZoneSleep 0x3005
  94. #define ServerOP_LSPlayerLeftWorld 0x3006
  95. #define ServerOP_LSPlayerJoinWorld 0x3007
  96. #define ServerOP_LSPlayerZoneChange 0x3008
  97. #define ServerOP_UsertoWorldReq 0xAB00
  98. #define ServerOP_UsertoWorldResp 0xAB01
  99. #define ServerOP_EncapPacket 0x2007 // Packet within a packet
  100. #define ServerOP_WorldListUpdate 0x2008
  101. #define ServerOP_WorldListRemove 0x2009
  102. #define ServerOP_TriggerWorldListRefresh 0x200A
  103. #define ServerOP_WhoAll 0x0210
  104. #define ServerOP_SetWorldTime 0x200B
  105. #define ServerOP_GetWorldTime 0x200C
  106. #define ServerOP_SyncWorldTime 0x200E
  107. //EQ2 Opcodes
  108. #define ServerOP_CharTimeStamp 0x200F
  109. #define ServerOP_NameFilterCheck 0x2011
  110. #define ServerOP_BasicCharUpdate 0x2012
  111. #define ServerOP_CharacterCreate 0x2013
  112. #define ServerOP_NameCharUpdate 0x2014
  113. #define ServerOP_GetLatestTables 0x2015
  114. #define ServerOP_GetTableQuery 0x2016
  115. #define ServerOP_GetTableData 0x2017
  116. #define ServerOP_RaceUpdate 0x2018
  117. #define ServerOP_ZoneUpdate 0x2019
  118. #define ServerOP_BugReport 0x201A
  119. #define ServerOP_ResetDatabase 0x201B
  120. #define ServerOP_ZoneUpdates 0x201C
  121. #define ServerOP_LoginEquipment 0x201D // updates charater select screen item appearances (gear appear)
  122. #define ServerOP_CharacterPicture 0x201E
  123. /************ PACKET RELATED STRUCT ************/
  124. class ServerPacket
  125. {
  126. public:
  127. ~ServerPacket() { safe_delete_array(pBuffer); }
  128. ServerPacket(int16 in_opcode = 0, int32 in_size = 0) {
  129. this->compressed = false;
  130. size = in_size;
  131. opcode = in_opcode;
  132. if (size == 0) {
  133. pBuffer = 0;
  134. }
  135. else {
  136. pBuffer = new uchar[size];
  137. memset(pBuffer, 0, size);
  138. }
  139. destination = 0;
  140. InflatedSize = 0;
  141. }
  142. ServerPacket* Copy() {
  143. if (this == 0) {
  144. return 0;
  145. }
  146. ServerPacket* ret = new ServerPacket(this->opcode, this->size);
  147. if (this->size)
  148. memcpy(ret->pBuffer, this->pBuffer, this->size);
  149. ret->compressed = this->compressed;
  150. ret->InflatedSize = this->InflatedSize;
  151. return ret;
  152. }
  153. bool Deflate() {
  154. if (compressed)
  155. return false;
  156. if ((!this->pBuffer) || (!this->size))
  157. return false;
  158. uchar* tmp = new uchar[this->size + 128];
  159. int32 tmpsize = DeflatePacket(this->pBuffer, this->size, tmp, this->size + 128);
  160. if (!tmpsize) {
  161. safe_delete_array(tmp);
  162. return false;
  163. }
  164. this->compressed = true;
  165. this->InflatedSize = this->size;
  166. this->size = tmpsize;
  167. uchar* new_buffer = new uchar[this->size];
  168. memcpy(new_buffer, tmp, this->size);
  169. safe_delete_array(tmp);
  170. uchar* tmpdel = this->pBuffer;
  171. this->pBuffer = new_buffer;
  172. safe_delete_array(tmpdel);
  173. return true;
  174. }
  175. bool Inflate() {
  176. if (!compressed)
  177. return false;
  178. if ((!this->pBuffer) || (!this->size))
  179. return false;
  180. uchar* tmp = new uchar[InflatedSize];
  181. int32 tmpsize = InflatePacket(this->pBuffer, this->size, tmp, InflatedSize);
  182. if (!tmpsize) {
  183. safe_delete_array(tmp);
  184. return false;
  185. }
  186. compressed = false;
  187. this->size = tmpsize;
  188. uchar* tmpdel = this->pBuffer;
  189. this->pBuffer = tmp;
  190. safe_delete_array(tmpdel);
  191. return true;
  192. }
  193. int32 size;
  194. int16 opcode;
  195. uchar* pBuffer;
  196. bool compressed;
  197. int32 InflatedSize;
  198. int32 destination;
  199. };
  200. #pragma pack(1)
  201. struct GetLatestTables_Struct{
  202. float table_version;
  203. float data_version;
  204. };
  205. struct ServerLSInfo_Struct {
  206. char name[201]; // name the worldserver wants
  207. char address[250]; // DNS address of the server
  208. char account[31]; // account name for the worldserver
  209. char password[256]; // password for the name
  210. char protocolversion[25]; // Major protocol version number
  211. char serverversion[64]; // minor server software version number
  212. int8 servertype; // 0=world, 1=chat, 2=login, 3=MeshLogin, 4=World Debug
  213. int32 dbversion; // database major+minor version from version.h (for PatchServer)
  214. };
  215. struct ServerLSStatus_Struct {
  216. sint32 status;
  217. sint32 num_players;
  218. sint32 num_zones;
  219. int8 world_max_level;
  220. };
  221. struct ServerSystemwideMessage {
  222. int32 lsaccount_id;
  223. char key[30]; // sessionID key for verification
  224. int32 type;
  225. char message[0];
  226. };
  227. struct ServerSyncWorldList_Struct {
  228. int32 RemoteID;
  229. int32 ip;
  230. sint32 status;
  231. char name[201];
  232. char address[250];
  233. char account[31];
  234. int32 accountid;
  235. int8 authlevel;
  236. int8 servertype; // 0=world, 1=chat, 2=login
  237. int32 adminid;
  238. int8 showdown;
  239. sint32 num_players;
  240. sint32 num_zones;
  241. bool placeholder;
  242. };
  243. struct UsertoWorldRequest_Struct {
  244. int32 lsaccountid;
  245. int32 char_id;
  246. int32 worldid;
  247. int32 FromID;
  248. int32 ToID;
  249. char ip_address[21];
  250. };
  251. struct UsertoWorldResponse_Struct {
  252. int32 lsaccountid;
  253. int32 char_id;
  254. int32 worldid;
  255. int32 access_key;
  256. int8 response;
  257. char ip_address[80];
  258. int32 port;
  259. int32 FromID;
  260. int32 ToID;
  261. };
  262. struct ServerEncapPacket_Struct {
  263. int32 ToID; // ID number of the LWorld on the other server
  264. int16 opcode;
  265. int16 size;
  266. uchar data[0];
  267. };
  268. struct ServerEmoteMessage_Struct {
  269. char to[64];
  270. int32 guilddbid;
  271. sint16 minstatus;
  272. int32 type;
  273. char message[0];
  274. };
  275. /*struct TableVersion{
  276. char name[64];
  277. int32 version;
  278. int32 max_table_version;
  279. int32 max_data_version;
  280. sint32 data_version;
  281. int8 last;
  282. char column_names[1000];
  283. };*/
  284. typedef struct {
  285. char name[256];
  286. unsigned int name_len;
  287. unsigned int version;
  288. unsigned int data_version;
  289. } TableVersion;
  290. template<class Type> void AddPtrData(string* buffer, Type& data){
  291. buffer->append((char*)&data, sizeof(Type));
  292. }
  293. template<class Type> void AddPtrData(string* buffer, Type* data, int16 size){
  294. buffer->append(data, size);
  295. }
  296. class LatestTableVersions {
  297. public:
  298. LatestTableVersions(){
  299. tables = 0;
  300. current_index = 0;
  301. total_tables = 0;
  302. data_version = 0;
  303. }
  304. ~LatestTableVersions(){
  305. safe_delete_array(tables);
  306. }
  307. void SetTableSize(int16 size){
  308. total_tables = size;
  309. tables = new TableVersion[total_tables];
  310. }
  311. void AddTable(char* name, int32 version, int32 data_version){
  312. strcpy(tables[current_index].name, name);
  313. tables[current_index].version = version;
  314. tables[current_index].data_version = data_version;
  315. current_index++;
  316. }
  317. int16 GetTotalSize(){
  318. return total_tables * sizeof(TableVersion) + sizeof(int16);
  319. }
  320. int16 GetTotalTables(){
  321. return total_tables;
  322. }
  323. TableVersion* GetTables(){
  324. return tables;
  325. }
  326. TableVersion GetTable(int16 index){
  327. return tables[index];
  328. }
  329. string Serialize(){
  330. AddPtrData(&buffer, total_tables);
  331. for(int16 i=0;i<total_tables;i++){
  332. AddPtrData(&buffer, tables[i].name, sizeof(tables[i].name));
  333. AddPtrData(&buffer, tables[i].version);
  334. AddPtrData(&buffer, tables[i].data_version);
  335. }
  336. return buffer;
  337. }
  338. void DeSerialize(uchar* data){
  339. uchar* ptr = data;
  340. memcpy(&total_tables, ptr, sizeof(total_tables));
  341. ptr+= sizeof(total_tables);
  342. tables = new TableVersion[total_tables];
  343. for(int16 i=0;i<total_tables;i++){
  344. memcpy(&tables[i].name, ptr, sizeof(tables[i].name));
  345. ptr+= sizeof(tables[i].name);
  346. memcpy(&tables[i].version, ptr, sizeof(tables[i].version));
  347. ptr+= sizeof(tables[i].version);
  348. memcpy(&tables[i].data_version, ptr, sizeof(tables[i].data_version));
  349. ptr+= sizeof(tables[i].data_version);
  350. }
  351. }
  352. int32 data_version;
  353. private:
  354. int16 current_index;
  355. int16 total_tables;
  356. TableVersion* tables;
  357. string buffer;
  358. };
  359. struct TableData{
  360. int16 size;
  361. char* query;
  362. };
  363. class TableQuery {
  364. public:
  365. TableQuery(){
  366. try_delete = true;
  367. num_queries = 0;
  368. data_version = 0;
  369. current_index = 0;
  370. latest_version = 0;
  371. your_version = 0;
  372. total_size = sizeof(num_queries) + sizeof(latest_version) + sizeof(your_version) + sizeof(tablename);
  373. }
  374. ~TableQuery(){
  375. if(try_delete){
  376. for(int16 i=0;i<tmp_queries.size();i++){
  377. safe_delete_array(tmp_queries[i]);
  378. }
  379. }
  380. }
  381. string GetQueriesString(){
  382. string query_string ;
  383. for(int32 i=0;i<tmp_queries.size();i++){
  384. query_string.append(tmp_queries[i]).append("\n");
  385. }
  386. return query_string;
  387. }
  388. void AddQuery(char* query){
  389. num_queries++;
  390. total_size += strlen(query) + 1;
  391. tmp_queries.push_back(query);
  392. }
  393. int16 GetTotalSize(){
  394. return total_size;
  395. }
  396. int16 GetTotalQueries(){
  397. return num_queries;
  398. }
  399. char* GetQuery(int16 index){
  400. return tmp_queries[index];
  401. }
  402. string Serialize(){
  403. num_queries = tmp_queries.size();
  404. AddPtrData(&buffer, num_queries);
  405. AddPtrData(&buffer, latest_version);
  406. AddPtrData(&buffer, your_version);
  407. AddPtrData(&buffer, data_version);
  408. AddPtrData(&buffer, tablename, sizeof(tablename));
  409. for(int16 i=0;i<GetTotalQueries();i++)
  410. AddPtrData(&buffer, tmp_queries[i], strlen(tmp_queries[i]) + 1);
  411. return buffer;
  412. }
  413. void DeSerialize(uchar* data){
  414. try_delete = false;
  415. uchar* ptr = data;
  416. memcpy(&num_queries, ptr, sizeof(num_queries));
  417. ptr+= sizeof(num_queries);
  418. memcpy(&latest_version, ptr, sizeof(latest_version));
  419. ptr+= sizeof(latest_version);
  420. memcpy(&your_version, ptr, sizeof(your_version));
  421. ptr+= sizeof(your_version);
  422. memcpy(&data_version, ptr, sizeof(data_version));
  423. ptr+= sizeof(data_version);
  424. memcpy(&tablename, ptr, sizeof(tablename));
  425. ptr+= sizeof(tablename);
  426. for(int16 i=0;i<GetTotalQueries();i++){
  427. tmp_queries.push_back((char*)ptr);
  428. ptr += strlen((char*)ptr) + 1;
  429. }
  430. }
  431. int16 current_index;
  432. int16 num_queries;
  433. int32 latest_version;
  434. int32 your_version;
  435. int32 data_version;
  436. bool try_delete;
  437. char tablename[64];
  438. int32 total_size;
  439. string buffer;
  440. private:
  441. vector<char*> tmp_queries;
  442. };
  443. class TableDataQuery{
  444. public:
  445. TableDataQuery(char* table_name){
  446. if( strlen(table_name) >= sizeof(tablename) )
  447. return;
  448. strcpy(tablename, table_name);
  449. num_queries = 0;
  450. columns_size = 0;
  451. columns = 0;
  452. version = 0;
  453. table_size = 0;
  454. }
  455. TableDataQuery(){
  456. num_queries = 0;
  457. columns_size = 0;
  458. columns = 0;
  459. version = 0;
  460. table_size = 0;
  461. }
  462. ~TableDataQuery(){
  463. safe_delete_array(columns);
  464. for(int32 i=0;i<num_queries;i++){
  465. safe_delete_array(queries[i]->query);
  466. safe_delete(queries[i]);
  467. }
  468. }
  469. int32 GetTotalQueries(){
  470. return num_queries;
  471. }
  472. string* Serialize(){
  473. buffer = "";
  474. num_queries = queries.size();
  475. if(GetTotalQueries() == 0)
  476. return 0;
  477. table_size = strlen(tablename);
  478. AddPtrData(&buffer, table_size);
  479. AddPtrData(&buffer, tablename, table_size + 1);
  480. AddPtrData(&buffer, version);
  481. if(num_queries > 200){
  482. int32 max_queries = 200;
  483. AddPtrData(&buffer, max_queries);
  484. }
  485. else
  486. AddPtrData(&buffer, num_queries);
  487. AddPtrData(&buffer, columns_size);
  488. AddPtrData(&buffer, columns, columns_size);
  489. vector<TableData*>::iterator query_iterator;
  490. int16 count = 0;
  491. for(int i=GetTotalQueries() - 1;i >=0 && count < 200;i--){
  492. AddPtrData(&buffer, queries[i]->size);
  493. AddPtrData(&buffer, queries[i]->query, queries[i]->size);
  494. safe_delete_array(queries[i]->query);
  495. safe_delete(queries[i]);
  496. queries.pop_back();
  497. count++;
  498. }
  499. return &buffer;
  500. }
  501. void DeSerialize(uchar* data){
  502. uchar* ptr = data;
  503. memcpy(&table_size, ptr, sizeof(table_size));
  504. ptr+= sizeof(table_size);
  505. memcpy(&tablename, ptr, table_size + 1);
  506. ptr+= table_size + 1;
  507. memcpy(&version, ptr, sizeof(version));
  508. ptr+= sizeof(version);
  509. memcpy(&num_queries, ptr, sizeof(num_queries));
  510. ptr+= sizeof(num_queries);
  511. memcpy(&columns_size, ptr, sizeof(columns_size));
  512. ptr+= sizeof(columns_size);
  513. columns = new char[columns_size + 1];
  514. memcpy(columns, ptr, columns_size + 1);
  515. ptr+= columns_size;
  516. for(int32 i=0;i<GetTotalQueries();i++)
  517. {
  518. TableData* new_query = new TableData;
  519. try {
  520. memcpy(&new_query->size, ptr, sizeof(new_query->size));
  521. ptr+= sizeof(new_query->size);
  522. new_query->query = new char[new_query->size + 1];
  523. memcpy(new_query->query, ptr, new_query->size);
  524. ptr+= new_query->size;
  525. queries.push_back(new_query);
  526. }
  527. catch( bad_alloc &ba )
  528. {
  529. cout << ba.what() << endl;
  530. if( NULL != new_query )
  531. delete new_query;
  532. }
  533. }
  534. }
  535. string buffer;
  536. int32 num_queries;
  537. int32 version;
  538. int16 table_size;
  539. char tablename[64];
  540. int16 columns_size;
  541. char* columns;
  542. vector<TableData*> queries;
  543. };
  544. // Max number of equipment updates to send at once
  545. struct EquipmentUpdateRequest_Struct
  546. {
  547. int16 max_per_batch;
  548. };
  549. // Login's structure of equipment data
  550. struct LoginEquipmentUpdate
  551. {
  552. int32 world_char_id;
  553. int16 equip_type;
  554. int8 red;
  555. int8 green;
  556. int8 blue;
  557. int8 highlight_red;
  558. int8 highlight_green;
  559. int8 highlight_blue;
  560. int32 slot;
  561. };
  562. // World's structure of equipment data
  563. struct EquipmentUpdate_Struct
  564. {
  565. int32 id; // unique record identifier per world
  566. int32 world_char_id;
  567. int16 equip_type;
  568. int8 red;
  569. int8 green;
  570. int8 blue;
  571. int8 highlight_red;
  572. int8 highlight_green;
  573. int8 highlight_blue;
  574. int32 slot;
  575. };
  576. // How many equipmment updates are there to send?
  577. struct EquipmentUpdateList_Struct
  578. {
  579. sint16 total_updates;
  580. };
  581. struct ZoneUpdateRequest_Struct{
  582. int16 max_per_batch;
  583. };
  584. struct LoginZoneUpdate{
  585. string name;
  586. string description;
  587. };
  588. struct ZoneUpdate_Struct{
  589. int32 zone_id;
  590. int8 zone_name_length;
  591. int8 zone_desc_length;
  592. char data[0];
  593. };
  594. struct ZoneUpdateList_Struct{
  595. sint16 total_updates;
  596. char data[0];
  597. };
  598. //EQ2 Specific Structures Login -> World (Image)
  599. struct CharacterTimeStamp_Struct {
  600. int32 char_id;
  601. int32 account_id;
  602. int32 unix_timestamp;
  603. };
  604. //EQ2 Specific Structures World -> Login (Image)
  605. /**UPDATE_FIELD TYPES**
  606. These will be stored beside the timestamp on the world server to determine what has changed on between the timestamp, when the update is sent, it will remove the flag.
  607. 8 bits in a byte:
  608. Example: 01001100
  609. 0 Level Flag
  610. 1 Race Flag
  611. 0 Class Flag
  612. 0 Gender Flag
  613. 1 Zone Flag
  614. 1 Armor Flag
  615. 0 Name Flag
  616. 0 Delete Flag
  617. **/
  618. #define LEVEL_UPDATE_FLAG 1
  619. #define RACE_UPDATE_FLAG 2
  620. #define CLASS_UPDATE_FLAG 4
  621. #define GENDER_UPDATE_FLAG 8
  622. #define ZONE_UPDATE_FLAG 16
  623. #define ARMOR_UPDATE_FLAG 32
  624. #define NAME_UPDATE_FLAG 64
  625. #define DELETE_UPDATE_FLAG 128
  626. //This structure used for basic changes such as level,class,gender, and deletes that are not able to be backed up
  627. struct CharDataUpdate_Struct {
  628. int32 account_id;
  629. int32 char_id;
  630. int8 update_field;
  631. int32 update_data;
  632. };
  633. struct BugReport{
  634. char category[64];
  635. char subcategory[64];
  636. char causes_crash[64];
  637. char reproducible[64];
  638. char summary[128];
  639. char description[2000];
  640. char version[32];
  641. char player[64];
  642. int32 account_id;
  643. char spawn_name[64];
  644. int32 spawn_id;
  645. int32 zone_id;
  646. };
  647. struct RaceUpdate_Struct {
  648. int32 account_id;
  649. int32 char_id;
  650. int16 model_type;
  651. int8 race;
  652. };
  653. //If this structure comes in with more than 74 bytes, should probably discard (leaves 65 bytes for new_name)
  654. #define CHARNAMEUPDATESTRUCT_MAXSIZE 74
  655. struct CharNameUpdate_Struct {
  656. int32 account_id;
  657. int32 char_id;
  658. int8 name_length; // If its longer than 64, something is wrong :-/
  659. char new_name[0];
  660. };
  661. //If this structure comes in with more than 78 bytes, should probably discard (leaves 65 bytes for new_zone)
  662. #define CHARZONESTRUCT_MAXSIZE 78
  663. struct CharZoneUpdate_Struct {
  664. int32 account_id;
  665. int32 char_id;
  666. int32 zone_id;
  667. int8 zone_length; // If its longer than 64, something is wrong :-/
  668. char new_zone[0];
  669. };
  670. struct WorldCharCreate_Struct {
  671. int32 account_id;
  672. int32 char_id;
  673. int16 model_type;
  674. int16 char_size;
  675. uchar character[0];
  676. };
  677. struct WorldCharNameFilter_Struct {
  678. int32 account_id;
  679. int16 name_length;
  680. uchar name[0];
  681. };
  682. struct WorldCharNameFilterResponse_Struct {
  683. int32 account_id;
  684. int32 char_id;
  685. int8 response;
  686. };
  687. #define CHARPICSTRUCT_MINSIZE 10
  688. // Should only be used for the headshot picture
  689. struct CharPictureUpdate_Struct {
  690. int32 account_id;
  691. int32 char_id;
  692. int16 pic_size;
  693. char pic[0];
  694. };
  695. #pragma pack()
  696. #endif