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 | |
parent | 084f8d2f172ddffad27ad6115a0d2add7bd8f2ee (diff) | |
download | LocalTransactionLedger-4d0de990e38632da9ad5c8b2d6ff90d259b2fcc6.tar.gz LocalTransactionLedger-4d0de990e38632da9ad5c8b2d6ff90d259b2fcc6.tar.bz2 LocalTransactionLedger-4d0de990e38632da9ad5c8b2d6ff90d259b2fcc6.zip |
feat: Add dragon eye placement
5 files changed, 67 insertions, 8 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemId.kt b/src/main/kotlin/moe/nea/ledger/ItemId.kt index 2b83357..56917e8 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemId.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemId.kt @@ -30,6 +30,8 @@ value class ItemId( val ARCHFIEND_LOW_CLASS = ItemId("ARCHFIEND_DICE") val ARCHFIEND_HIGH_CLASS = ItemId("HIGH_CLASS_ARCHFIEND_DICE") val ARCHFIEND_DYE = ItemId("DYE_ARCHFIEND") + val SLEEPING_EYE = ItemId("SLEEPING_EYE") + val SUMMONING_EYE = ItemId("SUMMONING_EYE") val DUNGEON_CHEST_KEY = ItemId("DUNGEON_CHEST_KEY") val BOOSTER_COOKIE = ItemId("BOOSTER_COOKIE") val KISMET_FEATHER = ItemId("KISMET_FEATHER") diff --git a/src/main/kotlin/moe/nea/ledger/Ledger.kt b/src/main/kotlin/moe/nea/ledger/Ledger.kt index 72bd32f..ee21efb 100644 --- a/src/main/kotlin/moe/nea/ledger/Ledger.kt +++ b/src/main/kotlin/moe/nea/ledger/Ledger.kt @@ -9,6 +9,7 @@ import moe.nea.ledger.database.Database import moe.nea.ledger.events.ChatReceived import moe.nea.ledger.events.LateWorldLoadEvent import moe.nea.ledger.events.RegistrationFinishedEvent +import moe.nea.ledger.events.WorldSwitchEvent import moe.nea.ledger.gen.BuildConfig import moe.nea.ledger.modules.AuctionHouseDetection import moe.nea.ledger.modules.BankDetection @@ -16,6 +17,7 @@ import moe.nea.ledger.modules.BazaarDetection import moe.nea.ledger.modules.BazaarOrderDetection import moe.nea.ledger.modules.BitsDetection import moe.nea.ledger.modules.BitsShopDetection +import moe.nea.ledger.modules.DragonEyePlacementDetection import moe.nea.ledger.modules.DungeonChestDetection import moe.nea.ledger.modules.ExternalDataProvider import moe.nea.ledger.modules.ForgeDetection @@ -114,29 +116,30 @@ class Ledger { BankDetection::class.java, BazaarDetection::class.java, BazaarOrderDetection::class.java, - DebugDataCommand::class.java, BitsDetection::class.java, BitsShopDetection::class.java, ConfigCommand::class.java, Database::class.java, + DebugDataCommand::class.java, + DragonEyePlacementDetection::class.java, DungeonChestDetection::class.java, ErrorUtil::class.java, ExternalDataProvider::class.java, + ForgeDetection::class.java, + GambleDetection::class.java, ItemIdProvider::class.java, KatDetection::class.java, KuudraChestDetection::class.java, LedgerLogger::class.java, LogChatCommand::class.java, - MinionDetection::class.java, + MinecraftExecutor::class.java, MineshaftCorpseDetection::class.java, - ForgeDetection::class.java, + MinionDetection::class.java, NpcDetection::class.java, - GambleDetection::class.java, - MinecraftExecutor::class.java, - UpdateChecker::class.java, - TriggerCommand::class.java, QueryCommand::class.java, RequestUtil::class.java, + TriggerCommand::class.java, + UpdateChecker::class.java, VisitorDetection::class.java, ) val errorUtil = di.provide<ErrorUtil>() @@ -160,6 +163,7 @@ class Ledger { fun worldSwitchEvent(event: EntityJoinWorldEvent) { if (event.entity == Minecraft.getMinecraft().thePlayer) { lastJoin = System.currentTimeMillis() + MinecraftForge.EVENT_BUS.post(WorldSwitchEvent()) } } diff --git a/src/main/kotlin/moe/nea/ledger/TransactionType.kt b/src/main/kotlin/moe/nea/ledger/TransactionType.kt index f6bbe6a..51105e2 100644 --- a/src/main/kotlin/moe/nea/ledger/TransactionType.kt +++ b/src/main/kotlin/moe/nea/ledger/TransactionType.kt @@ -15,9 +15,9 @@ enum class TransactionType { BOOSTER_COOKIE_ATE, COMMUNITY_SHOP_BUY, CORPSE_DESECRATED, - FORGED, DIE_ROLLED, DUNGEON_CHEST_OPEN, + FORGED, KAT_TIMESKIP, KAT_UPGRADE, KISMET_REROLL, @@ -25,4 +25,5 @@ enum class TransactionType { NPC_BUY, NPC_SELL, VISITOR_BARGAIN, + WYRM_EVOKED, }
\ No newline at end of file diff --git a/src/main/kotlin/moe/nea/ledger/events/WorldSwitchEvent.kt b/src/main/kotlin/moe/nea/ledger/events/WorldSwitchEvent.kt new file mode 100644 index 0000000..22a97f7 --- /dev/null +++ b/src/main/kotlin/moe/nea/ledger/events/WorldSwitchEvent.kt @@ -0,0 +1,6 @@ +package moe.nea.ledger.events + +import net.minecraftforge.fml.common.eventhandler.Event + +class WorldSwitchEvent : Event() { +}
\ No newline at end of file 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 |