Advertisement
deianu

ChantodoStacksPlugin.cs

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