Fix inventory not speaking extra info; not respecting config option. Reduce excess commas. Bump version to 1.3.5-alpha2.

master
Katie Durden 2023-03-03 00:12:01 -08:00
parent 7bb4819601
commit 1c61580d6b
2 changed files with 18 additions and 12 deletions

View File

@ -10,21 +10,23 @@ namespace stardew_access.Features
internal static int prevSlotIndex = -999; internal static int prevSlotIndex = -999;
internal static bool narrateHoveredSlot(InventoryMenu inventoryMenu, List<ClickableComponent> inventory, IList<Item> actualInventory, int x, int y, internal static bool narrateHoveredSlot(InventoryMenu inventoryMenu, List<ClickableComponent> inventory, IList<Item> 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 = "") bool handleHighlightedItem = false, String highlightedItemPrefix = "", String highlightedItemSuffix = "")
{ {
if (narrateHoveredSlotAndReturnIndex(inventoryMenu, inventory, actualInventory, x, y, if (narrateHoveredSlotAndReturnIndex(inventoryMenu, inventory, actualInventory, x, y,
giveExtraDetails = false, hoverPrice = -1, extraItemToShowIndex = -1, extraItemToShowAmount = -1, giveExtraDetails, hoverPrice, extraItemToShowIndex, extraItemToShowAmount,
handleHighlightedItem = false, highlightedItemPrefix = "", highlightedItemSuffix = "") == -999) handleHighlightedItem, highlightedItemPrefix, highlightedItemSuffix) == -999)
return false; return false;
return true; return true;
} }
internal static int narrateHoveredSlotAndReturnIndex(InventoryMenu inventoryMenu, List<ClickableComponent> inventory, IList<Item> actualInventory, int x, int y, internal static int narrateHoveredSlotAndReturnIndex(InventoryMenu inventoryMenu, List<ClickableComponent> inventory, IList<Item> 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 = "") bool handleHighlightedItem = false, String highlightedItemPrefix = "", String highlightedItemSuffix = "")
{ {
if (giveExtraDetails is null)
giveExtraDetails = !MainClass.Config.DisableInventoryVerbosity;
for (int i = 0; i < inventory.Count; i++) for (int i = 0; i < inventory.Count; i++)
{ {
if (!inventory[i].containsPoint(x, y)) continue; if (!inventory[i].containsPoint(x, y)) continue;
@ -45,27 +47,31 @@ namespace stardew_access.Features
string name = $"{namePrefix}{actualInventory[i].DisplayName}{nameSuffix}"; string name = $"{namePrefix}{actualInventory[i].DisplayName}{nameSuffix}";
int stack = actualInventory[i].Stack; int stack = actualInventory[i].Stack;
string quality = getQualityFromItem(actualInventory[i]); string quality = getQualityFromItem(actualInventory[i]);
string healthNStamine = getHealthNStaminaFromItem(actualInventory[i]); string healthNStamina = getHealthNStaminaFromItem(actualInventory[i]);
string buffs = getBuffsFromItem(actualInventory[i]); string buffs = getBuffsFromItem(actualInventory[i]);
string description = actualInventory[i].getDescription(); string description = actualInventory[i].getDescription();
string price = getPrice(hoverPrice); string price = getPrice(hoverPrice);
string requirements = getExtraItemInfo(extraItemToShowIndex, extraItemToShowAmount); string requirements = getExtraItemInfo(extraItemToShowIndex, extraItemToShowAmount);
if (giveExtraDetails) string details;
if (giveExtraDetails == true)
{ {
if (stack > 1) 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 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 else
{ {
if (stack > 1) if (stack > 1)
toSpeak = $"{stack} {name} {quality}, \n{requirements}, \n{price}"; toSpeak = $"{stack} {name}"; //{quality}, \n{requirements}, \n{price}";
else 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); checkAndSpeak(toSpeak, i);
prevSlotIndex = i; prevSlotIndex = i;

View File

@ -1,7 +1,7 @@
{ {
"Name": "Stardew Access", "Name": "Stardew Access",
"Author": "Mohammad Shoaib", "Author": "Mohammad Shoaib",
"Version": "1.3.4", "Version": "1.3.5-alpha2",
"Description": "An accessibility mod with screen reader support!", "Description": "An accessibility mod with screen reader support!",
"UniqueID": "shoaib.stardewaccess", "UniqueID": "shoaib.stardewaccess",
"EntryDll": "stardew-access.dll", "EntryDll": "stardew-access.dll",