diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-19 20:38:45 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-19 20:38:45 +0100 |
commit | 98857e6f70731b9e1d6bd19a51f992c9ca283f4c (patch) | |
tree | 8b74027edc4aba25d5e8b420b4f114d5629cabc8 /src/main | |
parent | eda44cb8743c709c15a7ed03381d05e43728e647 (diff) | |
download | LocalTransactionLedger-98857e6f70731b9e1d6bd19a51f992c9ca283f4c.tar.gz LocalTransactionLedger-98857e6f70731b9e1d6bd19a51f992c9ca283f4c.tar.bz2 LocalTransactionLedger-98857e6f70731b9e1d6bd19a51f992c9ca283f4c.zip |
feat: Archfiend gambling detection
Diffstat (limited to 'src/main')
5 files changed, 72 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemId.kt b/src/main/kotlin/moe/nea/ledger/ItemId.kt index 74f8e82..2b83357 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemId.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemId.kt @@ -27,6 +27,9 @@ value class ItemId( val BITS = ItemId("SKYBLOCK_BIT") val COPPER = ItemId("SKYBLOCK_COPPER") val NIL = ItemId("SKYBLOCK_NIL") + val ARCHFIEND_LOW_CLASS = ItemId("ARCHFIEND_DICE") + val ARCHFIEND_HIGH_CLASS = ItemId("HIGH_CLASS_ARCHFIEND_DICE") + val ARCHFIEND_DYE = ItemId("DYE_ARCHFIEND") 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 2d41a73..e5af95c 100644 --- a/src/main/kotlin/moe/nea/ledger/Ledger.kt +++ b/src/main/kotlin/moe/nea/ledger/Ledger.kt @@ -16,6 +16,7 @@ import moe.nea.ledger.modules.BitsDetection import moe.nea.ledger.modules.BitsShopDetection import moe.nea.ledger.modules.DungeonChestDetection import moe.nea.ledger.modules.ExternalDataProvider +import moe.nea.ledger.modules.GambleDetection import moe.nea.ledger.modules.KatDetection import moe.nea.ledger.modules.KuudraChestDetection import moe.nea.ledger.modules.MineshaftCorpseDetection @@ -118,6 +119,7 @@ class Ledger { MinionDetection::class.java, MineshaftCorpseDetection::class.java, NpcDetection::class.java, + GambleDetection::class.java, QueryCommand::class.java, RequestUtil::class.java, VisitorDetection::class.java, diff --git a/src/main/kotlin/moe/nea/ledger/TransactionType.kt b/src/main/kotlin/moe/nea/ledger/TransactionType.kt index 4e903d8..7521672 100644 --- a/src/main/kotlin/moe/nea/ledger/TransactionType.kt +++ b/src/main/kotlin/moe/nea/ledger/TransactionType.kt @@ -15,6 +15,7 @@ enum class TransactionType { BOOSTER_COOKIE_ATE, COMMUNITY_SHOP_BUY, CORPSE_DESECRATED, + DIE_ROLLED, DUNGEON_CHEST_OPEN, KAT_TIMESKIP, KAT_UPGRADE, diff --git a/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt new file mode 100644 index 0000000..6a339d7 --- /dev/null +++ b/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt @@ -0,0 +1,61 @@ +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.useMatcher +import moe.nea.ledger.utils.di.Inject +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class GambleDetection { + + val dieRolled = + "Your (?<isHighClass>High Class )?Archfiend Dice rolled a (?<face>[1-7])!.*" + .toPattern() + + @Inject + lateinit var logger: LedgerLogger + + @SubscribeEvent + fun onChat(event: ChatReceived) { + dieRolled.useMatcher(event.message) { + val isLowClass = group("isHighClass").isNullOrBlank() + val item = if (isLowClass) ItemId.ARCHFIEND_LOW_CLASS else ItemId.ARCHFIEND_HIGH_CLASS + val face = group("face") + val rollCost = if (isLowClass) 666_000.0 else 6_600_000.0 + if (face == "7") { + logger.logEntry(LedgerEntry( + TransactionType.DIE_ROLLED, + event.timestamp, + listOf( + ItemChange.lose(item, 1), + ItemChange.loseCoins(rollCost), + ItemChange.gain(ItemId.ARCHFIEND_DYE, 1), + ) + )) + } else if (face == "6") { + logger.logEntry(LedgerEntry( + TransactionType.DIE_ROLLED, + event.timestamp, + listOf( + ItemChange.lose(item, 1), + ItemChange.loseCoins(rollCost), + ItemChange.gainCoins(if (isLowClass) 15_000_000.0 else 100_000_000.0), + ) + )) + } else { + logger.logEntry(LedgerEntry( + TransactionType.DIE_ROLLED, + event.timestamp, + listOf( + ItemChange(item, 1.0, ItemChange.ChangeDirection.CATALYST), + ItemChange.loseCoins(rollCost), + ) + )) + } + } + } +}
\ No newline at end of file diff --git a/src/main/kotlin/moe/nea/ledger/modules/MineshaftCorpseDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/MineshaftCorpseDetection.kt index 85c9ad6..049ea39 100644 --- a/src/main/kotlin/moe/nea/ledger/modules/MineshaftCorpseDetection.kt +++ b/src/main/kotlin/moe/nea/ledger/modules/MineshaftCorpseDetection.kt @@ -10,6 +10,7 @@ import moe.nea.ledger.events.ChatReceived import moe.nea.ledger.matches import moe.nea.ledger.useMatcher import moe.nea.ledger.utils.BorderedTextTracker +import moe.nea.ledger.utils.di.Inject class MineshaftCorpseDetection : BorderedTextTracker() { /* @@ -69,6 +70,10 @@ class MineshaftCorpseDetection : BorderedTextTracker() { val corpseNameToKey = mapOf( "LAPIS" to ItemId.NIL ) + + @Inject lateinit var logger: LedgerLogger + + @Inject lateinit var itemIdProvider: ItemIdProvider }
\ No newline at end of file |