Advertisement
s4000

DAV_MonkRush

Dec 3rd, 2019
1,362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.42 KB | None | 0 0
  1. using SharpDX;
  2. using SharpDX.Direct2D1;
  3. using System;
  4. using System.Linq;
  5. using System.Globalization;
  6. using System.Collections.Generic;
  7. using Turbo.Plugins.Default;
  8.  
  9. namespace Turbo.Plugins.DAV
  10. {
  11.     public class DAV_MonkRush : BasePlugin, IInGameWorldPainter {
  12.         public float xPos { get; set; }
  13.         public float yPos { get; set; }
  14.         public float iconSize { get; set; }
  15.         public IFont Font_Good { get; set; }
  16.         public IFont Font_Warm { get; set; }
  17.  
  18.         public int Flurry_Min { get; set; }
  19.         public bool showRadius { get; set; }
  20.         public float ReleaseRaduis { get; set; }
  21.         public IBrush Brush_Flurry { get; set; }
  22.         public IBrush Brush_Release { get; set; }
  23.  
  24.         private ITexture Icon_COE { get; set; }
  25.         private ITexture Icon_TRush { get; set; }
  26.         private bool OK_COE { get; set; }
  27.         private bool OK_Stack { get; set; }
  28.  
  29.         public DAV_MonkRush() {
  30.             Enabled = true;
  31.         }
  32.  
  33.         public override void Load(IController hud) {
  34.             base.Load(hud);
  35.  
  36.             Flurry_Min = 20;
  37.             showRadius = true;
  38.             ReleaseRaduis = 20f;
  39.  
  40.             xPos = Hud.Window.Size.Width * 810 / 1920;
  41.             yPos = Hud.Window.Size.Height * 160 / 1080;
  42.             iconSize = Hud.Window.Size.Height * 40 / 1080;
  43.  
  44.             Brush_Flurry = Hud.Render.CreateBrush(255, 51, 51, 255, 2);
  45.             Brush_Release = Hud.Render.CreateBrush(255, 255, 51, 51, 3);
  46.             Font_Good = Hud.Render.CreateFont("arial", 9, 255, 51, 255, 51, true, false, 255, 0, 0, 0, true);
  47.             Font_Warm = Hud.Render.CreateFont("arial", 9, 255, 255, 51, 51, true, false, 255, 0, 0, 0, true);
  48.  
  49.             Icon_TRush = Hud.Texture.GetTexture(2984253060);
  50.             Icon_COE = Hud.Texture.GetTexture(1541236666);
  51.         }
  52.  
  53.         public void PaintWorld(WorldLayer layer) {
  54.             if (Hud.Game.SpecialArea != SpecialArea.GreaterRift) return;
  55.             if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Monk) return;
  56.             if (!Hud.Game.Me.Powers.BuffIsActive(484106, 0)) return; // NO "Won Khim Lau" Power
  57.             if (!Hud.Game.Me.Powers.UsedSkills.Any(x => x.SnoPower.Sno == 121442 && x.RuneNameEnglish == "Flurry")) return;
  58.  
  59.             if (showRadius)
  60.                 Brush_Flurry.DrawWorldEllipse(15, -1, Hud.Game.Me.FloorCoordinate);
  61.  
  62.             // Stack of Flurry
  63.             Icon_TRush?.Draw(xPos, yPos, iconSize, iconSize);
  64.             var rushBuff = Hud.Game.Me.Powers.GetBuff(121442);
  65.             if (rushBuff != null) {
  66.                 var stack = rushBuff.IconCounts[3];
  67.                 OK_Stack = stack >= Flurry_Min;
  68.                 var usedFont = OK_Stack ? Font_Good : Font_Warm;
  69.                 var layout = usedFont.GetTextLayout(stack.ToString());
  70.                 usedFont.DrawText(layout, xPos + (iconSize - layout.Metrics.Width) / 2f, yPos + (iconSize - layout.Metrics.Height) / 2f);
  71.             }
  72.             else OK_Stack = false;
  73.  
  74.             // COE
  75.             if (Hud.Game.Me.Powers.BuffIsActive(430674, 0)) {
  76.                 Icon_COE.Draw(xPos + iconSize, yPos, iconSize, iconSize);
  77.                 var coeBuff = Hud.Game.Me.Powers.GetBuff(430674);
  78.                 if (coeBuff == null) return;
  79.  
  80.                 var coeLeft = coeBuff.TimeLeftSeconds[8];
  81.  
  82.                 if (coeLeft >= 16) coeLeft -= 16;
  83.                 else if (coeLeft <= 4) coeLeft += 4;
  84.                 else return;
  85.  
  86.                 OK_COE = coeLeft <= 4d;
  87.                 var usedFont = OK_COE ? Font_Good : Font_Warm;
  88.                 var layout = usedFont.GetTextLayout(coeLeft.ToString("F1"));
  89.                 usedFont.DrawText(layout, xPos + iconSize * 1.5f - layout.Metrics.Width / 2f, yPos + (iconSize - layout.Metrics.Height) / 2f);
  90.             }
  91.             else return;
  92.  
  93.             if (OK_COE && OK_Stack) {
  94.                 Brush_Release.DrawRectangle(xPos, yPos, 2 * iconSize, iconSize);
  95.                 Brush_Release.DrawWorldEllipse(ReleaseRaduis, -1, Hud.Game.Me.FloorCoordinate);
  96.             }
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement