public void Populate(ComponentCost recipe) { if (recipe != null) { ISet <string> recipeRecords = new HashSet <string>(); GetRecords(recipe, recipeRecords); // Fetch player held items Dictionary <string, int> storedItems = _playerItemDao.GetCountByRecord(_mod); var stashItems = _stashManager.UnlootedItems .Where(item => recipeRecords.Contains(item.BaseRecord)) .Where(item => item.MateriaCombines == 0 || item.MateriaCombines >= 3) // "Good enough" for now, TODO: Check the DB for the real amount .ToList(); // Merge the two lists foreach (var item in stashItems) { if (storedItems.ContainsKey(item.BaseRecord)) { storedItems[item.BaseRecord] += Math.Max(1, (int)item.StackCount); } else { storedItems[item.BaseRecord] = Math.Max(1, (int)item.StackCount); } } // Apply "already have" items for (int depth = 0; depth < 10; depth++) { ApplyIngredientsDepthWise(recipe, storedItems, depth); } } }
public Dictionary <string, int> GetCountByRecord(string mod) { return(ThreadExecuter.Execute( () => repo.GetCountByRecord(mod) )); }