Added craftable or not craftable text for recipies in the crafting page
parent
deebc26a2a
commit
ac6247c70d
|
@ -2,6 +2,7 @@
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
using StardewValley.Menus;
|
using StardewValley.Menus;
|
||||||
|
using StardewValley.Objects;
|
||||||
|
|
||||||
namespace stardew_access.Patches
|
namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
|
@ -256,8 +257,10 @@ namespace stardew_access.Patches
|
||||||
string description = "";
|
string description = "";
|
||||||
string ingredients = "";
|
string ingredients = "";
|
||||||
string buffs = "";
|
string buffs = "";
|
||||||
|
string craftable = "";
|
||||||
|
|
||||||
description = $"Description:\n{___hoverRecipe.description}";
|
description = $"Description:\n{___hoverRecipe.description}";
|
||||||
|
craftable = ___hoverRecipe.doesFarmerHaveIngredientsInInventory(getContainerContents(__instance._materialContainers)) ? "Craftable" : "Not Craftable";
|
||||||
|
|
||||||
#region Crafting ingredients
|
#region Crafting ingredients
|
||||||
ingredients = "Ingredients:\n";
|
ingredients = "Ingredients:\n";
|
||||||
|
@ -309,7 +312,7 @@ namespace stardew_access.Patches
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
string toSpeak = $"{numberOfProduce} {name}, \n\t{ingredients}, \n\t{description}, \n\t{buffs}";
|
string toSpeak = $"{numberOfProduce} {name}, {craftable}, \n\t{ingredients}, \n\t{description} \n\t{buffs}";
|
||||||
|
|
||||||
if (craftingPageQueryKey != toSpeak)
|
if (craftingPageQueryKey != toSpeak)
|
||||||
{
|
{
|
||||||
|
@ -335,6 +338,22 @@ namespace stardew_access.Patches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method is used to get the inventory items to check if the player has enough ingredients for a recipe
|
||||||
|
// Taken from CraftingPage.cs -> 169 line
|
||||||
|
internal static IList<Item> getContainerContents(List<Chest> materialContainers)
|
||||||
|
{
|
||||||
|
if (materialContainers == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<Item> items = new List<Item>();
|
||||||
|
for (int i = 0; i < materialContainers.Count; i++)
|
||||||
|
{
|
||||||
|
items.AddRange(materialContainers[i].items);
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
internal static void InventoryPagePatch(InventoryPage __instance)
|
internal static void InventoryPagePatch(InventoryPage __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue