Advertisement
RNNCode

OtherShrinePlugin

Mar 28th, 2024 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 35.42 KB | None | 0 0
  1. // ShrineType.PoolOfReflection, ShrineType.HealingWell
  2. // ShrineType.PowerPylon, ShrineType.ConduitPylon, ShrineType.ChannelingPylon, ShrineType.ShieldPylon, ShrineType.SpeedPylon
  3. // ShrineType.BlessedShrine, ShrineType.EnlightenedShrine, ShrineType.FortuneShrine, ShrineType.FrenziedShrine, ShrineType.FleetingShrine, ShrineType.EmpoweredShrine
  4. // ShrineType.BanditShrine
  5.  
  6. using Turbo.Plugins.Default;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System;
  10.  
  11. namespace Turbo.Plugins.RNN
  12. {
  13.     public class OtherShrinePlugin : BasePlugin, IAfterCollectHandler, IInGameWorldPainter, INewAreaHandler, ICustomizer
  14.     {
  15.         public WorldDecoratorCollection QuestDecorator { get; set; }
  16.         public WorldDecoratorCollection KeywardenDecorator { get; set; }
  17.         public WorldDecoratorCollection BossDecorator { get; set; }
  18.         public WorldDecoratorCollection OtherMarkerDecorator { get; set; }
  19.         public WorldDecoratorCollection DefaultMarkerDecorator { get; set; }
  20.         public bool ShowMarkers { get; set;}
  21.         public int LineToMarkerRange { get; set; }
  22.         public float Opacity { get; set; }
  23.  
  24.         private WorldDecoratorCollection DecoratorRectangle { get; set; }
  25.         private WorldDecoratorCollection DecoratorRectangleGray { get; set; }
  26.         private WorldDecoratorCollection DecoratorCircle { get; set; }
  27.         private WorldDecoratorCollection DecoratorCircleGray { get; set; }
  28.         private WorldDecoratorCollection DecoratorHealing { get; set; }
  29.         private WorldDecoratorCollection DecoratorDefault { get; set; }
  30.         private WorldDecoratorCollection LinePylon { get; set; }
  31.         private WorldDecoratorCollection LinePool { get; set; }
  32.  
  33.         private WorldDecoratorCollection LineUnknownShrine { get; set; }
  34.         private WorldDecoratorCollection LineUndefinedShrine { get; set; }
  35.  
  36.         private TopLabelDecorator DecoratorPylonNemesys { get; set; }
  37.         private TopLabelDecorator DecoratorPopupON { get; set; }
  38.         private TopLabelDecorator DecoratorPopupOFF { get; set; }
  39.  
  40.         private Dictionary<string, bool> ShrineUsedCoord { get; set; } = new Dictionary<string, bool>();
  41.         private Dictionary<string, bool> MarkIdReapp { get; set; } = new Dictionary<string, bool>();
  42.         private Dictionary<ShrineType, ShrineData> ShrinesData { get; set; } = new Dictionary<ShrineType, ShrineData>();
  43.  
  44.         private Dictionary<uint, ShrineType> PylonBuffType { get; set; }  = new Dictionary<uint, ShrineType>
  45.         {
  46.             {262935,ShrineType.PowerPylon}, {403404,ShrineType.ConduitPylon}, {266258,ShrineType.ChannelingPylon}, {266254,ShrineType.ShieldPylon}, {266271,ShrineType.SpeedPylon}, // Power, Conduit, Chann, Shield, Speed
  47.             {278268,ShrineType.BlessedShrine}, {030476,ShrineType.BlessedShrine}, {278269,ShrineType.EnlightenedShrine}, {030477,ShrineType.EnlightenedShrine}, {263029,ShrineType.ConduitPylon}, // protección, experiencia
  48.             {278270,ShrineType.FortuneShrine}, {030478,ShrineType.FortuneShrine}, {278271,ShrineType.FrenziedShrine}, {030479,ShrineType.FrenziedShrine}, {260348,ShrineType.FleetingShrine}, // fortuna, frenético, fugaz
  49.             {260349,ShrineType.EmpoweredShrine}  // potenciado
  50.         };
  51.         private List<ShrineType> PylonsGR { get; set; } = new List<ShrineType>()
  52.         {
  53.             ShrineType.PowerPylon, ShrineType.ConduitPylon, ShrineType.ChannelingPylon, ShrineType.ShieldPylon, ShrineType.SpeedPylon
  54.         };
  55.  
  56.         private Dictionary<ActorSnoEnum, ShrineType> SnoTypeDic { get; set; } = new Dictionary<ActorSnoEnum,ShrineType>
  57.         {
  58.             // _shrine_global = 135384, // _shrine_global_glow /*156680*/
  59.             { ActorSnoEnum._poolofreflection /*373463*/, ShrineType.PoolOfReflection },
  60.             { ActorSnoEnum._healthwell_global /*138989*/, ShrineType.HealingWell },
  61.  
  62.             { ActorSnoEnum._x1_lr_shrine_damage /*330695*/, ShrineType.PowerPylon },
  63.             { ActorSnoEnum._x1_lr_shrine_electrified /*330696*/, ShrineType.ConduitPylon },
  64.             { ActorSnoEnum._x1_lr_shrine_infinite_casting /*330697*/, ShrineType.ChannelingPylon },
  65.             { ActorSnoEnum._x1_lr_shrine_invulnerable /*330698*/, ShrineType.ShieldPylon },
  66.             { ActorSnoEnum._x1_lr_shrine_run_speed /*330699*/, ShrineType.SpeedPylon },
  67.  
  68.             { ActorSnoEnum._shrine_global_blessed /*176074*/, ShrineType.BlessedShrine },
  69.             { ActorSnoEnum._shrine_global_enlightened /*176075*/, ShrineType.EnlightenedShrine },
  70.             { ActorSnoEnum._shrine_global_fortune /*176076*/, ShrineType.FortuneShrine },
  71.             { ActorSnoEnum._shrine_global_frenzied /*176077*/, ShrineType.FrenziedShrine },
  72.             { ActorSnoEnum._shrine_global_hoarder /*260346*/, ShrineType.FleetingShrine },
  73.             { ActorSnoEnum._shrine_global_reloaded /*260347*/, ShrineType.EmpoweredShrine },
  74.  
  75.             { ActorSnoEnum._a4_heaven_shrine_global_blessed /*225025*/, ShrineType.BlessedShrine },
  76.             { ActorSnoEnum._a4_heaven_shrine_global_enlightened /*225030*/, ShrineType.EnlightenedShrine },
  77.             { ActorSnoEnum._a4_heaven_shrine_global_fortune /*225027*/, ShrineType.FortuneShrine },
  78.             { ActorSnoEnum._a4_heaven_shrine_global_frenzied /*225028*/, ShrineType.FrenziedShrine },
  79.             { ActorSnoEnum._a4_heaven_shrine_global_hoarder /*260344*/, ShrineType.FleetingShrine },
  80.             { ActorSnoEnum._a4_heaven_shrine_global_reloaded /*260345*/, ShrineType.EmpoweredShrine },
  81.  
  82.             { ActorSnoEnum._a4_heaven_shrine_global_demoncorrupted_blessed /*225261*/, ShrineType.BlessedShrine },
  83.             { ActorSnoEnum._a4_heaven_shrine_global_demoncorrupted_enlightened /*225262*/, ShrineType.EnlightenedShrine },
  84.             { ActorSnoEnum._a4_heaven_shrine_global_demoncorrupted_fortune /*225263*/, ShrineType.FortuneShrine },
  85.             { ActorSnoEnum._a4_heaven_shrine_global_demoncorrupted_frenzied /*225266*/, ShrineType.FrenziedShrine },
  86.             { ActorSnoEnum._a4_heaven_shrine_global_demoncorrupted_hoarder /*260342*/, ShrineType.FleetingShrine },
  87.             { ActorSnoEnum._a4_heaven_shrine_global_demoncorrupted_reloaded /*260343*/, ShrineType.EmpoweredShrine },
  88.  
  89.             { ActorSnoEnum._p43_ad_shrine_global_blessed /*455251*/, ShrineType.BlessedShrine },
  90.             { ActorSnoEnum._p43_ad_shrine_global_enlightened /*455252*/, ShrineType.EnlightenedShrine },
  91.             { ActorSnoEnum._p43_ad_shrine_global_frenzied /*455253*/, ShrineType.FrenziedShrine },
  92.             { ActorSnoEnum._p43_ad_shrine_global_hoarder /*455254*/, ShrineType.FleetingShrine },
  93.             { ActorSnoEnum._p43_ad_shrine_global_reloaded /*455256*/, ShrineType.EmpoweredShrine },
  94.  
  95.             { ActorSnoEnum._shrine_treasuregoblin /*269349*/, ShrineType.BanditShrine },
  96.             { ActorSnoEnum._a4_heaven_shrine_treasuregoblin /*434409*/, ShrineType.BanditShrine },
  97.             { ActorSnoEnum._p43_ad_shrine_treasuregoblin /*455256*/, ShrineType.BanditShrine },
  98.             { ActorSnoEnum._p73_shrine_treasuregoblin /*455256*/, ShrineType.BanditShrine }
  99.         };
  100.  
  101.         private string PylonNemesys { get; set;} = string.Empty;
  102.         private string TextoPopup { get; set; } = string.Empty;
  103.         private IFont TextoFont { get; set; }
  104.  
  105.         private int PGRn { get; set; }
  106.         private int MyIndex { get; set; } = -1;
  107.         private bool InRift { get; set; }
  108.  
  109.         public bool NotifyInTown { get; set; }
  110.         public bool TTSViewPylon { get; set;}
  111.         public bool TTSBuffPylon { get; set;}
  112.         public string TTSViewPoolText { get; set;}
  113.  
  114.         public string LabelHealingWells  { get; set; }
  115.         public string LabelPoolOfReflection { get; set; }
  116.         public string LabelPossiblePylon { get; set; }
  117.         public bool LabelPylonExchange { get; set; }
  118.  
  119.         public bool HiddenPylonUsed { get; set; }
  120.         public bool LineToPylon { get; set; }
  121.         public float LineToPylonWidth { get; set; }
  122.         public float LineToPylonRange { get; set; }
  123.         public float LineToPoolRange { get; set; }
  124.         public bool SquarePylon { get; set; }
  125.  
  126.         public bool LineDifferentToUnknownShrine { get; set; } = true;  // Draw a gray line on the minimap to unidentified Sanctuary (Sanctuary)
  127.  
  128.         public bool ShowPylonSpawn { get; set; }
  129.         public bool ShowPopup { get; set;}
  130.  
  131.         public float xPopup { get; set;}
  132.         public float yPopup { get; set;}
  133.         public float FontSizePopup { get; set; }
  134.  
  135.         public bool NemesisAlert { get; set; }
  136.  
  137.         private class ShrineData
  138.         {
  139.             public string LabelG { get; set; }
  140.             public string LabelM { get; set; }
  141.             public string TTSView { get; set; }
  142.             public string TTSBuffON { get; set; }
  143.             public string TTSBuffOFF { get; set; }
  144.             public string PopupBuff { get; set; }
  145.             public bool GR { get; set; } = false;
  146.             public bool Buff { get; set; } = false;
  147.             public int Finish { get; set; } = 0;
  148.             public WorldDecoratorCollection ShrineDecorator { get; set; } = null;
  149.  
  150.             public void Set(string labelg, string labelm, string ttsview  , string ttson , string ttsoff, string popup)
  151.             {
  152.                 this.LabelG = labelg;
  153.                 this.LabelM = labelm;
  154.                 this.TTSView = ttsview;
  155.                 this.TTSBuffON = ttson;
  156.                 this.TTSBuffOFF = ttsoff;
  157.                 this.PopupBuff = popup;
  158.             }
  159.             public void Reset()
  160.             {
  161.                 this.GR = false;
  162.                 this.Buff = false;
  163.                 this.Finish = 0;
  164.             }
  165.         }
  166.  
  167.         public class PopupPylon : IQueueItem
  168.         {
  169.             public bool On { get; set; }
  170.             public string Text { get; set; }
  171.             public DateTime QueuedOn { get; private set; }
  172.             public TimeSpan LifeTime { get; private set; }
  173.  
  174.             public PopupPylon(bool on, string text, TimeSpan duration)
  175.             {
  176.                 this.On = on;
  177.                 this.Text = text;
  178.                 this.LifeTime = duration;
  179.                 this.QueuedOn = DateTime.Now;
  180.             }
  181.         }
  182.  
  183.         public void Config(ShrineType t, string labelg, string labelm, string ttsview  , string ttson , string ttsoff, string popup)
  184.         {
  185.             ShrinesData[t].Set(labelg, labelm, ttsview, ttson, ttsoff, popup);
  186.         }
  187.  
  188.         private WorldDecoratorCollection CreateShrineDecorator(float Gs = 7f, float Ms = 6f, int o = 192, int r = 255, int g = 255, int b = 55)
  189.         {
  190.             return  new WorldDecoratorCollection(
  191.                 new GroundLabelDecorator(Hud)
  192.                 {
  193.                     BackgroundBrush = Hud.Render.CreateBrush(255, 0, 0, 0, 0),
  194.                     BorderBrush = Hud.Render.CreateBrush(o, r, g, b, 1),
  195.                     TextFont = Hud.Render.CreateFont("tahoma", Gs, o, r, g, b, false, false, 128, 0, 0, 0, true),
  196.                 },
  197.                 new MapLabelDecorator(Hud)
  198.                 {
  199.                     LabelFont = Hud.Render.CreateFont("tahoma", Ms, o, r, g, b, false, false, 128, 0, 0, 0, true),
  200.                     RadiusOffset = 5f,
  201.                 },
  202.                 new MapShapeDecorator(Hud)
  203.                 {
  204.                     Brush = Hud.Render.CreateBrush(255, r, g, b, 2),
  205.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  206.                     Radius = 4.0f,
  207.                     ShapePainter = new RectangleShapePainter(Hud),
  208.                 }
  209.             );
  210.         }
  211.  
  212.         public void ModifyShrineDecorator(ShrineType shine, float GroundFontSize = 7f, float MapFontSize = 6f, int opacity = 192, int red = 255, int green = 255, int blue = 55 )
  213.         {
  214.             ShrinesData[shine].ShrineDecorator = CreateShrineDecorator( GroundFontSize, MapFontSize , opacity , red , green, blue);
  215.         }
  216.  
  217.         public OtherShrinePlugin()
  218.         {
  219.             Enabled = true;
  220.         }
  221.  
  222.         public override void Load(IController hud)
  223.         {
  224.             base.Load(hud);
  225.             Order = 30001;
  226.  
  227.             LabelHealingWells = "";         // Text on the minimap for HealingWells (null for namelocalized,"" for nothing)
  228.             LabelPoolOfReflection = "Pool"; // Text on the minimap for pools (null for namelocalized,"" for nothing)
  229.             LabelPossiblePylon = "Pylon?";  // Text for the labels of the places where possible pylons may appear
  230.             LabelPylonExchange = false;     // Exchange labels on map and mini map. If it is false they will always be shown
  231.  
  232.             NotifyInTown = false;       // Enable or disable TTS/Popup in Town
  233.             TTSViewPylon = true;        // Notify with voice (TTS) the Pylons and Sanctuaries
  234.             TTSBuffPylon = true;        // Notify with voice (TTS) When you receive a buff (and lose) from a pylon/Sanctuary
  235.             TTSViewPoolText = "Pool";   // Notify with voice (TTS) the pools of Reflection, will read the indicated text. Set to "" (or null) for not TTS
  236.  
  237.             SquarePylon = true;         // Show Square Yellow/Gray on pylons/shrines
  238.             HiddenPylonUsed = false;    // Hide or show (gray) decorators for used pylons
  239.             LineToPylon = true;         // Draw a yellow line on the minimap to the PoolOfReflection/Pylon/Sanctuary detected
  240.             LineToPylonWidth = 2f;      // Line width
  241.             LineToPylonRange = 700;     // Only draw the line if you are less than this distance
  242.             LineToPoolRange = 0;        // Only draw the line if you are less than this distance For unlimited distance set to 0
  243.  
  244.             ShowPylonSpawn = true;      // Hide or not the decorators of the possible Pylons. In case someone uses another complement for it
  245.             ShowPopup = true;           // Popup when you receive (or lose) a buff from a Pylon/Sanctuary
  246.  
  247.             xPopup = 0.5f;          // 0f ... 1f  Popup Coordinate x
  248.             yPopup = 0.81f;         // 0f ... 1f  Popup Coordinate y
  249.             FontSizePopup = 9f;     // Size font for popup text
  250.  
  251.             Opacity = 0.75f;            // 0f..1f opacity for all textures(of pylons/shrines/pools/wells, other markers) on the map when they're not on screen
  252.  
  253.             ShowMarkers = true;         // Show markers other than Pylons/Shrines/Pools/Wells. Assign the value "false" if you want to use another plugin for this
  254.             LineToMarkerRange = 700;    // Only draw the line if you are less than this distance
  255.  
  256.             NemesisAlert = true;
  257.  
  258.             foreach (ShrineType shrine in Enum.GetValues(typeof(ShrineType)))
  259.             {
  260.                 string msg = shrine.ToString().Replace("Shrine","").Replace("Pylon","") ;
  261.                 ShrinesData.Add(shrine,new ShrineData());
  262.                 ShrinesData[shrine].Set(null, null, null, msg + " Active",msg + " Lost", msg);
  263.                 //ShrinesData[shrine].ShrineDecorator = CreateShrineDecorator();
  264.             }
  265.  
  266.             TextoFont = Hud.Render.CreateFont("tahoma", 6, 255, 255, 255, 50, true, false, false);
  267.  
  268.             DecoratorDefault = new WorldDecoratorCollection ();
  269.  
  270.             DecoratorPylonNemesys = new TopLabelDecorator(Hud)
  271.             {
  272.                 TextFont = TextoFont,
  273.                 BackgroundTexture1 = Hud.Texture.ButtonTextureOrange,
  274.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureOrange,
  275.                 BackgroundTextureOpacity1 = 1.0f,
  276.                 BackgroundTextureOpacity2 = 1.0f,
  277.                 TextFunc = () =>  PylonNemesys,
  278.                 HintFunc = () => "Players with Nemesys",
  279.             };
  280.  
  281.             DecoratorRectangle = new WorldDecoratorCollection(
  282.                 new GroundLabelDecorator(Hud)
  283.                 {
  284.                     BackgroundBrush = Hud.Render.CreateBrush(255, 0, 0, 0, 0),
  285.                     BorderBrush = Hud.Render.CreateBrush(192, 255, 255, 55, 1),
  286.                     TextFont = Hud.Render.CreateFont("tahoma", 7f, 192, 255, 255, 55, false, false, 128, 0, 0, 0, true),
  287.                 },
  288.  
  289.                 new MapLabelDecorator(Hud)
  290.                 {
  291.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 192, 255, 255, 55, false, false, 128, 0, 0, 0, true),
  292.                     RadiusOffset = 5f,
  293.                 },
  294.                 new MapShapeDecorator(Hud)
  295.                 {
  296.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 64, 2),
  297.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  298.                     Radius = 4.0f,
  299.                     ShapePainter = new RectangleShapePainter(Hud),
  300.                 }
  301.             );
  302.  
  303.             DecoratorRectangleGray = new WorldDecoratorCollection(
  304.                 new GroundLabelDecorator(Hud)
  305.                 {
  306.                     BackgroundBrush = Hud.Render.CreateBrush(255, 20, 20, 20, 0),
  307.                     BorderBrush = Hud.Render.CreateBrush(192, 150, 150, 150, 1),
  308.                     TextFont = Hud.Render.CreateFont("tahoma", 7f, 200, 155, 155, 155, false, false, 128, 0, 0, 0, true),
  309.                 },
  310.                 new MapLabelDecorator(Hud)
  311.                 {
  312.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 155, 155, 155, false, false, 128, 0, 0, 0, true),
  313.                     RadiusOffset = 5f,
  314.                 },
  315.                 new MapShapeDecorator(Hud)
  316.                 {
  317.                     Brush = Hud.Render.CreateBrush(255, 150, 150, 150, 2),
  318.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  319.                     Radius = 4.0f,
  320.                     ShapePainter = new RectangleShapePainter(Hud),
  321.                 }
  322.             );
  323.  
  324.             DecoratorCircle = new WorldDecoratorCollection(
  325.                 new MapLabelDecorator(Hud)
  326.                 {
  327.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 192, 255, 255, 55, false, false, 128, 0, 0, 0, true),
  328.                     RadiusOffset = 5f,
  329.                 },
  330.                 new MapShapeDecorator(Hud)
  331.                 {
  332.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 64, 2),
  333.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  334.                     Radius = 4.0f,
  335.                     ShapePainter = new CircleShapePainter(Hud),
  336.                 }
  337.             );
  338.  
  339.             DecoratorCircleGray = new WorldDecoratorCollection(
  340.                 new MapLabelDecorator(Hud)
  341.                 {
  342.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 155, 155, 155, false, false, 128, 0, 0, 0, true),
  343.                     RadiusOffset = 5f,
  344.                 },
  345.                 new MapShapeDecorator(Hud)
  346.                 {
  347.                     Brush = Hud.Render.CreateBrush(255, 150, 150, 150, 2),
  348.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  349.                     Radius = 4.0f,
  350.                     ShapePainter = new CircleShapePainter(Hud),
  351.                 }
  352.             );
  353.  
  354.             DecoratorHealing = new WorldDecoratorCollection(
  355.                 new MapLabelDecorator(Hud)
  356.                 {
  357.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 220, 255, 64, 64, false, false, 128, 0, 0, 0, true),
  358.                     RadiusOffset = 5f,
  359.                 },
  360.                 new MapShapeDecorator(Hud)
  361.                 {
  362.                     Brush = Hud.Render.CreateBrush(255, 255, 64, 64, 2),
  363.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  364.                     Radius = 4.0f,
  365.                     ShapePainter = new CircleShapePainter(Hud),
  366.                 }
  367.             );
  368.  
  369.             QuestDecorator = new WorldDecoratorCollection(
  370.                 new MapShapeDecorator(Hud)
  371.                 {
  372.                     Brush = Hud.Render.CreateBrush(192, 255, 255, 55, -1),
  373.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  374.                     Radius = 10.0f,
  375.                     ShapePainter = new CircleShapePainter(Hud),
  376.                 },
  377.                 new MapLabelDecorator(Hud)
  378.                 {
  379.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 255, 255, 0, false, false, 128, 0, 0, 0, true),
  380.                     RadiusOffset = 10,
  381.                     Up = true,
  382.                 },
  383.                 new MapShapeDecorator(Hud)
  384.                 {
  385.                     Brush = Hud.Render.CreateBrush(120, 255, 255, 55, -1),
  386.                     ShapePainter = new LineFromMeShapePainter(Hud)
  387.                 }
  388.             );
  389.  
  390.             KeywardenDecorator = new WorldDecoratorCollection(
  391.                 new MapShapeDecorator(Hud)
  392.                 {
  393.                     Brush = Hud.Render.CreateBrush(192, 238, 130, 238, -1),
  394.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  395.                     Radius = 10.0f,
  396.                     ShapePainter = new CircleShapePainter(Hud),
  397.                 },
  398.                 new MapLabelDecorator(Hud)
  399.                 {
  400.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 255, 20, 255, false, false, 128, 0, 0, 0, true),
  401.                     RadiusOffset = 10,
  402.                     Up = true,
  403.                 },
  404.                 new MapShapeDecorator(Hud)
  405.                 {
  406.                     Brush = Hud.Render.CreateBrush(120, 238, 130, 238, -1),
  407.                     ShapePainter = new LineFromMeShapePainter(Hud)
  408.                 }
  409.             );
  410.  
  411.             BossDecorator = new WorldDecoratorCollection(
  412.                 new MapShapeDecorator(Hud)
  413.                 {
  414.                     Brush = Hud.Render.CreateBrush(192, 180, 0, 0, -1),
  415.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  416.                     Radius = 10.0f,
  417.                     ShapePainter = new CircleShapePainter(Hud),
  418.                 },
  419.                 new MapLabelDecorator(Hud)
  420.                 {
  421.                     LabelFont = Hud.Render.CreateFont("tahoma", 7f, 255, 255, 155, 0, false, false, 128, 0, 0, 0, true),
  422.                     RadiusOffset = 10,
  423.                     Up = true,
  424.                 },
  425.                 new MapShapeDecorator(Hud)
  426.                 {
  427.                     Brush = Hud.Render.CreateBrush(120, 180, 0, 0, -1),
  428.                     ShapePainter = new LineFromMeShapePainter(Hud)
  429.                 }
  430.             );
  431.             OtherMarkerDecorator = new WorldDecoratorCollection(
  432.                 new MapShapeDecorator(Hud)
  433.                 {
  434.                     Brush = Hud.Render.CreateBrush(192, 55, 155, 255, -1),
  435.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  436.                     Radius = 10.0f,
  437.                     ShapePainter = new CircleShapePainter(Hud),
  438.                 },
  439.                 new MapLabelDecorator(Hud)
  440.                 {
  441.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 55, 155, 255, false, false, 128, 0, 0, 0, true),
  442.                     RadiusOffset = 10,
  443.                     Up = true,
  444.                 },
  445.                 new MapShapeDecorator(Hud)
  446.                 {
  447.                     Brush = Hud.Render.CreateBrush(192, 55, 155, 255, -1),
  448.                     ShapePainter = new LineFromMeShapePainter(Hud)
  449.                 }
  450.             );
  451.             DefaultMarkerDecorator = new WorldDecoratorCollection(
  452.                 new MapShapeDecorator(Hud)
  453.                 {
  454.                     Brush = Hud.Render.CreateBrush(190, 255, 255, 255, -1),
  455.                     ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  456.                     Radius = 10.0f,
  457.                     ShapePainter = new CircleShapePainter(Hud),
  458.                 },
  459.                 new MapLabelDecorator(Hud)
  460.                 {
  461.                     LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 255, 255, 255, false, false, 128, 0, 0, 0, true),
  462.                     RadiusOffset = 10,
  463.                     Up = true,
  464.                 },
  465.                 new MapShapeDecorator(Hud)
  466.                 {
  467.                     Brush = Hud.Render.CreateBrush(192, 255, 255, 255, -1),
  468.                     ShapePainter = new LineFromMeShapePainter(Hud)
  469.                 }
  470.             );
  471.         }
  472.  
  473.         public void Customize()
  474.         {
  475.             Hud.TogglePlugin<MarkerPlugin>(false);
  476.             LineUnknownShrine = new WorldDecoratorCollection(
  477.                 new MapShapeDecorator(Hud)
  478.                 {
  479.                     Brush = Hud.Render.CreateBrush(255, 150, 155, 155, LineToPylonWidth,SharpDX.Direct2D1.DashStyle.Dash),
  480.                     ShapePainter = new LineFromMeShapePainter(Hud)
  481.                 }
  482.             );
  483.             LineUndefinedShrine = new WorldDecoratorCollection(
  484.                 new MapShapeDecorator(Hud)
  485.                 {
  486.                     Brush = Hud.Render.CreateBrush(255, 150, 155, 155, LineToPylonWidth,SharpDX.Direct2D1.DashStyle.DashDot),
  487.                     ShapePainter = new LineFromMeShapePainter(Hud)
  488.                 }
  489.             );
  490.             LinePylon = new WorldDecoratorCollection(
  491.                 new MapShapeDecorator(Hud)
  492.                 {
  493.                     Brush = Hud.Render.CreateBrush(255, 255, 200, 50, LineToPylonWidth,SharpDX.Direct2D1.DashStyle.Dash),
  494.                     ShapePainter = new LineFromMeShapePainter(Hud)
  495.                 }
  496.             );
  497.             LinePool = new WorldDecoratorCollection(
  498.                 new MapShapeDecorator(Hud)
  499.                 {
  500.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 0, LineToPylonWidth,SharpDX.Direct2D1.DashStyle.Dash),
  501.                     ShapePainter = new LineFromMeShapePainter(Hud)
  502.                 }
  503.             );
  504.             DecoratorPopupON = new TopLabelDecorator(Hud)
  505.             {
  506.                 BorderBrush = Hud.Render.CreateBrush(255, 180, 147, 109, -1),
  507.                 BackgroundBrush = Hud.Render.CreateBrush(200, 10, 10, 10, 0),
  508.                 TextFont = Hud.Render.CreateFont("tahoma", FontSizePopup, 255, 0, 250, 0, true, false, false),
  509.                 TextFunc = () =>  TextoPopup
  510.             };
  511.             DecoratorPopupOFF = new TopLabelDecorator(Hud)
  512.             {
  513.                 BorderBrush = Hud.Render.CreateBrush(255, 180, 147, 109, -1),
  514.                 BackgroundBrush = Hud.Render.CreateBrush(200, 10, 10, 10, 0),
  515.                 TextFont = Hud.Render.CreateFont("tahoma", FontSizePopup, 255, 250, 0, 0, true, false, false),
  516.                 TextFunc = () =>  TextoPopup
  517.             };
  518.         }
  519.  
  520.         public void OnNewArea(bool newGame, ISnoArea area)
  521.         {
  522.             if (newGame || (MyIndex != Hud.Game.Me.Index) )   // Fix partialment the newGame limitation
  523.             {
  524.                 MyIndex = Hud.Game.Me.Index;
  525.                 InRift = false;
  526.                 foreach (var p in ShrinesData.Keys) { ShrinesData[p].Reset(); }
  527.                 MarkIdReapp.Clear(); ShrineUsedCoord.Clear();
  528.             }
  529.             if ((area.HostAreaSno == 288482) || (area.Sno == 288482))
  530.             {
  531.                 if (!InRift)        //Start Map New Rift (Nephalem o GR)
  532.                 {
  533.                     InRift = true;
  534.                     if (Hud.Game.Me.InGreaterRift) // new GR
  535.                     {
  536.                         PGRn = 0 ;
  537.                         foreach (var p in ShrinesData.Keys) { ShrinesData[p].Reset();  }
  538.                     }
  539.                 }
  540.             }
  541.         }
  542.  
  543.         public void AfterCollect()
  544.         {
  545.             if (!Hud.Game.IsInGame) return;
  546.             if (InRift && (Hud.Game.Quests.FirstOrDefault(q => (q.SnoQuest.Sno == 337492) && (q.State == QuestState.started || q.State == QuestState.completed )) == null)) { InRift = false; }
  547.  
  548.             var actors = Hud.Game.Actors.Where(a => a.GizmoType == GizmoType.PowerUp && (a.SnoActor.Kind == ActorKind.Shrine || a.SnoActor.Kind == ActorKind.None) && a.FloorCoordinate.IsValid);
  549.             foreach (var actor in actors) // para paliar el problema de marker.IsUsed con los santuarios conocidos y desconocidos
  550.             {
  551.                 var sid = actor.WorldId + "|" + actor.FloorCoordinate.ToString();
  552.                 if (!ShrineUsedCoord.TryGetValue(sid, out var isUsed))
  553.                 {
  554.                     ShrineUsedCoord.Add(sid, actor.GetAttributeValue(Hud.Sno.Attributes.Gizmo_State, 1048575) == 1);
  555.                 }
  556.                 else if (!isUsed && actor.GetAttributeValue(Hud.Sno.Attributes.Gizmo_State, 1048575) == 1)
  557.                 {
  558.                     ShrineUsedCoord[sid] = true;
  559.                 }
  560.             }
  561.             var markers = Hud.Game.Markers.Where(s => s.FloorCoordinate.IsValid && (s.IsPylon || s.IsShrine || s.IsPoolOfReflection) && s.SnoActor != null);
  562.             foreach (var marker in markers)
  563.             {
  564.                 if (MarkIdReapp.TryGetValue(marker.Id, out var r))
  565.                 {
  566.                     if (r == false)
  567.                     {                      
  568.                         ActorSnoEnum fixActor = (marker.IsShrine && Hud.Game.Me.SnoArea.Sno == 486520)? ActorSnoEnum._p73_shrine_treasuregoblin: marker.SnoActor.Sno; //  echoing Nightmwares => _shrine_global is bandit, for early detection
  569.                         if (SnoTypeDic.TryGetValue(fixActor, out var stype))
  570.                         {
  571.                             MarkIdReapp[marker.Id] = true;
  572.                             var used = marker.IsShrine? (ShrineUsedCoord.TryGetValue(marker.WorldId + "|" + marker.FloorCoordinate.ToString(),out var isUsed)?isUsed:false) : marker.IsUsed; // marker.IsUsed puede dar un valor erróneo cuando marker es un sanc
  573.                             if (!used)
  574.                             {
  575.                                 string shrineName = string.Empty;
  576.                                 if (marker.IsPoolOfReflection)
  577.                                 {
  578.                                     shrineName = TTSViewPoolText ?? string.Empty;
  579.                                 }
  580.                                 else
  581.                                 {
  582.                                     if ( PylonsGR.Contains(stype) && !ShrinesData[stype].GR ) // marker.IsPylon
  583.                                     {
  584.                                         ShrinesData[stype].GR = true;
  585.                                         PGRn++;
  586.                                     }
  587.                                     shrineName = (TTSViewPylon)? ShrinesData[stype].TTSView: string.Empty;
  588.                                 }
  589.                                 if (shrineName != string.Empty)
  590.                                 {
  591.                                     Hud.Sound.Speak( shrineName ?? marker.SnoActor.NameLocalized ); // if == null localized name  , if == "" (string.Empty) no TTS
  592.                                 }
  593.                             }
  594.                         }
  595.                     }
  596.                 }
  597.                 else
  598.                 {
  599.                     MarkIdReapp.Add(marker.Id, false);
  600.                 }
  601.             }
  602.             foreach (uint buff in PylonBuffType.Keys)
  603.             {
  604.                 if (Hud.Game.Me.Powers.GetBuff(buff) == null) continue;
  605.                 var stype = PylonBuffType[buff];
  606.                 if ( Hud.Game.Me.Powers.BuffIsActive(buff,0)  )
  607.                 {
  608.                     var bfinish = Hud.Game.CurrentGameTick + (int) (60 * Hud.Game.Me.Powers.GetBuff(buff).TimeLeftSeconds[0]);
  609.                     if ( !ShrinesData[stype].Buff || (bfinish > (ShrinesData[stype].Finish + 60)) )
  610.                     {
  611.                         if (Hud.Game.Me.Powers.GetBuff(buff).TimeLeftSeconds[0] == 0) { continue; } // Patch Posible bug. Recibes bufo y TimeLeftSeconds es 0, ¿no inicializado aún?
  612.                         ShrinesData[stype].Buff = true;
  613.                         ShrinesData[stype].Finish = bfinish;
  614.                         if (Hud.Game.Me.Powers.GetBuff(buff).TimeElapsedSeconds[0] < 1)
  615.                         {
  616.                             var msg = ShrinesData[stype].TTSBuffON;
  617.                             if (TTSBuffPylon && !string.IsNullOrEmpty(msg))     // null or "" -> no TTS
  618.                             {
  619.                                 if (NotifyInTown || !Hud.Game.IsInTown) { Hud.Sound.Speak(msg); }
  620.                             }
  621.                             msg = ShrinesData[stype].PopupBuff;
  622.                             if (ShowPopup && !string.IsNullOrEmpty(msg))  // null or "" -> no popup
  623.                             {
  624.                                 if (NotifyInTown || !Hud.Game.IsInTown) { Hud.Queue.AddItem( new PopupPylon(true, msg, new TimeSpan(0, 0, 0, 0, 3000)) ); }
  625.                             }
  626.                         }
  627.                         if ( PylonsGR.Contains(stype) && !ShrinesData[stype].GR )
  628.                         {
  629.                             PGRn++;
  630.                             ShrinesData[stype].GR = true;
  631.                         }
  632.                     }
  633.                 }
  634.                 else if (ShrinesData[stype].Buff)
  635.                 {
  636.                     var t = Hud.Game.Me.Powers.GetBuff(buff).LastActive.ElapsedMilliseconds;
  637.                     if ( (Hud.Game.CurrentGameTick > ShrinesData[stype].Finish) || ((t > 200) && (t < 1000)) )  // Patch, erratic behavior BuffIsActive/LastActiveIwatch
  638.                     {
  639.                         ShrinesData[stype].Buff = false;
  640.                         ShrinesData[stype].Finish = Hud.Game.CurrentGameTick - 1;
  641.                         var msg = ShrinesData[stype].TTSBuffOFF;
  642.                         if (TTSBuffPylon && !string.IsNullOrEmpty(msg))
  643.                         {
  644.                             if (NotifyInTown || !Hud.Game.IsInTown)     { Hud.Sound.Speak(msg); }
  645.                         }
  646.                         msg = ShrinesData[stype].PopupBuff;
  647.                         if (ShowPopup && !string.IsNullOrEmpty(msg))
  648.                         {
  649.                             if (NotifyInTown || !Hud.Game.IsInTown)     { Hud.Queue.AddItem(new PopupPylon(false, msg, new TimeSpan(0, 0, 0, 0, 3000))); }
  650.                         }
  651.                     }
  652.                 }
  653.             }
  654.         }
  655.  
  656.         public void PaintWorld(WorldLayer layer)
  657.         {
  658.             if (!Hud.Game.IsInGame) return;
  659.             if (layer != WorldLayer.Ground) return;
  660.             if (!Hud.Game.IsInTown)
  661.             {
  662.                 var markers = Hud.Game.Markers.Where(s => s.FloorCoordinate.IsValid && s.SnoActor != null);
  663.                 foreach (var marker in markers)
  664.                 {
  665.                     Hud.Render.GetMinimapCoordinates(marker.FloorCoordinate.X, marker.FloorCoordinate.Y, out var mapX, out var mapY);
  666.                     if (Hud.SceneReveal.MinimapClip && Hud.Render.MinimapUiElement.Visible && !Hud.Render.MinimapUiElement.Rectangle.Contains(mapX,mapY)) continue;
  667.                     var texture = Hud.Texture.GetTexture(marker.TextureSno, marker.TextureFrameIndex);
  668.                     if (texture != null)
  669.                     {
  670.                         var width = texture.Width * Hud.Render.MinimapScale;    // Radius = 1
  671.                         var height = texture.Height * Hud.Render.MinimapScale;  //
  672.                         texture.Draw(mapX - (width / 2), mapY - (height / 2), width, height, marker.FloorCoordinate.IsOnScreen() ? 1f : Opacity); // Podría también hacer depender la opacidad de "used"
  673.                     }
  674.                     if (marker.IsHealingWell)
  675.                     {
  676.                         if (!marker.IsUsed)
  677.                         {
  678.                             DecoratorHealing.ToggleDecorators<MapShapeDecorator>(texture == null);
  679.                             DecoratorHealing.Paint(WorldLayer.Map, null, marker.FloorCoordinate, LabelHealingWells ?? marker.SnoActor.NameLocalized);
  680.                         }
  681.                     }
  682.                     else if (marker.IsPoolOfReflection)
  683.                     {
  684.                         if (!marker.IsUsed)
  685.                         {
  686.                             if (LineToPylon && (LineToPoolRange == 0 || marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) < LineToPoolRange))
  687.                             {
  688.                                 LinePool.Paint(WorldLayer.Map, null, marker.FloorCoordinate, "");
  689.                             }
  690.                             DecoratorCircle.ToggleDecorators<MapShapeDecorator>(texture == null);
  691.                             DecoratorCircle.Paint(WorldLayer.Map, null, marker.FloorCoordinate, LabelPoolOfReflection ?? marker.SnoActor.NameLocalized);
  692.                         }
  693.                     }
  694.                     else if (marker.IsPylon || marker.IsShrine)
  695.                     {
  696.                         var used = marker.IsPylon? marker.IsUsed : (ShrineUsedCoord.TryGetValue(marker.WorldId + "|" + marker.FloorCoordinate.ToString(),out var isUsed)?isUsed:false);  // marker.IsUsed puede dar un valor erróneo cuando marker es un sanc
  697.                         if (!used)
  698.                         {
  699.                             if (Hud.Game.Me.SnoArea.Sno != 486520)  // Desactivo líneas y némesis para las pesadillas resonadoras.
  700.                             {
  701.                                 if (NemesisAlert && marker.FloorCoordinate.IsOnScreen() && !Hud.Game.Me.Powers.BuffIsActive(318820))
  702.                                 {
  703.                                     var players = Hud.Game.Players.Where(p => p.Powers.BuffIsActive(318820) );
  704.                                     PylonNemesys = string.Empty;
  705.                                     foreach (var player in players)
  706.                                     {
  707.                                         PylonNemesys += ((PylonNemesys == string.Empty)? "":"\n") + player.BattleTagAbovePortrait ;
  708.                                     }
  709.                                     var l = TextoFont.GetTextLayout(PylonNemesys) ; var wi = l.Metrics.Width * 1.5f ; var he = l.Metrics.Height * 1.4f;
  710.                                     DecoratorPylonNemesys.Paint(marker.FloorCoordinate.ToScreenCoordinate().X - wi/2 , marker.FloorCoordinate.ToScreenCoordinate().Y - he - 12, wi, he, HorizontalAlign.Center);
  711.                                 }
  712.                                 if (LineToPylon && (marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) < LineToPylonRange))
  713.                                 {
  714.                                     if (marker.IsShrine && LineDifferentToUnknownShrine && !ShrineUsedCoord.ContainsKey(marker.WorldId + "|" + marker.FloorCoordinate.ToString()))
  715.                                     {
  716.                                         if (marker.SnoActor.Kind != ActorKind.Shrine) LineUndefinedShrine.Paint(WorldLayer.Map, null, marker.FloorCoordinate, "");
  717.                                         else LineUnknownShrine.Paint(WorldLayer.Map, null, marker.FloorCoordinate, "");
  718.                                     }
  719.                                     else LinePylon.Paint(WorldLayer.Map, null, marker.FloorCoordinate, "");
  720.                                 }
  721.                             }
  722.                         }
  723.                         else if (HiddenPylonUsed) continue;
  724.                         ActorSnoEnum fixActor = (marker.IsShrine && Hud.Game.Me.SnoArea.Sno == 486520)? ActorSnoEnum._p73_shrine_treasuregoblin: marker.SnoActor.Sno;
  725.                         if ( SnoTypeDic.TryGetValue(fixActor, out var stype) )
  726.                         {
  727.                             bool cerca = (marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) < 35)? true: false;
  728.                             DecoratorDefault = used ? DecoratorRectangleGray : (ShrinesData[stype].ShrineDecorator ?? DecoratorRectangle) ;
  729.                             if ((!LabelPylonExchange && marker.FloorCoordinate.IsOnScreen()) || cerca) //Mostrar GroundLabelDecorator cuando estás cerca
  730.                             {
  731.                                 DecoratorDefault.Paint(WorldLayer.Ground, null, marker.FloorCoordinate, (ShrinesData[stype].LabelG)?? marker.SnoActor.NameLocalized);
  732.                             }
  733.                             if (!LabelPylonExchange || !cerca) // Mostrar MapLabelDecorator cuando no estás cerca
  734.                             {
  735.                                 DecoratorDefault.ToggleDecorators<MapShapeDecorator>(SquarePylon);
  736.                                 DecoratorDefault.ToggleDecorators<MapLabelDecorator>(true);
  737.                                 DecoratorDefault.Paint(WorldLayer.Map, null, marker.FloorCoordinate, (ShrinesData[stype].LabelM)?? marker.SnoActor.NameLocalized);
  738.                             }
  739.                         }
  740.                     }
  741.                     else if (ShowMarkers)
  742.                     {
  743.                         if (marker.SnoQuest != null)                                { DecoratorDefault = QuestDecorator;            }
  744.                         else if (marker.SnoActor != null)
  745.                         {
  746.                             if (marker.SnoActor.Code.Contains("_Boss_"))            { DecoratorDefault = BossDecorator;             }
  747.                             else if (marker.SnoActor.Code.EndsWith("_Unique_Uber")) { DecoratorDefault = KeywardenDecorator;        }
  748.                             else                                                    { DecoratorDefault = OtherMarkerDecorator;      }
  749.                         }
  750.                         else                                                        { DecoratorDefault = DefaultMarkerDecorator;    }
  751.  
  752.                         DecoratorDefault.Decorators[2].Enabled = (marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) > LineToMarkerRange)?false:true;
  753.                         DecoratorDefault.Paint(WorldLayer.Map, null, marker.FloorCoordinate, marker.Name);
  754.                     }
  755.                 }
  756.                 if (ShowPylonSpawn)
  757.                 {
  758.                     var riftPylonSpawnPoints = Hud.Game.Actors.Where(s => s.SnoActor.Sno == ActorSnoEnum._markerlocation_tieredriftpylon);
  759.                     foreach (var actor in riftPylonSpawnPoints)
  760.                     {
  761.                         if ((Hud.Game.RiftPercentage < 100) && (PGRn < 4))
  762.                         {
  763.                             DecoratorDefault = DecoratorRectangle;          //DecoratorDefault = DecoratorRectangle; (for rectangle) or DecoratorDefault = DecoratorCircle; (for circle)
  764.                             DecoratorDefault.ToggleDecorators<MapLabelDecorator>(true);
  765.                         }
  766.                         else
  767.                         {
  768.                             DecoratorDefault = DecoratorRectangleGray;      //DecoratorDefault = DecoratorRectangleGray; (for rectangle) or DecoratorDefault = DecoratorCircleGray; (for circle)
  769.                             DecoratorDefault.ToggleDecorators<MapLabelDecorator>(false); // replace HayPylon with true for show always the label
  770.                         }
  771.                         DecoratorDefault.ToggleDecorators<MapShapeDecorator>(true);
  772.                         DecoratorDefault.Paint(WorldLayer.Map, actor, actor.FloorCoordinate, LabelPossiblePylon );
  773.                     }
  774.                 }
  775.             }
  776.             else if (!NotifyInTown) return;
  777.             float h = FontSizePopup + Hud.Window.Size.Height * 0.04f;
  778.             float y = Hud.Window.Size.Height * yPopup - h / 2;
  779.             foreach (PopupPylon p in Hud.Queue.GetItems<PopupPylon>().Take(7))
  780.             {
  781.                 TextoPopup = p.Text;
  782.                 float w = p.Text.Length*FontSizePopup + Hud.Window.Size.Width * 0.04f;
  783.                 float x = Hud.Window.Size.Width * xPopup - w / 2;
  784.                 if (p.On) { DecoratorPopupON.Paint(x, y , w, h, HorizontalAlign.Center); }
  785.                 else { DecoratorPopupOFF.Paint(x, y , w, h, HorizontalAlign.Center); }
  786.                 if (y < Hud.Window.Size.Height/2) y += h;
  787.                 else y -= h;
  788.             }
  789.         }
  790.     }
  791. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement