diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 10:03:22 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 10:03:22 +0200 |
commit | b292fbe448ebf15c5a00c4b552579bc15c525a2d (patch) | |
tree | 7ee5c44234ba29a5e7f3e2f03d88ab5247d3c532 /src/main | |
parent | 92c9d6e7982bbebf619c6b6352e06d0ac6b28228 (diff) | |
download | skyhanni-b292fbe448ebf15c5a00c4b552579bc15c525a2d.tar.gz skyhanni-b292fbe448ebf15c5a00c4b552579bc15c525a2d.tar.bz2 skyhanni-b292fbe448ebf15c5a00c4b552579bc15c525a2d.zip |
migrate tia relay and harp config into inventory helper
Diffstat (limited to 'src/main')
6 files changed, 87 insertions, 57 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 2339b1925..11bbd8c64 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -44,7 +44,7 @@ public class Features extends Config { public About about = new About(); @Expose - @Category(name = "GUI Locations", desc = "Change the locations of GUI elements. (§e/sh gui§7)") + @Category(name = "GUI", desc = "Change the locations of GUI elements. (§e/sh gui§7)") public GUIConfig gui = new GUIConfig(); @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java index 6bc3da6f3..827e63665 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java @@ -288,6 +288,62 @@ public class InventoryConfig { } @Expose + @ConfigOption(name = "Helper", desc = "") + @Accordion + public HelperConfig helper = new HelperConfig(); + + public static class HelperConfig { + @Expose + @ConfigOption(name = "Melody's Hair Harp", desc = "") + @Accordion + public HarpConfig harp = new HarpConfig(); + + public static class HarpConfig { + @Expose + @ConfigOption(name = "Use Keybinds", desc = "In the Harp, press buttons with your number row on the keyboard instead of clicking.") + @ConfigEditorBoolean + @FeatureToggle + public boolean keybinds = false; + + @Expose + @ConfigOption(name = "Show Numbers", desc = "In the Harp, show buttons as stack size (intended to be used with the Keybinds).") + @ConfigEditorBoolean + public boolean showNumbers = false; + } + + @Expose + @ConfigOption(name = "Tia Relay", desc = "") + @Accordion + public TiaRelayConfig tiaRelay = new TiaRelayConfig(); + + public static class TiaRelayConfig { + + @Expose + @ConfigOption(name = "Sound Puzzle Helper", desc = "Helps with solving the sound puzzle.") + @ConfigEditorBoolean + @FeatureToggle + public boolean soundHelper = true; + + @Expose + @ConfigOption(name = "Next Waypoint", desc = "Show the next relay waypoint for Tia the Fairy, where maintenance for the Abiphone network needs to be done.") + @ConfigEditorBoolean + @FeatureToggle + public boolean nextWaypoint = true; + + @Expose + @ConfigOption(name = "All Waypoints", desc = "Show all relay waypoints at once (intended for debugging).") + @ConfigEditorBoolean + public boolean allWaypoints = false; + + @Expose + @ConfigOption(name = "Mute Sound", desc = "Mutes the sound when close to the relay.") + @ConfigEditorBoolean + @FeatureToggle + public boolean tiaRelayMute = true; + } + } + + @Expose @ConfigOption( name = "Item number", desc = "Showing the item number as a stack size for these items." 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 e994fb21a..9ea25e9cf 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -125,38 +125,6 @@ public class MiscConfig { public Position nonGodPotEffectPos = new Position(10, 10, false, true); @Expose - @ConfigOption(name = "Tia Relay", desc = "") - @ConfigEditorAccordion(id = 7) - public boolean tiaRelay = false; - - @Expose - @ConfigOption(name = "Tia Relay Waypoint", desc = "Show the next relay waypoint for Tia the Fairy, where maintenance for the Abiphone network needs to be done.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 7) - @FeatureToggle - public boolean tiaRelayNextWaypoint = true; - - @Expose - @ConfigOption(name = "Tia Relay All", desc = "Show all relay waypoints at once.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 7) - public boolean tiaRelayAllWaypoints = false; - - @Expose - @ConfigOption(name = "Tia Relay Helper", desc = "Helps with solving the sound puzzle.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 7) - @FeatureToggle - public boolean tiaRelayHelper = true; - - @Expose - @ConfigOption(name = "Tia Relay Mute", desc = "Mutes the sound when close to the relay.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 7) - @FeatureToggle - public boolean tiaRelayMute = true; - - @Expose @ConfigOption(name = "Tps Display", desc = "") @ConfigEditorAccordion(id = 8) public boolean tpsDisplay = false; @@ -836,17 +804,6 @@ public class MiscConfig { @FeatureToggle public boolean patcherSendCoordWaypoint = false; - @Expose - @ConfigOption(name = "Harp Keybinds", desc = "In Melody's Harp, press buttons with your number row on the keyboard instead of clicking.") - @ConfigEditorBoolean - @FeatureToggle - public boolean harpKeybinds = false; - - @Expose - @ConfigOption(name = "Harp Numbers", desc = "In Melody's Harp, show buttons as stack size (intended to be used with Harp Keybinds).") - @ConfigEditorBoolean - @FeatureToggle - public boolean harpNumbers = false; @Expose @ConfigOption(name = "Account Upgrade Reminder", desc = "Remind you to claim account upgrades when complete.") @@ -868,6 +825,4 @@ public class MiscConfig { @Expose public Position inventoryLoadPos = new Position(394, 124, false, true); - - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt index b05908f9d..72cad7e00 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils.openInventoryName import at.hannibal2.skyhanni.utils.LorenzUtils @@ -16,7 +17,7 @@ import kotlin.time.Duration.Companion.milliseconds // Delaying key presses by 300ms comes from NotEnoughUpdates class HarpFeatures { - private val config get() = SkyHanniMod.feature.misc + private val config get() = SkyHanniMod.feature.inventory.helper.harp private var lastClick = SimpleTimeMark.farPast() private val keys = listOf( @@ -34,7 +35,7 @@ class HarpFeatures { @SubscribeEvent fun onGui(event: GuiScreenEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.harpKeybinds) return + if (!config.keybinds) return if (!openInventoryName().startsWith("Harp")) return val chest = event.gui as? GuiChest ?: return @@ -58,7 +59,7 @@ class HarpFeatures { @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.harpNumbers) return + if (!config.showNumbers) return if (!openInventoryName().startsWith("Harp")) return if (Item.getIdFromItem(event.stack.item) != 159) return // Stained hardened clay item id = 159 @@ -68,4 +69,10 @@ class HarpFeatures { event.stackTip = (index + 1).toString() } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "misc.harpKeybinds", "inventory.helper.harp.keybinds") + event.move(2, "misc.harpNumbers", "inventory.helper.harp.showNumbers") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt index 0d725b7d8..be912f393 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.tiarelay import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.PlaySoundEvent @@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TiaRelayHelper { + private val config get() = SkyHanniMod.feature.inventory.helper.tiaRelay private var inInventory = false private var lastClickSlot = 0 @@ -25,13 +27,13 @@ class TiaRelayHelper { if (!LorenzUtils.inSkyBlock) return val soundName = event.soundName - if (SkyHanniMod.feature.misc.tiaRelayMute) { + if (config.tiaRelayMute) { if (soundName == "mob.wolf.whine") { event.isCanceled = true } } - if (!SkyHanniMod.feature.misc.tiaRelayHelper) return + if (!config.soundHelper) return if (!inInventory) return val distance = event.distanceToPlayer @@ -52,7 +54,7 @@ class TiaRelayHelper { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.misc.tiaRelayHelper) return + if (!config.soundHelper) return if (event.repeatSeconds(1)) { if (InventoryUtils.openInventoryName().contains("Network Relay")) { @@ -94,7 +96,7 @@ class TiaRelayHelper { @SubscribeEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.misc.tiaRelayHelper) return + if (!config.soundHelper) return if (!inInventory) return val slot = event.slot @@ -125,7 +127,7 @@ class TiaRelayHelper { @SubscribeEvent fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.misc.tiaRelayHelper) return + if (!config.soundHelper) return if (!inInventory) return // only listen to right clicks @@ -135,5 +137,14 @@ class TiaRelayHelper { lastClickTime = System.currentTimeMillis() } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "misc.tiaRelayMute", "inventory.helper.tiaRelay.tiaRelayMute") + event.move(2, "misc.tiaRelayHelper", "inventory.helper.tiaRelay.soundHelper") + + event.move(2, "misc.tiaRelayNextWaypoint", "inventory.helper.tiaRelay.nextWaypoint") + event.move(2, "misc.tiaRelayAllWaypoints", "inventory.helper.tiaRelay.allWaypoints") + } + class Sound(val name: String, val pitch: Float) }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt index 7bfc45ae9..ff411c44b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt @@ -12,6 +12,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TiaRelayWaypoints { + private val config get() = SkyHanniMod.feature.inventory.helper.tiaRelay private var waypoint: LorenzVec? = null private var waypointName: String? = null private var island = IslandType.NONE @@ -19,7 +20,7 @@ class TiaRelayWaypoints { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.misc.tiaRelayNextWaypoint) return + if (!config.nextWaypoint) return val message = event.message for (relay in Relay.entries) { @@ -41,7 +42,7 @@ class TiaRelayWaypoints { fun onRenderWorld(event: RenderWorldLastEvent) { if (!LorenzUtils.inSkyBlock) return - if (SkyHanniMod.feature.misc.tiaRelayAllWaypoints) { + if (config.allWaypoints) { for (relay in Relay.entries) { if (relay.island == LorenzUtils.skyBlockIsland) { event.drawWaypointFilled(relay.waypoint, LorenzColor.LIGHT_PURPLE.toColor()) @@ -51,7 +52,7 @@ class TiaRelayWaypoints { return } - if (!SkyHanniMod.feature.misc.tiaRelayNextWaypoint) return + if (!config.nextWaypoint) return if (LorenzUtils.skyBlockIsland != island) return waypoint?.let { |