aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-18 09:54:24 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-18 09:54:24 +0200
commitf8c44bd3cc37ed479297f823284fbf515f45a2f3 (patch)
tree8105c6a84ef48cca9f6ccb69acc2cfb0f51c3614 /src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt
parent16dbd976dbd670d5210840b7cb8a91314ac74d23 (diff)
downloadskyhanni-f8c44bd3cc37ed479297f823284fbf515f45a2f3.tar.gz
skyhanni-f8c44bd3cc37ed479297f823284fbf515f45a2f3.tar.bz2
skyhanni-f8c44bd3cc37ed479297f823284fbf515f45a2f3.zip
Added debug option to copy rng meter values
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt
new file mode 100644
index 000000000..7c858df7f
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt
@@ -0,0 +1,38 @@
+package at.hannibal2.skyhanni.test
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigManager
+import at.hannibal2.skyhanni.events.InventoryOpenEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
+import at.hannibal2.skyhanni.utils.OSUtils
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object TestCopyRngMeterValues {
+
+ @SubscribeEvent
+ fun onInventoryOpen(event: InventoryOpenEvent) {
+ if (!SkyHanniMod.feature.dev.copyRngMeter) return
+
+ val map = mutableMapOf<String, 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) {
+ map[item.getInternalName()] = group("xp").formatNumber()
+ }
+ dungeonPattern.matchMatcher(line) {
+ map[item.getInternalName()] = group("xp").formatNumber()
+ }
+ }
+ }
+ if (map.isEmpty()) return
+
+ OSUtils.copyToClipboard(ConfigManager.gson.toJson(map))
+ LorenzUtils.debug("${map.size} items saved to clipboard.")
+ }
+} \ No newline at end of file