aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemId.kt29
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt11
-rw-r--r--src/main/kotlin/moe/nea/ledger/Ledger.kt6
-rw-r--r--src/main/kotlin/moe/nea/ledger/LedgerEntry.kt5
-rw-r--r--src/main/kotlin/moe/nea/ledger/TransactionType.kt3
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt5
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt5
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt3
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt3
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt3
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt35
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt5
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt35
-rw-r--r--src/main/kotlin/moe/nea/ledger/modules/GodPotionMixinDetection.kt38
-rw-r--r--src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java8
15 files changed, 161 insertions, 33 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemId.kt b/src/main/kotlin/moe/nea/ledger/ItemId.kt
index f627d08..8211cd3 100644
--- a/src/main/kotlin/moe/nea/ledger/ItemId.kt
+++ b/src/main/kotlin/moe/nea/ledger/ItemId.kt
@@ -1,40 +1,35 @@
package moe.nea.ledger
-@JvmInline
-value class ItemId(
+import moe.nea.ledger.utils.NoSideEffects
+
+data class ItemId(
val string: String
) {
+ @NoSideEffects
fun singleItem(): Pair<ItemId, Double> {
return withStackSize(1)
}
+ @NoSideEffects
fun withStackSize(size: Number): Pair<ItemId, Double> {
return Pair(this, size.toDouble())
}
companion object {
+
+ @JvmStatic
+ @NoSideEffects
+ fun forName(string: String) = ItemId(string)
fun skill(skill: String) = ItemId("SKYBLOCK_SKILL_$skill")
val GARDEN = skill("GARDEN")
val FARMING = skill("FARMING")
+
+
+ val COINS = ItemId("SKYBLOCK_COIN")
val GEMSTONE_POWDER = ItemId("SKYBLOCK_POWDER_GEMSTONE")
val MITHRIL_POWDER = ItemId("SKYBLOCK_POWDER_MITHRIL")
- val GOLD_ESSENCE = ItemId("ESSENCE_GOLD")
- val DRAGON_ESSENCE = ItemId("ESSENCE_DRAGON")
- val PELT = ItemId("SKYBLOCK_PELT")
- val COINS = ItemId("SKYBLOCK_COIN")
- val FINE_FLOUR = ItemId("FINE_FLOUR")
- 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 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")
}
} \ No newline at end of file
diff --git a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt
index 4d85713..0bacf32 100644
--- a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt
+++ b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt
@@ -4,6 +4,7 @@ import moe.nea.ledger.events.BeforeGuiAction
import moe.nea.ledger.events.ExtraSupplyIdEvent
import moe.nea.ledger.events.RegistrationFinishedEvent
import moe.nea.ledger.events.SupplyDebugInfo
+import moe.nea.ledger.gen.ItemIds
import moe.nea.ledger.modules.ExternalDataProvider
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
@@ -129,15 +130,15 @@ class ItemIdProvider {
}
etherialRewardPattern.useMatcher(properName) {
val id = when (val id = group("what")) {
- "Copper" -> ItemId.COPPER
- "Bits" -> ItemId.BITS
+ "Copper" -> ItemIds.SKYBLOCK_COPPER
+ "Bits" -> ItemIds.SKYBLOCK_BIT
"Garden Experience" -> ItemId.GARDEN
"Farming XP" -> ItemId.FARMING
- "Gold Essence" -> ItemId.GOLD_ESSENCE
+ "Gold Essence" -> ItemIds.ESSENCE_GOLD
"Gemstone Powder" -> ItemId.GEMSTONE_POWDER
"Mithril Powder" -> ItemId.MITHRIL_POWDER
- "Pelts" -> ItemId.PELT
- "Fine Flour" -> ItemId.FINE_FLOUR
+ "Pelts" -> ItemIds.SKYBLOCK_PELT
+ "Fine Flour" -> ItemIds.FINE_FLOUR
else -> {
id.ifDropLast(" Experience") {
ItemId.skill(generateName(it).string)
diff --git a/src/main/kotlin/moe/nea/ledger/Ledger.kt b/src/main/kotlin/moe/nea/ledger/Ledger.kt
index ed3c6a2..5682797 100644
--- a/src/main/kotlin/moe/nea/ledger/Ledger.kt
+++ b/src/main/kotlin/moe/nea/ledger/Ledger.kt
@@ -21,8 +21,11 @@ import moe.nea.ledger.modules.DragonEyePlacementDetection
import moe.nea.ledger.modules.`DragonSacrificeDetection`
import moe.nea.ledger.modules.DungeonChestDetection
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.GodPotionDetection
+import moe.nea.ledger.modules.GodPotionMixinDetection
import moe.nea.ledger.modules.KatDetection
import moe.nea.ledger.modules.KuudraChestDetection
import moe.nea.ledger.modules.MineshaftCorpseDetection
@@ -127,8 +130,11 @@ class Ledger {
DungeonChestDetection::class.java,
ErrorUtil::class.java,
ExternalDataProvider::class.java,
+ EyedropsDetection::class.java,
ForgeDetection::class.java,
GambleDetection::class.java,
+ GodPotionDetection::class.java,
+ GodPotionMixinDetection::class.java,
ItemIdProvider::class.java,
KatDetection::class.java,
KuudraChestDetection::class.java,
diff --git a/src/main/kotlin/moe/nea/ledger/LedgerEntry.kt b/src/main/kotlin/moe/nea/ledger/LedgerEntry.kt
index dec0727..ec5548f 100644
--- a/src/main/kotlin/moe/nea/ledger/LedgerEntry.kt
+++ b/src/main/kotlin/moe/nea/ledger/LedgerEntry.kt
@@ -1,6 +1,7 @@
package moe.nea.ledger
import com.google.gson.JsonObject
+import moe.nea.ledger.gen.ItemIds
import java.time.Instant
import java.util.UUID
@@ -10,8 +11,8 @@ data class LedgerEntry(
val items: List<ItemChange>,
) {
fun intoJson(profileId: UUID?): JsonObject {
- val coinAmount = items.find { it.itemId == ItemId.COINS || it.itemId == ItemId.BITS }?.count
- val nonCoins = items.find { it.itemId != ItemId.COINS && it.itemId != ItemId.BITS }
+ val coinAmount = items.find { it.itemId == ItemId.COINS || it.itemId == ItemIds.SKYBLOCK_BIT }?.count
+ val nonCoins = items.find { it.itemId != ItemId.COINS && it.itemId != ItemIds.SKYBLOCK_BIT }
return JsonObject().apply {
addProperty("transactionType", transactionType.name)
addProperty("timestamp", timestamp.toEpochMilli().toString())
diff --git a/src/main/kotlin/moe/nea/ledger/TransactionType.kt b/src/main/kotlin/moe/nea/ledger/TransactionType.kt
index 57f7535..26749d6 100644
--- a/src/main/kotlin/moe/nea/ledger/TransactionType.kt
+++ b/src/main/kotlin/moe/nea/ledger/TransactionType.kt
@@ -13,12 +13,15 @@ enum class TransactionType {
BAZAAR_SELL_ORDER,
BITS_PURSE_STATUS,
BOOSTER_COOKIE_ATE,
+ CAPSAICIN_EYEDROPS_USED,
COMMUNITY_SHOP_BUY,
CORPSE_DESECRATED,
DIE_ROLLED,
DRACONIC_SACRIFICE,
DUNGEON_CHEST_OPEN,
FORGED,
+ GOD_POTION_DRANK,
+ GOD_POTION_MIXIN_DRANK,
KAT_TIMESKIP,
KAT_UPGRADE,
KISMET_REROLL,
diff --git a/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt
index e4c3c98..44a0050 100644
--- a/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt
+++ b/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt
@@ -9,6 +9,7 @@ import moe.nea.ledger.LedgerLogger
import moe.nea.ledger.SHORT_NUMBER_PATTERN
import moe.nea.ledger.ScoreboardUtil
import moe.nea.ledger.TransactionType
+import moe.nea.ledger.gen.ItemIds
import moe.nea.ledger.parseShortNumber
import moe.nea.ledger.unformattedString
import moe.nea.ledger.useMatcher
@@ -33,7 +34,7 @@ class BitsDetection @Inject constructor(val ledger: LedgerLogger) {
TransactionType.BITS_PURSE_STATUS,
Instant.now(),
listOf(
- ItemChange(ItemId.BITS, bits.toDouble(), ItemChange.ChangeDirection.SYNC)
+ ItemChange(ItemIds.SKYBLOCK_BIT, bits.toDouble(), ItemChange.ChangeDirection.SYNC)
)
)
)
@@ -52,7 +53,7 @@ class BitsDetection @Inject constructor(val ledger: LedgerLogger) {
TransactionType.BOOSTER_COOKIE_ATE,
Instant.now(),
listOf(
- ItemChange.lose(ItemId.BOOSTER_COOKIE, 1)
+ ItemChange.lose(ItemIds.BOOSTER_COOKIE, 1)
)
)
)
diff --git a/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt
index d7e0a0d..553bebf 100644
--- a/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt
+++ b/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt
@@ -8,6 +8,7 @@ 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.gen.ItemIds
import moe.nea.ledger.getInternalId
import moe.nea.ledger.getLore
import moe.nea.ledger.parseShortNumber
@@ -54,8 +55,8 @@ class BitsShopDetection @Inject constructor(val ledger: LedgerLogger) {
TransactionType.COMMUNITY_SHOP_BUY,
Instant.now(),
listOf(
- ItemChange.lose(ItemId.BITS, lastBit.bitPrice.toDouble()),
- ItemChange.gain(lastBit.id, lastBit.stackSize)
+ ItemChange.lose(ItemIds.SKYBLOCK_BIT, lastBit.bitPrice.toDouble()),
+ ItemChange.gain(lastBit.id, lastBit.stackSize)
)
)
)
diff --git a/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt
index b9f70c4..e389ffb 100644
--- a/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt
+++ b/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt
@@ -7,6 +7,7 @@ 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.gen.ItemIds
import moe.nea.ledger.useMatcher
import moe.nea.ledger.utils.di.Inject
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -34,7 +35,7 @@ class DragonEyePlacementDetection {
TransactionType.WYRM_EVOKED,
event.timestamp,
listOf(
- ItemChange.lose(ItemId.SUMMONING_EYE, eyeCount)
+ ItemChange.lose(ItemIds.SUMMONING_EYE, eyeCount)
)
))
eyeCount = 0
diff --git a/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt
index 20934d2..574cfcf 100644
--- a/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt
+++ b/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt
@@ -9,6 +9,7 @@ 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.gen.ItemIds
import moe.nea.ledger.parseShortNumber
import moe.nea.ledger.useMatcher
import moe.nea.ledger.utils.di.Inject
@@ -43,7 +44,7 @@ class DragonSacrificeDetection {
event.timestamp,
listOf(
ItemChange.lose(sacrifice, 1),
- ItemChange.gain(ItemId.DRAGON_ESSENCE, lootEssence)
+ ItemChange.gain(ItemIds.ESSENCE_DRAGON, lootEssence)
)
))
}
diff --git a/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt
index feb452e..d61e386 100644
--- a/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt
+++ b/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt
@@ -9,6 +9,7 @@ import moe.nea.ledger.TransactionType
import moe.nea.ledger.events.ChatReceived
import moe.nea.ledger.events.ExtraSupplyIdEvent
import moe.nea.ledger.events.GuiClickEvent
+import moe.nea.ledger.gen.ItemIds
import moe.nea.ledger.getDisplayNameU
import moe.nea.ledger.unformattedString
import moe.nea.ledger.useMatcher
@@ -30,7 +31,7 @@ class DungeonChestDetection @Inject constructor(val logger: LedgerLogger) : Ches
TransactionType.KISMET_REROLL,
Instant.now(),
listOf(
- ItemChange.lose(ItemId.KISMET_FEATHER, 1)
+ ItemChange.lose(ItemIds.KISMET_FEATHER, 1)
)
)
)
diff --git a/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt
new file mode 100644
index 0000000..04dbe80
--- /dev/null
+++ b/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt
@@ -0,0 +1,35 @@
+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.gen.ItemIds
+import moe.nea.ledger.useMatcher
+import moe.nea.ledger.utils.di.Inject
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class EyedropsDetection {
+
+ val capsaicinEyedropsUsed = "You applied the eyedrops on the minion and ran out!".toPattern()
+
+ @Inject
+ lateinit var logger: LedgerLogger
+
+ @SubscribeEvent
+ fun onChat(event: ChatReceived) {
+ capsaicinEyedropsUsed.useMatcher(event.message) {
+ logger.logEntry(
+ LedgerEntry(
+ TransactionType.CAPSAICIN_EYEDROPS_USED,
+ event.timestamp,
+ listOf(
+ ItemChange.lose(ItemIds.CAPSAICIN_EYEDROPS_NO_CHARGES, 1)
+ )
+ )
+ )
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt
index 6a339d7..a8f79c1 100644
--- a/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt
+++ b/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt
@@ -6,6 +6,7 @@ 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.gen.ItemIds
import moe.nea.ledger.useMatcher
import moe.nea.ledger.utils.di.Inject
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -23,7 +24,7 @@ class GambleDetection {
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 item = if (isLowClass) ItemIds.ARCHFIEND_DICE else ItemIds.HIGH_CLASS_ARCHFIEND_DICE
val face = group("face")
val rollCost = if (isLowClass) 666_000.0 else 6_600_000.0
if (face == "7") {
@@ -33,7 +34,7 @@ class GambleDetection {
listOf(
ItemChange.lose(item, 1),
ItemChange.loseCoins(rollCost),
- ItemChange.gain(ItemId.ARCHFIEND_DYE, 1),
+ ItemChange.gain(ItemIds.DYE_ARCHFIEND, 1),
)
))
} else if (face == "6") {
diff --git a/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt
new file mode 100644
index 0000000..ae86519
--- /dev/null
+++ b/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt
@@ -0,0 +1,35 @@
+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.gen.ItemIds
+import moe.nea.ledger.useMatcher
+import moe.nea.ledger.utils.di.Inject
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class GodPotionDetection {
+
+ val godPotionDrank = "(SIP|SLURP|GULP|CHUGALUG)! The God Potion grants you powers for .*!".toPattern()
+
+ @Inject
+ lateinit var logger: LedgerLogger
+
+ @SubscribeEvent
+ fun onChat(event: ChatReceived) {
+ godPotionDrank.useMatcher(event.message) {
+ logger.logEntry(
+ LedgerEntry(
+ TransactionType.GOD_POTION_DRANK,
+ event.timestamp,
+ listOf(
+ ItemChange.lose(ItemIds.GOD_POTION_2, 1)
+ )
+ )
+ )
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/moe/nea/ledger/modules/GodPotionMixinDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/GodPotionMixinDetection.kt
new file mode 100644
index 0000000..b96a24a
--- /dev/null
+++ b/src/main/kotlin/moe/nea/ledger/modules/GodPotionMixinDetection.kt
@@ -0,0 +1,38 @@
+package moe.nea.ledger.modules
+
+import moe.nea.ledger.ItemChange
+import moe.nea.ledger.ItemId
+import moe.nea.ledger.ItemIdProvider
+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 GodPotionMixinDetection {
+
+ val godPotionMixinDrank = "SCHLURP! The (effects of the )?(?<what>.*?) (grants you effects|have been extended by) .*! They will pause if your God Potion expires.".toPattern()
+
+ @Inject
+ lateinit var logger: LedgerLogger
+
+ @Inject
+ lateinit var itemIdProvider: ItemIdProvider
+
+ @SubscribeEvent
+ fun onChat(event: ChatReceived) {
+ godPotionMixinDrank.useMatcher(event.message) {
+ logger.logEntry(
+ LedgerEntry(
+ TransactionType.GOD_POTION_MIXIN_DRANK,
+ event.timestamp,
+ listOf(
+ ItemChange.lose(itemIdProvider.findForName(group("what")) ?: ItemId.NIL, 1)
+ )
+ )
+ )
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java b/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java
new file mode 100644
index 0000000..f432130
--- /dev/null
+++ b/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java
@@ -0,0 +1,8 @@
+package moe.nea.ledger.utils;
+
+import kotlin.annotation.AnnotationRetention;
+import kotlin.annotation.Retention;
+
+@Retention(AnnotationRetention.BINARY)
+public @interface NoSideEffects {
+}