Advertisement
Guest User

Untitled

a guest
May 27th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. using System.Globalization;
  2. using Turbo.Plugins.Default;
  3. using System.Linq;
  4. using System;
  5.  
  6. namespace Turbo.Plugins.BW
  7. {
  8. public class ChantodoStacksPlugin : BasePlugin, IInGameTopPainter
  9. {
  10. public TopLabelWithTitleDecorator ChantodoDecorator { get; set; }
  11. public bool ShowInTown { get; set; }
  12. public IBrush GreenBrush { get; set; }
  13. public IBrush OrangeBrush { get; set; }
  14. public IBrush RedBrush { get; set; }
  15. private float w { get; set; }
  16. private float h { get; set; }
  17. public float XPos { get; set; }
  18. public float YPos { get; set; }
  19. private IFont currentFont;
  20. public ChantodoStacksPlugin()
  21. {
  22. Enabled = true;
  23. }
  24.  
  25. public override void Load(IController hud)
  26. {
  27. base.Load(hud);
  28.  
  29. GreenBrush = Hud.Render.CreateBrush(160, 0, 255, 0, 0);
  30. OrangeBrush = Hud.Render.CreateBrush(160, 255, 165, 0, 0);
  31. RedBrush = Hud.Render.CreateBrush(160, 255, 0, 0, 0);
  32.  
  33. ShowInTown = false;
  34. w = Hud.Window.Size.Width * 0.03f;
  35. h = Hud.Window.Size.Height * 0.02f;
  36. XPos = Hud.Window.Size.Width * 0.5f - w/2;
  37. YPos = Hud.Window.Size.Height * 0.5f + Hud.Window.Size.Height * 0.00001f;
  38.  
  39. ChantodoDecorator = new TopLabelWithTitleDecorator(Hud)
  40. {
  41. BackgroundBrush = GreenBrush,
  42. BorderBrush = Hud.Render.CreateBrush(255, 0, 0, 0, -1),
  43. TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 0, 0, 0, true, false, false),
  44. };
  45.  
  46. }
  47.  
  48. public void PaintTopInGame(ClipState clipState)
  49. {
  50. if (clipState != ClipState.BeforeClip) return;
  51. if (Hud.Render.UiHidden) return;
  52.  
  53.  
  54. IBuff chantodo = null;
  55. if (Hud.Game.IsInTown && ShowInTown == false) return;
  56.  
  57. if (!Hud.Game.Me.Powers.BuffIsActive(440235, 0)) return;
  58.  
  59. chantodo = Hud.Game.Me.Powers.GetBuff(440235);
  60. if (chantodo != null)
  61. {
  62. int stacks = chantodo.IconCounts[0];
  63.  
  64. if (stacks < 10)
  65. {
  66. ChantodoDecorator.BackgroundBrush = RedBrush;
  67. ChantodoDecorator.Paint(XPos, YPos, w, h, stacks.ToString());
  68. }
  69. else if (stacks >= 10 && stacks < 18)
  70. {
  71. ChantodoDecorator.BackgroundBrush = OrangeBrush;
  72. ChantodoDecorator.Paint(XPos, YPos, w, h, stacks.ToString());
  73. }
  74. else
  75. {
  76. ChantodoDecorator.BackgroundBrush = GreenBrush;
  77. ChantodoDecorator.Paint(XPos, YPos, w, h, stacks.ToString());
  78. }
  79. }
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement