psychopyro212

Untitled

Feb 20th, 2017
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.21 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace Turbo.Plugins.Psycho
  5. {
  6.     public class ShrineLabelsPlugin : BasePlugin, ICustomizer, IInGameWorldPainter
  7.     {
  8.         public bool UseCustomColors { get; set; }
  9.         public bool UseCustomNames { get; set; }
  10.         public string PossibleRiftPylonName { get; set; }
  11.         public Dictionary<ShrineType, WorldDecoratorCollection> ShrineDecorators { get; set; }
  12.         public Dictionary<ShrineType, string> ShrineCustomNames { get; set; }
  13.         public WorldDecoratorCollection PossibleRiftPylonDecorators { get; set; }
  14.  
  15.         public ShrineLabelsPlugin()
  16.         {
  17.             Enabled = true;
  18.             UseCustomColors = false;
  19.             UseCustomNames = false;
  20.         }
  21.  
  22.         public WorldDecoratorCollection CreateDecorators(float size = 6f, int a = 192, int r = 255, int g = 255, int b = 55, float radiusOffset = 5f)
  23.         {
  24.             return new WorldDecoratorCollection(
  25.                 new MapLabelDecorator(Hud)
  26.                 {
  27.                     LabelFont = Hud.Render.CreateFont("tahoma", size, a, r, g, b, false, false, 128, 0, 0, 0, true),
  28.                     RadiusOffset = radiusOffset,
  29.                 }
  30.             );
  31.         }
  32.  
  33.         public override void Load(IController hud)
  34.         {
  35.             base.Load(hud);
  36.             ShrineDecorators = new Dictionary<ShrineType, WorldDecoratorCollection>();
  37.             ShrineCustomNames = new Dictionary<ShrineType, string>();
  38.  
  39.             ShrineDecorators[ShrineType.PoolOfReflection] = CreateDecorators();
  40.             ShrineDecorators[ShrineType.HealingWell] = CreateDecorators();
  41.             ShrineDecorators[ShrineType.BlessedShrine] = CreateDecorators();
  42.             ShrineDecorators[ShrineType.EnlightenedShrine] = CreateDecorators();
  43.             ShrineDecorators[ShrineType.FortuneShrine] = CreateDecorators();
  44.             ShrineDecorators[ShrineType.FrenziedShrine] = CreateDecorators();
  45.             ShrineDecorators[ShrineType.EmpoweredShrine] = CreateDecorators();
  46.             ShrineDecorators[ShrineType.FleetingShrine] = CreateDecorators();
  47.             ShrineDecorators[ShrineType.PowerPylon] = CreateDecorators();
  48.             ShrineDecorators[ShrineType.ConduitPylon] = CreateDecorators();
  49.             ShrineDecorators[ShrineType.ChannelingPylon] = CreateDecorators();
  50.             ShrineDecorators[ShrineType.ShieldPylon] = CreateDecorators();
  51.             ShrineDecorators[ShrineType.SpeedPylon] = CreateDecorators();
  52.             ShrineDecorators[ShrineType.BanditShrine] = CreateDecorators();
  53.  
  54.             PossibleRiftPylonDecorators = CreateDecorators(7f, 255, 255, 255, 0);
  55.  
  56.             ShrineCustomNames[ShrineType.PoolOfReflection] = string.Empty;
  57.             ShrineCustomNames[ShrineType.HealingWell] = string.Empty;
  58.             ShrineCustomNames[ShrineType.BlessedShrine] = "Blessed Shrine";
  59.             ShrineCustomNames[ShrineType.EnlightenedShrine] = "Enlightened Shrine";
  60.             ShrineCustomNames[ShrineType.FortuneShrine] = "Fortune Shrine";
  61.             ShrineCustomNames[ShrineType.FrenziedShrine] = "Frenzied Shrine";
  62.             ShrineCustomNames[ShrineType.EmpoweredShrine] = "Empowered Shrine";
  63.             ShrineCustomNames[ShrineType.FleetingShrine] = "Fleeting Shrine";
  64.             ShrineCustomNames[ShrineType.PowerPylon] = "Power Pylon";
  65.             ShrineCustomNames[ShrineType.ConduitPylon] = "Conduit Pylon";
  66.             ShrineCustomNames[ShrineType.ChannelingPylon] = "Channeling Pylon";
  67.             ShrineCustomNames[ShrineType.ShieldPylon] = "Shield Pylon";
  68.             ShrineCustomNames[ShrineType.SpeedPylon] = "Speed Pylon";
  69.             ShrineCustomNames[ShrineType.BanditShrine] = "Bandit Shrine";
  70.  
  71.             PossibleRiftPylonName = "Pylon?";
  72.         }
  73.  
  74.         public void Customize()
  75.         {
  76.             if (UseCustomColors == false && UseCustomNames == false)
  77.             {
  78.                 Hud.RunOnPlugin<ShrinePlugin>(plugin =>
  79.                 {
  80.                     plugin.AllShrineDecorator.Add(new MapLabelDecorator(Hud)
  81.                     {
  82.                         LabelFont = Hud.Render.CreateFont("tahoma", 6f, 192, 255, 255, 55, false, false, 128, 0, 0, 0, true),
  83.                         RadiusOffset = 5.0f,
  84.                     });
  85.                 });
  86.             }
  87.         }
  88.  
  89.         public void PaintWorld(WorldLayer layer)
  90.         {
  91.             if (UseCustomColors != true && UseCustomNames != true) return;
  92.  
  93.             var shrines = Hud.Game.Shrines.Where(s => s.DisplayOnOverlay);
  94.             foreach (var shrine in shrines)
  95.             {
  96.                 if (!ShrineDecorators.ContainsKey(shrine.Type)) continue;
  97.  
  98.                 var shrineName = UseCustomNames ? ShrineCustomNames[shrine.Type] : shrine.SnoActor.NameLocalized;
  99.                 ShrineDecorators[shrine.Type].Paint(layer, shrine, shrine.FloorCoordinate, shrineName);
  100.             }
  101.  
  102.             var riftPylonSpawnPoints = Hud.Game.Actors.Where(x => x.SnoActor.Sno == 428690);
  103.             foreach (var actor in riftPylonSpawnPoints)
  104.             {
  105.                 PossibleRiftPylonDecorators.Paint(layer, actor, actor.FloorCoordinate, UseCustomNames ? PossibleRiftPylonName : "Pylon?");
  106.             }
  107.         }
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment