public static void ScanArtifacts(int count = 0) { // Get Max artifacts from screen int artifactCount = count == 0 ? ScanArtifactCount() : count; var(rectangles, cols, rows) = GetPageOfItems(); int fullPage = cols * rows; int totalRows = (int)Math.Ceiling(artifactCount / (decimal)cols); int cardsQueued = 0; int rowsQueued = 0; int offset = 0; UserInterface.SetArtifact_Max(artifactCount); StopScanning = false; // Go through artifact list while (cardsQueued < artifactCount) { int cardsRemaining = artifactCount - 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 >= artifactCount || 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); } } }