Advertisement
JackCeparou

GLQ_PlayersCirclePlugin

Aug 2nd, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.69 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_PlayersCirclePlugin : BasePlugin, IInGameWorldPainter
  8.     {
  9.         public WorldDecoratorCollection MeDecorator { get; set; }
  10.         public Dictionary<HeroClass, WorldDecoratorCollection> HeroClassDecorators { get; private set; }
  11.  
  12.         public GLQ_PlayersCirclePlugin()
  13.         {
  14.             Enabled = true;
  15.             HeroClassDecorators = new Dictionary<HeroClass, WorldDecoratorCollection>();
  16.         }
  17.  
  18.         public override void Load(IController hud)
  19.         {
  20.             base.Load(hud);
  21.  
  22.             MeDecorator = new WorldDecoratorCollection(
  23.                 new GroundCircleDecorator(Hud)
  24.                 {
  25.                     Brush = Hud.Render.CreateBrush(255, 255, 0, 0, 3),
  26.                     Radius = -1,
  27.                 }
  28.             );
  29.  
  30.             HeroClassDecorators.Add(HeroClass.Wizard, new WorldDecoratorCollection(
  31.                 new GroundCircleDecorator(Hud)
  32.                 {
  33.                     Brush = Hud.Render.CreateBrush(255, 255, 0, 255, 3),
  34.                     Radius = -1,
  35.                 }
  36.             ));
  37.             HeroClassDecorators.Add(HeroClass.WitchDoctor, new WorldDecoratorCollection(
  38.                 new GroundCircleDecorator(Hud)
  39.                 {
  40.                     Brush = Hud.Render.CreateBrush(255, 0, 128, 64, 3),
  41.                     Radius = -1,
  42.                 }
  43.             ));
  44.             HeroClassDecorators.Add(HeroClass.Barbarian, new WorldDecoratorCollection(
  45.                 new GroundCircleDecorator(Hud)
  46.                 {
  47.                     Brush = Hud.Render.CreateBrush(255, 255, 128, 64, 3),
  48.                     Radius = -1,
  49.                 }
  50.             ));
  51.             HeroClassDecorators.Add(HeroClass.DemonHunter, new WorldDecoratorCollection(
  52.                 new GroundCircleDecorator(Hud)
  53.                 {
  54.                     Brush = Hud.Render.CreateBrush(255, 36, 4, 187, 3),
  55.                     Radius = -1,
  56.                 }
  57.             ));
  58.             HeroClassDecorators.Add(HeroClass.Crusader, new WorldDecoratorCollection(
  59.                 new GroundCircleDecorator(Hud)
  60.                 {
  61.                     Brush = Hud.Render.CreateBrush(255, 240, 240, 240, 3),
  62.                     Radius = -1,
  63.                 }
  64.             ));
  65.             HeroClassDecorators.Add(HeroClass.Monk, new WorldDecoratorCollection(
  66.                 new GroundCircleDecorator(Hud)
  67.                 {
  68.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 0, 3),
  69.                     Radius = -1,
  70.                 }
  71.             ));
  72.             HeroClassDecorators.Add(HeroClass.Necromancer, new WorldDecoratorCollection(
  73.                 new GroundCircleDecorator(Hud)
  74.                 {
  75.                     Brush = Hud.Render.CreateBrush(255, 0, 128, 128, 3),
  76.                     Radius = -1,
  77.                 }
  78.             ));
  79.         }
  80.  
  81.         public void PaintWorld(WorldLayer layer)
  82.         {
  83.             var players = Hud.Game.Players.Where(player => player.CoordinateKnown && (player.HeadStone == null));
  84.             foreach (var player in players)
  85.             {
  86.                 if (player.IsMe)
  87.                 {
  88.                     MeDecorator.Paint(layer, player, player.FloorCoordinate, null);
  89.                 }
  90.                 else
  91.                 {
  92.                     WorldDecoratorCollection decorator;
  93.                     if (!HeroClassDecorators.TryGetValue(player.HeroClassDefinition.HeroClass, out decorator)) return;
  94.  
  95.                     decorator.Paint(layer, player, player.FloorCoordinate, null);
  96.                 }
  97.             }
  98.         }
  99.  
  100.     }
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement