Advertisement
zjqyf

GLQ_OtherPlayersPlugin

Jul 23rd, 2017
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.28 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Turbo.Plugins.Default;
  4.  
  5. namespace Turbo.Plugins.glq
  6. {
  7. public class GLQ_OtherPlayersPlugin : BasePlugin, IInGameWorldPainter
  8. {
  9.  
  10. public Dictionary<HeroClass, WorldDecoratorCollection> DecoratorByClass { get; set; }
  11. public float NameOffsetZ { get; set; }
  12.  
  13. public GLQ_OtherPlayersPlugin()
  14. {
  15. Enabled = true;
  16. DecoratorByClass = new Dictionary<HeroClass, WorldDecoratorCollection>();
  17. NameOffsetZ = 2.0f;
  18. }
  19.  
  20. public override void Load(IController hud)
  21. {
  22. base.Load(hud);
  23.  
  24. var pingTransformator = new StandardPingRadiusTransformator(Hud, 333);
  25. var shapePainter = new CircleShapePainter(Hud);
  26.  
  27. var grounLabelBackgroundBrush = Hud.Render.CreateBrush(255, 0, 0, 0, 0);
  28.  
  29. DecoratorByClass.Add(HeroClass.Barbarian, new WorldDecoratorCollection(
  30. new MapLabelDecorator(Hud)
  31. {
  32. LabelFont = Hud.Render.CreateFont("tahoma", 7f, 250, 255, 128, 64, false, false, 128, 0, 0, 0, true),
  33. Up = true,
  34. },
  35. new GroundLabelDecorator(Hud)
  36. {
  37. BackgroundBrush = grounLabelBackgroundBrush,
  38. BorderBrush = Hud.Render.CreateBrush(250, 255, 128, 64, 1),
  39. TextFont = Hud.Render.CreateFont("tahoma", 8f, 250, 255, 128, 64, false, false, 128, 0, 0, 0, true),
  40. }
  41. ));
  42.  
  43. DecoratorByClass.Add(HeroClass.Crusader, new WorldDecoratorCollection(
  44. new MapLabelDecorator(Hud)
  45. {
  46. LabelFont = Hud.Render.CreateFont("tahoma", 7f, 240, 240, 240, 240, false, false, 128, 0, 0, 0, true),
  47. Up = true,
  48. },
  49. new GroundLabelDecorator(Hud)
  50. {
  51. BackgroundBrush = grounLabelBackgroundBrush,
  52. BorderBrush = Hud.Render.CreateBrush(240, 240, 240, 240, 1),
  53. TextFont = Hud.Render.CreateFont("tahoma", 8f, 240, 240, 240, 240, false, false, 128, 0, 0, 0, true),
  54. }
  55. ));
  56.  
  57. DecoratorByClass.Add(HeroClass.DemonHunter, new WorldDecoratorCollection(
  58. new MapLabelDecorator(Hud)
  59. {
  60. LabelFont = Hud.Render.CreateFont("tahoma", 7f, 255, 0, 200, 255, false, false, 128, 0, 0, 0, true),
  61. Up = true,
  62. },
  63. new GroundLabelDecorator(Hud)
  64. {
  65. BackgroundBrush = grounLabelBackgroundBrush,
  66. BorderBrush = Hud.Render.CreateBrush(255, 0, 200, 255, 1),
  67. TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 0, 200, 255, false, false, 128, 0, 0, 0, true),
  68. }
  69. ));
  70.  
  71. DecoratorByClass.Add(HeroClass.Monk, new WorldDecoratorCollection(
  72. new MapLabelDecorator(Hud)
  73. {
  74. LabelFont = Hud.Render.CreateFont("tahoma", 7f, 245, 255, 255, 0, false, false, 128, 0, 0, 0, true),
  75. Up = true,
  76. },
  77. new GroundLabelDecorator(Hud)
  78. {
  79. BackgroundBrush = grounLabelBackgroundBrush,
  80. BorderBrush = Hud.Render.CreateBrush(245, 255, 255, 0, 1),
  81. TextFont = Hud.Render.CreateFont("tahoma", 8f, 245, 255, 255, 0, false, false, 128, 0, 0, 0, true),
  82. }
  83. ));
  84.  
  85. DecoratorByClass.Add(HeroClass.WitchDoctor, new WorldDecoratorCollection(
  86. new MapLabelDecorator(Hud)
  87. {
  88. LabelFont = Hud.Render.CreateFont("tahoma", 7f, 255, 0, 255, 0, false, false, 128, 0, 0, 0, true),
  89. Up = true,
  90. },
  91. new GroundLabelDecorator(Hud)
  92. {
  93. BackgroundBrush = grounLabelBackgroundBrush,
  94. BorderBrush = Hud.Render.CreateBrush(250, 0, 255, 0, 1),
  95. TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 0, 255, 0, false, false, 128, 0, 0, 0, true),
  96. }
  97. ));
  98.  
  99. DecoratorByClass.Add(HeroClass.Wizard, new WorldDecoratorCollection(
  100. new MapLabelDecorator(Hud)
  101. {
  102. LabelFont = Hud.Render.CreateFont("tahoma", 7f, 255, 255, 0, 255, false, false, 128, 0, 0, 0, true),
  103. Up = true,
  104. },
  105. new GroundLabelDecorator(Hud)
  106. {
  107. BackgroundBrush = grounLabelBackgroundBrush,
  108. BorderBrush = Hud.Render.CreateBrush(255, 255, 0, 255, 1),
  109. TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 255, 0, 255, false, false, 128, 0, 0, 0, true),
  110. }
  111. ));
  112. DecoratorByClass.Add(HeroClass.Necromancer, new WorldDecoratorCollection(
  113. new MapLabelDecorator(Hud)
  114. {
  115. LabelFont = Hud.Render.CreateFont("tahoma", 7f, 255, 175, 238, 238, false, false, 128, 0, 0, 0, true),
  116. Up = true,
  117. },
  118. new GroundLabelDecorator(Hud)
  119. {
  120. BackgroundBrush = grounLabelBackgroundBrush,
  121. BorderBrush = Hud.Render.CreateBrush(255, 175, 238, 238, 1),
  122. TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 175, 238, 238, false, false, 128, 0, 0, 0, true),
  123. }
  124. ));
  125.  
  126.  
  127.  
  128. }
  129.  
  130. public void PaintWorld(WorldLayer layer)
  131. {
  132. var players = Hud.Game.Players.Where(player => !player.IsMe && player.CoordinateKnown && (player.HeadStone == null));
  133. foreach (var player in players)
  134. {
  135. WorldDecoratorCollection decorator;
  136. if (!DecoratorByClass.TryGetValue(player.HeroClassDefinition.HeroClass, out decorator)) continue;
  137.  
  138. decorator.Paint(layer, null, NameOffsetZ != 0 ? player.FloorCoordinate.Offset(0, 0, NameOffsetZ) : player.FloorCoordinate, player.BattleTagAbovePortrait);
  139. }
  140. }
  141.  
  142. }
  143.  
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement