packets.hpp 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef PACKETS_HPP
  4. #define PACKETS_HPP
  5. #pragma warning( push )
  6. #pragma warning( disable : 4200 )
  7. // Required for MESSAGE_SIZE, TALKBOX_MESSAGE_SIZE
  8. #include "map.hpp"
  9. #define MAX_ITEM_OPTIONS MAX_ITEM_RDM_OPT
  10. #define UNAVAILABLE_STRUCT int8 _____unavailable
  11. /* packet size constant for itemlist */
  12. #if MAX_INVENTORY > MAX_STORAGE && MAX_INVENTORY > MAX_CART
  13. #define MAX_ITEMLIST MAX_INVENTORY
  14. #elif MAX_CART > MAX_INVENTORY && MAX_CART > MAX_STORAGE
  15. #define MAX_ITEMLIST MAX_CART
  16. #else
  17. #define MAX_ITEMLIST MAX_STORAGE
  18. #endif
  19. #define MAX_ACHIEVEMENT_DB MAX_ACHIEVEMENT_OBJECTIVES
  20. #define DEFINE_PACKET_HEADER(name, id) const int16 HEADER_##name = id;
  21. #include "packets_struct.hpp"
  22. // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
  23. #if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
  24. #pragma pack( push, 1 )
  25. #endif
  26. struct PACKET_CZ_REQ_MAKINGARROW{
  27. int16 packetType;
  28. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  29. uint32 itemId;
  30. #else
  31. uint16 itemId;
  32. #endif
  33. } __attribute__((packed));
  34. struct PACKET_CZ_SE_PC_BUY_CASHITEM_LIST_sub{
  35. uint32 itemId;
  36. uint32 amount;
  37. uint16 tab;
  38. } __attribute__((packed));
  39. struct PACKET_CZ_SE_PC_BUY_CASHITEM_LIST{
  40. int16 packetType;
  41. int16 packetLength;
  42. uint16 count;
  43. uint32 kafraPoints;
  44. struct PACKET_CZ_SE_PC_BUY_CASHITEM_LIST_sub items[];
  45. } __attribute__((packed));
  46. struct PACKET_CZ_REQ_CASH_BARGAIN_SALE_ITEM_INFO{
  47. int16 packetType;
  48. int16 packetLength;
  49. uint32 AID;
  50. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  51. uint32 itemId;
  52. #else
  53. uint16 itemId;
  54. #endif
  55. };
  56. struct PACKET_ZC_ACK_CASH_BARGAIN_SALE_ITEM_INFO{
  57. int16 packetType;
  58. uint16 result;
  59. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  60. uint32 itemId;
  61. #else
  62. uint16 itemId;
  63. #endif
  64. uint32 price;
  65. };
  66. struct PACKET_CZ_REQ_APPLY_BARGAIN_SALE_ITEM{
  67. int16 packetType;
  68. uint32 AID;
  69. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  70. uint32 itemId;
  71. #else
  72. uint16 itemId;
  73. #endif
  74. uint32 amount;
  75. uint32 startTime;
  76. #if PACKETVER >= 20150520
  77. uint16 hours;
  78. #else
  79. uint8 hours;
  80. #endif
  81. };
  82. struct PACKET_CZ_REQ_REMOVE_BARGAIN_SALE_ITEM{
  83. int16 packetType;
  84. uint32 AID;
  85. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  86. uint32 itemId;
  87. #else
  88. uint16 itemId;
  89. #endif
  90. };
  91. struct PACKET_ZC_NOTIFY_BARGAIN_SALE_SELLING{
  92. int16 packetType;
  93. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  94. uint32 itemId;
  95. #else
  96. uint16 itemId;
  97. #endif
  98. uint32 remainingTime;
  99. };
  100. struct PACKET_ZC_NOTIFY_BARGAIN_SALE_CLOSE{
  101. int16 packetType;
  102. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  103. uint32 itemId;
  104. #else
  105. uint16 itemId;
  106. #endif
  107. };
  108. struct PACKET_ZC_ACK_COUNT_BARGAIN_SALE_ITEM{
  109. int16 packetType;
  110. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  111. uint32 itemId;
  112. #else
  113. uint16 itemId;
  114. #endif
  115. uint32 amount;
  116. };
  117. struct PACKET_ZC_ACK_GUILDSTORAGE_LOG_sub{
  118. uint32 id;
  119. #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
  120. uint32 itemId;
  121. #else
  122. uint16 itemId;
  123. #endif
  124. int32 amount;
  125. uint8 action;
  126. int32 refine;
  127. int64 uniqueId;
  128. uint8 IsIdentified;
  129. uint16 itemType;
  130. struct EQUIPSLOTINFO slot;
  131. char name[NAME_LENGTH];
  132. char time[NAME_LENGTH];
  133. uint8 attribute;
  134. };
  135. struct PACKET_ZC_ACK_GUILDSTORAGE_LOG{
  136. int16 packetType;
  137. int16 PacketLength;
  138. uint16 result;
  139. uint16 amount;
  140. struct PACKET_ZC_ACK_GUILDSTORAGE_LOG_sub items[];
  141. };
  142. struct PACKET_EFST_SET_ENTER {
  143. int16 PacketType;
  144. uint32 GID;
  145. uint16 type;
  146. uint32 remaining;
  147. #if PACKETVER >= 20120618
  148. uint32 total;
  149. #endif
  150. int32 val1;
  151. int32 val2;
  152. int32 val3;
  153. };
  154. // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
  155. #if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
  156. #pragma pack( pop )
  157. #endif
  158. DEFINE_PACKET_HEADER(CZ_REQMAKINGITEM, 0x18e)
  159. DEFINE_PACKET_HEADER(CZ_REQ_MAKINGARROW, 0x1ae)
  160. DEFINE_PACKET_HEADER(CZ_REQ_ITEMREPAIR, 0x1fd)
  161. DEFINE_PACKET_HEADER(CZ_REQ_MAKINGITEM, 0x25b)
  162. DEFINE_PACKET_HEADER(CZ_REQ_CASH_BARGAIN_SALE_ITEM_INFO, 0x9ac)
  163. DEFINE_PACKET_HEADER(ZC_ACK_CASH_BARGAIN_SALE_ITEM_INFO, 0x9ad)
  164. DEFINE_PACKET_HEADER(CZ_REQ_APPLY_BARGAIN_SALE_ITEM, 0x9ae)
  165. DEFINE_PACKET_HEADER(CZ_REQ_REMOVE_BARGAIN_SALE_ITEM, 0x9b0)
  166. DEFINE_PACKET_HEADER(ZC_NOTIFY_BARGAIN_SALE_SELLING, 0x9b2)
  167. DEFINE_PACKET_HEADER(ZC_NOTIFY_BARGAIN_SALE_CLOSE, 0x9b3)
  168. DEFINE_PACKET_HEADER(ZC_ACK_COUNT_BARGAIN_SALE_ITEM, 0x9c4)
  169. DEFINE_PACKET_HEADER(ZC_ACK_GUILDSTORAGE_LOG, 0x9da)
  170. DEFINE_PACKET_HEADER(CZ_REQ_APPLY_BARGAIN_SALE_ITEM2, 0xa3d)
  171. #if PACKETVER >= 20120618
  172. DEFINE_PACKET_HEADER(ZC_EFST_SET_ENTER, 0x984)
  173. #elif PACKETVER >= 20111108
  174. DEFINE_PACKET_HEADER(ZC_EFST_SET_ENTER, 0x8ff)
  175. #endif
  176. const int16 MAX_INVENTORY_ITEM_PACKET_NORMAL = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_normal ) - ( sizeof( struct NORMALITEM_INFO ) * MAX_ITEMLIST) ) ) / sizeof( struct NORMALITEM_INFO ) );
  177. const int16 MAX_INVENTORY_ITEM_PACKET_EQUIP = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_equip ) - ( sizeof( struct EQUIPITEM_INFO ) * MAX_ITEMLIST ) ) ) / sizeof( struct EQUIPITEM_INFO ) );
  178. const int16 MAX_STORAGE_ITEM_PACKET_NORMAL = ( ( INT16_MAX - ( sizeof( struct ZC_STORE_ITEMLIST_NORMAL ) - ( sizeof( struct NORMALITEM_INFO ) * MAX_ITEMLIST) ) ) / sizeof( struct NORMALITEM_INFO ) );
  179. const int16 MAX_STORAGE_ITEM_PACKET_EQUIP = ( ( INT16_MAX - ( sizeof( struct ZC_STORE_ITEMLIST_EQUIP ) - ( sizeof( struct EQUIPITEM_INFO ) * MAX_ITEMLIST ) ) ) / sizeof( struct EQUIPITEM_INFO ) );
  180. const int16 MAX_GUILD_STORAGE_LOG_PACKET = ( ( INT16_MAX - sizeof( struct PACKET_ZC_ACK_GUILDSTORAGE_LOG ) ) / sizeof( struct PACKET_ZC_ACK_GUILDSTORAGE_LOG_sub ) );
  181. #undef MAX_ITEM_OPTIONS
  182. #undef UNAVAILABLE_STRUCT
  183. #undef MAX_ITEMLIST
  184. #undef MAX_ACHIEVEMENT_DB
  185. #undef MAX_PACKET_POS
  186. #undef DEFINE_PACKET_HEADER
  187. #pragma warning( pop )
  188. #endif /* PACKETS_HPP */