BattleMessageR2B.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. using CommonAI.Data;
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Instance;
  4. using CommonLang.IO;
  5. using CommonLang.IO.Attribute;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using XmdsCommon.Plugin;
  11. namespace XmdsCommonServer.Message
  12. {
  13. /// <summary>
  14. /// 战斗服通知客户端事件.
  15. /// </summary>
  16. [MessageType(0xFF00001)]
  17. public class PlayerRebirthEventR2B : PlayerEvent
  18. {
  19. //1 = 原地复活.
  20. //2 = 出生点复活.
  21. //3 = 复活点复活.
  22. //4 = 技能复活.
  23. //5 = 随机复活点
  24. public byte type = 0;
  25. public int HP = 0;
  26. public int MP = 0;
  27. public ConsumeItemEventB2R Callback = null;
  28. public PlayerRebirthEventR2B() { }
  29. public PlayerRebirthEventR2B(byte t, ConsumeItemEventB2R c)
  30. {
  31. type = t;
  32. Callback = c;
  33. }
  34. override public void WriteExternal(IOutputStream output)
  35. {
  36. base.WriteExternal(output);
  37. output.PutU8(type);
  38. output.PutExt(Callback);
  39. output.PutVS32(HP);
  40. output.PutVS32(MP);
  41. }
  42. override public void ReadExternal(IInputStream input)
  43. {
  44. base.ReadExternal(input);
  45. type = input.GetU8();
  46. Callback = input.GetExt<ConsumeItemEventB2R>();
  47. HP = input.GetVS32();
  48. MP = input.GetVS32();
  49. }
  50. }
  51. /// <summary>
  52. /// 游戏服通知战斗服救人.
  53. /// </summary>
  54. [MessageType(0xFF00002)]
  55. public class PlayerSaveEventR2B : PlayerEvent
  56. {
  57. //救助者.
  58. public InstanceUnit Saver = null;
  59. //死者.
  60. public InstanceUnit Decedent = null;
  61. //复活所需要时间.
  62. public int SaveTime = 0;
  63. }
  64. /// <summary>
  65. /// 游戏通知战斗服召唤坐骑.
  66. /// </summary>
  67. [MessageType(0xFF00003)]
  68. public class PlayerSummonMountEventR2B : PlayerEvent
  69. {
  70. /// <summary>
  71. /// 召唤时间.
  72. /// </summary>
  73. public int TimeMS = 0;
  74. /// <summary>
  75. /// 是否为上坐骑.
  76. /// </summary>
  77. public bool IsSummonMount = false;
  78. }
  79. /// <summary>
  80. /// 游戏服通知技能变更.
  81. /// </summary>
  82. [MessageType(0xFF00004)]
  83. public class PlayerSkillChangeEventR2B : PlayerEvent
  84. {
  85. public enum SkillOperate : byte
  86. {
  87. Reset = 0, //重置所有.
  88. Replace = 1, //替换(找到指定ID然后替换).
  89. Add = 2, //新增.
  90. Remove = 3, //删除.
  91. }
  92. /// <summary>
  93. /// 操作标识.
  94. /// </summary>
  95. public SkillOperate OperateID = SkillOperate.Reset;
  96. /// <summary>
  97. /// 技能列表(可能包含主动、被动).
  98. /// </summary>
  99. public List<GameSkill> SkillList = null;
  100. override public void WriteExternal(IOutputStream output)
  101. {
  102. base.WriteExternal(output);
  103. output.PutEnum8(OperateID);
  104. output.PutList<GameSkill>(SkillList, output.PutExt);
  105. }
  106. override public void ReadExternal(IInputStream input)
  107. {
  108. base.ReadExternal(input);
  109. OperateID = input.GetEnum8<SkillOperate>();
  110. SkillList = input.GetList<GameSkill>(input.GetExt<GameSkill>);
  111. }
  112. }
  113. /// <summary>
  114. /// 同步玩家可用背包数量.
  115. /// </summary>
  116. [MessageType(0xFF00005)]
  117. public class SyncPlayerInventorySizeEventR2B : PlayerEvent
  118. {
  119. public int Size = 0;
  120. override public void WriteExternal(IOutputStream output)
  121. {
  122. base.WriteExternal(output);
  123. output.PutS32(Size);
  124. }
  125. override public void ReadExternal(IInputStream input)
  126. {
  127. base.ReadExternal(input);
  128. Size = input.GetS32();
  129. }
  130. }
  131. /// <summary>
  132. /// 组队信息.
  133. /// </summary>
  134. [MessageType(0xFF00006)]
  135. public class TeamInfoEventR2B
  136. {
  137. public List<string> UUIDList = null;
  138. }
  139. /// <summary>
  140. /// 单位PK等级变更事件(游戏服至战斗服).
  141. /// </summary>
  142. [MessageType(0xFF00007)]
  143. public class PlayerPKLevelChangeEventR2B
  144. {
  145. /// <summary>
  146. /// 当前等级.
  147. /// </summary>
  148. public PKLevel CurPKLv;
  149. }
  150. /// <summary>
  151. /// 单位PK模式变更.(游戏服至战斗服).
  152. /// </summary>
  153. [MessageType(0xFF00008)]
  154. public class PlayerPKModeChangeEventR2B
  155. {
  156. /// <summary>
  157. /// 当前模式.
  158. /// </summary>
  159. public PKMode CurPKMode;
  160. }
  161. /// <summary>
  162. /// 单位PK模式变更.(游戏服至战斗服).
  163. /// </summary>
  164. [MessageType(0xFF00009)]
  165. public class PlayerPKValueChangeEventR2B
  166. {
  167. /// <summary>
  168. /// 更改值,实际计算公式:CurrentValue += ChangeValue.
  169. /// </summary>
  170. public int ChangeValue;
  171. }
  172. /// <summary>
  173. /// 属性变更指令.
  174. /// </summary>
  175. [MessageType(0xFF00010)]
  176. public class PropertyChangeEventR2B
  177. {
  178. /// <summary>
  179. /// 属性变更类型.
  180. /// </summary>
  181. public enum PropertyChangeType : byte
  182. {
  183. HP,
  184. NPC
  185. }
  186. public enum ValueType : byte
  187. {
  188. Value,
  189. Percent // 万分比.
  190. }
  191. /// <summary>
  192. /// 作用类型.
  193. /// </summary>
  194. public PropertyChangeType ChangeType;
  195. /// <summary>
  196. /// 值类型.
  197. /// </summary>
  198. public ValueType ChangeValueType;
  199. /// <summary>
  200. /// 值.
  201. /// </summary>
  202. public int ChangeValue;
  203. /// <summary>
  204. /// 持续时间.
  205. /// </summary>
  206. public int Duration;
  207. /// <summary>
  208. /// 过期时间戳.
  209. /// </summary>
  210. public long TimestampMS;
  211. }
  212. /// <summary>
  213. /// 宠物基础属性变更.
  214. /// </summary>
  215. [MessageType(0xFF00011)]
  216. public class PetBaseInfoChangeEventR2B
  217. {
  218. /// <summary>
  219. /// 基础属性.
  220. /// </summary>
  221. public PetBaseInfo BaseInfo;
  222. }
  223. /// <summary>
  224. /// 宠物整体属性变更.
  225. /// </summary>
  226. [MessageType(0xFF00012)]
  227. public class PetDataChangeEventR2B
  228. {
  229. /// <summary>
  230. /// 属性变更类型.
  231. /// </summary>
  232. public enum PetDataChangeType : byte
  233. {
  234. Add, //增加.
  235. Delete, //删除.
  236. Replace, //替换宠物.
  237. Reset, //重置当前.
  238. }
  239. public PetDataChangeType OpType;
  240. public PetData Data;
  241. }
  242. /// <summary>
  243. /// 宠物技能变更.
  244. /// </summary>
  245. [MessageType(0xFF00013)]
  246. public class PetSkillChangeEventR2B
  247. {
  248. /// <summary>
  249. /// 操作标识.
  250. /// </summary>
  251. public PlayerSkillChangeEventR2B.SkillOperate OperateID;
  252. /// <summary>
  253. /// 技能列表(可能包含主动、被动).
  254. /// </summary>
  255. public List<GameSkill> SkillList = null;
  256. }
  257. /// <summary>
  258. /// 组队背包更新.
  259. /// </summary>
  260. [MessageType(0xFF00014)]
  261. public class TeamInventorySizeChangeEventR2B
  262. {
  263. public int size;
  264. }
  265. /// <summary>
  266. /// 宠物属性变更指令.
  267. /// </summary>
  268. [MessageType(0xFF00015)]
  269. public class PetPropertyChangeEventR2B
  270. {
  271. public PropertyChangeEventR2B Order;
  272. }
  273. [MessageType(0xFF00016)]
  274. public class PetFollowModeChangeEventR2B
  275. {
  276. public XmdsCommon.Plugin.XmdsPetConifg.XmdsPetFollowMode mode;
  277. }
  278. /////////////////////////////////////组队相关////////////////////////////////////////////////
  279. /// <summary>
  280. /// 游戏服通知组队信息
  281. /// </summary>
  282. public class TeamDataEventR2B
  283. {
  284. public string LeaderId;
  285. public List<TeamMemberEventR2B> TeamMembers;
  286. public bool ContainMem(String id)
  287. {
  288. if(this.TeamMembers == null)
  289. {
  290. return false;
  291. }
  292. foreach(TeamMemberEventR2B member in this.TeamMembers)
  293. {
  294. if(member.uuid != null && member.uuid.Equals(id))
  295. {
  296. return true;
  297. }
  298. }
  299. return false;
  300. }
  301. }
  302. public class TeamMemberEventR2B
  303. {
  304. public int followLeader;
  305. public string uuid;
  306. }
  307. }