Advertisement
RuneB

BuffLabelsPlugin.cs

Feb 12th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.53 KB | None | 0 0
  1. namespace Turbo.Plugins.RuneB
  2. {
  3.     using Turbo.Plugins.Default;
  4.  
  5.     public class BuffLabelsPlugin : BasePlugin
  6.     {
  7.         //Horizontal and Vertical label positions.
  8.         private float YPos = 0.65f;
  9.         private float XPos = 0.5f;
  10.  
  11.         //Vertical distance between labels
  12.         private float YPosIncrement = 0.02f;
  13.  
  14.         //Label size is based on a percentage of screen width/height
  15.         private float LabelWidthPercentage = 0.052f;
  16.         private float LabelHeightPercentage = 0.016f;
  17.  
  18.         //If true labels are always shown
  19.         private bool Debug = false;
  20.  
  21.         private float LW, LH, Width, Height, YPosTemp;
  22.  
  23.         public IFont TextFont { get; set; }
  24.         public IBrush BorderBrush { get; set; }
  25.         public IBrush BackgroundBrushIP { get; set; }
  26.         public IBrush BackgroundBrushOC { get; set; }
  27.         public IBrush BackgroundBrushIS { get; set; }
  28.         public IBrush BackgroundBrushFD { get; set; }
  29.  
  30.         public bool IgnorePain { get; set; }
  31.         public bool Oculus { get; set; }
  32.         public bool InnerSanctuary { get; set; }
  33.         public bool FlyingDragon { get; set; }
  34.  
  35.         public BuffLabelsPlugin()
  36.         {
  37.             Enabled = true;
  38.         }
  39.  
  40.         public override void Load(IController hud)
  41.         {
  42.             base.Load(hud);
  43.  
  44.             //Turn labels on and off
  45.             IgnorePain = true;
  46.             Oculus = true;
  47.             InnerSanctuary = true;
  48.             FlyingDragon = true;
  49.  
  50.             TextFont = Hud.Render.CreateFont("tahoma", 6, 240, 240, 240, 240, true, false, true);
  51.             BorderBrush = Hud.Render.CreateBrush(150, 30, 30, 30, 0);
  52.  
  53.             BackgroundBrushIP = Hud.Render.CreateBrush(100, 100, 225, 100, 0);   // Ignore Pain
  54.             BackgroundBrushOC = Hud.Render.CreateBrush(100, 255, 255, 50, 0);    // Oculus
  55.             BackgroundBrushIS = Hud.Render.CreateBrush(100, 185, 220, 245, 0);   // Inner Sanctuary
  56.             BackgroundBrushFD = Hud.Render.CreateBrush(100, 50, 200, 255, 0);    // Flying Dragon
  57.  
  58.             Width = Hud.Window.Size.Width;
  59.             Height = Hud.Window.Size.Height;
  60.             LW = Width * LabelWidthPercentage;     // label width
  61.             LH = Height * LabelHeightPercentage;   // label height
  62.  
  63.             YPosTemp = YPos;
  64.         }
  65.  
  66.         public override void PaintWorld(WorldLayer layer)
  67.         {
  68.             if (IgnorePain && (Hud.Game.Me.Powers.BuffIsActive(79528, 0) || Hud.Game.Me.Powers.BuffIsActive(79528, 1)) || Debug)
  69.                 DrawLabel(BackgroundBrushIP,"Ignore Pain", .017f);
  70.  
  71.             if (Oculus && Hud.Game.Me.Powers.BuffIsActive(402461, 2) || Debug)
  72.                 DrawLabel(BackgroundBrushOC, "Oculus", .01f);
  73.  
  74.             if (InnerSanctuary && Hud.Game.Me.Powers.BuffIsActive(317076, 1) || Debug)
  75.                 DrawLabel(BackgroundBrushIS, "Inner Sanctuary", .023f);
  76.  
  77.             if (FlyingDragon && Hud.Game.Me.Powers.BuffIsActive(246562, 1) || Debug)
  78.                 DrawLabel(BackgroundBrushFD, "Flying Dragon", .02f);
  79.  
  80.             YPosTemp = YPos;
  81.         }
  82.  
  83.         private void DrawLabel(IBrush label, string buffText, float textCenter) {
  84.             YPosTemp += YPosIncrement;
  85.             BorderBrush.DrawRectangle(Width * XPos - LW * 1.05f * .5f, Height * YPosTemp - LH * 1.1f, LW * 1.05f, LH * 1.2f);
  86.             label.DrawRectangle(Width * XPos - LW * .5f, Height * YPosTemp - LH, LW, LH);
  87.             TextFont.DrawText(TextFont.GetTextLayout(buffText), Width * (XPos - textCenter), Height * YPosTemp - LH + 2f);
  88.         }
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement