diff options
5 files changed, 64 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 92a723707..cb85989c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -70,6 +70,7 @@ import at.hannibal2.skyhanni.features.slayer.SlayerProfitTracker import at.hannibal2.skyhanni.test.DebugCommand import at.hannibal2.skyhanni.test.GraphEditor import at.hannibal2.skyhanni.test.PacketTest +import at.hannibal2.skyhanni.test.SkyBlockIslandTest import at.hannibal2.skyhanni.test.SkyHanniConfigSearchResetCommand import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.test.TestBingo @@ -446,6 +447,10 @@ object Commands { "shtestgriffinspots", "Show potential griffin spots around you.", ) { GriffinBurrowHelper.testGriffinSpots() } + registerCommand( + "shtestisland", + "Sets the current skyblock island for testing purposes.", + ) { SkyBlockIslandTest.onCommand(it) } } private fun developersCodingHelp() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index edabad06a..6249ac295 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -31,6 +31,7 @@ import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.inAdvancedMiningIsland import at.hannibal2.skyhanni.utils.LorenzUtils.inAnyIsland import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -63,7 +64,7 @@ private fun onRemoval(line: String) { CustomScoreboardUtils.UndetectedScoreboardLines(message), message, "Unknown Lines" to confirmedUnknownLines, - "Island" to HypixelData.skyBlockIsland, + "Island" to LorenzUtils.skyBlockIsland, "Area" to HypixelData.skyBlockArea, "Full Scoreboard" to ScoreboardData.sidebarLinesFormatted, noStackTrace = true, @@ -509,7 +510,7 @@ private fun getNorthStarsShowWhen() = inAnyIsland(IslandType.WINTER) private fun getEmptyLineDisplayPair() = listOf("<empty>" to HorizontalAlignment.LEFT) private fun getIslandDisplayPair() = - listOf("§7㋖ §a" + HypixelData.skyBlockIsland.displayName to HorizontalAlignment.LEFT) + listOf("§7㋖ §a" + LorenzUtils.skyBlockIsland.displayName to HorizontalAlignment.LEFT) private fun getLocationDisplayPair() = buildList { HypixelData.skyBlockAreaWithSymbol?.let { add(it to HorizontalAlignment.LEFT) } diff --git a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt index 53543c261..76b729ae7 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt @@ -114,6 +114,16 @@ object DebugCommand { event.addData("Unknown SkyBlock island!") return } + + if (LorenzUtils.skyBlockIsland != HypixelData.skyBlockIsland) { + event.addData { + add("using a test island!") + add("test island: ${SkyBlockIslandTest.testIsland}") + add("real island: ${HypixelData.skyBlockIsland}") + } + return + } + event.addIrrelevant { add("on Hypixel SkyBlock") add("skyBlockIsland: ${LorenzUtils.skyBlockIsland}") diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyBlockIslandTest.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyBlockIslandTest.kt new file mode 100644 index 000000000..a797fd42e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyBlockIslandTest.kt @@ -0,0 +1,44 @@ +package at.hannibal2.skyhanni.test + +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.utils.ChatUtils + +object SkyBlockIslandTest { + + var testIsland: IslandType? = null + + fun onCommand(args: Array<String>) { + if (args.isEmpty()) { + ChatUtils.userError("Usage: /shtestisland <island name>/reset") + return + } + + val search = args.joinToString(" ").lowercase() + if (search == "reset") { + testIsland?.let { + ChatUtils.chat("Disabled test island (was ${it.displayName})") + testIsland = null + return + } + ChatUtils.chat("Test island was not set.") + return + } + val found = find(search) + if (found == null) { + ChatUtils.userError("Unknown island type! ($search)") + return + } + testIsland = found + ChatUtils.chat("Set test island to ${found.displayName}") + + } + + private fun find(search: String): IslandType? { + for (type in IslandType.values()) { + if (type.name.equals(search, ignoreCase = true)) return type + if (type.displayName.equals(search, ignoreCase = true)) return type + } + + return null + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index dbdfa86cc..ee9228609 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.features.misc.update.UpdateManager import at.hannibal2.skyhanni.features.misc.visualwords.ModifyVisualWords import at.hannibal2.skyhanni.features.nether.kuudra.KuudraAPI import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiEditSign +import at.hannibal2.skyhanni.test.SkyBlockIslandTest import at.hannibal2.skyhanni.test.TestBingo import at.hannibal2.skyhanni.utils.ChatUtils.lastButtonClicked import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull @@ -57,7 +58,7 @@ object LorenzUtils { /** * Consider using [IslandType.isInIsland] instead */ - val skyBlockIsland get() = HypixelData.skyBlockIsland + val skyBlockIsland get() = SkyBlockIslandTest.testIsland ?: HypixelData.skyBlockIsland val skyBlockArea get() = if (inSkyBlock) HypixelData.skyBlockArea else null |