diff options
author | jani270 <69345714+jani270@users.noreply.github.com> | 2025-01-24 23:48:21 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-01-25 19:46:45 +0100 |
commit | a8dc0dc3be2679605880b1948c61b7dfe2f35f10 (patch) | |
tree | 4bc8fbd2586703de172a4e194e555ab7d226b60e /mod | |
parent | c7b1459c6f36a8c1fe0a1962c4a57a2aea447efe (diff) | |
download | LocalTransactionLedger-a8dc0dc3be2679605880b1948c61b7dfe2f35f10.tar.gz LocalTransactionLedger-a8dc0dc3be2679605880b1948c61b7dfe2f35f10.tar.bz2 LocalTransactionLedger-a8dc0dc3be2679605880b1948c61b7dfe2f35f10.zip |
feat: Ghost Coin Drop Detection
Diffstat (limited to 'mod')
-rw-r--r-- | mod/src/main/kotlin/moe/nea/ledger/Ledger.kt | 2 | ||||
-rw-r--r-- | mod/src/main/kotlin/moe/nea/ledger/modules/GhostCoinDropDetection.kt | 37 |
2 files changed, 39 insertions, 0 deletions
diff --git a/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt b/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt index 134d519..b126c4a 100644 --- a/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt +++ b/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt @@ -29,6 +29,7 @@ import moe.nea.ledger.modules.ExternalDataProvider import moe.nea.ledger.modules.EyedropsDetection import moe.nea.ledger.modules.ForgeDetection import moe.nea.ledger.modules.GambleDetection +import moe.nea.ledger.modules.GhostCoinDropDetection import moe.nea.ledger.modules.GodPotionDetection import moe.nea.ledger.modules.GodPotionMixinDetection import moe.nea.ledger.modules.GummyPolarBearDetection @@ -145,6 +146,7 @@ class Ledger { EyedropsDetection::class.java, ForgeDetection::class.java, GambleDetection::class.java, + GhostCoinDropDetection::class.java, GodPotionDetection::class.java, GodPotionMixinDetection::class.java, GummyPolarBearDetection::class.java, diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/GhostCoinDropDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/GhostCoinDropDetection.kt new file mode 100644 index 0000000..3b18ad2 --- /dev/null +++ b/mod/src/main/kotlin/moe/nea/ledger/modules/GhostCoinDropDetection.kt @@ -0,0 +1,37 @@ +package moe.nea.ledger.modules + +import moe.nea.ledger.ItemChange +import moe.nea.ledger.LedgerEntry +import moe.nea.ledger.LedgerLogger +import moe.nea.ledger.SHORT_NUMBER_PATTERN +import moe.nea.ledger.TransactionType +import moe.nea.ledger.events.ChatReceived +import moe.nea.ledger.parseShortNumber +import moe.nea.ledger.useMatcher +import moe.nea.ledger.utils.di.Inject +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class GhostCoinDropDetection { + + val ghostCoinPattern = + Pattern.compile("The ghost's death materialized (?<coins>$SHORT_NUMBER_PATTERN) coins from the mists!") + + @Inject + lateinit var logger: LedgerLogger + + @SubscribeEvent + fun onGhostCoinDrop(event: ChatReceived) { + ghostCoinPattern.useMatcher(event.message) { + logger.logEntry( + LedgerEntry( + TransactionType.GHOST_COIN_DROP, + event.timestamp, + listOf( + ItemChange.gainCoins(parseShortNumber(group("coins"))), + ) + ) + ) + } + } +} |