work on inventory
This commit is contained in:
parent
50d32abd49
commit
32781b1462
11 changed files with 240 additions and 146 deletions
|
|
@ -4,7 +4,9 @@ namespace Poe2Trade.Inventory;
|
|||
|
||||
public interface IInventoryManager
|
||||
{
|
||||
event Action? Updated;
|
||||
InventoryTracker Tracker { get; }
|
||||
byte[]? LastScreenshot { get; }
|
||||
bool IsAtOwnHideout { get; }
|
||||
string SellerAccount { get; }
|
||||
void SetLocation(bool atHome, string? seller = null);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public class InventoryManager : IInventoryManager
|
|||
{
|
||||
private static readonly string SalvageTemplate = Path.Combine("assets", "salvage.png");
|
||||
|
||||
public event Action? Updated;
|
||||
public InventoryTracker Tracker { get; } = new();
|
||||
|
||||
private bool _atOwnHideout = true;
|
||||
|
|
@ -19,6 +20,7 @@ public class InventoryManager : IInventoryManager
|
|||
private readonly IClientLogWatcher _logWatcher;
|
||||
private readonly SavedSettings _config;
|
||||
|
||||
public byte[]? LastScreenshot { get; private set; }
|
||||
public bool IsAtOwnHideout => _atOwnHideout;
|
||||
public string SellerAccount => _sellerAccount;
|
||||
|
||||
|
|
@ -44,6 +46,7 @@ public class InventoryManager : IInventoryManager
|
|||
await _game.OpenInventory();
|
||||
|
||||
var result = await _screen.Grid.Scan("inventory");
|
||||
LastScreenshot = await _screen.CaptureRegion(GridLayouts.Inventory.Region);
|
||||
|
||||
var cells = new bool[5, 12];
|
||||
foreach (var cell in result.Occupied)
|
||||
|
|
@ -52,6 +55,7 @@ public class InventoryManager : IInventoryManager
|
|||
cells[cell.Row, cell.Col] = true;
|
||||
}
|
||||
Tracker.InitFromScan(cells, result.Items, defaultAction);
|
||||
Updated?.Invoke();
|
||||
|
||||
await _game.PressEscape();
|
||||
await Helpers.Sleep(Delays.PostFocus);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue