zjqyf

GLQ_GreaterRiftPylonMarkerPlugin.cs

Aug 23rd, 2017
1,722
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections.Generic;
  2. using Turbo.Plugins.Default;
  3.  
  4. namespace Turbo.Plugins.glq
  5. {
  6. //by 我想静静
  7. public class GLQ_GreaterRiftPylonMarkerPlugin : BasePlugin, IInGameTopPainter
  8. {
  9. public IBrush ProgressionLineBrush { get; set; }
  10. public Dictionary<string, double> ProgressionofShrines { get; set; }
  11. public IFont GreaterRiftFont { get; set; }
  12. public bool flag_wn { get; set; }
  13. public bool flag_dj { get; set; }
  14. public bool flag_jh { get; set; }
  15. public bool flag_hd { get; set; }
  16. public bool flag_js { get; set; }
  17.  
  18. public GLQ_GreaterRiftPylonMarkerPlugin()
  19. {
  20. Enabled = true;
  21. }
  22.  
  23. public override void Load(IController hud)
  24. {
  25. base.Load(hud);
  26. GreaterRiftFont = Hud.Render.CreateFont("tahoma", 6, 255, 200, 100, 200, false, false, 160, 0, 0, 0, true);
  27. ProgressionLineBrush = Hud.Render.CreateBrush(255, 125, 175, 240, 1f);
  28. ProgressionofShrines = new Dictionary<string, double>();
  29. flag_wn = false;
  30. flag_dj = false;
  31. flag_jh = false;
  32. flag_hd = false;
  33. flag_js = false;
  34. }
  35.  
  36. public void PaintTopInGame(ClipState clipState)
  37. {
  38. if (clipState != ClipState.BeforeClip) return;
  39. if ((Hud.Game.SpecialArea != SpecialArea.Rift) && (Hud.Game.SpecialArea != SpecialArea.GreaterRift)) return;
  40.  
  41. if (Hud.Game.SpecialArea == SpecialArea.GreaterRift)
  42. //if (Hud.Game.SpecialArea == SpecialArea.Rift)
  43. {
  44. var percent = Hud.Game.RiftPercentage;
  45. if (percent <= 0)
  46. {
  47. ProgressionofShrines.Clear();
  48. flag_wn = false;
  49. flag_dj = false;
  50. flag_jh = false;
  51. flag_hd = false;
  52. flag_js = false;
  53. return;
  54. }
  55. var ui = Hud.Render.GreaterRiftBarUiElement;
  56. //var ui = Hud.Render.NephalemRiftBarUiElement;
  57. var uiRect = ui.Rectangle;
  58. if (ui.Visible)
  59. {
  60. var shrines = Hud.Game.Shrines;
  61. //if (shrines.Count() <= 0) return;
  62. foreach (var actor in shrines)
  63. {
  64. switch (actor.SnoActor.Sno)
  65. {
  66. case ActorSnoEnum._x1_lr_shrine_damage:
  67. if (flag_wn == false) ProgressionofShrines.Add("威能", percent);
  68. flag_wn = true;
  69. break;
  70. case ActorSnoEnum._x1_lr_shrine_electrified:
  71. case ActorSnoEnum._x1_lr_shrine_electrified_tieredrift:
  72. if (flag_dj == false) ProgressionofShrines.Add("电击", percent);
  73. flag_dj = true;
  74. break;
  75. case ActorSnoEnum._x1_lr_shrine_infinite_casting:
  76. if (flag_jh == false) ProgressionofShrines.Add("减耗", percent);
  77. flag_jh = true;
  78. break;
  79. case ActorSnoEnum._x1_lr_shrine_invulnerable:
  80. if (flag_hd == false) ProgressionofShrines.Add("护盾", percent);
  81. flag_hd = true;
  82. break;
  83. case ActorSnoEnum._x1_lr_shrine_run_speed:
  84. if (flag_js == false) ProgressionofShrines.Add("加速", percent);
  85. flag_js = true;
  86. break;
  87. }
  88. }
  89. var x = (float)(uiRect.Left + uiRect.Width / 100.0f * percent);
  90. var py = Hud.Window.Size.Height / 30;
  91. foreach (var pos in ProgressionofShrines)
  92. {
  93. var xPos = (float)(uiRect.Left + uiRect.Width / 100.0f * pos.Value);
  94. ProgressionLineBrush.DrawLine(xPos, uiRect.Bottom, xPos, uiRect.Bottom + py, 0);
  95. var text = pos.Value.ToString("F1") + "%" + "\r\n" + pos.Key;
  96. GreaterRiftFont.DrawText(text, xPos, uiRect.Bottom + py, true);
  97. }
  98. }
  99. }
  100. }
  101. }
  102. }
RAW Paste Data