Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Turbo.Plugins.Default;
- using System.Collections.Generic;
- namespace Turbo.Plugins.BW
- {
- public class ChantodoStacksPlugin : BasePlugin, IInGameTopPainter, ITransparentCollection
- {
- public TopLabelWithTitleDecorator ChantodoDecorator { get; set; }
- public bool ShowInTown { get; set; }
- public IBrush GreenBrush { get; set; }
- public IBrush OrangeBrush { get; set; }
- public IBrush RedBrush { get; set; }
- public IBrush OutlineBrushChantodoRange { get; set; }
- public IFader Fader { get; set; }
- public float XPos { get; set; }
- public float YPos { get; set; }
- public int ChantodoRange = 27;
- private float w { get; set; }
- private float h { get; set; }
- public ChantodoStacksPlugin()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- GreenBrush = Hud.Render.CreateBrush(160, 0, 255, 0, 0);
- OrangeBrush = Hud.Render.CreateBrush(160, 255, 165, 0, 0);
- RedBrush = Hud.Render.CreateBrush(160, 255, 0, 0, 0);
- ShowInTown = false;
- w = Hud.Window.Size.Width * 0.03f;
- h = Hud.Window.Size.Height * 0.02f;
- XPos = Hud.Window.Size.Width * 0.5f - w/2;
- YPos = Hud.Window.Size.Height * 0.5f + Hud.Window.Size.Height * 0.00001f;
- ChantodoDecorator = new TopLabelWithTitleDecorator(Hud)
- {
- BackgroundBrush = GreenBrush,
- BorderBrush = Hud.Render.CreateBrush(255, 0, 0, 0, -1),
- TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 0, 0, 0, true, false, false),
- };
- OutlineBrushChantodoRange = Hud.Render.CreateBrush(100, 0, 255, 0, 3);
- Fader = new StandardFader(Hud, this);
- }
- public void PaintTopInGame(ClipState clipState)
- {
- if (clipState != ClipState.BeforeClip) return;
- if (Hud.Render.UiHidden) return;
- IBuff chantodo = null;
- if (Hud.Game.IsInTown && ShowInTown == false) return;
- if (!Hud.Game.Me.Powers.BuffIsActive(440235, 0)) return;
- chantodo = Hud.Game.Me.Powers.GetBuff(440235);
- if (chantodo != null)
- {
- int stacks = chantodo.IconCounts[0];
- if (stacks < 10)
- {
- ChantodoDecorator.BackgroundBrush = RedBrush;
- ChantodoDecorator.Paint(XPos, YPos, w, h, stacks.ToString());
- }
- else if (stacks >= 10 && stacks < 18)
- {
- ChantodoDecorator.BackgroundBrush = OrangeBrush;
- ChantodoDecorator.Paint(XPos, YPos, w, h, stacks.ToString());
- }
- else
- {
- ChantodoDecorator.BackgroundBrush = GreenBrush;
- ChantodoDecorator.Paint(XPos, YPos, w, h, stacks.ToString());
- }
- if (!Hud.Game.Me.IsInTown)
- {
- OutlineBrushChantodoRange.DrawWorldEllipse(ChantodoRange, -1, Hud.Game.Me.FloorCoordinate);
- }
- }
- }
- public IEnumerable<ITransparent> GetTransparents()
- {
- yield return OutlineBrushChantodoRange;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement