private static async Task <bool> TakeQ20Gems() { if (!LokiPoe.InGameState.StashUi.IsOpened) { GlobalLog.Error("[TakeQ20Gems] Unexpected error. Stash is closed."); return(false); } while (true) { var gem = StashGems.FirstOrDefault(Q20GemFitsForSelling); if (gem == null) { return(true); } if (Inventories.AvailableInventorySquares == 0) { GlobalLog.Warn("[TakeQ20Gems] Inventory is full."); return(true); } GlobalLog.Warn($"[TakeQ20Gems] Now taking \"{gem.Name}\"."); if (!await Inventories.FastMoveFromStashTab(gem.LocationTopLeft)) { return(false); } } }
private static async Task <bool> TakeGcpSets() { if (!await Inventories.OpenStashTab(_tabWithGcpSet)) { return(false); } while (true) { if (_gcpSet == null) { var qualities = GemQualitiesInCurrentTab; if (qualities.Count == 0) { GlobalLog.Info($"[TakeGcpSets] No quality gems were found in \"{_tabWithGcpSet}\" tab."); _tabWithGcpSet = null; return(true); } var finder = new GemSetFinder(qualities); _gcpSet = finder.BestSet; if (_gcpSet == null) { GlobalLog.Info($"[TakeGcpSets] No more gem sets for gcp recipe were found in \"{_tabWithGcpSet}\" tab."); _tabWithGcpSet = null; return(true); } } if (!_gcpSet.CanFit) { GlobalLog.Warn("[TakeGcpSets] Not enough inventory space for current gcp set."); _gcpSet = null; return(true); } GlobalLog.Warn($"[TakeGcpSets] Now taking gcp set {_gcpSet}"); foreach (int q in _gcpSet.Qualities) { var gem = StashGems.FirstOrDefault(g => QGemFitsForSelling(g) && g.Quality == q); if (gem == null) { GlobalLog.Error($"[TakeGcpSets] Unexpected error. Fail to find gem with quality {q} as a part of {_gcpSet} gcp set."); _tabWithGcpSet = null; _gcpSet = null; return(false); } if (!await Inventories.FastMoveFromStashTab(gem.LocationTopLeft)) { return(false); } } _gcpSet = null; } }