From 2cd351d816b7dad8c3251fcd640ff697335598a6 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sat, 21 Dec 2024 01:54:06 +0100 Subject: feat: Add support for chocolate and copper to npc buys --- src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt') diff --git a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt index 72f1d09..7fe0206 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt @@ -106,6 +106,7 @@ class ItemIdProvider { private val coinRegex = "(?$SHORT_NUMBER_PATTERN) Coins?".toPattern() private val stackedItemRegex = "(?.*) x(?$SHORT_NUMBER_PATTERN)".toPattern() private val essenceRegex = "(?.*) Essence x(?$SHORT_NUMBER_PATTERN)".toPattern() + private val numberedItemRegex = "(?$SHORT_NUMBER_PATTERN) (?.*)".toPattern() fun findCostItemsFromSpan(lore: List): List> { return lore.iterator().asSequence() @@ -161,6 +162,14 @@ class ItemIdProvider { return Pair(item, count) } } + numberedItemRegex.useMatcher(properName) { + val item = findForName(group("what"), fallbackToGenerated) + if (item != null) { + val count = parseShortNumber(group("count")) + return Pair(item, count) + } + } + return findForName(properName, fallbackToGenerated)?.let { Pair(it, 1.0) } } -- cgit