RNNCode

BuildsIconsAndCoe

Apr 29th, 2024 (edited)
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 56.86 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Collections.Generic;
  6. using SharpDX;
  7. using SharpDX.Direct2D1;
  8. using System.Windows.Forms;
  9.  
  10. namespace Turbo.Plugins.RNN
  11. {
  12.     public class BuildsIconsAndCoe : BasePlugin, IInGameTopPainter, ICustomizer, INewAreaHandler
  13.     {
  14.         private Dictionary<HeroClass,List<int>> AllBonusElements { get; set; }
  15.         private int[] IndexToBonus { get; set; } = new int[8] { 7, 5, 3, 1, 6, 2, 0, 4 };   // Index: 1 = Arcane, 2 = Cold, 3 = Fire, 4 = Holy, 5 = Lightning, 6 = Physical, 7 = Poison // index to bonus   { -, 5, 3, 1, 6, 2, 0, 4 };
  16.         private int[] BonusToIndex { get; set; } = new int[7] { 6, 3, 5, 2, 7, 1, 4 };      // Bonus: 0 = Physical, 1 = Fire, 2 = Lightning, 3 = Cold, 4 = Poison, 5 = Arcane, 6 = Holy // bonus to index   { 6, 3, 5, 2, 7, 1, 4};
  17.         private Dictionary<uint,int> SelectElement { get; set; } = new Dictionary<uint,int>();
  18.         public enum ElementNoRune { None = 0, Arcane = 1, Cold = 2, Fire = 3, Holy = 4, Lightning = 5, Physical = 6, Poison = 7 }
  19.         private long LastClick { get; set; } = 0;
  20.  
  21.         public delegate IPlayerSkill SkillFunc(IPlayer player);
  22.         public Dictionary<SkillFunc, ElementNoRune> SkillDefaultElement { get; set; } = new Dictionary<SkillFunc, ElementNoRune>();
  23.  
  24.         private int Ticks0 { get; set; } = 0;
  25.         private int Count0 { get; set; } = 0;
  26.  
  27.         private float SizeIconWidth  { get; set; }
  28.         private float SizeIconHeight  { get; set; }
  29.         private SharpDX.DirectWrite.TextLayout layout { get; set; } = null;
  30.  
  31.         private IFont FontAS { get; set; }
  32.         private IFont FontWhite { get; set; }
  33.         private IFont FontGray { get; set; }
  34.         private IFont FontGreen { get; set; }
  35.         private IFont FontYellow { get; set; }
  36.         private IFont FontOrange { get; set; }
  37.         private IFont FontBlue { get; set; }
  38.         private IFont FontDefault { get; set; } = null;
  39.         private IFont FontNames { get; set; }
  40.         private IFont FontLocust { get; set; }
  41.         private IFont FontFury { get; set; }
  42.  
  43.         private IFont FontStacks { get; set; }
  44.         private IFont FontTimeLeft { get; set; }
  45.         private IFont FontTimeLeft2 { get; set; }
  46.         private IFont FontStacksRed { get; set; }
  47.  
  48.         private IBrush TimeLeftClockBrush { get; set; }
  49.         private IBrush BrushBlack { get; set; }
  50.         private IBrush BrushGreen { get; set; }
  51.         private IBrush BrushRed { get; set; }
  52.         private IBrush BrushYellow { get; set; }
  53.         private IBrush BrushOrange { get; set; }
  54.         private IBrush BrushBlue { get; set; }
  55.         private IBrush BrushDefault { get; set; }
  56.  
  57.         private IFont FontCounter { get; set; }
  58.         private IFont FontExpl { get; set; }
  59.         private IFont FontLimit { get; set; }
  60.         private IFont FontLimit2 { get; set; }
  61.         private IFont FontAlly { get; set; }
  62.  
  63.         private float _SizeMultiplier  { get; set; }
  64.        
  65.         public float SizeMultiplier
  66.         {
  67.             get { return _SizeMultiplier; }
  68.             set
  69.             {
  70.                 if (_SizeMultiplier != value)
  71.                 {
  72.                     _SizeMultiplier = value;
  73.  
  74.                     FontWhite = Hud.Render.CreateFont("tahoma", 10f * SizeMultiplier, 255, 255, 255, 255, true, false, 255, 0, 0, 0, true);
  75.                     FontGray = Hud.Render.CreateFont("tahoma", 10f * SizeMultiplier, 235, 235, 235, 235, true, false, 255, 0, 0, 0, true);
  76.                     FontGreen = Hud.Render.CreateFont("tahoma", 13f * SizeMultiplier, 255, 0, 255, 0, true, false, 255, 0, 0, 0, true);
  77.                     FontYellow = Hud.Render.CreateFont("tahoma", 13f * SizeMultiplier, 255, 255, 255, 0, true, false, 255, 0, 0, 0, true);
  78.                     FontOrange = Hud.Render.CreateFont("tahoma", 13f * SizeMultiplier, 255, 255, 150, 0, true, false, 255, 0, 0, 0, true);
  79.                     FontBlue = Hud.Render.CreateFont("tahoma", 7f * SizeMultiplier, 255, 50, 150, 250, true, false, 255, 0, 0, 0, true);
  80.                     FontNames = Hud.Render.CreateFont("tahoma", 8f * SizeMultiplier, 235, 235, 235, 235, false, false, 255, 0, 0, 0, true);
  81.  
  82.                     FontStacks = Hud.Render.CreateFont("tahoma", 10f * SizeMultiplier, 255, 255, 255, 0, true, false, 255, 0, 0, 0, true);
  83.                     FontStacksRed = Hud.Render.CreateFont("tahoma", 10f * SizeMultiplier, 255, 255, 0, 0, true, false, 160, 0, 0, 0, true);
  84.                     FontTimeLeft = Hud.Render.CreateFont("tahoma", 10f * SizeMultiplier, 255, 0, 255, 0, true, false, 255, 0, 0, 0, true);
  85.                     FontTimeLeft2 = Hud.Render.CreateFont("tahoma", 7f * SizeMultiplier, 255, 0, 255, 0, true, false, 255, 0, 0, 0, true);
  86.  
  87.                     FontCounter = Hud.Render.CreateFont("tahoma", 8f * SizeMultiplier, 255, 0, 255, 0, true, false, 160, 0, 0, 0, true);
  88.                     FontLimit = Hud.Render.CreateFont("tahoma", 8f * SizeMultiplier, 255, 255, 220, 100, true, false, 160, 0, 0, 0, true);
  89.                     FontExpl = Hud.Render.CreateFont("tahoma", 9f * SizeMultiplier, 255, 50, 150, 255, true, false, 160, 0, 0, 0, true);
  90.  
  91.                     FontLimit2 = Hud.Render.CreateFont("tahoma", 8f * SizeMultiplier, 255, 255, 100, 50, true, false, 160, 0, 0, 0, true);
  92.                     FontLocust = Hud.Render.CreateFont("tahoma", 9f * SizeMultiplier, 255, 255, 255, 255, false, false, 255, 0, 0, 0, true);
  93.                     FontAS = Hud.Render.CreateFont("tahoma", 6f * SizeMultiplier, 255, 255, 255, 255, false, false, 255, 0, 0, 0, true);
  94.                     FontFury = Hud.Render.CreateFont("Tahoma", 9f * SizeMultiplier ,  255, 220, 150,255, true, false, 255, 0, 0, 0, true);
  95.                     FontAlly = Hud.Render.CreateFont("tahoma", 9f * SizeMultiplier, 255, 255, 220, 25, true, false, 255, 0, 0, 0, true);
  96.  
  97.                 }
  98.             }
  99.         }
  100.  
  101.  
  102.         public float Xpor  { get; set; }
  103.         public float Ypor  { get; set; }
  104.         public bool ShowCoe { get; set; }
  105.         public bool OnlyGR { get; set; }
  106.         public bool OnlyMe { get; set; } = false;
  107.         public bool ShowMe { get; set; }
  108.         public bool ShowOthers { get; set; }
  109.         public float Opacity { get; set; }
  110.         public bool InactiveRedFrame { get; set; }
  111.         public bool ShowNames { get; set; }
  112.         public int ProgressBarWidth { get; set; } = 2;
  113.         public bool ShowBonusDamageInTown { get; set; }
  114.         public bool SkillsWithJordanOnly { get; set; }
  115.  
  116.         public bool SymbolCooldown { get; set; }
  117.  
  118.         public bool Nayr { get; set; }
  119.         public bool BoneSpear { get; set; }
  120.         public bool Singularity { get; set; }
  121.         public bool ShowEssenceMages { get; set; }
  122.         public float EssenceLimit { get; set; }
  123.  
  124.         public bool SpiritBarrage { get; set; }
  125.         public bool ShowGlobes { get; set; }
  126.         public bool ShowSoulHarvest { get; set; }
  127.         public bool ShowBigBadVoodoo { get; set; }
  128.         public bool ShowSpiritWalk { get; set; }
  129.         public bool ShowLocust { get; set; }
  130.         public bool ShowHaunted { get; set; }
  131.         public int YardsLocustHaunt { get; set; }
  132.         public float SBWarning { get; set; }
  133.  
  134.         public bool ThornsBomb { get; set; }
  135.         public bool ValorFotH { get; set; }
  136.         public bool SteedCharge { get; set; }
  137.         public bool FlailCharge { get; set; }
  138.         public bool Akarat { get; set; }
  139.  
  140.         public bool Inna { get; set; }
  141.         public bool MantraSalvation { get; set; }
  142.         public bool AllyAmount { get; set; }
  143.         public bool SpiritGuards { get; set; }
  144.         public bool Lefebvre { get; set; }
  145.         public bool FlyingDragon { get; set; }
  146.  
  147.  
  148.         public bool Fenix { get; set; }
  149.  
  150.         private Dictionary<uint,int> Phantasms { get;set; } = new Dictionary<uint,int>();
  151.  
  152.         private HashSet<ActorSnoEnum> ZombieDogSno = new HashSet<ActorSnoEnum>
  153.         {
  154.             ActorSnoEnum._wd_zombiedog,                 // 51353    //2 rune
  155.             ActorSnoEnum._wd_zombiedogrune_fire,        // 103215   //4 rune
  156.             ActorSnoEnum._wd_zombiedogrune_healthglobe, // 105763   //0 rune
  157.             ActorSnoEnum._wd_zombiedogrune_healthlink,  // 110959   //3 rune
  158.             ActorSnoEnum._wd_zombiedogrune_lifesteal,   // 103235   //5 rune
  159.             ActorSnoEnum._wd_zombiedogrune_poison,      // 103217   //1 rune
  160.         };
  161.         private HashSet<ActorSnoEnum> MagesSno = new HashSet<ActorSnoEnum>
  162.         {
  163.             ActorSnoEnum._p6_necro_skeletonmage_b,
  164.             ActorSnoEnum._p6_necro_skeletonmage_e,
  165.             ActorSnoEnum._p6_necro_skeletonmage_f_archer,
  166.             ActorSnoEnum._p6_necro_skeletonmage_c,
  167.             ActorSnoEnum._p6_necro_skeletonmage_d,
  168.         };
  169.  
  170.         private HashSet<ActorSnoEnum> AllySno = new HashSet<ActorSnoEnum>
  171.         {
  172.             ActorSnoEnum._monk_male_mystically,                 // 169904,
  173.             ActorSnoEnum._monk_male_mystically_alabaster,       // 169905
  174.             ActorSnoEnum._monk_male_mystically_crimson,         // 169906
  175.             ActorSnoEnum._monk_male_mystically_indigo,          // 169907
  176.             ActorSnoEnum._monk_male_mystically_golden,          // 169908
  177.             ActorSnoEnum._monk_male_mystically_obsidian,        // 169909
  178.  
  179.             ActorSnoEnum._monk_male_mystically_alabaster_v2,    // 485723
  180.  
  181.             ActorSnoEnum._monk_female_mystically,                   // 123885
  182.             ActorSnoEnum._monk_female_mystically_alabaster,         // 169891
  183.             ActorSnoEnum._monk_female_mystically_crimson,           // 168878
  184.             ActorSnoEnum._monk_female_mystically_indigo,            // 169890
  185.             ActorSnoEnum._monk_female_mystically_golden,            // 169123
  186.             ActorSnoEnum._monk_female_mystically_obsidian,          // 169077
  187.  
  188.             ActorSnoEnum._monk_female_mystically_alabaster_v2,      // 485722
  189.  
  190.             ActorSnoEnum._x1_monk_female_mysticallymini_crimson,    // 367774
  191.             //ActorSnoEnum._x1_projectile_mystically_runec_boulder, // 363935
  192.             //ActorSnoEnum._monk_mysticallyrune_fire_shadowblur_crits, // 170972
  193.         };
  194.  
  195.         public BuildsIconsAndCoe()
  196.         {
  197.             Enabled = true;
  198.         }
  199.  
  200.         public override void Load(IController hud)
  201.         {
  202.             base.Load(hud);
  203.             Order = 30001;
  204.             /* Necro */
  205.             Nayr = true;                // Enable Icons Build Nayr
  206.             BoneSpear = true;           // Enable Icons Build Bone Spear (Set Bonus 6)
  207.             Singularity = true;         // Enable Icons Build Singularity
  208.             ShowEssenceMages = true;    // Show amount of essence with which the mages are summoned
  209.             EssenceLimit = 0.66f;       // 0f .. 0.95f . When the essence is below this value it will be colored orange (Green if it is at maximum and in another case yellow)
  210.  
  211.             /* WitchDoctor  */
  212.             SpiritBarrage = true;       // Enable Icons Build Spirit Barrage
  213.             SBWarning = 2.0f;           // 9.0f...0f Text will take the color yellow when it reaches this value
  214.             ShowGlobes = true;          // Health Globes Counter (floor)
  215.             ShowSoulHarvest = true;     // Show SoulHarvest icon
  216.             ShowBigBadVoodoo = false;   // Show Big Bad Voodoo icon
  217.             ShowSpiritWalk = false;     // Show Spirit Walk icon
  218.             ShowLocust = false;         // Locust Affected Monster Counters (Total \n Elites) at distance = YardsLocustHaunt
  219.             ShowHaunted = false;        // Haunted Affected Monster Counters (Total \n Elites) at distance = YardsLocustHaunt
  220.             YardsLocustHaunt = 40;      // Yards for Monsters Counters (Locust and Haunted)
  221.             /* Crusader */
  222.             ThornsBomb = true;          // Enable Icons Build Thorns Bomb (Invoker set 2 items + belt of the Trove)
  223.             ValorFotH = true;           // Enable Icons Build Valor - Fist of the Heaven
  224.             SteedCharge = true;         // Show Steed Charge icon
  225.             FlailCharge = true;         // Show Flail of the Charge (Bonus 2) icon
  226.             Akarat = true;              // Show Icon Akarat´s Champion
  227.  
  228.             /* Wizard   */
  229.             Fenix = true;               // Enable Icons Build Fenix (4 Items Set)
  230.  
  231.             /* Monk */
  232.             Inna = true;                // Enable Icons Build Inna (6 Items Set)
  233.             MantraSalvation = true;     // Show Mantra of Salvation Icon
  234.             AllyAmount = true;          // Show amount of mystical allies
  235.             SpiritGuards = true;        // Show Bracers Spirit Guards icon
  236.             Lefebvre = true;            // Show Shoulders Lefebvre´s Soliloquy icon
  237.             FlyingDragon = true;        // Show Flying Dragon icon
  238.  
  239.             /* Common */
  240.             ShowMe = true;              // Show for my character
  241.             ShowOthers = true;          // Show for others character
  242.             ShowNames = true;           // Show players names
  243.             OnlyGR = false;             // Show  in GR only
  244.             Xpor = 0.71f;               // To set the x coordinate of the icon
  245.             Ypor = 0.10f;               // To set the y coordinate of the icon
  246.             SizeMultiplier = 0.75f;     // Size multiplier for icons
  247.             Opacity = 0.75f;            // 0f..1f  Opacity for icon texture
  248.             ShowCoe = true;             // Show COE status
  249.             InactiveRedFrame = false;   // Inactive elements (coe) are shown in red (active in yellow)
  250.             ProgressBarWidth = 2;       // Width progressbar Coe (pixels)
  251.             SymbolCooldown = false;     // Symbol "✔️"
  252.             ShowBonusDamageInTown = false;  // Enable Displaying Elemental Damage Bonuses in Town
  253.             SkillsWithJordanOnly = false;   // The configured skills will be applied only if you have the Jordan equipped
  254.  
  255.             TimeLeftClockBrush = Hud.Render.CreateBrush(220, 0, 0, 0, 0);
  256.             BrushBlack = Hud.Render.CreateBrush(255, 80, 80, 80, 0);
  257.             BrushGreen = Hud.Render.CreateBrush(255, 0, 255 , 0, 0);
  258.             BrushYellow = Hud.Render.CreateBrush(255, 255, 255 , 0, 0);
  259.             BrushOrange = Hud.Render.CreateBrush(255, 255, 185 , 0, 0);
  260.             BrushBlue = Hud.Render.CreateBrush(255, 50, 150 , 250, 0);
  261.  
  262.             AllBonusElements = new Dictionary<HeroClass, List<int>> // 1 = Arcane, 2 = Cold, 3 = Fire, 4 = Holy, 5 = Lightning, 6 = Physical, 7 = Poison
  263.             {
  264.                 {   HeroClass.Necromancernew List<int>{2,6,7}        },
  265.                 {   HeroClass.Barbarian,    new List<int>{2,3,5,6}      },
  266.                 {   HeroClass.DemonHunternew List<int>{2,3,5,6}      },
  267.                 {   HeroClass.Wizard,       new List<int>{1,2,3,5}      },
  268.                 {   HeroClass.WitchDoctornew List<int>{2,3,6,7}      },
  269.                 {   HeroClass.Crusader,     new List<int>{3,4,5,6}      },
  270.                 {   HeroClass.Monk,         new List<int>{2,3,4,5,6}    },
  271.             };
  272.         }
  273.  
  274.         public void Customize()
  275.         {
  276.             var OpacityBrush = (int) (Opacity * 255);
  277.             BrushRed = Hud.Render.CreateBrush(OpacityBrush, 255, 50 , 50, 0);
  278.  
  279.             if ((SBWarning < 0f) || (SBWarning > 9f)) { SBWarning = 2; }
  280.             if (EssenceLimit < 0 || EssenceLimit > 0.95 ) { EssenceLimit = 0.66f;   }
  281.         }
  282.  
  283.         public void OnNewArea(bool newGame, ISnoArea area)
  284.         {
  285.             if (newGame) Phantasms.Clear();
  286.         }
  287.  
  288.         private void DrawTimeLeftClock(RectangleF rect, double elapsed, double timeLeft)   // plugins\Default\BuffLists\Painter\BuffPainter.cs
  289.         {
  290.             if ((timeLeft > 0) && (elapsed >= 0) && (TimeLeftClockBrush != null))
  291.             {
  292.                 var endAngle = Convert.ToInt32(360.0d / (timeLeft + elapsed) * elapsed);
  293.                 var startAngle = 0;
  294.                 TimeLeftClockBrush.Opacity = 1 - (float)(0.5f / (timeLeft + elapsed) * elapsed);
  295.                 var rad = rect.Width * 0.45f;
  296.                 using (var pg = Hud.Render.CreateGeometry())
  297.                 {
  298.                     using (var gs = pg.Open())
  299.                     {
  300.                         gs.BeginFigure(rect.Center, FigureBegin.Filled);
  301.                         for (var angle = startAngle; angle <= endAngle; angle++)
  302.                         {
  303.                             var mx = rad * (float)Math.Cos((angle - 90) * Math.PI / 180.0f);
  304.                             var my = rad * (float)Math.Sin((angle - 90) * Math.PI / 180.0f);
  305.                             var vec = new Vector2(rect.Center.X + mx, rect.Center.Y + my);
  306.                             gs.AddLine(vec);
  307.                         }
  308.  
  309.                         gs.EndFigure(FigureEnd.Closed);
  310.                         gs.Close();
  311.                     }
  312.  
  313.                     TimeLeftClockBrush.DrawGeometry(pg);
  314.                 }
  315.             }
  316.         }
  317.  
  318.         public void DrawIconBuff(float x, float y, float width, float height, uint idtexture, int stacks, double timeleft, double elapsed, double timeleft2 = 0)
  319.         {
  320.             Hud.Texture.GetTexture(idtexture).Draw(x, y, width, height, Opacity);
  321.             Hud.Texture.BuffFrameTexture.Draw(x, y, width, height, Opacity);
  322.             if (timeleft > 0)
  323.             {
  324.                 DrawTimeLeftClock(new RectangleF(x, y , width, height), elapsed , timeleft);
  325.                 layout = FontTimeLeft.GetTextLayout(timeleft.ToString( (timeleft < 1)? "F1" : "F0") );
  326.                 FontTimeLeft.DrawText(layout, x + ((width - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((height - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  327.                 if (timeleft2 > 0)
  328.                 {
  329.                     layout = FontTimeLeft2.GetTextLayout(timeleft2.ToString((timeleft2 < 1)? "F1" : "F0") );
  330.                     FontTimeLeft2.DrawText(layout, x + ((width - (float)Math.Ceiling(layout.Metrics.Width))/5.0f), y + ((height - (float)Math.Ceiling(layout.Metrics.Height))/1.1f) );
  331.                 }
  332.             }
  333.             layout = FontStacks.GetTextLayout( stacks.ToString() );
  334.             (stacks == 0?FontStacksRed:FontStacks).DrawText(layout, x + ((width - (float)Math.Ceiling(layout.Metrics.Width))/1.15f), y + ((height - (float)Math.Ceiling(layout.Metrics.Height))/1.05f) );
  335.         }
  336.  
  337.         public void DrawIconSkill(float x, float y, float width, float height, IPlayerSkill skill, int index = 1, double fix = 0)
  338.         {
  339.             Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, width, height, Opacity);
  340.             double timeleft = 0;
  341.             if (skill.Buff != null) // 465839
  342.             {
  343.                 Hud.Texture.BuffFrameTexture.Draw(x, y, width, height, Opacity);
  344.                 timeleft = skill.Buff.TimeLeftSeconds[index] - fix;
  345.             }
  346.             else
  347.             {
  348.                 if (skill.SnoPower.Sno == 362102) Hud.Texture.BuffFrameTexture.Draw(x, y, width, height, Opacity);
  349.                 else Hud.Texture.DebuffFrameTexture.Draw(x, y, width, height, Opacity);
  350.             }
  351.             if (skill.CooldownFinishTick > Hud.Game.CurrentGameTick)
  352.             {
  353.                 double remaining = (skill.CooldownFinishTick - Hud.Game.CurrentGameTick) / 60.0d;
  354.                 double elapsed = (Hud.Game.CurrentGameTick - skill.CooldownStartTick) / 60.0d;
  355.                 DrawTimeLeftClock(new SharpDX.RectangleF(x, y , width, height), elapsed , remaining);
  356.                 layout = FontWhite.GetTextLayout( remaining.ToString( (remaining < 1)? "F1":"F0" ) );
  357.             }
  358.             else { layout = FontWhite.GetTextLayout(SymbolCooldown?"✔️":""); }
  359.             FontWhite.DrawText(layout, x + ((width - (float)Math.Ceiling(layout.Metrics.Width))/1.25f), y + ((height - (float)Math.Ceiling(layout.Metrics.Height))/1.1f) );
  360.             if (timeleft > 0)
  361.             {
  362.                 layout = FontTimeLeft.GetTextLayout(timeleft.ToString( (timeleft < 1)? "F1" : "F0") );
  363.                 FontTimeLeft.DrawText(layout, x + ((width - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((height - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  364.             }
  365.         }
  366.  
  367.         public void PaintTopInGame(ClipState clipState)
  368.         {
  369.             if (clipState != ClipState.BeforeClip) return;
  370.             if (!Hud.Game.IsInGame) return;
  371.             if (OnlyGR && !Hud.Game.Me.InGreaterRift) return;
  372.  
  373.             var players = Hud.Game.Players.Where( p => p.IsMe?ShowMe:(ShowOthers && p.HasValidActor) ).OrderBy(p => p.PortraitIndex);
  374.             if (players.Any())
  375.             {
  376.                 SizeIconWidth = Hud.Texture.BuffFrameTexture.Width   * Hud.Window.Size.Height/1200.0f * SizeMultiplier;
  377.                 SizeIconHeight = Hud.Texture.BuffFrameTexture.Height * Hud.Window.Size.Height/1200.0f * SizeMultiplier;
  378.                 var y =  Hud.Window.Size.Height * Ypor ;
  379.                 foreach(var player in players)
  380.                 {
  381.                     var x =  Hud.Window.Size.Width * Xpor;
  382.                     if (player.HeroClassDefinition.HeroClass == HeroClass.Necromancer)
  383.                     {
  384.                         IPlayerSkill skill = player.Powers.UsedNecromancerPowers.SkeletalMage;  // 462089
  385.                         var build = false;
  386.  
  387.                         if (BoneSpear && player.Powers.BuffIsActive(484303)) // Bonut 6 set
  388.                         {
  389.                             build = true;
  390.                             if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout,x + 1,y ); y += layout.Metrics.Height + 1; }
  391.                             if (player.Powers.BuffIsActive(478534)) // Dayntee Equipped
  392.                             {
  393.                                 Hud.Texture.InventoryLegendaryBackgroundLarge.Draw(x,y,SizeIconWidth,SizeIconHeight,Opacity);
  394.                                 Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.P61_Unique_Belt_01).Draw(x,y,SizeIconWidth,SizeIconHeight,Opacity);
  395.                                 Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  396.                                 var n = Hud.Game.AliveMonsters.Where(m => m.Cursed).Count();
  397.                                 layout = FontStacks.GetTextLayout(n.ToString());
  398.                                 ((n > 0)?FontStacks:FontStacksRed).DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.20f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.05f) );
  399.                                 if (player.Powers.BuffIsActive(478534,1))
  400.                                 {
  401.                                     layout = FontTimeLeft.GetTextLayout("✔️");  // Dayntee Buff
  402.                                     FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/5f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/14f) );
  403.                                 }
  404.                                 x += SizeIconWidth;
  405.                             }
  406.                         }
  407.  
  408.                         else if ( Singularity && ((skill != null) && (skill?.Rune == 1 || player.Powers.BuffIsActive(484311))) ) // Singularity
  409.                         {
  410.                             build = true;
  411.                             if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout,x + 1,y ); y += layout.Metrics.Height + 1; }
  412.                             if (skill.Buff != null)
  413.                             {
  414.                                 var stacks = ( (skill.Buff.IconCounts[6] == 1) && (skill.Buff.TimeLeftSeconds[5] == 0) )? 0:skill.Buff.IconCounts[6];
  415.                                 if (stacks == 0)
  416.                                 {
  417.                                     DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,skill.SnoPower.NormalIconTextureId,0, 0, 0 );
  418.                                 }
  419.                                 else
  420.                                 {
  421.                                     DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,skill.SnoPower.NormalIconTextureId,stacks,skill.Buff.TimeLeftSeconds[5],skill.Buff.TimeElapsedSeconds[5],skill.Buff.TimeLeftSeconds[6]);
  422.                                 }
  423.                             }
  424.                             else
  425.                             {
  426.                                 Hud.Texture.GetTexture(265393923).Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity); // skill.SnoPower.NormalIconTextureId
  427.                                 Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  428.                             }
  429.                             x += SizeIconWidth;
  430.                             if (ShowEssenceMages /*&& player.Powers.BuffIsActive(475247)*/) // Nailuj
  431.                             {
  432.                                 Hud.Texture.GetTexture(265393923).Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  433.                                 Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  434.  
  435.                                 var mages = Hud.Game.Actors.Where(a => MagesSno.Contains(a.SnoActor.Sno) && a.SummonerAcdDynamicId == player.SummonerId);
  436.                                 if (mages.Any())
  437.                                 {
  438.                                     double removegem = (player.Powers.BuffIsActive(403466))? 100d/(100 + player.GetAttributeValue(Hud.Sno.Attributes.Item_Power_Passive,403466) * 10d): 1;
  439.                                     var c = 1;
  440.                                     var resmax = ((player.Powers.UsedNecromancerPowers.Simulacrum == null) || player.Powers.BuffIsActive(465350))? player.Stats.ResourceMaxPri: player.Stats.ResourceMaxPri * 2;
  441.                                     foreach (var MagesGroup in mages.GroupBy(a => (int)(a.GetAttributeValue(Hud.Sno.Attributes.Multiplicative_Damage_Percent_Bonus, 1048575) * removegem / 0.03d)).OrderBy(g => g.Key))
  442.                                     {
  443.                                         if (MagesGroup.FirstOrDefault().GetAttributeValue(Hud.Sno.Attributes.Multiplicative_Damage_Percent_Bonus, 1048575) == 1) continue;
  444.                                         FontDefault = (MagesGroup.Key >= resmax - 3)? FontCounter: (MagesGroup.Key < resmax * EssenceLimit)?FontLimit2:FontLimit ;
  445.                                         var layout = FontDefault.GetTextLayout( String.Format("{0,-3} {1,2}",MagesGroup.Key ,MagesGroup.Count()) );
  446.                                         FontDefault.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.5f), y + (layout.Metrics.Height * 0.91f * (c - 1)) );
  447.                                         if (++c > 3) break;
  448.                                     }
  449.                                 }
  450.                                 x += SizeIconWidth;
  451.                             }
  452.                         }
  453.  
  454.                         if (Nayr && player.Powers.BuffIsActive(476587)) // Nayr
  455.                         {
  456.                             if (!build)
  457.                             {
  458.                                 build = true;
  459.                                 if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout,x + 1,y ); y += layout.Metrics.Height + 1; }
  460.                             }
  461.                             var buff = player.Powers.GetBuff(476587);
  462.                             if (buff != null)
  463.                             {
  464.                                 var c = buff.IconCounts[7];
  465.                                 if (c > 0)
  466.                                 {
  467.                                     int j = 7; double timeleft = 0; double timeleft2 = 15;
  468.                                     for (var i = 1; i < 7; i++)
  469.                                     {
  470.                                         var t = buff.TimeLeftSeconds[i];
  471.                                         if (t > 0)
  472.                                         {
  473.                                             if (t > timeleft) { j = i; timeleft = t; }
  474.                                             if (t < timeleft2) { timeleft2 = t; }
  475.                                         }
  476.                                     }
  477.                                     DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,2831437924, c, buff.TimeLeftSeconds[j], buff.TimeElapsedSeconds[j],(c > 1)?timeleft2:0 );
  478.                                 }
  479.                                 else { DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,2831437924, 0, 0, 0); }
  480.                             }
  481.                             x += SizeIconWidth;
  482.                         }
  483.  
  484.  
  485.                         if (build)
  486.                         {
  487.                             skill = player.Powers.UsedNecromancerPowers.LandOfTheDead; // 465839
  488.                             if (skill != null)
  489.                             {
  490.                                 DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill, 0);   // index 0
  491.                                 x += SizeIconWidth;
  492.                             }
  493.  
  494.                             skill = player.Powers.UsedNecromancerPowers.Simulacrum; // 465350
  495.                             if (skill != null)
  496.                             {
  497.                                 DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill, 1);   // index 1 , para averiguar el timeleft
  498.                                 if (player.Powers.BuffIsActive(465350) && player.Powers.BuffIsActive(484309))
  499.                                 {
  500.                                     layout = FontTimeLeft.GetTextLayout("∞");
  501.                                     FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  502.                                 }
  503.                                 x += SizeIconWidth;
  504.                             }
  505.  
  506.                             skill = player.Powers.UsedNecromancerPowers.BoneArmor;  // 466857
  507.                             if (skill != null)
  508.                             {
  509.                                 if (skill.Buff != null)
  510.                                 {
  511.                                     DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,skill.SnoPower.NormalIconTextureId,skill.Buff.IconCounts[0],skill.Buff.TimeLeftSeconds[0], skill.Buff.TimeElapsedSeconds[0] );
  512.                                 }
  513.                                 else
  514.                                 {
  515.                                     Hud.Texture.GetTexture(436563001).Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  516.                                     Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  517.                                 }
  518.                                 x += SizeIconWidth;
  519.                             }
  520.  
  521.                             if (player.Powers.BuffIsActive(475251)) // Bloodtide Blade
  522.                             {
  523.                                 Hud.Texture.InventoryLegendaryBackgroundLarge.Draw(x,y,SizeIconWidth,SizeIconHeight,Opacity);
  524.                                 Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.P65_Unique_Scythe2H_02).Draw(x,y,SizeIconWidth,SizeIconHeight,Opacity);
  525.                                 if (Math.Abs(Hud.Game.CurrentGameTick - Ticks0) > 20)
  526.                                 {
  527.                                     Count0 = Hud.Game.AliveMonsters.Where(m => m.FloorCoordinate.XYDistanceTo(player.FloorCoordinate) <= 25).Count();
  528.                                     Ticks0 = Hud.Game.CurrentGameTick;
  529.                                 }
  530.                                 layout = FontTimeLeft.GetTextLayout( Count0.ToString() );
  531.                                 FontStacks.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/2.0f) );
  532.                                 x += SizeIconWidth;
  533.                             }
  534.                         }
  535.                         else continue;
  536.                     }
  537.                     else if (player.HeroClassDefinition.HeroClass == HeroClass.WitchDoctor)
  538.                     {
  539.                         if (!SpiritBarrage) continue;
  540.                         IPlayerSkill skill = player.Powers.UsedWitchDoctorPowers.SpiritBarrage; // 108506
  541.                         if ( (skill != null) && (skill.Rune == 2 || player.Powers.BuffIsActive(484270)))
  542.                         {
  543.                             {   // Simple bloque
  544.                                 if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout,x + 1,y ); y += layout.Metrics.Height + 1; }
  545.                                 var actors = Hud.Game.Actors.Where(a => a.SnoActor.Sno == ActorSnoEnum._wd_spiritbarragerune_aoe_ghostmodel && (a.SummonerAcdDynamicId == player.SummonerId));
  546.                                 Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth , SizeIconHeight, Opacity); // TextureId 1117784160
  547.                                 int total = actors.Count();
  548.                                 if (total > 0)
  549.                                 {
  550.                                     foreach(var a in actors)
  551.                                     {
  552.                                         if (!Phantasms.ContainsKey(a.AnnId)) { Phantasms[a.AnnId] = a.CreatedAtInGameTick; }
  553.                                     }
  554.                                     actors = actors.OrderByDescending(a => Phantasms[a.AnnId]);
  555.                                     Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  556.                                     var c = 0;
  557.                                     foreach (var actor in actors)
  558.                                     {
  559.                                         if (++c > 3) break;
  560.                                         var t = (player.Powers.BuffIsActive(484270)?10:5) - (Hud.Game.CurrentGameTick - Phantasms[actor.AnnId]) /  60f;
  561.                                         if (t <= 0)
  562.                                         {
  563.                                             var layout = FontExpl.GetTextLayout("🞴");
  564.                                             FontExpl.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/8.0f), y + (layout.Metrics.Height * 0.68f * (c - 1)) );
  565.                                         }
  566.                                         else
  567.                                         {
  568.                                             FontDefault = (t > SBWarning)? FontCounter:FontLimit;
  569.                                             var layout = FontDefault.GetTextLayout( String.Format("{0:0}",(int) (t + 0.90)) ); // Redondeará a X si es menor  a X.10
  570.                                             FontDefault.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/7.0f), y + (layout.Metrics.Height * 0.90f * (c - 1)) );
  571.                                         }
  572.                                     }
  573.                                 }
  574.                                 else {  Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);    }
  575.                                 layout = FontStacks.GetTextLayout(total.ToString());
  576.                                 (total == 0?FontStacksRed:FontStacks).DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.15f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.05f) );
  577.                                 layout = FontAS.GetTextLayout(player.Offense.AttackSpeed.ToString("F2", CultureInfo.InvariantCulture));
  578.                                 FontAS.DrawText(layout,x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.24f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/7.0f) );
  579.                                 x +=  SizeIconWidth;
  580.                             }
  581.                             if (ShowSoulHarvest)
  582.                             {
  583.                                 skill = player.Powers.UsedWitchDoctorPowers.SoulHarvest;
  584.                                 if (skill != null)
  585.                                 {
  586.                                     if (skill.Buff != null) // 67616
  587.                                     {
  588.                                         DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,skill.SnoPower.NormalIconTextureId,skill.Buff.IconCounts[0],skill.Buff.TimeLeftSeconds[0],skill.Buff.TimeElapsedSeconds[0] );
  589.                                     }
  590.                                     else
  591.                                     {
  592.                                         Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);  // skill.SnoPower.NormalIconTextureId = 2196086897
  593.                                         Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  594.                                     }
  595.                                     x += SizeIconWidth;
  596.                                 }
  597.                             }
  598.                             if (ShowLocust)
  599.                             {
  600.                                 skill = player.Powers.UsedWitchDoctorPowers.LocustSwarm;
  601.                                 if ( (skill != null) || player.Powers.BuffIsActive(423238) )
  602.                                 {
  603.                                     Hud.Texture.GetTexture(1465459957).Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);  // skill.SnoPower.NormalIconTextureId = 1465459957
  604.                                     Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  605.                                     var m = Hud.Game.AliveMonsters.Where(a => a.FloorCoordinate.XYDistanceTo(player.FloorCoordinate) <= YardsLocustHaunt);
  606.                                     var mLc = m.Where(a => a.Locust).Count();
  607.                                     if (mLc > 0)
  608.                                     {
  609.                                         var mc = m.Count();
  610.                                         var e = m.Where(a => (a.Rarity == ActorRarity.Champion || a.Rarity == ActorRarity.Rare || a.Rarity == ActorRarity.Boss) && (a.SummonerAcdDynamicId == 0) );
  611.                                         var ec = e.Count();
  612.                                         if (mc > ec)
  613.                                         {
  614.                                             layout = FontLocust.GetTextLayout( mLc.ToString() + "|" + mc.ToString());
  615.                                             FontLocust.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/6.0f) );
  616.                                         }
  617.                                         if (ec > 0)
  618.                                         {
  619.                                             var eLc = e.Where(a => a.Locust).Count();
  620.                                             layout = FontLocust.GetTextLayout( eLc.ToString() + "|" + ec.ToString());
  621.                                             FontLocust.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.20f) );
  622.                                         }
  623.                                     }
  624.                                     x += SizeIconWidth;
  625.                                 }
  626.                             }
  627.                             if (ShowHaunted)
  628.                             {
  629.                                 skill = player.Powers.UsedWitchDoctorPowers.Haunt;
  630.                                 if (skill != null)
  631.                                 {
  632.                                     Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);  // skill.SnoPower.NormalIconTextureId =
  633.                                     Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  634.                                     var m = Hud.Game.AliveMonsters.Where(a => a.FloorCoordinate.XYDistanceTo(player.FloorCoordinate) <= YardsLocustHaunt);
  635.                                     var mHc = m.Where(a => a.Haunted).Count();
  636.                                     if (mHc > 0)
  637.                                     {
  638.                                         var mc = m.Count();
  639.                                         var e = m.Where(a => (a.Rarity == ActorRarity.Champion || a.Rarity == ActorRarity.Rare || a.Rarity == ActorRarity.Boss) && (a.SummonerAcdDynamicId == 0) );
  640.                                         var ec = e.Count();
  641.                                         if (mc > ec)
  642.                                         {
  643.                                             layout = FontLocust.GetTextLayout( mHc.ToString() + "|" + mc.ToString());
  644.                                             FontLocust.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/6.0f) );
  645.                                         }
  646.                                         if (ec > 0)
  647.                                         {
  648.                                             var eHc = e.Where(a => a.Haunted).Count();
  649.                                             layout = FontLocust.GetTextLayout( eHc.ToString() + "|" + ec.ToString());
  650.                                             FontLocust.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.20f) );
  651.                                         }
  652.                                     }
  653.                                     x += SizeIconWidth;
  654.                                 }
  655.                             }
  656.                             if (ShowBigBadVoodoo)
  657.                             {
  658.                                 skill = player.Powers.UsedWitchDoctorPowers.BigBadVoodoo;
  659.                                 if (skill != null)
  660.                                 {
  661.                                     DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill, 4);   // index 4 , para averiguar el timeleft
  662.                                     x += SizeIconWidth;
  663.                                 }
  664.                             }
  665.                             if (ShowSpiritWalk) // 106237
  666.                             {
  667.                                 skill = player.Powers.UsedWitchDoctorPowers.SpiritWalk;
  668.                                 if (skill != null)
  669.                                 {
  670.                                     var shukrani = player.Powers.BuffIsActive(486132);
  671.                                     DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill, shukrani?13:0);   // index,  para averiguar el timeleft
  672.                                     if (shukrani && player.Powers.BuffIsActive(106237,14))
  673.                                     {
  674.                                         layout = FontTimeLeft.GetTextLayout("∞");
  675.                                         FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  676.                                     }
  677.                                     x += SizeIconWidth;
  678.                                 }
  679.                             }
  680.                             skill = player.Powers.UsedWitchDoctorPowers.Sacrifice;  // 102572 - Sacrifice
  681.                             if ( (skill != null) && (skill.Rune == 0) )
  682.                             {
  683.                                 if (skill.Buff != null)
  684.                                 {
  685.                                     DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,skill.SnoPower.NormalIconTextureId,skill.Buff.IconCounts[0],skill.Buff.TimeLeftSeconds[0],skill.Buff.TimeElapsedSeconds[0] );
  686.                                 }
  687.                                 else
  688.                                 {
  689.                                     Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);  // skill.SnoPower.NormalIconTextureId =
  690.                                     Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  691.                                 }
  692.                                 var n = Hud.Game.Actors.Where(a => ZombieDogSno.Contains(a.SnoActor.Sno) && (a.SummonerAcdDynamicId == player.SummonerId)).Count();
  693.                                 if (n > 0)
  694.                                 {
  695.                                     layout = FontWhite.GetTextLayout(n.ToString());
  696.                                     FontWhite.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/7.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.05f) );
  697.                                 }
  698.                                 x += SizeIconWidth;
  699.                             }
  700.                             if (player.Powers.UsedPassives.Any(p => p.Sno == Hud.Sno.SnoPowers.WitchDoctor_Passive_GruesomeFeast.Sno)) // 208594
  701.                             {
  702.                                 IBuff buff = player.Powers.GetBuff(208594);
  703.                                 if (buff != null)  // Hud.Sno.SnoPowers.WitchDoctor_Passive_GruesomeFeast.NormalIconTextureId  = 1591242582
  704.                                 {
  705.                                     DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,1591242582,buff.IconCounts[1],buff.TimeLeftSeconds[1],buff.TimeElapsedSeconds[1] );
  706.                                 }
  707.                                 else
  708.                                 {
  709.                                     Hud.Texture.GetTexture(1591242582).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  710.                                     Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  711.                                 }
  712.                                 x +=  SizeIconWidth;
  713.                                 if (ShowGlobes)
  714.                                 {
  715.                                     var n = Hud.Game.Actors.Where(a => a.SnoActor.Kind == ActorKind.HealthGlobe).Count();
  716.                                     if (n > 0)
  717.                                     {
  718.                                         layout = FontWhite.GetTextLayout(n.ToString());
  719.                                         var w = (n < 10)? layout.Metrics.Width + 1:(layout.Metrics.Width/2 + 2);
  720.                                         BrushRed.DrawEllipse(x + SizeIconWidth / 2 , y + SizeIconHeight / 2 , w , w );
  721.                                         FontWhite.DrawText(layout,x + (SizeIconWidth - layout.Metrics.Width) / 2 , y + (SizeIconHeight - layout.Metrics.Height) / 2 - 1 );
  722.                                     }
  723.                                 }
  724.                             }
  725.                         }
  726.                         else continue;
  727.                     }
  728.                     else if (player.HeroClassDefinition.HeroClass == HeroClass.Crusader)
  729.                     {
  730.                         if (ThornsBomb && player.Powers.BuffIsActive(445829))
  731.                         {
  732.                             if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout,x + 1,y ); y += layout.Metrics.Height + 1; }
  733.                             IBuff buff = player.Powers.GetBuff(445829);
  734.                             if (buff != null)
  735.                             {
  736.                                 DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,2503653692,buff.IconCounts[1],buff.TimeLeftSeconds[1],buff.TimeElapsedSeconds[1] );
  737.                             }
  738.                             x += SizeIconWidth;
  739.                         }
  740.                         else if (ValorFotH && player.Powers.BuffIsActive(483643))
  741.                         {
  742.                             IBuff buff = Hud.Game.Me.Powers.GetBuff(483655);
  743.                             if (buff != null)
  744.                             {
  745.                                 DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,3114805186,buff.IconCounts[1],buff.TimeLeftSeconds[1],buff.TimeElapsedSeconds[1] );
  746.                             }
  747.                             else
  748.                             {
  749.                                 Hud.Texture.GetTexture(3114805186).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  750.                                 Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  751.                             }
  752.                             if (player.Powers.UsedCrusaderPowers.HeavensFury != null)
  753.                             {
  754.                                 buff = player.Powers.GetBuff(483643);
  755.                                 if (buff != null)
  756.                                 {
  757.                                     layout = FontFury.GetTextLayout(buff.IconCounts[1].ToString());
  758.                                     FontFury.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.11f) );
  759.                                 }
  760.                             }
  761.                             x += SizeIconWidth;
  762.                         }
  763.                         else continue;
  764.                         IPlayerSkill skill = player.Powers.UsedCrusaderPowers.SteedCharge; // 243853
  765.                         if (skill != null)
  766.                         {
  767.                             if (SteedCharge)
  768.                             {
  769.                                 DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill, 0);
  770.                                 x += SizeIconWidth;
  771.                             }
  772.                             if (FlailCharge && player.Powers.BuffIsActive(447291))
  773.                             {
  774.                                 IBuff buff = player.Powers.GetBuff(447291);
  775.                                 if (buff != null)
  776.                                 {
  777.                                     Hud.Texture.InventorySetBackgroundLarge.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  778.                                     Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.P4_Unique_Flail_2H_Set_01_x1).Draw(x + SizeIconWidth/6, y, SizeIconWidth * 0.55f, SizeIconHeight, Opacity);
  779.                                     Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  780.                                     var timeleft = buff.TimeLeftSeconds[1]; var stacks = (buff.IconCounts[1] == 1 || skill.Buff?.IconCounts[0] == 1)?200:0;
  781.                                     if (timeleft > 0)
  782.                                     {
  783.                                         layout = FontTimeLeft.GetTextLayout(timeleft.ToString( (timeleft < 1)? "F1" : "F0") );
  784.                                         FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  785.                                     }
  786.                                     layout = FontStacks.GetTextLayout( stacks.ToString());
  787.                                     (stacks == 0?FontStacksRed:FontStacks).DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.25f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.05f) );
  788.                                 }
  789.                                 x += SizeIconWidth;
  790.                             }
  791.                         }
  792.                         if (Akarat)
  793.                         {
  794.                             skill = player.Powers.UsedCrusaderPowers.AkaratsChampion; // 269032
  795.                             if (skill != null)
  796.                             {
  797.                                 DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill, 1);   // index 1,  para averiguar el timeleft
  798.                                 x += SizeIconWidth;
  799.                             }
  800.                         }
  801.                     }
  802.                     else if (player.HeroClassDefinition.HeroClass == HeroClass.Wizard)
  803.                     {
  804.                         if (Fenix && player.Powers.BuffIsActive(485549) && player.Powers.UsedWizardPowers.SpectralBlade != null)  // 485549 set-4 , 445814 set-6
  805.                         {
  806.                             if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout,x + 1,y ); y += layout.Metrics.Height + 1; }
  807.                             IBuff buff = player.Powers.GetBuff(485549); // 485549 set-4 . Combustion
  808.                             IPlayerSkill skill = player.Powers.UsedWizardPowers.SpectralBlade;  // 98027 - SpectralBlade
  809.                             //if (skill != null)
  810.                             {
  811.                                 if (skill.Buff != null)
  812.                                 {
  813.                                     DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,skill.SnoPower.NormalIconTextureId,skill.Buff.IconCounts[4],skill.Buff.TimeLeftSeconds[4],skill.Buff.TimeElapsedSeconds[4] );
  814.                                 }
  815.                                 else
  816.                                 {
  817.                                     Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);  // skill.SnoPower.NormalIconTextureId =
  818.                                     Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  819.                                 }
  820.                                 x += SizeIconWidth;
  821.                             }
  822.                             if (buff != null)
  823.                             {
  824.                                 Hud.Texture.GetTexture(1714727035).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  825.                                 skill = player.Powers.UsedWizardPowers.Disintegrate;
  826.                                 ((skill == null)?Hud.Texture.DebuffFrameTexture:Hud.Texture.BuffFrameTexture).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  827.                                 int stacks = buff.IconCounts[3];
  828.  
  829.                                 layout = FontStacks.GetTextLayout(stacks.ToString());
  830.                                 (stacks == 0?FontStacksRed:FontStacks).DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.25f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.05f) );
  831.                             }
  832.                             x += SizeIconWidth;
  833.                             skill = player.Powers.UsedWizardPowers.MirrorImage; //  98027 - MirrorImage
  834.                             if (skill != null)
  835.                             {
  836.                                 DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill, 0, 1.5);  // index 0,  para averiguar el timeleft . Debo restar 1.5s (death)
  837.                                 layout = FontFury.GetTextLayout( skill.Buff != null? skill.Buff.IconCounts[6].ToString():"" );
  838.                                 FontFury.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/7.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.1f) );
  839.                                 x += SizeIconWidth;
  840.                             }
  841.                             if (player.Powers.UsedPassives.Any(p => p.Sno == Hud.Sno.SnoPowers.Wizard_Passive_UnwaveringWill.Sno)) // 298038 - UnwaveringWill
  842.                             {
  843.                                 Hud.Texture.GetTexture(859252908).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);  // Hud.Sno.SnoPowers.Wizard_Passive_UnwaveringWill.NormalIconTextureId  = 859252908
  844.                                 Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  845.                                 if (player.Powers.BuffIsActive(298038,1))
  846.                                 {
  847.                                     layout = FontTimeLeft.GetTextLayout("✔️");
  848.                                     FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/2.0f) );
  849.                                 }
  850.                                 else
  851.                                 {
  852.                                     layout = FontStacksRed.GetTextLayout("X️");
  853.                                     FontStacksRed.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/2.0f) );
  854.                                 }
  855.                                 x += SizeIconWidth;
  856.                             }
  857.                         }
  858.                         else continue;
  859.                     }
  860.                     else if (player.HeroClassDefinition.HeroClass == HeroClass.Monk)
  861.                     {
  862.                         if (Inna && player.Powers.BuffIsActive(449252)) // set inna bonus 6
  863.                         {
  864.                             if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout,x + 1,y ); y += layout.Metrics.Height + 1; }
  865.                             IPlayerSkill skill = player.Powers.UsedMonkPowers.WayOfTheHundredFists;
  866.                             if (skill != null && (skill.Rune == 3 || skill.Rune == 2) )
  867.                             {
  868.                                 if (skill.Buff != null)
  869.                                 {
  870.                                     var i = (skill.Rune == 3)?4:1;
  871.                                     DrawIconBuff(x,y,SizeIconWidth,SizeIconHeight,skill.SnoPower.NormalIconTextureId,skill.Buff.IconCounts[i],skill.Buff.TimeLeftSeconds[i],skill.Buff.TimeElapsedSeconds[i] );
  872.                                 }
  873.                                 else
  874.                                 {
  875.                                     Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);  // skill.SnoPower.NormalIconTextureId =
  876.                                     Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  877.                                 }
  878.                                 x += SizeIconWidth;
  879.                             }
  880.                             if (player.Powers.BuffIsActive(440569))  // Shenlong: 440568 equipped , 440569 bonus
  881.                             {
  882.                                 var buff = player.Powers.GetBuff(440569);
  883.                                 if (buff != null)
  884.                                 {
  885.                                     Hud.Texture.GetTexture(buff.SnoPower.Icons[1].TextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  886.                                     Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  887.                                     FontDefault = (buff.IconCounts[1] == 1)? FontStacks : FontTimeLeft ;
  888.                                 }
  889.                                 else { FontDefault = FontTimeLeft; }
  890.                                 layout = FontAlly.GetTextLayout(player.Stats.ResourcePctPri.ToString("F0") + "﹪" );
  891.                                 FontDefault.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.2f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/2.4f) );
  892.                                 //layout = FontAS.GetTextLayout(player.Stats.ResourceCurPri.ToString("F0") );
  893.                                 //FontNames.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.3f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.1f) );
  894.                                 x += SizeIconWidth;
  895.                             }
  896.                             skill = player.Powers.UsedMonkPowers.MysticAlly;
  897.                             if (skill != null)
  898.                             {
  899.                                 DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill);  // skill.Buff == null , no timeleft
  900.                                 if (AllyAmount)
  901.                                 {
  902.                                     var Ally = Hud.Game.Actors.Where(a => AllySno.Contains(a.SnoActor.Sno) && a.SummonerAcdDynamicId == player.SummonerId);
  903.                                     int AllyHideCount = Ally.Where(a => a.GetAttributeValueAsUInt(Hud.Sno.Attributes.Hidden, 1048575) == 1).Count();
  904.                                     int AllyMiniCount = 0;
  905.  
  906.                                     if (skill.Rune == 0)
  907.                                     {
  908.                                         AllyMiniCount = Ally.Where(a => a.SnoActor.Sno == ActorSnoEnum._x1_monk_female_mysticallymini_crimson ).Count();
  909.                                         layout = FontLimit2.GetTextLayout( AllyMiniCount.ToString());
  910.                                         FontLimit2.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/7.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.1f) );
  911.                                     }
  912.  
  913.                                     layout = FontAlly.GetTextLayout( (Ally.Count() - AllyMiniCount).ToString());
  914.                                     FontAlly.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/12.0f) );
  915.  
  916.                                     layout = FontNames.GetTextLayout(AllyHideCount.ToString());
  917.                                     FontNames.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.2f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/10.0f) );
  918.                                 }
  919.                                 x += SizeIconWidth;
  920.                             }
  921.                             skill = player.Powers.UsedMonkPowers.Serenity;
  922.                             if (skill != null)
  923.                             {
  924.                                 DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill,0);    // timeleft 0
  925.                                 x += SizeIconWidth;
  926.                             }
  927.                             skill = player.Powers.UsedMonkPowers.Epiphany;
  928.                             if (skill != null)
  929.                             {
  930.                                 DrawIconSkill(x,y,SizeIconWidth,SizeIconHeight,skill,0);    // timeleft 0
  931.                                 x += SizeIconWidth;
  932.                             }
  933.                             if (MantraSalvation)
  934.                             {
  935.                                 skill = player.Powers.UsedMonkPowers.MantraOfSalvation; // 375049 -> 375050
  936.                                 if (skill != null)
  937.                                 {
  938.                                     Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  939.                                     IBuff buff = player.Powers.GetBuff(375050);
  940.                                     if (buff != null)
  941.                                     {
  942.                                         var timeleft = buff.TimeLeftSeconds[1];
  943.                                         if (timeleft > 0)
  944.                                         {
  945.                                             layout = FontTimeLeft.GetTextLayout(timeleft.ToString( (timeleft < 1)? "F1" : "F0") );
  946.                                             FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  947.                                         }
  948.                                         Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  949.                                     }
  950.                                     else
  951.                                     {
  952.                                         Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  953.                                     }
  954.                                     x += SizeIconWidth;
  955.                                 }
  956.                             }
  957.                             if (FlyingDragon)
  958.                             {
  959.  
  960.                                 if (player.Powers.BuffIsActive(246562))  // Dragón Volador
  961.                                 {
  962.                                     var buff = player.Powers.GetBuff(246562);
  963.                                     if (buff != null)
  964.                                     {
  965.                                         Hud.Texture.InventoryLegendaryBackgroundLarge.Draw(x,y,SizeIconWidth,SizeIconHeight,Opacity);
  966.                                         Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.Unique_CombatStaff_2H_009_x1).Draw(x, y, SizeIconWidth, SizeIconHeight, 1.0f);
  967.                                         Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth,SizeIconHeight, Opacity);
  968.                                         var timeleft = buff.TimeLeftSeconds[1];
  969.                                         if (timeleft > 0)
  970.                                         {
  971.                                             layout = FontTimeLeft.GetTextLayout(timeleft.ToString( (timeleft < 1)? "F1" : "F0") );
  972.                                             FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  973.                                         }
  974.                                         else
  975.                                         {
  976.                                             layout = FontStacksRed.GetTextLayout("X️");
  977.                                             FontStacksRed.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/2.0f) );
  978.                                         }
  979.                                     }
  980.                                     x += SizeIconWidth;
  981.                                 }
  982.                             }
  983.                             if (SpiritGuards)
  984.                             {
  985.                                 if (player.Powers.BuffIsActive(430289)) // Bracers Spirit Guards
  986.                                 {
  987.                                     var buff = player.Powers.GetBuff(430289);
  988.                                     if (buff != null)
  989.                                     {
  990.                                         Hud.Texture.GetTexture(buff.SnoPower.Icons[1].TextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  991.                                         Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  992.                                         var timeleft = buff.TimeLeftSeconds[1];
  993.                                         if (timeleft > 0)
  994.                                         {
  995.                                             layout = FontTimeLeft.GetTextLayout(timeleft.ToString( (timeleft < 1)? "F1" : "F0") );
  996.                                             FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  997.                                         }
  998.                                     }
  999.                                     x += SizeIconWidth;
  1000.                                 }
  1001.                             }
  1002.                             if (Lefebvre)
  1003.                             {
  1004.                                 if (player.Powers.BuffIsActive(449236)) // Bracers Spirit Guards
  1005.                                 {
  1006.                                     Hud.Texture.InventoryLegendaryBackgroundLarge.Draw(x,y,SizeIconWidth,SizeIconHeight,Opacity);   // Hud.Texture.InventoryLegendaryBackgroundSmall / Hud.Texture.InventoryLegendaryBackgroundLarge
  1007.                                     Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.P4_Unique_Shoulder_101).Draw(x + SizeIconWidth/4,y,SizeIconWidth/2,SizeIconHeight,Opacity);
  1008.                                     var buff = player.Powers.GetBuff(223473);
  1009.                                     if (buff != null)
  1010.                                     {
  1011.                                         Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  1012.                                         var timeleft = buff.TimeLeftSeconds[0];
  1013.                                         if (timeleft > 0)
  1014.                                         {
  1015.                                             layout = FontTimeLeft.GetTextLayout(timeleft.ToString( (timeleft < 1)? "F1" : "F0") );
  1016.                                             FontTimeLeft.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/14.0f) );
  1017.                                         }
  1018.                                     }
  1019.                                     else
  1020.                                     {
  1021.                                         Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  1022.                                     }
  1023.                                     x += SizeIconWidth;
  1024.                                 }
  1025.                             }
  1026.                         }
  1027.                         else continue;
  1028.                     }
  1029.                     else continue;
  1030.  
  1031.                     x =  Hud.Window.Size.Width * Xpor;  y +=  SizeIconHeight;
  1032.                     if (ShowCoe && (player.Powers.GetBuff(Hud.Sno.SnoPowers.ConventionOfElements.Sno) != null) ) // 430674
  1033.                     {
  1034.                         var BuffCoE = player.Powers.GetBuff(430674);
  1035.                         var HeroBonusElements = AllBonusElements[player.HeroClassDefinition.HeroClass];
  1036.                         var BonusCount = HeroBonusElements.Count;
  1037.                         var ActiveElement = -1; var BestElement = -1;  double MaxBonus = -1;    string ActiveLetter = string.Empty;
  1038.                         for(var k = BonusCount - 1; k > -1 ; k--)
  1039.                         {
  1040.                             var index = HeroBonusElements[k];
  1041.                             if (BuffCoE.IconCounts[index] > 0)  {   ActiveElement = index;  }
  1042.  
  1043.                             var bonus = player.Offense.ElementalDamageBonus[IndexToBonus[index]];
  1044.                             if (bonus > MaxBonus)
  1045.                             {
  1046.                                 MaxBonus = bonus;
  1047.                                 BestElement = index;
  1048.                                 ActiveLetter = "B";
  1049.                             }
  1050.                             else if (bonus == MaxBonus) ActiveLetter = "";
  1051.                         }
  1052.                         if ((ActiveElement != -1) && (BestElement != -1) )
  1053.                         {
  1054.                             if (SelectElement.TryGetValue(player.HeroId, out var sindex) && sindex != int.MaxValue)
  1055.                             {
  1056.                                 ActiveLetter = "M";
  1057.                                 BestElement = sindex;
  1058.                             }
  1059.                             else if (!SkillsWithJordanOnly || player.Powers.BuffIsActive(Hud.Sno.SnoPowers.StoneOfJordan.Sno)) // 484282 - P69_ItemPassive_Unique_Ring_001
  1060.                             {
  1061.                                 foreach(var data in SkillDefaultElement)
  1062.                                 {
  1063.                                     var skill = data.Key(player);
  1064.                                     if (skill != null)
  1065.                                     {
  1066.                                         if (skill.Rune != 255 || HeroBonusElements.Contains((int) data.Value))
  1067.                                         {
  1068.                                             BestElement = (skill.Rune == 255)? (int) data.Value : BonusToIndex[skill.ElementalType];
  1069.                                             ActiveLetter = "S";
  1070.                                         }
  1071.                                         else if (data.Value == ElementNoRune.None) continue; // None (continue) o bad index (break)
  1072.                                         break;
  1073.                                     }
  1074.                                 }
  1075.                             }
  1076.  
  1077.                             for (var l = 0; l < BonusCount; l++)
  1078.                             {
  1079.                                 if (HeroBonusElements[BonusCount - 1] != BestElement)
  1080.                                 {
  1081.                                     HeroBonusElements.Insert(0,HeroBonusElements[BonusCount - 1]);
  1082.                                     HeroBonusElements.RemoveAt(BonusCount);
  1083.                                 }
  1084.                                 else  {   break;  }
  1085.                             }
  1086.                             y += ProgressBarWidth;
  1087.                             foreach(var index in HeroBonusElements)
  1088.                             {
  1089.                                 Hud.Texture.GetTexture(BuffCoE.SnoPower.Icons[index].TextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  1090.  
  1091.                                 double s = 0; bool best = false;
  1092.                                 if (index == ActiveElement)
  1093.                                 {
  1094.                                     s = BuffCoE.TimeLeftSeconds[index];
  1095.                                     if (index == BestElement)
  1096.                                     {
  1097.                                         FontDefault = FontGreen; BrushDefault = BrushGreen;
  1098.                                         best = true;
  1099.                                     }
  1100.                                     else { FontDefault = FontGray; }
  1101.                                     DrawTimeLeftClock(new SharpDX.RectangleF(x, y , SizeIconWidth, SizeIconHeight), BuffCoE.TimeElapsedSeconds[index], BuffCoE.TimeLeftSeconds[index]);
  1102.                                     Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  1103.                                 }
  1104.                                 else
  1105.                                 {
  1106.                                     if (index == BestElement)
  1107.                                     {
  1108.                                         best = true;
  1109.                                         s = (BonusCount - HeroBonusElements.IndexOf(ActiveElement) - 1) * 4 - BuffCoE.TimeElapsedSeconds[ActiveElement] ;
  1110.                                         if (  s >  ((BonusCount - 1) * 2) ) { FontDefault = FontOrange; BrushDefault = BrushOrange; }
  1111.                                         else { FontDefault = FontYellow; BrushDefault = BrushYellow; }
  1112.                                     }
  1113.                                     (InactiveRedFrame?Hud.Texture.DebuffFrameTexture:Hud.Texture.BuffFrameTexture).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
  1114.                                 }
  1115.  
  1116.                                 if (Hud.Window.CursorInsideRect(x, y, SizeIconWidth, SizeIconHeight) && Hud.Input.IsKeyDown(Keys.Menu) && (Hud.Game.CurrentRealTimeMilliseconds - LastClick > 1000))
  1117.                                 {
  1118.                                     if (Hud.Input.IsKeyDown(Keys.LButton))
  1119.                                     {
  1120.                                         if (Hud.Game.IsInTown)
  1121.                                         {
  1122.                                             SelectElement[player.HeroId] = (SelectElement.TryGetValue(player.HeroId,out var findex) && findex == index)? int.MaxValue : index;
  1123.                                             LastClick = Hud.Game.CurrentRealTimeMilliseconds;
  1124.                                             return;
  1125.                                         }
  1126.                                     }
  1127.                                 }
  1128.                                 if (Hud.Game.IsInTown)
  1129.                                 {
  1130.                                     if (ShowBonusDamageInTown)
  1131.                                     {
  1132.                                         layout = FontBlue.GetTextLayout(Math.Round(player.Offense.ElementalDamageBonus[IndexToBonus[index]] * 100).ToString());
  1133.                                         FontBlue.DrawText(layout, x + (SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/6f , y + (SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.05f );
  1134.                                     }
  1135.                                     if (best)
  1136.                                     {
  1137.                                         layout = FontBlue.GetTextLayout(ActiveLetter);
  1138.                                         FontBlue.DrawText(layout, x + (SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/1.16f , y + (SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.05f );
  1139.                                     }
  1140.                                 }
  1141.                                 if (s > 0)
  1142.                                 {
  1143.                                     //layout = FontDefault.GetTextLayout(s.ToString( (s < 1)? "F1" : "F0") );
  1144.                                     layout = FontDefault.GetTextLayout( (s < 1)? s.ToString("F1") : String.Format("{0:0}",(int) (s + 0.80)) ); // Redondeará a X si es menor  a X.20
  1145.                                     FontDefault.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/2.0f));
  1146.                                 }
  1147.                                 x += SizeIconWidth;
  1148.                             }
  1149.                             BrushBlack.DrawRectangle(x , y, - SizeIconWidth * BonusCount, - ProgressBarWidth);
  1150.                             var t = (float) ( SizeIconWidth * (BonusCount - HeroBonusElements.IndexOf(ActiveElement) - BuffCoE.TimeElapsedSeconds[ActiveElement] / 4) );
  1151.                             if (t > 0) BrushDefault.DrawRectangle(x, y, - t , - ProgressBarWidth);
  1152.                             y =  y + SizeIconHeight;
  1153.                         }
  1154.                     }
  1155.                     y += SizeIconHeight * (ShowNames?0.1f:0.4f);
  1156.                 }
  1157.             }
  1158.         }
  1159.     }
  1160. }
Advertisement
Add Comment
Please, Sign In to add comment