From 9d2dd976072a2b8bd3aa7247f3df85f414ec1a70 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Sat, 20 Aug 2022 22:58:42 +0530 Subject: [PATCH] Added 'not usable here' to inventories --- stardew-access/Patches/BundleMenuPatches.cs | 4 ++++ stardew-access/Patches/DonationMenuPatches.cs | 7 +++++++ stardew-access/Patches/GameMenuPatches.cs | 19 ++++++++++++------- stardew-access/Patches/MenuPatches.cs | 14 ++++++++++++++ 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/stardew-access/Patches/BundleMenuPatches.cs b/stardew-access/Patches/BundleMenuPatches.cs index 2e34511..fc3dc6c 100644 --- a/stardew-access/Patches/BundleMenuPatches.cs +++ b/stardew-access/Patches/BundleMenuPatches.cs @@ -334,6 +334,10 @@ namespace stardew_access.Patches } toSpeak = $"{item.Stack} {toSpeak}"; + if (!__instance.inventory.highlightMethod(__instance.inventory.actualInventory[currentInventorySlot])) + { + toSpeak = $"{toSpeak} not usable here"; + } } else { diff --git a/stardew-access/Patches/DonationMenuPatches.cs b/stardew-access/Patches/DonationMenuPatches.cs index 159bc25..f4969ca 100644 --- a/stardew-access/Patches/DonationMenuPatches.cs +++ b/stardew-access/Patches/DonationMenuPatches.cs @@ -311,8 +311,15 @@ namespace stardew_access.Patches if (__instance.inventory.actualInventory[i] == null) toSpeak = "Empty slot"; else + { 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}") { fieldOfficeMenuQuery = $"{toSpeak}:{i}"; diff --git a/stardew-access/Patches/GameMenuPatches.cs b/stardew-access/Patches/GameMenuPatches.cs index 97ce43a..f322daf 100644 --- a/stardew-access/Patches/GameMenuPatches.cs +++ b/stardew-access/Patches/GameMenuPatches.cs @@ -241,7 +241,7 @@ namespace stardew_access.Patches #endregion #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 = ""; return; @@ -396,7 +396,7 @@ namespace stardew_access.Patches #endregion #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 = ""; #endregion } @@ -573,14 +573,14 @@ namespace stardew_access.Patches #endregion #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 = ""; itemGrabMenuQueryKey = ""; 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 = ""; itemGrabMenuQueryKey = ""; @@ -855,7 +855,7 @@ namespace stardew_access.Patches #endregion #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 = ""; craftingPageQueryKey = ""; @@ -1072,7 +1072,7 @@ namespace stardew_access.Patches #endregion #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 = ""; inventoryPageQueryKey = ""; @@ -1174,7 +1174,7 @@ namespace stardew_access.Patches } } - internal static bool narrateHoveredItemInInventory(List inventory, IList actualInventory, int x, int y, bool giveExtraDetails = false, int hoverPrice = -1, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1) + internal static bool narrateHoveredItemInInventory(InventoryMenu inventoryMenu, List inventory, IList actualInventory, int x, int y, bool giveExtraDetails = false, int hoverPrice = -1, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1) { #region Narrate hovered item for (int i = 0; i < inventory.Count; i++) @@ -1272,6 +1272,11 @@ namespace stardew_access.Patches price = $"Sell Price: {hoverPrice} g"; } + if (!inventoryMenu.highlightMethod(actualInventory[i])) + { + name = $"{name} not usable here"; + } + if (giveExtraDetails) { if (stack > 1) diff --git a/stardew-access/Patches/MenuPatches.cs b/stardew-access/Patches/MenuPatches.cs index 5bd970b..40c98bf 100644 --- a/stardew-access/Patches/MenuPatches.cs +++ b/stardew-access/Patches/MenuPatches.cs @@ -136,8 +136,15 @@ namespace stardew_access.Patches if (__instance.inventory.actualInventory[i] == null) toSpeak = "Empty slot"; else + { 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}") { forgeMenuQuery = $"{toSpeak}:{i}"; @@ -296,8 +303,15 @@ namespace stardew_access.Patches if (__instance.inventory.actualInventory[i] == null) toSpeak = "Empty slot"; else + { 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}") { tailoringMenuQuery = $"{toSpeak}:{i}";