diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-28 15:52:17 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-28 15:52:17 +0100 |
commit | c82d0b07033e02f7a6a23adbc1607ab3d41afdad (patch) | |
tree | bb48f950d7c4ed1ca96e087824ab6653500e0de4 /src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt | |
parent | 4d0de990e38632da9ad5c8b2d6ff90d259b2fcc6 (diff) | |
download | LocalTransactionLedger-c82d0b07033e02f7a6a23adbc1607ab3d41afdad.tar.gz LocalTransactionLedger-c82d0b07033e02f7a6a23adbc1607ab3d41afdad.tar.bz2 LocalTransactionLedger-c82d0b07033e02f7a6a23adbc1607ab3d41afdad.zip |
feat: Add draonic sacrifice tracker
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt index 7fe0206..4d85713 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt @@ -105,6 +105,7 @@ class ItemIdProvider { private val coinRegex = "(?<amount>$SHORT_NUMBER_PATTERN) Coins?".toPattern() private val stackedItemRegex = "(?<name>.*) x(?<count>$SHORT_NUMBER_PATTERN)".toPattern() + private val reverseStackedItemRegex = "(?<count>$SHORT_NUMBER_PATTERN)x (?<name>.*)".toPattern() private val essenceRegex = "(?<essence>.*) Essence x(?<count>$SHORT_NUMBER_PATTERN)".toPattern() private val numberedItemRegex = "(?<count>$SHORT_NUMBER_PATTERN) (?<what>.*)".toPattern() @@ -156,7 +157,14 @@ class ItemIdProvider { parseShortNumber(group("count"))) } stackedItemRegex.useMatcher(properName) { - var item = findForName(group("name"), fallbackToGenerated) + val item = findForName(group("name"), fallbackToGenerated) + if (item != null) { + val count = parseShortNumber(group("count")) + return Pair(item, count) + } + } + reverseStackedItemRegex.useMatcher(properName) { + val item = findForName(group("name"), fallbackToGenerated) if (item != null) { val count = parseShortNumber(group("count")) return Pair(item, count) |