public static void ScanWeapons(int count = 0) { // Determine maximum number of weapons to scan int weaponCount = count == 0 ? ScanWeaponCount(): count; var(rectangles, cols, rows) = GetPageOfItems(); int fullPage = cols * rows; int totalRows = (int)Math.Ceiling(weaponCount / (decimal)cols); int cardsQueued = 0; int rowsQueued = 0; int offset = 0; UserInterface.SetWeapon_Max(weaponCount); // TODO: Rewrite this method to allow for scanning enhancement ore quantities // weaponCount += 3; // Determine Delay if delay has not been found before // Scraper.FindDelay(rectangles); StopScanning = false; // Go through weapon list while (cardsQueued < weaponCount) { int cardsRemaining = weaponCount - cardsQueued; // Go through each "page" of items and queue. In the event that not a full page of // items are scrolled to, offset the index of rectangle to start clicking from for (int i = cardsRemaining < fullPage ? (rows - (totalRows - rowsQueued)) * cols : 0; i < rectangles.Count; i++) { Rectangle item = rectangles[i]; Navigation.SetCursorPos(Navigation.GetPosition().Left + item.Center().X, Navigation.GetPosition().Top + item.Center().Y + offset); Navigation.Click(); Navigation.SystemRandomWait(Navigation.Speed.SelectNextInventoryItem); // Queue card for scanning QueueScan(cardsQueued); cardsQueued++; if (cardsQueued >= weaponCount || StopScanning) { return; } } rowsQueued += rows; // Page done, now scroll // If the number of remaining scans is shorter than a full page then // only scroll a few rows if (totalRows - rowsQueued <= rows) { if (Navigation.GetAspectRatio() == new Size(8, 5)) { offset = 35; // Lazy fix } for (int i = 0; i < 10 * (totalRows - rowsQueued) - 1; i++) { Navigation.sim.Mouse.VerticalScroll(-1); } Navigation.SystemRandomWait(Navigation.Speed.Fast); } else { // Scroll back one to keep it from getting too crazy if (rowsQueued % 15 == 0) { Navigation.sim.Mouse.VerticalScroll(1); } for (int i = 0; i < 10 * rows - 1; i++) { Navigation.sim.Mouse.VerticalScroll(-1); } Navigation.SystemRandomWait(Navigation.Speed.Fast); } } }