aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-07-15 16:51:00 +0200
committerGitHub <noreply@github.com>2024-07-15 16:51:00 +0200
commite848b84935291d2bf9883602a6f2b35d2aaeb9df (patch)
tree9b038ee6d25b094930e4d9ecacce8ec55de332ad
parent005e676ca57f92adfaeea1d9726f652f7bc5aceb (diff)
downloadskyhanni-e848b84935291d2bf9883602a6f2b35d2aaeb9df.tar.gz
skyhanni-e848b84935291d2bf9883602a6f2b35d2aaeb9df.tar.bz2
skyhanni-e848b84935291d2bf9883602a6f2b35d2aaeb9df.zip
Fix: Hot Potato Book in Community Project (#2214)
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt6
1 files 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<String, Pair<String, Int>>()
+ private val bookPattern = "(?<name>.* [IVX]+) Book".toPattern()
+
fun readItemAmount(originalInput: String): Pair<String, Int>? {
// 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]!!