PC [BUG] Cooking Recipes for ItemDeliveryQuests are bugged

BlaDe

Farmer
When the game chooses an item to be requested for an ItemDeliverQuest, all cooking recipes known are evaluated. This evaluation is bugged.

A recipe is stored like this:
"Tortilla": "270 1/5 4/229/l 13",
"Red Plate": "266 1 264 1/15 3/230/f Emily 7",
"Eggplant Parm.": "272 1 256 1/30 2/231/f Lewis 7",

The ingredients are the first thing in the list, stored as itemID amount pairs

e.g.
Red Plate": "266 1 264 1/ is one Red Cabbage and one Radish

The following code evaluates the ingredients of the recipe:
C#:
foreach (string s in all_unlocked_cooking_recipes)
                {
                    if (r.NextDouble() < 0.4)
                    {
                        continue;
                    }
                    List<int> cropsAvailableNow = Utility.possibleCropsAtThisTime(Game1.currentSeason, (Game1.dayOfMonth <= 7) ? true : false);
                    Dictionary<string, string> cookingRecipes = Game1.content.Load<Dictionary<string, string>>("Data//CookingRecipes");
                    if (!cookingRecipes.ContainsKey(s))
                    {
                        continue;
                    }
                    string[] ingredientsSplit = cookingRecipes[s].Split('/')[0].Split(' ');
                    bool ingredientsAvailable = true;
                    for (int i = 0; i < ingredientsSplit.Length; i++)
                    {
                        if (!possibleItems.Contains(Convert.ToInt32(ingredientsSplit[i])) && !Utility.isCategoryIngredientAvailable(Convert.ToInt32(ingredientsSplit[i])) && (cropsAvailableNow == null || !cropsAvailableNow.Contains(Convert.ToInt32(ingredientsSplit[i]))))
                        {
                            ingredientsAvailable = false;
                            break;
                        }
                    }
                    if (ingredientsAvailable)
                    {
                        possibleItems.Add(Convert.ToInt32(cookingRecipes[s].Split('/')[2]));
                    }
                }
The loop that iterates the ingredientsSplit is treating the amount of an ingredient as its own ingredient. i.e "Tortilla": "270 1/ Looks to see if both 270 and 1 are valid ingredients, where it should only be 270.

for (int i = 0; i < ingredientsSplit.Length; i++) needs to change to
for (int i = 0; i < ingredientsSplit.Length; i+=2)

Also, common ingredients (flour, sugar, oil etc.) are never deemed available. This cuts out a lot of otherwise valid ingredients from being added to the list.

If this is fixed, may want to do a check to see if the player can cook anything (has a house upgrade).


Note: I made the above change in my predictor and got bean hotpot to show up.
 
Top