diff options
Diffstat (limited to 'src')
4 files changed, 77 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index 2a6b99297..2829bcb8d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.SlayerChangeEvent @@ -62,7 +63,7 @@ object SlayerAPI { return result } - fun getNameWithEnchantmentFor(internalName: NEUInternalName): String { + private fun getNameWithEnchantmentFor(internalName: NEUInternalName): String { if (internalName.asString() == "WISP_POTION") { return "§fWisp's Ice-Flavored Water" } @@ -70,6 +71,25 @@ object SlayerAPI { } @SubscribeEvent + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Slayer") + + if (!hasActiveSlayerQuest()) { + event.exit("no active slayer quest") + return + } + + event.addData( + buildList { + add("activeSlayer: ${getActiveSlayer()}") + add("isInCorrectArea: $isInCorrectArea") + add("isInAnyArea: $isInAnyArea") + add("latestSlayerProgress: $latestSlayerProgress") + } + ) + } + + @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/events/DebugDataCollectEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/DebugDataCollectEvent.kt index 1cb72c4f8..a53a144cf 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/DebugDataCollectEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/DebugDataCollectEvent.kt @@ -1,26 +1,42 @@ package at.hannibal2.skyhanni.events -class DebugDataCollectEvent(private val builder: StringBuilder) : LorenzEvent() { +import at.hannibal2.skyhanni.utils.StringUtils.equalsIgnoreColor + +class DebugDataCollectEvent(private val builder: StringBuilder, private val search: String?) : LorenzEvent() { private var currentTitle = "" + private var exit = false fun title(title: String) { - if (currentTitle != "") error("Title already set") + if (currentTitle != "") error("Title already set: '$currentTitle'") currentTitle = title } fun exit(text: String) { + exit = true addData(listOf(text)) } fun addData(text: List<String>) { if (currentTitle == "") error("Title not set") + writeData(text) + currentTitle = "" + exit = false + } - builder.append("\n$currentTitle\n") + private fun writeData(text: List<String>) { + if (exit && search == null) return + search?.let { + if (!search.equalsIgnoreColor("all")) { + if (!currentTitle.contains(search, ignoreCase = true)) { + return + } + } + } + builder.append("\n== $currentTitle ==\n") for (line in text) { builder.append(" $line\n") } - currentTitle = "" } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index 2840565df..fb141ad30 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.DungeonBossRoomEnterEvent import at.hannibal2.skyhanni.events.DungeonEnterEvent import at.hannibal2.skyhanni.events.DungeonStartEvent @@ -220,6 +221,29 @@ class DungeonAPI { } } + @SubscribeEvent + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Dungeon") + + if (!LorenzUtils.inDungeons) { + event.exit("not in dungeons") + return + } + + event.addData( + buildList { + add("dungeonFloor: $dungeonFloor") + add("started: $started") + add("getRoomID: ${getRoomID()}") + add("inBossRoom: $inBossRoom") + add("") + add("playerClass: $playerClass") + add("isUniqueClass: $isUniqueClass") + add("playerClassLevel: $playerClassLevel") + } + ) + } + enum class DungeonFloor(private val bossName: String) { ENTRANCE("The Watcher"), F1("Bonzo"), diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index e611757c3..2855662f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.HypixelData -import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -15,7 +14,6 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent -import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled @@ -42,6 +40,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils +import at.hannibal2.skyhanni.utils.StringUtils.equalsIgnoreColor import kotlinx.coroutines.launch import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiContainer @@ -381,29 +380,20 @@ class SkyHanniDebugsAndTests { builder.append("ironman: ${HypixelData.ironman}\n") builder.append("stranded: ${HypixelData.stranded}\n") builder.append("bingo: ${HypixelData.bingo}\n") + } - if (LorenzUtils.inDungeons) { - builder.append("\n") - builder.append("In dungeon!\n") - builder.append(" dungeonFloor: ${DungeonAPI.dungeonFloor}\n") - builder.append(" started: ${DungeonAPI.started}\n") - builder.append(" getRoomID: ${DungeonAPI.getRoomID()}\n") - builder.append(" inBossRoom: ${DungeonAPI.inBossRoom}\n") - builder.append(" ") - builder.append(" playerClass: ${DungeonAPI.playerClass}\n") - builder.append(" isUniqueClass: ${DungeonAPI.isUniqueClass}\n") - builder.append(" playerClassLevel: ${DungeonAPI.playerClassLevel}\n") - } - if (SlayerAPI.hasActiveSlayerQuest()) { - builder.append("\n") - builder.append("Doing slayer!\n") - builder.append(" activeSlayer: ${SlayerAPI.getActiveSlayer()}\n") - builder.append(" isInCorrectArea: ${SlayerAPI.isInCorrectArea}\n") - builder.append(" isInAnyArea: ${SlayerAPI.isInAnyArea}\n") + val search = args.getOrNull(0) + builder.append("\n") + if (search != null) { + if (search.equalsIgnoreColor("all")) { + builder.append("search for everything.\n") + } else { + builder.append("search: '$search'\n") } + } else { + builder.append("search not set.\n") } - - DebugDataCollectEvent(builder).postAndCatch() + DebugDataCollectEvent(builder, search).postAndCatch() builder.append("```") OSUtils.copyToClipboard(builder.toString()) |