Advertisement
zjqyf

GLQ_PlayerSkillBarPlugin.cs

Jul 27th, 2017
2,707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.51 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using SharpDX;
  3. using System.Collections.Generic;
  4. namespace Turbo.Plugins.glq
  5. {
  6. public class GLQ_PlayerSkillBarPlugin : BasePlugin, IInGameWorldPainter
  7. {
  8. public GLQ_SkillBarPainter SkillPainter { get; set; }
  9. public float XOffset { get; set; }
  10. public float YOffset { get; set; }
  11. public bool Wizard { get; set; }
  12. public bool WitchDoctor { get; set; }
  13. public bool Barbarian { get; set; }
  14. public bool DemonHunter { get; set; }
  15. public bool Crusader { get; set; }
  16. public bool Monk { get; set; }
  17. public bool Necromancer { get; set; }
  18. private float currentX { get; set; }
  19. //public List<uint> WatchedSnos;
  20. private Dictionary<string, string> List = new Dictionary<string, string>();
  21. public bool AllSkill { get; set; }
  22. public GLQ_PlayerSkillBarPlugin()
  23. {
  24. Enabled = true;
  25. Wizard = true;
  26. WitchDoctor = true;
  27. Barbarian = true;
  28. DemonHunter = true;
  29. Crusader = true;
  30. Monk = true;
  31. Necromancer = true;
  32. AllSkill = true;
  33. }
  34. public override void Load(IController hud)
  35. {
  36. base.Load(hud);
  37. SkillPainter = new GLQ_SkillBarPainter(Hud, true)
  38. {
  39. TextureOpacity = 1.0f,
  40. CooldownFont = Hud.Render.CreateFont("arial", 7, 255, 255, 255, 255, true, false, 255, 0, 0, 0, true),
  41. };
  42. }
  43. public void AddNames(params string[] names)
  44. {
  45. foreach (var name in names)
  46. {
  47. List[name] = name;
  48. }
  49. }
  50. public void RemoveName(string name)
  51. {
  52. if (List.ContainsKey(name)) List.Remove(name);
  53. }
  54. public void PaintWorld(WorldLayer layer)
  55. {
  56. if (layer != WorldLayer.Ground)
  57. {
  58. return;
  59. }
  60.  
  61. foreach (IPlayer player in Hud.Game.Players)
  62. {
  63. currentX = XOffset;
  64. if (!player.IsMe)
  65. {
  66. if (Wizard && player.HeroClassDefinition.HeroClass == HeroClass.Wizard)
  67. {
  68. DrawPlayerSkills(player);
  69. }
  70. if (WitchDoctor && player.HeroClassDefinition.HeroClass == HeroClass.WitchDoctor)
  71. {
  72. DrawPlayerSkills(player);
  73. }
  74. if (Barbarian && player.HeroClassDefinition.HeroClass == HeroClass.Barbarian)
  75. {
  76. DrawPlayerSkills(player);
  77. }
  78. if (DemonHunter && player.HeroClassDefinition.HeroClass == HeroClass.DemonHunter)
  79. {
  80. DrawPlayerSkills(player);
  81. }
  82. if (Crusader && player.HeroClassDefinition.HeroClass == HeroClass.Crusader)
  83. {
  84. DrawPlayerSkills(player);
  85. }
  86. if (Monk && player.HeroClassDefinition.HeroClass == HeroClass.Monk)
  87. {
  88. DrawPlayerSkills(player);
  89. }
  90. if (Necromancer && player.HeroClassDefinition.HeroClass == HeroClass.Necromancer)
  91. {
  92. DrawPlayerSkills(player);
  93. }
  94. }
  95. }
  96. }
  97.  
  98. private void DrawPlayerSkills(IPlayer player)
  99. {
  100. var portraitRect = player.PortraitUiElement.Rectangle;
  101. var size = portraitRect.Width * 0.3f;
  102. var passivesX = portraitRect.Right;
  103. YOffset = portraitRect.Height * 0.095f;
  104. foreach (var skill in player.Powers.SkillSlots)
  105. {
  106. if (skill != null && (List.ContainsKey(skill.SnoPower.Sno.ToString()) || AllSkill))
  107. {
  108. var y = portraitRect.Y + YOffset;
  109.  
  110. var rect = new RectangleF( passivesX + currentX, y, size, size);
  111.  
  112. SkillPainter.Paint(skill, rect);
  113.  
  114. if (Hud.Window.CursorInsideRect(rect.X, rect.Y, rect.Width, rect.Height))
  115. {
  116. Hud.Render.SetHint(skill.RuneNameLocalized);
  117. }
  118. currentX += size;
  119. }
  120. }
  121. }
  122. }
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement