private List<Recipe> CalculateShoppingList(List<Recipe> list)
{
if (Way == RecipeWay.Buy)
{
var r = list.FirstOrDefault(x => x.DataId == DataId);
if (r == null)
{
list.Add(new Recipe(this.DataId, this.Quantity, false)
{
MarketItem = this.MarketItem,
SellPriceCosts = this.SellPriceCosts,
CraftPriceCosts = this.CraftPriceCosts,
});
}
else
{
r.Quantity += Quantity;
r.SellPriceCosts = r.Quantity * SellPrice;
}
}
else
{
foreach (Recipe r in RecipeItems)
{
r.CalculateShoppingList(list);
}
}
return list;
}