Advertisement
s4000

DAV_SaderValorRGK

Dec 1st, 2019
3,484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.41 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_SaderValorRGK : BasePlugin, IInGameWorldPainter {
  12.         public bool showOnChar { get; set; }
  13.         public float xPos { get; set; }
  14.         public float yPos { get; set; }
  15.         public IFont Font_Norm { get; set; }
  16.         public IFont Font_Good { get; set; }
  17.         public IFont Font_Warm { get; set; }
  18.  
  19.         public float barH { get; set; }
  20.         public float barW { get; set; }
  21.         public float Energy_Bad { get; set; }
  22.         public string Energy_Message { get; set; }
  23.         public IBrush Brush_BG { get; set; }
  24.         public IBrush Brush_EnergyBad { get; set; }
  25.         public IBrush Brush_EnergyGood { get; set; }
  26.  
  27.         public int FistofHeaven_Min { get; set; }
  28.         public float iconSize { get; set; }
  29.         public WorldDecoratorCollection FistofHeaven_Decorator { get; set; }
  30.  
  31.         private float xref { get; set; }
  32.         private float yref { get; set; }
  33.         private ITexture Icon_FistHeaven { get; set; }
  34.         private ITexture Icon_HeavenFury { get; set; }
  35.         private ITexture Icon_COE { get; set; }
  36.         private IPlayer ValorSader { get; set; }
  37.  
  38.         public DAV_SaderValorRGK() {
  39.             Enabled = true;
  40.         }
  41.  
  42.         public override void Load(IController hud) {
  43.             base.Load(hud);
  44.  
  45.             Energy_Bad = 0.4f;
  46.             Energy_Message = "Fury : ";
  47.             FistofHeaven_Min = 4;
  48.  
  49.             showOnChar = true;
  50.             xPos = 60; // Hud.Window.Size.Width * 810 / 1920;
  51.             yPos = -20;  // Hud.Window.Size.Height * 160 / 1080;
  52.             barH = Hud.Window.Size.Height * 14 / 1080;
  53.             barW = Hud.Window.Size.Width * 120 / 1920;
  54.             iconSize = Hud.Window.Size.Height * 40 / 1080;
  55.  
  56.             Font_Norm = Hud.Render.CreateFont("arial", 7, 255, 255, 255, 255, false, false, true);
  57.             Font_Good = Hud.Render.CreateFont("arial", 9, 255, 51, 255, 51, true, false, 255, 0, 0, 0, true);
  58.             Font_Warm = Hud.Render.CreateFont("arial", 9, 255, 255, 51, 51, true, false, 255, 0, 0, 0, true);
  59.  
  60.             Brush_EnergyGood = Hud.Render.CreateBrush(240, 51, 255, 51, 0);
  61.             Brush_EnergyBad = Hud.Render.CreateBrush(240, 255, 51, 51, 0);
  62.             Brush_BG = Hud.Render.CreateBrush(240, 204, 204, 204, 0);
  63.  
  64.             FistofHeaven_Decorator = new WorldDecoratorCollection(
  65.                 new GroundCircleDecorator(Hud) {
  66.                     Brush = Hud.Render.CreateBrush(102, 204, 204, 51, 0),
  67.                     Radius = 5,
  68.                 }
  69.             );
  70.  
  71.             Icon_FistHeaven = Hud.Texture.GetTexture(3476188190);
  72.             Icon_HeavenFury = Hud.Texture.GetTexture(2206308930);
  73.             Icon_COE = Hud.Texture.GetTexture(2639019912);
  74.         }
  75.  
  76.         public void PaintWorld(WorldLayer layer) {
  77.             if (Hud.Game.SpecialArea != SpecialArea.GreaterRift) return;
  78.  
  79.             if (Hud.Game.Me.Powers.BuffIsActive(483639, 0))
  80.                 ValorSader = Hud.Game.Me;
  81.             else {
  82.                 if (Hud.Game.RiftPercentage < 100) return;
  83.                 var players = Hud.Game.Players.Where(x => x.HeroClassDefinition.HeroClass == HeroClass.Crusader && x.Powers.BuffIsActive(483639, 0));
  84.                 if (players.Count() == 1)
  85.                     ValorSader = players.FirstOrDefault();
  86.                 else return;
  87.             }
  88.  
  89.             var FistofHeaven = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_crusader_fistofheavens_teslacoil);
  90.             foreach (var actor in FistofHeaven)
  91.                 FistofHeaven_Decorator.Paint(layer, null, actor.FloorCoordinate, null);
  92.  
  93.             if (showOnChar) {
  94.                 var screenCoord = ValorSader.FloorCoordinate.ToScreenCoordinate(true);
  95.                 xref = screenCoord.X + xPos;
  96.                 yref = screenCoord.Y + yPos;
  97.             }
  98.             else {
  99.                 xref = xPos;
  100.                 yref = yPos;
  101.             }
  102.  
  103.             // Number of Fist of Heaven Actor
  104.             Icon_FistHeaven?.Draw(xref, yref, iconSize, iconSize);
  105.             var stack = FistofHeaven.Count();
  106.             var usedFont = stack < FistofHeaven_Min ? Font_Warm : Font_Good;
  107.             var layout = usedFont.GetTextLayout(stack.ToString());
  108.             usedFont.DrawText(layout, xref + (iconSize - layout.Metrics.Width) / 2f, yref + (iconSize - layout.Metrics.Height) / 2f);
  109.             xref += iconSize;
  110.  
  111.             // Number of Valor Set 2 Stack
  112.             var furyBuff = ValorSader.Powers.GetBuff(483643);
  113.             Icon_HeavenFury?.Draw(xref, yref, iconSize, iconSize);
  114.             stack = furyBuff.IconCounts[1];
  115.             usedFont = stack < 3 ? Font_Warm : Font_Good;
  116.             usedFont.DrawText(stack.ToString(), xref + 2, yref + 2);
  117.  
  118.             var timeLeft = furyBuff.TimeLeftSeconds[1];
  119.             if (timeLeft > 0) {
  120.                 layout = Font_Warm.GetTextLayout(timeLeft.ToString(timeLeft < 1 ? "F1" : "F0"));
  121.                 Font_Warm.DrawText(layout, xref + iconSize - layout.Metrics.Width - 2, yref + iconSize - layout.Metrics.Height - 2);
  122.             }
  123.             xref += iconSize;
  124.  
  125.             // COE
  126.             if (ValorSader.Powers.BuffIsActive(430674, 0)) {
  127.                 Icon_COE.Draw(xref, yref, iconSize, iconSize);
  128.                 var coeLeft = ValorSader.Powers.GetBuff(430674).TimeLeftSeconds[8];
  129.                 if (coeLeft >= 8) {
  130.                     usedFont = coeLeft > 12 ? Font_Warm : Font_Good;
  131.                     layout = usedFont.GetTextLayout((coeLeft - 8).ToString("F1"));
  132.                     usedFont.DrawText(layout, xref + (iconSize - layout.Metrics.Width) / 2f, yref + (iconSize - layout.Metrics.Height) / 2f);
  133.                 }
  134.             }
  135.             yref += iconSize;
  136.             xref -= iconSize * 2;
  137.  
  138.             // Resource Status
  139.             var EnergyPct = ValorSader.Stats.ResourcePctPri / 100f;
  140.             var usedBrush = EnergyPct < Energy_Bad ? Brush_EnergyBad : Brush_EnergyGood;
  141.             Brush_BG.DrawRectangle(xref, yref, barW, barH);
  142.             usedBrush.DrawRectangle(xref, yref, barW * EnergyPct, barH);
  143.  
  144.             layout = Font_Norm.GetTextLayout(Energy_Message + EnergyPct.ToString("0%"));
  145.             Font_Norm.DrawText(layout, xref + 2, yref + (barH - layout.Metrics.Height) / 2f);
  146.         }
  147.     }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement