Advertisement
zjqyf

MonsterRiftProgressionPlugin

Mar 4th, 2017
1,271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.84 KB | None | 0 0
  1. using SharpDX.DirectInput;
  2. using Turbo.Plugins.Default;
  3.  
  4. namespace Turbo.Plugins.glq
  5. {
  6. public class MonsterRiftProgressionPlugin : BasePlugin, IInGameWorldPainter, IKeyEventHandler
  7. {
  8. public WorldDecoratorCollection Decorator1 { get; set; }
  9. public WorldDecoratorCollection Decorator1_Dying { get; set; }
  10. public WorldDecoratorCollection Decorator2 { get; set; }
  11. public WorldDecoratorCollection Decorator2_Dying { get; set; }
  12. public WorldDecoratorCollection Decorator3 { get; set; }
  13. public WorldDecoratorCollection Decorator3_Dying { get; set; }
  14. public WorldDecoratorCollection Decorator4 { get; set; }
  15. public WorldDecoratorCollection Decorator4_Dying { get; set; }
  16. public WorldDecoratorCollection Decorator5 { get; set; }
  17. public WorldDecoratorCollection Decorator5_Dying { get; set; }
  18. public double DisplayLimit { get; set; }
  19. public IKeyEvent ToggleKeyEvent { get; set; }
  20. public bool TurnedOn { get; set; }
  21. public bool DyingEnable { get; set; }
  22. public bool OnlyMultiplayerEnable { get; set; }
  23. private bool Multiplayer;
  24. public int DyingLimit { get; set; }
  25. public MonsterRiftProgressionPlugin()
  26. {
  27. Enabled = true;
  28. }
  29.  
  30. public override void Load(IController hud)
  31. {
  32. base.Load(hud);
  33. ToggleKeyEvent = Hud.Input.CreateKeyEvent(true, Key.F9, false, false, false);
  34. TurnedOn = true;
  35. DisplayLimit = 0.0;
  36. DyingEnable = true;
  37. DyingLimit = 15;
  38. OnlyMultiplayerEnable = true;
  39.  
  40. Decorator1 = new WorldDecoratorCollection(
  41. new GroundLabelDecorator(Hud)
  42. {
  43. BackgroundBrush = Hud.Render.CreateBrush(90, 0, 0, 0, 0),
  44. TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, false, false, 88, 0, 0, 0, true),
  45. }
  46. );
  47. Decorator1_Dying = new WorldDecoratorCollection(
  48. new GroundLabelDecorator(Hud)
  49. {
  50. BackgroundBrush = Hud.Render.CreateBrush(90, 0, 0, 0, 0),
  51. TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 0, 0, false, false, 88, 0, 0, 0, true),
  52. }
  53. );
  54. Decorator2 = new WorldDecoratorCollection(
  55. new GroundLabelDecorator(Hud)
  56. {
  57. BackgroundBrush = Hud.Render.CreateBrush(90, 0, 0, 0, 0),
  58. TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 0, 200, 0, false, false, 88, 0, 0, 0, true),
  59. }
  60. );
  61. Decorator2_Dying = new WorldDecoratorCollection(
  62. new GroundLabelDecorator(Hud)
  63. {
  64. BackgroundBrush = Hud.Render.CreateBrush(90, 0, 0, 0, 0),
  65. TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 0, 0, false, false, 88, 0, 0, 0, true),
  66. }
  67. );
  68. Decorator3 = new WorldDecoratorCollection(
  69. new GroundLabelDecorator(Hud)
  70. {
  71. BackgroundBrush = Hud.Render.CreateBrush(200, 0, 125, 0, 0),
  72. TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, 88, 0, 0, 0, true),
  73. }
  74. );
  75. Decorator3_Dying = new WorldDecoratorCollection(
  76. new GroundLabelDecorator(Hud)
  77. {
  78. BackgroundBrush = Hud.Render.CreateBrush(200, 0, 125, 0, 0),
  79. TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 0, 0, true, false, 88, 0, 0, 0, true),
  80. }
  81. );
  82. Decorator4 = new WorldDecoratorCollection(
  83. new GroundLabelDecorator(Hud)
  84. {
  85. BackgroundBrush = Hud.Render.CreateBrush(200, 0, 55, 0, 0),
  86. TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 255, 255, 255, true, false, 88, 0, 200, 0, true),
  87. }
  88. );
  89. Decorator4_Dying = new WorldDecoratorCollection(
  90. new GroundLabelDecorator(Hud)
  91. {
  92. BackgroundBrush = Hud.Render.CreateBrush(200, 0, 55, 0, 0),
  93. TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 255, 0, 0, true, false, 88, 0, 0, 0, true),
  94. }
  95. );
  96. Decorator5 = new WorldDecoratorCollection(
  97. new GroundLabelDecorator(Hud)
  98. {
  99. BackgroundBrush = Hud.Render.CreateBrush(200, 0, 20, 0, 0),
  100. TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 0, 125, 0, true, false, 88, 255, 255, 255, true),
  101. }
  102. );
  103. Decorator5_Dying = new WorldDecoratorCollection(
  104. new GroundLabelDecorator(Hud)
  105. {
  106. BackgroundBrush = Hud.Render.CreateBrush(200, 0, 20, 0, 0),
  107. TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 255, 0, 0, true, false, 88, 255, 255, 255, true),
  108. }
  109. );
  110.  
  111. }
  112. public WorldDecoratorCollection GetDecoratorByProgression(IMonster monster)
  113. {
  114. if (monster.SnoMonster.RiftProgression<=1.0)
  115. {
  116. if(OnlyMultiplayerEnable)
  117. {
  118. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable && Multiplayer)
  119. {
  120. return Decorator1_Dying;
  121. }
  122. else
  123. {
  124. return Decorator1;
  125. }
  126. }
  127. else
  128. {
  129. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable)
  130. {
  131. return Decorator1_Dying;
  132. }
  133. else
  134. {
  135. return Decorator1;
  136. }
  137. }
  138. }
  139. if (monster.SnoMonster.RiftProgression <= 2.0)
  140. {
  141. if (OnlyMultiplayerEnable)
  142. {
  143. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable && Multiplayer)
  144. {
  145. return Decorator2_Dying;
  146. }
  147. else
  148. {
  149. return Decorator2;
  150. }
  151. }
  152. else
  153. {
  154. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable)
  155. {
  156. return Decorator2_Dying;
  157. }
  158. else
  159. {
  160. return Decorator2;
  161. }
  162. }
  163. }
  164. if (monster.SnoMonster.RiftProgression <= 3.0)
  165. {
  166. if (OnlyMultiplayerEnable)
  167. {
  168. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable && Multiplayer)
  169. {
  170. return Decorator3_Dying;
  171. }
  172. else
  173. {
  174. return Decorator3;
  175. }
  176. }
  177. else
  178. {
  179. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable)
  180. {
  181. return Decorator3_Dying;
  182. }
  183. else
  184. {
  185. return Decorator3;
  186. }
  187. }
  188. }
  189. if (monster.SnoMonster.RiftProgression <= 4.0)
  190. {
  191. if (OnlyMultiplayerEnable)
  192. {
  193. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable && Multiplayer)
  194. {
  195. return Decorator4_Dying;
  196. }
  197. else
  198. {
  199. return Decorator4;
  200. }
  201. }
  202. else
  203. {
  204. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable)
  205. {
  206. return Decorator4_Dying;
  207. }
  208. else
  209. {
  210. return Decorator4;
  211. }
  212. }
  213.  
  214. }
  215. if (OnlyMultiplayerEnable)
  216. {
  217. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable && Multiplayer)
  218. {
  219. return Decorator5_Dying;
  220. }
  221. else
  222. {
  223. return Decorator5;
  224. }
  225. }
  226. else
  227. {
  228. if (monster.CurHealth / monster.MaxHealth * 100 <= DyingLimit && DyingEnable)
  229. {
  230. return Decorator5_Dying;
  231. }
  232. else
  233. {
  234. return Decorator5;
  235. }
  236. }
  237. // in theory there is no monster with >10 progression
  238. }
  239. public void OnKeyEvent(IKeyEvent keyEvent)
  240. {
  241. if (keyEvent.IsPressed && ToggleKeyEvent.Matches(keyEvent))
  242. {
  243. TurnedOn = !TurnedOn;
  244. }
  245. }
  246. public void PaintWorld(WorldLayer layer)
  247. {
  248. if (!TurnedOn) return;
  249. var inRift = Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.GreaterRift;
  250. if (!inRift) return;
  251. var monsters = Hud.Game.AliveMonsters;
  252. if (Hud.Game.NumberOfPlayersInGame > 1 && OnlyMultiplayerEnable)
  253. {
  254. Multiplayer = true;
  255. }
  256. else
  257. {
  258. Multiplayer = false;
  259. }
  260. foreach (var monster in monsters)
  261. {
  262. double MonsterRiftProgression = monster.SnoMonster.RiftProgression * 100.0d / Hud.Game.MaxQuestProgress;
  263. var decorator = GetDecoratorByProgression(monster);
  264. if (monster.IsElite && monster.SummonerAcdDynamicId == 0 && MonsterRiftProgression >= DisplayLimit)
  265. {
  266. decorator.Paint(layer, monster, monster.FloorCoordinate, MonsterRiftProgression.ToString("f2") + "%");
  267. }
  268. if (!monster.IsElite && MonsterRiftProgression >= DisplayLimit)
  269. {
  270. decorator.Paint(layer, monster, monster.FloorCoordinate, MonsterRiftProgression.ToString("f2") + "%");
  271. }
  272. }
  273. }
  274.  
  275. }
  276.  
  277. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement