Advertisement
zjqyf

GLQ_OriginalHealthPotionSkillPlugin.cs

Sep 10th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 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. Cooldown = ((Hud.Game.Me.Powers.HealthPotionSkill.CooldownStartTick + 30 * 60d) - Hud.Game.CurrentGameTick) / 60d;
  35. IsOnCooldown = Cooldown <= 30 && Cooldown >= 0 ? true : false;
  36. if (IsOnCooldown)
  37. {
  38. Decorator.TextFunc = () => Cooldown < 1 ? Cooldown.ToString("f1") : Cooldown.ToString("f0");
  39. Decorator.Paint(rect.X, rect.Y, rect.Width, rect.Height, HorizontalAlign.Center);
  40. }
  41.  
  42. }
  43.  
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement