Advertisement
jarppaaja

PartyInspector.cs

Mar 9th, 2019
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 22.90 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using SharpDX.DirectInput;
  3. using SharpDX;
  4. using System.Linq;
  5. using System.Collections.Generic;
  6. using Turbo.Plugins.Jack.Extensions;
  7. using System;
  8. using System.Globalization;
  9.  
  10. namespace Turbo.Plugins.Prrovoss
  11. {
  12.  
  13.     public class PartyInspector : BasePlugin, IInGameTopPainter, IKeyEventHandler
  14.     {
  15.         public bool Show { get; set; }
  16.         public IKeyEvent ToggleKeyEvent { get; set; }
  17.         public float SkillRatio { get; set; }
  18.         public float GemRatio { get; set; }
  19.         public float KanaiRatio { get; set; }
  20.         public float ItemRatio { get; set; }
  21.         public SkillPainter SkillPainter { get; set; }
  22.         public Dictionary<uint, uint> LegendaryGemItemIDs { get; set; }
  23.         public float XOffset { get; set; }
  24.         public float YOffset { get; set; }
  25.         public float GapRatio { get; set; }
  26.         private float currY { get; set; }
  27.         private float gap { get; set; }
  28.         public bool DrawKanai { get; set; }
  29.         public bool DrawLegendaryItems { get; set; }
  30.         public bool DrawGems { get; set; }
  31.         public bool DrawSkills { get; set; }
  32.         public bool DrawMetaInformations { get; set; }
  33.         public List<int> ElementOrder { get; set; }
  34.         public List<MetaElement> UpperMeta = new List<MetaElement>();
  35.         public List<MetaElement> LowerMeta = new List<MetaElement>();
  36.  
  37.         public TopLabelWithTitleDecorator LabelDecorator { get; set; }
  38.  
  39.         private float currentX { get; set; }
  40.  
  41.         public PartyInspector()
  42.         {
  43.             Enabled = true;
  44.             Order = 99;
  45.         }
  46.  
  47.  
  48.         public class MetaElement
  49.         {
  50.             public string Hint { get; set; }
  51.             public string Title { get; set; }
  52.             public Func<IPlayer, string> Text { get; set; }
  53.  
  54.             public MetaElement(Func<IPlayer, string> text, string title = null, string hint = null)
  55.             {
  56.                 Hint = hint;
  57.                 Title = title;
  58.                 Text = text;
  59.             }
  60.         }
  61.  
  62.         public override void Load(IController hud)
  63.         {
  64.             base.Load(hud);
  65.  
  66.             Show = false;
  67.             ToggleKeyEvent = Hud.Input.CreateKeyEvent(true, Key.F8, false, false, false);
  68.  
  69.             LegendaryGemItemIDs = new Dictionary<uint, uint>();
  70.  
  71.             SkillPainter = new SkillPainter(Hud, true)
  72.             {
  73.                 TextureOpacity = 1.0f,
  74.                 EnableSkillDpsBar = true,
  75.                 EnableDetailedDpsHint = true,
  76.                 CooldownFont = Hud.Render.CreateFont("arial", 8, 255, 255, 255, 255, true, false, 255, 0, 0, 0, true),
  77.                 SkillDpsBackgroundBrushesByElementalType = new IBrush[]
  78.                 {
  79.                     Hud.Render.CreateBrush(222, 255, 6, 0, 0),
  80.                     Hud.Render.CreateBrush(222, 183, 57, 7, 0),
  81.                     Hud.Render.CreateBrush(222, 0, 38, 119, 0),
  82.                     Hud.Render.CreateBrush(222, 77, 102, 155, 0),
  83.                     Hud.Render.CreateBrush(222, 50, 106, 21, 0),
  84.                     Hud.Render.CreateBrush(222, 138, 0, 94, 0),
  85.                     Hud.Render.CreateBrush(222, 190, 117, 0, 0),
  86.                 },
  87.                 SkillDpsFont = Hud.Render.CreateFont("tahoma", 7, 222, 255, 255, 255, false, false, 0, 0, 0, 0, false),
  88.             };
  89.             SkillRatio = 0.025f;
  90.             KanaiRatio = 0.025f;
  91.             ItemRatio = 0.025f;
  92.             GemRatio = 0.0166666666666667f;
  93.  
  94.             LabelDecorator = new TopLabelWithTitleDecorator(Hud)
  95.             {
  96.                 BorderBrush = Hud.Render.CreateBrush(255, 180, 147, 109, -1),
  97.                 BackgroundBrush = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
  98.                 TextFont = Hud.Render.CreateFont("tahoma", 6, 255, 255, 210, 150, false, false, false),
  99.                 TitleFont = Hud.Render.CreateFont("tahoma", 6, 255, 180, 147, 109, false, false, false),
  100.             };
  101.  
  102.             LegendaryGemItemIDs.Add(428348, 3249948847); //Stricken
  103.             LegendaryGemItemIDs.Add(383014, 3248511367); //BotP
  104.             LegendaryGemItemIDs.Add(403456, 3248547304); //BotT
  105.             LegendaryGemItemIDs.Add(403470, 3249805099); //Hoarder
  106.             LegendaryGemItemIDs.Add(428352, 3250847272); //Boyarskys
  107.             LegendaryGemItemIDs.Add(403466, 3249661351); //Enforcer
  108.             LegendaryGemItemIDs.Add(428029, 3249876973); //Esoteric
  109.             LegendaryGemItemIDs.Add(403459, 3248583241); //Ease
  110.             LegendaryGemItemIDs.Add(403461, 3248655115); //Toxin
  111.             LegendaryGemItemIDs.Add(403464, 3248762926); //Gogok
  112.             LegendaryGemItemIDs.Add(428354, 3250883209); //Iceblink
  113.             LegendaryGemItemIDs.Add(403465, 3248798863); //Invigoration
  114.             LegendaryGemItemIDs.Add(403463, 3248726989); //Mirinae
  115.             LegendaryGemItemIDs.Add(428031, 3249912910); //Gizzard
  116.             LegendaryGemItemIDs.Add(403467, 3249697288); //Moratorium
  117.             LegendaryGemItemIDs.Add(428350, 3249984784); //Mutilation
  118.             LegendaryGemItemIDs.Add(403462, 3248691052); //PE
  119.             LegendaryGemItemIDs.Add(454736, 3250919146); //Soul Shard
  120.             LegendaryGemItemIDs.Add(403469, 3249769162); //Simplicitys
  121.             LegendaryGemItemIDs.Add(403471, 3249841036); //Taeguk
  122.             LegendaryGemItemIDs.Add(403460, 3248619178); //WoL
  123.             LegendaryGemItemIDs.Add(403468, 3249733225); //Zeis
  124.  
  125.             XOffset = 0.14f;
  126.             YOffset = 0.012f;
  127.             GapRatio = 0.012f;
  128.  
  129.             DrawGems = true;
  130.             DrawKanai = true;
  131.             DrawSkills = true;
  132.             DrawLegendaryItems = true;
  133.             DrawMetaInformations = true;
  134.  
  135.             ElementOrder = new List<int>(new int[] { 0, 1, 2, 4, 3 });
  136.  
  137.             UpperMeta.Add(new MetaElement(((p) => p.Offense.AttackSpeed.ToString("0.000")), "AS", "Attack Speed"));
  138.             UpperMeta.Add(new MetaElement(((p) => p.Offense.AreaDamageBonus.ToString("F0", CultureInfo.InvariantCulture) + "%"), "AD", "Area Damage"));
  139.             UpperMeta.Add(new MetaElement(((p) => (p.Stats.CooldownReduction * 100).ToString("F2", CultureInfo.InvariantCulture) + "%"), "CDR", "Cooldown reduction"));
  140.             UpperMeta.Add(new MetaElement(((p) => (p.Stats.ResourceCostReduction * 100).ToString("F2", CultureInfo.InvariantCulture) + "%"), "RCR", "Resource cost reduction"));
  141.  
  142.             LowerMeta.Add(new MetaElement(((p) => ValueToString(p.Defense.EhpMax, ValueFormat.ShortNumber)), "EHP", "Effective health pool"));
  143.             LowerMeta.Add(new MetaElement(((p) => ValueToString(p.Defense.LifeRegen, ValueFormat.ShortNumber)), "LPS", "Life per second"));
  144.             LowerMeta.Add(new MetaElement(((p) => ValueToString(p.Stats.PickupRange, ValueFormat.ShortNumber)), "PR", "Pickup range"));
  145.  
  146.  
  147.         }
  148.  
  149.  
  150.  
  151.         public void PaintTopInGame(ClipState clipState)
  152.         {
  153.             if (clipState != ClipState.BeforeClip) return;
  154.             if (Show)
  155.             {
  156.                 var x = Hud.Window.Size.Width * XOffset;
  157.                 currY = Hud.Window.Size.Width * YOffset;
  158.                 gap = Hud.Window.Size.Width * GapRatio;
  159.  
  160.                 foreach (IPlayer player in Hud.Game.Players)
  161.                 {
  162.                     currentX = x;
  163.  
  164.                     foreach (int element in ElementOrder)
  165.                     {
  166.                         switch (element)
  167.                         {
  168.                             case 0:
  169.                                 if (DrawKanai)
  170.                                 {
  171.                                     DrawKanaiItems(player);
  172.                                 }
  173.                                 break;
  174.  
  175.                             case 1:
  176.                                 if (DrawGems)
  177.                                 {
  178.                                     DrawLegendaryGems(player);
  179.                                 }
  180.                                 break;
  181.  
  182.                             case 2:
  183.                                 if (DrawSkills)
  184.                                 {
  185.                                     DrawPlayerSkills(player);
  186.                                 }
  187.                                 break;
  188.                             case 3:
  189.                                 if (DrawLegendaryItems)
  190.                                 {
  191.                                     DrawBuffs(player);
  192.                                 }
  193.                                 break;
  194.                             case 4:
  195.                                 if (DrawMetaInformations)
  196.                                 {
  197.                                     DrawMeta(player);
  198.                                 }
  199.                                 break;
  200.                         }
  201.                     }
  202.  
  203.                 }
  204.             }
  205.         }
  206.  
  207.  
  208.  
  209.         private void DrawMeta(IPlayer player)
  210.         {
  211.             var size = Hud.Window.Size.Width * SkillRatio;
  212.             var xUpper = currentX;
  213.             var yUpper = player.PortraitUiElement.Rectangle.Y + currY - player.PortraitUiElement.Rectangle.Width * 0.1f;
  214.  
  215.             var xLower = currentX;
  216.             var yLower = player.PortraitUiElement.Rectangle.Y + currY + size + player.PortraitUiElement.Rectangle.Width * 0.1f;
  217.  
  218.             var width = Hud.Window.Size.Width * ItemRatio;
  219.             var height = Hud.Window.Size.Width * ItemRatio * 0.8f;
  220.  
  221.  
  222.             foreach (MetaElement element in UpperMeta)
  223.             {
  224.                 LabelDecorator.Paint(xUpper, yUpper, size, size, element.Text(player), element.Title, element.Hint);
  225.                 xUpper += size;
  226.             }
  227.  
  228.             foreach (MetaElement element in LowerMeta)
  229.             {
  230.                 LabelDecorator.Paint(xLower, yLower, size, size, element.Text(player), element.Title, element.Hint);
  231.                 xLower += size;
  232.             }
  233.  
  234.             currentX += Math.Max(LowerMeta.Count, UpperMeta.Count) * size + gap;
  235.         }
  236.  
  237.  
  238.         private void DrawBuffs(IPlayer player)
  239.         {
  240.  
  241.             foreach (IBuff buff in player.Powers.UsedLegendaryPowers.AllLegendaryPowerBuffs().Where(b => b.Active))
  242.             {
  243.  
  244.                 IEnumerable<uint> itemSnos = buff.SnoPower.GetItemSnos();
  245.                 if (itemSnos != null)
  246.                 {
  247.                     var draw = true;
  248.                     if (player.CubeSnoItem1 != null && itemSnos.Contains(player.CubeSnoItem1.Sno)) draw = false;
  249.                     if (player.CubeSnoItem2 != null && itemSnos.Contains(player.CubeSnoItem2.Sno)) draw = false;
  250.                     if (player.CubeSnoItem3 != null && itemSnos.Contains(player.CubeSnoItem3.Sno)) draw = false;
  251.                     if (draw) DrawItem(Hud.Inventory.GetSnoItem(itemSnos.First()), player);
  252.                 }
  253.             }
  254.             currentX += gap;
  255.         }
  256.  
  257.         private void DrawKanaiItems(IPlayer player)
  258.         {
  259.             if (player.CubeSnoItem1 != null) DrawItem(player.CubeSnoItem1, player);
  260.             if (player.CubeSnoItem2 != null) DrawItem(player.CubeSnoItem2, player);
  261.             if (player.CubeSnoItem3 != null) DrawItem(player.CubeSnoItem3, player);
  262.             currentX += gap;
  263.         }
  264.  
  265.         private void DrawItem(ISnoItem snoItem, IPlayer player)
  266.         {
  267.  
  268.  
  269.            
  270.  
  271.             var portraitRect = player.PortraitUiElement.Rectangle;
  272.  
  273.             var itemRect = new System.Drawing.RectangleF(currentX, portraitRect.Y, Hud.Window.Size.Width * ItemRatio, Hud.Window.Size.Width * ItemRatio * 2);
  274.             if (itemRect == null || snoItem == null)
  275.             {
  276.                 return;
  277.             }
  278.             itemRect.Offset(0, currY);
  279.             if (snoItem.ItemHeight == 1)
  280.             {
  281.                 itemRect.Offset(0, currY);
  282.                 itemRect.Height /= 2;
  283.             }
  284.  
  285.             var slotTexture = Hud.Texture.InventorySlotTexture;
  286.             if(slotTexture!=null) slotTexture.Draw(itemRect.X, itemRect.Y, itemRect.Width, itemRect.Height);
  287.  
  288.            
  289.             if (Hud.Window.CursorInsideRect(itemRect.X, itemRect.Y, itemRect.Width, itemRect.Height))
  290.             {
  291.                 var itemName = snoItem.NameLocalized ?? "" ;
  292.  
  293.                 var power = snoItem.LegendaryPower;
  294.                 var powerDesc = "";
  295.                 if (power != null)
  296.                 {
  297.                     itemName += "\n\n";
  298.                     powerDesc = power.DescriptionLocalized ?? "";
  299.                    
  300.                     var patternBegin = powerDesc.IndexOf("{c_magic}");
  301.                     if (patternBegin != -1)
  302.                     {
  303.                         var patternEnd = powerDesc.IndexOf("{/c}") != -1 ? powerDesc.IndexOf("{/c}") + 4 : powerDesc.IndexOf("{/c_magic}") + 10;
  304.                         if (patternEnd != -1)
  305.                         {
  306.                             var toReplace = powerDesc.Substring(patternBegin, patternEnd - patternBegin);
  307.                             var replacement = toReplace.Contains("%") ? "X%" : "X";
  308.                             powerDesc = powerDesc.Replace(toReplace, replacement);
  309.                         }
  310.                     }
  311.                    
  312.                 }
  313.  
  314.                 Hud.Render.SetHint(itemName + powerDesc);
  315.             }
  316.  
  317.             var backgroundTexture = snoItem.ItemHeight == 2 ? Hud.Texture.InventoryLegendaryBackgroundLarge : Hud.Texture.InventoryLegendaryBackgroundSmall;
  318.             if(backgroundTexture!=null) backgroundTexture.Draw(itemRect.X, itemRect.Y, itemRect.Width, itemRect.Height);
  319.  
  320.             var itemTexture = Hud.Texture.GetItemTexture(snoItem);
  321.             if (itemTexture != null)
  322.             {
  323.                itemTexture.Draw(itemRect.X, itemRect.Y, itemRect.Width, itemRect.Height);
  324.             }
  325.             currentX += itemRect.Width;
  326.         }
  327.  
  328.  
  329.         private void DrawLegendaryGems(IPlayer player)
  330.         {
  331.             IEnumerable<IBuff> gemBuffs = player.Powers.UsedLegendaryGems.AllGemPrimaryBuffs().Where(b => b.Active);
  332.             var size = Hud.Window.Size.Width * GemRatio;
  333.             var portraitRect = player.PortraitUiElement.Rectangle;
  334.             var index = 0;
  335.  
  336.             foreach (IBuff buff in gemBuffs)
  337.             {
  338.                 if (index == 3)
  339.                 {
  340.                     currentX += size;
  341.                     index = 0;
  342.                 }
  343.  
  344.                 var y = portraitRect.Y + currY + size * index;
  345.  
  346.                 var rect = new RectangleF(currentX, y, size, size);
  347.  
  348.                 var texture = Hud.Texture.GetItemTexture(Hud.Inventory.GetSnoItem(LegendaryGemItemIDs[buff.SnoPower.Sno]));
  349.  
  350.                 if (Hud.Window.CursorInsideRect(rect.X, rect.Y, rect.Width, rect.Height))
  351.                 {
  352.                     Hud.Render.SetHint(buff.SnoPower.NameLocalized);
  353.                 }
  354.  
  355.                 if (texture != null)
  356.                 {
  357.                     texture.Draw(rect.X, rect.Y, rect.Width, rect.Height);
  358.                 }
  359.  
  360.                 index++;
  361.             }
  362.             currentX += size + gap;
  363.         }
  364.  
  365.  
  366.         private void DrawPlayerSkills(IPlayer player)
  367.         {
  368.             var size = Hud.Window.Size.Width * SkillRatio;
  369.             var portraitRect = player.PortraitUiElement.Rectangle;
  370.             var index = 0;
  371.             var passivesX = currentX;
  372.             foreach (int i in new int[] { 2, 3, 4, 5, 0, 1 })
  373.             {
  374.                 var skill = player.Powers.SkillSlots[i];
  375.                 if (skill != null)
  376.                 {
  377.                     index = skill.Key <= ActionKey.RightSkill ? (int)skill.Key + 4 : (int)skill.Key - 2;
  378.  
  379.                     var y = portraitRect.Y + currY - portraitRect.Width * 0.1f;
  380.  
  381.                     var rect = new RectangleF(currentX, y, size, size);
  382.  
  383.                     SkillPainter.Paint(skill, rect);
  384.  
  385.                     if (Hud.Window.CursorInsideRect(rect.X, rect.Y, rect.Width, rect.Height))
  386.                     {
  387.                         Hud.Render.SetHint(skill.RuneNameLocalized);
  388.                     }
  389.  
  390.                 }
  391.                 currentX += size;
  392.             }
  393.  
  394.             index = 0;
  395.             var powers = getPowers(player);
  396.             foreach (var skill in powers)
  397.             {
  398.                 if (skill != null)
  399.                 {
  400.                     var y = portraitRect.Y + currY + size + portraitRect.Width * 0.1f;
  401.  
  402.                     var rect = new RectangleF(passivesX, y, size, size);
  403.  
  404.                     var texture = skill.NormalIconTextureId > 0
  405.                         ? Hud.Texture.GetTexture(skill.NormalIconTextureId)
  406.                         : Hud.Texture.EmptySocketTexture;
  407.                     texture.Draw(rect.X, rect.Y, rect.Width, rect.Height);
  408.  
  409.                     if (Hud.Window.CursorInsideRect(rect.X, rect.Y, rect.Width, rect.Height))
  410.                     {
  411.                         Hud.Render.SetHint(skill.NameLocalized);
  412.                     }
  413.                 }
  414.                 passivesX += powers.Count > 4 ? size * 1.222222f : size * 1.666666f;
  415.                 index++;
  416.             }
  417.             currentX += gap;
  418.         }
  419.  
  420.         public void OnKeyEvent(IKeyEvent keyEvent)
  421.         {
  422.             if (keyEvent.IsPressed && ToggleKeyEvent.Matches(keyEvent))
  423.             {
  424.                 Show = !Show;
  425.                 if (Show) testme(Hud.Game.Me);
  426.             }
  427.         }
  428.  
  429.         void testme(IPlayer player)
  430.         {
  431.             System.Text.StringBuilder builder = new System.Text.StringBuilder().AppendLine();
  432.  
  433.             builder.Append("ALL").AppendLine();
  434.             foreach (var buff in player.Powers.AllBuffs)
  435.             {
  436.                 builder
  437.                     .AppendFormat(" {0,-5}", buff.Active)
  438.                     .AppendFormat(" T={0,-10}", buff.SnoPower.NormalIconTextureId)
  439.                     .AppendFormat(" {0,-6}", buff.SnoPower.Sno)
  440.                     .AppendFormat(" {0,-35}", buff.SnoPower.Code)
  441.                     .AppendFormat(" {0}", buff.SnoPower.DescriptionEnglish)
  442.                     .AppendLine();
  443.             }
  444.             builder.Append("USED PASSIVES").AppendLine();
  445.             foreach (var power in player.Powers.UsedPassives)
  446.             {
  447.                 builder
  448.                     .AppendFormat(" {0,-5}", "-")
  449.                     .AppendFormat(" T={0,-10}", power.NormalIconTextureId)
  450.                     .AppendFormat(" {0,-6}", power.Sno)
  451.                     .AppendFormat(" {0,-35}", power.Code)
  452.                     .AppendFormat(" {0}", power.DescriptionEnglish)
  453.                     .AppendLine();
  454.             }
  455.             var items = Hud.Game.Items.Where(x => x.Location >= ItemLocation.LeftRing && x.Location <= ItemLocation.Neck).ToList();
  456.             IItem hellfire = null;
  457.             builder.Append("ITEMS").AppendLine();
  458.             foreach (IItem item in items)
  459.             {
  460.                 if (item.SnoItem.Sno == 761548935) hellfire = item;
  461.                 builder
  462.                     .AppendFormat(" {0,-9}", item.Location)
  463.                     .AppendFormat(" {0,-10}", item.SnoItem.Sno)
  464.                     .AppendFormat(" {0,-25}", item.SnoItem.Code)
  465.                     .AppendFormat(" {0,-25}", item.SnoItem.NameEnglish)
  466.                     .Append(" SOCKET:");
  467.                 foreach (var socketed in item.ItemsInSocket)
  468.                 {
  469.                     builder
  470.                         .AppendFormat(" {0,-6}", socketed.SnoItem.Sno)
  471.                         .AppendFormat(" {0}", socketed.SnoItem.Code)
  472.                         ;
  473.                 }
  474.                 builder.AppendLine();
  475.             }
  476.             if (hellfire != null)
  477.             {
  478.                 builder.Append("HELLFIRE").AppendLine();
  479.                 var perfection = hellfire.Perfections?.FirstOrDefault(x => x.Attribute.Code == "Item_Power_Passive");
  480.                 if (perfection != null)
  481.                 {
  482.                     ISnoPower power = Hud.Sno.GetSnoPower(perfection.Modifier);
  483.                     if (power != null)
  484.                     {
  485.                         builder
  486.                             .AppendFormat(" {0,-6}", power.Sno)
  487.                             .AppendFormat(" T={0,-10}", power.NormalIconTextureId)
  488.                             .AppendFormat(" {0}", power.DescriptionEnglish)
  489.                             .AppendLine()
  490.                             ;
  491.                         if (power.NormalIconTextureId == 0)
  492.                         {
  493.                             // My Hellfire Amulet has CombinationStrike passive but it is not in UsedMonkPowers!
  494.                             ISnoPower monkPower = player.Powers.UsedMonkPowers.CombinationStrike;
  495.                             if (monkPower != null)
  496.                             {
  497.                                 builder
  498.                                     .AppendFormat(" {0,-6}", monkPower.Sno)
  499.                                     .AppendFormat(" T={0,-10}", monkPower.NormalIconTextureId)
  500.                                     .AppendFormat(" {0}", monkPower.DescriptionEnglish)
  501.                                     .AppendLine()
  502.                                     ;
  503.                             }
  504.                             else
  505.                             {
  506.                                 builder.Append("UsedMonkPowers.CombinationStrike == NULL").AppendLine();
  507.                             }
  508.                             // SeizeTheInitiative is used and can be found in UsedMonkPowers!
  509.                             monkPower = player.Powers.UsedMonkPowers.SeizeTheInitiative;
  510.                             if (monkPower != null)
  511.                             {
  512.                                 builder
  513.                                     .AppendFormat(" {0,-6}", monkPower.Sno)
  514.                                     .AppendFormat(" T={0,-10}", monkPower.NormalIconTextureId)
  515.                                     .AppendFormat(" {0}", monkPower.DescriptionEnglish)
  516.                                     .AppendLine()
  517.                                     ;
  518.                             }
  519.                             else
  520.                             {
  521.                                 builder.Append("UsedMonkPowers.SeizeTheInitiative == NULL").AppendLine();
  522.                             }
  523.                         }
  524.                     }
  525.                 }
  526.             }
  527.             Hud.Debug(builder.ToString());
  528.         }
  529.  
  530.         List<ISnoPower> getPowers(IPlayer player)
  531.         {
  532.             List<ISnoPower> powers = player.Powers.UsedPassives.ToList();
  533.             var hellfire = Hud.Game.Items.FirstOrDefault(x => (x.Location >= ItemLocation.LeftRing && x.Location <= ItemLocation.Neck) && x.SnoItem.Sno == 761548935);
  534.             if (hellfire != null)
  535.             {
  536.                 var perfection = hellfire.Perfections?.FirstOrDefault(x => x.Attribute.Code == "Item_Power_Passive");
  537.                 if (perfection != null)
  538.                 {
  539.                     ISnoPower power = Hud.Sno.GetSnoPower(perfection.Modifier);
  540.                     if (power != null)
  541.                     {
  542.                         powers.Add(power);
  543.                     }
  544.                 }
  545.             }
  546.             return powers;
  547.         }
  548.     }
  549. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement