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/java/at/hannibal2/skyhanni/features | |
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/java/at/hannibal2/skyhanni/features')
4 files changed, 24 insertions, 17 deletions
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() |