Advertisement
s4000

DAV_WizChantodoPlugin

Aug 31st, 2019
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.31 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.DavPlayer
  7. {
  8.     public class DAV_WizChantodoPlugin : BasePlugin, IInGameTopPainter {
  9.         public TopLabelDecorator ArchonDecorator { get; set; }
  10.         public TopLabelDecorator ChantodoDecorator { get; set; }
  11.         public IBrush GreenBrush { get; set; }
  12.         public IBrush OrangeBrush { get; set; }
  13.         public IBrush RedBrush { get; set; }
  14.         public IBrush RangeBrush { get; set; }
  15.         public IBrush ZeiBrush { get; set; }
  16.         public float iconSize  { get; set; }
  17.         public float XPos { get; set; }
  18.         public float YPos { get; set; }
  19.  
  20.         private int ChantodoStack { get; set; }
  21.         private double ArchonLeft { get; set; }
  22.  
  23.         public DAV_WizChantodoPlugin() {
  24.             Enabled = true;
  25.         }
  26.  
  27.         public override void Load(IController hud) {
  28.             base.Load(hud);
  29.  
  30.             XPos = Hud.Window.Size.Width * 0.45f;
  31.             YPos = Hud.Window.Size.Height * 0.611f - 11f;
  32.             iconSize = Hud.Window.Size.Height * 9.35f / 240f;
  33.  
  34.             GreenBrush = Hud.Render.CreateBrush(204, 0, 255, 0, 3);
  35.             OrangeBrush = Hud.Render.CreateBrush(204, 255, 255, 51, 3);
  36.             RedBrush = Hud.Render.CreateBrush(204, 255, 0, 0, 3);
  37.             RangeBrush = Hud.Render.CreateBrush(204, 51, 153, 255, 3);
  38.             ZeiBrush = Hud.Render.CreateBrush(255,192,96,0, 1);
  39.  
  40.             ChantodoDecorator = new TopLabelDecorator(Hud) {
  41.                 BackgroundTexture1 = Hud.Texture.GetTexture(Hud.Sno.SnoPowers.Wizard_ArcaneOrb.NormalIconTextureId),
  42.                 TextFont = Hud.Render.CreateFont("arial", 9, 255, 0, 255, 0, true, false, 255, 0, 0, 0, true),
  43.                 TextFunc = () => ChantodoStack.ToString()
  44.             };
  45.  
  46.             ArchonDecorator = new TopLabelDecorator(Hud) {
  47.                 BackgroundTexture1 = Hud.Texture.GetTexture(Hud.Sno.SnoPowers.Wizard_Archon.NormalIconTextureId),
  48.                 TextFont = Hud.Render.CreateFont("arial", 9, 255, 255, 255, 255, true, false, 255, 255, 51, 51, true),
  49.                 TextFunc = () => ArchonLeft.ToString("F0")
  50.             };
  51.         }
  52.  
  53.         public void PaintTopInGame(ClipState clipState) {
  54.             if (clipState != ClipState.BeforeClip) return;
  55.            
  56.             var me = Hud.Game.Me;
  57.             if (me.HeroClassDefinition.HeroClass != HeroClass.Wizard) return;
  58.             if (!me.Powers.BuffIsActive(440235, 0)) return;
  59.  
  60.             var archon = me.Powers.GetBuff(Hud.Sno.SnoPowers.Wizard_Archon.Sno);
  61.             if (archon != null) {
  62.                 ArchonLeft = archon.TimeLeftSeconds[2];
  63.                 if (ArchonLeft > 0) {
  64.                     if (ArchonLeft >= 10) ArchonDecorator.BackgroundBrush = GreenBrush;
  65.                     else if (ArchonLeft >= 5) ArchonDecorator.BackgroundBrush = OrangeBrush;
  66.                     else ArchonDecorator.BackgroundBrush = RedBrush;
  67.  
  68.                     ArchonDecorator.Paint(XPos + 3*iconSize, YPos, iconSize, iconSize, HorizontalAlign.Center);
  69.                     RangeBrush.DrawWorldEllipse(24, -1, me.FloorCoordinate);
  70.                     if (me.Powers.BuffIsActive(Hud.Sno.SnoPowers.ZeisStoneOfVengeancePrimary.Sno, 0)) { // 403468
  71.                         ZeiBrush.DrawWorldEllipse(10, -1, me.FloorCoordinate);
  72.                         ZeiBrush.DrawWorldEllipse(20, -1, me.FloorCoordinate);
  73.                     }
  74.                     return;
  75.                 }
  76.             }
  77.  
  78.             ChantodoStack = me.Powers.GetBuff(440235).IconCounts[0];
  79.             if (ChantodoStack >= 18) ChantodoDecorator.BackgroundBrush = GreenBrush;
  80.             else if (ChantodoStack >= 10) ChantodoDecorator.BackgroundBrush = OrangeBrush;
  81.             else ChantodoDecorator.BackgroundBrush = RedBrush;
  82.             ChantodoDecorator.Paint(XPos, YPos, iconSize, iconSize, HorizontalAlign.Center);
  83.         }
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement