aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-07-30 11:47:19 +0200
committerGitHub <noreply@github.com>2024-07-30 11:47:19 +0200
commit34649cff17d412c936eb13e27aaf0f1e939b763e (patch)
tree11d5e50c947869c25a7e15785baef73a9bbe555e /src/main
parent9a7d509cf07542ae23bda0b15ba27f22955b1e51 (diff)
downloadskyhanni-34649cff17d412c936eb13e27aaf0f1e939b763e.tar.gz
skyhanni-34649cff17d412c936eb13e27aaf0f1e939b763e.tar.bz2
skyhanni-34649cff17d412c936eb13e27aaf0f1e939b763e.zip
Fix: TunnelMaps values not clearing on lobby swap (#2275)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt125
1 files changed, 80 insertions, 45 deletions
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 2f4ad5476..b3e7c56c1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt
@@ -11,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.IslandChangeEvent
import at.hannibal2.skyhanni.events.ItemClickEvent
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
@@ -110,13 +111,13 @@ object TunnelsMaps {
}
private val oldGemstonePattern by RepoPattern.pattern(
- "mining.tunnels.maps.gem.old", ".*(?:Ruby|Amethyst|Jade|Sapphire|Amber|Topaz).*"
+ "mining.tunnels.maps.gem.old", ".*(?:Ruby|Amethyst|Jade|Sapphire|Amber|Topaz).*",
)
private val newGemstonePattern by RepoPattern.pattern(
- "mining.tunnels.maps.gem.new", ".*(?:Aquamarine|Onyx|Citrine|Peridot).*"
+ "mining.tunnels.maps.gem.new", ".*(?:Aquamarine|Onyx|Citrine|Peridot).*",
)
private val commissionInvPattern by RepoPattern.pattern(
- "mining.commission.inventory", "Commissions"
+ "mining.commission.inventory", "Commissions",
)
/**
@@ -125,19 +126,19 @@ object TunnelsMaps {
*/
private val glacitePattern by RepoPattern.pattern(
"mining.commisson.reward.glacite",
- "§7- §b[\\d,]+ Glacite Powder"
+ "§7- §b[\\d,]+ Glacite Powder",
)
private val collectorCommissionPattern by RepoPattern.pattern(
"mining.commisson.collector",
- "§9(?<what>\\w+(?: \\w+)?) Collector"
+ "§9(?<what>\\w+(?: \\w+)?) Collector",
)
private val invalidGoalPattern by RepoPattern.pattern(
"mining.commisson.collector.invalid",
- "Glacite|Scrap"
+ "Glacite|Scrap",
)
private val completedPattern by RepoPattern.pattern(
"mining.commisson.completed",
- "§a§lCOMPLETED"
+ "§a§lCOMPLETED",
)
private val translateTable = mutableMapOf<String, String>()
@@ -170,7 +171,7 @@ object TunnelsMaps {
"Unknown Collection Commission: $type", "$type can't be found in the graph.",
"type" to type,
"graphNames" to possibleLocations.keys,
- "lore" to lore
+ "lore" to lore,
)
null
} else {
@@ -234,7 +235,7 @@ object TunnelsMaps {
fun onConfigLoad(event: ConfigLoadEvent) {
onToggle(
config.compactGemstone,
- config.excludeFairy
+ config.excludeFairy,
) {
locationDisplay = generateLocationsDisplay()
}
@@ -247,21 +248,31 @@ object TunnelsMaps {
if (active.isNotEmpty()) {
if (goal == campfire && active != campfire.name) {
add(Renderable.string("§6Override for ${campfire.name}"))
- add(Renderable.clickable(Renderable.string("§eMake §f$active §eactive"), onClick = {
- goal = getNext()
- }))
+ add(
+ Renderable.clickable(
+ Renderable.string("§eMake §f$active §eactive"),
+ onClick = {
+ goal = getNext()
+ },
+ ),
+ )
} else {
add(
Renderable.clickAndHover(
Renderable.string("§6Active: §f$active"),
listOf("§eClick to disable current Waypoint"),
- onClick = ::clearPath
- )
+ onClick = ::clearPath,
+ ),
)
if (hasNext()) {
- add(Renderable.clickable(Renderable.string("§eNext Spot"), onClick = {
- goal = getNext()
- }))
+ add(
+ Renderable.clickable(
+ Renderable.string("§eNext Spot"),
+ onClick = {
+ goal = getNext()
+ },
+ ),
+ )
} else {
add(Renderable.string(""))
}
@@ -279,45 +290,61 @@ object TunnelsMaps {
add(Renderable.string("§6Locations:"))
add(
Renderable.multiClickAndHover(
- campfire.name!!, listOf(
- "§eLeft Click to set active", "§eRight Click for override"
- ), click = mapOf(
- 0 to guiSetActive(campfire.name!!), 1 to ::campfireOverride
- )
- )
+ campfire.name!!,
+ listOf(
+ "§eLeft Click to set active", "§eRight Click for override",
+ ),
+ click = mapOf(
+ 0 to guiSetActive(campfire.name!!), 1 to ::campfireOverride,
+ ),
+ ),
)
if (!config.excludeFairy.get()) {
- add(Renderable.hoverable(Renderable.horizontalContainer(listOf(Renderable.string("§dFairy Souls")) + fairySouls.map {
- val name = it.key.removePrefix("§dFairy Soul ")
- Renderable.clickable(Renderable.string("§d[${name}]"), onClick = guiSetActive(it.key))
- }), Renderable.string("§dFairy Souls")))
+ add(
+ Renderable.hoverable(
+ Renderable.horizontalContainer(
+ listOf(Renderable.string("§dFairy Souls")) + fairySouls.map {
+ val name = it.key.removePrefix("§dFairy Soul ")
+ Renderable.clickable(Renderable.string("§d[${name}]"), onClick = guiSetActive(it.key))
+ },
+ ),
+ Renderable.string("§dFairy Souls"),
+ ),
+ )
}
if (config.compactGemstone.get()) {
add(
Renderable.table(
listOf(
- newGemstones.map(::toCompactGemstoneName), oldGemstones.map(::toCompactGemstoneName)
- )
- )
+ newGemstones.map(::toCompactGemstoneName), oldGemstones.map(::toCompactGemstoneName),
+ ),
+ ),
)
} else {
- addAll(newGemstones.map {
- Renderable.clickable(Renderable.string(it.key), onClick = guiSetActive(it.key))
- })
- addAll(oldGemstones.map {
- Renderable.clickable(Renderable.string(it.key), onClick = guiSetActive(it.key))
- })
+ addAll(
+ newGemstones.map {
+ Renderable.clickable(Renderable.string(it.key), onClick = guiSetActive(it.key))
+ },
+ )
+ addAll(
+ oldGemstones.map {
+ Renderable.clickable(Renderable.string(it.key), onClick = guiSetActive(it.key))
+ },
+ )
}
- addAll(normalLocations.map {
- Renderable.clickable(Renderable.string(it.key), onClick = guiSetActive(it.key))
- })
+ addAll(
+ normalLocations.map {
+ Renderable.clickable(Renderable.string(it.key), onClick = guiSetActive(it.key))
+ },
+ )
}
private fun toCompactGemstoneName(it: Map.Entry<String, List<GraphNode>>): Renderable = Renderable.clickAndHover(
- Renderable.string((it.key.getFirstColorCode()?.let { "§$it" } ?: "") + ("ROUGH_".plus(
- it.key.removeColor().removeSuffix("stone")
- ).asInternalName().itemName.takeWhile { it != ' ' }.removeColor()),
- horizontalAlign = RenderUtils.HorizontalAlignment.CENTER
+ Renderable.string(
+ (it.key.getFirstColorCode()?.let { "§$it" } ?: "") + ("ROUGH_".plus(
+ it.key.removeColor().removeSuffix("stone"),
+ ).asInternalName().itemName.takeWhile { it != ' ' }.removeColor()),
+ horizontalAlign = RenderUtils.HorizontalAlignment.CENTER,
),
tips = listOf(it.key),
onClick = guiSetActive(it.key),
@@ -400,7 +427,7 @@ object TunnelsMaps {
config.pathWidth.toInt(),
true,
bezierPoint = 2.0,
- textSize = config.textSize.toDouble()
+ textSize = config.textSize.toDouble(),
)
event.drawDynamicText(
if (config.distanceFirst) {
@@ -410,7 +437,7 @@ object TunnelsMaps {
}.position,
"§e${path.second.roundToInt()}m",
config.textSize.toDouble(),
- yOff = 10f
+ yOff = 10f,
)
}
@@ -455,6 +482,14 @@ object TunnelsMaps {
}
}
+ @SubscribeEvent
+ fun onIslandChange(event: IslandChangeEvent) {
+ if (closedNote == null) return // Value that must be none null if it was active
+ closedNote = null
+ clearPath()
+ cooldowns.clear()
+ }
+
private var nextSpotDelay = SimpleTimeMark.farPast()
private fun nextSpotKey(event: LorenzKeyPressEvent) {