Advertisement
iThinkiWin

RNN's OtherShrinePlugin (edit)

Oct 15th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 20.67 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4. using System;
  5. using Turbo.Plugins.Default;
  6.  
  7. namespace Turbo.Plugins.RNN
  8. {
  9.     public class OtherShrinePlugin : BasePlugin, ICustomizer, IInGameWorldPainter, INewAreaHandler, IAfterCollectHandler
  10.     {
  11.         private WorldDecoratorCollection DecoratorRectangle { get; set; }
  12.         private WorldDecoratorCollection DecoratorRectangleGray { get; set; }
  13.         private WorldDecoratorCollection DecoratorCircle { get; set; }
  14.         private WorldDecoratorCollection DecoratorCircleGray { get; set; }
  15.         private WorldDecoratorCollection DecoratorHealing { get; set; }
  16.         private WorldDecoratorCollection DecoratorDefault { get; set; }
  17.         private WorldDecoratorCollection LinePylon { get; set; }
  18.         private WorldDecoratorCollection LinePool { get; set; }
  19.  
  20.         private TopLabelDecorator DecoratorPylonNemesys { get; set; }
  21.         private TopLabelDecorator DecoratorPopupON { get; set; }
  22.         private TopLabelDecorator DecoratorPopupOFF { get; set; }
  23.  
  24.         private string PylonNemesys { get; set; } = string.Empty;
  25.         private string TextoPopup { get; set; } = string.Empty;
  26.         private IFont TextoFont { get; set; }
  27.  
  28.         private Dictionary<string, int> ShrineCoordReapp { get; set; } = new Dictionary<string, int>();
  29.         private Dictionary<uint, ShrineType> PylonBuffType { get; set; }
  30.         private Dictionary<ShrineType, ShrineData> ShrinesDic { get; set; } = new Dictionary<ShrineType, ShrineData>();
  31.         private List<ShrineType> PylonsGR { get; set; } = new List<ShrineType>(){ ShrineType.PowerPylon, ShrineType.ConduitPylon, ShrineType.ChannelingPylon, ShrineType.ShieldPylon, ShrineType.SpeedPylon };
  32.         private int PGRn { get; set; }
  33.         private int MyIndex { get; set; } = -1;
  34.         private bool InRift { get; set; }
  35.  
  36.         public bool NotifyInTown { get; set; }
  37.         public bool TTSViewPylon { get; set; }
  38.         public bool TTSBuffPylon { get; set; }
  39.         public string TTSViewPoolText { get; set; }
  40.  
  41.         public string LabelHealingWells  { get; set; }
  42.         public string LabelPoolOfReflection { get; set; }
  43.         public string LabelPossiblePylon { get; set; }
  44.         public bool LabelPylonExchange { get; set; }
  45.  
  46.         public bool HiddenPylonUsed { get; set; }
  47.         public bool LineToPylon { get; set; }
  48.         public float LineToPylonWidth { get; set; } = 2f;
  49.  
  50.         public bool CircleHealingWells { get; set; }
  51.         public bool CirclePoolOfReflection { get; set; }
  52.         public bool ShowPylonSpawn { get; set; }
  53.         public bool ShowPopup { get; set; }
  54.  
  55.         public float xPopup { get; set; }
  56.         public float yPopup { get; set; }
  57.         public int pFontSize { get; set; } = 9;
  58.  
  59.         public class ShrineData
  60.         {
  61.             public string LabelG { get; set; }
  62.             public string LabelM { get; set; }
  63.             public string TTSView { get; set; }
  64.             public string TTSBuffON { get; set; }
  65.             public string TTSBuffOFF { get; set; }
  66.             public string PopupBuff { get; set; }
  67.             public bool GR { get; set; } = false;
  68.             public bool Buff { get; set; } = false;
  69.             public int Finish { get; set; } = 0;
  70.  
  71.             public void Set(string labelg, string labelm, string ttsview , string ttson , string ttsoff, string popup)
  72.             {
  73.                 this.LabelG = labelg;
  74.                 this.LabelM = labelm;
  75.                 this.TTSView = ttsview;
  76.                 this.TTSBuffON = ttson;
  77.                 this.TTSBuffOFF = ttsoff;
  78.                 this.PopupBuff = popup;
  79.             }
  80.  
  81.             public void Reset()
  82.             {
  83.                 this.GR = false;
  84.                 this.Buff = false;
  85.                 this.Finish = 0;
  86.             }
  87.         }
  88.  
  89.         public class PopupPylon : IQueueItem
  90.         {
  91.             public bool On { get; set; }
  92.             public string Text { get; set; }
  93.             public DateTime QueuedOn { get; private set; }
  94.             public TimeSpan LifeTime { get; private set; }
  95.  
  96.             public PopupPylon(bool on, string text, TimeSpan duration)
  97.             {
  98.                 this.On = on;
  99.                 this.Text = text;
  100.                 this.LifeTime = duration;
  101.                 this.QueuedOn = DateTime.Now;
  102.             }
  103.         }
  104.  
  105.         public void Config(ShrineType t, string labelg, string labelm, string ttsview , string ttson , string ttsoff, string popup)
  106.         {
  107.             ShrinesDic[t].Set(labelg, labelm, ttsview, ttson, ttsoff, popup);
  108.         }
  109.  
  110.         public OtherShrinePlugin()
  111.         {
  112.             Enabled = true;
  113.         }
  114.  
  115.         public override void Load(IController hud)
  116.         {
  117.             base.Load(hud);
  118.             Order = 30001;
  119.  
  120.             LabelHealingWells = ""; // Texto en el minimapa para los pozos , null namelocalized, "" nothing
  121.             LabelPoolOfReflection = "Pool"; // Texto en el minimapa para los pozos , null namelocalized, "" nothing
  122.             LabelPossiblePylon = "Pylon?"; // Texto para lugares donde pueden aparecer posibles pilones.
  123.             LabelPylonExchange = false; // Intercambiar etiquetas en mapa y minimpa. Si es false se mostrarán siempre
  124.  
  125.             NotifyInTown = false; // TTS/Popup in Town
  126.             TTSViewPylon = true; // Notificar con voz (TTS) Los Pilones y Santuarios
  127.             TTSBuffPylon = true; // Notificar con voz (TTS) Cuando se recibe un bufo de un pilón/Santuario
  128.             TTSViewPoolText = "Pool"; // Notificar con voz (TTS) Los pools of Reflection , leerá el texto indicado. Set to "" (or null) for not TTS
  129.  
  130.             HiddenPylonUsed = false; // Ocultar o mostrar (en gris) las etiquetas de los pilones usados
  131.             LineToPylon = true; // Dibuja una línea amarilla en el minimapa hasta el pozo o pilón/santuario detectado
  132.             LineToPylonWidth = 1f;
  133.  
  134.             CircleHealingWells = true; // Ver Círculos rojos en los pozos no utilizados
  135.             CirclePoolOfReflection = true; // Ver Círculos amarillos en los pozos no utilizados
  136.             ShowPylonSpawn = true;
  137.             ShowPopup = true; // Mostrar un Popup cuando se recibe un Buff de un pilón
  138.  
  139.             xPopup = 0.46f; // 0f ... 1f
  140.             yPopup = 0.75f; // 0f ... 1f
  141.  
  142.             // ShrineType.PoolOfReflection, ShrineType.HealingWell
  143.             // ShrineType.PowerPylon, ShrineType.ConduitPylon, ShrineType.ChannelingPylon, ShrineType.ShieldPylon, ShrineType.SpeedPylon
  144.             // ShrineType.BlessedShrine, ShrineType.EnlightenedShrine, ShrineType.FortuneShrine, ShrineType.FrenziedShrine, ShrineType.FleetingShrine, ShrineType.EmpoweredShrine
  145.             // ShrineType.BanditShrine
  146.  
  147.             PylonBuffType = new Dictionary<uint, ShrineType>
  148.             {
  149.                 {262935,ShrineType.PowerPylon}, {403404,ShrineType.ConduitPylon}, {266258,ShrineType.ChannelingPylon}, {266254,ShrineType.ShieldPylon}, {266271,ShrineType.SpeedPylon}, // Power, Conduit, Chann, Shield, Speed
  150.                 {278268,ShrineType.BlessedShrine}, {030476,ShrineType.BlessedShrine}, {278269,ShrineType.EnlightenedShrine}, {030477,ShrineType.EnlightenedShrine}, {263029,ShrineType.ConduitPylon}, // protección, experiencia
  151.                 {278270,ShrineType.FortuneShrine}, {030478,ShrineType.FortuneShrine}, {278271,ShrineType.FrenziedShrine}, {030479,ShrineType.FrenziedShrine}, {260348,ShrineType.FleetingShrine}, // fortuna, frenético, fugaz
  152.                 {260349,ShrineType.EmpoweredShrine} // potenciado
  153.             };
  154.  
  155.             foreach (ShrineType shrine in Enum.GetValues(typeof(ShrineType)))
  156.             {
  157.                 string msg = shrine.ToString().Replace("Shrine","").Replace("Pylon","") ;
  158.                 ShrinesDic.Add( shrine,new ShrineData());
  159.                 ShrinesDic[shrine].Set(null, null, null, msg + " Active",msg + " Lost", msg);
  160.             }
  161.  
  162.             TextoFont = Hud.Render.CreateFont("tahoma", 6, 255, 255, 100, 100, true, false, false);
  163.  
  164.             DecoratorDefault = new WorldDecoratorCollection ();
  165.  
  166.             DecoratorPylonNemesys = new TopLabelDecorator(Hud)
  167.             {
  168.                 TextFont = Hud.Render.CreateFont("tahoma", 6, 255, 255, 255, 50, true, false, false),
  169.                 BackgroundTexture1 = Hud.Texture.ButtonTextureOrange,
  170.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureOrange,
  171.                 BackgroundTextureOpacity1 = 1.0f,
  172.                 BackgroundTextureOpacity2 = 1.0f,
  173.                 TextFunc = () => PylonNemesys,
  174.                 HintFunc = () => "Players with Nemesys",
  175.             };
  176.  
  177.             DecoratorPopupON = new TopLabelDecorator(hud)
  178.             {
  179.                 BorderBrush = hud.Render.CreateBrush(255, 180, 147, 109, -1),
  180.                 BackgroundBrush = hud.Render.CreateBrush(200, 10, 10, 10, 0),
  181.                 TextFont = hud.Render.CreateFont("tahoma", pFontSize, 255, 0, 250, 0, true, false, false),
  182.                 TextFunc = () => TextoPopup
  183.             };
  184.  
  185.             DecoratorPopupOFF = new TopLabelDecorator(hud)
  186.             {
  187.                 BorderBrush = hud.Render.CreateBrush(255, 180, 147, 109, -1),
  188.                 BackgroundBrush = hud.Render.CreateBrush(200, 10, 10, 10, 0),
  189.                 TextFont = hud.Render.CreateFont("tahoma", pFontSize, 255, 250, 0, 0, true, false, false),
  190.                 TextFunc = () => TextoPopup
  191.             };
  192.  
  193.             DecoratorRectangle = new WorldDecoratorCollection(
  194.                 new MapShapeDecorator(Hud)
  195.                 {
  196.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 64, 2),
  197.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  198.                     Radius = 4.0f,
  199.                     ShapePainter = new RectangleShapePainter(Hud),
  200.                 },
  201.                 new MapLabelDecorator(Hud)
  202.                 {
  203.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 192, 255, 255, 55, false, false, 128, 0, 0, 0, true),
  204.                     RadiusOffset = 5f,
  205.                 },
  206.                 new GroundLabelDecorator(Hud)
  207.                 {
  208.                     BackgroundBrush = Hud.Render.CreateBrush(255, 0, 0, 0, 0),
  209.                     BorderBrush = Hud.Render.CreateBrush(192, 255, 255, 55, 1),
  210.                     TextFont = Hud.Render.CreateFont("tahoma", 7f, 192, 255, 255, 55, false, false, 128, 0, 0, 0, true),
  211.                 }
  212.             );
  213.  
  214.             DecoratorRectangleGray = new WorldDecoratorCollection(
  215.                 new MapShapeDecorator(Hud)
  216.                 {
  217.                     Brush = Hud.Render.CreateBrush(255, 150, 150, 150, 2),
  218.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  219.                     Radius = 4.0f,
  220.                     ShapePainter = new RectangleShapePainter(Hud),
  221.                 },
  222.                 new MapLabelDecorator(Hud)
  223.                 {
  224.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 155, 155, 155, false, false, 128, 0, 0, 0, true),
  225.                     RadiusOffset = 5f,
  226.                 },
  227.                 new GroundLabelDecorator(Hud)
  228.                 {
  229.                     BackgroundBrush = Hud.Render.CreateBrush(255, 20, 20, 20, 0),
  230.                     BorderBrush = Hud.Render.CreateBrush(192, 150, 150, 150, 1),
  231.                     TextFont = Hud.Render.CreateFont("tahoma", 7f, 200, 155, 155, 155, false, false, 128, 0, 0, 0, true),
  232.                 }
  233.             );
  234.  
  235.             DecoratorCircle = new WorldDecoratorCollection( //No aplicar un ToggleDecorators directamente o habrá que modificar la parte del PoolOfReflection
  236.                 new MapShapeDecorator(Hud)
  237.                 {
  238.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 64, 2),
  239.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  240.                     Radius = 4.0f,
  241.                     ShapePainter = new CircleShapePainter(Hud),
  242.                 },
  243.                 new MapLabelDecorator(Hud)
  244.                 {
  245.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 192, 255, 255, 55, false, false, 128, 0, 0, 0, true),
  246.                     RadiusOffset = 5f,
  247.                 }
  248.             );
  249.  
  250.             DecoratorCircleGray = new WorldDecoratorCollection( //No aplicar un ToggleDecorators directamente o habrá que modificar la parte del PoolOfReflection
  251.                 new MapShapeDecorator(Hud)
  252.                 {
  253.                     Brush = Hud.Render.CreateBrush(255, 150, 150, 150, 2),
  254.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  255.                     Radius = 4.0f,
  256.                     ShapePainter = new CircleShapePainter(Hud),
  257.                 },
  258.                 new MapLabelDecorator(Hud)
  259.                 {
  260.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 155, 155, 155, false, false, 128, 0, 0, 0, true),
  261.                     RadiusOffset = 5f,
  262.                 }
  263.             );
  264.  
  265.             DecoratorHealing = new WorldDecoratorCollection(
  266.                 new MapShapeDecorator(Hud)
  267.                 {
  268.                     Brush = Hud.Render.CreateBrush(255, 255, 64, 64, 2),
  269.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  270.                     Radius = 4.0f,
  271.                     ShapePainter = new CircleShapePainter(Hud),
  272.                 },
  273.                 new MapLabelDecorator(Hud)
  274.                 {
  275.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 220, 255, 64, 64, false, false, 128, 0, 0, 0, true),
  276.                     RadiusOffset = 5f,
  277.                 }
  278.             );
  279.         }
  280.  
  281.         public void Customize()
  282.         {
  283.             Hud.TogglePlugin<ShrinePlugin>(false);
  284.             LinePylon = new WorldDecoratorCollection(
  285.                 new MapShapeDecorator(Hud)
  286.                 {
  287.                     Brush = Hud.Render.CreateBrush(255, 255, 200, 50, LineToPylonWidth,SharpDX.Direct2D1.DashStyle.Dash),
  288.                     ShapePainter = new LineFromMeShapePainter(Hud)
  289.                 }
  290.             );
  291.             LinePool = new WorldDecoratorCollection(
  292.                 new MapShapeDecorator(Hud)
  293.                 {
  294.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 0, LineToPylonWidth,SharpDX.Direct2D1.DashStyle.Dash),
  295.                     ShapePainter = new LineFromMeShapePainter(Hud)
  296.                 }
  297.             );
  298.         }
  299.  
  300.         public void OnNewArea(bool newGame, ISnoArea area)
  301.         {
  302.             if (newGame || (MyIndex != Hud.Game.Me.Index)) // Fix partialment the newGame limitation
  303.             {
  304.                 MyIndex = Hud.Game.Me.Index;
  305.                 InRift = false;
  306.                 foreach (var p in ShrinesDic.Keys)  { ShrinesDic[p].Reset(); }
  307.             }
  308.             if ((area.HostAreaSno == 288482) || (area.Sno == 288482))
  309.             {
  310.                 if (!InRift) //Start Map New Rift (Nephalem o GR)
  311.                 {
  312.                     InRift = true;
  313.                     if (Hud.Game.Me.InGreaterRift) // new GR
  314.                     {
  315.                         PGRn = 0 ;
  316.                         foreach (var p in ShrinesDic.Keys) { ShrinesDic[p].Reset(); }
  317.                     }
  318.                 }
  319.             }
  320.             else
  321.             {
  322.                 if (Hud.Game.IsInTown) { ShrineCoordReapp.Clear(); }
  323.             }
  324.         }
  325.  
  326.         public void AfterCollect()
  327.         {
  328.             if (InRift && (Hud.Game.Quests.FirstOrDefault(q => (q.SnoQuest.Sno == 337492) && (q.State == QuestState.started || q.State == QuestState.completed)) == null)) { InRift = false; }
  329.             if (!Hud.Game.IsInGame) return;
  330.             var shrines = Hud.Game.Shrines.Where(s => s.DisplayOnOverlay && s.FloorCoordinate.IsValid && (s.Type != ShrineType.HealingWell) );
  331.             foreach (var shrine in shrines)
  332.             {
  333.                 string shrineName = string.Empty; int Reappears = 0;
  334.                 string coord = shrine.FloorCoordinate.ToString();
  335.                 if (ShrineCoordReapp.TryGetValue(coord, out Reappears))
  336.                 {
  337.                     if (Reappears < 100) { // Limited to 100 to avoid overflow. I continue counting up to 100 for curiosity and debug purposes
  338.                         Reappears++;
  339.                         if (Reappears == 1) // Required reappearances to differentiate it from a fake shrine.
  340.                         {
  341.                             if (shrine.Type == ShrineType.PoolOfReflection)
  342.                             {
  343.                                 shrineName = (string.IsNullOrEmpty(TTSViewPoolText)) ? string.Empty : TTSViewPoolText;
  344.                             }
  345.                             else
  346.                             {
  347.                                 if (PylonsGR.Contains(shrine.Type) && !ShrinesDic[shrine.Type].GR)
  348.                                 {
  349.                                     ShrinesDic[shrine.Type].GR = true;
  350.                                     PGRn++;
  351.                                 }
  352.                                 shrineName = (TTSViewPylon) ? ShrinesDic[shrine.Type].TTSView : string.Empty;
  353.                             }
  354.                             if (shrineName != string.Empty)
  355.                             {
  356.                                 Hud.Sound.Speak( shrineName ?? shrine.SnoActor.NameLocalized); // if == null it will be used localized name for that shrine , if == "" (string.Empty) no TTS for that shrine
  357.                             }
  358.                         }
  359.                         ShrineCoordReapp[coord] = Reappears;
  360.                     }
  361.                 }
  362.                 else ShrineCoordReapp.Add(coord,0); // new shrine detected -> saving (coordinate,reappears)
  363.             }
  364.  
  365.             foreach (uint buff in PylonBuffType.Keys)
  366.             {
  367.                 if (Hud.Game.Me.Powers.GetBuff(buff) == null) continue;
  368.                 var stype = PylonBuffType[buff];
  369.                 if ( Hud.Game.Me.Powers.BuffIsActive(buff,0))
  370.                 {
  371.                     var bfinish = Hud.Game.CurrentGameTick + (int) (60 * Hud.Game.Me.Powers.GetBuff(buff).TimeLeftSeconds[0]);
  372.                     if ( !ShrinesDic[stype].Buff || (bfinish > (ShrinesDic[stype].Finish + 60)))
  373.                     {
  374.                         ShrinesDic[stype].Buff = true;
  375.                         ShrinesDic[stype].Finish = bfinish;
  376.                         if (Hud.Game.Me.Powers.GetBuff(buff).TimeElapsedSeconds[0] < 1)
  377.                         {
  378.                             var msg = ShrinesDic[stype].TTSBuffON;
  379.                             if (TTSBuffPylon && !string.IsNullOrEmpty(msg)) // null or "" -> no TTS
  380.                             {
  381.                                 if (NotifyInTown || !Hud.Game.IsInTown) { Hud.Sound.Speak(msg); }
  382.                             }
  383.                             msg = ShrinesDic[stype].PopupBuff;
  384.                             if (ShowPopup && !string.IsNullOrEmpty(msg)) // null or "" -> no popup
  385.                             {
  386.                                 if (NotifyInTown || !Hud.Game.IsInTown) { Hud.Queue.AddItem( new PopupPylon(true, msg, new TimeSpan(0, 0, 0, 0, 3000))); }
  387.                             }
  388.                         }
  389.                         if ( PylonsGR.Contains(stype) && !ShrinesDic[stype].GR )
  390.                         {
  391.                             PGRn++;
  392.                             ShrinesDic[stype].GR = true;
  393.                         }
  394.                     }
  395.                 }
  396.                 else if (ShrinesDic[stype].Buff)
  397.                 {
  398.                     var t = Hud.Game.Me.Powers.GetBuff(buff).LastActive.ElapsedMilliseconds;
  399.                     if ( (Hud.Game.CurrentGameTick > ShrinesDic[stype].Finish) || ((t > 50) && (t < 1000))) // Patch, erratic behavior BuffIsActive/LastActiveIwatch
  400.                     {
  401.                         ShrinesDic[stype].Buff = false;
  402.                         ShrinesDic[stype].Finish = Hud.Game.CurrentGameTick - 1;
  403.                         var msg = ShrinesDic[stype].TTSBuffOFF;
  404.                         if (TTSBuffPylon && !string.IsNullOrEmpty(msg))
  405.                         {
  406.                             if (NotifyInTown || !Hud.Game.IsInTown) { Hud.Sound.Speak(msg); }
  407.                         }
  408.                         msg = ShrinesDic[stype].PopupBuff;
  409.                         if (ShowPopup && !string.IsNullOrEmpty(msg))
  410.                         {
  411.                             if (NotifyInTown || !Hud.Game.IsInTown) { Hud.Queue.AddItem(new PopupPylon(false, msg, new TimeSpan(0, 0, 0, 0, 3000))); }
  412.                         }
  413.                     }
  414.                 }
  415.             }
  416.         }
  417.  
  418.         public void PaintWorld(WorldLayer layer)
  419.         {
  420.             if (!Hud.Game.IsInGame) return;
  421.             if (layer != WorldLayer.Ground) return;
  422.             if (!Hud.Game.IsInTown)
  423.             {
  424.                 foreach (var shrine in Hud.Game.Shrines) // No usaré var shrines = Hud.Game.Shrines.Where(s => s.DisplayOnOverlay); // !Disabled && !Operated
  425.                 {
  426.                     if (shrine.Type == ShrineType.HealingWell)
  427.                     {
  428.                         if (shrine.DisplayOnOverlay)
  429.                         {
  430.                             if (CircleHealingWells) DecoratorHealing.Paint(WorldLayer.Map, shrine, shrine.FloorCoordinate, LabelHealingWells ?? shrine.SnoActor.NameLocalized);
  431.                         }
  432.                     }
  433.                     else
  434.                     {
  435.                         if (shrine.Type == ShrineType.PoolOfReflection)
  436.                         {
  437.                             if (shrine.DisplayOnOverlay)
  438.                             {
  439.                                 if (CirclePoolOfReflection) DecoratorCircle.Paint(WorldLayer.Map, shrine, shrine.FloorCoordinate, LabelPoolOfReflection ?? shrine.SnoActor.NameLocalized);
  440.                                 if (LineToPylon) LinePool.Paint(WorldLayer.Map, null, shrine.FloorCoordinate, "");
  441.                             }
  442.                         }
  443.                         else
  444.                         {
  445.                             if (shrine.DisplayOnOverlay || !HiddenPylonUsed)
  446.                             {
  447.                                 bool cerca = (shrine.FloorCoordinate.IsValid && shrine.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) < 35) ? true : false;
  448.                                 DecoratorDefault = (shrine.DisplayOnOverlay) ? DecoratorRectangle : DecoratorRectangleGray ;
  449.                                 if ((!LabelPylonExchange && shrine.IsOnScreen) || cerca) //Mostrar GroundLabelDecorator cuando estás cerca
  450.                                 {
  451.                                     DecoratorDefault.Paint(WorldLayer.Ground, shrine, shrine.FloorCoordinate, (ShrinesDic[shrine.Type].LabelG) ?? shrine.SnoActor.NameLocalized);
  452.                                 }
  453.                                 if (!LabelPylonExchange || !cerca) // Mostrar MapLabelDecorator cuando no estás cerca
  454.                                 {
  455.                                     DecoratorDefault.Paint(WorldLayer.Map, shrine, shrine.FloorCoordinate, (ShrinesDic[shrine.Type].LabelM) ?? shrine.SnoActor.NameLocalized);
  456.                                 }
  457.                                 if (shrine.DisplayOnOverlay)
  458.                                 {
  459.                                     var players = Hud.Game.Players.Where(p => (p.BattleTagAbovePortrait != string.Empty) ); PylonNemesys = string.Empty;
  460.                                     foreach (var player in players)
  461.                                     {
  462.                                         var Nemesis = player.Powers.GetBuff(318820);
  463.                                         if ( (Nemesis != null) && Nemesis.Active)
  464.                                         {
  465.                                             if (player.IsMe) { PylonNemesys = string.Empty; break; }
  466.                                             PylonNemesys += ((PylonNemesys == string.Empty) ? "" : "\n") + player.BattleTagAbovePortrait;
  467.                                         }
  468.                                     }
  469.                                     if (!string.IsNullOrEmpty(PylonNemesys))
  470.                                     {
  471.                                         if(PylonNemesys.IndexOf('\n') == -1) PylonNemesys = PylonNemesys + "\n";
  472.                                         var l = TextoFont.GetTextLayout(PylonNemesys) ;
  473.                                         DecoratorPylonNemesys.Paint(shrine.ScreenCoordinate.X - (int) (l.Metrics.Width * 0.75) , shrine.ScreenCoordinate.Y , l.Metrics.Width * 1.5f, l.Metrics.Height * 1.4f, HorizontalAlign.Center);
  474.                                     }
  475.                                     if (LineToPylon) LinePylon.Paint(WorldLayer.Map, null, shrine.FloorCoordinate, "");
  476.                                 }
  477.                             }
  478.                         }
  479.                     }
  480.                 }
  481.                 if (ShowPylonSpawn)
  482.                 {
  483.                     var riftPylonSpawnPoints = Hud.Game.Actors.Where(s => s.SnoActor.Sno == ActorSnoEnum._markerlocation_tieredriftpylon);
  484.                     foreach (var actor in riftPylonSpawnPoints)
  485.                     {
  486.                         bool HayPylon;
  487.                         if ((Hud.Game.RiftPercentage < 100) && (PGRn < 4))
  488.                         {
  489.                             DecoratorDefault = DecoratorRectangle;//DecoratorDefault = DecoratorRectangle; (for rectangle) or DecoratorDefault = DecoratorCircle; (for circle)
  490.                             HayPylon = true;
  491.                         }
  492.                         else
  493.                         {
  494.                             DecoratorDefault = DecoratorRectangleGray; // DecoratorDefault = DecoratorRectangleGray; (for rectangle) or DecoratorDefault = DecoratorCircleGray; (for circle)
  495.                             HayPylon = false;
  496.                         }
  497.                         DecoratorDefault.ToggleDecorators<MapLabelDecorator>(HayPylon); // replace HayPylon with true for show always the label
  498.                         DecoratorDefault.Paint(WorldLayer.Map, actor, actor.FloorCoordinate, LabelPossiblePylon );
  499.                     }
  500.                 }
  501.             }
  502.             if (NotifyInTown || !Hud.Game.IsInTown)
  503.             {
  504.                 float x = Hud.Window.Size.Width * xPopup;
  505.                 float y = Hud.Window.Size.Height * yPopup;
  506.                 foreach (PopupPylon p in Hud.Queue.GetItems<PopupPylon>().Take(7))
  507.                 {
  508.                     TextoPopup = p.Text;
  509.                     float w = p.Text.Length*pFontSize + Hud.Window.Size.Width * 0.05f;
  510.                     float h = pFontSize + Hud.Window.Size.Height * 0.05f;
  511.                     if (p.On) { DecoratorPopupON.Paint(x, y , w, h, HorizontalAlign.Center); }
  512.                     else { DecoratorPopupOFF.Paint(x, y , w, h, HorizontalAlign.Center); }
  513.                     if (y < Hud.Window.Size.Height/2) y += h;
  514.                     else y -= h;
  515.                 }
  516.             }
  517.         }
  518.     }
  519. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement