XmdsProperties.cs 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735
  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("技能类型-不要改,服务器配置")]
  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. public int MaxMonsterAttack { get { return CUtils.CastInt(monsterAtk * (1 + monsterAtkPer * 0.0001f)); } }
  1443. public int MaxMonsterDef { get { return CUtils.CastInt(monsterDef * (1 + monsterDefPer * 0.0001f)); } }
  1444. ///////////////////////////////////////////////////////////////////////////////////////////
  1445. /// 为实现技能或者buff特殊逻辑,加上的特殊字段
  1446. public int NormalAtkCriteRate; //普攻暴击几率
  1447. ///////////////////////////////////////////////////////////////////////////////////////////
  1448. //获取攻击力
  1449. public int GetFinalAttack(bool isMonster)
  1450. {
  1451. if (isMonster)
  1452. {
  1453. return MaxAttack + MaxMonsterAttack;
  1454. }
  1455. else
  1456. {
  1457. return MaxAttack;
  1458. }
  1459. }
  1460. public object Clone()
  1461. {
  1462. XmdsUnitProp ret = new XmdsUnitProp();
  1463. ret.BaseMaxHP = this.BaseMaxHP;
  1464. ret.HPPer = this.HPPer;
  1465. ret.HP = this.HP;
  1466. ret.BaseAttack = this.BaseAttack;
  1467. ret.AttackPer = this.AttackPer;
  1468. ret.BaseDefence = this.BaseDefence;
  1469. ret.DefencePer = this.DefencePer;
  1470. ret.BaseIgnoreDefense = this.BaseIgnoreDefense;
  1471. ret.IgnoreDefensePer = this.IgnoreDefensePer;
  1472. ret.BaseResCrit = this.BaseResCrit;
  1473. ret.ResCritPer = this.ResCritPer;
  1474. ret.ResCritRate = this.ResCritRate;
  1475. ret.CritRate = this.CritRate;
  1476. ret.CritDamage = this.CritDamage;
  1477. ret.CritDamageRes = this.CritDamageRes;
  1478. ret.PlayerDamageAdd = this.PlayerDamageAdd;
  1479. ret.PlayerDamageReduce = this.PlayerDamageReduce;
  1480. ret.CtrlTimeReduce = this.CtrlTimeReduce;
  1481. ret.SkillCD = this.SkillCD;
  1482. ret.HPReborn = this.HPReborn;
  1483. ret.HPRecoverPer = this.HPRecoverPer;
  1484. ret.HealEffect = this.HealEffect;
  1485. ret.HealedEffect = this.HealedEffect;
  1486. ret.MoveSpeed = this.MoveSpeed;
  1487. ret.VelocityAddition = this.VelocityAddition;
  1488. ret.CurInventorySize = this.CurInventorySize;
  1489. ret.CurTeamInventorySize = this.CurTeamInventorySize;
  1490. ret.pickupRange = this.pickupRange;
  1491. ret.SkillDamageAdd = this.SkillDamageAdd;
  1492. ret.AttackSpeed = this.AttackSpeed;
  1493. ret.ControlUp = this.ControlUp;
  1494. ret.ArtifactMainPer = this.ArtifactMainPer;
  1495. //元素攻击 & 防御 & 克制 & 抵御
  1496. ret.ArtifactAttack = (int[])this.ArtifactAttack.Clone();
  1497. ret.ArtifactDefense = (int[])this.ArtifactDefense.Clone();
  1498. ret.ArtifactRestraint = (int[])this.ArtifactRestraint.Clone();
  1499. ret.ArtifactResist = (int[])this.ArtifactResist.Clone();
  1500. ret.ToBossCritRate = this.ToBossCritRate;
  1501. ret.ToBossCritDamage = this.ToBossCritDamage;
  1502. ret.KillValuePer = this.KillValuePer;
  1503. ret.YaoQiLevel = this.YaoQiLevel;
  1504. ret.NormalAtkLeech = this.NormalAtkLeech;
  1505. ret.ActiveAtkLeech = this.ActiveAtkLeech;
  1506. ret.monsterDamageAdd = this.monsterDamageAdd;
  1507. ret.monsterDamageReduce = this.monsterDamageReduce;
  1508. ret.fateType = this.fateType;
  1509. ret.fateValue = this.fateValue;
  1510. ret.ArtifactIndex = this.ArtifactIndex;
  1511. ret.ArtifactDefenceIndex = this.ArtifactDefenceIndex;
  1512. ret.AllDmgAdd = this.AllDmgAdd;
  1513. ret.AllDmgReduce = this.AllDmgReduce;
  1514. for (int i = 0; i < (int)UnitFateType.Five; i++)
  1515. {
  1516. ret.MonsterRestraint[i] = this.MonsterRestraint[i];
  1517. }
  1518. ret.BreakShieldValue = this.BreakShieldValue;
  1519. ret.ShieldValue = this.ShieldValue;
  1520. ret.monsterAtk = this.monsterAtk;
  1521. ret.monsterDef = this.monsterDef;
  1522. ret.monsterAtkPer = this.monsterAtkPer;
  1523. ret.monsterDefPer = this.monsterDefPer;
  1524. return ret;
  1525. }
  1526. public void AddTo(XmdsUnitProp prop)
  1527. {
  1528. this.BaseMaxHP += prop.BaseMaxHP;
  1529. this.HPPer += prop.HPPer;
  1530. this.HP += prop.HP;
  1531. this.BaseAttack += prop.BaseAttack;
  1532. this.AttackPer += prop.AttackPer;
  1533. this.BaseDefence += prop.BaseDefence;
  1534. this.DefencePer += prop.DefencePer;
  1535. this.BaseIgnoreDefense += prop.BaseIgnoreDefense;
  1536. this.IgnoreDefensePer += prop.IgnoreDefensePer;
  1537. this.BaseResCrit += prop.BaseResCrit;
  1538. this.ResCritPer += prop.ResCritPer;
  1539. this.ResCritRate += prop.ResCritRate;
  1540. this.CritRate += prop.CritRate;
  1541. this.CritDamage += prop.CritDamage;
  1542. this.CritDamageRes += prop.CritDamageRes;
  1543. this.PlayerDamageAdd += prop.PlayerDamageAdd;
  1544. this.PlayerDamageReduce += prop.PlayerDamageReduce;
  1545. this.CtrlTimeReduce += prop.CtrlTimeReduce;
  1546. this.SkillCD += prop.SkillCD;
  1547. this.HPReborn += prop.HPReborn;
  1548. this.HPRecoverPer += prop.HPRecoverPer;
  1549. this.HealEffect += prop.HealEffect;
  1550. this.HealedEffect += prop.HealedEffect;
  1551. this.MoveSpeed += prop.MoveSpeed;
  1552. this.VelocityAddition += prop.VelocityAddition;
  1553. this.CurInventorySize += prop.CurInventorySize;
  1554. this.CurTeamInventorySize += prop.CurTeamInventorySize;
  1555. this.pickupRange += prop.pickupRange;
  1556. this.SkillDamageAdd += prop.SkillDamageAdd;
  1557. this.AttackSpeed += prop.AttackSpeed;
  1558. this.ControlUp += prop.ControlUp;
  1559. this.ArtifactMainPer += prop.ArtifactMainPer;
  1560. //元素攻击 & 防御 & 克制 & 抵御
  1561. for(int i = 0; i < 5; i++)
  1562. {
  1563. this.ArtifactAttack[i] += prop.ArtifactAttack[i];
  1564. this.ArtifactDefense[i] += prop.ArtifactDefense[i];
  1565. this.ArtifactRestraint[i] += prop.ArtifactRestraint[i];
  1566. this.ArtifactResist[i] += prop.ArtifactResist[i];
  1567. }
  1568. this.ToBossCritRate += prop.ToBossCritRate;
  1569. this.ToBossCritDamage += prop.ToBossCritDamage;
  1570. this.KillValuePer += prop.KillValuePer;
  1571. this.YaoQiLevel += prop.YaoQiLevel;
  1572. this.NormalAtkLeech += prop.NormalAtkLeech;
  1573. this.ActiveAtkLeech += prop.ActiveAtkLeech;
  1574. this.monsterDamageAdd += prop.monsterDamageAdd;
  1575. this.monsterDamageReduce += prop.monsterDamageReduce;
  1576. this.AllDmgAdd += prop.AllDmgAdd;
  1577. this.AllDmgReduce += prop.AllDmgReduce;
  1578. for (int i = 0; i < (int)UnitFateType.Five; i++)
  1579. {
  1580. this.MonsterRestraint[i] += prop.MonsterRestraint[i];
  1581. }
  1582. this.BreakShieldValue += prop.BreakShieldValue;
  1583. this.ShieldValue += prop.ShieldValue;
  1584. //猎妖值
  1585. this.monsterAtk += prop.monsterAtk;
  1586. this.monsterDef += prop.monsterDef;
  1587. this.monsterAtkPer += prop.monsterAtkPer;
  1588. this.monsterDefPer += prop.monsterDefPer;
  1589. }
  1590. public void WriteExternal(IOutputStream output)
  1591. {
  1592. output.PutS32(this.BaseMaxHP);
  1593. output.PutS32(this.HPPer);
  1594. output.PutS32(this.HP);
  1595. output.PutS32(this.BaseAttack);
  1596. output.PutS32(this.AttackPer);
  1597. output.PutS32(this.BaseDefence);
  1598. output.PutS32(this.DefencePer);
  1599. output.PutS32(this.BaseIgnoreDefense);
  1600. output.PutS32(this.IgnoreDefensePer);
  1601. output.PutS32(this.CritRate);
  1602. output.PutS32(this.BaseResCrit);
  1603. output.PutS32(this.ResCritPer);
  1604. output.PutS32(this.ResCritRate);
  1605. output.PutS32(this.CritDamage);
  1606. output.PutS32(this.CritDamageRes);
  1607. output.PutS32(this.PlayerDamageAdd);
  1608. output.PutS32(this.PlayerDamageReduce);
  1609. output.PutS32(this.CtrlTimeReduce);
  1610. output.PutS32(this.SkillCD);
  1611. output.PutS32(this.HPReborn);
  1612. output.PutS32(this.HealEffect);
  1613. output.PutS32(this.HealedEffect);
  1614. output.PutF32(this.MoveSpeed);
  1615. output.PutS32(this.VelocityAddition);
  1616. output.PutS32(this.CurInventorySize);
  1617. output.PutS32(this.CurTeamInventorySize);
  1618. output.PutS32(this.pickupRange);
  1619. output.PutS32(this.SkillDamageAdd);
  1620. output.PutS32(this.AttackSpeed);
  1621. output.PutS32(this.ControlUp);
  1622. output.PutS32(this.ArtifactMainPer);
  1623. for(int i = 0; i < 5; i++)
  1624. {
  1625. output.PutS32(this.ArtifactAttack[i]);
  1626. output.PutS32(this.ArtifactDefense[i]);
  1627. output.PutS32(this.ArtifactRestraint[i]);
  1628. output.PutS32(this.ArtifactResist[i]);
  1629. }
  1630. output.PutS32(this.ToBossCritRate);
  1631. output.PutS32(this.ToBossCritDamage);
  1632. output.PutS32(this.KillValuePer);
  1633. output.PutS32(this.YaoQiLevel);
  1634. output.PutS32(this.NormalAtkLeech);
  1635. output.PutS32(this.ActiveAtkLeech);
  1636. for (int i = 0; i < (int)UnitFateType.Five; i++)
  1637. {
  1638. output.PutS32(this.MonsterRestraint[i]);
  1639. }
  1640. output.PutS32(this.BreakShieldValue);
  1641. // 猎妖值
  1642. output.PutS32(this.monsterAtk);
  1643. output.PutS32(this.monsterDef);
  1644. output.PutS32(this.monsterAtkPer);
  1645. output.PutS32(this.monsterDefPer);
  1646. }
  1647. public void ReadExternal(IInputStream input)
  1648. {
  1649. this.BaseMaxHP = input.GetS32();
  1650. this.HPPer = input.GetS32();
  1651. this.HP = input.GetS32();
  1652. this.BaseAttack = input.GetS32();
  1653. this.AttackPer = input.GetS32();
  1654. this.BaseDefence = input.GetS32();
  1655. this.DefencePer = input.GetS32();
  1656. this.BaseIgnoreDefense = input.GetS32();
  1657. this.IgnoreDefensePer = input.GetS32();
  1658. this.CritRate = input.GetS32();
  1659. this.BaseResCrit = input.GetS32();
  1660. this.ResCritPer = input.GetS32();
  1661. this.ResCritRate = input.GetS32();
  1662. this.CritDamage = input.GetS32();
  1663. this.CritDamageRes = input.GetS32();
  1664. this.PlayerDamageAdd = input.GetS32();
  1665. this.PlayerDamageReduce = input.GetS32();
  1666. this.CtrlTimeReduce = input.GetS32();
  1667. this.SkillCD = input.GetS32();
  1668. this.HPReborn = input.GetS32();
  1669. this.HealEffect = input.GetS32();
  1670. this.HealedEffect = input.GetS32();
  1671. this.MoveSpeed = input.GetF32();
  1672. this.VelocityAddition = input.GetS32();
  1673. this.CurInventorySize = input.GetS32();
  1674. this.CurTeamInventorySize = input.GetS32();
  1675. this.pickupRange = input.GetS32();
  1676. this.SkillDamageAdd = input.GetS32();
  1677. this.AttackSpeed = input.GetS32();
  1678. this.ControlUp = input.GetS32();
  1679. this.ArtifactMainPer = input.GetS32();
  1680. for (int i = 0; i < 5; i++)
  1681. {
  1682. this.ArtifactAttack[i] = input.GetS32();
  1683. this.ArtifactDefense[i] = input.GetS32();
  1684. this.ArtifactRestraint[i] = input.GetS32();
  1685. this.ArtifactResist[i] = input.GetS32();
  1686. }
  1687. this.ToBossCritRate = input.GetS32();
  1688. this.ToBossCritDamage = input.GetS32();
  1689. this.KillValuePer = input.GetS32();
  1690. this.YaoQiLevel = input.GetS32();
  1691. this.NormalAtkLeech = input.GetS32();
  1692. this.ActiveAtkLeech = input.GetS32();
  1693. for (int i = 0; i < (int)UnitFateType.Five; i++)
  1694. {
  1695. this.MonsterRestraint[i] = input.GetS32();
  1696. }
  1697. this.BreakShieldValue = input.GetS32();
  1698. // 猎妖值
  1699. this.monsterAtk = input.GetS32();
  1700. this.monsterDef = input.GetS32();
  1701. this.monsterAtkPer = input.GetS32();
  1702. this.monsterDefPer = input.GetS32();
  1703. }
  1704. }
  1705. #endregion
  1706. #region 单位技能信息集合.
  1707. /// <summary>
  1708. /// 单位技能信息集合.
  1709. /// </summary>
  1710. [MessageType(0x9001002)]
  1711. [ExpandableAttribute]
  1712. public class XmdsUnitSkillInfo : ICloneable, IExternalizable
  1713. {
  1714. public List<GameSkill> UnitSkills = null;
  1715. public XmdsUnitSkillInfo()
  1716. {
  1717. }
  1718. public object Clone()
  1719. {
  1720. XmdsUnitSkillInfo ret = new XmdsUnitSkillInfo();
  1721. ret.UnitSkills = CUtils.CloneList<GameSkill>(this.UnitSkills);
  1722. return ret;
  1723. }
  1724. public void WriteExternal(IOutputStream output)
  1725. {
  1726. output.PutList<GameSkill>(this.UnitSkills, output.PutExt);
  1727. }
  1728. public void ReadExternal(IInputStream input)
  1729. {
  1730. this.UnitSkills = input.GetList<GameSkill>(input.GetExt<GameSkill>);
  1731. }
  1732. }
  1733. [MessageType(0x9001005)]
  1734. [ExpandableAttribute]
  1735. public class GameSkill : ICloneable, IExternalizable
  1736. {
  1737. //默认为主动技能.
  1738. public XmdsSkillType SkillType = XmdsSkillType.active;
  1739. //技能ID.
  1740. public int SkillID = 0;
  1741. //技能等级.
  1742. public int SkillLevel = 1;
  1743. //天赋技能等级.
  1744. //斩妖特殊含义:冷却时间减少,触发几率增加,持续时间增加
  1745. public int TalentSkillLevel1 = 1;
  1746. public int TalentSkillLevel2 = 1;
  1747. public int TalentSkillLevel3 = 1;
  1748. //技能到期时间戳.
  1749. public long SkillTimestampMS = 0;
  1750. //CD时间变更万分比.
  1751. public int SkillCDDecreasePercent = 0;
  1752. //是否允许自动释放.
  1753. public bool AutoLaunch = true;
  1754. //战斗命中人数
  1755. public HashMap<uint, int> mHitUnits = new HashMap<uint, int>();
  1756. public GameSkill() { }
  1757. public GameSkill(int skillId)
  1758. {
  1759. this.SkillID = skillId;
  1760. }
  1761. public GameSkill(int skillId, XmdsSkillType type, bool autoLaunch = true)
  1762. {
  1763. this.SkillID = skillId;
  1764. this.SkillType = type;
  1765. this.AutoLaunch = autoLaunch;
  1766. }
  1767. // 被动只有一个等级
  1768. public int GetPassiveLevel()
  1769. {
  1770. return this.SkillLevel + this.TalentSkillLevel1;
  1771. }
  1772. public object Clone()
  1773. {
  1774. GameSkill ret = new GameSkill();
  1775. ret.SkillID = this.SkillID;
  1776. ret.SkillLevel = this.SkillLevel;
  1777. ret.SkillType = this.SkillType;
  1778. ret.TalentSkillLevel1 = this.TalentSkillLevel1;
  1779. ret.TalentSkillLevel2 = this.TalentSkillLevel2;
  1780. ret.TalentSkillLevel3 = this.TalentSkillLevel3;
  1781. ret.SkillTimestampMS = this.SkillTimestampMS;
  1782. ret.SkillCDDecreasePercent = this.SkillCDDecreasePercent;
  1783. ret.AutoLaunch = this.AutoLaunch;
  1784. return ret;
  1785. }
  1786. public void WriteExternal(IOutputStream output)
  1787. {
  1788. output.PutS32(SkillID);
  1789. output.PutS32(SkillLevel);
  1790. output.PutEnum8(SkillType);
  1791. output.PutS32(TalentSkillLevel1);
  1792. output.PutS64(SkillTimestampMS);
  1793. output.PutS32(SkillCDDecreasePercent);
  1794. output.PutBool(AutoLaunch);
  1795. }
  1796. public void ReadExternal(IInputStream input)
  1797. {
  1798. this.SkillID = input.GetS32();
  1799. this.SkillLevel = input.GetS32();
  1800. this.SkillType = input.GetEnum8<XmdsSkillType>();
  1801. this.TalentSkillLevel1 = input.GetS32();
  1802. this.SkillTimestampMS = input.GetS64();
  1803. this.SkillCDDecreasePercent = input.GetS32();
  1804. this.AutoLaunch = input.GetBool();
  1805. }
  1806. }
  1807. [Desc("施法区域提示")]
  1808. [MessageType(0x900100A)]
  1809. [ExpandableAttribute]
  1810. public class XmdsSkillLaunchModeData : ICloneable, IExternalizable
  1811. {
  1812. public enum XmdsSkillLaunchMode : byte
  1813. {
  1814. [Desc("普通模式")]
  1815. Mode_None,
  1816. [Desc("箭头模式")]
  1817. Mode_Arrow,
  1818. [Desc("扇形模式")]
  1819. Mode_Fan,
  1820. [Desc("区域模式")]
  1821. Mode_Area,
  1822. [Desc("缠绕")]
  1823. Mode_Twine,
  1824. }
  1825. [Desc("施法模式")]
  1826. public XmdsSkillLaunchMode Mode = XmdsSkillLaunchMode.Mode_None;
  1827. [Desc("技能范围半径")]
  1828. public float Shape_Radius = 0;
  1829. [Desc("箭头模式下代表箭头宽度")]
  1830. public float Shape_Width = 0;
  1831. [Desc("扇形模式下代表扇形展开范围")]
  1832. public int Shape_Angle = 0;
  1833. [Desc("施放点和单位中心点偏移距离")]
  1834. public float Shape_LaunchCenterOffset = 0;
  1835. [Desc("缠绕非中心圆的长")]
  1836. public float TwineNotCircleLength = 0;
  1837. [Desc("缠绕非中心圆的宽")]
  1838. public float TwineNotCircleWidth = 0;
  1839. [Desc("缠绕中心圆的缩放比")]
  1840. public float TwineCircleScale = 0;
  1841. [Desc("显示施法引导")]
  1842. public bool ShowLaunchGuide = false;
  1843. public object Clone()
  1844. {
  1845. XmdsSkillLaunchModeData ret = new XmdsSkillLaunchModeData();
  1846. ret.Mode = this.Mode;
  1847. ret.Shape_Radius = this.Shape_Radius;
  1848. ret.Shape_Angle = this.Shape_Angle;
  1849. ret.Shape_Width = this.Shape_Width;
  1850. ret.Shape_LaunchCenterOffset = this.Shape_LaunchCenterOffset;
  1851. ret.TwineNotCircleLength = this.TwineNotCircleLength;
  1852. ret.TwineNotCircleWidth = this.TwineNotCircleWidth;
  1853. ret.TwineCircleScale = this.TwineCircleScale;
  1854. ret.ShowLaunchGuide = this.ShowLaunchGuide;
  1855. return ret;
  1856. }
  1857. public void WriteExternal(IOutputStream output)
  1858. {
  1859. output.PutEnum8(Mode);
  1860. output.PutF32(Shape_Radius);
  1861. output.PutS32(Shape_Angle);
  1862. output.PutF32(Shape_Width);
  1863. output.PutF32(Shape_LaunchCenterOffset);
  1864. output.PutF32(TwineNotCircleLength);
  1865. output.PutF32(TwineNotCircleWidth);
  1866. output.PutF32(TwineCircleScale);
  1867. output.PutBool(ShowLaunchGuide);
  1868. }
  1869. public void ReadExternal(IInputStream input)
  1870. {
  1871. Mode = input.GetEnum8<XmdsSkillLaunchMode>();
  1872. Shape_Radius = input.GetF32();
  1873. Shape_Angle = input.GetS32();
  1874. Shape_Width = input.GetF32();
  1875. Shape_LaunchCenterOffset = input.GetF32();
  1876. TwineNotCircleLength = input.GetF32();
  1877. TwineNotCircleWidth = input.GetF32();
  1878. TwineCircleScale = input.GetF32();
  1879. ShowLaunchGuide = input.GetBool();
  1880. }
  1881. }
  1882. #endregion
  1883. #region PK相关数据.
  1884. /// <summary>
  1885. /// 单位PK信息..
  1886. /// </summary>
  1887. [MessageType(0x9001010)]
  1888. [ExpandableAttribute]
  1889. public class PKInfo : ICloneable, IExternalizable
  1890. {
  1891. //当前PK等级.
  1892. public PKLevel CurPKLevel = PKLevel.White;
  1893. //当前PK模式.
  1894. public PKMode CurPKMode = PKMode.Peace;
  1895. //当前PK值.
  1896. public int CurPKValue = 0;
  1897. public object Clone()
  1898. {
  1899. PKInfo ret = new PKInfo();
  1900. ret.CurPKLevel = this.CurPKLevel;
  1901. ret.CurPKMode = this.CurPKMode;
  1902. ret.CurPKValue = this.CurPKValue;
  1903. return ret;
  1904. }
  1905. public void ReadExternal(IInputStream input)
  1906. {
  1907. this.CurPKLevel = input.GetEnum8<PKLevel>();
  1908. this.CurPKMode = input.GetEnum8<PKMode>();
  1909. this.CurPKValue = input.GetS32();
  1910. }
  1911. public void WriteExternal(IOutputStream output)
  1912. {
  1913. output.PutEnum8(CurPKLevel);
  1914. output.PutEnum8(CurPKMode);
  1915. output.PutS32(CurPKValue);
  1916. }
  1917. }
  1918. #endregion
  1919. #region Buff容器.
  1920. public abstract class XmdsBuffVirtual : IDisposable
  1921. {
  1922. private static AtomicInteger s_alloc_object_count = new AtomicInteger(0);
  1923. private static AtomicInteger s_active_object_count = new AtomicInteger(0);
  1924. public static int AllocCount { get { return s_alloc_object_count.Value; } }
  1925. public static int ActiveCount { get { return s_active_object_count.Value; } }
  1926. private bool mDisposed = false;
  1927. public XmdsBuffVirtual()
  1928. {
  1929. s_alloc_object_count++;
  1930. s_active_object_count++;
  1931. }
  1932. ~XmdsBuffVirtual()
  1933. {
  1934. s_alloc_object_count--;
  1935. }
  1936. public void Dispose()
  1937. {
  1938. if (mDisposed) { return; }
  1939. mDisposed = true;
  1940. OnDispose();
  1941. s_active_object_count--;
  1942. }
  1943. protected virtual void OnDispose() { }
  1944. }
  1945. #endregion
  1946. #region 任务数据.
  1947. [MessageType(0x9001008)]
  1948. [ExpandableAttribute]
  1949. public class QuestAttribute : ICloneable, IExternalizable
  1950. {
  1951. public string Key;
  1952. public string Value;
  1953. public void WriteExternal(IOutputStream output)
  1954. {
  1955. output.PutUTF(Key);
  1956. output.PutUTF(Value);
  1957. }
  1958. public void ReadExternal(IInputStream input)
  1959. {
  1960. this.Key = input.GetUTF();
  1961. this.Value = input.GetUTF();
  1962. }
  1963. public object Clone()
  1964. {
  1965. QuestAttribute ret = new QuestAttribute();
  1966. ret.Key = this.Key;
  1967. ret.Value = this.Value;
  1968. return ret;
  1969. }
  1970. }
  1971. [MessageType(0x9001007)]
  1972. [ExpandableAttribute]
  1973. public class XmdsQuestData : ICloneable, IExternalizable
  1974. {
  1975. /// <summary>
  1976. /// 任务ID.
  1977. /// </summary>
  1978. [DescAttribute("任务ID")]
  1979. public string TaskID = null;
  1980. /// <summary>
  1981. /// 任务状态.
  1982. /// </summary>
  1983. [DescAttribute("任务状态")]
  1984. public string TaskState = null;
  1985. public List<QuestAttribute> Attributes = null;
  1986. //子状态, 1: 任务目标已达成
  1987. public static readonly string Attribute_SubState = "state";
  1988. //任务类型
  1989. public static readonly string Attribute_TaskType = "type";
  1990. //目标ID
  1991. public static readonly string Attribute_TargetId = "targetId";
  1992. //目标场景
  1993. public static readonly string Attribute_AreaId = "areaId";
  1994. //目标路点
  1995. public static readonly string Attribute_PointId = "pointId";
  1996. //任务完成目标的需求数量
  1997. //public static readonly string Attribute_TargetNum = "targetNum";
  1998. //任务进度
  1999. //public static readonly string Attribute_Progress = "progress";
  2000. //添加任务进度数量
  2001. public static readonly string Attribute_AddProgress = "add_progress";
  2002. //自定义属性,表示战斗服接收游戏服初始数据完成
  2003. public static readonly string Attribute_InitOK = "INIT_OK";
  2004. public enum TaskType : int
  2005. {
  2006. Kill = 1,
  2007. InterActiveUnit = 2,
  2008. InterActiveItem = 3,
  2009. Got = 4,
  2010. Convoy = 5, //护送
  2011. Guard = 6, //守护
  2012. Area = 7, //到达指定区域
  2013. KillPlayer = 8, //杀人
  2014. Challenge = 25, //挑战
  2015. ConqueringtheDemons = 26, //伏魔
  2016. Steal = 27, //偷窃
  2017. RefineSoul = 28, //炼魂
  2018. CatchPet = 29, //抓宠
  2019. Treasure = 30, //寻宝
  2020. }
  2021. public static int GetTaskTypeByString(string typeValue)
  2022. {
  2023. int ret = 0;
  2024. int.TryParse(typeValue, out ret);
  2025. return ret;
  2026. }
  2027. public static int GetTaskType(QuestData qData)
  2028. {
  2029. string taskType = qData.Attributes.Get(XmdsQuestData.Attribute_TaskType);
  2030. return GetTaskTypeByString(taskType);
  2031. }
  2032. public static int GetTargetSceneID(QuestData qData)
  2033. {
  2034. string areaId = qData.Attributes.Get(XmdsQuestData.Attribute_AreaId);
  2035. int result = 0;
  2036. if (!string.IsNullOrEmpty(areaId))
  2037. {
  2038. Int32.TryParse(areaId, out result);
  2039. }
  2040. return result;
  2041. }
  2042. public static string GetTargetScenePoint(QuestData qData)
  2043. {
  2044. return qData.Attributes.Get(XmdsQuestData.Attribute_PointId);
  2045. }
  2046. public static string GetTarget(QuestData qData)
  2047. {
  2048. return qData.Attributes.Get(XmdsQuestData.Attribute_TargetId);
  2049. }
  2050. /// <summary>
  2051. /// 获取目标总数量
  2052. /// </summary>
  2053. /// <param name="qData"></param>
  2054. /// <returns></returns>
  2055. //public static int GetTargetQuantity(QuestData qData)
  2056. //{
  2057. // string str = qData.Attributes.Get(QuestData.Attribute_TargetNum);
  2058. // int result = 0;
  2059. // if (!string.IsNullOrEmpty(str))
  2060. // {
  2061. // Int32.TryParse(str, out result);
  2062. // }
  2063. // return result;
  2064. //}
  2065. /// <summary>
  2066. /// 获取进度
  2067. /// </summary>
  2068. /// <param name="qData"></param>
  2069. /// <returns></returns>
  2070. //public static int GetProgress(QuestData qData)
  2071. //{
  2072. // string str = qData.Attributes.Get(QuestData.Attribute_Progress);
  2073. // int result = 0;
  2074. // if (!string.IsNullOrEmpty(str))
  2075. // {
  2076. // Int32.TryParse(str, out result);
  2077. // }
  2078. // return result;
  2079. //}
  2080. public static int GetTargetID(QuestData qData)
  2081. {
  2082. string targetId = qData.Attributes.Get(XmdsQuestData.Attribute_TargetId);
  2083. int result = 0;
  2084. if (!string.IsNullOrEmpty(targetId))
  2085. {
  2086. Int32.TryParse(targetId, out result);
  2087. }
  2088. return result;
  2089. }
  2090. /// <summary>
  2091. /// 返回任务目标是否已达成
  2092. /// </summary>
  2093. public static bool IsTargetComplete(QuestData qData)
  2094. {
  2095. string state = qData.Attributes.Get(XmdsQuestData.Attribute_SubState);
  2096. return (!string.IsNullOrEmpty(state) && state == "1");
  2097. }
  2098. public void AddAttribute(string key, string value)
  2099. {
  2100. if (Attributes == null)
  2101. {
  2102. Attributes = new List<QuestAttribute>();
  2103. }
  2104. QuestAttribute attr = new QuestAttribute();
  2105. attr.Key = key;
  2106. attr.Value = value;
  2107. Attributes.Add(attr);
  2108. }
  2109. public void WriteExternal(IOutputStream output)
  2110. {
  2111. output.PutUTF(TaskID);
  2112. output.PutUTF(TaskState);
  2113. output.PutList<QuestAttribute>(this.Attributes, output.PutExt);
  2114. }
  2115. public void ReadExternal(IInputStream input)
  2116. {
  2117. this.TaskID = input.GetUTF();
  2118. this.TaskState = input.GetUTF();
  2119. this.Attributes = input.GetList<QuestAttribute>(input.GetExt<QuestAttribute>);
  2120. }
  2121. public object Clone()
  2122. {
  2123. XmdsQuestData ret = new XmdsQuestData();
  2124. ret.TaskID = this.TaskID;
  2125. ret.TaskState = this.TaskState;
  2126. return ret;
  2127. }
  2128. }
  2129. [MessageType(0x9001009)]
  2130. [ExpandableAttribute]
  2131. public class XmdsQuestFlag : ICloneable, IExternalizable
  2132. {
  2133. public string FlagName = "flag_name";
  2134. public string FlagValue = null;
  2135. public void WriteExternal(IOutputStream output)
  2136. {
  2137. output.PutUTF(FlagName);
  2138. output.PutUTF(FlagValue);
  2139. }
  2140. public void ReadExternal(IInputStream input)
  2141. {
  2142. this.FlagName = input.GetUTF();
  2143. this.FlagValue = input.GetUTF();
  2144. }
  2145. public object Clone()
  2146. {
  2147. XmdsQuestFlag ret = new XmdsQuestFlag();
  2148. ret.FlagName = this.FlagName;
  2149. ret.FlagValue = this.FlagValue;
  2150. return ret;
  2151. }
  2152. public override string ToString()
  2153. {
  2154. return FlagName + " = " + FlagValue;
  2155. }
  2156. }
  2157. #endregion
  2158. #region 宠物相关
  2159. [MessageType(0x9001011)]
  2160. [ExpandableAttribute]
  2161. public class PetData : ICloneable, IExternalizable
  2162. {
  2163. //宠物配置信息.
  2164. public XmdsPetConifg PetConfig = null;
  2165. //基础信息.
  2166. public PetBaseInfo BaseInfo = null;
  2167. //能力属性.
  2168. public XmdsUnitProp UnitProp = null;
  2169. //技能信息.
  2170. public XmdsUnitSkillInfo SkillInfo = null;
  2171. public object Clone()
  2172. {
  2173. PetData ret = new PetData();
  2174. if (this.BaseInfo != null)
  2175. ret.BaseInfo = (PetBaseInfo)this.BaseInfo.Clone();
  2176. if (this.UnitProp != null)
  2177. ret.UnitProp = (XmdsUnitProp)this.UnitProp.Clone();
  2178. if (SkillInfo != null)
  2179. ret.SkillInfo = (XmdsUnitSkillInfo)this.SkillInfo.Clone();
  2180. if (PetConfig != null)
  2181. ret.PetConfig = (XmdsPetConifg)this.PetConfig.Clone();
  2182. return ret;
  2183. }
  2184. public void ReadExternal(IInputStream input)
  2185. {
  2186. BaseInfo = input.GetExt<PetBaseInfo>();
  2187. UnitProp = input.GetExt<XmdsUnitProp>();
  2188. SkillInfo = input.GetExt<XmdsUnitSkillInfo>();
  2189. PetConfig = input.GetExt<XmdsPetConifg>();
  2190. }
  2191. public void WriteExternal(IOutputStream output)
  2192. {
  2193. output.PutExt(BaseInfo);
  2194. output.PutExt(UnitProp);
  2195. output.PutExt(SkillInfo);
  2196. output.PutExt(PetConfig);
  2197. }
  2198. }
  2199. /// <summary>
  2200. /// 基础信息.
  2201. /// </summary>
  2202. [MessageType(0x9001012)]
  2203. [ExpandableAttribute]
  2204. public class PetBaseInfo : ICloneable, IExternalizable
  2205. {
  2206. //名字.
  2207. public string name = "揍我啊";
  2208. //等级.
  2209. public int level = 1;
  2210. //品质.
  2211. public byte QColor = 1;
  2212. //模型.
  2213. public string AvatarModel = "23101_rabbit";
  2214. //模型缩放比例.
  2215. public int AvatarModelScale = 70;
  2216. //特效模型.
  2217. public string EffectModel = "vfx_pet_illusion_lv5";
  2218. //光环特效.
  2219. public int EffectScale = 150;
  2220. //光环特效在场景中的缩放配置.
  2221. public int EffectSceneScale = 200;
  2222. //模板.
  2223. public int TemplateID = 0;
  2224. //头像.
  2225. public string IconName = null;
  2226. //宿主ID.
  2227. public uint MasterID = 0;
  2228. //进阶等级.
  2229. public byte StateLv = 0;
  2230. public object Clone()
  2231. {
  2232. PetBaseInfo ret = new PetBaseInfo();
  2233. ret.name = this.name;
  2234. ret.level = this.level;
  2235. ret.QColor = this.QColor;
  2236. ret.AvatarModel = this.AvatarModel;
  2237. ret.AvatarModelScale = this.AvatarModelScale;
  2238. ret.EffectModel = this.EffectModel;
  2239. ret.EffectScale = this.EffectScale;
  2240. ret.EffectSceneScale = this.EffectSceneScale;
  2241. ret.IconName = this.IconName;
  2242. ret.TemplateID = this.TemplateID;
  2243. ret.MasterID = this.MasterID;
  2244. ret.StateLv = this.StateLv;
  2245. return ret;
  2246. }
  2247. public void ReadExternal(IInputStream input)
  2248. {
  2249. name = input.GetUTF();
  2250. level = input.GetS32();
  2251. QColor = input.GetU8();
  2252. AvatarModel = input.GetUTF();
  2253. AvatarModelScale = input.GetS32();
  2254. EffectModel = input.GetUTF();
  2255. EffectScale = input.GetS32();
  2256. EffectSceneScale = input.GetS32();
  2257. IconName = input.GetUTF();
  2258. TemplateID = input.GetS32();
  2259. MasterID = input.GetU32();
  2260. StateLv = input.GetU8();
  2261. }
  2262. public void WriteExternal(IOutputStream output)
  2263. {
  2264. output.PutUTF(name);
  2265. output.PutS32(level);
  2266. output.PutU8(QColor);
  2267. output.PutUTF(AvatarModel);
  2268. output.PutS32(AvatarModelScale);
  2269. output.PutUTF(EffectModel);
  2270. output.PutS32(EffectScale);
  2271. output.PutS32(EffectSceneScale);
  2272. output.PutUTF(IconName);
  2273. output.PutS32(TemplateID);
  2274. output.PutU32(MasterID);
  2275. output.PutU8(StateLv);
  2276. }
  2277. }
  2278. /// <summary>
  2279. /// 配置信息.
  2280. /// </summary>
  2281. [MessageType(0x9001013)]
  2282. [ExpandableAttribute]
  2283. public class XmdsPetConifg : ICloneable, IExternalizable
  2284. {
  2285. /// <summary>
  2286. /// 跟随模式.
  2287. /// </summary>
  2288. public enum XmdsPetFollowMode : byte
  2289. {
  2290. ActiveAtk = 0,
  2291. PassiveAtk = 1,
  2292. FollowMaster = 2,
  2293. }
  2294. /// <summary>
  2295. /// 跟随模式.
  2296. /// </summary>
  2297. public XmdsPetFollowMode Mode;
  2298. /** 天命数据 */
  2299. public UnitFateType fateType;
  2300. public int fateValue;
  2301. public object Clone()
  2302. {
  2303. XmdsPetConifg ret = new XmdsPetConifg();
  2304. ret.Mode = this.Mode;
  2305. return ret;
  2306. }
  2307. public void ReadExternal(IInputStream input)
  2308. {
  2309. Mode = input.GetEnum8<XmdsPetFollowMode>();
  2310. }
  2311. public void WriteExternal(IOutputStream output)
  2312. {
  2313. output.PutEnum8<XmdsPetFollowMode>(Mode);
  2314. }
  2315. }
  2316. #endregion
  2317. #region 动态场景信息.
  2318. [MessageType(0x9001016)]
  2319. [ExpandableAttribute]
  2320. public class SceneInfo : ICloneable, IExternalizable
  2321. {
  2322. /// <summary>
  2323. /// 是否已通关.
  2324. /// </summary>
  2325. public bool AllowAutoGuard = true;
  2326. public object Clone()
  2327. {
  2328. SceneInfo ret = new SceneInfo();
  2329. ret.AllowAutoGuard = this.AllowAutoGuard;
  2330. return ret;
  2331. }
  2332. public void ReadExternal(IInputStream input)
  2333. {
  2334. this.AllowAutoGuard = input.GetBool();
  2335. }
  2336. public void WriteExternal(IOutputStream output)
  2337. {
  2338. output.PutBool(AllowAutoGuard);
  2339. }
  2340. }
  2341. #endregion
  2342. #region 伤害数值.
  2343. /// <summary>
  2344. /// 玩家伤害信息.
  2345. /// </summary>
  2346. [MessageType(0x9001017)]
  2347. [ExpandableAttribute]
  2348. public class PlayerDamageInfo : ICloneable, IExternalizable
  2349. {
  2350. /// <summary>
  2351. /// 玩家信息.
  2352. /// </summary>
  2353. public XmdsUnitBaseInfo PlayerInfo;
  2354. /// <summary>
  2355. /// 伤害.
  2356. /// </summary>
  2357. public int Damage;
  2358. public string PlayerUUID;
  2359. public object Clone()
  2360. {
  2361. PlayerDamageInfo ret = new PlayerDamageInfo();
  2362. ret.Damage = this.Damage;
  2363. ret.PlayerInfo = this.PlayerInfo;
  2364. ret.PlayerUUID = this.PlayerUUID;
  2365. return ret;
  2366. }
  2367. public void ReadExternal(IInputStream input)
  2368. {
  2369. this.PlayerInfo = input.GetExt<XmdsUnitBaseInfo>();
  2370. this.Damage = input.GetS32();
  2371. this.PlayerUUID = input.GetUTF();
  2372. }
  2373. public void WriteExternal(IOutputStream output)
  2374. {
  2375. output.PutExt(this.PlayerInfo);
  2376. output.PutS32(this.Damage);
  2377. output.PutUTF(this.PlayerUUID);
  2378. }
  2379. }
  2380. #endregion
  2381. }