psychopyro212

Untitled

Mar 8th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.34 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.         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)
  33.         {
  34.             var grounLabelBackgroundBrush = Hud.Render.CreateBrush(bga, bgr, bgg, bgb, 0);
  35.             return new WorldDecoratorCollection(
  36.                 new GroundLabelDecorator(Hud)
  37.                 {
  38.                     BackgroundBrush = grounLabelBackgroundBrush,
  39.                     BorderBrush = Hud.Render.CreateBrush(a, r, g, b, 1),
  40.                     TextFont = Hud.Render.CreateFont("tahoma", size, a, r, g, b, false, false, 128, 0, 0, 0, true),
  41.                 });
  42.         }
  43.        
  44.         public override void Load(IController hud)
  45.         {
  46.             base.Load(hud);
  47.  
  48.             ShrineDecorators = new Dictionary<ShrineType, WorldDecoratorCollection>();
  49.             ShrineShortDecorators = new Dictionary<ShrineType, WorldDecoratorCollection>();
  50.             ShrineCustomNames = new Dictionary<ShrineType, string>();
  51.             ShrineCustomNamesShort = new Dictionary<ShrineType, string>();
  52.  
  53.             foreach (ShrineType shrine in Enum.GetValues(typeof(ShrineType)))
  54.             {
  55.                 ShrineDecorators[shrine] = CreateMapDecorators();
  56.                 ShrineShortDecorators[shrine] = CreateGroundLabelDecorators();
  57.                 ShrineCustomNames[shrine] = string.Empty;
  58.                 ShrineCustomNamesShort[shrine] = string.Empty;
  59.             }
  60.  
  61.             PossibleRiftPylonDecorators = CreateMapDecorators();
  62.         }
  63.  
  64.         public void Customize()
  65.         {
  66.             Hud.TogglePlugin<ShrinePlugin>(false);
  67.         }
  68.  
  69.         public void PaintWorld(WorldLayer layer)
  70.         {
  71.             var shrines = Hud.Game.Shrines.Where(s => s.DisplayOnOverlay);
  72.             foreach (var shrine in shrines)
  73.             {
  74.                 if (shrine.Type == ShrineType.HealingWell && ShowHealingWells == false) continue;
  75.                 if (shrine.Type == ShrineType.PoolOfReflection && ShowPoolOfReflection == false) continue;
  76.                
  77.                 var shrineName = (ShrineCustomNames[shrine.Type] != string.Empty) ? ShrineCustomNames[shrine.Type] : shrine.SnoActor.NameLocalized;
  78.                 ShrineDecorators[shrine.Type].Paint(layer, shrine, shrine.FloorCoordinate, shrineName);
  79.  
  80.                 var ShrineNameShort = (ShrineCustomNamesShort[shrine.Type] != string.Empty) ? ShrineCustomNamesShort[shrine.Type] : shrine.SnoActor.NameLocalized;
  81.                 ShrineShortDecorators[shrine.Type].Paint(layer, shrine, shrine.FloorCoordinate, ShrineNameShort);
  82.             }
  83.  
  84.             var riftPylonSpawnPoints = Hud.Game.Actors.Where(x => x.SnoActor.Sno == 428690);
  85.  
  86.             foreach (var actor in riftPylonSpawnPoints)
  87.             {
  88.                 PossibleRiftPylonDecorators.Paint(layer, actor, actor.FloorCoordinate, (PossibleRiftPylonName != string.Empty) ? PossibleRiftPylonName : "Pylon?");
  89.             }
  90.         }
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment