I would do it as a task, so it can be timed just before selling. That way your item vendor filters will determine what to do with the items afterwards (sell the bad rares etc) so they don't full all your stash space
if (!TaskManager.AddBefore(new ChanceOrbsTask(), "SellTask"))
{
Log.ErrorFormat("[EquipBetterGear] Add ChanceOrbsTask Before SellTask failed.");
}
then make a 'ChanceOrbsTask' with something like this
var items =
LokiPoe.InGameState.InventoryPanel.Main.OrderBy(i => i.LocationTopLeft.X)
.ThenBy(i => i.LocationTopLeft.Y)
.ToList();
foreach (var item in items)
{
if ( ((item.FullName == "Gavel") || (item.FullName == "Siege Axe")) && (item.Rarity == Rarity.Normal) )
{
await Coroutines.OpenInventoryPanel();
var ErrorUseChanceOrb = LokiPoe.InGameState.InventoryPanel.UseItemOnItemInMainInventory("Orb of Chance", item);
if (ErrorUseChanceOrb != Loki.Game.LokiPoe.InGameState.UseItemError.None)
{
Log.ErrorFormat("[ChanceOrbTask] Use Chance Orb returned => {0}.", ErrorUseChanceOrb);
}
}
}
this would only work if chance orbs are in your inventory, otherwise look at using this instead: LokiPoe.InGameState.StashPanel.UseItemOnItemInMainInventory(string, Loki.Game.Objects.Item)
best of luck!
Free up my time to release more code, help me pay my bills, and be awesome Support Me