KProtocolDef.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:9k
源码类别:

模拟服务器

开发平台:

C/C++

  1. #ifndef KProtocolDefH
  2. #define KProtocolDefH
  3. // Add by Freeway chen in 2003.7.1
  4. // 定义协议兼容的版本,如果修改的协议,导致原有版本无法使用,需要修改下面的值
  5. #define USE_KPROTOCOL_VERSION   1
  6. //#undef USE_KPROTOCOL_VERSION
  7. #define KPROTOCOL_VERSION   1
  8. /*
  9.  *
  10.  */
  11. /*
  12.  * It was to judge a package type that 
  13.  * it is a larger package or it is a small package
  14.  */
  15. const UINT g_nGlobalProtocolType = 31;
  16. enum s2c_PROTOCOL
  17. {
  18. s2c_roleserver_getroleinfo_result = 10,
  19. s2c_syncgamesvr_roleinfo_cipher,
  20. s2c_gamestatistic_bigpackage,
  21. /*
  22.  * This value must be equal to c2s_micropackbegin
  23.  */
  24. s2c_micropackbegin = g_nGlobalProtocolType,
  25. s2c_accountbegin = 32,
  26. s2c_accountlogin,
  27. s2c_gamelogin,
  28. s2c_accountlogout,
  29. s2c_gatewayverify, //用于连接后第一个包
  30. s2c_gatewayverifyagain, //用于重连后第一个包
  31. s2c_gatewayinfo,
  32. s2c_multiserverbegin = 48,
  33. s2c_querymapinfo,
  34. s2c_querygameserverinfo,
  35. s2c_identitymapping,
  36. s2c_notifyplayerlogin,
  37. s2c_notifyplayerexchange,
  38. s2c_notifysvrip,
  39. s2c_roleserver_getrolelist_result,
  40. s2c_roleserver_saverole_result,
  41. s2c_roleserver_createrole_result,
  42. s2c_roleserver_deleterole_result,
  43. s2c_logiclogout,
  44. s2c_gateway_broadcast,
  45. s2c_gamestatistic,
  46. s2c_clientbegin = 64,
  47. s2c_login, //ref: ../../S3Client/Login/LoginDef.h
  48. s2c_logout,
  49. s2c_syncend,
  50. s2c_synccurplayer,
  51. s2c_synccurplayerskill,
  52. s2c_synccurplayernormal,
  53. s2c_newplayer,
  54. s2c_removeplayer,
  55. s2c_syncworld,
  56. s2c_syncplayer,
  57. s2c_syncplayermin,
  58. s2c_syncnpc,
  59. s2c_syncnpcmin,
  60. s2c_syncnpcminplayer,
  61. s2c_objadd,
  62. s2c_syncobjstate,
  63. s2c_syncobjdir,
  64. s2c_objremove,
  65. s2c_objTrapAct,
  66. s2c_npcremove,
  67. s2c_npcwalk,
  68. s2c_npcrun,
  69. s2c_npcattack,
  70. s2c_npcmagic,
  71. s2c_npcjump,
  72. s2c_npctalk,
  73. s2c_npchurt,
  74. s2c_npcdeath,
  75. s2c_npcchgcurcamp,
  76. s2c_npcchgcamp,
  77. s2c_skillcast,
  78. s2c_playertalk,
  79. s2c_playerexp,
  80. s2c_teaminfo,
  81. s2c_teamselfinfo,
  82. s2c_teamapplyinfofalse,
  83. s2c_teamcreatesuccess,
  84. s2c_teamcreatefalse,
  85. s2c_teamopenclose,
  86. s2c_teamgetapply,
  87. s2c_teamaddmember,
  88. s2c_teamleave,
  89. s2c_teamchangecaptain,
  90. s2c_playerfactiondata,
  91. s2c_playerleavefaction,
  92. s2c_playerfactionskilllevel,
  93. s2c_playersendchat,
  94. s2c_playersyncleadexp,
  95. s2c_playerlevelup,
  96. s2c_teammatelevel,
  97. s2c_playersyncattribute,
  98. s2c_playerskilllevel,
  99. s2c_syncitem,
  100. s2c_removeitem,
  101. s2c_syncmoney,
  102. s2c_playermoveitem,
  103. s2c_scriptaction,
  104. s2c_chatapplyaddfriend,
  105. s2c_chataddfriend,
  106. s2c_chatrefusefriend,
  107. s2c_chataddfriendfail,
  108. s2c_chatloginfriendnoname,
  109. s2c_chatloginfriendname,
  110. s2c_chatonefrienddata,
  111. s2c_chatfriendonline,
  112. s2c_chatdeletefriend,
  113. s2c_chatfriendoffline,
  114. s2c_syncrolelist,
  115. s2c_tradechangestate,
  116. s2c_npcsetmenustate,
  117. s2c_trademoneysync,
  118. s2c_tradedecision,
  119. s2c_chatscreensingleerror,
  120. s2c_syncnpcstate,
  121. s2c_teaminviteadd,
  122. s2c_tradepressoksync,
  123. s2c_ping,
  124. s2c_npcsit,
  125. s2c_opensalebox,
  126. s2c_castskilldirectly,
  127. s2c_msgshow,
  128. s2c_syncstateeffect,
  129. s2c_openstorebox,
  130. s2c_playerrevive,
  131. s2c_requestnpcfail,
  132. s2c_tradeapplystart,
  133. s2c_rolenewdelresponse, //新建与删除角色的结果返回,所带数据为结构tagNewDelRoleResponse
  134. s2c_ItemAutoMove,
  135. s2c_itemexchangefinish,
  136. s2c_changeweather,
  137. s2c_pksyncnormalflag,
  138. s2c_pksyncenmitystate,
  139. s2c_pksyncexercisestate,
  140. s2c_pksyncpkvalue,
  141. s2c_npcsleepmode,
  142. s2c_viewequip,
  143. s2c_ladderresult,
  144. s2c_ladderlist,
  145. s2c_tongcreate,
  146. s2c_replyclientping,
  147. s2c_npcgoldchange,
  148. s2c_itemdurabilitychange,
  149. // s2c_gmgateway2relaysvr, //GM登陆后网关通知中转服务器有合法连接的协议
  150. s2c_extend = 250,
  151. s2c_extendchat = 251,
  152. s2c_extendfriend = 252,
  153. s2c_extendtong = 253,
  154. s2c_end,
  155. };
  156. enum c2s_PROTOCOL
  157. {
  158. c2s_roleserver_saveroleinfo = 10,
  159. c2s_roleserver_createroleinfo,
  160. c2s_gmsvr2gateway_saverole,
  161. /*
  162.  * This value must be equal to s2c_micropackbegin
  163.  */
  164. c2s_micropackbegin = g_nGlobalProtocolType,
  165. c2s_accountbegin = 32,
  166. c2s_accountlogin,
  167. c2s_gamelogin,
  168. c2s_accountlogout,
  169. c2s_gatewayverify,
  170. c2s_gatewayverifyagain,
  171. c2s_gatewayinfo,
  172. c2s_multiserverbegin = 48,
  173. c2s_permitplayerlogin,
  174. c2s_updatemapinfo,
  175. c2s_updategameserverinfo,
  176. c2s_entergame,
  177. c2s_leavegame,
  178. c2s_registeraccount,
  179. c2s_requestsvrip,
  180. c2s_roleserver_getrolelist,
  181. c2s_roleserver_getroleinfo,
  182. c2s_roleserver_deleteplayer,
  183. c2s_gamestatistic,
  184. c2s_roleserver_lock,
  185. c2s_gameserverbegin = 64,
  186. c2s_login,
  187. c2s_logiclogin,
  188. c2s_syncend,
  189. c2s_loadplayer,
  190. c2s_newplayer,
  191. c2s_removeplayer,
  192. c2s_requestworld,
  193. c2s_requestplayer,
  194. c2s_requestnpc,
  195. c2s_requestobj,
  196. c2s_npcwalk,
  197. c2s_npcrun,
  198. c2s_npcskill,
  199. c2s_npcjump,
  200. c2s_npctalk,
  201. c2s_npchurt,
  202. c2s_npcdeath,
  203. c2s_playertalk,
  204. c2s_teamapplyinfo,
  205. c2s_teamapplycreate,
  206. c2s_teamapplyopenclose,
  207. c2s_teamapplyadd,
  208. c2s_teamacceptmember,
  209. c2s_teamapplyleave,
  210. c2s_teamapplykickmember,
  211. c2s_teamapplychangecaptain,
  212. c2s_teamapplydismiss,
  213. c2s_playerapplysetpk,
  214. c2s_playerapplyfactiondata,
  215. c2s_playersendchat,
  216. c2s_playeraddbaseattribute,
  217. c2s_playerapplyaddskillpoint,
  218. c2s_playereatitem,
  219. c2s_playerpickupitem,
  220. c2s_playermoveitem,
  221. c2s_playersellitem,
  222. c2s_playerbuyitem,
  223. c2s_playerthrowawayitem,
  224. c2s_playerselui,
  225. c2s_chatsetchannel,
  226. c2s_chatapplyaddfriend,
  227. c2s_chataddfriend,
  228. c2s_chatrefusefriend,
  229. c2s_dbplayerselect,
  230. c2s_chatapplyresendallfriendname,
  231. c2s_chatapplysendonefriendname,
  232. c2s_chatdeletefriend,
  233. c2s_chatredeletefriend,
  234. c2s_tradeapplystateopen,
  235. c2s_tradeapplystateclose,
  236. c2s_tradeapplystart,
  237. c2s_trademovemoney,
  238. c2s_tradedecision,
  239. c2s_dialognpc,
  240. c2s_teaminviteadd,
  241. c2s_changeauraskill,
  242. c2s_teamreplyinvite,
  243. c2s_ping,
  244. c2s_npcsit,
  245. c2s_objmouseclick,
  246. c2s_storemoney,
  247. c2s_playerrevive,
  248. c2s_tradereplystart,
  249. c2s_pkapplychangenormalflag,
  250. c2s_pkapplyenmity,
  251. c2s_viewequip,
  252. // c2s_gmlogin, //功效同c2s_login
  253. c2s_ladderquery,
  254. c2s_repairitem,
  255. _c2s_begin_relay = 250,
  256. c2s_extend = _c2s_begin_relay,
  257. c2s_extendchat,
  258. c2s_extendfriend,
  259. _c2s_end_relay = c2s_extendfriend,
  260. c2s_extendtong,
  261. c2s_end,
  262. };
  263. enum c2c_PROTOCOL //该协议族仅用于server和server之间
  264. {
  265. c2c_transferroleinfo = 14,
  266. c2c_micropackbegin = g_nGlobalProtocolType,
  267. c2c_protocolbegin = 32,
  268. c2c_permitplayerexchangeout = 64,
  269. c2c_permitplayerexchangein,
  270. c2c_notifyexchange,
  271. s2s_broadcast = 96, //用于从Relay到游戏世界的广播
  272. s2s_execute = 97, //用于从Relay到游戏世界的执行脚本
  273. c2c_end,
  274. };
  275. //以下协议为c2s_extend协议的派生协议,参见KRelayProtocol.h
  276. //扩展协议必须以EXTEND_HEADER打头
  277. enum gm_PROTOCOL //该协议族仅用于gm和server之间
  278. {
  279. gm_begin = 32,
  280. gm_c2s_execute, //以下协议由GM客户端以relay_c2c_askwaydata转发给游戏世界
  281. gm_c2s_disable,
  282. gm_c2s_enable,
  283. gm_c2s_tracking,
  284. gm_c2s_setrole,
  285. gm_c2s_getrole,
  286. gm_c2s_findplayer,
  287. gm_c2s_unlock,
  288. gm_c2s_getrolelist,
  289. gm_c2s_broadcast_chat,
  290. gm_s2c_tracking, //以下协议由游戏世界以relay_c2c_data转发给GM客户端
  291. gm_s2c_getrole,
  292. gm_s2c_findplayer,
  293. gm_s2c_getrolelist,
  294. gm_end,
  295. };
  296. enum relay_PROTOCOL //该协议族仅用于server和relay之间
  297. {
  298. relay_begin = 32,
  299. relay_c2c_data,
  300. relay_c2c_askwaydata,
  301. relay_s2c_loseway,
  302. relay_end,
  303. };
  304. enum chat_PROTOCOL
  305. {
  306. chat_micropackbegin = g_nGlobalProtocolType,
  307. chat_someonechat,
  308. chat_channelchat,
  309. chat_feedback,
  310. chat_everyone,
  311. chat_groupman,
  312. chat_specman,
  313. chat_relegate,
  314. chat_filterplayer,
  315. };
  316. enum playercomm_PROTOCOL //该协议族仅用于server和client之间,但是server可以转发给relay处理,因为relay承担了部分server的功能
  317. {
  318. playercomm_begin = 32,
  319. playercomm_c2s_querychannelid,
  320. playercomm_s2c_notifychannelid,
  321. playercomm_c2s_freechannelid,
  322. playercomm_c2s_subscribe,
  323. playercomm_s2c_relegate,
  324. playercomm_c2s_rollback,
  325. playercomm_s2c_gmquerychannelid,
  326. playercomm_s2c_gmfreechannelid,
  327. playercomm_s2c_gmsubscribe,
  328. playercomm_c2s_someoneact,
  329. playercomm_c2s_channelact,
  330. playercomm_someonechat,
  331. playercomm_channelchat,
  332. };
  333. // game server 发给 s3client 帮会扩展协议 id
  334. enum
  335. {
  336. enumTONG_SYNC_ID_CREATE_FAIL = 0,
  337. enumTONG_SYNC_ID_TRANSFER_ADD_APPLY,
  338. enumTONG_SYNC_ID_ADD,
  339. enumTONG_SYNC_ID_HEAD_INFO,
  340. enumTONG_SYNC_ID_SELF_INFO,
  341. enumTONG_SYNC_ID_MANAGER_INFO,
  342. enumTONG_SYNC_ID_MEMBER_INFO,
  343. enumTONG_SYNC_ID_INSTATE,
  344. enumTONG_SYNC_ID_KICK,
  345. enumTONG_SYNC_ID_CHANGE_MASTER_FAIL,
  346. enumTONG_SYNC_ID_NUM,
  347. };
  348. // s3client 发给 game server 帮会扩展协议 id
  349. enum
  350. {
  351. enumTONG_COMMAND_ID_START = 0,
  352. enumTONG_COMMAND_ID_APPLY_CREATE,
  353. enumTONG_COMMAND_ID_APPLY_ADD,
  354. enumTONG_COMMAND_ID_ACCEPT_ADD,
  355. enumTONG_COMMAND_ID_APPLY_INFO,
  356. enumTONG_COMMAND_ID_APPLY_INSTATE,
  357. enumTONG_COMMAND_ID_APPLY_KICK,
  358. enumTONG_COMMAND_ID_APPLY_LEAVE,
  359. enumTONG_COMMAND_ID_APPLY_CHANGE_MASTER,
  360. enumTONG_COMMAND_ID_NUM,
  361. };
  362. #endif