Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Turbo.Plugins.RuneB
- {
- using Turbo.Plugins.Default;
- public class BuffLabelsPlugin : BasePlugin
- {
- //Horizontal and Vertical label positions.
- private float YPos = 0.65f;
- private float XPos = 0.5f;
- //Vertical distance between labels
- private float YPosIncrement = 0.02f;
- //Label size is based on a percentage of screen width/height
- private float LabelWidthPercentage = 0.052f;
- private float LabelHeightPercentage = 0.016f;
- //If true labels are always shown
- private bool Debug = false;
- private float LW, LH, Width, Height, YPosTemp;
- public IFont TextFont { get; set; }
- public IBrush BorderBrush { get; set; }
- public IBrush BackgroundBrushIP { get; set; }
- public IBrush BackgroundBrushOC { get; set; }
- public IBrush BackgroundBrushIS { get; set; }
- public IBrush BackgroundBrushFD { get; set; }
- public bool IgnorePain { get; set; }
- public bool Oculus { get; set; }
- public bool InnerSanctuary { get; set; }
- public bool FlyingDragon { get; set; }
- public BuffLabelsPlugin()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- //Turn labels on and off
- IgnorePain = true;
- Oculus = true;
- InnerSanctuary = true;
- FlyingDragon = true;
- TextFont = Hud.Render.CreateFont("tahoma", 6, 240, 240, 240, 240, true, false, true);
- BorderBrush = Hud.Render.CreateBrush(150, 30, 30, 30, 0);
- BackgroundBrushIP = Hud.Render.CreateBrush(100, 100, 225, 100, 0); // Ignore Pain
- BackgroundBrushOC = Hud.Render.CreateBrush(100, 255, 255, 50, 0); // Oculus
- BackgroundBrushIS = Hud.Render.CreateBrush(100, 185, 220, 245, 0); // Inner Sanctuary
- BackgroundBrushFD = Hud.Render.CreateBrush(100, 50, 200, 255, 0); // Flying Dragon
- Width = Hud.Window.Size.Width;
- Height = Hud.Window.Size.Height;
- LW = Width * LabelWidthPercentage; // label width
- LH = Height * LabelHeightPercentage; // label height
- YPosTemp = YPos;
- }
- public override void PaintWorld(WorldLayer layer)
- {
- if (IgnorePain && (Hud.Game.Me.Powers.BuffIsActive(79528, 0) || Hud.Game.Me.Powers.BuffIsActive(79528, 1)) || Debug)
- DrawLabel(BackgroundBrushIP,"Ignore Pain", .017f);
- if (Oculus && Hud.Game.Me.Powers.BuffIsActive(402461, 2) || Debug)
- DrawLabel(BackgroundBrushOC, "Oculus", .01f);
- if (InnerSanctuary && Hud.Game.Me.Powers.BuffIsActive(317076, 1) || Debug)
- DrawLabel(BackgroundBrushIS, "Inner Sanctuary", .023f);
- if (FlyingDragon && Hud.Game.Me.Powers.BuffIsActive(246562, 1) || Debug)
- DrawLabel(BackgroundBrushFD, "Flying Dragon", .02f);
- YPosTemp = YPos;
- }
- private void DrawLabel(IBrush label, string buffText, float textCenter) {
- YPosTemp += YPosIncrement;
- BorderBrush.DrawRectangle(Width * XPos - LW * 1.05f * .5f, Height * YPosTemp - LH * 1.1f, LW * 1.05f, LH * 1.2f);
- label.DrawRectangle(Width * XPos - LW * .5f, Height * YPosTemp - LH, LW, LH);
- TextFont.DrawText(TextFont.GetTextLayout(buffText), Width * (XPos - textCenter), Height * YPosTemp - LH + 2f);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement