psychopyro212

Untitled

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