Advertisement
psychopyro212

Untitled

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