psychopyro212

Untitled

Mar 8th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.37 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.        
  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 string PossibleRiftPylonName { get; set; }
  14.         public WorldDecoratorCollection PossibleRiftPylonDecorators { get; set; }
  15.         public bool ShowHealingWells { get; set;}
  16.         public bool ShowPoolOfReflection { get; set;}
  17.         private enum Enum{}
  18.  
  19.         public ShrineLabelsPlugin()
  20.         {
  21.             Enabled = true;
  22.         }
  23.  
  24.         public WorldDecoratorCollection CreateMapDecorators(float size = 6f, int a = 192, int r = 255, int g = 255, int b = 55, float radiusOffset = 5f)
  25.         {
  26.             return new WorldDecoratorCollection(
  27.                 new MapLabelDecorator(Hud)
  28.                 {
  29.                     LabelFont = Hud.Render.CreateFont("tahoma", size, a, r, g, b, false, false, 128, 0, 0, 0, true),
  30.                     RadiusOffset = radiusOffset,
  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.  
  62.             PossibleRiftPylonDecorators = CreateMapDecorators();
  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.  
  87.             foreach (var actor in riftPylonSpawnPoints)
  88.             {
  89.                 PossibleRiftPylonDecorators.Paint(layer, actor, actor.FloorCoordinate, (PossibleRiftPylonName != string.Empty) ? PossibleRiftPylonName : "Pylon?");
  90.             }
  91.         }
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment