diff --git a/stardew-access/Features/InventoryUtils.cs b/stardew-access/Features/InventoryUtils.cs index 8b8e913..c30f4e4 100644 --- a/stardew-access/Features/InventoryUtils.cs +++ b/stardew-access/Features/InventoryUtils.cs @@ -10,21 +10,23 @@ namespace stardew_access.Features internal static int prevSlotIndex = -999; internal static bool narrateHoveredSlot(InventoryMenu inventoryMenu, List inventory, IList actualInventory, int x, int y, - bool giveExtraDetails = false, int hoverPrice = -1, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1, + bool? giveExtraDetails = null, int hoverPrice = -1, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1, bool handleHighlightedItem = false, String highlightedItemPrefix = "", String highlightedItemSuffix = "") { if (narrateHoveredSlotAndReturnIndex(inventoryMenu, inventory, actualInventory, x, y, - giveExtraDetails = false, hoverPrice = -1, extraItemToShowIndex = -1, extraItemToShowAmount = -1, - handleHighlightedItem = false, highlightedItemPrefix = "", highlightedItemSuffix = "") == -999) + giveExtraDetails, hoverPrice, extraItemToShowIndex, extraItemToShowAmount, + handleHighlightedItem, highlightedItemPrefix, highlightedItemSuffix) == -999) return false; return true; } internal static int narrateHoveredSlotAndReturnIndex(InventoryMenu inventoryMenu, List inventory, IList actualInventory, int x, int y, - bool giveExtraDetails = false, int hoverPrice = -1, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1, + bool? giveExtraDetails = null, int hoverPrice = -1, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1, bool handleHighlightedItem = false, String highlightedItemPrefix = "", String highlightedItemSuffix = "") { + if (giveExtraDetails is null) + giveExtraDetails = !MainClass.Config.DisableInventoryVerbosity; for (int i = 0; i < inventory.Count; i++) { if (!inventory[i].containsPoint(x, y)) continue; @@ -45,27 +47,31 @@ namespace stardew_access.Features string name = $"{namePrefix}{actualInventory[i].DisplayName}{nameSuffix}"; int stack = actualInventory[i].Stack; string quality = getQualityFromItem(actualInventory[i]); - string healthNStamine = getHealthNStaminaFromItem(actualInventory[i]); + string healthNStamina = getHealthNStaminaFromItem(actualInventory[i]); string buffs = getBuffsFromItem(actualInventory[i]); string description = actualInventory[i].getDescription(); string price = getPrice(hoverPrice); string requirements = getExtraItemInfo(extraItemToShowIndex, extraItemToShowAmount); - if (giveExtraDetails) + string details; + if (giveExtraDetails == true) { if (stack > 1) - toSpeak = $"{stack} {name} {quality}, \n{requirements}, \n{price}, \n{description}, \n{healthNStamine}, \n{buffs}"; + toSpeak = $"{stack} {name}"; // {quality}, \n{requirements}, \n{price}, \n{description}, \n{healthNStamina}, \n{buffs}"; else - toSpeak = $"{name} {quality}, \n{requirements}, \n{price}, \n{description}, \n{healthNStamine}, \n{buffs}"; + toSpeak = $"{name}"; //{quality}, \n{requirements}, \n{price}, \n{description}, \n{healthNStamina}, \n{buffs}"; + details = string.Join(",\n", new string[] { quality, requirements, price, description, healthNStamina, buffs }.Where(c => !string.IsNullOrEmpty(c))); } else { if (stack > 1) - toSpeak = $"{stack} {name} {quality}, \n{requirements}, \n{price}"; + toSpeak = $"{stack} {name}"; //{quality}, \n{requirements}, \n{price}"; else - toSpeak = $"{name} {quality}, \n{requirements}, \n{price}"; + toSpeak = $"{name}"; //{quality}, \n{requirements}, \n{price}"; + details = string.Join(",\n", new string[] { quality, requirements, price }.Where(c => !string.IsNullOrEmpty(c))); } - + if (!string.IsNullOrEmpty(details)) + toSpeak = $"{toSpeak}, {details}"; checkAndSpeak(toSpeak, i); prevSlotIndex = i; diff --git a/stardew-access/manifest.json b/stardew-access/manifest.json index 494cb2e..a95415e 100644 --- a/stardew-access/manifest.json +++ b/stardew-access/manifest.json @@ -1,7 +1,7 @@ { "Name": "Stardew Access", "Author": "Mohammad Shoaib", - "Version": "1.3.4", + "Version": "1.3.5-alpha2", "Description": "An accessibility mod with screen reader support!", "UniqueID": "shoaib.stardewaccess", "EntryDll": "stardew-access.dll",