Advertisement
zjqyf

GLQ_EliteHealthBarPlugin

Jun 15th, 2017
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System;
  4. using Turbo.Plugins.Default;
  5.  
  6. namespace Turbo.Plugins.glq
  7. {
  8. public class GLQ_EliteHealthBarPlugin : 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. public IFont TextFontHaunt { get; set; }
  17. public IFont TextFontLocust { get; set; }
  18. public int b { get; set; }
  19.  
  20.  
  21. public GLQ_EliteHealthBarPlugin()
  22. {
  23. Enabled = true;
  24. }
  25.  
  26. public override void Load(IController hud)
  27. {
  28. base.Load(hud);
  29. TextFont = Hud.Render.CreateFont("tahoma", 8, 180, 255, 255, 255, false, false, true);
  30. BorderBrush = Hud.Render.CreateBrush(255, 0, 100, 0, -1);
  31. BackgroundBrush = Hud.Render.CreateBrush(255, 0, 0, 0, 0);
  32. RareBrush = Hud.Render.CreateBrush(200, 255, 128, 0, 0);
  33. ChampionBrush = Hud.Render.CreateBrush(200, 0, 128, 255, 0);
  34. TextFontLocust = Hud.Render.CreateFont("tahoma", 8, 120, 128, 255, 128, true, false, true);
  35. TextFontHaunt = Hud.Render.CreateFont("tahoma", 8, 120, 150, 200, 255, true, false, true);
  36. TextFontLocust.SetShadowBrush(255, 0, 64, 64, true);
  37. TextFontHaunt.SetShadowBrush(255, 0, 0, 64, true);
  38. b = 35;
  39.  
  40. }
  41.  
  42. public void PaintWorld(WorldLayer layer)
  43. {
  44. var w1 = Hud.Window.Size.Width * 0.00333f * b;
  45. var textLocust = "虫群";//"L"
  46. var layoutLocust = TextFontLocust.GetTextLayout(textLocust);
  47. var textHaunt = "蚀魂";//"H"
  48. var layoutHaunt = TextFontHaunt.GetTextLayout(textHaunt);
  49. var h2 = Hud.Window.Size.Height * 0.017f;
  50. var x2 = Hud.Window.Size.Width * 0.001667f * b;
  51. var x3 = Hud.Window.Size.Width * 0.02f;
  52.  
  53.  
  54. var monsters = Hud.Game.AliveMonsters;
  55. foreach (var monster in monsters)
  56. {
  57. bool illusionist = false;
  58. if(monster.SummonerAcdDynamicId == 0)
  59. {
  60. illusionist = false;
  61. }
  62. else
  63. {
  64. illusionist = true;
  65. }
  66. if (monster.Rarity == ActorRarity.Champion)
  67. {
  68. if (illusionist == false)
  69. {
  70. var hptext = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f0");
  71. var layout = TextFont.GetTextLayout(hptext);
  72. var h = Hud.Window.Size.Height * 0.00034f * 35;
  73. var w = monster.CurHealth * w1 / monster.MaxHealth;
  74. var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X;// - w1 / 2;
  75. var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y;// + py * 14;
  76. var locustX = monsterX + x3 * 0.1f;
  77. var hauntX = monsterX - x3;
  78. var buffY = monsterY - h2 * 2f;
  79. var hpX = monsterX + w1 / 2 + 3;
  80. //BorderBrush.DrawRectangle(monsterX, monsterY, w1, h);
  81. BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
  82. if (monster.Rarity == ActorRarity.Champion) ChampionBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h);
  83. if (monster.Locust) TextFontLocust.DrawText(layoutLocust, locustX, buffY);
  84. if (monster.Haunted) TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY);
  85. TextFont.DrawText(layout, hpX, monsterY + h2);
  86. }
  87. }
  88. if (monster.Rarity == ActorRarity.Rare)
  89. {
  90. if (illusionist == false)
  91. {
  92. var hptext = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f0");
  93. var layout = TextFont.GetTextLayout(hptext);
  94. var h = Hud.Window.Size.Height * 0.00034f * 35;
  95. var w = monster.CurHealth * w1 / monster.MaxHealth;
  96. var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X;// - w1 / 2;
  97. var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y;// + py * 14;
  98. var locustX = monsterX + x3 * 0.1f;
  99. var hauntX = monsterX - x3;
  100. var buffY = monsterY - h2 * 2f;
  101. var hpX = monsterX + w1 / 2 + 3;
  102. //BorderBrush.DrawRectangle(monsterX, monsterY, w1, h);
  103. BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
  104. if (monster.Rarity == ActorRarity.Rare) RareBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h);
  105. if (monster.Locust) TextFontLocust.DrawText(layoutLocust, locustX, buffY);
  106. if (monster.Haunted) TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY);
  107. TextFont.DrawText(layout, hpX, monsterY + h2);
  108. }
  109. }
  110. }
  111. }
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement