aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-07-21 12:05:30 +0200
committerGitHub <noreply@github.com>2024-07-21 12:05:30 +0200
commit3b80141b255ab6099e8dfdd12912e76798b9df19 (patch)
tree4cd07ea7b749122f4792a23aeed5d3a9c872fd44 /src/main/java
parent1da1de3da35f7f98f582967368be51b50278aa5b (diff)
downloadskyhanni-3b80141b255ab6099e8dfdd12912e76798b9df19.tar.gz
skyhanni-3b80141b255ab6099e8dfdd12912e76798b9df19.tar.bz2
skyhanni-3b80141b255ab6099e8dfdd12912e76798b9df19.zip
Improvement: Royal Pigeon Left Click (#2181)
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/mining/TunnelMapsConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt26
2 files changed, 25 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/TunnelMapsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/TunnelMapsConfig.java
index b6340f164..5ff38b346 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/TunnelMapsConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/TunnelMapsConfig.java
@@ -45,6 +45,11 @@ public class TunnelMapsConfig {
public int nextSpotHotkey = Keyboard.KEY_NONE;
@Expose
+ @ConfigOption(name = "Left Click Pigeon", desc = "Left click the Royal Pigeon to go to the next spot.")
+ @ConfigEditorBoolean
+ public boolean leftClickPigeon = true;
+
+ @Expose
@ConfigOption(name = "Dynamic Path Colour", desc = "Instead of the selected color use the color of the target as line colour.")
@ConfigEditorBoolean
public boolean dynamicPathColour = true;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt
index 18d4c250e..2f4ad5476 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.mining
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.ClickType
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.model.Graph
import at.hannibal2.skyhanni.data.model.GraphNode
@@ -10,6 +11,7 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
+import at.hannibal2.skyhanni.events.ItemClickEvent
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
@@ -24,6 +26,7 @@ import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.HypixelCommands
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.LocationUtils
@@ -141,11 +144,13 @@ object TunnelsMaps {
/** @return Errors with an empty String */
private fun getGenericName(input: String): String = translateTable.getOrPut(input) {
- possibleLocations.keys.firstOrNull() { it.uppercase().removeColor().contains(input.uppercase()) } ?: ""
+ possibleLocations.keys.firstOrNull { it.uppercase().removeColor().contains(input.uppercase()) } ?: ""
}
private var clickTranslate = mapOf<Int, String>()
+ private val ROYAL_PIGEON by lazy { "ROYAL_PIGEON".asInternalName() }
+
@SubscribeEvent
fun onInventoryFullyOpened(event: InventoryFullyOpenedEvent) {
if (!isEnabled()) return
@@ -423,6 +428,14 @@ object TunnelsMaps {
nextSpotKey(event)
}
+ @SubscribeEvent
+ fun onItemClick(event: ItemClickEvent) {
+ if (!isEnabled() || !config.leftClickPigeon) return
+ if (event.clickType != ClickType.LEFT_CLICK) return
+ if (event.itemInHand?.getInternalNameOrNull() != ROYAL_PIGEON) return
+ nextSpot()
+ }
+
private fun campfireKey(event: LorenzKeyPressEvent) {
if (event.keyCode != config.campfireKey) return
if (config.travelScroll) {
@@ -446,15 +459,16 @@ object TunnelsMaps {
private fun nextSpotKey(event: LorenzKeyPressEvent) {
if (event.keyCode != config.nextSpotHotkey) return
+ nextSpot()
+ }
+
+ private fun nextSpot() {
if (!nextSpotDelay.isInPast()) return
nextSpotDelay = 0.5.seconds.fromNow()
goal = getNext()
}
- val areas = setOf(
- "Glacite Tunnels", "Dwarven Base Camp", "Glacite Lake", "Fossil Research Center"
- )
+ private val areas = setOf("Glacite Tunnels", "Dwarven Base Camp", "Glacite Lake", "Fossil Research Center")
- private fun isEnabled() =
- IslandType.DWARVEN_MINES.isInIsland() && config.enable && areas.contains(LorenzUtils.skyBlockArea)
+ private fun isEnabled() = IslandType.DWARVEN_MINES.isInIsland() && config.enable && LorenzUtils.skyBlockArea in areas
}