Advertisement
s4000

DAV_UsefulCubeItems

Nov 12th, 2020
1,178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using Turbo.Plugins.Default;
  4.  
  5. namespace Turbo.Plugins.DAV
  6. {
  7.     public class DAV_UsefulCubeItems : BasePlugin, IInGameTopPainter {
  8.         public bool BiLanguage { get; set; } = false; // also add NameEnglish for item Sno if TRUE
  9.         public IFont TextFont { get; set; }
  10.         public IBrush DefaultBrush { get; set; }
  11.         public Dictionary<string, IBrush> HighLightBrushs { get; set; } = new Dictionary<string, IBrush>();
  12.  
  13.         private IUiElement cubeSlot { get; set; }
  14.         private List<IUiElement> CubeSlots { get; set; }
  15.         private Dictionary<string, string> [] HighLightItems{ get; set; } = new Dictionary<string, string> [7];
  16.  
  17.         public DAV_UsefulCubeItems() {
  18.             Enabled = true;
  19.             for (var i = 0; i < 7; i++)
  20.                 HighLightItems[i] = new Dictionary<string, string> ();
  21.         }
  22.  
  23.         public void PaintTopInGame(ClipState clipState) {
  24.             if (clipState != ClipState.Inventory) return;
  25.             if (!cubeSlot.Visible) return;
  26.  
  27.             var myList = HighLightItems[(int) Hud.Game.Me.HeroClassDefinition.HeroClass];
  28.             foreach (var Slot in CubeSlots) {
  29.                 if (Slot == null || !Slot.Visible) continue;
  30.  
  31.                 var itemName = Slot.ReadText(System.Text.Encoding.UTF8, true);
  32.                 if (string.IsNullOrEmpty(itemName)) continue;
  33.  
  34.                 if (myList.TryGetValue(itemName, out var profileN)) {
  35.                     var usedBrush = HighLightBrushs.ContainsKey(profileN) ? HighLightBrushs[profileN] : DefaultBrush;
  36.                     usedBrush.DrawRectangle(Slot.Rectangle);
  37.                     TextFont.DrawText(profileN, Slot.Rectangle.X + 4, Slot.Rectangle.Y + 2);
  38.                 }
  39.             }
  40.         }
  41.  
  42.         public override void Load(IController hud) {
  43.             base.Load(hud);
  44.  
  45.             TextFont = Hud.Render.CreateFont("Arial", 8, 255, 225, 255, 102, true, false, true);
  46.             DefaultBrush = Hud.Render.CreateBrush(255, 255, 255, 51, 4f);
  47.             HighLightBrushs.Add("Uliana", Hud.Render.CreateBrush(255, 255, 128, 51, 4f));
  48.             HighLightBrushs.Add("ZDPS", Hud.Render.CreateBrush(255, 51, 255, 51, 4f, SharpDX.Direct2D1.DashStyle.DashDot));
  49.  
  50.         // Common Gears
  51.             AddUsefulCubeItem("ZDPS", 3107424000, HeroClass.Barbarian); // 核眼之戒 Oculus Ring
  52.             AddUsefulCubeItem("ZDPS", 3107424000, HeroClass.Monk); // 核眼之戒 Oculus Ring
  53.             AddUsefulCubeItem("ZDPS", 923327011, HeroClass.Monk); // 強橫護腕 Strongarm Bracers
  54.             AddUsefulCubeItem("ZDPS", 595616090, HeroClass.None); // 劊子手 The Executioner
  55.             AddUsefulCubeItem("ZDPS", 595616121, HeroClass.None); // 梅希斯密特之劫掠者 Messerschmidt's Reaver
  56.             AddUsefulCubeItem("General", 962426467, HeroClass.None); // 死敵護腕 Nemesis Bracers
  57.             AddUsefulCubeItem("General", 3145373733, HeroClass.None); // 皇家華戒 Ring of Royal Grandeur
  58.             AddUsefulCubeItem("General", 1979309080, HeroClass.None); // 虛幻長靴 Illusory Boots
  59.             AddUsefulCubeItem("Speed", 1771898421, HeroClass.None); // 黃金裹腰 Goldwrap
  60.             AddUsefulCubeItem("Speed", 3145409670, HeroClass.None); // 貪婪指環 Avarice Band
  61.  
  62.         // Monk
  63.             AddUsefulCubeItem("General", 446651865, HeroClass.Monk); // 翔龍 Flying Dragon
  64.             AddUsefulCubeItem("Uliana", 4061835217, HeroClass.Monk); // 猛獅之爪 Lion's Claw
  65.             AddUsefulCubeItem("Uliana", 400756501, HeroClass.Monk); // 失蹤者的羈絆 Binding of the Lost
  66.             AddUsefulCubeItem("Uliana", 1935108657, HeroClass.Monk); // 狂石 Madstone
  67.             AddUsefulCubeItem("Uliana", 1861699992, HeroClass.Monk); // 弓術護腕 Gungdo Gear
  68.             AddUsefulCubeItem("Uliana", 1484349569, HeroClass.Monk); // 永恆之悟 The Flow of Eternity
  69.             AddUsefulCubeItem("Uliana", 3074252290, HeroClass.Monk); // 厄圖拉斯之拳 The Fist of Az'Turrasq
  70.  
  71.             cubeSlot = Hud.Render.GetUiElement("Root.NormalLayer.Kanais_Collection");
  72.             CubeSlots = new List<IUiElement> {
  73.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow0._item0.ItemPowerTitle", cubeSlot, null),
  74.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow0._item1.ItemPowerTitle", cubeSlot, null),
  75.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow0._item2.ItemPowerTitle", cubeSlot, null),
  76.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow1._item4.ItemPowerTitle", cubeSlot, null),
  77.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow1._item5.ItemPowerTitle", cubeSlot, null),
  78.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow1._item6.ItemPowerTitle", cubeSlot, null),
  79.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow2._item8.ItemPowerTitle", cubeSlot, null),
  80.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow2._item9.ItemPowerTitle", cubeSlot, null),
  81.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow2._item10.ItemPowerTitle", cubeSlot, null),
  82.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow3._item12.ItemPowerTitle", cubeSlot, null),
  83.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow3._item13.ItemPowerTitle", cubeSlot, null),
  84.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow3._item14.ItemPowerTitle", cubeSlot, null),
  85.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow4._item16.ItemPowerTitle", cubeSlot, null),
  86.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow4._item17.ItemPowerTitle", cubeSlot, null),
  87.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow4._item18.ItemPowerTitle", cubeSlot, null),
  88.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow5._item20.ItemPowerTitle", cubeSlot, null),
  89.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow5._item21.ItemPowerTitle", cubeSlot, null),
  90.                 Hud.Render.RegisterUiElement("Root.NormalLayer.Kanais_Collection.LayoutRoot.Kanais_Power_Select.Kanais_Collection_Powers.CollectionList._content._stackpanel._tilerow5._item22.ItemPowerTitle", cubeSlot, null),
  91.             };
  92.         }
  93.  
  94.         public void AddUsefulCubeItem(string buildName, string itemName, HeroClass myHero = HeroClass.None) {
  95.             if (myHero == HeroClass.None) {
  96.                 for (var i = 0; i < 7; i++)
  97.                     HighLightItems[i].Add(itemName, buildName);
  98.             }
  99.             else HighLightItems[(int) myHero].Add(itemName, buildName);
  100.         }
  101.  
  102.         public void AddUsefulCubeItem(string buildName, uint itemSno, HeroClass myHero = HeroClass.None) {
  103.             var usefulItem = Hud.Inventory.GetSnoItem(itemSno);
  104.             if (usefulItem != null) {
  105.                 AddUsefulCubeItem(buildName, usefulItem.NameLocalized, myHero);
  106.                 if (BiLanguage)
  107.                     AddUsefulCubeItem(buildName, usefulItem.NameEnglish, myHero);
  108.             }
  109.         }
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement