From e848b84935291d2bf9883602a6f2b35d2aaeb9df Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:51:00 +0200 Subject: Fix: Hot Potato Book in Community Project (#2214) --- src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index b662e10d4..5bafb370a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -294,11 +294,11 @@ object ItemUtils { private val itemAmountCache = mutableMapOf>() + private val bookPattern = "(?.* [IVX]+) Book".toPattern() + fun readItemAmount(originalInput: String): Pair? { // This workaround fixes 'Turbo Cacti I Book' - val input = (if (originalInput.endsWith(" Book")) { - originalInput.replace(" Book", "") - } else originalInput).removeResets() + val input = (bookPattern.matchMatcher(originalInput) { group("name") } ?: originalInput).removeResets() if (itemAmountCache.containsKey(input)) { return itemAmountCache[input]!! -- cgit