Skip to content

Commit

Permalink
Fix: Hot Potato Book in Community Project (#2214)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsEmpa authored Jul 15, 2024
1 parent 005e676 commit e848b84
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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]!!
Expand Down

0 comments on commit e848b84

Please sign in to comment.