Advertisement
zjqyf

GLQ_OriginalHealthPotionSkillPlugin.cs

Sep 12th, 2017
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. using SharpDX;
  2. using System;
  3. using Turbo.Plugins.Default;
  4. namespace Turbo.Plugins.glq
  5. {
  6. public class GLQ_OriginalHealthPotionSkillPlugin : BasePlugin, IInGameTopPainter, ICustomizer
  7. {
  8. public TopLabelDecorator Decorator { get; set; }
  9.  
  10. public GLQ_OriginalHealthPotionSkillPlugin()
  11. {
  12. Enabled = true;
  13. }
  14. public override void Load(IController hud)
  15. {
  16. base.Load(hud);
  17. Decorator = new TopLabelDecorator(Hud)
  18. {
  19. TextFont = Hud.Render.CreateFont("tahoma", 14, 255, 255, 255, 255, true, false, 250, 0, 0, 0, true),
  20. };
  21. }
  22. public void Customize()
  23. {
  24. Hud.GetPlugin<OriginalHealthPotionSkillPlugin>().Enabled = false;//Disable the default plugin
  25. }
  26. public void PaintTopInGame(ClipState clipState)
  27. {
  28. if (Hud.Render.UiHidden) return;
  29. if (clipState != ClipState.BeforeClip) return;
  30. double Cooldown;
  31. bool IsOnCooldown;
  32. var ui = Hud.Render.GetPlayerSkillUiElement(ActionKey.Heal);
  33. var rect = new RectangleF((float)Math.Round(ui.Rectangle.X) + 0.5f, (float)Math.Round(ui.Rectangle.Y) + 0.5f, (float)Math.Round(ui.Rectangle.Width), (float)Math.Round(ui.Rectangle.Height));
  34. if(Hud.Game.Me.Powers.HealthPotionSkill.IsOnCooldown)
  35. {
  36. Cooldown = (Hud.Game.Me.Powers.HealthPotionSkill.CooldownFinishTick - Hud.Game.CurrentGameTick) / 60d;
  37. IsOnCooldown = Cooldown <= 30 && Cooldown >= 0 ? true : false;
  38. if (IsOnCooldown)
  39. {
  40. Decorator.TextFunc = () => Cooldown < 1 ? Cooldown.ToString("f1") : Cooldown.ToString("f0");
  41. Decorator.Paint(rect.X, rect.Y, rect.Width, rect.Height, HorizontalAlign.Center);
  42. }
  43. }
  44.  
  45.  
  46.  
  47.  
  48. }
  49.  
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement