aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-01-16 20:46:41 +0100
committerLinnea Gräf <nea@nea.moe>2025-01-16 20:46:41 +0100
commit2cc7d668eacba1919208ba6b131b01fe10bbf0ed (patch)
tree8490092dbffcc729acc4a3679028ba633e395fae
parent0cb08682bc6b759a054066e145cb0332a40f42a7 (diff)
downloadLocalTransactionLedger-2cc7d668eacba1919208ba6b131b01fe10bbf0ed.tar.gz
LocalTransactionLedger-2cc7d668eacba1919208ba6b131b01fe10bbf0ed.tar.bz2
LocalTransactionLedger-2cc7d668eacba1919208ba6b131b01fe10bbf0ed.zip
refactor: Move some basetypes and fix: Kuudra chest and dungeon chest detection mixing
-rw-r--r--basetypes/src/main/kotlin/moe/nea/ledger/ItemId.kt (renamed from mod/src/main/kotlin/moe/nea/ledger/ItemId.kt)8
-rw-r--r--basetypes/src/main/kotlin/moe/nea/ledger/utils/RemoveInRelease.kt (renamed from mod/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.kt)2
-rw-r--r--build-src/build.gradle.kts1
-rw-r--r--build-src/src/main/kotlin/ledger-staged-proguard.gradle.kts1
-rw-r--r--build.gradle.kts10
-rw-r--r--mod/ledger-rules.pro2
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt1
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt8
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt1
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt1
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt2
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt1
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt1
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt1
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/KuudraChestDetection.kt3
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/VisitorDetection.kt3
16 files changed, 17 insertions, 29 deletions
diff --git a/mod/src/main/kotlin/moe/nea/ledger/ItemId.kt b/basetypes/src/main/kotlin/moe/nea/ledger/ItemId.kt
index 8211cd3..8dcfa27 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/ItemId.kt
+++ b/basetypes/src/main/kotlin/moe/nea/ledger/ItemId.kt
@@ -1,16 +1,16 @@
package moe.nea.ledger
-import moe.nea.ledger.utils.NoSideEffects
+import moe.nea.ledger.utils.RemoveInRelease
data class ItemId(
val string: String
) {
- @NoSideEffects
+ @RemoveInRelease
fun singleItem(): Pair<ItemId, Double> {
return withStackSize(1)
}
- @NoSideEffects
+ @RemoveInRelease
fun withStackSize(size: Number): Pair<ItemId, Double> {
return Pair(this, size.toDouble())
}
@@ -19,7 +19,7 @@ data class ItemId(
companion object {
@JvmStatic
- @NoSideEffects
+ @RemoveInRelease
fun forName(string: String) = ItemId(string)
fun skill(skill: String) = ItemId("SKYBLOCK_SKILL_$skill")
diff --git a/mod/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.kt b/basetypes/src/main/kotlin/moe/nea/ledger/utils/RemoveInRelease.kt
index 9b0e7a3..319fb63 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.kt
+++ b/basetypes/src/main/kotlin/moe/nea/ledger/utils/RemoveInRelease.kt
@@ -1,4 +1,4 @@
package moe.nea.ledger.utils
@Retention(AnnotationRetention.BINARY)
-annotation class NoSideEffects
+annotation class RemoveInRelease
diff --git a/build-src/build.gradle.kts b/build-src/build.gradle.kts
index 5e53bfc..8e90b7f 100644
--- a/build-src/build.gradle.kts
+++ b/build-src/build.gradle.kts
@@ -8,4 +8,5 @@ repositories {
dependencies {
implementation("com.google.code.gson:gson:2.9.1") // Match loom :)
implementation(gradleApi())
+ api("com.guardsquare:proguard-gradle:7.6.1")
}
diff --git a/build-src/src/main/kotlin/ledger-staged-proguard.gradle.kts b/build-src/src/main/kotlin/ledger-staged-proguard.gradle.kts
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/build-src/src/main/kotlin/ledger-staged-proguard.gradle.kts
@@ -0,0 +1 @@
+
diff --git a/build.gradle.kts b/build.gradle.kts
index b4583f1..171c811 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,19 +1,11 @@
import com.github.gmazzo.buildconfig.BuildConfigExtension
import java.io.ByteArrayOutputStream
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath("com.guardsquare:proguard-gradle:7.6.1")
- }
-}
-
plugins {
kotlin("jvm") version "2.0.20" apply false
id("com.github.gmazzo.buildconfig") version "5.5.0" apply false
id("ledger-globals")
+ id("com.github.johnrengelman.shadow") version "8.1.1" apply false
}
allprojects {
diff --git a/mod/ledger-rules.pro b/mod/ledger-rules.pro
index 32cd337..faa10c2 100644
--- a/mod/ledger-rules.pro
+++ b/mod/ledger-rules.pro
@@ -1,4 +1,4 @@
-keep class !moe.nea.ledger.gen.** {*;}
-dontobfuscate
--assumenosideeffects class ** { @moe.nea.ledger.utils.NoSideEffects <methods>; }
+-assumenosideeffects class ** { @moe.nea.ledger.utils.RemoveInRelease <methods>; }
#-dontoptimize
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt
index 44a0050..f0f5369 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/BitsDetection.kt
@@ -1,7 +1,6 @@
package moe.nea.ledger.modules
import moe.nea.ledger.ItemChange
-import moe.nea.ledger.ItemId
import moe.nea.ledger.events.ChatReceived
import moe.nea.ledger.events.LateWorldLoadEvent
import moe.nea.ledger.LedgerEntry
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt
index 553bebf..84185bf 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/BitsShopDetection.kt
@@ -22,10 +22,10 @@ class BitsShopDetection @Inject constructor(val ledger: LedgerLogger) {
data class BitShopEntry(
- val id: ItemId,
- val stackSize: Int,
- val bitPrice: Int,
- val timestamp: Long = System.currentTimeMillis()
+ val id: ItemId,
+ val stackSize: Int,
+ val bitPrice: Int,
+ val timestamp: Long = System.currentTimeMillis()
)
var lastClickedBitShopItem: BitShopEntry? = null
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt
index e389ffb..b7b9de1 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/DragonEyePlacementDetection.kt
@@ -1,7 +1,6 @@
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
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt
index 574cfcf..3bf36f9 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/DragonSacrificeDetection.kt
@@ -2,7 +2,6 @@ package moe.nea.ledger.modules
import moe.nea.ledger.DebouncedValue
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
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt
index e747be9..37d0e9c 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/DungeonChestDetection.kt
@@ -76,7 +76,7 @@ class DungeonChestDetection @Inject constructor(val logger: LedgerLogger) : Ches
}
}
- val rewardMessage = " (WOOD|GOLD|DIAMOND|EMERALD|OBSIDIAN|BEDROCK) CHEST REWARDS".toPattern()
+ val rewardMessage = " *(WOOD|GOLD|DIAMOND|EMERALD|OBSIDIAN|BEDROCK) CHEST REWARDS".toPattern()
@SubscribeEvent
fun onChatMessage(event: ChatReceived) {
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt
index 04dbe80..1c36ae4 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/EyedropsDetection.kt
@@ -1,7 +1,6 @@
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
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt
index a8f79c1..9149e14 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/GambleDetection.kt
@@ -1,7 +1,6 @@
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
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt
index ae86519..e858a6b 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/GodPotionDetection.kt
@@ -1,7 +1,6 @@
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
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/KuudraChestDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/KuudraChestDetection.kt
index e0e9322..88c45d2 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/KuudraChestDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/KuudraChestDetection.kt
@@ -36,6 +36,9 @@ class KuudraChestDetection : ChestDetection() {
if (requiredKey != null && !hasKey(requiredKey)) {
return
}
+ if (requiredKey == null && event.slotIn.inventory.name != "Free Chest") {
+ return
+ }
log.logEntry(LedgerEntry(
TransactionType.KUUDRA_CHEST_OPEN,
diffs.timestamp,
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/VisitorDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/VisitorDetection.kt
index f457ae4..5178e9f 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/VisitorDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/VisitorDetection.kt
@@ -5,15 +5,12 @@ import moe.nea.ledger.ItemId
import moe.nea.ledger.ItemIdProvider
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.events.ExtraSupplyIdEvent
import moe.nea.ledger.events.GuiClickEvent
import moe.nea.ledger.getDisplayNameU
import moe.nea.ledger.getLore
-import moe.nea.ledger.parseShortNumber
import moe.nea.ledger.unformattedString
-import moe.nea.ledger.useMatcher
import moe.nea.ledger.utils.di.Inject
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.time.Instant