diff --git a/debug_loot_capture.png b/debug_loot_capture.png index 902adbf..caf2708 100644 Binary files a/debug_loot_capture.png and b/debug_loot_capture.png differ diff --git a/debug_loot_detected.png b/debug_loot_detected.png index 2ccb365..d4a2737 100644 Binary files a/debug_loot_detected.png and b/debug_loot_detected.png differ diff --git a/debug_loot_edges.png b/debug_loot_edges.png index 6743ea0..68e41d6 100644 Binary files a/debug_loot_edges.png and b/debug_loot_edges.png differ diff --git a/src/Poe2Trade.Bot/KulemakExecutor.cs b/src/Poe2Trade.Bot/KulemakExecutor.cs index fbd7e43..266903e 100644 --- a/src/Poe2Trade.Bot/KulemakExecutor.cs +++ b/src/Poe2Trade.Bot/KulemakExecutor.cs @@ -130,7 +130,7 @@ public class KulemakExecutor : MappingExecutor await Sleep(Delays.PostStashOpen); // Scan inventory now that stash (and inventory panel) is open - var scanResult = await _screen.Grid.Scan("inventory"); + var scanResult = await _inventory.SnapshotInventory(); if (scanResult.Occupied.Count > 0) { @@ -467,7 +467,7 @@ public class KulemakExecutor : MappingExecutor for (var pass = 0; pass < 3; pass++) { - var scanResult = await _screen.Grid.Scan("inventory"); + var scanResult = await _inventory.SnapshotInventory(); if (scanResult.Items.Count == 0) { if (pass > 0) Log.Information("Inventory clear after {Pass} passes", pass); diff --git a/src/Poe2Trade.Bot/MappingExecutor.cs b/src/Poe2Trade.Bot/MappingExecutor.cs index 0c9ee75..980e04a 100644 --- a/src/Poe2Trade.Bot/MappingExecutor.cs +++ b/src/Poe2Trade.Bot/MappingExecutor.cs @@ -607,7 +607,7 @@ public abstract class MappingExecutor : GameExecutor for (var pass = 0; pass < 3; pass++) { - var scanResult = await _screen.Grid.Scan("inventory"); + var scanResult = await _inventory.SnapshotInventory(); if (scanResult.Items.Count == 0) { if (pass > 0) Log.Information("Inventory clear after {Pass} passes", pass); diff --git a/src/Poe2Trade.Inventory/IInventoryManager.cs b/src/Poe2Trade.Inventory/IInventoryManager.cs index 9a65ec3..cca23e4 100644 --- a/src/Poe2Trade.Inventory/IInventoryManager.cs +++ b/src/Poe2Trade.Inventory/IInventoryManager.cs @@ -1,4 +1,5 @@ using Poe2Trade.Core; +using Poe2Trade.Screen; namespace Poe2Trade.Inventory; @@ -11,6 +12,7 @@ public interface IInventoryManager string SellerAccount { get; } void SetLocation(bool atHome, string? seller = null); Task ScanInventory(PostAction defaultAction = PostAction.Stash); + Task SnapshotInventory(); Task ClearToStash(); Task EnsureAtOwnHideout(); Task ProcessInventory(); diff --git a/src/Poe2Trade.Inventory/InventoryManager.cs b/src/Poe2Trade.Inventory/InventoryManager.cs index 744a80a..a47582c 100644 --- a/src/Poe2Trade.Inventory/InventoryManager.cs +++ b/src/Poe2Trade.Inventory/InventoryManager.cs @@ -48,6 +48,9 @@ public class InventoryManager : IInventoryManager await Helpers.Sleep(Delays.PostFocus); await _game.OpenInventory(); + _game.MoveMouseInstant(1700, 700); + await Helpers.Sleep(100); + var result = await _screen.Grid.Scan("inventory"); LastScreenshot = await _screen.CaptureRegion(GridLayouts.Inventory.Region); @@ -64,6 +67,16 @@ public class InventoryManager : IInventoryManager await Helpers.Sleep(Delays.PostFocus); } + public async Task SnapshotInventory() + { + _game.MoveMouseInstant(1700, 700); + await Helpers.Sleep(100); + var result = await _screen.Grid.Scan("inventory"); + LastScreenshot = await _screen.CaptureRegion(GridLayouts.Inventory.Region); + Updated?.Invoke(); + return result; + } + public async Task ClearToStash() { Log.Information("Checking inventory for leftover items...");