XmdsProperties.cs 88 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760
  1. using CommonAI.Zone;
  2. using CommonAI.Zone.Helper;
  3. using CommonAI.Zone.Instance;
  4. using CommonAI.Zone.Formula;
  5. using CommonLang;
  6. using CommonLang.IO;
  7. using CommonLang.IO.Attribute;
  8. using CommonLang.Property;
  9. using CommonLang.Xml;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using CommonLang.Concurrent;
  15. using System.ComponentModel;
  16. using static CommonAI.Zone.Instance.InstanceUnit;
  17. using CommonLang.Geometry;
  18. using CommonAI.Data;
  19. using CommonAI.Zone.Attributes;
  20. using XmdsCommon.JSGModule;
  21. namespace XmdsCommon.Plugin
  22. {
  23. #region 编辑器扩展Properties.
  24. [MessageType(0x000B0001)]
  25. [DescAttribute("单位战斗属性")]
  26. [ExpandableAttribute]
  27. public class XmdsUnitProperties : IUnitProperties
  28. {
  29. /// <summary>
  30. /// 地位类型.
  31. /// </summary>
  32. public enum StatusType : byte
  33. {
  34. Normal,//普通.
  35. Elite, //精英.
  36. Boss, //BOSS.
  37. SpecialElite,
  38. SpecialBoss,
  39. }
  40. /// <summary>
  41. /// 服务端数据.
  42. /// </summary>
  43. [DescAttribute("单位属性-服务器,填时需要联系程序")]
  44. public XmdsUnitData ServerData = new XmdsUnitData();
  45. /// <summary>
  46. /// 单位是否受AOI影响.
  47. /// </summary>
  48. [DescAttribute("是否为静态单位,是-不受AOI影响")]
  49. public bool IsStaticUnit = false;
  50. /// <summary>
  51. /// 是否启用脱战计时,关闭时,单位脱战不受时间限制.
  52. /// </summary>
  53. [DescAttribute("是否启用脱战倒计时")]
  54. public bool IsUseCombatTimeCount = true;
  55. /// <summary>
  56. /// 头像.
  57. /// </summary>
  58. [DescAttribute("头像图片")]
  59. public string HeadIcon = "没脸见人";
  60. [DescAttribute("机器人测试模板", "Bot")]
  61. public bool BotTestTemplate = false;
  62. [DescAttribute("交互时是否面对交互对象", "NPC")]
  63. public bool FaceToInteractiveUnit = true;
  64. [DescAttribute("是否为精英、BOSS", "地位类型")]
  65. public StatusType GameStatusType = StatusType.Normal;
  66. [DescAttribute("初始化时是否读取配置脚本", "功能扩展")]
  67. public bool LoadDataConfig = true;
  68. [DescAttribute("单位游荡配置", "功能扩展")]
  69. public WanderConfig WanderConfigData = null;
  70. [DescAttribute("是否显示血条", "功能扩展")]
  71. public bool ShowHPBanner = true;
  72. public override string ToString()
  73. {
  74. return "Xmds 单位扩展属性";
  75. }
  76. public object Clone()
  77. {
  78. XmdsUnitProperties ret = new XmdsUnitProperties();
  79. ret.ServerData = (XmdsUnitData)this.ServerData.Clone();
  80. ret.HeadIcon = this.HeadIcon;
  81. ret.BotTestTemplate = this.BotTestTemplate;
  82. ret.IsStaticUnit = this.IsStaticUnit;
  83. ret.IsUseCombatTimeCount = this.IsUseCombatTimeCount;
  84. ret.FaceToInteractiveUnit = this.FaceToInteractiveUnit;
  85. ret.GameStatusType = this.GameStatusType;
  86. ret.LoadDataConfig = this.LoadDataConfig;
  87. ret.ShowHPBanner = this.ShowHPBanner;
  88. ret.WanderConfigData = this.WanderConfigData;
  89. return ret;
  90. }
  91. public void WriteExternal(IOutputStream output)
  92. {
  93. output.PutExt(ServerData);
  94. output.PutUTF(HeadIcon);
  95. output.PutBool(BotTestTemplate);
  96. output.PutBool(IsStaticUnit);
  97. output.PutBool(IsUseCombatTimeCount);
  98. output.PutBool(FaceToInteractiveUnit);
  99. output.PutEnum8(GameStatusType);
  100. output.PutBool(LoadDataConfig);
  101. output.PutBool(ShowHPBanner);
  102. output.PutExt(WanderConfigData);
  103. }
  104. public void ReadExternal(IInputStream input)
  105. {
  106. this.ServerData = input.GetExt<XmdsUnitData>();
  107. this.HeadIcon = input.GetUTF();
  108. this.BotTestTemplate = input.GetBool();
  109. this.IsStaticUnit = input.GetBool();
  110. this.IsUseCombatTimeCount = input.GetBool();
  111. this.FaceToInteractiveUnit = input.GetBool();
  112. this.GameStatusType = input.GetEnum8<StatusType>();
  113. this.LoadDataConfig = input.GetBool();
  114. this.ShowHPBanner = input.GetBool();
  115. this.WanderConfigData = input.GetExt<WanderConfig>();
  116. }
  117. }
  118. [MessageType(0x000B0002)]
  119. [DescAttribute("攻击属性")]
  120. [ExpandableAttribute]
  121. public class XmdsAttackProperties : IAttackProperties
  122. {
  123. [DescAttribute("技能ID(伤害判定,无填-1)", "技能ID")]
  124. [TemplateIDAttribute(typeof(SkillTemplate))]
  125. public int SkillTemplateID = 0;
  126. [DescAttribute("伤害百分比公式ID", "数值公式ID")]
  127. public int DamagePerID = 0;
  128. [DescAttribute("伤害绝对值公式ID", "数值公式ID")]
  129. public int DamageModiferID = 0;
  130. public XmdsAttackProperties()
  131. {
  132. }
  133. public int GetAttackID()
  134. {
  135. return SkillTemplateID;
  136. }
  137. public override string ToString()
  138. {
  139. return "Xmds 攻击扩展属性";
  140. }
  141. public object Clone()
  142. {
  143. XmdsAttackProperties ret = new XmdsAttackProperties();
  144. ret.SkillTemplateID = this.SkillTemplateID;
  145. ret.DamagePerID = this.DamagePerID;
  146. ret.DamageModiferID = this.DamageModiferID;
  147. return ret;
  148. }
  149. public void WriteExternal(IOutputStream output)
  150. {
  151. output.PutS32(SkillTemplateID);
  152. output.PutS32(DamagePerID);
  153. output.PutS32(DamageModiferID);
  154. }
  155. public void ReadExternal(IInputStream input)
  156. {
  157. SkillTemplateID = input.GetS32();
  158. DamagePerID = input.GetS32();
  159. DamageModiferID = input.GetS32();
  160. }
  161. }
  162. [MessageType(0x000B0003)]
  163. [DescAttribute("BUFF属性")]
  164. [ExpandableAttribute]
  165. public class XmdsBuffProperties : IBuffProperties
  166. {
  167. public enum XmdsBuffAbility : int
  168. {
  169. [Desc("无")]
  170. None = 0,
  171. [Desc("属性变更")]
  172. PropChange = 1 << 8, //属性变更.
  173. [Desc("晕眩")]
  174. STUN = 1, //晕眩.
  175. [Desc("冰冻")]
  176. FROZEN = 2, //冰冻.
  177. [Desc("吸收伤害护盾")]
  178. SHIELD_AbsorbDamage = 3, //吸收伤害护盾.
  179. [Desc("沉默")]
  180. Silent = 4, //沉默.
  181. [Desc("伤害减免")]
  182. DamageRemit = 5, //伤害减免.
  183. [Desc("嘲讽")]
  184. Mocking = 6, //嘲讽.
  185. [Desc("技能伤害变更")]
  186. SkillDamageChange = 7, //技能伤害变更.
  187. [Desc("能量消耗改变")]
  188. EnergyCost = 8, //能量消耗改变.
  189. [Desc("移动速度降低")]
  190. MoveSpeedDown = 9, //移动速度降低.
  191. [Desc("流血")]
  192. Bleed = 10, //流血.
  193. [Desc("加血")]
  194. AddHP = 11, //加血.
  195. [Desc("能量变更")]
  196. MPChange = 12, //能量变更.
  197. [Desc("标记")]
  198. Mark = 13, //标记.
  199. [Desc("技能CD变更")]
  200. ChangeSkillTotalTime = 14, //技能CD变更.
  201. [Desc("技能变更")]
  202. ChangeSkill = 15, //技能变更.
  203. [Desc("无敌")]
  204. Invincible = 16, //无敌.
  205. [Desc("点燃")]
  206. Burn = 17, //点燃.
  207. [Desc("速度上升 + 免疫控制")]
  208. SpeedUpAndIngoreCtrl = 18, //(奥义)速度上升+免疫控制.
  209. [Desc("锁帧 + 免疫伤害控制")]
  210. Fridge = 19, //冰箱.
  211. [Desc("隐身")]
  212. Stealth = 20, //隐身.
  213. [Desc("免疫控制")]
  214. IngoreCtrl = 21, //免疫控制.
  215. [Desc("闷棍")]
  216. Sap = 22, //闷棍.
  217. [Desc("献祭(耗MP)")]
  218. Immolate_MP = 23, //献祭.
  219. [Desc("暗影状态")]
  220. ShadowState = 24, //暗影状态.
  221. [Desc("烙印1:定时,或者结束时,造成额外伤害.")]
  222. Brand = 25, //烙印.
  223. [Desc("Event:单位打到别人后触发.事件型")]
  224. Event_OnHitOther = 26, //事件型BUFF,当单位打到别人.
  225. [Desc("Event:单位收到伤害.事件型")]
  226. Event_OnHitDamageEvent = 27,//事件性BUFF,受到伤害.
  227. [Desc("变身")]
  228. ChangeAvatar = 28, //变身.
  229. [Desc("激活技能")]
  230. ActiveSkill = 29,//激活技能.
  231. [Desc("单位链接")]
  232. UnitLink = 30,//BUFF状态跟其他单位挂钩.
  233. [Desc("虚无无视攻击(技能、BUFF)")]
  234. Nothingness = 31,//虚无状态无视攻击.
  235. [Desc("无法被选中(客户端操作)")]
  236. Selectable = 32,
  237. [Desc("限制伤害最多受到指定伤害")]
  238. SHIELD_LimitingDamage = 33,
  239. [Desc("恐惧")]
  240. Fear = 34,
  241. [Desc("反伤")]
  242. SHIELD_IronMaiden = 35,
  243. [Desc("禁锢(和眩晕冰冻一样)")]
  244. JINGU = 36,
  245. [Desc("加血(不会打断)")]
  246. AddHP_Unbroken = 37,
  247. [Desc("无敌,放技能失效mmp")]
  248. Invincible_luanchSkillBreak = 38,
  249. [Desc("根据生命值变更攻击伤害")]
  250. AttakUp_ByHp = 39,
  251. [Desc("锁血N")]
  252. Lock_HP = 40,
  253. [Desc("受击加血N%")]
  254. HitAttHp = 41,
  255. [Desc("速度改变 + 免伤")]
  256. SpeedChg_DamageRemit = 42,
  257. [Desc("免疫硬控,转换成减速50%")]
  258. IgnorCtrl_To_SpeedDown = 43,
  259. [Desc("免控 & 速度变更")]
  260. IgnorCtrl_And_SpeedChg = 44,
  261. [Desc("烙印1: 被标记,再次攻击触发")]
  262. Brand_1 = 45, //烙印.
  263. [Desc("烙印2: 对指定目标的伤害提高")]
  264. Brand_2 = 46, //烙印.
  265. [Desc("烙印3: 下次攻击额外伤害")]
  266. Brand_3 = 47, //烙印.
  267. [Desc("烙印4:buff创建者攻击buff拥有者,改变拥有者属性")]
  268. Brand_4 = 48, //烙印.
  269. [Desc("烙印5:buff创建者队友攻击buff拥有者,给队友增加回血buff")]
  270. Brand_5 = 49, //烙印.
  271. [Desc("烙印6:结束创建一个新的法术")]
  272. Brand_6 = 50, //烙印.
  273. [Desc("击杀玩家,创建新法术")]
  274. KillCreateSpeel = 51,
  275. [Desc("移动速度提高")]
  276. MoveSpeedUp = 52, //移动速度提高.
  277. [Desc("攻速")]
  278. AttackSpeed = 53, //攻速
  279. [Desc("伤害附带debuff")]
  280. AttackAdditionDebuff = 54,
  281. [Desc("减速,按时间衰减")]
  282. SpeedDown_Attenuation = 55,
  283. [Desc("debuff创建者及队友攻击,回血")]
  284. Attack_AddHP = 56,
  285. [Desc("护符,抵挡下一次致命伤害")]
  286. Remit_DeadlyDamage = 57,
  287. [Desc("加速,按时间衰减")]
  288. SpeedUp_Attenuation = 58,
  289. [Desc("诅咒,1-真实伤害")]
  290. Curse_RealDamage = 59,
  291. [Desc("X技能击中,创建新的法术")]
  292. Hit_CreateSpell = 60,
  293. [Desc("破甲")]
  294. Sunder_Armor = 61,
  295. [Desc("攻击,范围回血")]
  296. Attack_RoundAddHP = 62,
  297. [Desc("附加buff")]
  298. AddBuff = 63,
  299. [Desc("压制")]
  300. YaZhi = 64,
  301. [Desc("加血, 根据当前生命变化")]
  302. AddHPExt = 65, //加血.
  303. [Desc("无法移动")]
  304. CanNotMove = 66,
  305. [Desc("根据已损失生命值加血")]
  306. AddHPByLossHP = 67,
  307. [Desc("攻击就回血(已损失生命),回血")]
  308. Attack_AddHPEXT = 68,
  309. [Desc("结束伤害类型buff")]
  310. Damage = 69,
  311. [Desc("治疗毒天赋")]
  312. RemedyPoison = 70,
  313. [Desc("护盾-受伤释放法术")]
  314. SHIELD_HitLaunchSpell = 71,
  315. [Desc("增加天赋值")]
  316. ADD_TALENT = 72,
  317. //100+的都是比较特殊的buff,一般只能适用于一个单独的buff
  318. [Desc("下次技能暴击 & 回血")]
  319. NextAttakCrit_AddHP = 100,
  320. [Desc("测试buff")]
  321. JSGTestBuff = 101,
  322. [Desc("攻击创建额外法术")]
  323. AttackCreateSpell = 102,
  324. }
  325. public class XmdsBuffAbilityNode
  326. {
  327. public XmdsBuffAbility ability = XmdsBuffAbility.None;
  328. public XmdsBuffAbilityNode() { }
  329. public XmdsBuffAbilityNode(XmdsBuffAbility a) { ability = a; }
  330. public override string ToString()
  331. {
  332. return ability.ToString();
  333. }
  334. }
  335. private List<XmdsBuffVirtual> mBuffVirtualList = new List<XmdsBuffVirtual>();
  336. [DescAttribute("BUFF是否可被驱散.", "BUFF属性.")]
  337. public bool Dispelled = true;
  338. [DescAttribute("描述BUFF具体作用及实际能力.", "BUFF能力列表.")]
  339. public List<XmdsBuffAbilityNode> BuffAbilityList = new List<XmdsBuffAbilityNode>();
  340. [DescAttribute("是否显示BUFF ICON.", "BUFF属性.")]
  341. public bool ShowBuffIcon = true;
  342. public XmdsBuffProperties()
  343. {
  344. }
  345. public override string ToString()
  346. {
  347. return "Xmds BUFF扩展属性";
  348. }
  349. public object Clone()
  350. {
  351. XmdsBuffProperties prop = new XmdsBuffProperties();
  352. prop.Dispelled = this.Dispelled;
  353. prop.BuffAbilityList = new List<XmdsBuffAbilityNode>(this.BuffAbilityList.Count);
  354. prop.ShowBuffIcon = this.ShowBuffIcon;
  355. foreach (var e in this.BuffAbilityList) { prop.BuffAbilityList.Add(new XmdsBuffAbilityNode(e.ability)); }
  356. return prop;
  357. }
  358. public void WriteExternal(IOutputStream output)
  359. {
  360. output.PutBool(Dispelled);
  361. int count = BuffAbilityList.Count;
  362. output.PutS32(count);
  363. for (int i = 0; i < count; i++)
  364. {
  365. output.PutEnum32(BuffAbilityList[i].ability);
  366. }
  367. output.PutBool(ShowBuffIcon);
  368. }
  369. public void ReadExternal(IInputStream input)
  370. {
  371. this.Dispelled = input.GetBool();
  372. BuffAbilityList.Clear();
  373. int count = input.GetS32();
  374. for (int i = 0; i < count; i++)
  375. {
  376. BuffAbilityList.Add(new XmdsBuffAbilityNode(input.GetEnum32<XmdsBuffAbility>()));
  377. }
  378. this.ShowBuffIcon = input.GetBool();
  379. }
  380. public void addBuffVirtual(XmdsBuffVirtual buffVirtual)
  381. {
  382. mBuffVirtualList.Add(buffVirtual);
  383. }
  384. public List<XmdsBuffVirtual> GetBuffVirtualList()
  385. {
  386. return mBuffVirtualList;
  387. }
  388. }
  389. [MessageType(0x000B0004)]
  390. [DescAttribute("道具属性")]
  391. [ExpandableAttribute]
  392. public class XmdsItemProperties : IItemProperties
  393. {
  394. public enum XmdsItemAbility : int
  395. {
  396. NONE = 0,//无.
  397. HP_CHANGE = 1,//血量改变(加/减).
  398. }
  399. public enum XmdsItemType : int
  400. {
  401. None,
  402. [Desc("任务物品")]
  403. Task,//任务计数用.
  404. [Desc("装备物品")]
  405. Equip,//装备道具.
  406. [Desc("掉落道具")]
  407. TC,
  408. [Desc("炼魂道具")]
  409. RefineSoul,
  410. [Desc("buff类道具")]
  411. Buff,
  412. [Desc("Boss墓碑")]
  413. BossTombstone,
  414. [Desc("仙盟建筑")]
  415. GuildBuild,
  416. [Desc("妖气")]
  417. YaoQi,
  418. [Desc("拾取后换模型PickedRes")]
  419. Picked,
  420. }
  421. public enum XmdsItemPickState : byte
  422. {
  423. [Desc("无")]
  424. None,
  425. [Desc("钓鱼")]
  426. Fish,
  427. [Desc("拾取")]
  428. Pick,
  429. [Desc("采集")]
  430. Collect,
  431. [Desc("牵马")]
  432. Horse,
  433. [Desc("公会打坐")]
  434. Meditation,
  435. [Desc("公会传功")]
  436. Contribution,
  437. [Desc("公会净妖")]
  438. NetDemon,
  439. [Desc("切换场景,协议走的是拾取协议,客户端无法确定场景ID,由服务器控制")]
  440. GoToScene,
  441. [Desc("游戏场景中,福袋的互动")]
  442. Jump,
  443. }
  444. public enum XmdsItemSoundType : int
  445. {
  446. [Desc("None")]
  447. None,
  448. [Desc("Virtuals")]
  449. Virtuals,
  450. [Desc("怪物掉落技能")]
  451. MonsterDropSkill,
  452. [Desc("小说")]
  453. XiaoShuo,
  454. [Desc("功法")]
  455. GongFa,
  456. [Desc("mate202")]
  457. Mate202,
  458. [Desc("rideItem")]
  459. RideItem,
  460. [Desc("petItem")]
  461. PetItem,
  462. [Desc("mate205")]
  463. Mate205,
  464. [Desc("mate206")]
  465. Mate206,
  466. [Desc("mate208")]
  467. Mate208,
  468. [Desc("mate209")]
  469. Mate209,
  470. [Desc("mate210")]
  471. Mate210,
  472. [Desc("chest")]
  473. Chest,
  474. [Desc("jinbi")]
  475. Jinbi,
  476. [Desc("hpot")]
  477. Hpot,
  478. [Desc("VirtQuest")]
  479. VirtQuest,
  480. [Desc("realQuest")]
  481. RealQuest,
  482. [Desc("魂魄")]
  483. HunPo,
  484. [Desc("misc")]
  485. Misc,
  486. [Desc("武器")]
  487. Wuqi,
  488. [Desc("护身符10")]
  489. HuShenFu10,
  490. [Desc("戒指")]
  491. JieZhi,
  492. [Desc("护身符12")]
  493. HuShenFu12,
  494. [Desc("头部")]
  495. Head,
  496. [Desc("上衣")]
  497. ShangYi,
  498. [Desc("腿部")]
  499. TuiBu,
  500. [Desc("肩部")]
  501. JianBu,
  502. [Desc("手套")]
  503. ShouTao,
  504. [Desc("鞋子")]
  505. XieZi,
  506. [Desc("项链")]
  507. XianLian,
  508. [Desc("戒指2")]
  509. JieZhi2,
  510. }
  511. [DescAttribute("物品声音类型", "声音类型")]
  512. public XmdsItemSoundType soundType = XmdsItemSoundType.None;
  513. [DescAttribute("物品能力", "物品能力")]
  514. public XmdsItemAbility abilityType = 0;
  515. [DescAttribute("作用效果", "物品能力")]
  516. public int effectValue = 0;
  517. [DescAttribute("是否为任务道具", "拾取物品条件")]
  518. public bool IsTaskItem = false;
  519. [DescAttribute("物品类型", "物品属性")]
  520. public XmdsItemType ItemType = XmdsItemType.None;
  521. [DescAttribute("采集动作名字(采集、浇花、焚烧)AreaReadyOne:灵气 AreaBox:一次性采集道具 AreaAction_n:有打开表现(n为正整数)", "物品属性")]
  522. public string PickActionName;
  523. [DescAttribute("采集按钮名字(垂钓等)", "物品属性")]
  524. public string PickButtonName;
  525. [DescAttribute("采集后显示", "物品属性")]
  526. public string PickedRes;
  527. [DescAttribute("采集时的特效", "特效")]
  528. public LaunchEffect PickEffect;
  529. [DescAttribute("物品触发功能ID", "物品作用")]
  530. public int TriggerFunctionID;
  531. [DescAttribute("拾取状态", "物品属性")]
  532. public XmdsItemPickState PickState = XmdsItemPickState.None;
  533. [DescAttribute("是否显示进度百分比", "物品属性")]
  534. public bool ShowPickPercentText = true;
  535. [DescAttribute("是否允许自动拾取", "物品属性")]
  536. public bool AllowAutoGuardPick = false;
  537. [DescAttribute("炼魂道具作用半径,只在ItemType为RefineSoul有效", "物品属性")]
  538. public int RefineSoulRadius = 0;
  539. [DescAttribute("炼魂道具的收集特效,只在ItemType为RefineSoul有效", "物品属性")]
  540. public LaunchSpell RefineSoulSpell;
  541. [DescAttribute("炼魂道具的收集满特效,只在ItemType为RefineSoul有效", "物品属性")]
  542. public LaunchEffect RefineSuccessEffect;
  543. [DescAttribute("小地图显示标识", "小地图显示标识")]
  544. public string SmallMap;
  545. public XmdsItemProperties()
  546. {
  547. }
  548. public override string ToString()
  549. {
  550. return "Xmds 道具扩展属性";
  551. }
  552. public object Clone()
  553. {
  554. XmdsItemProperties ret = new XmdsItemProperties();
  555. ret.soundType = this.soundType;
  556. ret.abilityType = this.abilityType;
  557. ret.effectValue = this.effectValue;
  558. ret.IsTaskItem = this.IsTaskItem;
  559. ret.ItemType = this.ItemType;
  560. ret.PickActionName = this.PickActionName;
  561. ret.PickButtonName = this.PickButtonName;
  562. ret.PickedRes = this.PickedRes;
  563. ret.PickEffect = this.PickEffect;
  564. ret.TriggerFunctionID = this.TriggerFunctionID;
  565. ret.PickState = this.PickState;
  566. ret.ShowPickPercentText = this.ShowPickPercentText;
  567. ret.AllowAutoGuardPick = this.AllowAutoGuardPick;
  568. ret.RefineSoulRadius = this.RefineSoulRadius;
  569. ret.RefineSoulSpell = CUtils.TryClone<LaunchSpell>(this.RefineSoulSpell);
  570. RefineSuccessEffect = CUtils.TryClone<LaunchEffect>(this.RefineSuccessEffect);
  571. ret.SmallMap = this.SmallMap;
  572. return ret;
  573. }
  574. public void WriteExternal(IOutputStream output)
  575. {
  576. output.PutEnum32((int)this.soundType);
  577. output.PutEnum32((int)this.abilityType);
  578. output.PutS32(this.effectValue);
  579. output.PutBool(this.IsTaskItem);
  580. output.PutEnum32(this.ItemType);
  581. output.PutUTF(this.PickActionName);
  582. output.PutUTF(this.PickButtonName);
  583. output.PutUTF(this.PickedRes);
  584. output.PutExt(this.PickEffect);
  585. output.PutS32(TriggerFunctionID);
  586. output.PutBool(ShowPickPercentText);
  587. output.PutEnum8(PickState);
  588. output.PutBool(AllowAutoGuardPick);
  589. output.PutS32(this.RefineSoulRadius);
  590. output.PutExt(this.RefineSoulSpell);
  591. output.PutExt(this.RefineSuccessEffect);
  592. output.PutUTF(this.SmallMap);
  593. }
  594. public void ReadExternal(IInputStream input)
  595. {
  596. soundType = input.GetEnum32<XmdsItemSoundType>();
  597. abilityType = input.GetEnum32<XmdsItemAbility>();
  598. effectValue = input.GetS32();
  599. IsTaskItem = input.GetBool();
  600. ItemType = input.GetEnum32<XmdsItemType>();
  601. PickActionName = input.GetUTF();
  602. PickButtonName = input.GetUTF();
  603. PickedRes = input.GetUTF();
  604. PickEffect = input.GetExt<LaunchEffect>();
  605. TriggerFunctionID = input.GetS32();
  606. ShowPickPercentText = input.GetBool();
  607. PickState = input.GetEnum8<XmdsItemPickState>();
  608. AllowAutoGuardPick = input.GetBool();
  609. RefineSoulRadius = input.GetS32();
  610. RefineSoulSpell = input.GetExt<LaunchSpell>();
  611. RefineSuccessEffect = input.GetExt<LaunchEffect>();
  612. SmallMap = input.GetUTF();
  613. }
  614. }
  615. [MessageType(0x000B0005)]
  616. [DescAttribute("技能属性")]
  617. [ExpandableAttribute]
  618. public class XmdsSkillProperties : ISkillProperties
  619. {
  620. public enum XmdsSkillLaunchType : byte
  621. {
  622. None,
  623. [Desc("吟唱-前摇")]
  624. Chat, //吟唱.
  625. [Desc("引导-持续施法")]
  626. Continuous, //持续施法.
  627. [Desc("蓄力")]
  628. ChargeAttack,
  629. }
  630. public enum XmdsSkillTargetType : byte
  631. {
  632. None,
  633. [Desc("死亡单位-技能施法目标类型")]
  634. AllianceDead, //对死亡单位有效.
  635. [Desc("敌方单位-技能施法目标类型")]
  636. Enemy, //对敌人.
  637. [Desc("友方单位(不包括自己)-技能施法目标类型")]
  638. Alliance, //同盟.
  639. [Desc("友方单位(包括自己)-技能施法目标类型")]
  640. AllianceIncludeSelf, //同盟包括自己.
  641. [Desc("对自己施法-技能施法目标类型")]
  642. Self, //同盟包括自己.
  643. }
  644. public enum TargetUnitType : byte
  645. {
  646. ALL = 0,
  647. Monster = 1,
  648. Player = 2,
  649. ExcpetPlayer = 3,
  650. }
  651. public enum SkillLaunchCondition : byte
  652. {
  653. NeedTarget, //必须指定一个目标.
  654. IgnoreTarget, //技能施放无需目标.
  655. IgnoreTargetAndCheckAtkRange, //无需目标但有目标时需要检测施法距离并靠近.
  656. }
  657. [DescAttribute("是否需要目标")]
  658. public bool NeedTarget = true;
  659. [DescAttribute("技能施放条件.")]
  660. public SkillLaunchCondition LaunchCondition = SkillLaunchCondition.IgnoreTarget;
  661. [Desc("目标作用类型")]
  662. public TargetUnitType NeedTargetType = TargetUnitType.ALL;
  663. [DescAttribute("是否为需要随机的普通攻击-默认否")]
  664. public bool IsRandomNormalAttack = false;
  665. [DescAttribute("技能顺序-技能面板顺序")]
  666. public int SkillIndex = 0;
  667. [DescAttribute("技能储存使用次数-技能面板顺序")]
  668. public byte UseTimes = 1;
  669. [DescAttribute("技能使用次数变更时间间隔")]
  670. public int AddUseTimesIntervalMS = 3000;
  671. [DescAttribute("技能类型-此处修改无效,在SkillData表中配置")]
  672. public XmdsSkillType SkillType = XmdsSkillType.active;
  673. [DescAttribute("无/引导/吟唱.-技能施法类型.")]
  674. public XmdsSkillLaunchType LaunchType = XmdsSkillLaunchType.None;
  675. [DescAttribute("施法作用目标类型-技能施法目标类型.")]
  676. public XmdsSkillTargetType TargetType = XmdsSkillTargetType.Enemy;
  677. [DescAttribute("技能名字用于引导或吟唱展示-技能扩展属性.")]
  678. public string DisplayName = null;
  679. [DescAttribute("施放模式.-技能施放模式.")]
  680. public XmdsSkillLaunchModeData LaunchModeData = new XmdsSkillLaunchModeData();
  681. public XmdsSkillProperties() { }
  682. public override string ToString()
  683. {
  684. return "Xmds 技能扩展属性";
  685. }
  686. public object Clone()
  687. {
  688. XmdsSkillProperties ret = new XmdsSkillProperties();
  689. ret.NeedTarget = this.NeedTarget;
  690. ret.NeedTargetType = this.NeedTargetType;
  691. ret.IsRandomNormalAttack = this.IsRandomNormalAttack;
  692. ret.SkillIndex = this.SkillIndex;
  693. ret.UseTimes = this.UseTimes;
  694. ret.SkillType = this.SkillType;
  695. ret.LaunchType = this.LaunchType;
  696. ret.TargetType = this.TargetType;
  697. ret.DisplayName = this.DisplayName;
  698. ret.LaunchModeData = this.LaunchModeData;
  699. ret.LaunchCondition = this.LaunchCondition;
  700. ret.AddUseTimesIntervalMS = this.AddUseTimesIntervalMS;
  701. return ret;
  702. }
  703. public void WriteExternal(IOutputStream output)
  704. {
  705. output.PutBool(this.NeedTarget);
  706. output.PutEnum8(this.NeedTargetType);
  707. output.PutBool(this.IsRandomNormalAttack);
  708. output.PutS32(this.SkillIndex);
  709. output.PutU8(this.UseTimes);
  710. output.PutEnum8(this.SkillType);
  711. output.PutEnum8(this.LaunchType);
  712. output.PutEnum8(this.TargetType);
  713. output.PutUTF(this.DisplayName);
  714. output.PutExt(this.LaunchModeData);
  715. output.PutEnum8(this.LaunchCondition);
  716. output.PutS32(this.AddUseTimesIntervalMS);
  717. }
  718. public void ReadExternal(IInputStream input)
  719. {
  720. this.NeedTarget = input.GetBool();
  721. this.NeedTargetType = input.GetEnum8<XmdsSkillProperties.TargetUnitType>();
  722. this.IsRandomNormalAttack = input.GetBool();
  723. this.SkillIndex = input.GetS32();
  724. this.UseTimes = input.GetU8();
  725. this.SkillType = input.GetEnum8<XmdsSkillType>();
  726. this.LaunchType = input.GetEnum8<XmdsSkillLaunchType>();
  727. this.TargetType = input.GetEnum8<XmdsSkillTargetType>();
  728. this.DisplayName = input.GetUTF();
  729. this.LaunchModeData = input.GetExt<XmdsSkillLaunchModeData>();
  730. this.LaunchCondition = input.GetEnum8<SkillLaunchCondition>();
  731. this.AddUseTimesIntervalMS = input.GetS32();
  732. }
  733. public XmdsSkillType GetSkillType()
  734. {
  735. return this.SkillType;
  736. }
  737. public int GetSkillUseTimes()
  738. {
  739. return this.UseTimes;
  740. }
  741. public int GetSkillAddTimeInterval()
  742. {
  743. return this.AddUseTimesIntervalMS;
  744. }
  745. }
  746. [MessageType(0x000B0006)]
  747. [DescAttribute("法术属性")]
  748. [ExpandableAttribute]
  749. public class XmdsSpellProperties : ISpellProperties
  750. {
  751. [DescAttribute("Spell缩放X轴-参数设置")]
  752. public float FileBodyScale_X = 1.0f;
  753. [DescAttribute("Spell缩放Y轴-参数设置")]
  754. public float FileBodyScale_Y = 1.0f;
  755. [DescAttribute("Spell缩放Z轴-参数设置")]
  756. public float FileBodyScale_Z = 1.0f;
  757. [DescAttribute("是否为炼魂特效")]
  758. public bool IsRefineSoul = false;
  759. [Desc("目标作用类型")]
  760. public XmdsSkillProperties.TargetUnitType NeedTargetType = XmdsSkillProperties.TargetUnitType.ALL;
  761. public XmdsSpellProperties()
  762. {
  763. }
  764. public override string ToString()
  765. {
  766. return "Xmds 法术扩展属性";
  767. }
  768. public object Clone()
  769. {
  770. XmdsSpellProperties ret = new XmdsSpellProperties();
  771. ret.FileBodyScale_X = this.FileBodyScale_X;
  772. ret.FileBodyScale_Y = this.FileBodyScale_Y;
  773. ret.FileBodyScale_Z = this.FileBodyScale_Z;
  774. ret.NeedTargetType = this.NeedTargetType;
  775. ret.IsRefineSoul = this.IsRefineSoul;
  776. return ret;
  777. }
  778. public void WriteExternal(IOutputStream output)
  779. {
  780. output.PutF32(FileBodyScale_X);
  781. output.PutF32(FileBodyScale_Y);
  782. output.PutF32(FileBodyScale_Z);
  783. output.PutEnum8(this.NeedTargetType);
  784. output.PutBool(IsRefineSoul);
  785. }
  786. public void ReadExternal(IInputStream input)
  787. {
  788. this.FileBodyScale_X = input.GetF32();
  789. this.FileBodyScale_Y = input.GetF32();
  790. this.FileBodyScale_Z = input.GetF32();
  791. this.NeedTargetType = input.GetEnum8<XmdsSkillProperties.TargetUnitType>();
  792. this.IsRefineSoul = input.GetBool();
  793. }
  794. }
  795. [MessageType(0x000B0008)]
  796. [DescAttribute("场景属性")]
  797. [ExpandableAttribute]
  798. public class XmdsSceneProperties : ISceneProperties
  799. {
  800. [DescAttribute("机器人测试场景", "Bot")]
  801. public bool BotTestTemplate = false;
  802. [DescAttribute("别名", "扩展属性")]
  803. public string Alias = null;
  804. [DescAttribute("是否储存玩家状态", "场景属性")]
  805. public bool SavePlayerStatus = false;
  806. [DescAttribute("游戏服扩展属性", "扩展属性")]
  807. public XmdsServerSceneData ServerSceneData = new XmdsServerSceneData();
  808. [DescAttribute("场景小地图名字", "扩展属性")]
  809. public string SceneSmallMapName = null;
  810. [DescAttribute("场景AOI范围,-1为读取游戏默认配置", "扩展属性")]
  811. public int AOIMaxRange = -1;
  812. [DescAttribute("场景AOI范围,-1为读取游戏默认配置", "扩展属性")]
  813. public int AOIMinRange = -1;
  814. public XmdsSceneProperties()
  815. {
  816. }
  817. public void OnInit(InstanceZone owner)
  818. {
  819. }
  820. public byte GetAutoFightFlag()
  821. {
  822. return ServerSceneData.AllowAutoGuard;
  823. }
  824. public override string ToString()
  825. {
  826. return "Xmds 场景扩展属性";
  827. }
  828. public object Clone()
  829. {
  830. XmdsSceneProperties ret = new XmdsSceneProperties();
  831. ret.BotTestTemplate = this.BotTestTemplate;
  832. ret.Alias = this.Alias;
  833. ret.SavePlayerStatus = this.SavePlayerStatus;
  834. ret.ServerSceneData = this.ServerSceneData;
  835. ret.SceneSmallMapName = this.SceneSmallMapName;
  836. ret.AOIMaxRange = this.AOIMaxRange;
  837. ret.AOIMinRange = this.AOIMinRange;
  838. return ret;
  839. }
  840. public void WriteExternal(IOutputStream output)
  841. {
  842. output.PutBool(BotTestTemplate);
  843. output.PutUTF(Alias);
  844. output.PutBool(SavePlayerStatus);
  845. output.PutUTF(SceneSmallMapName);
  846. output.PutS32(AOIMaxRange);
  847. output.PutS32(AOIMinRange);
  848. output.PutExt(ServerSceneData);
  849. }
  850. public void ReadExternal(IInputStream input)
  851. {
  852. this.BotTestTemplate = input.GetBool();
  853. this.Alias = input.GetUTF();
  854. this.SavePlayerStatus = input.GetBool();
  855. this.SceneSmallMapName = input.GetUTF();
  856. this.AOIMaxRange = input.GetS32();
  857. this.AOIMinRange = input.GetS32();
  858. this.ServerSceneData = input.GetExt<XmdsServerSceneData>();
  859. }
  860. }
  861. [MessageType(0x000B0009)]
  862. [DescAttribute("单位触发器扩展属性")]
  863. [ExpandableAttribute]
  864. public class XmdsUnitTriggerProperties : IUnitTriggerProperties
  865. {
  866. public XmdsUnitTriggerProperties()
  867. {
  868. }
  869. public override string ToString()
  870. {
  871. return "Xmds 单位触发器扩展属性";
  872. }
  873. public object Clone()
  874. {
  875. return new XmdsUnitTriggerProperties();
  876. }
  877. public void WriteExternal(IOutputStream output)
  878. {
  879. }
  880. public void ReadExternal(IInputStream input)
  881. {
  882. }
  883. }
  884. #endregion
  885. #region 游戏服场景配置数据.
  886. /// <summary>
  887. /// 游戏服场景配置数据.
  888. /// </summary>
  889. [DescAttribute("游戏服场景配置数据.")]
  890. [MessageType(0x9001014)]
  891. public class XmdsServerSceneData : ICloneable, IExternalizable
  892. {
  893. public const string NORMAL_MAP = "Normal-World";
  894. [DescAttribute("场景单位强度", "游戏服场景配置数据.")]
  895. public string SceneHard = "Normal-World";
  896. [DescAttribute("是否计算PK值", "游戏服场景配置数据.")]
  897. public bool CalPKValue = true;
  898. [DescAttribute("是否允许自动挂机", "游戏服场景配置数据.")]
  899. public byte AllowAutoGuard = 0;
  900. [DescAttribute("是否使用空间分割", "游戏服场景配置数据.")]
  901. public bool UsespaceDiv = false;
  902. //[DescAttribute("玩法类型", "游戏服场景配置数据.")]
  903. //public CommonAI.Data.SceneType CurSceneType = CommonAI.Data.SceneType.Normal;
  904. [DescAttribute("场景类型", "游戏服场景配置数据.")]
  905. public CommonAI.XmdsConstConfig.AreaType CurAreaType = CommonAI.XmdsConstConfig.AreaType.None;
  906. public object Clone()
  907. {
  908. XmdsServerSceneData ret = new XmdsServerSceneData();
  909. ret.SceneHard = this.SceneHard;
  910. ret.CalPKValue = this.CalPKValue;
  911. ret.AllowAutoGuard = this.AllowAutoGuard;
  912. ret.CurAreaType = this.CurAreaType;
  913. //UsespaceDiv不做保存使用.
  914. return ret;
  915. }
  916. public void WriteExternal(IOutputStream output)
  917. {
  918. output.PutUTF(SceneHard);
  919. output.PutBool(CalPKValue);
  920. output.PutU8(AllowAutoGuard);
  921. output.PutEnum8(CurAreaType);
  922. //UsespaceDiv不做保存使用.
  923. }
  924. public void ReadExternal(IInputStream input)
  925. {
  926. SceneHard = input.GetUTF();
  927. CalPKValue = input.GetBool();
  928. AllowAutoGuard = input.GetU8();
  929. CurAreaType = input.GetEnum8<CommonAI.XmdsConstConfig.AreaType>();
  930. //UsespaceDiv不做保存使用.
  931. }
  932. }
  933. #endregion
  934. #region 游荡配置.
  935. /// <summary>
  936. /// 游荡配置.
  937. /// </summary>
  938. [DescAttribute("怪物停留一段时间[MinHoldTimeMS-MaxHoldTimeMS](随机),游走一段时间[MinMoveTimeMS-MaxMoveTimeMS](随机).", "游荡配置")]
  939. [MessageType(0x9001015)]
  940. public class WanderConfig : ICloneable, IExternalizable
  941. {
  942. [DescAttribute("最小停留时间(毫秒).", "游荡配置")]
  943. public int MinHoldTimeMS = 0;
  944. [DescAttribute("最大停留时间(毫秒)最大停留时间>0才启动游走", "游荡配置")]
  945. public int MaxHoldTimeMS = 0;
  946. [DescAttribute("最小游走时间(毫秒).", "游荡配置")]
  947. public int MinMoveTimeMS = 0;
  948. [DescAttribute("最大游走时间(毫秒).", "游荡配置")]
  949. public int MaxMoveTimeMS = 0;
  950. [DescAttribute(" 游荡范围.", "游荡配置")]
  951. public int WanderRange = 0;
  952. public object Clone()
  953. {
  954. WanderConfig ret = new WanderConfig();
  955. ret.MaxHoldTimeMS = this.MaxHoldTimeMS;
  956. ret.MinHoldTimeMS = this.MinHoldTimeMS;
  957. ret.MaxMoveTimeMS = this.MaxMoveTimeMS;
  958. ret.MinMoveTimeMS = this.MinMoveTimeMS;
  959. return ret;
  960. }
  961. public void ReadExternal(IInputStream input)
  962. {
  963. this.MaxMoveTimeMS = input.GetS32();
  964. this.MinMoveTimeMS = input.GetS32();
  965. this.MaxHoldTimeMS = input.GetS32();
  966. this.MinHoldTimeMS = input.GetS32();
  967. this.WanderRange = input.GetS32();
  968. }
  969. public void WriteExternal(IOutputStream output)
  970. {
  971. output.PutS32(this.MaxMoveTimeMS);
  972. output.PutS32(this.MinMoveTimeMS);
  973. output.PutS32(this.MaxHoldTimeMS);
  974. output.PutS32(this.MinHoldTimeMS);
  975. output.PutS32(this.WanderRange);
  976. }
  977. }
  978. #endregion
  979. #region 游戏服单位数据.
  980. /// <summary>
  981. /// 游戏单位数据.
  982. /// </summary>
  983. [MessageType(0x9001006)]
  984. [ExpandableAttribute]
  985. public class XmdsUnitData : ICloneable, IExternalizable
  986. {
  987. #region 基础属性.
  988. /// <summary>
  989. /// 单位基础信息.
  990. /// </summary>
  991. public XmdsUnitBaseInfo BaseInfo = new XmdsUnitBaseInfo();
  992. /// <summary>
  993. ///装备时装信息.
  994. /// </summary>
  995. public List<XmdsAvatarInfo> AvatarList = new List<XmdsAvatarInfo>();
  996. /// <summary>
  997. ///技能信息.
  998. /// </summary>
  999. public XmdsUnitSkillInfo Skills = null;
  1000. public XmdsUnitSkillInfo CardSkills = null;
  1001. /// <summary>
  1002. /// 单位能力属性.
  1003. /// </summary>
  1004. public XmdsUnitProp Prop = new XmdsUnitProp();
  1005. public XmdsUnitProp PropExt = null;
  1006. /// <summary>
  1007. /// 任务数据.
  1008. /// </summary>
  1009. public List<XmdsQuestData> Tasks = new List<XmdsQuestData>();
  1010. [Desc("测试:QuestFlags")]
  1011. public List<XmdsQuestFlag> QuestFlags = new List<XmdsQuestFlag>();
  1012. /// <summary>
  1013. /// PK信息.
  1014. /// </summary>
  1015. public PKInfo UnitPKInfo = new PKInfo();
  1016. /// <summary>
  1017. /// 宠物信息.
  1018. /// </summary>
  1019. public PetData UnitPetData = null;
  1020. /// <summary>
  1021. /// 单位场景相关信息.
  1022. /// </summary>
  1023. public SceneInfo UnitSceneInfo = new SceneInfo();
  1024. [Desc("标记,不能设置")]
  1025. public bool PlayerEntered = false;
  1026. #endregion
  1027. public XmdsUnitData()
  1028. {
  1029. }
  1030. public object Clone()
  1031. {
  1032. XmdsUnitData ret = new XmdsUnitData();
  1033. if (this.Prop != null) { ret.Prop = (XmdsUnitProp)this.Prop.Clone(); }
  1034. if (this.PropExt != null) { ret.PropExt = (XmdsUnitProp)this.PropExt.Clone(); }
  1035. if (this.Skills != null) { ret.Skills = (XmdsUnitSkillInfo)this.Skills.Clone(); }
  1036. if (this.CardSkills != null) { ret.CardSkills = (XmdsUnitSkillInfo)this.CardSkills.Clone(); }
  1037. if (this.BaseInfo != null) { ret.BaseInfo = (XmdsUnitBaseInfo)this.BaseInfo.Clone(); }
  1038. if (this.AvatarList != null) { ret.AvatarList = new List<XmdsAvatarInfo>(this.AvatarList); }
  1039. if (this.Tasks != null) { ret.Tasks = new List<XmdsQuestData>(this.Tasks); }
  1040. ret.QuestFlags = CUtils.CloneList<XmdsQuestFlag>(this.QuestFlags);
  1041. ret.PlayerEntered = this.PlayerEntered;
  1042. if (UnitPKInfo != null) { ret.UnitPKInfo = (PKInfo)this.UnitPKInfo.Clone(); }
  1043. if (UnitPetData != null) { ret.UnitPetData = (PetData)this.UnitPetData.Clone(); }
  1044. if (UnitSceneInfo != null) { ret.UnitSceneInfo = (SceneInfo)this.UnitSceneInfo.Clone(); }
  1045. return ret;
  1046. }
  1047. public void WriteExternal(IOutputStream output)
  1048. {
  1049. output.PutExt(this.Prop);
  1050. output.PutExt(this.Skills);
  1051. output.PutExt(this.CardSkills);
  1052. output.PutExt(this.BaseInfo);
  1053. output.PutList(this.AvatarList, output.PutExt);
  1054. output.PutBool(this.PlayerEntered);
  1055. output.PutExt(this.UnitPKInfo);
  1056. output.PutExt(this.UnitPetData);
  1057. output.PutExt(this.UnitSceneInfo);
  1058. }
  1059. public void ReadExternal(IInputStream input)
  1060. {
  1061. this.Prop = input.GetExt<XmdsUnitProp>();
  1062. this.Skills = input.GetExt<XmdsUnitSkillInfo>();
  1063. this.CardSkills = input.GetExt<XmdsUnitSkillInfo>();
  1064. this.BaseInfo = input.GetExt<XmdsUnitBaseInfo>();
  1065. this.AvatarList = input.GetList<XmdsAvatarInfo>(input.GetExt<XmdsAvatarInfo>);
  1066. this.PlayerEntered = input.GetBool();
  1067. this.UnitPKInfo = input.GetExt<PKInfo>();
  1068. this.UnitPetData = input.GetExt<PetData>();
  1069. this.UnitSceneInfo = input.GetExt<SceneInfo>();
  1070. }
  1071. }
  1072. #endregion
  1073. #region 人物基础信息.
  1074. [MessageType(0x9001004)]
  1075. [ExpandableAttribute]
  1076. public class XmdsUnitBaseInfo : IExternalizable, ICloneable
  1077. {
  1078. //职业.
  1079. public CommonAI.Data.XmdsUnitPro ProType = CommonAI.Data.XmdsUnitPro.None;
  1080. //等级.
  1081. public int UnitLv = 0;
  1082. //名字.
  1083. public string name = "";
  1084. //VIP等级.
  1085. public int VIPLv = 0;
  1086. //称号ID.
  1087. public int TitleID = 0;
  1088. //服务器ID.
  1089. public int ServerID = 0;
  1090. //公会ID.
  1091. public string GuildID = null;
  1092. //公会名字.
  1093. public string GuildName = null;
  1094. //阵营
  1095. public int force = 0;
  1096. //盟友阵营
  1097. public int alliesForce = 0;
  1098. //遗言.
  1099. public byte Testament = 0;
  1100. //进阶等级.
  1101. public byte StateLv = 0;
  1102. //玩家服务器id
  1103. public int logicServerId = 0;
  1104. //玩家性别,0男,1-女
  1105. public byte sex;
  1106. //角色唯一ID
  1107. public string uuid;
  1108. //仅服务器用,
  1109. // 药水加成
  1110. public float potionAddition = 0;
  1111. // 玩家职业
  1112. //特殊状态(悬赏.)
  1113. public CommonAI.XmdsConstConfig.SpecialState SPState = CommonAI.XmdsConstConfig.SpecialState.None;
  1114. public void WriteExternal(IOutputStream output)
  1115. {
  1116. output.PutEnum8(ProType);
  1117. output.PutS32(UnitLv);
  1118. output.PutUTF(name);
  1119. output.PutS32(VIPLv);
  1120. output.PutS32(TitleID);
  1121. output.PutS32(ServerID);
  1122. output.PutUTF(GuildID);
  1123. output.PutUTF(GuildName);
  1124. output.PutVS32(force);
  1125. output.PutU8(Testament);
  1126. output.PutU8(StateLv);
  1127. output.PutEnum8(SPState);
  1128. output.PutS32(logicServerId);
  1129. output.PutU8(sex);
  1130. output.PutUTF(uuid);
  1131. }
  1132. public void ReadExternal(IInputStream input)
  1133. {
  1134. ProType = input.GetEnum8<CommonAI.Data.XmdsUnitPro>();
  1135. UnitLv = input.GetS32();
  1136. name = input.GetUTF();
  1137. VIPLv = input.GetS32();
  1138. TitleID = input.GetS32();
  1139. ServerID = input.GetS32();
  1140. GuildID = input.GetUTF();
  1141. GuildName = input.GetUTF();
  1142. force = input.GetVS32();
  1143. Testament = input.GetU8();
  1144. StateLv = input.GetU8();
  1145. SPState = input.GetEnum8<CommonAI.XmdsConstConfig.SpecialState>();
  1146. logicServerId = input.GetS32();
  1147. sex = input.GetU8();
  1148. uuid = input.GetUTF();
  1149. }
  1150. public object Clone()
  1151. {
  1152. XmdsUnitBaseInfo ret = new XmdsUnitBaseInfo();
  1153. ret.ProType = this.ProType;
  1154. ret.UnitLv = this.UnitLv;
  1155. ret.name = this.name;
  1156. ret.VIPLv = this.VIPLv;
  1157. ret.TitleID = this.TitleID;
  1158. ret.ServerID = this.ServerID;
  1159. ret.GuildID = this.GuildID;
  1160. ret.GuildName = this.GuildName;
  1161. ret.force = this.force;
  1162. ret.Testament = this.Testament;
  1163. ret.StateLv = this.StateLv;
  1164. ret.SPState = this.SPState;
  1165. ret.logicServerId = this.logicServerId;
  1166. ret.sex = this.sex;
  1167. ret.potionAddition = this.potionAddition;
  1168. ret.uuid = this.uuid;
  1169. ret.alliesForce = this.alliesForce;
  1170. return ret;
  1171. }
  1172. }
  1173. #endregion
  1174. #region Avatar相关信息.
  1175. [MessageType(0x000B0010)]
  1176. [ExpandableAttribute]
  1177. public class XmdsAvatarInfo : IExternalizable
  1178. {
  1179. public enum XmdsAvatar
  1180. {
  1181. None,
  1182. R_Hand_Weapon,// 主武器挂载点.
  1183. R_Hand_Buff,//主武器特效挂载点.
  1184. L_Hand_Weapon,//副武器挂载点.
  1185. L_Hand_Buff,//副武器特效挂载点.
  1186. Head_Equipment,//头部时装挂载点.
  1187. Head_Buff,//头部特效挂载点.
  1188. Chest_Equipment,//胸部时装挂载点.
  1189. Chest_Buff,//胸背部特效挂载点.
  1190. Rear_Equipment,//背部时装挂载点.
  1191. Rear_Buff,//背部特效挂载点.
  1192. Foot_Equipment,//脚部时装挂载点.
  1193. Foot_Buff,//脚部特效挂载点.
  1194. Tail_Equipment,// 尾巴时装挂载点.
  1195. Tail_Buff,// 尾巴特效挂载点.
  1196. Avatar_Body,//身体.
  1197. Ride_Equipment //坐骑挂载点.
  1198. }
  1199. public XmdsAvatar PartTag = XmdsAvatar.None;
  1200. public string FileName = null;
  1201. public byte EffectType = 0;
  1202. public XmdsAvatarInfo() { }
  1203. public void WriteExternal(IOutputStream output)
  1204. {
  1205. output.PutS32((int)PartTag);
  1206. output.PutUTF(FileName);
  1207. output.PutU8(EffectType);
  1208. }
  1209. public void ReadExternal(IInputStream input)
  1210. {
  1211. PartTag = (XmdsAvatar)input.GetS32();
  1212. FileName = input.GetUTF();
  1213. EffectType = input.GetU8();
  1214. }
  1215. }
  1216. #endregion
  1217. #region 能力属性.
  1218. /// <summary>
  1219. /// 单位能力值.
  1220. /// </summary>
  1221. [MessageType(0x9001003)]
  1222. [Expandable]
  1223. public class XmdsUnitProp : ICloneable, IExternalizable
  1224. {
  1225. private const int DEFAULT_VALUE = -1;
  1226. public const float PER = 0.0001f;
  1227. /// <summary>
  1228. ///基础血量.
  1229. /// </summary>
  1230. public int BaseMaxHP = 0;
  1231. /// <summary>
  1232. /// 生命%
  1233. /// </summary>
  1234. public int HPPer;
  1235. /// <summary>
  1236. ///最大血量.
  1237. /// </summary>
  1238. public int MaxHP { get { return CUtils.CastInt((double)BaseMaxHP * (1.0f + HPPer * 0.0001f)); } }
  1239. /// <summary>
  1240. /// 当前血量.
  1241. /// </summary>
  1242. public int HP = 0;
  1243. /* ------------------------------------------------------------------------------------------------ */
  1244. /// <summary>
  1245. ///攻击基础值.
  1246. /// </summary>
  1247. public int BaseAttack = 0;
  1248. /// <summary>
  1249. /// 最大攻击%
  1250. /// </summary>
  1251. public int AttackPer;
  1252. /// <summary>
  1253. ///最大攻击
  1254. /// </summary>
  1255. public int MaxAttack { get { return CUtils.CastInt(BaseAttack * (1 + AttackPer * 0.0001f)); } }
  1256. /* ------------------------------------------------------------------------------------------------ */
  1257. /// <summary>
  1258. /// 基础防御
  1259. /// </summary>
  1260. public int BaseDefence;
  1261. /// <summary>
  1262. /// 按百分比增加防御
  1263. /// </summary>
  1264. public int DefencePer;
  1265. /// <summary>
  1266. /// 防御
  1267. /// </summary>
  1268. public int Defence { get { return CUtils.CastInt(BaseDefence * (1 + DefencePer * 0.0001f)); } }
  1269. /* ------------------------------------------------------------------------------------------------ */
  1270. /// <summary>
  1271. ///无视防御基础值(穿透)
  1272. /// </summary>
  1273. public int BaseIgnoreDefense;
  1274. /// <summary>
  1275. ///无视防御百分比(穿透)
  1276. /// </summary>
  1277. public int IgnoreDefensePer;
  1278. /// <summary>
  1279. ///无视防御(穿透)
  1280. /// </summary>
  1281. public int IgnoreDefense { get { return BaseIgnoreDefense; } }
  1282. /* ------------------------------------------------------------------------------------------------ */
  1283. /// <summary>
  1284. ///基础抗暴.
  1285. /// </summary>
  1286. public int BaseResCrit;
  1287. /// <summary>
  1288. /// 抗暴%
  1289. /// </summary>
  1290. public int ResCritPer;
  1291. /// <summary>
  1292. /// 抗暴.
  1293. /// </summary>
  1294. public int ResCrit { get { return CUtils.CastInt(BaseResCrit * (1 + ResCritPer * 0.0001f)); } }
  1295. /// <summary>
  1296. /// 抗暴率
  1297. /// </summary>
  1298. public int ResCritRate;
  1299. /* ------------------------------------------------------------------------------------------------ */
  1300. /// <summary>
  1301. /// 暴击率.
  1302. /// </summary>
  1303. public int CritRate;
  1304. /// <summary>
  1305. ///暴击伤害加成百分比
  1306. /// </summary>
  1307. public int CritDamage = 0;
  1308. /// <summary>
  1309. ///受到暴击伤害减少百分比
  1310. /// </summary>
  1311. public int CritDamageRes = 0;
  1312. /* ------------------------------------------------------------------------------------------------ */
  1313. /// <summary>
  1314. /// 玩家间伤害加成百分比
  1315. /// </summary>
  1316. public int PlayerDamageAdd;
  1317. /// <summary>
  1318. /// 玩家间受到伤害减免%
  1319. /// </summary>
  1320. public int PlayerDamageReduce;
  1321. /// <summary>
  1322. /// 所有控制效果包括减速、冻结、眩晕、禁锢等的时间,按百分比减少
  1323. /// </summary>
  1324. public int CtrlTimeReduce = 0;
  1325. /// <summary>
  1326. /// 所有技能的冷却时间减少百分比
  1327. /// </summary>
  1328. public int SkillCD = 0;
  1329. /// <summary>
  1330. ///血量恢复值.
  1331. ///</summary>
  1332. public int HPReborn = 0;
  1333. /// <summary>
  1334. ///血量恢复百分比
  1335. ///</summary>
  1336. public int HPRecoverPer = 0;
  1337. /// <summary>
  1338. /// 最终生命恢复值
  1339. /// </summary>
  1340. public int MaxHPReborn { get { return CUtils.CastInt(HPReborn * (1 + HPRecoverPer * 0.0001f)); } }
  1341. /// <summary>
  1342. ///治疗效果影响百分比.
  1343. /// </summary>
  1344. public int HealEffect = 0;
  1345. /// <summary>
  1346. ///受治疗效果影响百分比.
  1347. /// </summary>
  1348. public int HealedEffect = 0;
  1349. /// <summary>
  1350. ///移动速度.
  1351. /// </summary>
  1352. public float MoveSpeed = 0;
  1353. /// <summary>
  1354. ///速度加成(装备+坐骑的百分比加成).
  1355. /// </summary>
  1356. public int VelocityAddition = 0;
  1357. /// <summary>
  1358. /// 当前背包可用数量.
  1359. /// </summary>
  1360. public int CurInventorySize;
  1361. /// <summary>
  1362. /// 当前队伍背包数量.
  1363. /// </summary>
  1364. public int CurTeamInventorySize;
  1365. /// <summary>
  1366. /// 拾取范围,只在JJC生效,我也不知道是哪个SB想出来的
  1367. /// </summary>
  1368. public int pickupRange = 0;
  1369. /* ------------------------------------------------------------------------------------------------ */
  1370. /// <summary>
  1371. /// 技能伤害加成
  1372. /// </summary>
  1373. public int SkillDamageAdd = 0;
  1374. /// <summary>
  1375. /// 攻速, 正常10000,变化万分之N, 修改普攻的冷却缩减时间
  1376. /// </summary>
  1377. public int AttackSpeed;
  1378. /// <summary>
  1379. /// 控制增幅
  1380. /// </summary>
  1381. public int ControlUp;
  1382. /// <summary>
  1383. /// 神器伤害加成比
  1384. /// </summary>
  1385. public int ArtifactMainPer;
  1386. //元素攻击 & 防御 & 克制 & 抵御
  1387. public int [] ArtifactAttack = new int[5];
  1388. public int [] ArtifactDefense = new int[5];
  1389. /** 克制 */
  1390. public int [] ArtifactRestraint = new int[5];
  1391. /** 抵御 */
  1392. public int [] ArtifactResist = new int[5];
  1393. //boss伤害
  1394. public int ToBossCritRate;
  1395. public int ToBossCritDamage;
  1396. /// <summary>
  1397. /// 杀意,增加伤害百分比
  1398. /// </summary>
  1399. public int KillValuePer;
  1400. /// <summary>
  1401. /// 妖气等级
  1402. /// </summary>
  1403. public int YaoQiLevel;
  1404. /// <summary>
  1405. /// 普攻吸血
  1406. /// </summary>
  1407. public int NormalAtkLeech;
  1408. /// <summary>
  1409. /// 技能吸血
  1410. /// </summary>
  1411. public int ActiveAtkLeech;
  1412. //MMO-14631: 2121.3.23 FieldBossDamageAdd对全部怪物增伤
  1413. /// <summary>
  1414. /// 野外boss伤害增益 -> 【全部怪物增伤】
  1415. /// </summary>
  1416. public int monsterDamageAdd;
  1417. /// <summary>
  1418. /// MMO-14873: 2021.3.30 调整成怪物伤害减免
  1419. /// 副本小怪伤害增益 ->【怪物伤害减免】
  1420. /// </summary>
  1421. public int monsterDamageReduce;
  1422. //命格伤害加成
  1423. public int [] MonsterRestraint = new int[(int)UnitFateType.Five];
  1424. // 天命属性
  1425. public UnitFateType fateType;
  1426. public int fateValue;
  1427. //神器,背饰
  1428. public int ArtifactIndex = -1;
  1429. public int ArtifactDefenceIndex = -1;
  1430. //所有单位增伤,减伤
  1431. public int AllDmgAdd;
  1432. public int AllDmgReduce;
  1433. // 破定值
  1434. public int BreakShieldValue;
  1435. //定力值
  1436. public int ShieldValue;
  1437. //新增属性
  1438. public int monsterAtk; // 猎妖攻
  1439. public int monsterDef; // 猎妖防
  1440. public int monsterAtkPer; // 猎妖攻百分比
  1441. public int monsterDefPer; // 猎妖防百分比
  1442. //内部属性, CardWeight
  1443. public int[] cardWeight = new int[(int)CardType.Max+1];
  1444. public int MaxMonsterAttack { get { return CUtils.CastInt(monsterAtk * (1 + monsterAtkPer * 0.0001f)); } }
  1445. public int MaxMonsterDef { get { return CUtils.CastInt(monsterDef * (1 + monsterDefPer * 0.0001f)); } }
  1446. ///////////////////////////////////////////////////////////////////////////////////////////
  1447. /// 为实现技能或者buff特殊逻辑,加上的特殊字段
  1448. public int NormalAtkCriteRate; //普攻暴击几率
  1449. ///////////////////////////////////////////////////////////////////////////////////////////
  1450. //获取攻击力
  1451. public int GetFinalAttack(bool isMonster)
  1452. {
  1453. if (isMonster)
  1454. {
  1455. return MaxAttack + MaxMonsterAttack;
  1456. }
  1457. else
  1458. {
  1459. return MaxAttack;
  1460. }
  1461. }
  1462. public object Clone()
  1463. {
  1464. XmdsUnitProp ret = new XmdsUnitProp();
  1465. ret.BaseMaxHP = this.BaseMaxHP;
  1466. ret.HPPer = this.HPPer;
  1467. ret.HP = this.HP;
  1468. ret.BaseAttack = this.BaseAttack;
  1469. ret.AttackPer = this.AttackPer;
  1470. ret.BaseDefence = this.BaseDefence;
  1471. ret.DefencePer = this.DefencePer;
  1472. ret.BaseIgnoreDefense = this.BaseIgnoreDefense;
  1473. ret.IgnoreDefensePer = this.IgnoreDefensePer;
  1474. ret.BaseResCrit = this.BaseResCrit;
  1475. ret.ResCritPer = this.ResCritPer;
  1476. ret.ResCritRate = this.ResCritRate;
  1477. ret.CritRate = this.CritRate;
  1478. ret.CritDamage = this.CritDamage;
  1479. ret.CritDamageRes = this.CritDamageRes;
  1480. ret.PlayerDamageAdd = this.PlayerDamageAdd;
  1481. ret.PlayerDamageReduce = this.PlayerDamageReduce;
  1482. ret.CtrlTimeReduce = this.CtrlTimeReduce;
  1483. ret.SkillCD = this.SkillCD;
  1484. ret.HPReborn = this.HPReborn;
  1485. ret.HPRecoverPer = this.HPRecoverPer;
  1486. ret.HealEffect = this.HealEffect;
  1487. ret.HealedEffect = this.HealedEffect;
  1488. ret.MoveSpeed = this.MoveSpeed;
  1489. ret.VelocityAddition = this.VelocityAddition;
  1490. ret.CurInventorySize = this.CurInventorySize;
  1491. ret.CurTeamInventorySize = this.CurTeamInventorySize;
  1492. ret.pickupRange = this.pickupRange;
  1493. ret.SkillDamageAdd = this.SkillDamageAdd;
  1494. ret.AttackSpeed = this.AttackSpeed;
  1495. ret.ControlUp = this.ControlUp;
  1496. ret.ArtifactMainPer = this.ArtifactMainPer;
  1497. //元素攻击 & 防御 & 克制 & 抵御
  1498. ret.ArtifactAttack = (int[])this.ArtifactAttack.Clone();
  1499. ret.ArtifactDefense = (int[])this.ArtifactDefense.Clone();
  1500. ret.ArtifactRestraint = (int[])this.ArtifactRestraint.Clone();
  1501. ret.ArtifactResist = (int[])this.ArtifactResist.Clone();
  1502. ret.ToBossCritRate = this.ToBossCritRate;
  1503. ret.ToBossCritDamage = this.ToBossCritDamage;
  1504. ret.KillValuePer = this.KillValuePer;
  1505. ret.YaoQiLevel = this.YaoQiLevel;
  1506. ret.NormalAtkLeech = this.NormalAtkLeech;
  1507. ret.ActiveAtkLeech = this.ActiveAtkLeech;
  1508. ret.monsterDamageAdd = this.monsterDamageAdd;
  1509. ret.monsterDamageReduce = this.monsterDamageReduce;
  1510. ret.fateType = this.fateType;
  1511. ret.fateValue = this.fateValue;
  1512. ret.ArtifactIndex = this.ArtifactIndex;
  1513. ret.ArtifactDefenceIndex = this.ArtifactDefenceIndex;
  1514. ret.AllDmgAdd = this.AllDmgAdd;
  1515. ret.AllDmgReduce = this.AllDmgReduce;
  1516. for (int i = 0; i < (int)UnitFateType.Five; i++)
  1517. {
  1518. ret.MonsterRestraint[i] = this.MonsterRestraint[i];
  1519. }
  1520. ret.BreakShieldValue = this.BreakShieldValue;
  1521. ret.ShieldValue = this.ShieldValue;
  1522. ret.monsterAtk = this.monsterAtk;
  1523. ret.monsterDef = this.monsterDef;
  1524. ret.monsterAtkPer = this.monsterAtkPer;
  1525. ret.monsterDefPer = this.monsterDefPer;
  1526. for(int i = 0; i < cardWeight.Length; i++)
  1527. {
  1528. ret.cardWeight[i] = this.cardWeight[i];
  1529. }
  1530. return ret;
  1531. }
  1532. public void AddTo(XmdsUnitProp prop)
  1533. {
  1534. this.BaseMaxHP += prop.BaseMaxHP;
  1535. this.HPPer += prop.HPPer;
  1536. this.HP += prop.HP;
  1537. this.BaseAttack += prop.BaseAttack;
  1538. this.AttackPer += prop.AttackPer;
  1539. this.BaseDefence += prop.BaseDefence;
  1540. this.DefencePer += prop.DefencePer;
  1541. this.BaseIgnoreDefense += prop.BaseIgnoreDefense;
  1542. this.IgnoreDefensePer += prop.IgnoreDefensePer;
  1543. this.BaseResCrit += prop.BaseResCrit;
  1544. this.ResCritPer += prop.ResCritPer;
  1545. this.ResCritRate += prop.ResCritRate;
  1546. this.CritRate += prop.CritRate;
  1547. this.CritDamage += prop.CritDamage;
  1548. this.CritDamageRes += prop.CritDamageRes;
  1549. this.PlayerDamageAdd += prop.PlayerDamageAdd;
  1550. this.PlayerDamageReduce += prop.PlayerDamageReduce;
  1551. this.CtrlTimeReduce += prop.CtrlTimeReduce;
  1552. this.SkillCD += prop.SkillCD;
  1553. this.HPReborn += prop.HPReborn;
  1554. this.HPRecoverPer += prop.HPRecoverPer;
  1555. this.HealEffect += prop.HealEffect;
  1556. this.HealedEffect += prop.HealedEffect;
  1557. this.MoveSpeed += prop.MoveSpeed;
  1558. this.VelocityAddition += prop.VelocityAddition;
  1559. this.CurInventorySize += prop.CurInventorySize;
  1560. this.CurTeamInventorySize += prop.CurTeamInventorySize;
  1561. this.pickupRange += prop.pickupRange;
  1562. this.SkillDamageAdd += prop.SkillDamageAdd;
  1563. this.AttackSpeed += prop.AttackSpeed;
  1564. this.ControlUp += prop.ControlUp;
  1565. this.ArtifactMainPer += prop.ArtifactMainPer;
  1566. //元素攻击 & 防御 & 克制 & 抵御
  1567. for(int i = 0; i < 5; i++)
  1568. {
  1569. this.ArtifactAttack[i] += prop.ArtifactAttack[i];
  1570. this.ArtifactDefense[i] += prop.ArtifactDefense[i];
  1571. this.ArtifactRestraint[i] += prop.ArtifactRestraint[i];
  1572. this.ArtifactResist[i] += prop.ArtifactResist[i];
  1573. }
  1574. this.ToBossCritRate += prop.ToBossCritRate;
  1575. this.ToBossCritDamage += prop.ToBossCritDamage;
  1576. this.KillValuePer += prop.KillValuePer;
  1577. this.YaoQiLevel += prop.YaoQiLevel;
  1578. this.NormalAtkLeech += prop.NormalAtkLeech;
  1579. this.ActiveAtkLeech += prop.ActiveAtkLeech;
  1580. this.monsterDamageAdd += prop.monsterDamageAdd;
  1581. this.monsterDamageReduce += prop.monsterDamageReduce;
  1582. this.AllDmgAdd += prop.AllDmgAdd;
  1583. this.AllDmgReduce += prop.AllDmgReduce;
  1584. for (int i = 0; i < (int)UnitFateType.Five; i++)
  1585. {
  1586. this.MonsterRestraint[i] += prop.MonsterRestraint[i];
  1587. }
  1588. this.BreakShieldValue += prop.BreakShieldValue;
  1589. this.ShieldValue += prop.ShieldValue;
  1590. //猎妖值
  1591. this.monsterAtk += prop.monsterAtk;
  1592. this.monsterDef += prop.monsterDef;
  1593. this.monsterAtkPer += prop.monsterAtkPer;
  1594. this.monsterDefPer += prop.monsterDefPer;
  1595. for (int i = 0; i < cardWeight.Length; i++)
  1596. {
  1597. this.cardWeight[i] += prop.cardWeight[i];
  1598. }
  1599. }
  1600. public void WriteExternal(IOutputStream output)
  1601. {
  1602. output.PutS32(this.BaseMaxHP);
  1603. output.PutS32(this.HPPer);
  1604. output.PutS32(this.HP);
  1605. output.PutS32(this.BaseAttack);
  1606. output.PutS32(this.AttackPer);
  1607. output.PutS32(this.BaseDefence);
  1608. output.PutS32(this.DefencePer);
  1609. output.PutS32(this.BaseIgnoreDefense);
  1610. output.PutS32(this.IgnoreDefensePer);
  1611. output.PutS32(this.CritRate);
  1612. output.PutS32(this.BaseResCrit);
  1613. output.PutS32(this.ResCritPer);
  1614. output.PutS32(this.ResCritRate);
  1615. output.PutS32(this.CritDamage);
  1616. output.PutS32(this.CritDamageRes);
  1617. output.PutS32(this.PlayerDamageAdd);
  1618. output.PutS32(this.PlayerDamageReduce);
  1619. output.PutS32(this.CtrlTimeReduce);
  1620. output.PutS32(this.SkillCD);
  1621. output.PutS32(this.HPReborn);
  1622. output.PutS32(this.HealEffect);
  1623. output.PutS32(this.HealedEffect);
  1624. output.PutF32(this.MoveSpeed);
  1625. output.PutS32(this.VelocityAddition);
  1626. output.PutS32(this.CurInventorySize);
  1627. output.PutS32(this.CurTeamInventorySize);
  1628. output.PutS32(this.pickupRange);
  1629. output.PutS32(this.SkillDamageAdd);
  1630. output.PutS32(this.AttackSpeed);
  1631. output.PutS32(this.ControlUp);
  1632. output.PutS32(this.ArtifactMainPer);
  1633. for(int i = 0; i < 5; i++)
  1634. {
  1635. output.PutS32(this.ArtifactAttack[i]);
  1636. output.PutS32(this.ArtifactDefense[i]);
  1637. output.PutS32(this.ArtifactRestraint[i]);
  1638. output.PutS32(this.ArtifactResist[i]);
  1639. }
  1640. output.PutS32(this.ToBossCritRate);
  1641. output.PutS32(this.ToBossCritDamage);
  1642. output.PutS32(this.KillValuePer);
  1643. output.PutS32(this.YaoQiLevel);
  1644. output.PutS32(this.NormalAtkLeech);
  1645. output.PutS32(this.ActiveAtkLeech);
  1646. for (int i = 0; i < (int)UnitFateType.Five; i++)
  1647. {
  1648. output.PutS32(this.MonsterRestraint[i]);
  1649. }
  1650. output.PutS32(this.BreakShieldValue);
  1651. // 猎妖值
  1652. output.PutS32(this.monsterAtk);
  1653. output.PutS32(this.monsterDef);
  1654. output.PutS32(this.monsterAtkPer);
  1655. output.PutS32(this.monsterDefPer);
  1656. //for (int i = 0; i < cardWeight.Length; i++)
  1657. //{
  1658. // output.PutS32(this.cardWeight[i]);
  1659. //}
  1660. }
  1661. public void ReadExternal(IInputStream input)
  1662. {
  1663. this.BaseMaxHP = input.GetS32();
  1664. this.HPPer = input.GetS32();
  1665. this.HP = input.GetS32();
  1666. this.BaseAttack = input.GetS32();
  1667. this.AttackPer = input.GetS32();
  1668. this.BaseDefence = input.GetS32();
  1669. this.DefencePer = input.GetS32();
  1670. this.BaseIgnoreDefense = input.GetS32();
  1671. this.IgnoreDefensePer = input.GetS32();
  1672. this.CritRate = input.GetS32();
  1673. this.BaseResCrit = input.GetS32();
  1674. this.ResCritPer = input.GetS32();
  1675. this.ResCritRate = input.GetS32();
  1676. this.CritDamage = input.GetS32();
  1677. this.CritDamageRes = input.GetS32();
  1678. this.PlayerDamageAdd = input.GetS32();
  1679. this.PlayerDamageReduce = input.GetS32();
  1680. this.CtrlTimeReduce = input.GetS32();
  1681. this.SkillCD = input.GetS32();
  1682. this.HPReborn = input.GetS32();
  1683. this.HealEffect = input.GetS32();
  1684. this.HealedEffect = input.GetS32();
  1685. this.MoveSpeed = input.GetF32();
  1686. this.VelocityAddition = input.GetS32();
  1687. this.CurInventorySize = input.GetS32();
  1688. this.CurTeamInventorySize = input.GetS32();
  1689. this.pickupRange = input.GetS32();
  1690. this.SkillDamageAdd = input.GetS32();
  1691. this.AttackSpeed = input.GetS32();
  1692. this.ControlUp = input.GetS32();
  1693. this.ArtifactMainPer = input.GetS32();
  1694. for (int i = 0; i < 5; i++)
  1695. {
  1696. this.ArtifactAttack[i] = input.GetS32();
  1697. this.ArtifactDefense[i] = input.GetS32();
  1698. this.ArtifactRestraint[i] = input.GetS32();
  1699. this.ArtifactResist[i] = input.GetS32();
  1700. }
  1701. this.ToBossCritRate = input.GetS32();
  1702. this.ToBossCritDamage = input.GetS32();
  1703. this.KillValuePer = input.GetS32();
  1704. this.YaoQiLevel = input.GetS32();
  1705. this.NormalAtkLeech = input.GetS32();
  1706. this.ActiveAtkLeech = input.GetS32();
  1707. for (int i = 0; i < (int)UnitFateType.Five; i++)
  1708. {
  1709. this.MonsterRestraint[i] = input.GetS32();
  1710. }
  1711. this.BreakShieldValue = input.GetS32();
  1712. // 猎妖值
  1713. this.monsterAtk = input.GetS32();
  1714. this.monsterDef = input.GetS32();
  1715. this.monsterAtkPer = input.GetS32();
  1716. this.monsterDefPer = input.GetS32();
  1717. //for (int i = 0; i < cardWeight.Length; i++)
  1718. //{
  1719. // this.cardWeight[i] = input.GetS32();
  1720. //}
  1721. }
  1722. }
  1723. #endregion
  1724. #region 单位技能信息集合.
  1725. /// <summary>
  1726. /// 单位技能信息集合.
  1727. /// </summary>
  1728. [MessageType(0x9001002)]
  1729. [ExpandableAttribute]
  1730. public class XmdsUnitSkillInfo : ICloneable, IExternalizable
  1731. {
  1732. public List<GameSkill> UnitSkills = null;
  1733. public XmdsUnitSkillInfo()
  1734. {
  1735. }
  1736. public object Clone()
  1737. {
  1738. XmdsUnitSkillInfo ret = new XmdsUnitSkillInfo();
  1739. ret.UnitSkills = CUtils.CloneList<GameSkill>(this.UnitSkills);
  1740. return ret;
  1741. }
  1742. public void WriteExternal(IOutputStream output)
  1743. {
  1744. output.PutList<GameSkill>(this.UnitSkills, output.PutExt);
  1745. }
  1746. public void ReadExternal(IInputStream input)
  1747. {
  1748. this.UnitSkills = input.GetList<GameSkill>(input.GetExt<GameSkill>);
  1749. }
  1750. }
  1751. [MessageType(0x9001005)]
  1752. [ExpandableAttribute]
  1753. public class GameSkill : ICloneable, IExternalizable
  1754. {
  1755. //默认为主动技能.
  1756. public XmdsSkillType SkillType = XmdsSkillType.active;
  1757. //技能ID.
  1758. public int SkillID = 0;
  1759. //技能等级.
  1760. public int SkillLevel = 1;
  1761. //天赋技能等级.
  1762. //斩妖特殊含义:冷却时间减少,触发几率增加,持续时间增加
  1763. //天书:1:灵珠伤害加成
  1764. public int TalentSkillLevel1 = 1;
  1765. public int TalentSkillLevel2 = 1;
  1766. public int TalentSkillLevel3 = 1;
  1767. //技能到期时间戳.
  1768. public long SkillTimestampMS = 0;
  1769. //CD时间变更万分比.
  1770. public int SkillCDDecreasePercent = 0;
  1771. //是否允许自动释放.
  1772. public bool AutoLaunch = true;
  1773. //战斗命中人数
  1774. public HashMap<uint, int> mHitUnits = new HashMap<uint, int>();
  1775. public GameSkill() { }
  1776. public GameSkill(int skillId)
  1777. {
  1778. this.SkillID = skillId;
  1779. }
  1780. public GameSkill(int skillId, XmdsSkillType type, bool autoLaunch = true)
  1781. {
  1782. this.SkillID = skillId;
  1783. this.SkillType = type;
  1784. this.AutoLaunch = autoLaunch;
  1785. }
  1786. // 被动只有一个等级
  1787. public int GetPassiveLevel()
  1788. {
  1789. return this.SkillLevel + this.TalentSkillLevel1;
  1790. }
  1791. public object Clone()
  1792. {
  1793. GameSkill ret = new GameSkill();
  1794. ret.SkillID = this.SkillID;
  1795. ret.SkillLevel = this.SkillLevel;
  1796. ret.SkillType = this.SkillType;
  1797. ret.TalentSkillLevel1 = this.TalentSkillLevel1;
  1798. ret.TalentSkillLevel2 = this.TalentSkillLevel2;
  1799. ret.TalentSkillLevel3 = this.TalentSkillLevel3;
  1800. ret.SkillTimestampMS = this.SkillTimestampMS;
  1801. ret.SkillCDDecreasePercent = this.SkillCDDecreasePercent;
  1802. ret.AutoLaunch = this.AutoLaunch;
  1803. return ret;
  1804. }
  1805. public void WriteExternal(IOutputStream output)
  1806. {
  1807. output.PutS32(SkillID);
  1808. output.PutS32(SkillLevel);
  1809. output.PutEnum8(SkillType);
  1810. output.PutS32(TalentSkillLevel1);
  1811. output.PutS64(SkillTimestampMS);
  1812. output.PutS32(SkillCDDecreasePercent);
  1813. output.PutBool(AutoLaunch);
  1814. }
  1815. public void ReadExternal(IInputStream input)
  1816. {
  1817. this.SkillID = input.GetS32();
  1818. this.SkillLevel = input.GetS32();
  1819. this.SkillType = input.GetEnum8<XmdsSkillType>();
  1820. this.TalentSkillLevel1 = input.GetS32();
  1821. this.SkillTimestampMS = input.GetS64();
  1822. this.SkillCDDecreasePercent = input.GetS32();
  1823. this.AutoLaunch = input.GetBool();
  1824. }
  1825. }
  1826. [Desc("施法区域提示")]
  1827. [MessageType(0x900100A)]
  1828. [ExpandableAttribute]
  1829. public class XmdsSkillLaunchModeData : ICloneable, IExternalizable
  1830. {
  1831. public enum XmdsSkillLaunchMode : byte
  1832. {
  1833. [Desc("普通模式")]
  1834. Mode_None,
  1835. [Desc("箭头模式")]
  1836. Mode_Arrow,
  1837. [Desc("扇形模式")]
  1838. Mode_Fan,
  1839. [Desc("区域模式")]
  1840. Mode_Area,
  1841. [Desc("缠绕")]
  1842. Mode_Twine,
  1843. }
  1844. [Desc("施法模式")]
  1845. public XmdsSkillLaunchMode Mode = XmdsSkillLaunchMode.Mode_None;
  1846. [Desc("技能范围半径")]
  1847. public float Shape_Radius = 0;
  1848. [Desc("箭头模式下代表箭头宽度")]
  1849. public float Shape_Width = 0;
  1850. [Desc("扇形模式下代表扇形展开范围")]
  1851. public int Shape_Angle = 0;
  1852. [Desc("施放点和单位中心点偏移距离")]
  1853. public float Shape_LaunchCenterOffset = 0;
  1854. [Desc("缠绕非中心圆的长")]
  1855. public float TwineNotCircleLength = 0;
  1856. [Desc("缠绕非中心圆的宽")]
  1857. public float TwineNotCircleWidth = 0;
  1858. [Desc("缠绕中心圆的缩放比")]
  1859. public float TwineCircleScale = 0;
  1860. [Desc("显示施法引导")]
  1861. public bool ShowLaunchGuide = false;
  1862. public object Clone()
  1863. {
  1864. XmdsSkillLaunchModeData ret = new XmdsSkillLaunchModeData();
  1865. ret.Mode = this.Mode;
  1866. ret.Shape_Radius = this.Shape_Radius;
  1867. ret.Shape_Angle = this.Shape_Angle;
  1868. ret.Shape_Width = this.Shape_Width;
  1869. ret.Shape_LaunchCenterOffset = this.Shape_LaunchCenterOffset;
  1870. ret.TwineNotCircleLength = this.TwineNotCircleLength;
  1871. ret.TwineNotCircleWidth = this.TwineNotCircleWidth;
  1872. ret.TwineCircleScale = this.TwineCircleScale;
  1873. ret.ShowLaunchGuide = this.ShowLaunchGuide;
  1874. return ret;
  1875. }
  1876. public void WriteExternal(IOutputStream output)
  1877. {
  1878. output.PutEnum8(Mode);
  1879. output.PutF32(Shape_Radius);
  1880. output.PutS32(Shape_Angle);
  1881. output.PutF32(Shape_Width);
  1882. output.PutF32(Shape_LaunchCenterOffset);
  1883. output.PutF32(TwineNotCircleLength);
  1884. output.PutF32(TwineNotCircleWidth);
  1885. output.PutF32(TwineCircleScale);
  1886. output.PutBool(ShowLaunchGuide);
  1887. }
  1888. public void ReadExternal(IInputStream input)
  1889. {
  1890. Mode = input.GetEnum8<XmdsSkillLaunchMode>();
  1891. Shape_Radius = input.GetF32();
  1892. Shape_Angle = input.GetS32();
  1893. Shape_Width = input.GetF32();
  1894. Shape_LaunchCenterOffset = input.GetF32();
  1895. TwineNotCircleLength = input.GetF32();
  1896. TwineNotCircleWidth = input.GetF32();
  1897. TwineCircleScale = input.GetF32();
  1898. ShowLaunchGuide = input.GetBool();
  1899. }
  1900. }
  1901. #endregion
  1902. #region PK相关数据.
  1903. /// <summary>
  1904. /// 单位PK信息..
  1905. /// </summary>
  1906. [MessageType(0x9001010)]
  1907. [ExpandableAttribute]
  1908. public class PKInfo : ICloneable, IExternalizable
  1909. {
  1910. //当前PK等级.
  1911. public PKLevel CurPKLevel = PKLevel.White;
  1912. //当前PK模式.
  1913. public PKMode CurPKMode = PKMode.Peace;
  1914. //当前PK值.
  1915. public int CurPKValue = 0;
  1916. public object Clone()
  1917. {
  1918. PKInfo ret = new PKInfo();
  1919. ret.CurPKLevel = this.CurPKLevel;
  1920. ret.CurPKMode = this.CurPKMode;
  1921. ret.CurPKValue = this.CurPKValue;
  1922. return ret;
  1923. }
  1924. public void ReadExternal(IInputStream input)
  1925. {
  1926. this.CurPKLevel = input.GetEnum8<PKLevel>();
  1927. this.CurPKMode = input.GetEnum8<PKMode>();
  1928. this.CurPKValue = input.GetS32();
  1929. }
  1930. public void WriteExternal(IOutputStream output)
  1931. {
  1932. output.PutEnum8(CurPKLevel);
  1933. output.PutEnum8(CurPKMode);
  1934. output.PutS32(CurPKValue);
  1935. }
  1936. }
  1937. #endregion
  1938. #region Buff容器.
  1939. public abstract class XmdsBuffVirtual : IDisposable
  1940. {
  1941. private static AtomicInteger s_alloc_object_count = new AtomicInteger(0);
  1942. private static AtomicInteger s_active_object_count = new AtomicInteger(0);
  1943. public static int AllocCount { get { return s_alloc_object_count.Value; } }
  1944. public static int ActiveCount { get { return s_active_object_count.Value; } }
  1945. private bool mDisposed = false;
  1946. public XmdsBuffVirtual()
  1947. {
  1948. s_alloc_object_count++;
  1949. s_active_object_count++;
  1950. }
  1951. ~XmdsBuffVirtual()
  1952. {
  1953. s_alloc_object_count--;
  1954. }
  1955. public void Dispose()
  1956. {
  1957. if (mDisposed) { return; }
  1958. mDisposed = true;
  1959. OnDispose();
  1960. s_active_object_count--;
  1961. }
  1962. protected virtual void OnDispose() { }
  1963. }
  1964. #endregion
  1965. #region 任务数据.
  1966. [MessageType(0x9001008)]
  1967. [ExpandableAttribute]
  1968. public class QuestAttribute : ICloneable, IExternalizable
  1969. {
  1970. public string Key;
  1971. public string Value;
  1972. public void WriteExternal(IOutputStream output)
  1973. {
  1974. output.PutUTF(Key);
  1975. output.PutUTF(Value);
  1976. }
  1977. public void ReadExternal(IInputStream input)
  1978. {
  1979. this.Key = input.GetUTF();
  1980. this.Value = input.GetUTF();
  1981. }
  1982. public object Clone()
  1983. {
  1984. QuestAttribute ret = new QuestAttribute();
  1985. ret.Key = this.Key;
  1986. ret.Value = this.Value;
  1987. return ret;
  1988. }
  1989. }
  1990. [MessageType(0x9001007)]
  1991. [ExpandableAttribute]
  1992. public class XmdsQuestData : ICloneable, IExternalizable
  1993. {
  1994. /// <summary>
  1995. /// 任务ID.
  1996. /// </summary>
  1997. [DescAttribute("任务ID")]
  1998. public string TaskID = null;
  1999. /// <summary>
  2000. /// 任务状态.
  2001. /// </summary>
  2002. [DescAttribute("任务状态")]
  2003. public string TaskState = null;
  2004. public List<QuestAttribute> Attributes = null;
  2005. //子状态, 1: 任务目标已达成
  2006. public static readonly string Attribute_SubState = "state";
  2007. //任务类型
  2008. public static readonly string Attribute_TaskType = "type";
  2009. //目标ID
  2010. public static readonly string Attribute_TargetId = "targetId";
  2011. //目标场景
  2012. public static readonly string Attribute_AreaId = "areaId";
  2013. //目标路点
  2014. public static readonly string Attribute_PointId = "pointId";
  2015. //任务完成目标的需求数量
  2016. //public static readonly string Attribute_TargetNum = "targetNum";
  2017. //任务进度
  2018. //public static readonly string Attribute_Progress = "progress";
  2019. //添加任务进度数量
  2020. public static readonly string Attribute_AddProgress = "add_progress";
  2021. //自定义属性,表示战斗服接收游戏服初始数据完成
  2022. public static readonly string Attribute_InitOK = "INIT_OK";
  2023. public enum TaskType : int
  2024. {
  2025. Kill = 1,
  2026. InterActiveUnit = 2,
  2027. InterActiveItem = 3,
  2028. Got = 4,
  2029. Convoy = 5, //护送
  2030. Guard = 6, //守护
  2031. Area = 7, //到达指定区域
  2032. KillPlayer = 8, //杀人
  2033. Challenge = 25, //挑战
  2034. ConqueringtheDemons = 26, //伏魔
  2035. Steal = 27, //偷窃
  2036. RefineSoul = 28, //炼魂
  2037. CatchPet = 29, //抓宠
  2038. Treasure = 30, //寻宝
  2039. }
  2040. public static int GetTaskTypeByString(string typeValue)
  2041. {
  2042. int ret = 0;
  2043. int.TryParse(typeValue, out ret);
  2044. return ret;
  2045. }
  2046. public static int GetTaskType(QuestData qData)
  2047. {
  2048. string taskType = qData.Attributes.Get(XmdsQuestData.Attribute_TaskType);
  2049. return GetTaskTypeByString(taskType);
  2050. }
  2051. public static int GetTargetSceneID(QuestData qData)
  2052. {
  2053. string areaId = qData.Attributes.Get(XmdsQuestData.Attribute_AreaId);
  2054. int result = 0;
  2055. if (!string.IsNullOrEmpty(areaId))
  2056. {
  2057. Int32.TryParse(areaId, out result);
  2058. }
  2059. return result;
  2060. }
  2061. public static string GetTargetScenePoint(QuestData qData)
  2062. {
  2063. return qData.Attributes.Get(XmdsQuestData.Attribute_PointId);
  2064. }
  2065. public static string GetTarget(QuestData qData)
  2066. {
  2067. return qData.Attributes.Get(XmdsQuestData.Attribute_TargetId);
  2068. }
  2069. /// <summary>
  2070. /// 获取目标总数量
  2071. /// </summary>
  2072. /// <param name="qData"></param>
  2073. /// <returns></returns>
  2074. //public static int GetTargetQuantity(QuestData qData)
  2075. //{
  2076. // string str = qData.Attributes.Get(QuestData.Attribute_TargetNum);
  2077. // int result = 0;
  2078. // if (!string.IsNullOrEmpty(str))
  2079. // {
  2080. // Int32.TryParse(str, out result);
  2081. // }
  2082. // return result;
  2083. //}
  2084. /// <summary>
  2085. /// 获取进度
  2086. /// </summary>
  2087. /// <param name="qData"></param>
  2088. /// <returns></returns>
  2089. //public static int GetProgress(QuestData qData)
  2090. //{
  2091. // string str = qData.Attributes.Get(QuestData.Attribute_Progress);
  2092. // int result = 0;
  2093. // if (!string.IsNullOrEmpty(str))
  2094. // {
  2095. // Int32.TryParse(str, out result);
  2096. // }
  2097. // return result;
  2098. //}
  2099. public static int GetTargetID(QuestData qData)
  2100. {
  2101. string targetId = qData.Attributes.Get(XmdsQuestData.Attribute_TargetId);
  2102. int result = 0;
  2103. if (!string.IsNullOrEmpty(targetId))
  2104. {
  2105. Int32.TryParse(targetId, out result);
  2106. }
  2107. return result;
  2108. }
  2109. /// <summary>
  2110. /// 返回任务目标是否已达成
  2111. /// </summary>
  2112. public static bool IsTargetComplete(QuestData qData)
  2113. {
  2114. string state = qData.Attributes.Get(XmdsQuestData.Attribute_SubState);
  2115. return (!string.IsNullOrEmpty(state) && state == "1");
  2116. }
  2117. public void AddAttribute(string key, string value)
  2118. {
  2119. if (Attributes == null)
  2120. {
  2121. Attributes = new List<QuestAttribute>();
  2122. }
  2123. QuestAttribute attr = new QuestAttribute();
  2124. attr.Key = key;
  2125. attr.Value = value;
  2126. Attributes.Add(attr);
  2127. }
  2128. public void WriteExternal(IOutputStream output)
  2129. {
  2130. output.PutUTF(TaskID);
  2131. output.PutUTF(TaskState);
  2132. output.PutList<QuestAttribute>(this.Attributes, output.PutExt);
  2133. }
  2134. public void ReadExternal(IInputStream input)
  2135. {
  2136. this.TaskID = input.GetUTF();
  2137. this.TaskState = input.GetUTF();
  2138. this.Attributes = input.GetList<QuestAttribute>(input.GetExt<QuestAttribute>);
  2139. }
  2140. public object Clone()
  2141. {
  2142. XmdsQuestData ret = new XmdsQuestData();
  2143. ret.TaskID = this.TaskID;
  2144. ret.TaskState = this.TaskState;
  2145. return ret;
  2146. }
  2147. }
  2148. [MessageType(0x9001009)]
  2149. [ExpandableAttribute]
  2150. public class XmdsQuestFlag : ICloneable, IExternalizable
  2151. {
  2152. public string FlagName = "flag_name";
  2153. public string FlagValue = null;
  2154. public void WriteExternal(IOutputStream output)
  2155. {
  2156. output.PutUTF(FlagName);
  2157. output.PutUTF(FlagValue);
  2158. }
  2159. public void ReadExternal(IInputStream input)
  2160. {
  2161. this.FlagName = input.GetUTF();
  2162. this.FlagValue = input.GetUTF();
  2163. }
  2164. public object Clone()
  2165. {
  2166. XmdsQuestFlag ret = new XmdsQuestFlag();
  2167. ret.FlagName = this.FlagName;
  2168. ret.FlagValue = this.FlagValue;
  2169. return ret;
  2170. }
  2171. public override string ToString()
  2172. {
  2173. return FlagName + " = " + FlagValue;
  2174. }
  2175. }
  2176. #endregion
  2177. #region 宠物相关
  2178. [MessageType(0x9001011)]
  2179. [ExpandableAttribute]
  2180. public class PetData : ICloneable, IExternalizable
  2181. {
  2182. //宠物配置信息.
  2183. public XmdsPetConifg PetConfig = null;
  2184. //基础信息.
  2185. public PetBaseInfo BaseInfo = null;
  2186. //能力属性.
  2187. public XmdsUnitProp UnitProp = null;
  2188. //技能信息.
  2189. public XmdsUnitSkillInfo SkillInfo = null;
  2190. public object Clone()
  2191. {
  2192. PetData ret = new PetData();
  2193. if (this.BaseInfo != null)
  2194. ret.BaseInfo = (PetBaseInfo)this.BaseInfo.Clone();
  2195. if (this.UnitProp != null)
  2196. ret.UnitProp = (XmdsUnitProp)this.UnitProp.Clone();
  2197. if (SkillInfo != null)
  2198. ret.SkillInfo = (XmdsUnitSkillInfo)this.SkillInfo.Clone();
  2199. if (PetConfig != null)
  2200. ret.PetConfig = (XmdsPetConifg)this.PetConfig.Clone();
  2201. return ret;
  2202. }
  2203. public void ReadExternal(IInputStream input)
  2204. {
  2205. BaseInfo = input.GetExt<PetBaseInfo>();
  2206. UnitProp = input.GetExt<XmdsUnitProp>();
  2207. SkillInfo = input.GetExt<XmdsUnitSkillInfo>();
  2208. PetConfig = input.GetExt<XmdsPetConifg>();
  2209. }
  2210. public void WriteExternal(IOutputStream output)
  2211. {
  2212. output.PutExt(BaseInfo);
  2213. output.PutExt(UnitProp);
  2214. output.PutExt(SkillInfo);
  2215. output.PutExt(PetConfig);
  2216. }
  2217. }
  2218. /// <summary>
  2219. /// 基础信息.
  2220. /// </summary>
  2221. [MessageType(0x9001012)]
  2222. [ExpandableAttribute]
  2223. public class PetBaseInfo : ICloneable, IExternalizable
  2224. {
  2225. //名字.
  2226. public string name = "揍我啊";
  2227. //等级.
  2228. public int level = 1;
  2229. //品质.
  2230. public byte QColor = 1;
  2231. //模型.
  2232. public string AvatarModel = "23101_rabbit";
  2233. //模型缩放比例.
  2234. public int AvatarModelScale = 70;
  2235. //特效模型.
  2236. public string EffectModel = "vfx_pet_illusion_lv5";
  2237. //光环特效.
  2238. public int EffectScale = 150;
  2239. //光环特效在场景中的缩放配置.
  2240. public int EffectSceneScale = 200;
  2241. //模板.
  2242. public int TemplateID = 0;
  2243. //头像.
  2244. public string IconName = null;
  2245. //宿主ID.
  2246. public uint MasterID = 0;
  2247. //进阶等级.
  2248. public byte StateLv = 0;
  2249. public object Clone()
  2250. {
  2251. PetBaseInfo ret = new PetBaseInfo();
  2252. ret.name = this.name;
  2253. ret.level = this.level;
  2254. ret.QColor = this.QColor;
  2255. ret.AvatarModel = this.AvatarModel;
  2256. ret.AvatarModelScale = this.AvatarModelScale;
  2257. ret.EffectModel = this.EffectModel;
  2258. ret.EffectScale = this.EffectScale;
  2259. ret.EffectSceneScale = this.EffectSceneScale;
  2260. ret.IconName = this.IconName;
  2261. ret.TemplateID = this.TemplateID;
  2262. ret.MasterID = this.MasterID;
  2263. ret.StateLv = this.StateLv;
  2264. return ret;
  2265. }
  2266. public void ReadExternal(IInputStream input)
  2267. {
  2268. name = input.GetUTF();
  2269. level = input.GetS32();
  2270. QColor = input.GetU8();
  2271. AvatarModel = input.GetUTF();
  2272. AvatarModelScale = input.GetS32();
  2273. EffectModel = input.GetUTF();
  2274. EffectScale = input.GetS32();
  2275. EffectSceneScale = input.GetS32();
  2276. IconName = input.GetUTF();
  2277. TemplateID = input.GetS32();
  2278. MasterID = input.GetU32();
  2279. StateLv = input.GetU8();
  2280. }
  2281. public void WriteExternal(IOutputStream output)
  2282. {
  2283. output.PutUTF(name);
  2284. output.PutS32(level);
  2285. output.PutU8(QColor);
  2286. output.PutUTF(AvatarModel);
  2287. output.PutS32(AvatarModelScale);
  2288. output.PutUTF(EffectModel);
  2289. output.PutS32(EffectScale);
  2290. output.PutS32(EffectSceneScale);
  2291. output.PutUTF(IconName);
  2292. output.PutS32(TemplateID);
  2293. output.PutU32(MasterID);
  2294. output.PutU8(StateLv);
  2295. }
  2296. }
  2297. /// <summary>
  2298. /// 配置信息.
  2299. /// </summary>
  2300. [MessageType(0x9001013)]
  2301. [ExpandableAttribute]
  2302. public class XmdsPetConifg : ICloneable, IExternalizable
  2303. {
  2304. /// <summary>
  2305. /// 跟随模式.
  2306. /// </summary>
  2307. public enum XmdsPetFollowMode : byte
  2308. {
  2309. ActiveAtk = 0,
  2310. PassiveAtk = 1,
  2311. FollowMaster = 2,
  2312. }
  2313. /// <summary>
  2314. /// 跟随模式.
  2315. /// </summary>
  2316. public XmdsPetFollowMode Mode;
  2317. /** 天命数据 */
  2318. public UnitFateType fateType;
  2319. public int fateValue;
  2320. public object Clone()
  2321. {
  2322. XmdsPetConifg ret = new XmdsPetConifg();
  2323. ret.Mode = this.Mode;
  2324. return ret;
  2325. }
  2326. public void ReadExternal(IInputStream input)
  2327. {
  2328. Mode = input.GetEnum8<XmdsPetFollowMode>();
  2329. }
  2330. public void WriteExternal(IOutputStream output)
  2331. {
  2332. output.PutEnum8<XmdsPetFollowMode>(Mode);
  2333. }
  2334. }
  2335. #endregion
  2336. #region 动态场景信息.
  2337. [MessageType(0x9001016)]
  2338. [ExpandableAttribute]
  2339. public class SceneInfo : ICloneable, IExternalizable
  2340. {
  2341. /// <summary>
  2342. /// 是否已通关.
  2343. /// </summary>
  2344. public bool AllowAutoGuard = true;
  2345. public object Clone()
  2346. {
  2347. SceneInfo ret = new SceneInfo();
  2348. ret.AllowAutoGuard = this.AllowAutoGuard;
  2349. return ret;
  2350. }
  2351. public void ReadExternal(IInputStream input)
  2352. {
  2353. this.AllowAutoGuard = input.GetBool();
  2354. }
  2355. public void WriteExternal(IOutputStream output)
  2356. {
  2357. output.PutBool(AllowAutoGuard);
  2358. }
  2359. }
  2360. #endregion
  2361. #region 伤害数值.
  2362. /// <summary>
  2363. /// 玩家伤害信息.
  2364. /// </summary>
  2365. [MessageType(0x9001017)]
  2366. [ExpandableAttribute]
  2367. public class PlayerDamageInfo : ICloneable, IExternalizable
  2368. {
  2369. /// <summary>
  2370. /// 玩家信息.
  2371. /// </summary>
  2372. public XmdsUnitBaseInfo PlayerInfo;
  2373. /// <summary>
  2374. /// 伤害.
  2375. /// </summary>
  2376. public int Damage;
  2377. public string PlayerUUID;
  2378. public object Clone()
  2379. {
  2380. PlayerDamageInfo ret = new PlayerDamageInfo();
  2381. ret.Damage = this.Damage;
  2382. ret.PlayerInfo = this.PlayerInfo;
  2383. ret.PlayerUUID = this.PlayerUUID;
  2384. return ret;
  2385. }
  2386. public void ReadExternal(IInputStream input)
  2387. {
  2388. this.PlayerInfo = input.GetExt<XmdsUnitBaseInfo>();
  2389. this.Damage = input.GetS32();
  2390. this.PlayerUUID = input.GetUTF();
  2391. }
  2392. public void WriteExternal(IOutputStream output)
  2393. {
  2394. output.PutExt(this.PlayerInfo);
  2395. output.PutS32(this.Damage);
  2396. output.PutUTF(this.PlayerUUID);
  2397. }
  2398. }
  2399. #endregion
  2400. }