psychopyro212

Untitled

Feb 20th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.69 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.        
  67.  
  68.         public void Customize()
  69.        
  70.         {
  71.             if (OtherPlayersCircles)
  72.             {
  73.                 Hud.RunOnPlugin<OtherPlayersPlugin>(plugin =>
  74.                 {
  75.                     plugin.NameOffsetZ = 0;  
  76.                     foreach (HeroClass heroClass in Enum.GetValues(typeof(HeroClass)))
  77.                     {
  78.                         plugin.DecoratorByClass[heroClass].Decorators.Add(MyGroundCirleDecorator[heroClass]);
  79.                         plugin.DecoratorByClass[heroClass].Decorators.Add(MyMapCircleDecorator[heroClass]);
  80.                    
  81.                     }
  82.                 });
  83.             }
  84.         }
  85.            
  86.         public void PaintWorld(WorldLayer layer)
  87.         {
  88.             if (Hud.Game.IsInTown) return;
  89.             if (MyPlayerCircle == false) return;
  90.  
  91.             if (MyPlayerCircleColorOverride)
  92.             {
  93.                 MyGroundCircle.Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, string.Empty);
  94.                 return;
  95.             }
  96.             if (OtherPlayersCircles)
  97.             {            
  98.                 Hud.RunOnPlugin<OtherPlayersPlugin>(plugin =>
  99.                 {
  100.                     plugin.DecoratorByClass[Hud.Game.Me.HeroClassDefinition.HeroClass].Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, string.Empty);
  101.                     return;
  102.                 });  
  103.             }              
  104.         }
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment