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

模拟服务器

开发平台:

C/C++

  1. #ifndef KPROTOCOL_H
  2. #define KPROTOCOL_H
  3. #ifndef __linux
  4. #ifdef _STANDALONE
  5. #include "GameDataDef.h"
  6. #else
  7. #include "../Sources/Core/src/GameDataDef.h"
  8. #endif
  9. #else
  10. #include "GameDataDef.h"
  11. #include <string.h>
  12. #endif
  13. #include "KProtocolDef.h"
  14. #include "KRelayProtocol.h"
  15. #pragma pack(push, enter_protocol)
  16. #pragma pack(1)
  17. #define PROTOCOL_MSG_TYPE BYTE
  18. #define PROTOCOL_MSG_SIZE (sizeof(PROTOCOL_MSG_TYPE))
  19. #define MAX_PROTOCOL_NUM 200
  20. typedef struct
  21. {
  22. BYTE ProtocolType;
  23. BYTE WalkSpeed;
  24. BYTE RunSpeed;
  25. BYTE AttackSpeed;
  26. BYTE CastSpeed;
  27. BYTE HelmType;
  28. BYTE ArmorType;
  29. BYTE WeaponType;
  30. BYTE HorseType;
  31. BYTE RankID;
  32. DWORD ID;
  33. BYTE m_btSomeFlag; // 0x01 PKFlag 0x02 FightModeFlag 0x04 SleepModeFlag
  34. // BYTE m_btPKFlag;
  35. // BYTE m_btFightMode;
  36. // BYTE m_SleepMode;
  37. // char Name[32];
  38. } PLAYER_SYNC;
  39. typedef struct
  40. {
  41. BYTE ProtocolType;
  42. DWORD ID;
  43. BYTE WalkSpeed; // 是否只要传一份就够了(只改变一个或是同时改变)
  44. BYTE RunSpeed;
  45. BYTE AttackSpeed;
  46. BYTE CastSpeed; // 是否考虑不改变施法速度,或施法速度等于攻击速度
  47. BYTE HelmType;
  48. BYTE ArmorType;
  49. BYTE WeaponType;
  50. BYTE HorseType;
  51. BYTE RankID;
  52. BYTE m_btSomeFlag; // 0x01 PKFlag 0x02 FightModeFlag 0x04 SleepModeFlag 0x08 TongOpenFlag
  53. // BYTE FightMode;
  54. // BYTE m_btPKFlag;
  55. // BYTE m_btSleepMode;
  56. } PLAYER_NORMAL_SYNC;
  57. typedef struct
  58. {
  59. BYTE ProtocolType;
  60. WORD m_wLength;
  61. BYTE Camp; // 阵营
  62. BYTE CurrentCamp; // 当前阵营
  63. BYTE m_bySeries; // 五行系
  64. BYTE LifePerCent; // 生命百分比
  65. BYTE m_btMenuState; // 组队、交易等状态
  66. BYTE m_Doing; // 行为
  67. BYTE m_btKind; // npc类型
  68. DWORD MapX; // 位置信息
  69. DWORD MapY; // 位置信息
  70. DWORD ID; // Npc的唯一ID
  71. int NpcSettingIdx; // 客户端用于加载玩家资源及基础数值设定
  72. WORD NpcEnchant; // 加强的NPC(后面的bit表示加强类型,名字是否金色之类的由加强的数目在客户端确定)
  73. char m_szName[32]; // 名字
  74. } NPC_SYNC;
  75. typedef struct
  76. {
  77. BYTE ProtocolType;
  78. DWORD ID;
  79. DWORD MapX;
  80. DWORD MapY;
  81. BYTE Camp;
  82. BYTE LifePerCent;
  83. BYTE Doing;
  84. BYTE State;
  85. } NPC_NORMAL_SYNC;
  86. typedef struct
  87. {
  88. BYTE ProtocolType;
  89. //int m_nRegionID;
  90. DWORD m_dwNpcID;
  91. DWORD m_dwMapX;
  92. DWORD m_dwMapY;
  93. WORD m_wOffX;
  94. WORD m_wOffY;
  95. BYTE m_byDoing;
  96. BYTE m_btCamp;
  97. BYTE m_btLifePerCent;
  98. } NPC_PLAYER_TYPE_NORMAL_SYNC;
  99.                  
  100. typedef struct
  101. {
  102. BYTE ProtocolType;
  103. DWORD ID;
  104. } NPC_REMOVE_SYNC, NPC_SIT_SYNC, NPC_DEATH_SYNC, NPC_REQUEST_COMMAND, NPC_REQUEST_FAIL;
  105. typedef struct
  106. {
  107. BYTE ProtocolType;
  108. DWORD ID;
  109. int nMpsX;
  110. int nMpsY;
  111. } NPC_WALK_SYNC;
  112. typedef struct
  113. {
  114. BYTE ProtocolType;
  115. DWORD ID;
  116. BYTE Type;
  117. } NPC_REVIVE_SYNC;
  118. typedef struct
  119. {
  120. BYTE ProtocolType;
  121. DWORD ID;
  122. int nMpsX;
  123. int nMpsY;
  124. } NPC_JUMP_SYNC;
  125. typedef struct
  126. {
  127. BYTE ProtocolType;
  128. DWORD ID;
  129. int nMpsX;
  130. int nMpsY;
  131. } NPC_RUN_SYNC;
  132. typedef struct
  133. {
  134. BYTE ProtocolType;
  135. DWORD ID;
  136. int nFrames;
  137. int nX;
  138. int nY;
  139. } NPC_HURT_SYNC;
  140. typedef struct
  141. {
  142. BYTE ProtocolType;
  143. DWORD ID;
  144. BYTE Camp;
  145. } NPC_CHGCURCAMP_SYNC;
  146. typedef struct
  147. {
  148. BYTE ProtocolType;
  149. DWORD ID;
  150. BYTE Camp;
  151. } NPC_CHGCAMP_SYNC;
  152. typedef struct
  153. {
  154. BYTE ProtocolType;
  155. DWORD ID;
  156. int nSkillID;
  157. int nSkillLevel;
  158. int nMpsX;
  159. int nMpsY;
  160. } NPC_SKILL_SYNC;
  161. typedef struct
  162. {
  163. BYTE ProtocolType;
  164. int nSkillID;
  165. int nMpsX;
  166. int nMpsY;
  167. } NPC_SKILL_COMMAND;
  168. typedef struct
  169. {
  170. BYTE ProtocolType;
  171. int nMpsX;
  172. int nMpsY;
  173. } NPC_WALK_COMMAND;
  174. typedef struct
  175. {
  176. BYTE ProtocolType;
  177. // BYTE ReviveType;
  178. } NPC_REVIVE_COMMAND;
  179. typedef struct
  180. {
  181. BYTE ProtocolType;
  182. int nMpsX;
  183. int nMpsY;
  184. } NPC_RUN_COMMAND;
  185. typedef struct
  186. {
  187. BYTE ProtocolType;
  188. int nShopIndex;
  189. } SALE_BOX_SYNC;
  190. typedef struct 
  191. {
  192. BYTE ProtocolType;
  193. int nNpcId;
  194. } PLAYER_DIALOG_NPC_COMMAND; //主角与nNpcId对话的请求
  195. typedef struct
  196. {
  197. BYTE ProtocolType; // 协议名称
  198. int m_nExp; // 当前经验
  199. } PLAYER_EXP_SYNC; // 玩家同步经验
  200. typedef struct
  201. {
  202. BYTE ProtocolType; // 协议名称
  203. } PLAYER_APPLY_CREATE_TEAM; // 客户端玩家创建队伍,向服务器发请求
  204. struct PLAYER_SEND_CREATE_TEAM_SUCCESS
  205. {
  206. BYTE ProtocolType; // 协议名称
  207. DWORD nTeamServerID; // 队伍在服务器上的唯一标识
  208. PLAYER_SEND_CREATE_TEAM_SUCCESS() {nTeamServerID = -1;}
  209. }; // 服务器通知玩家队伍创建成功
  210. typedef struct
  211. {
  212. BYTE ProtocolType; // 协议名称
  213. BYTE m_btErrorID; // 队伍创建不成功原因:0 同名 1 玩家本身已经属于某一支队伍 3 当前处于不能组队状态
  214. } PLAYER_SEND_CREATE_TEAM_FALSE;// 服务器通知客户端队伍创建不成功
  215. typedef struct
  216. {
  217. BYTE ProtocolType; // 协议名称
  218. DWORD m_dwTarNpcID; // 查询目标 npc id
  219. } PLAYER_APPLY_TEAM_INFO; // 客户端向服务器申请查询某个npc的组队情况
  220. typedef struct
  221. {
  222. BYTE ProtocolType; // 协议名称
  223. } PLAYER_APPLY_TEAM_INFO_FALSE; // 服务器告知客户端申请查询某个npc的组队情况失败
  224. typedef struct PLAYER_SEND_TEAM_INFO_DATA
  225. {
  226. BYTE ProtocolType; // 协议名称
  227. int m_nCaptain; // 队长 npc id
  228. int m_nMember[MAX_TEAM_MEMBER]; // 所有队员 npc id
  229. DWORD nTeamServerID; // 队伍在服务器上的唯一标识
  230. PLAYER_SEND_TEAM_INFO_DATA() {nTeamServerID = -1;};
  231. } PLAYER_SEND_TEAM_INFO; // 服务器向客户端发送某个队伍的信息数据
  232. typedef struct PLAYER_SEND_SELF_TEAM_INFO_DATA
  233. {
  234. BYTE ProtocolType; // 协议名称
  235. BYTE m_btState; // 队伍状态
  236. DWORD m_dwNpcID[MAX_TEAM_MEMBER + 1]; // 每名成员的npc id (队长放在第一位)
  237. char m_szNpcName[MAX_TEAM_MEMBER + 1][32]; // 每名成员的名字(队长放在第一位)
  238. DWORD nTeamServerID; // 队伍在服务器上的唯一标识
  239. DWORD m_dwLeadExp; // 玩家的统率力经验
  240. BYTE m_btLevel[MAX_TEAM_MEMBER + 1]; // 每名成员的等级(队长放在第一位)
  241. PLAYER_SEND_SELF_TEAM_INFO_DATA() {memset(m_szNpcName, 0, 32 * (MAX_TEAM_MEMBER + 1)); nTeamServerID = -1;};
  242. } PLAYER_SEND_SELF_TEAM_INFO; // 服务器向客户端发送客户端自身队伍的信息数据
  243. typedef struct
  244. {
  245. BYTE ProtocolType; // 协议名称
  246. BYTE m_btOpenClose; // 打开或关闭
  247. } PLAYER_TEAM_OPEN_CLOSE; // 队伍队长向服务器申请开放、关闭队伍是否允许接收成员状态
  248. typedef struct
  249. {
  250. BYTE ProtocolType; // 协议名称
  251. DWORD m_dwTarNpcID; // 目标队伍队长npc id 或者 申请人 npc id
  252. } PLAYER_APPLY_ADD_TEAM; // 玩家向服务器申请加入某个队伍或者服务器向某个队长转发某个玩家的加入申请
  253. typedef struct
  254. {
  255. BYTE ProtocolType; // 协议名称
  256. DWORD m_dwNpcID; // 被接受入队伍的npc id
  257. } PLAYER_ACCEPT_TEAM_MEMBER; // 玩家通知服务器接受某个玩家入队伍
  258. typedef struct PLAYER_TEAM_ADD_MEMBER_DATA
  259. {
  260. BYTE ProtocolType; // 协议名称
  261. BYTE m_btLevel; // 加入者等级
  262. DWORD m_dwNpcID; // 加入者npc id
  263. char m_szName[32]; // 加入者姓名
  264. PLAYER_TEAM_ADD_MEMBER_DATA() {memset(m_szName, 0, 32);};
  265. } PLAYER_TEAM_ADD_MEMBER; // 服务器通知队伍中的各个玩家有新成员加入
  266. typedef struct
  267. {
  268. BYTE ProtocolType; // 协议名称
  269. } PLAYER_APPLY_LEAVE_TEAM; // 客户端玩家申请离队
  270. typedef struct
  271. {
  272. BYTE ProtocolType; // 协议名称
  273. DWORD m_dwNpcID; // 离队npc id
  274. } PLAYER_LEAVE_TEAM; // 服务器通知各队员某人离队
  275. typedef struct
  276. {
  277. BYTE ProtocolType; // 协议名称
  278. DWORD m_dwNpcID; // 离队npc id
  279. } PLAYER_TEAM_KICK_MEMBER; // 队长踢除某个队员
  280. typedef struct
  281. {
  282. BYTE ProtocolType; // 协议名称
  283. DWORD m_dwNpcID; // 目标npc id
  284. } PLAYER_APPLY_TEAM_CHANGE_CAPTAIN;// 队长向服务器申请把自己的队长身份交给别的队员
  285. typedef struct
  286. {
  287. BYTE ProtocolType; // 协议名称
  288. DWORD m_dwCaptainID; // 新队长npc id
  289. DWORD m_dwMemberID; // 新队员npc id
  290. } PLAYER_TEAM_CHANGE_CAPTAIN; // 服务器通知各队员更换队长
  291. typedef struct
  292. {
  293. BYTE ProtocolType; // 协议名称
  294. } PLAYER_APPLY_TEAM_DISMISS; // 向服务器申请解散队伍
  295. typedef struct
  296. {
  297. BYTE ProtocolType; // 协议名称
  298. BYTE m_btPKFlag; // pk 开关
  299. } PLAYER_SET_PK; // 向服务器申请打开、关闭PK
  300. typedef struct
  301. {
  302. BYTE ProtocolType; // 协议名称
  303. BYTE m_btCamp; // 新阵营
  304. BYTE m_btCurFaction; // 当前门派
  305. BYTE m_btFirstFaction; // 首次加入门派
  306. int m_nAddTimes; // 加入门派次数
  307. } PLAYER_FACTION_DATA; // 服务器发给客户端门派信息
  308. typedef struct
  309. {
  310. BYTE ProtocolType; // 协议名称
  311. } PLAYER_LEAVE_FACTION; // 服务器通知玩家离开门派
  312. typedef struct
  313. {
  314. BYTE ProtocolType; // 协议名称
  315. BYTE m_btCurFactionID; // 当前门派id
  316. BYTE m_btLevel; // 技能开放等级
  317. } PLAYER_FACTION_SKILL_LEVEL; // 服务器通知玩家开放当前门派技能到某个等级
  318. typedef struct
  319. {
  320. BYTE ProtocolType; // 协议名称
  321. } PLAYER_APPLY_FACTION_DATA; // 客户端申请更新门派数据
  322. typedef struct PLAYER_SEND_CHAT_DATA_COMMAND
  323. {
  324. BYTE ProtocolType; // 协议名称
  325. WORD m_wLength;
  326. BYTE m_btCurChannel; // 当前聊天频道
  327. BYTE m_btType; // MSG_G_CHAT 或 MSG_G_CMD 或……
  328. BYTE m_btChatPrefixLen; // 格式控制字符长度
  329. WORD m_wSentenceLen; // 聊天语句长度
  330. DWORD m_dwTargetID; // 聊天对象 id
  331. int m_nTargetIdx; // 聊天对象在服务器端的 idx
  332. char m_szSentence[MAX_SENTENCE_LENGTH + CHAT_MSG_PREFIX_MAX_LEN]; // 聊天语句内容
  333. PLAYER_SEND_CHAT_DATA_COMMAND() {memset(m_szSentence, 0, sizeof(m_szSentence));};
  334. } PLAYER_SEND_CHAT_COMMAND; // 客户端聊天内容发送给服务器
  335. typedef struct PLAYER_SEND_CHAT_DATA_SYNC
  336. {
  337. BYTE ProtocolType; // 协议名称
  338. WORD m_wLength;
  339. BYTE m_btCurChannel; // 当前聊天状态
  340. BYTE m_btNameLen; // 名字长度
  341. BYTE m_btChatPrefixLen; // 控制字符长度
  342. WORD m_wSentenceLen; // 聊天语句长度
  343. DWORD m_dwSourceID; // 
  344. char m_szSentence[32 + CHAT_MSG_PREFIX_MAX_LEN + MAX_SENTENCE_LENGTH]; // 聊天语句内容
  345. PLAYER_SEND_CHAT_DATA_SYNC() { memset(m_szSentence, 0, sizeof(m_szSentence)); };
  346. } PLAYER_SEND_CHAT_SYNC; // 客户端聊天内容发送给服务器
  347. typedef struct
  348. {
  349. BYTE ProtocolType;
  350. WORD m_wLength;
  351. BYTE m_btState;
  352. int m_nID;
  353. int m_nDataID;
  354. int m_nXpos;
  355. int m_nYpos;
  356. int m_nMoneyNum;
  357. int m_nItemID;
  358. BYTE m_btDir;
  359. BYTE m_btItemWidth;
  360. WORD m_wCurFrame;
  361. BYTE m_btItemHeight;
  362. BYTE m_btColorID;
  363. BYTE m_btFlag;
  364. char m_szName[32];
  365. } OBJ_ADD_SYNC;
  366. typedef struct
  367. {
  368. BYTE ProtocolType;
  369. BYTE m_btState;
  370. int m_nID;
  371. } OBJ_SYNC_STATE;
  372. typedef struct
  373. {
  374. BYTE ProtocolType;
  375. BYTE m_btDir;
  376. int m_nID;
  377. } OBJ_SYNC_DIR;
  378. typedef struct
  379. {
  380. BYTE ProtocolType;
  381. int m_nID;
  382. BYTE m_btSoundFlag;
  383. } OBJ_SYNC_REMOVE;
  384. typedef struct
  385. {
  386. BYTE ProtocolType;
  387. int m_nID;
  388. int m_nTarX;
  389. int m_nTarY;
  390. } OBJ_SYNC_TRAP_ACT;
  391. typedef struct
  392. {
  393. BYTE ProtocolType;
  394. int m_nID;
  395. } OBJ_CLIENT_SYNC_ADD;
  396. typedef struct
  397. {
  398. BYTE ProtocolType; // 协议名称
  399. DWORD m_dwLeadExp; // 统率力经验值
  400. } PLAYER_LEAD_EXP_SYNC; // 同步统率力经验值
  401. typedef struct
  402. {
  403. BYTE ProtocolType; // 协议名称
  404. BYTE m_btLevel; // 当前等级
  405. int m_nExp; // 当前经验
  406. int m_nAttributePoint; // 剩余属性点
  407. int m_nSkillPoint; // 剩余技能点
  408. int m_nBaseLifeMax; // 当前最大生命值
  409. int m_nBaseStaminaMax; // 当前最大体力值
  410. int m_nBaseManaMax; // 当前最大内力值
  411. } PLAYER_LEVEL_UP_SYNC; // 玩家升级
  412. typedef struct
  413. {
  414. BYTE ProtocolType; // 协议名称
  415. BYTE m_btLevel; // 当前等级
  416. DWORD m_dwTeammateID; // 队友 npc id
  417. } PLAYER_TEAMMATE_LEVEL_SYNC; // 玩家升级的时候通知队友
  418. typedef struct
  419. {
  420. BYTE ProtocolType; // 协议名称
  421. BYTE m_btAttribute; // 属性(0=Strength 1=Dexterity 2=Vitality 3=Engergy)
  422. int m_nAddNo; // 加的点数
  423. } PLAYER_ADD_BASE_ATTRIBUTE_COMMAND; // 玩家添加基本属性点
  424. typedef struct
  425. {
  426. BYTE ProtocolType; // 协议名称
  427. int m_nSkillID; // 技能id
  428. int m_nAddPoint; // 要加的点数
  429. } PLAYER_ADD_SKILL_POINT_COMMAND;// 玩家申请增加某个技能的点数
  430. typedef struct
  431. {
  432. BYTE ProtocolType; // 协议名称
  433. BYTE m_btAttribute; // 属性(0=Strength 1=Dexterity 2=Vitality 3=Engergy)
  434. int m_nBasePoint; // 基本点数
  435. int m_nCurPoint; // 当前点数
  436. int m_nLeavePoint; // 剩余未分配属性点
  437. } PLAYER_ATTRIBUTE_SYNC; // 玩家同步属性点
  438. typedef struct
  439. {
  440. BYTE ProtocolType; // 协议名称
  441. int m_nSkillID; // 技能id
  442. int m_nSkillLevel; // 技能等级
  443. int m_nLeavePoint; // 剩余未分配技能点
  444. } PLAYER_SKILL_LEVEL_SYNC; // 玩家同步技能点
  445. //typedef struct
  446. //{
  447. // BYTE ProtocolType; // 协议名称
  448. // int m_nItemID; // 物品id
  449. // int m_nSourcePos; // 来源位置
  450. // int m_nTargetPos; // 目的位置
  451. //} PLAYER_EQUIP_ITEM_COMMAND; // 玩家鼠标右键点击使用物品(装备)
  452. typedef struct
  453. {
  454. BYTE ProtocolType; // 协议名称
  455. BYTE m_btPlace; // 药品位置
  456. BYTE m_btX; // 药品位置
  457. BYTE m_btY; // 药品位置
  458. int m_nItemID; // 物品id
  459. } PLAYER_EAT_ITEM_COMMAND; // 玩家鼠标右键点击使用物品(吃药)
  460. typedef struct
  461. {
  462. BYTE ProtocolType; // 协议名称
  463. int m_nObjID; // 鼠标点击的obj的id
  464. BYTE m_btPosType; // 位置类型
  465. BYTE m_btPosX; // 坐标 x
  466. BYTE m_btPosY; // 坐标 y
  467. } PLAYER_PICKUP_ITEM_COMMAND; // 玩家获得物品(鼠标点击地图上的obj)
  468. typedef struct
  469. {
  470. BYTE ProtocolType; // 协议类型
  471. int m_ID; // 物品的ID
  472. BYTE m_Genre; // 物品的类型
  473. BYTE m_Detail; // 物品的类别
  474. BYTE m_Particur; // 物品的详细类别
  475. BYTE m_Series; // 物品的五行
  476. BYTE m_Level; // 物品的等级
  477. BYTE m_btPlace; // 坐标
  478. BYTE m_btX; // 坐标
  479. BYTE m_btY; // 坐标
  480. BYTE m_Luck; // MF
  481. BYTE m_MagicLevel[6]; // 生成参数
  482. WORD m_Version; // 装备版本
  483. WORD m_Durability; // 耐久度
  484. UINT m_RandomSeed; // 随机种子
  485. } ITEM_SYNC;
  486. typedef struct
  487. {
  488. BYTE ProtocolType; // 协议类型
  489. int m_ID; // 物品的ID
  490. } ITEM_REMOVE_SYNC;
  491. typedef struct
  492. {
  493. BYTE ProtocolType; // 协议类型
  494. int m_ID; // 物品的ID
  495. } PLAYER_SELL_ITEM_COMMAND;
  496. typedef struct
  497. {
  498. BYTE ProtocolType; // 协议类型
  499. BYTE m_BuyIdx; // 买第几个东西
  500. BYTE m_Place; // 放在身上哪个地方
  501. BYTE m_X; // 坐标X
  502. BYTE m_Y; // 坐标Y
  503. } PLAYER_BUY_ITEM_COMMAND;
  504. typedef struct
  505. {
  506. BYTE ProtocolType; // 协议类型
  507. int m_nMoney1; // 装备栏
  508. int m_nMoney2; // 贮物箱
  509. int m_nMoney3; // 交易栏
  510. } PLAYER_MONEY_SYNC; // 服务器通知客户端钱的数量
  511. typedef struct
  512. {
  513. BYTE ProtocolType; // 协议类型
  514. BYTE m_btDownPos;
  515. BYTE m_btDownX;
  516. BYTE m_btDownY;
  517. BYTE m_btUpPos;
  518. BYTE m_btUpX;
  519. BYTE m_btUpY;
  520. } PLAYER_MOVE_ITEM_COMMAND;
  521. typedef struct
  522. {
  523. BYTE ProtocolType; // 协议类型
  524. BYTE m_btDownPos;
  525. BYTE m_btDownX;
  526. BYTE m_btDownY;
  527. BYTE m_btUpPos;
  528. BYTE m_btUpX;
  529. BYTE m_btUpY;
  530. } PLAYER_MOVE_ITEM_SYNC;
  531. // s2c_ItemAutoMove
  532. typedef struct
  533. {
  534. BYTE ProtocolType; // 协议类型
  535. BYTE m_btSrcPos;
  536. BYTE m_btSrcX;
  537. BYTE m_btSrcY;
  538. BYTE m_btDestPos;
  539. BYTE m_btDestX;
  540. BYTE m_btDestY;
  541. } ITEM_AUTO_MOVE_SYNC;
  542. typedef struct
  543. {
  544. BYTE ProtocolType; // 协议类型
  545. } PLAYER_THROW_AWAY_ITEM_COMMAND;
  546. typedef struct
  547. {
  548. BYTE ProtocolType; // 协议类型
  549. short m_shLife;
  550. short m_shStamina;
  551. short m_shMana;
  552. short m_shAngry;
  553. BYTE m_btTeamData;
  554. } CURPLAYER_NORMAL_SYNC;
  555. typedef struct
  556. {
  557. BYTE ProtocolType; // 协议类型
  558. // npc部分
  559. DWORD m_dwID; // Npc的ID
  560. BYTE m_btLevel; // Npc的等级
  561. BYTE m_btSex; // 性别
  562. BYTE m_btKind; // Npc的类型
  563. BYTE m_btSeries; // Npc的五行系
  564. WORD m_wLifeMax; // Npc的最大生命
  565. WORD m_wStaminaMax; // Npc的最大体力
  566. WORD m_wManaMax; // Npc的最大内力
  567. int m_HeadImage;
  568. // player 部分
  569. WORD m_wAttributePoint; // 未分配属性点
  570. WORD m_wSkillPoint; // 未分配技能点
  571. WORD m_wStrength; // 玩家的基本力量(决定基本伤害)
  572. WORD m_wDexterity; // 玩家的基本敏捷(决定命中、体力)
  573. WORD m_wVitality; // 玩家的基本活力(决定生命、体力)
  574. WORD m_wEngergy; // 玩家的基本精力(决定内力)
  575. WORD m_wLucky; // 玩家的基本幸运值
  576. int m_nExp; // 当前经验值(当前等级在npc身上)
  577. DWORD m_dwLeadExp; // 统率力经验值
  578. // 门派
  579. BYTE m_btCurFaction; // 当前门派
  580. BYTE m_btFirstFaction; // 第一次加入的是哪个门派
  581. int m_nFactionAddTimes; // 加入各种门派的总次数
  582. // 排名
  583. WORD m_wWorldStat; // 世界排名
  584. WORD m_wSectStat; // 门派排名
  585. // 钱
  586. int m_nMoney1;
  587. int m_nMoney2;
  588. } CURPLAYER_SYNC;
  589. #define MAX_SCIRPTACTION_BUFFERNUM 300
  590. typedef struct
  591. {
  592. BYTE ProtocolType;
  593. WORD m_wProtocolLong;
  594. BYTE m_nOperateType; //操作类型
  595. BYTE m_bUIId, m_bOptionNum, m_bParam1, m_bParam2;// m_bParam1,主信息是数字标识还是字符串标识, m_bParam2,是否是与服务器交互的选择界面
  596. int m_nParam;
  597. int m_nBufferLen;
  598. char m_pContent[MAX_SCIRPTACTION_BUFFERNUM]; //带控制符
  599. } PLAYER_SCRIPTACTION_SYNC;
  600. typedef struct
  601. {
  602. WORD SkillId;
  603. BYTE SkillLevel;
  604. } SKILL_SEND_ALL_SYNC_DATA;
  605. typedef struct
  606. {
  607. BYTE ProtocolType;
  608. WORD m_wProtocolLong;
  609. SKILL_SEND_ALL_SYNC_DATA m_sAllSkill[80];
  610. } SKILL_SEND_ALL_SYNC;
  611. typedef struct
  612. {
  613. BYTE ProtocolType;
  614. BYTE WeatherID;
  615. } SYNC_WEATHER;
  616. typedef struct defWORLD_SYNC
  617. {
  618. BYTE ProtocolType;
  619. int SubWorld;
  620. int Region;
  621. BYTE Weather;
  622. DWORD Frame;
  623. } WORLD_SYNC;
  624. typedef struct 
  625. {
  626. BYTE ProtocolType;
  627. int nSelectIndex;
  628. }PLAYER_SELECTUI_COMMAND;
  629. typedef struct
  630. {
  631. BYTE ProtocolType; // 协议类型
  632. DWORD m_dwTakeChannel; // 订阅频道
  633. } CHAT_SET_CHANNEL_COMMAND; // 设定订阅频道
  634. typedef struct
  635. {
  636. BYTE ProtocolType; // 协议类型
  637. WORD m_wLength;
  638. DWORD m_dwTargetNpcID; // 目标 npc id
  639. char m_szInfo[MAX_SENTENCE_LENGTH];// 给对方的话
  640. } CHAT_APPLY_ADD_FRIEND_COMMAND; // 聊天添加好友
  641. typedef struct
  642. {
  643. BYTE ProtocolType; // 协议类型
  644. int m_nSrcPlayerIdx; // 来源 player idx
  645. char m_szSourceName[32]; // 来源玩家名字
  646. char m_szInfo[MAX_SENTENCE_LENGTH];// 对方给的话
  647. } CHAT_APPLY_ADD_FRIEND_SYNC; // 聊天添加好友
  648. typedef struct
  649. {
  650. BYTE ProtocolType; // 协议类型
  651. int m_nTargetPlayerIdx; // 被接受player idx
  652. } CHAT_ADD_FRIEND_COMMAND; // 添加某玩家为聊天好友
  653. typedef struct
  654. {
  655. BYTE ProtocolType; // 协议类型
  656. int m_nTargetPlayerIdx; // 被拒绝player idx
  657. } CHAT_REFUSE_FRIEND_COMMAND; // 拒绝添加某玩家为聊天好友
  658. typedef struct
  659. {
  660. BYTE ProtocolType; // 协议类型
  661. DWORD m_dwID; // 新添加好友的 id
  662. int m_nIdx; // 新添加好友在 player 数组中的位置
  663. char m_szName[32]; // 新添加好友的名字
  664. } CHAT_ADD_FRIEND_SYNC; // 通知客户端成功添加一个聊天好友
  665. typedef struct
  666. {
  667. BYTE ProtocolType; // 协议类型
  668. WORD m_wLength;
  669. char m_szName[32]; // 拒绝者名字
  670. } CHAT_REFUSE_FRIEND_SYNC; // 通知客户端添加聊天好友的申请被拒绝
  671. typedef struct
  672. {
  673. BYTE ProtocolType; // 协议类型
  674. int m_nTargetPlayerIdx; // 出错 player idx (一般可能是此player下线或者换服务器了)
  675. } CHAT_ADD_FRIEND_FAIL_SYNC; // 通知客户端添加聊天好友失败
  676. typedef struct
  677. {
  678. BYTE ProtocolType; // c2s_viewequip
  679. DWORD m_dwNpcID;
  680. } VIEW_EQUIP_COMMAND;
  681. //此结构已经被tagDBSelPlayer结构替换
  682. /*typedef struct
  683. {
  684. BYTE ProtocolType; // 协议类型
  685. int m_nSelect; // 
  686. } DB_PLAYERSELECT_COMMAND;*/
  687. /*
  688.  * { Add by liupeng 2003.05.10
  689.  *
  690.  * #pragma pack( push, 1 )
  691. */
  692. /*
  693.  * Nonstandard extension used : zero-sized array in struct/union
  694.  */
  695. #pragma warning(disable: 4200)
  696. #define KSG_PASSWORD_MAX_SIZE   64
  697. typedef struct tagKSG_PASSWORD
  698. {
  699.     char szPassword[KSG_PASSWORD_MAX_SIZE];    // 现在采用MD5的字符串,由于是32个字符,加上末尾'',需要至少33个空间,因此使用64
  700. } KSG_PASSWORD;
  701. #define _NAME_LEN 32
  702. struct tagProtoHeader
  703. {
  704. BYTE cProtocol;
  705. };
  706. struct tagResult : public tagProtoHeader
  707. {
  708. BYTE cResult;
  709. };
  710. struct tagDBSelPlayer : public tagProtoHeader
  711. {
  712. char szRoleName[_NAME_LEN];
  713. };
  714. struct tagDBDelPlayer : public tagProtoHeader
  715. {
  716. char         szAccountName[_NAME_LEN];
  717.     KSG_PASSWORD    Password;
  718. char         szRoleName[_NAME_LEN];
  719. };
  720. //删除与新建角色的返回消息带的数据
  721. struct tagNewDelRoleResponse : public tagDBSelPlayer
  722. {
  723. bool bSucceeded; //是否成功
  724. };
  725. // 2003.05.11
  726. struct tagDBSyncPlayerInfo : public tagProtoHeader
  727. {
  728. size_t dataLength;
  729. char szData[0];
  730. };
  731. /*
  732.  * 2003.06.27
  733.  * s2c_gateway_broadcast
  734. */
  735. #define AP_WARNING_ALL_PLAYER_QUIT 1
  736. #define AP_NOTIFY_GAMESERVER_SAFECLOSE 2
  737. #define AP_NOTIFY_ALL_PLAYER 3
  738. #define MAX_GATEWAYBROADCAST_LEN 260
  739. struct tagGatewayBroadCast : public tagProtoHeader
  740. {
  741. UINT uCmdType;
  742. char szData[MAX_GATEWAYBROADCAST_LEN];
  743. };
  744. /*
  745.  * 2003.05.22
  746.  * s2c_syncgamesvr_roleinfo_cipher
  747. */
  748. struct tagGuidableInfo : public tagProtoHeader
  749. {
  750. GUID guid;
  751. WORD nExtPoint; //可用的附送点
  752. WORD nChangePoint; //变化的附送点
  753. size_t datalength;
  754. char szData[0];
  755. };
  756. /*
  757.  * c2s_permitplayerlogin
  758.  */
  759. struct tagPermitPlayerLogin : public tagProtoHeader
  760. {
  761. GUID guid;
  762. BYTE szRoleName[_NAME_LEN];
  763. /*
  764.  * Succeeded : true
  765.  * Failed  : false
  766.  */
  767. bool bPermit;
  768. };
  769. struct tagPermitPlayerExchange
  770. {
  771. BYTE cProtocol;
  772. GUID guid;
  773. DWORD dwIp;
  774. WORD wPort;
  775. bool bPermit;
  776. };
  777. /*
  778.  * c2s_notifyplayerlogin
  779.  */
  780. struct tagNotifyPlayerLogin : public tagPermitPlayerLogin
  781. {
  782. UINT nIPAddr;
  783. unsigned short nPort;
  784. };
  785. /*
  786.  * s2c_querymapinfo
  787.  */
  788. struct tagQueryMapInfo : public tagProtoHeader
  789. {
  790. };
  791. /*
  792.  * s2c_querygameserverinfo
  793.  */
  794. struct tagQueryGameSvrInfo : public tagProtoHeader
  795. {
  796. };
  797. /*
  798.  * s2c_notifysvrip
  799.  */
  800. struct tagNotifySvrIp : public tagProtoHeader
  801. {
  802. WORD pckgID;
  803. BYTE cIPType;
  804. DWORD dwMapID;
  805. DWORD dwSvrIP;
  806. };
  807. /*
  808.  * s2c_notifyplayerexchange
  809.  */
  810. struct tagNotifyPlayerExchange : public tagProtoHeader
  811. {
  812. GUID guid;
  813. UINT nIPAddr;
  814. unsigned short nPort;
  815. };
  816. /*
  817.  * c2s_requestsvrip
  818.  */
  819. /*
  820.  * BYTE cIPType
  821.  */
  822. #define INTRANER_IP 0
  823. #define INTERNET_IP 1
  824. struct tagRequestSvrIp : public tagProtoHeader
  825. {
  826. WORD pckgID;
  827. BYTE cIPType;
  828. DWORD dwMapID;
  829. };
  830. /*
  831.  * c2c_notifyexchange
  832.  */
  833. struct tagSearchWay : public tagProtoHeader
  834. {
  835. int lnID;
  836. int nIndex;
  837. DWORD dwPlayerID;
  838. };
  839. /*
  840.  * c2s_updatemapinfo
  841.  */
  842. struct tagUpdateMapID : public tagProtoHeader
  843. {
  844. /*
  845.  * For example : Are your clear older information when it 
  846.  * update local informatin
  847.  */
  848. BYTE cReserve;
  849. BYTE cMapCount;
  850. BYTE szMapID[0]; // C4200 warning
  851. };
  852. /*
  853.  * c2s_updategameserverinfo
  854.  */
  855. struct tagGameSvrInfo : public tagProtoHeader
  856. {
  857. UINT nIPAddr_Intraner;
  858. UINT nIPAddr_Internet;
  859. unsigned short nPort;
  860. WORD wCapability;
  861. };
  862. /*
  863.  * s2c_identitymapping
  864.  */
  865. struct tagIdentityMapping : public tagGameSvrInfo
  866. {
  867. GUID guid;
  868. };
  869. /*
  870.  * c2s_logiclogin
  871.  * s2c_gmgateway2relaysvr
  872.  * s2c_gmnotify
  873.  */
  874. struct tagLogicLogin : public tagProtoHeader
  875. {
  876. GUID guid;
  877. };
  878. /*
  879.  * s2c_logiclogout
  880.  */
  881. struct tagLogicLogout : public tagProtoHeader
  882. {
  883. BYTE szRoleName[_NAME_LEN];
  884. };
  885. /*
  886.  * c2s_registeraccount
  887.  */
  888. struct tagRegisterAccount : public tagProtoHeader
  889. {
  890. BYTE szAccountName[_NAME_LEN];
  891. };
  892. /*
  893.  * c2s_entergame
  894.  */
  895. struct tagEnterGame : public tagProtoHeader
  896. {
  897. /*
  898.  * Succeeded : content is account name
  899.  * Failed  : content is null
  900.  */
  901. BYTE szAccountName[_NAME_LEN];
  902. };
  903. struct tagEnterGame2 : public EXTEND_HEADER
  904. {
  905. char szAccountName[_NAME_LEN];
  906. char szCharacterName[_NAME_LEN];
  907. DWORD dwNameID;
  908. unsigned long lnID;
  909. };
  910. /*
  911.  * c2s_leavegame
  912.  */
  913. /*
  914.  * BYTE cCmdType
  915.  */
  916. #define NORMAL_LEAVEGAME 0x0 // lock account
  917. #define HOLDACC_LEAVEGAME 0x1A // clear resource but don't to unlock account 
  918. struct tagLeaveGame : public tagProtoHeader
  919. {
  920. BYTE cCmdType;
  921. WORD nExtPoint;        //将要扣除的附送点
  922. /*
  923.  * Succeeded : content is account name
  924.  * Failed  : content is null
  925.  */
  926. char szAccountName[_NAME_LEN];
  927. };
  928. struct tagLeaveGame2 : public EXTEND_HEADER
  929. {
  930. BYTE cCmdType;
  931. char szAccountName[_NAME_LEN];
  932. };
  933. /*
  934. *  c2s_registerfamily
  935. */
  936. struct tagRegisterFamily : public tagProtoHeader
  937. {
  938. BYTE bRegister; //1 is Register, 0 is unRegister
  939. BYTE nFamily;
  940. BYTE RelayMethod;
  941. };
  942. /*
  943.  * c2s_gmsvr2gateway_saverole
  944.  */
  945. struct tagGS2GWSaveRole : public tagProtoHeader
  946. {
  947. size_t datalength;
  948. BYTE szData[0];
  949. };
  950. /*
  951.  * #pragma pack( pop )
  952.  *
  953.  * } End of the struct define
  954.  */
  955. typedef struct
  956. {
  957. char szName[32];
  958. BYTE Sex;
  959. BYTE Series;
  960. // BYTE HelmType;
  961. // BYTE ArmorType;
  962. // BYTE WeaponType;
  963. BYTE Level;
  964. } RoleBaseInfo/* client */, S3DBI_RoleBaseInfo /* server */;
  965. typedef struct
  966. {
  967. BYTE ProtocolType;
  968. RoleBaseInfo m_RoleList[MAX_PLAYER_IN_ACCOUNT];
  969. } ROLE_LIST_SYNC;
  970. //移自RoleDBManager/kroledbheader.h
  971. //用来替换上面的ROLE_LIST_SYNC,ROLE_LIST_SYNC结构不再需要了
  972. struct TProcessData
  973. {
  974. unsigned char nProtoId;
  975. size_t nDataLen;//TRoleNetMsg时表示该Block的实际数据长度,TProcessData时表示Stream的实际数据长度
  976. unsigned long ulIdentity;
  977. bool bLeave;
  978. char pDataBuffer[1];//实际的数据
  979. };
  980. struct tagRoleEnterGame
  981. {
  982. BYTE ProtocolType;
  983. bool bLock;
  984. char Name[_NAME_LEN];
  985. };
  986. //新建角色的信息结构
  987. //注释:新建决消息c2s_newplayer,传送的参数为TProcessData结构描述的数据,其中TProcessData::pDataBuffer要扩展为NEW_PLAYER_COMMAND
  988. struct NEW_PLAYER_COMMAND
  989. {
  990. BYTE m_btRoleNo; // 角色编号
  991. BYTE m_btSeries; // 五行系
  992. unsigned short m_NativePlaceId; //出生地ID
  993. char m_szName[32]; // 姓名
  994. };
  995. typedef struct
  996. {
  997. BYTE ProtocolType; // 协议类型
  998. DWORD m_dwID; // 好友 id
  999. int m_nPlayerIdx; // 好友 player index
  1000. } CHAT_LOGIN_FRIEND_NONAME_SYNC; // 玩家登录时发送玩家聊天好友数据(不带名字)
  1001. typedef struct
  1002. {
  1003. BYTE ProtocolType; // 协议类型
  1004. WORD m_wLength;
  1005. DWORD m_dwID; // 好友 id
  1006. int m_nPlayerIdx; // 好友 player index
  1007. char m_szName[32]; // 好友名字
  1008. } CHAT_LOGIN_FRIEND_NAME_SYNC; // 玩家登录时发送玩家聊天好友数据(带名字)
  1009. typedef struct
  1010. {
  1011. BYTE ProtocolType; // 协议类型
  1012. } CHAT_APPLY_RESEND_ALL_FRIEND_NAME_COMMAND;
  1013. typedef struct
  1014. {
  1015. BYTE ProtocolType; // 协议类型
  1016. DWORD m_dwID; // 好友 id
  1017. } CHAT_APPLY_SEND_ONE_FRIEND_NAME_COMMAND; // 申请得到玩家某个聊天好友的完整数据
  1018. typedef struct
  1019. {
  1020. BYTE ProtocolType; // 协议类型
  1021. DWORD m_dwID; // 好友 id
  1022. int m_nPlayerIdx; // 好友 player index
  1023. char m_szName[32]; // 好友名字
  1024. } CHAT_ONE_FRIEND_DATA_SYNC; // 发送玩家某一个聊天好友数据(带名字)
  1025. typedef struct
  1026. {
  1027. BYTE ProtocolType; // 协议类型
  1028. DWORD m_dwID; // 好友 id
  1029. int m_nPlayerIdx; // 好友 player index
  1030. } CHAT_FRIEND_ONLINE_SYNC; // 通知客户端有好友上线
  1031. typedef struct
  1032. {
  1033. BYTE ProtocolType; // 协议类型
  1034. DWORD m_dwID; // 被删除id
  1035. } CHAT_DELETE_FRIEND_COMMAND; // 删除某个聊天好友
  1036. typedef struct
  1037. {
  1038. BYTE ProtocolType; // 协议类型
  1039. DWORD m_dwID; // 删除id
  1040. } CHAT_DELETE_FRIEND_SYNC; // 被某个聊天好友删除
  1041. typedef struct
  1042. {
  1043. BYTE ProtocolType; // 协议类型
  1044. DWORD m_dwID; // 被删除id
  1045. } CHAT_REDELETE_FRIEND_COMMAND; // 删除某个聊天好友
  1046. typedef struct 
  1047. {
  1048. BYTE ProtocolType;
  1049. BYTE m_LogoutType;
  1050. } LOGOUT_COMMAND;
  1051. typedef struct
  1052. {
  1053. BYTE ProtocolType;
  1054. BYTE szAccName[32];
  1055. } LOGIN_COMMAND;
  1056. typedef struct
  1057. {
  1058. BYTE ProtocolType; // 协议类型
  1059. DWORD m_dwID; // 好友 id
  1060. } CHAT_FRIEND_OFFLINE_SYNC; // 通知客户端有好友下线
  1061. typedef struct
  1062. {
  1063. BYTE ProtocolType; // 协议类型
  1064. WORD m_wLength;
  1065. char m_szSentence[MAX_SENTENCE_LENGTH];
  1066. } TRADE_APPLY_OPEN_COMMAND;
  1067. typedef struct
  1068. {
  1069. BYTE ProtocolType; // 协议类型
  1070. } TRADE_APPLY_CLOSE_COMMAND;
  1071. typedef struct
  1072. {
  1073. BYTE ProtocolType; // 协议类型
  1074. BYTE m_btState; // if == 0 close if == 1 open if == 2 trading
  1075. DWORD m_dwNpcID; // 如果是开始交易,对方的 npc id
  1076. } TRADE_CHANGE_STATE_SYNC;
  1077. typedef struct
  1078. {
  1079. BYTE ProtocolType; // 协议类型
  1080. WORD m_wLength;
  1081. DWORD m_dwID;
  1082. BYTE m_btState;
  1083. char m_szSentence[MAX_SENTENCE_LENGTH];
  1084. } NPC_SET_MENU_STATE_SYNC;
  1085. typedef struct
  1086. {
  1087. BYTE ProtocolType; // 协议类型
  1088. DWORD m_dwID;
  1089. } TRADE_APPLY_START_COMMAND;
  1090. // 服务器转发交易申请
  1091. typedef struct
  1092. {
  1093. BYTE ProtocolType; // 协议类型
  1094. int m_nDestIdx; // 申请者在服务器端的player idx
  1095. DWORD m_dwNpcId; // 申请者的 npc id
  1096. } TRADE_APPLY_START_SYNC;
  1097. // 接受或拒绝别人的交易申请
  1098. typedef struct
  1099. {
  1100. BYTE ProtocolType; // 协议类型
  1101. BYTE m_bDecision; // 同意 1 不同意 0
  1102. int m_nDestIdx; // 交易对方在服务器端的player idx
  1103. } TRADE_REPLY_START_COMMAND;
  1104. typedef struct
  1105. {
  1106. BYTE ProtocolType; // 协议类型
  1107. int m_nMoney;
  1108. } TRADE_MOVE_MONEY_COMMAND; // c2s_trademovemoney
  1109. typedef struct
  1110. {
  1111. BYTE ProtocolType; // 协议类型
  1112. int m_nMoney;
  1113. } TRADE_MONEY_SYNC; // s2c_trademoneysync
  1114. typedef struct
  1115. {
  1116. BYTE ProtocolType; // 协议类型
  1117. BYTE m_btDecision; // 确定交易 1  退出交易 0  取消确定 4  锁定交易 2  取消锁定 3
  1118. } TRADE_DECISION_COMMAND; // 交易执行或取消 c2s_tradedecision
  1119. typedef struct
  1120. {
  1121. BYTE ProtocolType; // 协议类型
  1122. BYTE m_btDecision; // 交易ok 1  交易取消 0  锁定 2  取消锁定 3
  1123. } TRADE_DECISION_SYNC; // s2c_tradedecision
  1124. typedef struct
  1125. {
  1126. BYTE ProtocolType;
  1127. BYTE m_byDir; // 取钱的方向(0存,1取)
  1128. DWORD m_dwMoney; // 钱数
  1129. } STORE_MONEY_COMMAND;
  1130. typedef struct
  1131. {
  1132. BYTE ProtocolType; // 协议类型
  1133. WORD m_wLength; // 长度
  1134. BYTE m_btError; // 错误类型 0 对方关闭了此频道,1 找不到对方
  1135. char m_szName[32]; // 对方名字
  1136. } CHAT_SCREENSINGLE_ERROR_SYNC;
  1137. typedef struct 
  1138. {
  1139. BYTE ProtocolType; // 协议类型
  1140. BYTE m_btStateInfo[MAX_NPC_RECORDER_STATE];
  1141. DWORD m_ID; // Npc的GID
  1142. } NPC_SYNC_STATEINFO;
  1143. typedef struct
  1144. {
  1145. BYTE ProtocolType; // 协议类型
  1146. DWORD m_dwNpcID;
  1147. } TEAM_INVITE_ADD_COMMAND;
  1148. typedef struct
  1149. {
  1150. BYTE ProtocolType; // 协议类型
  1151. WORD m_wLength; // 长度
  1152. int m_nIdx;
  1153. char m_szName[32];
  1154. } TEAM_INVITE_ADD_SYNC;
  1155. typedef struct
  1156. {
  1157. BYTE ProtocolType; //
  1158. int m_nAuraSkill;
  1159. } SKILL_CHANGEAURASKILL_COMMAND; //更换光环技能
  1160. typedef struct
  1161. {
  1162. BYTE ProtocolType;
  1163. BYTE m_btResult;
  1164. int m_nIndex;
  1165. } TEAM_REPLY_INVITE_COMMAND;
  1166. typedef struct
  1167. {
  1168. BYTE ProtocolType;
  1169. BYTE m_btSelfLock;
  1170. BYTE m_btDestLock;
  1171. BYTE m_btSelfOk;
  1172. BYTE m_btDestOk;
  1173. } TRADE_STATE_SYNC;
  1174. typedef struct
  1175. {
  1176. BYTE ProtocolType;
  1177. WORD m_wLength;
  1178. DWORD m_dwSkillID; // 技能
  1179. int m_nLevel;
  1180. int m_nTime; // 时间
  1181. KMagicAttrib m_MagicAttrib[MAX_SKILL_STATE];
  1182. } STATE_EFFECT_SYNC;
  1183. typedef struct
  1184. {
  1185. BYTE ProtocolType;
  1186. DWORD m_dwTime;
  1187. } PING_COMMAND;
  1188. typedef struct
  1189. {
  1190. BYTE ProtocolType;
  1191. DWORD m_dwReplyServerTime;
  1192. DWORD m_dwClientTime;
  1193. } PING_CLIENTREPLY_COMMAND;
  1194. typedef struct
  1195. {
  1196. BYTE ProtocolType;
  1197. BYTE m_btSitFlag;
  1198. } NPC_SIT_COMMAND;
  1199. typedef struct
  1200. {
  1201. BYTE ProtocolType;
  1202. int nMpsX;
  1203. int nMpsY;
  1204. } NPC_JUMP_COMMAND;
  1205. typedef struct
  1206. {
  1207. BYTE ProtocolType;
  1208. int m_dwRegionID;
  1209. int m_nObjID;
  1210. } OBJ_MOUSE_CLICK_SYNC;
  1211. typedef struct tagSHOW_MSG_SYNC
  1212. {
  1213. BYTE ProtocolType;
  1214. WORD m_wLength;
  1215. WORD m_wMsgID;
  1216. LPVOID m_lpBuf;
  1217. tagSHOW_MSG_SYNC() {m_lpBuf = NULL;};
  1218. ~tagSHOW_MSG_SYNC() {Release();}
  1219. void Release() {if (m_lpBuf) delete []m_lpBuf; m_lpBuf = NULL;}
  1220. } SHOW_MSG_SYNC;
  1221. typedef struct
  1222. {
  1223. BYTE ProtocolType;
  1224. BYTE m_btFlag;
  1225. } PK_APPLY_NORMAL_FLAG_COMMAND;
  1226. typedef struct
  1227. {
  1228. BYTE ProtocolType;
  1229. BYTE m_btFlag;
  1230. } PK_NORMAL_FLAG_SYNC;
  1231. typedef struct
  1232. {
  1233. BYTE ProtocolType;
  1234. DWORD m_dwNpcID;
  1235. } PK_APPLY_ENMITY_COMMAND;
  1236. typedef struct
  1237. {
  1238. BYTE ProtocolType;
  1239. WORD m_wLength;
  1240. BYTE m_btState;
  1241. DWORD m_dwNpcID;
  1242. char m_szName[32];
  1243. } PK_ENMITY_STATE_SYNC;
  1244. typedef struct
  1245. {
  1246. BYTE ProtocolType;
  1247. WORD m_wLength;
  1248. BYTE m_btState;
  1249. DWORD m_dwNpcID;
  1250. char m_szName[32];
  1251. } PK_EXERCISE_STATE_SYNC;
  1252. typedef struct
  1253. {
  1254. BYTE ProtocolType;
  1255. int m_nPKValue;
  1256. } PK_VALUE_SYNC;
  1257. typedef struct
  1258. {
  1259. int m_nID; // 物品的ID
  1260. BYTE m_btGenre; // 物品的类型
  1261. BYTE m_btDetail; // 物品的类别
  1262. BYTE m_btParticur; // 物品的详细类别
  1263. BYTE m_btSeries; // 物品的五行
  1264. BYTE m_btLevel; // 物品的等级
  1265. BYTE m_btLuck; // MF
  1266. BYTE m_btMagicLevel[6]; // 生成参数
  1267. WORD m_wVersion; // 装备版本
  1268. DWORD m_dwRandomSeed; // 随机种子
  1269. } SViewItemInfo;
  1270. typedef struct
  1271. {
  1272. BYTE ProtocolType;
  1273. DWORD m_dwNpcID;
  1274. SViewItemInfo m_sInfo[itempart_num];
  1275. } VIEW_EQUIP_SYNC; // s2c_viewequip
  1276. typedef struct//该结构是所统计的玩家的基本数据
  1277. {
  1278. char Name[20];
  1279. int nValue;
  1280. BYTE bySort;
  1281. }TRoleList;
  1282. // 游戏统计结构
  1283. typedef struct
  1284. {
  1285. TRoleList MoneyStat[10]; //金钱最多排名列表(十个玩家,最多可达到100个)
  1286. TRoleList LevelStat[10]; //级别最多排名列表(十个玩家,最多可达到100个)
  1287. TRoleList KillerStat[10]; //杀人最多排名列表
  1288. //[门派号][玩家数],其中[0]是没有加入门派的玩家
  1289. TRoleList MoneyStatBySect[11][10]; //各门派金钱最多排名列表
  1290. TRoleList LevelStatBySect[11][10]; //各门派级别最多排名列表
  1291. //[门派号],其中[0]是没有加入门派的玩家
  1292. int SectPlayerNum[11]; //各个门派的玩家数
  1293. int SectMoneyMost[11]; //财富排名前一百玩家中各门派所占比例数
  1294. int SectLevelMost[11]; //级别排名前一百玩家中各门派所占比例数
  1295. }  TGAME_STAT_DATA;
  1296. typedef struct
  1297. {
  1298. BYTE ProtocolType;
  1299. BYTE bSleep;
  1300. DWORD NpcID;
  1301. } NPC_SLEEP_SYNC;
  1302. //////////////
  1303. //排名相关
  1304. typedef struct
  1305. {
  1306. BYTE ProtocolType;
  1307. DWORD dwLadderID;
  1308. TRoleList StatData[10];
  1309. } LADDER_DATA;
  1310. typedef struct
  1311. {
  1312. BYTE ProtocolType;
  1313. WORD wSize;
  1314. int nCount;
  1315. DWORD dwLadderID[0];
  1316. } LADDER_LIST;
  1317. typedef struct
  1318. {
  1319. BYTE ProtocolType;
  1320. DWORD dwLadderID;
  1321. } LADDER_QUERY;
  1322. ///////////////////
  1323. //chat 相关
  1324. typedef struct
  1325. {
  1326. BYTE ProtocolType;
  1327. WORD wSize;
  1328. DWORD packageID;
  1329. char someone[_NAME_LEN];
  1330. BYTE sentlen;
  1331. } CHAT_SOMEONECHAT_CMD, CHAT_SOMEONECHAT_SYNC;
  1332. typedef struct
  1333. {
  1334. BYTE ProtocolType;
  1335. WORD wSize;
  1336. DWORD packageID;
  1337. BYTE filter;
  1338. DWORD channelid;
  1339. BYTE cost; //0: 无限制,1: 10元/句,2: <10Lv ? 不能说 : MaxMana/2/句, 3: MaxMana/10/句,4: <20Lv ? 不能说 : MaxMana*4/5/句
  1340. BYTE sentlen;
  1341. } CHAT_CHANNELCHAT_CMD;
  1342. typedef struct
  1343. {
  1344. BYTE ProtocolType;
  1345. WORD wSize;
  1346. DWORD packageID;
  1347. char someone[_NAME_LEN];
  1348. DWORD channelid;
  1349. BYTE sentlen;
  1350. } CHAT_CHANNELCHAT_SYNC;
  1351. enum {codeSucc, codeFail, codeStore};
  1352. typedef struct
  1353. {
  1354. BYTE ProtocolType;
  1355. DWORD packageID;
  1356. BYTE code;
  1357. } CHAT_FEEDBACK;
  1358. typedef struct
  1359. {
  1360. BYTE ProtocolType;
  1361. WORD wSize;
  1362. WORD wChatLength;
  1363. } CHAT_EVERYONE;
  1364. typedef struct
  1365. {
  1366. BYTE ProtocolType;
  1367. WORD wSize;
  1368. WORD wChatLength;
  1369. BYTE byHasIdentify;
  1370. WORD wPlayerCount;
  1371. } CHAT_GROUPMAN;
  1372. typedef struct
  1373. {
  1374. BYTE ProtocolType;
  1375. WORD wSize;
  1376. DWORD nameid;
  1377. unsigned long lnID;
  1378. WORD wChatLength;
  1379. } CHAT_SPECMAN;
  1380. enum { tgtcls_team, tgtcls_fac, tgtcls_tong, tgtcls_scrn, tgtcls_bc};
  1381. typedef struct
  1382. {
  1383. BYTE ProtocolType;
  1384. WORD wSize;
  1385. DWORD nFromIP;
  1386. DWORD nFromRelayID;
  1387. DWORD channelid;
  1388. BYTE TargetCls;
  1389. DWORD TargetID;
  1390. WORD routeDateLength;
  1391. } CHAT_RELEGATE;
  1392. ///////////////////////////////////////
  1393. // tong 相关
  1394. typedef struct
  1395. {
  1396. BYTE ProtocolType;
  1397. WORD m_wLength;
  1398. BYTE m_btMsgId;
  1399. } S2C_TONG_HEAD;
  1400. typedef struct
  1401. {
  1402. BYTE ProtocolType;
  1403. WORD m_wLength;
  1404. BYTE m_btMsgId;
  1405. } STONG_PROTOCOL_HEAD;
  1406. typedef struct
  1407. {
  1408. int m_nPlayerIdx;
  1409. int m_nCamp;
  1410. char m_szTongName[defTONG_NAME_MAX_LENGTH + 1];
  1411. } STONG_SERVER_TO_CORE_APPLY_CREATE;
  1412. typedef struct
  1413. {
  1414. int m_nPlayerIdx;
  1415. DWORD m_dwNpcID;
  1416. } STONG_SERVER_TO_CORE_APPLY_ADD;
  1417. typedef struct
  1418. {
  1419. int m_nSelfIdx;
  1420. int m_nTargetIdx;
  1421. DWORD m_dwNameID;
  1422. } STONG_SERVER_TO_CORE_CHECK_ADD_CONDITION;
  1423. typedef struct
  1424. {
  1425. int m_nCamp;
  1426. int m_nPlayerIdx;
  1427. DWORD m_dwPlayerNameID;
  1428. char m_szTongName[64];
  1429. } STONG_SERVER_TO_CORE_CREATE_SUCCESS;
  1430. typedef struct
  1431. {
  1432. int m_nSelfIdx;
  1433. int m_nTargetIdx;
  1434. DWORD m_dwNameID;
  1435. } STONG_SERVER_TO_CORE_REFUSE_ADD;
  1436. typedef struct
  1437. {
  1438. int m_nSelfIdx;
  1439. int m_nInfoID;
  1440. int m_nParam1;
  1441. int m_nParam2;
  1442. int m_nParam3;
  1443. char m_szName[32];
  1444. } STONG_SERVER_TO_CORE_GET_INFO;
  1445. typedef struct
  1446. {
  1447. int m_nCamp;
  1448. int m_nPlayerIdx;
  1449. DWORD m_dwPlayerNameID;
  1450. char m_szTongName[32];
  1451. char m_szMasterName[32];
  1452. char m_szTitleName[32];
  1453. } STONG_SERVER_TO_CORE_ADD_SUCCESS;
  1454. typedef struct
  1455. {
  1456. int m_nPlayerIdx;
  1457. BYTE m_btFigure;
  1458. BYTE m_btPos;
  1459. char m_szTitle[32];
  1460. char m_szName[32];
  1461. } STONG_SERVER_TO_CORE_BE_INSTATED;
  1462. typedef struct
  1463. {
  1464. int m_nPlayerIdx;
  1465. BYTE m_btFigure;
  1466. BYTE m_btPos;
  1467. char m_szName[32];
  1468. } STONG_SERVER_TO_CORE_BE_KICKED;
  1469. typedef struct
  1470. {
  1471. int m_nPlayerIdx;
  1472. BOOL m_bSuccessFlag;
  1473. char m_szName[32];
  1474. } STONG_SERVER_TO_CORE_LEAVE;
  1475. typedef struct
  1476. {
  1477. int m_nPlayerIdx;
  1478. BYTE m_btFigure;
  1479. BYTE m_btPos;
  1480. DWORD m_dwTongNameID;
  1481. char m_szName[32];
  1482. } STONG_SERVER_TO_CORE_CHECK_GET_MASTER_POWER;
  1483. typedef struct
  1484. {
  1485. int m_nPlayerIdx;
  1486. BYTE m_btFigure;
  1487. BYTE m_btPos;
  1488. DWORD m_dwTongNameID;
  1489. char m_szTitle[32];
  1490. char m_szName[32];
  1491. } STONG_SERVER_TO_CORE_CHANGE_AS;
  1492. typedef struct
  1493. {
  1494. DWORD m_dwTongNameID;
  1495. char m_szName[32];
  1496. } STONG_SERVER_TO_CORE_CHANGE_MASTER;
  1497. typedef struct
  1498. {
  1499. DWORD m_dwParam;
  1500. int m_nFlag;
  1501. int m_nCamp;
  1502. int m_nFigure;
  1503. int m_nPos;
  1504. char m_szTongName[32];
  1505. char m_szTitle[32];
  1506. char m_szMaster[32];
  1507. char m_szName[32];
  1508. } STONG_SERVER_TO_CORE_LOGIN;
  1509. // 玩家申请建立帮会 用扩展协议
  1510. typedef struct
  1511. {
  1512. BYTE ProtocolType;
  1513. WORD m_wLength;
  1514. BYTE m_btMsgId;
  1515. BYTE m_btCamp;
  1516. char m_szName[defTONG_NAME_MAX_LENGTH + 1];
  1517. } TONG_APPLY_CREATE_COMMAND;
  1518. // 玩家申请加入帮会 用扩展协议
  1519. typedef struct
  1520. {
  1521. BYTE ProtocolType;
  1522. WORD m_wLength;
  1523. BYTE m_btMsgId;
  1524. DWORD m_dwNpcID;
  1525. } TONG_APPLY_ADD_COMMAND;
  1526. // 玩家申请加入帮会 用扩展协议
  1527. typedef struct
  1528. {
  1529. BYTE ProtocolType;
  1530. WORD m_wLength;
  1531. BYTE m_btMsgId;
  1532. DWORD m_dwTongNameID;
  1533. BYTE m_btCurFigure;
  1534. BYTE m_btCurPos;
  1535. BYTE m_btNewFigure;
  1536. BYTE m_btNewPos;
  1537. char m_szName[32];
  1538. } TONG_APPLY_INSTATE_COMMAND;
  1539. // 帮会建立失败 扩展协议
  1540. typedef struct
  1541. {
  1542. BYTE ProtocolType;
  1543. WORD m_wLength;
  1544. BYTE m_btMsgId;
  1545. BYTE m_btFailId;
  1546. } TONG_CREATE_FAIL_SYNC;
  1547. // 转发加入帮会申请 扩展协议
  1548. typedef struct
  1549. {
  1550. BYTE ProtocolType;
  1551. WORD m_wLength;
  1552. BYTE m_btMsgId;
  1553. int m_nPlayerIdx;
  1554. char m_szName[32];
  1555. } TONG_APPLY_ADD_SYNC;
  1556. // 通知玩家建立帮会成功 用普通协议
  1557. typedef struct
  1558. {
  1559. BYTE ProtocolType;
  1560. BYTE m_btCamp;
  1561. char m_szName[defTONG_NAME_MAX_LENGTH + 1];
  1562. } TONG_CREATE_SYNC;
  1563. // 通知玩家加入帮会 用扩展协议
  1564. typedef struct
  1565. {
  1566. BYTE ProtocolType;
  1567. WORD m_wLength;
  1568. BYTE m_btMsgId;
  1569. BYTE m_btCamp;
  1570. char m_szTongName[32];
  1571. char m_szTitle[32];
  1572. char m_szMaster[32];
  1573. } TONG_Add_SYNC;
  1574. // 玩家申请解散帮会 用扩展协议
  1575. typedef struct
  1576. {
  1577. BYTE ProtocolType;
  1578. WORD m_wLength;
  1579. BYTE m_btMsgId;
  1580. } TONG_APPLY_DISMISS_COMMAND;
  1581. // 玩家帮会被解散 用普通协议
  1582. typedef struct
  1583. {
  1584. BYTE ProtocolType;
  1585. } TONG_DISMISS_SYNC;
  1586. typedef struct
  1587. {
  1588. BYTE ProtocolType;
  1589. WORD m_wLength;
  1590. BYTE m_btMsgId;
  1591. int m_nPlayerIdx;
  1592. DWORD m_dwNameID;
  1593. BYTE m_btFlag; // 是否接受 TRUE 接受 FALSE 不接受
  1594. } TONG_ACCEPT_MEMBER_COMMAND;
  1595. typedef struct
  1596. {
  1597. BYTE ProtocolType;
  1598. WORD m_wLength;
  1599. BYTE m_btMsgId;
  1600. BYTE m_btInfoID;
  1601. int m_nParam1;
  1602. int m_nParam2;
  1603. int m_nParam3;
  1604. char m_szBuf[64];
  1605. } TONG_APPLY_INFO_COMMAND;
  1606. typedef struct
  1607. {
  1608. BYTE m_btFigure;
  1609. BYTE m_btPos;
  1610. char m_szTitle[32];
  1611. char m_szName[32];
  1612. } TONG_ONE_LEADER_INFO;
  1613. typedef struct
  1614. {
  1615. char m_szName[32];
  1616. } TONG_ONE_MEMBER_INFO;
  1617. typedef struct
  1618. {
  1619. BYTE ProtocolType;
  1620. WORD m_wLength;
  1621. BYTE m_btMsgId;
  1622. DWORD m_dwNpcID;
  1623. DWORD m_dwMoney;
  1624. int m_nCredit;
  1625. BYTE m_btCamp;
  1626. BYTE m_btLevel;
  1627. BYTE m_btDirectorNum;
  1628. BYTE m_btManagerNum;
  1629. DWORD m_dwMemberNum;
  1630. char m_szTongName[32];
  1631. TONG_ONE_LEADER_INFO m_sMember[1 + defTONG_MAX_DIRECTOR];
  1632. } TONG_HEAD_INFO_SYNC;
  1633. typedef struct
  1634. {
  1635. BYTE ProtocolType;
  1636. WORD m_wLength;
  1637. BYTE m_btMsgId;
  1638. DWORD m_dwMoney;
  1639. int m_nCredit;
  1640. BYTE m_btCamp;
  1641. BYTE m_btLevel;
  1642. BYTE m_btDirectorNum;
  1643. BYTE m_btManagerNum;
  1644. DWORD m_dwMemberNum;
  1645. BYTE m_btStateNo;
  1646. BYTE m_btCurNum;
  1647. char m_szTongName[32];
  1648. TONG_ONE_LEADER_INFO m_sMember[defTONG_ONE_PAGE_MAX_NUM];
  1649. } TONG_MANAGER_INFO_SYNC;
  1650. typedef struct
  1651. {
  1652. BYTE ProtocolType;
  1653. WORD m_wLength;
  1654. BYTE m_btMsgId;
  1655. DWORD m_dwMoney;
  1656. int m_nCredit;
  1657. BYTE m_btCamp;
  1658. BYTE m_btLevel;
  1659. BYTE m_btDirectorNum;
  1660. BYTE m_btManagerNum;
  1661. DWORD m_dwMemberNum;
  1662. BYTE m_btStateNo;
  1663. BYTE m_btCurNum;
  1664. char m_szTitle[32];
  1665. char m_szTongName[32];
  1666. TONG_ONE_MEMBER_INFO m_sMember[defTONG_ONE_PAGE_MAX_NUM];
  1667. } TONG_MEMBER_INFO_SYNC;
  1668. // 玩家自身在帮会中的信息 用扩展协议
  1669. typedef struct
  1670. {
  1671. BYTE ProtocolType;
  1672. WORD m_wLength;
  1673. BYTE m_btMsgId;
  1674. BYTE m_btJoinFlag;
  1675. BYTE m_btFigure;
  1676. BYTE m_btCamp;
  1677. char m_szTongName[32];
  1678. char m_szTitle[32];
  1679. char m_szMaster[32];
  1680. } TONG_SELF_INFO_SYNC;
  1681. typedef struct
  1682. {
  1683. BYTE ProtocolType;
  1684. WORD m_wLength;
  1685. BYTE m_btMsgId;
  1686. DWORD m_dwTongNameID;
  1687. BYTE m_btSuccessFlag;
  1688. BYTE m_btOldFigure;
  1689. BYTE m_btOldPos;
  1690. BYTE m_btNewFigure;
  1691. BYTE m_btNewPos;
  1692. char m_szTitle[32];
  1693. char m_szName[32];
  1694. } TONG_INSTATE_SYNC;
  1695. typedef struct
  1696. {
  1697. BYTE ProtocolType;
  1698. WORD m_wLength;
  1699. BYTE m_btMsgId;
  1700. DWORD m_dwTongNameID;
  1701. BYTE m_btFigure;
  1702. BYTE m_btPos;
  1703. char m_szName[32];
  1704. } TONG_APPLY_KICK_COMMAND;
  1705. typedef struct
  1706. {
  1707. BYTE ProtocolType;
  1708. WORD m_wLength;
  1709. BYTE m_btMsgId;
  1710. DWORD m_dwTongNameID;
  1711. BYTE m_btSuccessFlag;
  1712. BYTE m_btFigure;
  1713. BYTE m_btPos;
  1714. char m_szName[32];
  1715. } TONG_KICK_SYNC;
  1716. typedef struct
  1717. {
  1718. BYTE ProtocolType;
  1719. WORD m_wLength;
  1720. BYTE m_btMsgId;
  1721. DWORD m_dwTongNameID;
  1722. BYTE m_btFigure;
  1723. BYTE m_btPos;
  1724. char m_szName[32];
  1725. } TONG_APPLY_LEAVE_COMMAND;
  1726. typedef struct
  1727. {
  1728. BYTE ProtocolType;
  1729. WORD m_wLength;
  1730. BYTE m_btMsgId;
  1731. DWORD m_dwTongNameID;
  1732. BYTE m_btFigure;
  1733. BYTE m_btPos;
  1734. char m_szName[32];
  1735. } TONG_APPLY_CHANGE_MASTER_COMMAND;
  1736. typedef struct
  1737. {
  1738. BYTE ProtocolType;
  1739. WORD m_wLength;
  1740. BYTE m_btMsgId;
  1741. DWORD m_dwTongNameID;
  1742. BYTE m_btFailID;
  1743. char m_szName[32];
  1744. } TONG_CHANGE_MASTER_FAIL_SYNC;
  1745. // tong 相关 end
  1746. typedef struct
  1747. {
  1748. BYTE ProtocolType;
  1749. DWORD m_dwNpcID;
  1750. WORD m_wGoldFlag;
  1751. } NPC_GOLD_CHANGE_SYNC;
  1752. typedef struct
  1753. {
  1754. BYTE ProtocolType;
  1755. DWORD dwItemID;
  1756. int nChange;
  1757. } ITEM_DURABILITY_CHANGE;
  1758. typedef struct
  1759. {
  1760. BYTE ProtocolType;
  1761. DWORD dwItemID;
  1762. } ITEM_REPAIR;
  1763. // 在调用这支函数之前必须判断是否处于交易状态,如果正在交易,不能调用这支函数
  1764. void SendClientCmdSell(int nID);
  1765. // 在调用这支函数之前必须判断是否处于交易状态,如果正在交易,不能调用这支函数
  1766. void SendClientCmdBuy(int nBuyIdx, int nPlace, int nX, int nY);
  1767. // 在调用这支函数之前必须判断是否处于交易状态,如果正在交易,不能调用这支函数
  1768. void SendClientCmdRun(int nX, int nY);
  1769. // 在调用这支函数之前必须判断是否处于交易状态,如果正在交易,不能调用这支函数
  1770. void SendClientCmdWalk(int nX, int nY);
  1771. // 在调用这支函数之前必须判断是否处于交易状态,如果正在交易,不能调用这支函数
  1772. void SendClientCmdSkill(int nSkillID, int nX, int nY);
  1773. //void SendClientCmdPing();
  1774. void SendClientCmdSit(int nSitFlag);
  1775. void SendClientCmdMoveItem(void* pDownPos, void* pUpPos);
  1776. void SendClientCmdQueryLadder(DWORD dwLadderID);
  1777. void SendClientCmdRequestNpc(int nID);
  1778. void SendClientCmdJump(int nX, int nY);
  1779. void SendClientCmdStoreMoney(int nDir, int nMoney);
  1780. //void SendClientCmdRevive(int nReviveType);
  1781. void SendClientCmdRevive();
  1782. void SendObjMouseClick(int nObjID, DWORD dwRegionID);
  1783. void SendClientCmdRepair(DWORD dwID);
  1784. extern int g_nProtocolSize[MAX_PROTOCOL_NUM];
  1785. #pragma pack(pop, enter_protocol)
  1786. #endif