Added 'not usable here' to inventories

master
Mohammad Shoaib Khan 2022-08-20 22:58:42 +05:30
parent d14af408df
commit 741e6a5219
4 changed files with 37 additions and 7 deletions

View File

@ -334,6 +334,10 @@ namespace stardew_access.Patches
} }
toSpeak = $"{item.Stack} {toSpeak}"; toSpeak = $"{item.Stack} {toSpeak}";
if (!__instance.inventory.highlightMethod(__instance.inventory.actualInventory[currentInventorySlot]))
{
toSpeak = $"{toSpeak} not usable here";
}
} }
else else
{ {

View File

@ -311,8 +311,15 @@ namespace stardew_access.Patches
if (__instance.inventory.actualInventory[i] == null) if (__instance.inventory.actualInventory[i] == null)
toSpeak = "Empty slot"; toSpeak = "Empty slot";
else else
{
toSpeak = $"{__instance.inventory.actualInventory[i].Stack} {__instance.inventory.actualInventory[i].DisplayName}"; toSpeak = $"{__instance.inventory.actualInventory[i].Stack} {__instance.inventory.actualInventory[i].DisplayName}";
if (!__instance.inventory.highlightMethod(__instance.inventory.actualInventory[i]))
{
toSpeak = $"{toSpeak} not usable here";
}
}
if (fieldOfficeMenuQuery != $"{toSpeak}:{i}") if (fieldOfficeMenuQuery != $"{toSpeak}:{i}")
{ {
fieldOfficeMenuQuery = $"{toSpeak}:{i}"; fieldOfficeMenuQuery = $"{toSpeak}:{i}";

View File

@ -241,7 +241,7 @@ namespace stardew_access.Patches
#endregion #endregion
#region Narrate hovered item #region Narrate hovered item
if (narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y, hoverPrice: __instance.hoverPrice)) if (narrateHoveredItemInInventory(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y, hoverPrice: __instance.hoverPrice))
{ {
shopMenuQueryKey = ""; shopMenuQueryKey = "";
return; return;
@ -396,7 +396,7 @@ namespace stardew_access.Patches
#endregion #endregion
#region Narrate hovered item #region Narrate hovered item
if (narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y)) if (narrateHoveredItemInInventory(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y))
geodeMenuQueryKey = ""; geodeMenuQueryKey = "";
#endregion #endregion
} }
@ -573,14 +573,14 @@ namespace stardew_access.Patches
#endregion #endregion
#region Narrate hovered item #region Narrate hovered item
if (narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y, true)) if (narrateHoveredItemInInventory(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y, true))
{ {
gameMenuQueryKey = ""; gameMenuQueryKey = "";
itemGrabMenuQueryKey = ""; itemGrabMenuQueryKey = "";
return; return;
} }
if (narrateHoveredItemInInventory(__instance.ItemsToGrabMenu.inventory, __instance.ItemsToGrabMenu.actualInventory, x, y, true)) if (narrateHoveredItemInInventory(__instance.ItemsToGrabMenu, __instance.ItemsToGrabMenu.inventory, __instance.ItemsToGrabMenu.actualInventory, x, y, true))
{ {
gameMenuQueryKey = ""; gameMenuQueryKey = "";
itemGrabMenuQueryKey = ""; itemGrabMenuQueryKey = "";
@ -855,7 +855,7 @@ namespace stardew_access.Patches
#endregion #endregion
#region Narrate hovered item #region Narrate hovered item
if (narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y)) if (narrateHoveredItemInInventory(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y))
{ {
gameMenuQueryKey = ""; gameMenuQueryKey = "";
craftingPageQueryKey = ""; craftingPageQueryKey = "";
@ -1072,7 +1072,7 @@ namespace stardew_access.Patches
#endregion #endregion
#region Narrate hovered item #region Narrate hovered item
if (narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y, true)) if (narrateHoveredItemInInventory(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y, true))
{ {
gameMenuQueryKey = ""; gameMenuQueryKey = "";
inventoryPageQueryKey = ""; inventoryPageQueryKey = "";
@ -1174,7 +1174,7 @@ namespace stardew_access.Patches
} }
} }
internal static bool narrateHoveredItemInInventory(List<ClickableComponent> inventory, IList<Item> actualInventory, int x, int y, bool giveExtraDetails = false, int hoverPrice = -1, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1) internal static bool narrateHoveredItemInInventory(InventoryMenu inventoryMenu, List<ClickableComponent> inventory, IList<Item> actualInventory, int x, int y, bool giveExtraDetails = false, int hoverPrice = -1, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1)
{ {
#region Narrate hovered item #region Narrate hovered item
for (int i = 0; i < inventory.Count; i++) for (int i = 0; i < inventory.Count; i++)
@ -1272,6 +1272,11 @@ namespace stardew_access.Patches
price = $"Sell Price: {hoverPrice} g"; price = $"Sell Price: {hoverPrice} g";
} }
if (!inventoryMenu.highlightMethod(actualInventory[i]))
{
name = $"{name} not usable here";
}
if (giveExtraDetails) if (giveExtraDetails)
{ {
if (stack > 1) if (stack > 1)

View File

@ -136,8 +136,15 @@ namespace stardew_access.Patches
if (__instance.inventory.actualInventory[i] == null) if (__instance.inventory.actualInventory[i] == null)
toSpeak = "Empty slot"; toSpeak = "Empty slot";
else else
{
toSpeak = $"{__instance.inventory.actualInventory[i].Stack} {__instance.inventory.actualInventory[i].DisplayName}"; toSpeak = $"{__instance.inventory.actualInventory[i].Stack} {__instance.inventory.actualInventory[i].DisplayName}";
if (!__instance.inventory.highlightMethod(__instance.inventory.actualInventory[i]))
{
toSpeak = $"{toSpeak} not usable here";
}
}
if (forgeMenuQuery != $"{toSpeak}:{i}") if (forgeMenuQuery != $"{toSpeak}:{i}")
{ {
forgeMenuQuery = $"{toSpeak}:{i}"; forgeMenuQuery = $"{toSpeak}:{i}";
@ -296,8 +303,15 @@ namespace stardew_access.Patches
if (__instance.inventory.actualInventory[i] == null) if (__instance.inventory.actualInventory[i] == null)
toSpeak = "Empty slot"; toSpeak = "Empty slot";
else else
{
toSpeak = $"{__instance.inventory.actualInventory[i].Stack} {__instance.inventory.actualInventory[i].DisplayName}"; toSpeak = $"{__instance.inventory.actualInventory[i].Stack} {__instance.inventory.actualInventory[i].DisplayName}";
if (!__instance.inventory.highlightMethod(__instance.inventory.actualInventory[i]))
{
toSpeak = $"{toSpeak} not usable here";
}
}
if (tailoringMenuQuery != $"{toSpeak}:{i}") if (tailoringMenuQuery != $"{toSpeak}:{i}")
{ {
tailoringMenuQuery = $"{toSpeak}:{i}"; tailoringMenuQuery = $"{toSpeak}:{i}";