diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-28 14:45:52 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-28 14:45:52 +0100 |
commit | 4d0de990e38632da9ad5c8b2d6ff90d259b2fcc6 (patch) | |
tree | 5e1333637dd0952efca193b3031a769376c7859e /src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt | |
parent | 084f8d2f172ddffad27ad6115a0d2add7bd8f2ee (diff) | |
download | LocalTransactionLedger-4d0de990e38632da9ad5c8b2d6ff90d259b2fcc6.tar.gz LocalTransactionLedger-4d0de990e38632da9ad5c8b2d6ff90d259b2fcc6.tar.bz2 LocalTransactionLedger-4d0de990e38632da9ad5c8b2d6ff90d259b2fcc6.zip |
feat: Add dragon eye placement
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt new file mode 100644 index 0000000..b9f70c4 --- /dev/null +++ b/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt @@ -0,0 +1,46 @@ +package moe.nea.ledger.modules + +import moe.nea.ledger.ItemChange +import moe.nea.ledger.ItemId +import moe.nea.ledger.LedgerEntry +import moe.nea.ledger.LedgerLogger +import moe.nea.ledger.TransactionType +import moe.nea.ledger.events.ChatReceived +import moe.nea.ledger.events.WorldSwitchEvent +import moe.nea.ledger.useMatcher +import moe.nea.ledger.utils.di.Inject +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class DragonEyePlacementDetection { + val eyePlaced = "☬ You placed a Summoning Eye!( Brace yourselves!)? \\(./.\\)".toPattern() +//☬ You placed a Summoning Eye! Brace yourselves! (8/8) + var eyeCount = 0 + + @SubscribeEvent + fun onWorldSwap(event: WorldSwitchEvent) { + eyeCount = 0 + } + + @SubscribeEvent + fun onRetrieveEye(event: ChatReceived) { + if (event.message == "You recovered a Summoning Eye!") { + eyeCount-- + } + eyePlaced.useMatcher(event.message) { + eyeCount++ + } + if (event.message == "Your Sleeping Eyes have been awoken by the magic of the Dragon. They are now Remnants of the Eye!") { + logger.logEntry(LedgerEntry( + TransactionType.WYRM_EVOKED, + event.timestamp, + listOf( + ItemChange.lose(ItemId.SUMMONING_EYE, eyeCount) + ) + )) + eyeCount = 0 + } + } + + @Inject + lateinit var logger: LedgerLogger +}
\ No newline at end of file |