aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]!!