psychopyro212

Untitled

Feb 20th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.63 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Collections.Generic;
  3. namespace Turbo.Plugins.PsychosPlugins
  4. {
  5.     public class ClassMarkersPlugin : BasePlugin, ICustomizer, IInGameWorldPainter
  6.     {
  7.         public Dictionary<HeroClass, MapShapeDecorator> MyMapCircleDecorator { get; set; }
  8.         public Dictionary<HeroClass, GroundCircleDecorator> MyGroundCirleDecorator { get; set; }
  9.         public WorldDecoratorCollection MyGroundCircle {get; set;}
  10.         public bool MyPlayerCircle {get; set;}
  11.         public bool OtherPlayersCircles {get; set;}
  12.         public bool MyPlayerCircleColorOverride {get; set;}
  13.         private enum Enum{}
  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.  
  33.         public GroundCircleDecorator CreateGroundCircleDecorators(int a = 255, int r = 255, int g = 255, int b = 255, int t = 5, float radius = 4f)
  34.         {
  35.             return new GroundCircleDecorator(Hud)
  36.                 {
  37.                     Brush = Hud.Render.CreateBrush(a, r, g, b, t),
  38.                     Radius = radius,
  39.                 };
  40.         }
  41.  
  42.         public override void Load(IController hud)
  43.         {
  44.             base.Load(hud);
  45.  
  46.             MyMapCircleDecorator = new Dictionary<HeroClass, MapShapeDecorator>();
  47.             MyGroundCirleDecorator = new Dictionary<HeroClass, GroundCircleDecorator>();
  48.  
  49.             MyMapCircleDecorator[HeroClass.Barbarian] = CreateMapCircleDecorators(200, 250, 10, 10);
  50.             MyMapCircleDecorator[HeroClass.Crusader] = CreateMapCircleDecorators(240, 0, 200, 250);
  51.             MyMapCircleDecorator[HeroClass.DemonHunter] = CreateMapCircleDecorators(255, 0, 0, 200, 5);
  52.             MyMapCircleDecorator[HeroClass.Monk] = CreateMapCircleDecorators(245, 120, 0, 200);
  53.             MyMapCircleDecorator[HeroClass.WitchDoctor] = CreateMapCircleDecorators(155, 0, 155, 125);
  54.             MyMapCircleDecorator[HeroClass.Wizard] = CreateMapCircleDecorators(255, 250, 50, 180);
  55.  
  56.             MyGroundCirleDecorator[HeroClass.Barbarian] = CreateGroundCircleDecorators(200, 250, 10, 10);
  57.             MyGroundCirleDecorator[HeroClass.Crusader] = CreateGroundCircleDecorators(240, 0, 200, 250);
  58.             MyGroundCirleDecorator[HeroClass.DemonHunter] = CreateGroundCircleDecorators(255, 0, 0, 200, 5);
  59.             MyGroundCirleDecorator[HeroClass.Monk] = CreateGroundCircleDecorators(245, 120, 0, 200);
  60.             MyGroundCirleDecorator[HeroClass.WitchDoctor] = CreateGroundCircleDecorators(155, 0, 155, 125);
  61.             MyGroundCirleDecorator[HeroClass.Wizard] = CreateGroundCircleDecorators(255, 250, 50, 180);
  62.  
  63.             MyGroundCircle = new WorldDecoratorCollection(CreateGroundCircleDecorators(255,255,255,255), CreateMapCircleDecorators(255,255,255,255));
  64.         }
  65.        
  66.         public void Customize()
  67.         {
  68.             if (OtherPlayersCircles)
  69.             {
  70.                 Hud.RunOnPlugin<OtherPlayersPlugin>(plugin =>
  71.                 {
  72.                     plugin.NameOffsetZ = 0;  
  73.                     foreach (HeroClass heroClass in Enum.GetValues(typeof(HeroClass)))
  74.                     {
  75.                         plugin.DecoratorByClass[heroClass].Decorators.Add(MyGroundCirleDecorator[heroClass]);
  76.                         plugin.DecoratorByClass[heroClass].Decorators.Add(MyMapCircleDecorator[heroClass]);
  77.                     }
  78.                 });
  79.             }
  80.         }
  81.  
  82.         public void PaintWorld(WorldLayer layer)
  83.         {
  84.             if (Hud.Game.IsInTown) return;
  85.             if (MyPlayerCircle == false) return;
  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. }
Advertisement
Add Comment
Please, Sign In to add comment