diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-30 22:01:15 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-30 22:01:15 +0100 |
commit | 00aadb43fcf8d9557987f60f476a44f4b22a0c45 (patch) | |
tree | 5762122614144d247ec6a22126635f35200170d6 /src | |
parent | 1c0090ec301b87edebc29453287e585f88de2c4f (diff) | |
download | LocalTransactionLedger-00aadb43fcf8d9557987f60f476a44f4b22a0c45.tar.gz LocalTransactionLedger-00aadb43fcf8d9557987f60f476a44f4b22a0c45.tar.bz2 LocalTransactionLedger-00aadb43fcf8d9557987f60f476a44f4b22a0c45.zip |
refactor: Add more item ids
Diffstat (limited to 'src')
11 files changed, 26 insertions, 33 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemId.kt b/src/main/kotlin/moe/nea/ledger/ItemId.kt index f4786cd..ade63fb 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemId.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemId.kt @@ -22,25 +22,9 @@ data class ItemId( val FARMING = skill("FARMING") - val ARCHFIEND_DYE = ItemId("DYE_ARCHFIEND") - val ARCHFIEND_HIGH_CLASS = ItemId("HIGH_CLASS_ARCHFIEND_DICE") - val ARCHFIEND_LOW_CLASS = ItemId("ARCHFIEND_DICE") - val BITS = ItemId("SKYBLOCK_BIT") - val BOOSTER_COOKIE = ItemId("BOOSTER_COOKIE") - val CAP_EYEDROPS = ItemId("CAPSAICIN_EYEDROPS_NO_CHARGES") val COINS = ItemId("SKYBLOCK_COIN") - val COPPER = ItemId("SKYBLOCK_COPPER") - val DRAGON_ESSENCE = ItemId("ESSENCE_DRAGON") - val DUNGEON_CHEST_KEY = ItemId("DUNGEON_CHEST_KEY") - val FINE_FLOUR = ItemId("FINE_FLOUR") val GEMSTONE_POWDER = ItemId("SKYBLOCK_POWDER_GEMSTONE") - val GOD_POTION = ItemId("GOD_POTION_2") - val GOLD_ESSENCE = ItemId("ESSENCE_GOLD") - val KISMET_FEATHER = ItemId("KISMET_FEATHER") val MITHRIL_POWDER = ItemId("SKYBLOCK_POWDER_MITHRIL") val NIL = ItemId("SKYBLOCK_NIL") - val PELT = ItemId("SKYBLOCK_PELT") - val SLEEPING_EYE = ItemId("SLEEPING_EYE") - val SUMMONING_EYE = ItemId("SUMMONING_EYE") } }
\ 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/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/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 index 2b1a8cd..04dbe80 100644 --- a/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt +++ b/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.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 @@ -25,7 +26,7 @@ class EyedropsDetection { TransactionType.CAPSAICIN_EYEDROPS_USED, event.timestamp, listOf( - ItemChange.lose(ItemId.CAP_EYEDROPS, 1) + ItemChange.lose(ItemIds.CAPSAICIN_EYEDROPS_NO_CHARGES, 1) ) ) ) diff --git a/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt index 0ef43a2..a8f79c1 100644 --- a/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt +++ b/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt @@ -24,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") { diff --git a/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt b/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt index 806feb0..ae86519 100644 --- a/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt +++ b/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.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 @@ -25,7 +26,7 @@ class GodPotionDetection { TransactionType.GOD_POTION_DRANK, event.timestamp, listOf( - ItemChange.lose(ItemId.GOD_POTION, 1) + ItemChange.lose(ItemIds.GOD_POTION_2, 1) ) ) ) |