diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-16 20:48:23 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-16 20:48:23 +0200 |
commit | e05c91c7b7ed1ae2587ae4ac9b90caae9adceff5 (patch) | |
tree | 39694118f9525c5c7df6e048e78ad5b1f5bc2ead /src/main | |
parent | 8a24244b8e19830b074b8bc739abd1cc8c70fe98 (diff) | |
download | skyhanni-e05c91c7b7ed1ae2587ae4ac9b90caae9adceff5.tar.gz skyhanni-e05c91c7b7ed1ae2587ae4ac9b90caae9adceff5.tar.bz2 skyhanni-e05c91c7b7ed1ae2587ae4ac9b90caae9adceff5.zip |
migrate reputation helper config into crimson isle
Diffstat (limited to 'src/main')
6 files changed, 59 insertions, 55 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java index 3826f87b0..78746683c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java @@ -3,10 +3,8 @@ package at.hannibal2.skyhanni.config.features; import at.hannibal2.skyhanni.config.FeatureToggle; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; -import io.github.moulberry.moulconfig.annotations.Accordion; -import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; -import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; -import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.moulconfig.annotations.*; +import org.lwjgl.input.Keyboard; public class CrimsonIsleConfig { @@ -105,4 +103,37 @@ public class CrimsonIsleConfig { @Expose public Position nextResetCooldownPos = new Position(10, 10, false, true); } + + @ConfigOption(name = "Reputation Helper", desc = "") + @Accordion + @Expose + public ReputatioHelperConfig reputationHelper = new ReputatioHelperConfig(); + + public static class ReputatioHelperConfig { + + @Expose + @ConfigOption(name = "Enabled", desc = "Enable features around Reputation features in the Crimson Isle.") + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = true; + + @Expose + @ConfigOption(name = "Use Hotkey", desc = "Only show the Reputation Helper while pressing the hotkey.") + @ConfigEditorBoolean + public boolean useHotkey = false; + + @Expose + @ConfigOption(name = "Hotkey", desc = "Press this hotkey to show the Reputation Helper.") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) + public int hotkey = Keyboard.KEY_NONE; + + + @Expose + public Position position = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Show Locations", desc = "Crimson Isles waypoints for locations to get reputation.") + @ConfigEditorDropdown(values = {"Always", "Only With Hotkey", "Never"}) + public int showLocation = 1; + } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 39c79b509..e9ee4c08e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -137,40 +137,6 @@ public class MiscConfig { public Position nonGodPotEffectPos = new Position(10, 10, false, true); @Expose - @ConfigOption(name = "Crimson Reputation Helper", desc = "") - @ConfigEditorAccordion(id = 6) - public boolean reputationHelper = false; - - @Expose - @ConfigOption(name = "Crimson Isle Reputation", desc = "Enable features around Reputation features in the Crimson Isle.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 6) - @FeatureToggle - public boolean crimsonIsleReputationHelper = true; - - @Expose - @ConfigOption(name = "Use Hotkey", desc = "Only show the Reputation Helper while pressing the hotkey.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 6) - public boolean reputationHelperUseHotkey = false; - - @Expose - @ConfigOption(name = "Hotkey", desc = "Press this hotkey to show the Reputation Helper.") - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) - @ConfigAccordionId(id = 6) - public int reputationHelperHotkey = Keyboard.KEY_NONE; - - - @Expose - public Position crimsonIsleReputationHelperPos = new Position(10, 10, false, true); - - @Expose - @ConfigOption(name = "Show Locations", desc = "Crimson Isles waypoints for locations to get reputation.") - @ConfigEditorDropdown(values = {"Always", "Only With Hotkey", "Never"}) - @ConfigAccordionId(id = 6) - public int crimsonIsleReputationShowLocation = 1; - - @Expose @ConfigOption(name = "Tia Relay", desc = "") @ConfigEditorAccordion(id = 7) public boolean tiaRelay = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index cb5006aa7..be61e4c1c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -21,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { - val config get() = SkyHanniMod.feature.misc + val config get() = SkyHanniMod.feature.crimsonIsle.reputationHelper val questHelper = DailyQuestHelper(this) val miniBossHelper = DailyMiniBossHelper(this) @@ -64,7 +65,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - if (!config.crimsonIsleReputationHelper) return + if (!config.enabled) return if (!dirty && display.isEmpty()) { dirty = true } @@ -106,23 +107,32 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { @SubscribeEvent(priority = EventPriority.LOWEST) fun renderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { - if (!config.crimsonIsleReputationHelper) return + if (!config.enabled) return if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - if (config.reputationHelperUseHotkey) { - if (!OSUtils.isKeyHeld(config.reputationHelperHotkey)) { + if (config.useHotkey) { + if (!OSUtils.isKeyHeld(config.hotkey)) { return } } - config.crimsonIsleReputationHelperPos.renderStringsAndItems( + config.position.renderStringsAndItems( display, posLabel = "Crimson Isle Reputation Helper" ) } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "misc.crimsonIsleReputationHelper", "crimsonIsle.reputationHelper.enabled") + event.move(2, "misc.reputationHelperUseHotkey", "crimsonIsle.reputationHelper.useHotkey") + event.move(2, "misc.reputationHelperHotkey", "crimsonIsle.reputationHelper.hotkey") + event.move(2, "misc.crimsonIsleReputationHelperPos", "crimsonIsle.reputationHelper.position") + event.move(2, "misc.crimsonIsleReputationShowLocation", "crimsonIsle.reputationHelper.showLocation") + } + fun update() { ProfileStorageData.profileSpecific?.crimsonIsle?.let { questHelper.saveConfig(it) @@ -152,9 +162,9 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { return LorenzVec(x, y, z) } - fun showLocations() = when (config.crimsonIsleReputationShowLocation) { + fun showLocations() = when (config.showLocation) { 0 -> true - 1 -> OSUtils.isKeyHeld(config.reputationHelperHotkey) + 1 -> OSUtils.isKeyHeld(config.hotkey) else -> false } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt index bab45b0a9..79550595e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra -import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData @@ -26,7 +25,7 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH fun onRenderWorld(event: RenderWorldLastEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!reputationHelper.config.enabled) return if (!reputationHelper.showLocations()) return if (allKuudraDone) return @@ -40,7 +39,7 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.KUUDRA_ARENA) return - if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!reputationHelper.config.enabled) return val message = event.message if (!message.contains("KUUDRA DOWN!") || message.contains(":")) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index 1f5c7c081..424f51653 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest -import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.* @@ -15,6 +14,7 @@ import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraft.client.gui.inventory.GuiChest @@ -338,6 +338,5 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { storage.latestTrophyFishInInventory = latestTrophyFishInInventory } - private fun isEnabled() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE && - SkyHanniMod.feature.misc.crimsonIsleReputationHelper + private fun isEnabled() = IslandType.CRIMSON_ISLE.isInIsland() && reputationHelper.config.enabled }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt index 982551549..3263dc744 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss -import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -27,7 +26,7 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!reputationHelper.config.enabled) return val message = event.message for (miniBoss in miniBosses) { @@ -41,7 +40,7 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel fun onRenderWorld(event: RenderWorldLastEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!reputationHelper.config.enabled) return if (!reputationHelper.showLocations()) return val playerLocation = LocationUtils.playerLocation() |