inventory snapshot addition
This commit is contained in:
parent
db3069660e
commit
53641fc8e7
7 changed files with 18 additions and 3 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 7.4 MiB After Width: | Height: | Size: 7 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.3 MiB After Width: | Height: | Size: 6 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 334 KiB After Width: | Height: | Size: 319 KiB |
|
|
@ -130,7 +130,7 @@ public class KulemakExecutor : MappingExecutor
|
||||||
await Sleep(Delays.PostStashOpen);
|
await Sleep(Delays.PostStashOpen);
|
||||||
|
|
||||||
// Scan inventory now that stash (and inventory panel) is open
|
// 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)
|
if (scanResult.Occupied.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -467,7 +467,7 @@ public class KulemakExecutor : MappingExecutor
|
||||||
|
|
||||||
for (var pass = 0; pass < 3; pass++)
|
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 (scanResult.Items.Count == 0)
|
||||||
{
|
{
|
||||||
if (pass > 0) Log.Information("Inventory clear after {Pass} passes", pass);
|
if (pass > 0) Log.Information("Inventory clear after {Pass} passes", pass);
|
||||||
|
|
|
||||||
|
|
@ -607,7 +607,7 @@ public abstract class MappingExecutor : GameExecutor
|
||||||
|
|
||||||
for (var pass = 0; pass < 3; pass++)
|
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 (scanResult.Items.Count == 0)
|
||||||
{
|
{
|
||||||
if (pass > 0) Log.Information("Inventory clear after {Pass} passes", pass);
|
if (pass > 0) Log.Information("Inventory clear after {Pass} passes", pass);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Poe2Trade.Core;
|
using Poe2Trade.Core;
|
||||||
|
using Poe2Trade.Screen;
|
||||||
|
|
||||||
namespace Poe2Trade.Inventory;
|
namespace Poe2Trade.Inventory;
|
||||||
|
|
||||||
|
|
@ -11,6 +12,7 @@ public interface IInventoryManager
|
||||||
string SellerAccount { get; }
|
string SellerAccount { get; }
|
||||||
void SetLocation(bool atHome, string? seller = null);
|
void SetLocation(bool atHome, string? seller = null);
|
||||||
Task ScanInventory(PostAction defaultAction = PostAction.Stash);
|
Task ScanInventory(PostAction defaultAction = PostAction.Stash);
|
||||||
|
Task<ScanResult> SnapshotInventory();
|
||||||
Task ClearToStash();
|
Task ClearToStash();
|
||||||
Task<bool> EnsureAtOwnHideout();
|
Task<bool> EnsureAtOwnHideout();
|
||||||
Task ProcessInventory();
|
Task ProcessInventory();
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ public class InventoryManager : IInventoryManager
|
||||||
await Helpers.Sleep(Delays.PostFocus);
|
await Helpers.Sleep(Delays.PostFocus);
|
||||||
await _game.OpenInventory();
|
await _game.OpenInventory();
|
||||||
|
|
||||||
|
_game.MoveMouseInstant(1700, 700);
|
||||||
|
await Helpers.Sleep(100);
|
||||||
|
|
||||||
var result = await _screen.Grid.Scan("inventory");
|
var result = await _screen.Grid.Scan("inventory");
|
||||||
LastScreenshot = await _screen.CaptureRegion(GridLayouts.Inventory.Region);
|
LastScreenshot = await _screen.CaptureRegion(GridLayouts.Inventory.Region);
|
||||||
|
|
||||||
|
|
@ -64,6 +67,16 @@ public class InventoryManager : IInventoryManager
|
||||||
await Helpers.Sleep(Delays.PostFocus);
|
await Helpers.Sleep(Delays.PostFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ScanResult> 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()
|
public async Task ClearToStash()
|
||||||
{
|
{
|
||||||
Log.Information("Checking inventory for leftover items...");
|
Log.Information("Checking inventory for leftover items...");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue