Advertisement
s4000

DAV_MonkCombinationStrike

Jan 21st, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.26 KB | Gaming | 0 0
  1. using System;
  2. using Turbo.Plugins.Default;
  3.  
  4. namespace Turbo.Plugins.DAV {
  5.  
  6.     public class DAV_MonkCombinationStrike : BasePlugin, IInGameTopPainter {
  7.         public IFont TimeFont { get; set; }
  8.         public IBrush GreenBrush { get; set; }
  9.         public IBrush RedBrush { get; set; }
  10.         public IBrush WhiteBrush { get; set; }
  11.         public double Attacktime { get; set; } = 3d;
  12.         public float BrushHigh { get; set; } = 15f;
  13.  
  14.         public DAV_MonkCombinationStrike() {
  15.             Enabled = true;
  16.         }
  17.  
  18.         public override void Load(IController hud) {
  19.             base.Load(hud);
  20.  
  21.             TimeFont = Hud.Render.CreateFont("arial", 7, 255, 255, 255, 255, false, false, 255, 0, 0, 0, true);
  22.             GreenBrush = Hud.Render.CreateBrush(240, 128, 255, 0, 0);
  23.             RedBrush = Hud.Render.CreateBrush(240, 255, 51, 51, 0);
  24.             WhiteBrush = Hud.Render.CreateBrush(240, 255, 255, 255, 0);
  25.         }
  26.  
  27.         public void PaintTopInGame(ClipState clipState) {
  28.             if (clipState != ClipState.BeforeClip) return;
  29.             if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Monk) return;
  30.  
  31.             var csPassive = Hud.Game.Me.Powers.GetBuff(218415);
  32.             if (csPassive == null || !csPassive.Active) return;
  33.  
  34.             var uiSkill1 = Hud.Render.GetPlayerSkillUiElement(ActionKey.Skill1);
  35.             foreach (var skill in Hud.Game.Me.Powers.CurrentSkills) {
  36.                 var buffIndex = BuffIndex(skill.SnoPower.Sno);
  37.                 if (buffIndex <= 0) continue;
  38.  
  39.                 var ui = Hud.Render.GetPlayerSkillUiElement(skill.Key);
  40.                 var x = (float)Math.Round(ui.Rectangle.X) + 0.5f;
  41.                 var y = ((float)Math.Round(uiSkill1.Rectangle.Y) + (float)Math.Round(ui.Rectangle.Height) + 0.5f);
  42.                 var w = (float)Math.Round(ui.Rectangle.Width);
  43.                 WhiteBrush.DrawRectangle(x, y, w, BrushHigh);
  44.  
  45.                 var t = csPassive.TimeLeftSeconds[buffIndex];
  46.                 if (t <= 0) continue;
  47.  
  48.                 var w1 = w * (float)t / 10f;
  49.                 var timeBrush = t > Attacktime ? GreenBrush : RedBrush;
  50.  
  51.                 timeBrush.DrawRectangle(x, y, w1, BrushHigh);
  52.                 var layout = TimeFont.GetTextLayout(t.ToString(t > Attacktime ? "F0" : "F1"));
  53.                 TimeFont.DrawText(layout, x + 1, y + (BrushHigh - layout.Metrics.Height)/2);
  54.             }
  55.         }
  56.  
  57.         private int BuffIndex(uint skillSno) {
  58.             switch (skillSno) {
  59.                 case 96019 : return 2;
  60.                 case 96311 : return 3;
  61.                 case 95940 : return 4;
  62.                 case 97110 : return 5;
  63.             }
  64.  
  65.             return -1;
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement