EzPlugins

RepairAndSalvagePlugin

Nov 16th, 2024 (edited)
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 18.36 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System;
  3. using System.Text;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Windows.Forms;
  7. using SharpDX.DirectInput;
  8. using System.Runtime.InteropServices;
  9. using System.Text.RegularExpressions;
  10. using System.Drawing;
  11. using System.Threading;
  12.  
  13. namespace Turbo.Plugins.Ez
  14. {
  15.     public class RepairAndSalvagePlugin : BasePlugin, IKeyEventHandler, IInGameTopPainter
  16.     {
  17.         public bool Debug { get; set; } = false;
  18.  
  19.         private static IntPtr D3Hwnd = IntPtr.Zero;
  20.  
  21.         [DllImport("USER32.DLL")]
  22.         private static extern IntPtr FindWindow(string ClassName, string WindowText);
  23.  
  24.         [DllImport("USER32.DLL")]
  25.         private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
  26.  
  27.         [DllImport("user32.dll")]
  28.         public static extern bool SetCursorPos(int x, int y);
  29.         [DllImport("user32.dll")]
  30.         public static extern bool GetCursorPos(out Point point);
  31.  
  32.         [DllImport("user32.dll")]
  33.         private static extern void mouse_event(uint dwFlags, int dx, int dy, uint dwData, IntPtr dwExtraInfo);
  34.  
  35.         public static void SendPressKey(Keys key)
  36.         {
  37.             SendMessage(D3Hwnd, 256U, (IntPtr)((int)key), IntPtr.Zero);
  38.             SendMessage(D3Hwnd, 257U, (IntPtr)((int)key), IntPtr.Zero);
  39.         }
  40.  
  41.         public void mouseLClickUiE(IUiElement uie)  // D3Hwnd
  42.         {
  43.             if (uie.Visible)
  44.             {
  45.                 var x = (int) (uie.Rectangle.X + uie.Rectangle.Width/2.0f);
  46.                 var y = (int) (uie.Rectangle.Y + uie.Rectangle.Height/2.0f);
  47.                 IntPtr lParam = (IntPtr)(y << 16 | (x & 65535));
  48.                 SendMessage(D3Hwnd, 513U, (IntPtr)1, lParam);
  49.                 SendMessage(D3Hwnd, 514U, (IntPtr)1, lParam);
  50.             }
  51.         }
  52.  
  53.         public bool mouseLClickItemInventory(IItem item)
  54.         {
  55.             var rect = Hud.Inventory.GetItemRect(item);
  56.             if (rect != System.Drawing.RectangleF.Empty)
  57.             {
  58.                 var x = (int) (rect.X + rect.Width/2.0f + Hud.Window.Offset.X);
  59.                 var y = (int) (rect.Y + rect.Height/2.0f + Hud.Window.Offset.Y);
  60.                 SetCursorPos(x, y);
  61.                 Thread.Sleep(1);
  62.                 GetCursorPos(out var point);
  63.                 if (point.X == x && point.Y == y) { mouse_event(6U, 0, 0, 0U, IntPtr.Zero); } // It largely eliminates the inconvenience of moving the mouse while processing items
  64.                 else return false;
  65.             }
  66.             return true;
  67.         }
  68.  
  69.         protected IUiElement VENDOR_MAIN;
  70.         protected IUiElement VENDOR_REPAIRALL;
  71.  
  72.         protected IUiElement VENDOR_TAB_0;
  73.         protected IUiElement VENDOR_TAB_1;
  74.         protected IUiElement VENDOR_TAB_2;
  75.         protected IUiElement VENDOR_TAB_3;
  76.         protected IUiElement VENDOR_TAB_4;
  77.  
  78.         protected IUiElement VENDOR_DIALOG_0;
  79.         protected IUiElement VENDOR_DIALOG_1;
  80.         protected IUiElement VENDOR_DIALOG_2;
  81.         protected IUiElement VENDOR_DIALOG_3;
  82.         protected IUiElement VENDOR_DIALOG_4;
  83.  
  84.         protected IUiElement Salvage_Normal_Button;
  85.         protected IUiElement Salvage_Magic_Button;
  86.         protected IUiElement Salvage_Rare_Button;
  87.         protected IUiElement SalvageOneButton;
  88.         protected IUiElement SalvageAuxButton;
  89.         protected IUiElement Chat_Editline;
  90.  
  91.         protected IUiElement Button_OK;
  92.  
  93.         private SharpDX.DirectWrite.TextLayout layout { get; set; } = null;
  94.         private List<IItem> ItemsToSalvage { get; set; } =  new List<IItem>();
  95.         private int[] dataNMR { get; set; }
  96.         private bool ActionOn { get; set; } = false;
  97.         private long msLapseAction { get; set; } = 0;
  98.         private long msLapseActionOk { get; set; } = 0;
  99.         private bool mRepair { get; set; } = false;
  100.         private bool mSalvage { get; set; } = false;
  101.         private bool waitButtonOk { get; set; } = false;
  102.         private bool mCollect { get; set; } = false;
  103.         private bool StopNow { get; set; } = false;
  104.         private Point PointMousePos { get; set; }
  105.  
  106.         private bool _doRepairSalvage  { get; set; } = false;
  107.  
  108.         private bool doRepairSalvage
  109.         {
  110.             get { return _doRepairSalvage; }
  111.             set
  112.             {
  113.                 if (_doRepairSalvage != value)
  114.                 {
  115.                     if (value == true)
  116.                     {
  117.                         ActionOn = true;
  118.                         waitButtonOk = false;
  119.                         mRepair = false;
  120.                         mSalvage = false;
  121.                         mCollect = true;
  122.                         StopNow = false;
  123.                         ItemsToSalvage.Clear();
  124.                         GetCursorPos(out var point);
  125.                         PointMousePos = point;
  126.                     }
  127.                     else if (RestoreMousePointer)
  128.                     {
  129.                         SetCursorPos(PointMousePos.X, PointMousePos.Y);
  130.                     }
  131.                     if (Chat_Editline.Visible)  SendPressKey(Keys.Enter);
  132.                     _doRepairSalvage = value;
  133.                 }
  134.             }
  135.         }
  136.  
  137.         private bool _LMod_SalvagePlugin_Disable { get; set; } = false;
  138.  
  139.         public bool LMod_SalvagePlugin_Disable
  140.         {
  141.             get { return _LMod_SalvagePlugin_Disable; }
  142.             set
  143.             {
  144.                 if (Enabled)
  145.                 {
  146.                     _LMod_SalvagePlugin_Disable = value;
  147.                     if (_LMod_SalvagePlugin_Disable)
  148.                     {
  149.                         var pl = Hud.AllPlugins.FirstOrDefault(p => p.GetType().FullName == "Turbo.Plugins.LightningMod.SalvagePlugin");
  150.                         if (pl != null && pl.Enabled)
  151.                         {
  152.                             pl.Enabled = false;
  153.                         }
  154.                     }
  155.                 }
  156.             }
  157.         }
  158.  
  159.         public IBrush ItemHighlightBrush { get; set; }
  160.         public IFont InfoFont { get; set; }
  161.  
  162.         public IKeyEvent ToggleKeyEvent { get; set; }
  163.         public long msLapseMin { get; set; } = 10;
  164.         public long msLapseAnvilEnable { get; set; } = 150;
  165.         public long msLapseAnvilDisable { get; set; } = 150;
  166.         public long msLapseWaitButtonOk { get; set; } = 350;
  167.  
  168.         public bool saveItemPrimal { get; set; }
  169.         public bool saveItemAncient { get; set; }
  170.         public string TextAvailable { get; set; }
  171.         public string TextNotAvailable { get; set; }
  172.         public bool ConfirmWihtEnterKey { get; set; }
  173.         public bool IgnoreInventoryLockArea { get; set; }
  174.         public bool RestoreMousePointer { get; set; }
  175.         public Dictionary<ISnoItem, int> WhiteList { get; set; } = new Dictionary<ISnoItem, int>();
  176.  
  177.         public RepairAndSalvagePlugin()
  178.         {
  179.             Enabled = true;
  180.         }
  181.  
  182.         public override void Load(IController hud)
  183.         {
  184.             base.Load(hud);
  185.  
  186.             TextAvailable = "Repair&Salvage: Press {0} to Start"; // {0} => Hotkey
  187.             TextNotAvailable = "Repair&Salvage: unavailable, lock area missing";
  188.             saveItemPrimal = true;              // Keep primal items , not salvage
  189.             saveItemAncient = false;            // Keep Ancient items , not salvage
  190.             ConfirmWihtEnterKey = false;        // Use Key Enter or Mouse Virtual for dialog confirmation
  191.             ToggleKeyEvent = Hud.Input.CreateKeyEvent(true, Key.F3, controlPressed: false, altPressed: false, shiftPressed: false); // Hotkey
  192.             IgnoreInventoryLockArea = false;    // If false -> Lock area required in the inventory. If true -> Ignore if you have defined (or not) a lock area in the inventory.
  193.             RestoreMousePointer = true;         // Restore to original position.
  194.  
  195.             VENDOR_MAIN = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage", null, null);
  196.             VENDOR_REPAIRALL = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.repair_dialog.RepairAll", VENDOR_DIALOG_3, null);
  197.  
  198.             VENDOR_TAB_0 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.tab_0", VENDOR_MAIN, null);
  199.             VENDOR_TAB_1 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.tab_1", VENDOR_MAIN, null);
  200.             VENDOR_TAB_2 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.tab_2", VENDOR_MAIN, null);
  201.             VENDOR_TAB_3 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.tab_3", VENDOR_MAIN, null);
  202.             VENDOR_TAB_4 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.tab_4", VENDOR_MAIN, null);
  203.  
  204.             VENDOR_DIALOG_0 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.craftweapons_dialog", VENDOR_MAIN, null);
  205.             VENDOR_DIALOG_1 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.craftarmor_dialog", VENDOR_MAIN, null);
  206.             VENDOR_DIALOG_2 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.salvage_dialog", VENDOR_MAIN, null);
  207.             VENDOR_DIALOG_3 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.repair_dialog", VENDOR_MAIN, null);
  208.             VENDOR_DIALOG_4 = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.training_dialog", VENDOR_MAIN, null);
  209.  
  210.             Salvage_Normal_Button = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.salvage_dialog.salvage_all_wrapper.salvage_normal_button", VENDOR_DIALOG_2, null);
  211.             Salvage_Magic_Button = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.salvage_dialog.salvage_all_wrapper.salvage_magic_button", VENDOR_DIALOG_2, null);
  212.             Salvage_Rare_Button = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.salvage_dialog.salvage_all_wrapper.salvage_rare_button", VENDOR_DIALOG_2, null);
  213.             SalvageOneButton = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.salvage_dialog.salvage_all_wrapper.salvage_button", VENDOR_DIALOG_2, null);
  214.             SalvageAuxButton = Hud.Render.RegisterUiElement("Root.NormalLayer.vendor_dialog_mainPage.salvage_dialog.salvage_button", VENDOR_DIALOG_2, null);
  215.  
  216.             Button_OK = Hud.Render.RegisterUiElement("Root.TopLayer.confirmation.subdlg.stack.wrap.button_ok", null, null);
  217.  
  218.             Chat_Editline = Hud.Render.RegisterUiElement("Root.NormalLayer.chatentry_dialog_backgroundScreen.chatentry_content.chat_editline", null, null);
  219.  
  220.             ItemHighlightBrush = Hud.Render.CreateBrush(255, 200, 200, 100, -1.6f);
  221.             InfoFont = Hud.Render.CreateFont("tahoma", 8, 255, 200, 200, 0, true, false, 255, 0, 0, 0, true);
  222.  
  223.             D3Hwnd = FindWindow("D3 Main Window Class", null); // D3Hwnd = FindWindow(null, "Diablo III");
  224.  
  225.         }
  226.  
  227.         public void OnKeyEvent(IKeyEvent keyEvent)
  228.         {
  229.             if (keyEvent.IsPressed && ToggleKeyEvent.Matches(keyEvent))
  230.             {
  231.                 if (Hud.Game.IsInTown)
  232.                 {
  233.                     if (IgnoreInventoryLockArea || (Hud.Inventory.InventoryLockArea.Width > 0 && Hud.Inventory.InventoryLockArea.Height > 0))
  234.                     {
  235.                         if (VENDOR_MAIN.Visible && VENDOR_TAB_4.Visible)
  236.                         {
  237.                             if (!doRepairSalvage)
  238.                                 doRepairSalvage = true;
  239.                             else
  240.                                 StopNow = true;
  241.                         }
  242.                     }
  243.                 }
  244.             }
  245.         }
  246.  
  247.         private List<IItem> GetItemsToSalvage() // Function to decide which items to salvage
  248.         {
  249.             var result = new List<IItem>();
  250.             var items = Hud.Inventory.ItemsInInventory.Where(i => (i.SnoItem.Kind == ItemKind.loot || i.SnoItem.Kind == ItemKind.potion) && !i.VendorBought && i.ItemsInSocket == null);
  251.             foreach (var item in items)
  252.             {
  253.                 var transmogStat = item.StatList.FirstOrDefault(s => s.Id == "TransmogGBID#1048575");
  254.                 if (transmogStat != null && transmogStat.DoubleValue != -1) continue;  // -1 when undo transmog
  255.                 if (item.IsNormal || item.IsMagic || item.IsRare)
  256.                 {
  257.                     if ( !item.AccountBound && (Hud.Game.Me.CurrentLevelNormal == 70 || IgnoreInventoryLockArea || !item.IsInventoryLocked) )
  258.                         result.Add(item);
  259.                 }
  260.                 else if
  261.                 (
  262.                         (IgnoreInventoryLockArea || !item.IsInventoryLocked)
  263.                     &&  item.EnchantedAffixCounter == 0 && item.Quantity <= 1 && Hud.Game.Me.ArmorySets.FirstOrDefault(armorySet => armorySet?.ContainsItem(item) == true) == null // Not in Armory
  264.                     &&  (!saveItemPrimal || item.AncientRank != 2) && (!saveItemAncient || item.AncientRank != 1)
  265.                     &&  (item.SnoItem.MainGroupCode != "riftkeystone") && (item.SnoItem.MainGroupCode != "horadriccache") && (item.SnoItem.MainGroupCode != "-") && (item.SnoItem.MainGroupCode != "pony")
  266.                     &&  (item.SnoItem.MainGroupCode != "plans") && !item.SnoItem.MainGroupCode.Contains("cosmetic") && (item.SnoItem.MainGroupCode != "gems_unique") // never salvage Whisper of Atonement
  267.                     &&  (item.SnoItem.NameEnglish != "Staff of Herding") && (item.SnoItem.NameEnglish != "Hellforge Ember")
  268.                     &&  (!item.SnoItem.Code.StartsWith("P72_Soulshard") || item.JewelRank <= 0) // only salvage non-upgraded Soulshard
  269.                     &&  (!WhiteList.TryGetValue(item.SnoItem, out var rank) || item.AncientRank < rank) // White List
  270.                 )
  271.                     result.Add(item);
  272.             }
  273.             result.Sort((a, b) =>
  274.             {
  275.                 var r = a.InventoryX.CompareTo(b.InventoryX);
  276.                 if (r == 0) r = a.InventoryY.CompareTo(b.InventoryY);
  277.                 return r;
  278.             });
  279.             return result;
  280.         }
  281.  
  282.         public void PaintTopInGame(ClipState clipState)
  283.         {
  284.             if (clipState != ClipState.Inventory) return;
  285.             if (!Hud.Game.IsInGame || !Hud.Game.IsInTown || !Hud.Inventory.InventoryMainUiElement.Visible) return;
  286.             if (VENDOR_MAIN.Visible && VENDOR_TAB_4.Visible)    //BlackSmith (Jeweler and Mystic 3 Tabs, cube 0 Tabs)       //Tabs active 16-13-37-34-73        // (+-1) => Values for non-active tab (mouse over or not)
  287.             {
  288.                 layout = InfoFont.GetTextLayout( (IgnoreInventoryLockArea || (Hud.Inventory.InventoryLockArea.Width > 0 && Hud.Inventory.InventoryLockArea.Height > 0)) ? String.Format(TextAvailable, ToggleKeyEvent.ToString()) : TextNotAvailable );
  289.                 InfoFont.DrawText(layout, VENDOR_MAIN.Rectangle.X + (VENDOR_MAIN.Rectangle.Width * 0.04f), VENDOR_MAIN.Rectangle.X + (VENDOR_MAIN.Rectangle.Height * 0.088f));
  290.  
  291.                 var ItemsToSalvagePaint = GetItemsToSalvage();
  292.                 foreach (var item in ItemsToSalvagePaint)
  293.                 {
  294.                     var itemRect = Hud.Inventory.GetItemRect(item);
  295.                     ItemHighlightBrush.DrawRectangle(itemRect);
  296.                 }
  297.  
  298.                 if (doRepairSalvage && Hud.Game.Me.AnimationState == AcdAnimationState.Idle)
  299.                 {
  300.                     if (Hud.Game.CurrentRealTimeMilliseconds > msLapseAction)
  301.                     {
  302.                         if (Button_OK.Visible)
  303.                         {
  304.                             if (Button_OK.AnimState != 35)          // Minimizing improper press hits of the Accept button
  305.                             {
  306.                                 msLapseAction = Hud.Game.CurrentRealTimeMilliseconds + msLapseMin;
  307.                                 if (ConfirmWihtEnterKey)            // use Enter Key
  308.                                     SendPressKey(Keys.Enter);
  309.                                 else                                // or use Virtual Mouse
  310.                                     mouseLClickUiE(Button_OK);
  311.                                 waitButtonOk = false;
  312.                             }
  313.                         }
  314.                         else if (waitButtonOk)
  315.                         {
  316.                             if (Hud.Game.CurrentRealTimeMilliseconds > msLapseActionOk)
  317.                             {
  318.                                 waitButtonOk = false;
  319.                             }
  320.                         }
  321.                         else
  322.                         {
  323.                             msLapseAction = Hud.Game.CurrentRealTimeMilliseconds + msLapseMin;
  324.                             if (VENDOR_DIALOG_3.Visible) // Repair
  325.                             {
  326.                                 if (!mRepair)
  327.                                 {
  328.                                     if (VENDOR_REPAIRALL.Visible)
  329.                                     {
  330.                                         var match = Regex.Match(VENDOR_REPAIRALL.ReadText(Encoding.UTF8, true), @"([0-9]+)"); // @"([0-9]+([\.,][0-9]+)*)" for complete number ?
  331.                                         if (match.Success && match.Groups[1].Value != "0")
  332.                                         {
  333.                                             mouseLClickUiE(VENDOR_REPAIRALL);
  334.                                         }
  335.                                         else
  336.                                         {
  337.                                             mRepair = true;
  338.                                             mouseLClickUiE(VENDOR_TAB_2);
  339.                                         }
  340.                                     }
  341.                                 }
  342.                                 else
  343.                                 {
  344.                                     mouseLClickUiE(VENDOR_TAB_2);
  345.                                 }
  346.                             }
  347.                             else if (VENDOR_DIALOG_2.Visible) // Salvage
  348.                             {
  349.                                 if (!mRepair)
  350.                                 {
  351.                                     mouseLClickUiE(VENDOR_TAB_3);
  352.                                 }
  353.                                 else
  354.                                 {
  355.                                     if (!mSalvage)
  356.                                     {
  357.                                         if (mCollect)
  358.                                         {
  359.                                             ItemsToSalvage = GetItemsToSalvage();
  360.                                             if (Hud.Game.Me.CurrentLevelNormal == 70 || IgnoreInventoryLockArea) // Only at level 70 will the buttons be used to save all rare/normal/magic items, and only when their amount is greater than 1
  361.                                             {
  362.                                                 IItem lastNormal = null; IItem lastMagic = null; IItem lastRare = null;
  363.                                                 dataNMR = new int[] {0, 0, 0};
  364.                                                 foreach (var item in ItemsToSalvage.ToArray())
  365.                                                 {
  366.                                                         if (item.IsNormal)      { dataNMR[0] = dataNMR[0] + 1; if (dataNMR[0] == 1) lastNormal = item; else ItemsToSalvage.Remove(item);  }
  367.                                                         else if (item.IsMagic)  { dataNMR[1] = dataNMR[1] + 1; if (dataNMR[1] == 1) lastMagic = item; else ItemsToSalvage.Remove(item);  }
  368.                                                         else if (item.IsRare)   { dataNMR[2] = dataNMR[2] + 1; if (dataNMR[2] == 1) lastRare = item; else ItemsToSalvage.Remove(item);  }
  369.                                                 }
  370.                                                 if (dataNMR[0] > 1) { ItemsToSalvage.Remove(lastNormal); }
  371.                                                 if (dataNMR[1] > 1) { ItemsToSalvage.Remove(lastMagic); }
  372.                                                 if (dataNMR[2] > 1) { ItemsToSalvage.Remove(lastRare); }
  373.                                             }
  374.                                             else mSalvage  = true;
  375.                                             mCollect = false;
  376.                                         }
  377.                                         else
  378.                                         {
  379.                                             IUiElement uie = null;
  380.                                             if (dataNMR[0] > 1)         { dataNMR[0] = 0; uie = Salvage_Normal_Button; }
  381.                                             else if (dataNMR[1] > 1)    { dataNMR[1] = 0; uie = Salvage_Magic_Button; }
  382.                                             else if (dataNMR[2] > 1)    { dataNMR[2] = 0; uie = Salvage_Rare_Button; }
  383.                                             if (uie != null && !StopNow)
  384.                                             {
  385.                                                 if (uie.Visible)
  386.                                                 {
  387.                                                     waitButtonOk = true;
  388.                                                     msLapseActionOk = Hud.Game.CurrentRealTimeMilliseconds + msLapseWaitButtonOk;
  389.                                                     mouseLClickUiE(uie);
  390.                                                 }
  391.                                             }
  392.                                             else mSalvage = true;
  393.                                         }
  394.                                     }
  395.                                     else
  396.                                     {
  397.                                         if (SalvageOneButton.Visible)
  398.                                         {
  399.                                             if (ItemsToSalvage.Any() && !StopNow)
  400.                                             {
  401.                                                 if (SalvageOneButton.AnimState != 19 && SalvageOneButton.AnimState != 20)
  402.                                                 {
  403.                                                     msLapseAction = Hud.Game.CurrentRealTimeMilliseconds + msLapseAnvilEnable;
  404.                                                     mouseLClickUiE(SalvageOneButton);
  405.                                                 }
  406.                                                 else
  407.                                                 {
  408.                                                     var item = ItemsToSalvage.First();
  409.                                                     if (item.SeenInInventory)
  410.                                                     {
  411.                                                         if (mouseLClickItemInventory(item))
  412.                                                         {
  413.                                                             if (!item.IsNormal && !item.IsMagic && !item.IsRare)
  414.                                                             {
  415.                                                                 waitButtonOk = true;
  416.                                                                 msLapseActionOk = Hud.Game.CurrentRealTimeMilliseconds + msLapseWaitButtonOk;
  417.                                                             }
  418.                                                             ItemsToSalvage.Remove(item);
  419.                                                         }
  420.                                                     }
  421.                                                     else ItemsToSalvage.Remove(item);
  422.                                                 }
  423.                                             }
  424.                                             else    // No more items to salvage
  425.                                             {
  426.                                                 if (ActionOn)   // I wait a while to disable the anvil
  427.                                                 {
  428.                                                     ActionOn = false;
  429.                                                     msLapseAction = Hud.Game.CurrentRealTimeMilliseconds + msLapseAnvilDisable;
  430.                                                 }
  431.                                                 else // Disabling anvil
  432.                                                 {
  433.                                                     if (SalvageOneButton.AnimState == 19 || SalvageOneButton.AnimState == 20)
  434.                                                         mouseLClickUiE(SalvageOneButton);
  435.                                                     doRepairSalvage = false;
  436.                                                 }
  437.                                             }
  438.                                         }
  439.                                         else
  440.                                         {
  441.                                             doRepairSalvage = false;
  442.                                         }
  443.                                     }
  444.                                 }
  445.                             }
  446.                             else if (VENDOR_DIALOG_0.Visible || VENDOR_DIALOG_1.Visible || (VENDOR_DIALOG_4.Visible && VENDOR_TAB_4.AnimState == 73))
  447.                             {
  448.                                 mouseLClickUiE(VENDOR_TAB_3);
  449.                             }
  450.                             else // should never get here
  451.                             {
  452.                                 doRepairSalvage = false;
  453.                             }
  454.                         }
  455.                     }
  456.                 }
  457.             }
  458.             else if (doRepairSalvage)
  459.             {
  460.                 doRepairSalvage = false;
  461.             }
  462.         }
  463.     }
  464. }
Advertisement
Add Comment
Please, Sign In to add comment