psychopyro212

Untitled

Mar 26th, 2017
2,086
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.62 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace Turbo.Plugins.Psycho
  5. {
  6.     public class ClassMarkersPlugin : BasePlugin, ICustomizer, IInGameWorldPainter
  7.     {
  8.         public Dictionary<HeroClass, MapShapeDecorator> MyMapCircleDecorator { get; set; }
  9.         public Dictionary<HeroClass, GroundCircleDecorator> MyGroundCirleDecorator { get; set; }
  10.         public WorldDecoratorCollection MyGroundCircle {get; set;}
  11.         public bool MyPlayerCircle {get; set;}
  12.         public bool OtherPlayersCircles {get; set;}
  13.         public bool MyPlayerCircleColorOverride {get; set;}
  14.  
  15.         public ClassMarkersPlugin()
  16.         {
  17.             Enabled = true;
  18.             MyPlayerCircle = true;
  19.             OtherPlayersCircles = true;
  20.             MyPlayerCircleColorOverride = false;
  21.         }
  22.  
  23.         public MapShapeDecorator CreateMapCircleDecorators(int a = 255, int r = 255, int g = 255, int b = 255, int t = 5, float radius = 2f)
  24.         {
  25.             return new MapShapeDecorator(Hud)
  26.                 {
  27.                     Brush = Hud.Render.CreateBrush(a, r, g, b, t),
  28.                     ShapePainter = new CircleShapePainter(Hud),
  29.                     Radius = radius,
  30.                 };
  31.         }
  32.         public GroundCircleDecorator CreateGroundCircleDecorators(int a = 255, int r = 255, int g = 255, int b = 255, int t = 5, float radius = 4f)
  33.         {
  34.             return new GroundCircleDecorator(Hud)
  35.                 {
  36.                     Brush = Hud.Render.CreateBrush(a, r, g, b, t),
  37.                     Radius = radius,
  38.                 };
  39.         }
  40.  
  41.         public override void Load(IController hud)
  42.         {
  43.             base.Load(hud);
  44.  
  45.             MyMapCircleDecorator = new Dictionary<HeroClass, MapShapeDecorator>();
  46.             MyGroundCirleDecorator = new Dictionary<HeroClass, GroundCircleDecorator>();
  47.  
  48.             MyMapCircleDecorator[HeroClass.Barbarian] = CreateMapCircleDecorators(200, 250, 10, 10);
  49.             MyMapCircleDecorator[HeroClass.Crusader] = CreateMapCircleDecorators(240, 0, 200, 250);
  50.             MyMapCircleDecorator[HeroClass.DemonHunter] = CreateMapCircleDecorators(255, 0, 0, 200, 5);
  51.             MyMapCircleDecorator[HeroClass.Monk] = CreateMapCircleDecorators(245, 120, 0, 200);
  52.             MyMapCircleDecorator[HeroClass.WitchDoctor] = CreateMapCircleDecorators(155, 0, 155, 125);
  53.             MyMapCircleDecorator[HeroClass.Wizard] = CreateMapCircleDecorators(255, 250, 50, 180);
  54.  
  55.             MyGroundCirleDecorator[HeroClass.Barbarian] = CreateGroundCircleDecorators(200, 250, 10, 10);
  56.             MyGroundCirleDecorator[HeroClass.Crusader] = CreateGroundCircleDecorators(240, 0, 200, 250);
  57.             MyGroundCirleDecorator[HeroClass.DemonHunter] = CreateGroundCircleDecorators(255, 0, 0, 200, 5);
  58.             MyGroundCirleDecorator[HeroClass.Monk] = CreateGroundCircleDecorators(245, 120, 0, 200);
  59.             MyGroundCirleDecorator[HeroClass.WitchDoctor] = CreateGroundCircleDecorators(155, 0, 155, 125);
  60.             MyGroundCirleDecorator[HeroClass.Wizard] = CreateGroundCircleDecorators(255, 250, 50, 180);
  61.  
  62.             MyGroundCircle = new WorldDecoratorCollection(CreateGroundCircleDecorators(255,255,255,255),CreateMapCircleDecorators(255,255,255,255));
  63.         }
  64.  
  65.         public void Customize()
  66.         {
  67.             if (OtherPlayersCircles)
  68.             {
  69.                 Hud.RunOnPlugin<OtherPlayersPlugin>(plugin =>
  70.                 {
  71.                     plugin.NameOffsetZ = 0;  
  72.                     foreach (HeroClass heroClass in Enum.GetValues(typeof(HeroClass)))
  73.                     {
  74.                         plugin.DecoratorByClass[heroClass].Decorators.Add(MyGroundCirleDecorator[heroClass]);
  75.                         plugin.DecoratorByClass[heroClass].Decorators.Add(MyMapCircleDecorator[heroClass]);
  76.                     }
  77.                 });
  78.             }
  79.         }
  80.            
  81.         public void PaintWorld(WorldLayer layer)
  82.         {
  83.             if (Hud.Game.IsInTown) return;
  84.             if (MyPlayerCircle == false) return;
  85.  
  86.             if (MyPlayerCircleColorOverride)
  87.             {
  88.                 MyGroundCircle.Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, string.Empty);
  89.                 return;
  90.             }
  91.             if (OtherPlayersCircles)
  92.             {            
  93.                 Hud.RunOnPlugin<OtherPlayersPlugin>(plugin =>
  94.                 {
  95.                     plugin.DecoratorByClass[Hud.Game.Me.HeroClassDefinition.HeroClass].Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, string.Empty);
  96.                     return;
  97.                 });  
  98.             }              
  99.         }
  100.     }
  101. }
Add Comment
Please, Sign In to add comment