summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt13
2 files changed, 17 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
index e418f6043..348d05cb2 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import com.google.gson.GsonBuilder
import com.google.gson.annotations.Expose
import net.minecraft.item.ItemStack
@@ -41,7 +42,10 @@ object TestCopyBestiaryValues {
var bracket: Int = 0
}
- val pattern = "\\[Lv(?<lvl>.*)] (?<text>.*)".toPattern()
+ private val bestiaryTypePattern by RepoPattern.pattern(
+ "test.bestiary.type",
+ "\\[Lv(?<lvl>.*)] (?<text>.*)"
+ )
@SubscribeEvent(priority = EventPriority.LOW)
fun onLateInventoryOpen(event: InventoryUpdatedEvent) {
@@ -85,7 +89,7 @@ object TestCopyBestiaryValues {
for (i in 10..43) {
val stack = inventoryItems[i] ?: continue
val stackName = stack.name ?: continue
- pattern.matchMatcher(stackName.removeColor()) {
+ bestiaryTypePattern.matchMatcher(stackName.removeColor()) {
val lvl = group("lvl").toInt()
var text = group("text").lowercase().replace(" ", "_")
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt
index 5ab1effb7..9d2c0d3d4 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt
@@ -11,17 +11,26 @@ import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object TestCopyRngMeterValues {
+ private val patternGroup = RepoPattern.group("test.dev.copyrng")
+ private val slayerPattern by patternGroup.pattern(
+ "slayer",
+ "§7Slayer XP: §d.*§5/§d(?<xp>.*)"
+ )
+ private val dungeonPattern by patternGroup.pattern(
+ "dungeon",
+ "§7Dungeon Score: §d.*§5/§d(?<xp>.*)"
+ )
+
@SubscribeEvent
fun onInventoryOpen(event: InventoryFullyOpenedEvent) {
if (!SkyHanniMod.feature.dev.debug.copyRngMeter) return
val map = mutableMapOf<NEUInternalName, Long>()
- val slayerPattern = "§7Slayer XP: §d.*§5/§d(?<xp>.*)".toPattern()
- val dungeonPattern = "§7Dungeon Score: §d.*§5/§d(?<xp>.*)".toPattern()
for (item in event.inventoryItems.values) {
for (line in item.getLore()) {
slayerPattern.matchMatcher(line) {