Advertisement
zjqyf

EliteHealthListPlugin

Mar 15th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Turbo.Plugins.Default;
  5.  
  6. namespace Turbo.Plugins.glq
  7. {
  8. public class EliteHealthListPlugin : BasePlugin, IInGameWorldPainter
  9. {
  10. //作者:我想静静 修改:小米
  11. public IFont TextFont { get; set; }
  12. public IBrush BorderBrush { get; set; }
  13. public IBrush BackgroundBrush { get; set; }
  14. public IBrush RareBrush { get; set; }
  15. public IBrush ChampionBrush { get; set; }
  16.  
  17. public EliteHealthListPlugin()
  18. {
  19. Enabled = true;
  20. }
  21.  
  22. public override void Load(IController hud)
  23. {
  24. base.Load(hud);
  25. TextFont = Hud.Render.CreateFont("tahoma", 6, 180, 255, 255, 255, false, false, true);
  26. BorderBrush = Hud.Render.CreateBrush(120, 50, 205, 50, 1);
  27. BackgroundBrush = Hud.Render.CreateBrush(120, 0, 0, 0, 0);
  28. RareBrush = Hud.Render.CreateBrush(120, 255, 128, 0, 0);
  29. ChampionBrush = Hud.Render.CreateBrush(120, 0, 128, 255, 0);
  30. }
  31.  
  32. public void PaintWorld(WorldLayer layer)
  33. {
  34. var monsters = Hud.Game.AliveMonsters;
  35. Dictionary<IMonster, string> eliteGroup = new Dictionary<IMonster, string>();
  36.  
  37. foreach (var monster in monsters)
  38. {
  39. if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
  40. {
  41. eliteGroup.Add(monster, String.Join(", ", monster.AffixSnoList));
  42. }
  43. }
  44. Dictionary<IMonster, string> eliteGroup1 = eliteGroup.OrderBy(p => p.Value).ToDictionary(p => p.Key, o => o.Value);
  45.  
  46. var px = Hud.Window.Size.Width * 0.00125f;
  47. var py = Hud.Window.Size.Height * 0.001667f;
  48. var h = py * 5;
  49. var w2 = py * 50;
  50. var count = 0;
  51. string preStr = null;
  52. //remove clone
  53. foreach (var elite in eliteGroup1)
  54. {
  55. bool illusionist = false;
  56. if(elite.Key.SummonerAcdDynamicId == 0)
  57. {
  58. illusionist = false;
  59. }
  60. else
  61. {
  62. illusionist = true;
  63. }
  64. if (elite.Key.Rarity == ActorRarity.Champion)
  65. {
  66. if (illusionist == false)
  67. {
  68. var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth;
  69. var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0");
  70. var layout = TextFont.GetTextLayout(text);
  71. if (preStr != elite.Value || preStr == null) count++;
  72. var y = py * 8 * count;
  73. //BorderBrush.DrawRectangle(x, y, 70, h);
  74. BackgroundBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, w2, h);
  75. TextFont.DrawText(layout, Hud.Window.Size.Width * 0.125f + px + w2, y - py);
  76. ChampionBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, (float)w, h);
  77. preStr = elite.Value;
  78. count++;
  79. }
  80. }
  81. if (elite.Key.Rarity == ActorRarity.Rare)
  82. {
  83. if (illusionist == false)
  84. {
  85. var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth;
  86. var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0");
  87. var layout = TextFont.GetTextLayout(text);
  88. if (preStr != elite.Value || preStr == null) count++;
  89. var y = py * 8 * count;
  90. //BorderBrush.DrawRectangle(x, y, 70, h);
  91. BackgroundBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, w2, h);
  92. TextFont.DrawText(layout, Hud.Window.Size.Width * 0.125f + px + w2, y - py);
  93. RareBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, (float)w, h);
  94. preStr = elite.Value;
  95. count++;
  96. }
  97. }
  98. }
  99. eliteGroup.Clear();
  100. }
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement