started adding navigation
This commit is contained in:
parent
32781b1462
commit
468e0a7246
20 changed files with 844 additions and 31 deletions
|
|
@ -3,6 +3,7 @@ using Poe2Trade.Core;
|
|||
using Poe2Trade.Game;
|
||||
using Poe2Trade.Inventory;
|
||||
using Poe2Trade.GameLog;
|
||||
using Poe2Trade.Navigation;
|
||||
using Poe2Trade.Screen;
|
||||
using Poe2Trade.Trade;
|
||||
using Serilog;
|
||||
|
|
@ -38,6 +39,7 @@ public class BotOrchestrator : IAsyncDisposable
|
|||
public IInventoryManager Inventory { get; }
|
||||
public TradeExecutor TradeExecutor { get; }
|
||||
public TradeQueue TradeQueue { get; }
|
||||
public NavigationExecutor Navigation { get; }
|
||||
private readonly Dictionary<string, ScrapExecutor> _scrapExecutors = new();
|
||||
|
||||
// Events
|
||||
|
|
@ -58,12 +60,24 @@ public class BotOrchestrator : IAsyncDisposable
|
|||
TradeExecutor = tradeExecutor;
|
||||
TradeQueue = tradeQueue;
|
||||
Links = links;
|
||||
Navigation = new NavigationExecutor(game);
|
||||
_paused = store.Settings.Paused;
|
||||
}
|
||||
|
||||
public bool IsReady => _started;
|
||||
public bool IsPaused => _paused;
|
||||
|
||||
public BotMode Mode
|
||||
{
|
||||
get => Config.Mode;
|
||||
set
|
||||
{
|
||||
if (Config.Mode == value) return;
|
||||
Store.UpdateSettings(s => s.Mode = value);
|
||||
StatusUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public string State
|
||||
{
|
||||
get => _state;
|
||||
|
|
@ -142,6 +156,11 @@ public class BotOrchestrator : IAsyncDisposable
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (Navigation.State != NavigationState.Idle)
|
||||
{
|
||||
State = Navigation.State.ToString();
|
||||
return;
|
||||
}
|
||||
State = "Idle";
|
||||
}
|
||||
|
||||
|
|
@ -183,6 +202,7 @@ public class BotOrchestrator : IAsyncDisposable
|
|||
|
||||
// Wire executor events
|
||||
TradeExecutor.StateChanged += _ => UpdateExecutorState();
|
||||
Navigation.StateChanged += _ => UpdateExecutorState();
|
||||
TradeQueue.TradeCompleted += () => { _tradesCompleted++; StatusUpdated?.Invoke(); };
|
||||
TradeQueue.TradeFailed += () => { _tradesFailed++; StatusUpdated?.Invoke(); };
|
||||
Inventory.Updated += () => StatusUpdated?.Invoke();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue