Monster.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. using System;
  2. using System.Collections.Generic;
  3. using MongoDB.Bson.Serialization.Attributes;
  4. using ProtoBuf;
  5. namespace ET
  6. {
  7. [ProtoContract]
  8. [Config]
  9. public partial class MonsterCategory : ConfigSingleton<MonsterCategory>, IMerge
  10. {
  11. [ProtoIgnore]
  12. [BsonIgnore]
  13. private Dictionary<int, Monster> dict = new Dictionary<int, Monster>();
  14. [BsonElement]
  15. [ProtoMember(1)]
  16. private List<Monster> list = new List<Monster>();
  17. public void Merge(object o)
  18. {
  19. MonsterCategory s = o as MonsterCategory;
  20. this.list.AddRange(s.list);
  21. }
  22. [ProtoAfterDeserialization]
  23. public void ProtoEndInit()
  24. {
  25. foreach (Monster config in list)
  26. {
  27. config.AfterEndInit();
  28. this.dict.Add(config.Id, config);
  29. }
  30. this.list.Clear();
  31. this.AfterEndInit();
  32. }
  33. public Monster Get(int id)
  34. {
  35. this.dict.TryGetValue(id, out Monster item);
  36. if (item == null)
  37. {
  38. throw new Exception($"配置找不到,配置表名: {nameof (Monster)},配置id: {id}");
  39. }
  40. return item;
  41. }
  42. public bool Contain(int id)
  43. {
  44. return this.dict.ContainsKey(id);
  45. }
  46. public Dictionary<int, Monster> GetAll()
  47. {
  48. return this.dict;
  49. }
  50. public Monster GetOne()
  51. {
  52. if (this.dict == null || this.dict.Count <= 0)
  53. {
  54. return null;
  55. }
  56. return this.dict.Values.GetEnumerator().Current;
  57. }
  58. }
  59. [ProtoContract]
  60. public partial class Monster: ProtoObject, IConfig
  61. {
  62. /// <summary>Id</summary>
  63. [ProtoMember(1)]
  64. public int Id { get; set; }
  65. /// <summary>怪物名字</summary>
  66. [ProtoMember(2)]
  67. public string Name { get; set; }
  68. /// <summary>副名字/称号</summary>
  69. [ProtoMember(3)]
  70. public string Title { get; set; }
  71. /// <summary>等级</summary>
  72. [ProtoMember(4)]
  73. public int Level { get; set; }
  74. /// <summary>战斗规模</summary>
  75. [ProtoMember(5)]
  76. public int FightType { get; set; }
  77. /// <summary>1等级压制 0或空不压制</summary>
  78. [ProtoMember(6)]
  79. public int LvRepress { get; set; }
  80. /// <summary>名字颜色</summary>
  81. [ProtoMember(7)]
  82. public int Qcolor { get; set; }
  83. /// <summary>怪物类型</summary>
  84. [ProtoMember(8)]
  85. public int Type { get; set; }
  86. /// <summary>定力值</summary>
  87. [ProtoMember(9)]
  88. public int MPValue { get; set; }
  89. /// <summary>怪物可获取的技能类型</summary>
  90. [ProtoMember(10)]
  91. public int SkillType { get; set; }
  92. /// <summary>玩家围攻数量</summary>
  93. [ProtoMember(11)]
  94. public float FightCount { get; set; }
  95. /// <summary>存活时间</summary>
  96. [ProtoMember(12)]
  97. public float AliveTime { get; set; }
  98. /// <summary>致死玩家时间</summary>
  99. [ProtoMember(13)]
  100. public float KillPlayerTime { get; set; }
  101. /// <summary>生命</summary>
  102. [ProtoMember(14)]
  103. public int MaxHP { get; set; }
  104. /// <summary>攻击</summary>
  105. [ProtoMember(15)]
  106. public int MaxAttack { get; set; }
  107. /// <summary>防御</summary>
  108. [ProtoMember(16)]
  109. public int MaxDefence { get; set; }
  110. /// <summary>暴击率</summary>
  111. [ProtoMember(17)]
  112. public int CritRate { get; set; }
  113. /// <summary>暴击伤害</summary>
  114. [ProtoMember(18)]
  115. public int CritDamage { get; set; }
  116. /// <summary>穿透</summary>
  117. [ProtoMember(19)]
  118. public int IgnoreDefencePer { get; set; }
  119. /// <summary>变成普通怪的概率</summary>
  120. [ProtoMember(20)]
  121. public int Prob1 { get; set; }
  122. /// <summary>普通怪ID</summary>
  123. [ProtoMember(21)]
  124. public int ReviveID1 { get; set; }
  125. /// <summary>变成稀有怪的概率</summary>
  126. [ProtoMember(22)]
  127. public int Prob2 { get; set; }
  128. /// <summary>稀有怪ID</summary>
  129. [ProtoMember(23)]
  130. public int ReviveID2 { get; set; }
  131. /// <summary>变成首脑怪的概率</summary>
  132. [ProtoMember(24)]
  133. public int Prob3 { get; set; }
  134. /// <summary>首脑怪ID</summary>
  135. [ProtoMember(25)]
  136. public int ReviveID3 { get; set; }
  137. /// <summary>变成精英怪的概率</summary>
  138. [ProtoMember(26)]
  139. public int Prob4 { get; set; }
  140. /// <summary>精英怪ID</summary>
  141. [ProtoMember(27)]
  142. public int ReviveID4 { get; set; }
  143. /// <summary>显示个性语言概率</summary>
  144. [ProtoMember(28)]
  145. public int DialogChance { get; set; }
  146. /// <summary>个性语言</summary>
  147. [ProtoMember(29)]
  148. public string DialogWords { get; set; }
  149. /// <summary>战死时语言概率</summary>
  150. [ProtoMember(30)]
  151. public int DeadDialogChance { get; set; }
  152. /// <summary>战死时语言内容</summary>
  153. [ProtoMember(31)]
  154. public string DeadDialogWords { get; set; }
  155. /// <summary>非战斗状态时语音概率</summary>
  156. [ProtoMember(32)]
  157. public int IdleSpeakChance { get; set; }
  158. /// <summary>非战斗状态时语音内容</summary>
  159. [ProtoMember(33)]
  160. public string IdleSpeakWords { get; set; }
  161. /// <summary>战斗状态时语音概率</summary>
  162. [ProtoMember(35)]
  163. public int FightSpeakChance { get; set; }
  164. /// <summary>战斗状态时语音内容</summary>
  165. [ProtoMember(36)]
  166. public string FightSpeakWords { get; set; }
  167. /// <summary>非战斗状态时语音播放间隔4</summary>
  168. [ProtoMember(37)]
  169. public string FightSpeakCoolDown { get; set; }
  170. /// <summary>死亡时播放的语音</summary>
  171. [ProtoMember(38)]
  172. public string DeadSpeakWords { get; set; }
  173. /// <summary>是否主动攻击</summary>
  174. [ProtoMember(39)]
  175. public int isAttack { get; set; }
  176. /// <summary>身负特殊技能</summary>
  177. [ProtoMember(40)]
  178. public string Ability { get; set; }
  179. /// <summary>触发特殊技能血量万分比</summary>
  180. [ProtoMember(41)]
  181. public string CallAbilityPerHP { get; set; }
  182. /// <summary>特殊技能参数</summary>
  183. [ProtoMember(42)]
  184. public string AbilityPar { get; set; }
  185. /// <summary>是否任务共享</summary>
  186. [ProtoMember(43)]
  187. public int ShareType { get; set; }
  188. /// <summary>图标文件</summary>
  189. [ProtoMember(44)]
  190. public string Icon { get; set; }
  191. /// <summary>怪物描述</summary>
  192. [ProtoMember(45)]
  193. public string MonsterDes { get; set; }
  194. /// <summary>怪物攻略</summary>
  195. [ProtoMember(46)]
  196. public string MonsterRaid { get; set; }
  197. /// <summary>性别</summary>
  198. [ProtoMember(47)]
  199. public int Sex { get; set; }
  200. /// <summary>生物类型</summary>
  201. [ProtoMember(48)]
  202. public int Atype { get; set; }
  203. /// <summary>首杀TC</summary>
  204. [ProtoMember(49)]
  205. public string FirstTc { get; set; }
  206. /// <summary>常规TC</summary>
  207. [ProtoMember(50)]
  208. public string Tc { get; set; }
  209. /// <summary>队伍模式TC</summary>
  210. [ProtoMember(51)]
  211. public string TeamTc { get; set; }
  212. /// <summary>个人TC</summary>
  213. [ProtoMember(52)]
  214. public string PersonTc { get; set; }
  215. /// <summary>助攻tc</summary>
  216. [ProtoMember(53)]
  217. public string AssistTC { get; set; }
  218. /// <summary>基础经验</summary>
  219. [ProtoMember(54)]
  220. public int BaseExp { get; set; }
  221. /// <summary>基础灵石</summary>
  222. [ProtoMember(55)]
  223. public int GoldBase { get; set; }
  224. /// <summary>经验万分比</summary>
  225. [ProtoMember(56)]
  226. public int ExpRatio { get; set; }
  227. }
  228. }