diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-02 09:59:22 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-02 09:59:22 +0200 |
commit | 842a02b0c7a43a9157f220e5ca3f071f7c6be711 (patch) | |
tree | b980da1dc1e57b8a2ebab6680c191a0aaf1acb8e /src/main/java | |
parent | 34b6ac6b6f956c04ba565b109aa826880eef0661 (diff) | |
download | skyhanni-842a02b0c7a43a9157f220e5ca3f071f7c6be711.tar.gz skyhanni-842a02b0c7a43a9157f220e5ca3f071f7c6be711.tar.bz2 skyhanni-842a02b0c7a43a9157f220e5ca3f071f7c6be711.zip |
Added options to ignore the wizard and the crypt warp for diana.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java | 19 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt | 24 |
2 files changed, 31 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java index d5d46a0b1..3321e76e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java @@ -35,6 +35,25 @@ public class DianaConfig { public int keyBindWarp = Keyboard.KEY_NONE; @Expose + @ConfigOption(name = "Ignored Warps", desc = "") + @Accordion + public IgnoredWarpsConfig ignoredWarps = new IgnoredWarpsConfig(); + + public static class IgnoredWarpsConfig { + + @Expose + @ConfigOption(name = "Crypt", desc = "Ignore the crypt warp point (Because it takes a long time to leave).") + @ConfigEditorBoolean + public boolean crypt = false; + + @Expose + @ConfigOption(name = "Wizard", desc = "Ignore the wizard tower warp point (Because it is easy to fall into the rift).") + @ConfigEditorBoolean + public boolean wizard = false; + + } + + @Expose @ConfigOption(name = "Inquisitor Waypoint Sharing", desc = "") @Accordion @ConfigAccordionId(id = 9) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt index c58ff7d90..fe9efd09a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt @@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent import org.lwjgl.input.Keyboard class BurrowWarpHelper { + private val config get() = SkyHanniMod.feature.diana private var lastWarpTime = 0L private var lastWarp: WarpPoint? = null @@ -20,11 +21,11 @@ class BurrowWarpHelper { fun onKeyBindPressed(event: KeyInputEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.HUB) return - if (!SkyHanniMod.feature.diana.burrowNearestWarp) return + if (!config.burrowNearestWarp) return if (!Keyboard.getEventKeyState()) return val key = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey() - if (SkyHanniMod.feature.diana.keyBindWarp == key) { + if (config.keyBindWarp == key) { currentWarp?.let { if (System.currentTimeMillis() > lastWarpTime + 5_000) { lastWarpTime = System.currentTimeMillis() @@ -43,7 +44,7 @@ class BurrowWarpHelper { val time = System.currentTimeMillis() - lastWarpTime if (time < 1_000) { lastWarp?.let { - it.enabled = false + it.unlocked = false LorenzUtils.chat( "§e[SkyHanni] Detected not having access to warp point §b${it.displayName}§e!\n" + "§e[SkyHanni] Use §c/shresetburrowwarps §eonce you have activated this travel scroll." @@ -73,13 +74,12 @@ class BurrowWarpHelper { } } - private fun getNearestWarpPoint(location: LorenzVec): WarpPoint { - val map = WarpPoint.entries.filter { it.enabled }.map { it to it.distance(location) } - return map.sorted().first().first - } + private fun getNearestWarpPoint(location: LorenzVec) = + WarpPoint.entries.filter { it.unlocked && !it.ignored() }.map { it to it.distance(location) } + .sorted().first().first fun resetDisabledWarps() { - WarpPoint.entries.forEach { it.enabled = true } + WarpPoint.entries.forEach { it.unlocked = true } LorenzUtils.chat("§e[SkyHanni] Reset disabled burrow warps.") } } @@ -88,15 +88,15 @@ class BurrowWarpHelper { val displayName: String, private val location: LorenzVec, private val extraBlocks: Int, - var enabled: Boolean = true, + val ignored: () -> Boolean = { false }, + var unlocked: Boolean = true, ) { HUB("Hub", LorenzVec(-3, 70, -70), 2), CASTLE("Castle", LorenzVec(-250, 130, 45), 10), - - // CRYPT("Crypt", LorenzVec(-190, 74, -88), 25), + CRYPT("Crypt", LorenzVec(-190, 74, -88), 15, { SkyHanniMod.feature.diana.ignoredWarps.crypt }), DA("Dark Auction", LorenzVec(91, 74, 173), 2), MUSEUM("Museum", LorenzVec(-75, 76, 81), 2), - WIZARD("Wizard", LorenzVec(42.5, 122.0, 69.0), 5), + WIZARD("Wizard", LorenzVec(42.5, 122.0, 69.0), 5, { SkyHanniMod.feature.diana.ignoredWarps.wizard }), ; fun distance(other: LorenzVec): Double = other.distance(location) + extraBlocks |