psychopyro212

Untitled

Mar 26th, 2017
4,012
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.39 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace Turbo.Plugins.Psycho
  6. {
  7.     public class ShrineLabelsPlugin : BasePlugin, ICustomizer, IInGameWorldPainter
  8.     {
  9.         public Dictionary<ShrineType, WorldDecoratorCollection> ShrineDecorators { get; set; }
  10.         public Dictionary<ShrineType, WorldDecoratorCollection> ShrineShortDecorators { get; set; }
  11.         public Dictionary<ShrineType, string> ShrineCustomNames { get; set; }
  12.         public Dictionary<ShrineType, string> ShrineCustomNamesShort { get; set;}
  13.         public WorldDecoratorCollection PossibleRiftPylonDecorators { get; set; }
  14.         public string PossibleRiftPylonName { get; set; }
  15.         public bool ShowHealingWells { get; set;}
  16.         public bool ShowPoolOfReflection { get; set;}
  17.  
  18.         public ShrineLabelsPlugin()
  19.         {
  20.             Enabled = true;
  21.         }
  22.  
  23.         public WorldDecoratorCollection CreateMapDecorators(float size = 6f, int a = 192, int r = 255, int g = 255, int b = 55, float radiusOffset = 5f)
  24.         {
  25.             return new WorldDecoratorCollection(
  26.                 new MapLabelDecorator(Hud)
  27.                 {
  28.                     LabelFont = Hud.Render.CreateFont("tahoma", size, a, r, g, b, false, false, 128, 0, 0, 0, true),
  29.                     RadiusOffset = radiusOffset,
  30.                 });
  31.         }
  32.  
  33.         public WorldDecoratorCollection CreateGroundLabelDecorators(float size = 6f, int a = 192, int r = 255, int g = 255, int b = 55,int bga = 255, int bgr = 0, int bgg = 0, int bgb = 0)
  34.         {
  35.             var grounLabelBackgroundBrush = Hud.Render.CreateBrush(bga, bgr, bgg, bgb, 0);
  36.             return new WorldDecoratorCollection(
  37.                 new GroundLabelDecorator(Hud)
  38.                 {
  39.                     BackgroundBrush = grounLabelBackgroundBrush,
  40.                     BorderBrush = Hud.Render.CreateBrush(a, r, g, b, 1),
  41.                     TextFont = Hud.Render.CreateFont("tahoma", size, a, r, g, b, false, false, 128, 0, 0, 0, true),
  42.                 });
  43.         }
  44.        
  45.         public override void Load(IController hud)
  46.         {
  47.             base.Load(hud);
  48.  
  49.             ShrineDecorators = new Dictionary<ShrineType, WorldDecoratorCollection>();
  50.             ShrineShortDecorators = new Dictionary<ShrineType, WorldDecoratorCollection>();
  51.             ShrineCustomNames = new Dictionary<ShrineType, string>();
  52.             ShrineCustomNamesShort = new Dictionary<ShrineType, string>();
  53.  
  54.             foreach (ShrineType shrine in Enum.GetValues(typeof(ShrineType)))
  55.             {
  56.                 ShrineDecorators[shrine] = CreateMapDecorators();
  57.                 ShrineShortDecorators[shrine] = CreateGroundLabelDecorators();
  58.                 ShrineCustomNames[shrine] = string.Empty;
  59.                 ShrineCustomNamesShort[shrine] = string.Empty;
  60.             }
  61.             PossibleRiftPylonDecorators = CreateMapDecorators();
  62.             PossibleRiftPylonName = string.Empty;
  63.         }
  64.  
  65.         public void Customize()
  66.         {
  67.             Hud.TogglePlugin<ShrinePlugin>(false);
  68.         }
  69.  
  70.         public void PaintWorld(WorldLayer layer)
  71.         {
  72.             var shrines = Hud.Game.Shrines.Where(s => s.DisplayOnOverlay);
  73.             foreach (var shrine in shrines)
  74.             {
  75.                 if (shrine.Type == ShrineType.HealingWell && ShowHealingWells == false) continue;
  76.                 if (shrine.Type == ShrineType.PoolOfReflection && ShowPoolOfReflection == false) continue;
  77.                
  78.                 var shrineName = (ShrineCustomNames[shrine.Type] != string.Empty) ? ShrineCustomNames[shrine.Type] : shrine.SnoActor.NameLocalized;
  79.                 ShrineDecorators[shrine.Type].Paint(layer, shrine, shrine.FloorCoordinate, shrineName);
  80.  
  81.                 var ShrineNameShort = (ShrineCustomNamesShort[shrine.Type] != string.Empty) ? ShrineCustomNamesShort[shrine.Type] : shrine.SnoActor.NameLocalized;
  82.                 ShrineShortDecorators[shrine.Type].Paint(layer, shrine, shrine.FloorCoordinate, ShrineNameShort);
  83.             }
  84.  
  85.             var riftPylonSpawnPoints = Hud.Game.Actors.Where(x => x.SnoActor.Sno == 428690);
  86.             foreach (var actor in riftPylonSpawnPoints)
  87.             {
  88.                 PossibleRiftPylonDecorators.Paint(layer, actor, actor.FloorCoordinate, (PossibleRiftPylonName != string.Empty) ? PossibleRiftPylonName : "Pylon?");
  89.             }
  90.         }
  91.     }
  92. }
Add Comment
Please, Sign In to add comment