Skip to content

Commit

Permalink
option to disable button helper + improve rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
MTOnline69 committed Sep 29, 2024
1 parent 346ee77 commit b037f7b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ public class EnigmaSoulConfig {
@ConfigOption(name = "Color", desc = "Color of the Enigma Souls.")
@ConfigEditorColour
public String color = "0:245:219:27:198";

@Expose
@ConfigOption(name = "Buttons Helper", desc = "Help find all 56 wooden buttons required for the Buttons soul when tracking it.")
@ConfigEditorBoolean
public boolean showButtonsHelper = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object RiftAPI {
}

var inRiftRace = false
var showButtons = false
var trackingButtons = false
var allButtonsHit = false

fun inLivingCave() = LorenzUtils.skyBlockArea == "Living Cave"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ object WoodenButtonsHelper {
if (closestNode != currentSpot) {
currentSpot = closestNode
currentSpot?.let {
IslandGraphs.pathFind(it.position, "Button Spot", config.color.toChromaColor())
IslandGraphs.pathFind(it.position, "Button Spot", config.color.toChromaColor(), condition = { config.showPathFinder && config.showButtonsHelper })
}
}
}
Expand Down Expand Up @@ -167,18 +167,18 @@ object WoodenButtonsHelper {
val spot = currentSpot ?: return
val distance = spot.position.distanceToPlayer()
if (distance > 2.5) {
event.drawDynamicText(spot.position.add(y = 1), "Hit Buttons Here!", 1.5)
event.drawDynamicText(spot.position.add(y = 1), "Hit Buttons Here!", 1.25)
}

if (distance > 15.0) return
val spotName = "${spot.name}:${spot.position}"
buttonLocations[spotName]?.forEach { button ->
if (!hitButtons.contains(button)) {
event.drawWaypointFilled(button, config.color.toChromaColor(), minimumAlpha = 0F)
event.drawWaypointFilled(button, config.color.toChromaColor(), inverseAlphaScale = true)
}
}
}

private fun checkButtons() = RiftAPI.inRift() && !RiftAPI.allButtonsHit
private fun showButtons() = checkButtons() && RiftAPI.showButtons
fun showButtons() = checkButtons() && RiftAPI.trackingButtons && config.showButtonsHelper
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.render.gui.ReplaceItemEvent
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.features.rift.area.dreadfarm.WoodenButtonsHelper
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
Expand Down Expand Up @@ -89,8 +90,8 @@ object EnigmaSoulWaypoints {

if (event.slotId == 31 && inventoryUnfound.isNotEmpty()) {
event.makePickblock()
if ("Buttons" in inventoryUnfound) {
RiftAPI.showButtons = !RiftAPI.showButtons
if (inventoryUnfound.contains("Buttons")) {
RiftAPI.trackingButtons = !RiftAPI.trackingButtons
}
if (adding) {
trackedSouls.addAll(inventoryUnfound)
Expand All @@ -111,14 +112,14 @@ object EnigmaSoulWaypoints {
if (!soulLocations.contains(name)) return

if (name == "Buttons") {
RiftAPI.showButtons = !RiftAPI.showButtons
RiftAPI.trackingButtons = !RiftAPI.trackingButtons
}

if (!trackedSouls.contains(name)) {
ChatUtils.chat("§5Tracking the $name Enigma Soul!", prefixColor = "§5")
if (config.showPathFinder) {
soulLocations[name]?.let {
if (name != "Buttons" || RiftAPI.allButtonsHit) {
if (!(name == "Buttons" && WoodenButtonsHelper.showButtons())) {
IslandGraphs.pathFind(it, "$name Enigma Soul", config.color.toChromaColor(), condition = { config.showPathFinder })
}
}
Expand Down Expand Up @@ -198,7 +199,7 @@ object EnigmaSoulWaypoints {
trackedSouls.remove(closestSoul)
ChatUtils.chat("§5Found the $closestSoul Enigma Soul!", prefixColor = "§5")
if (closestSoul == "Buttons") {
RiftAPI.showButtons = false
RiftAPI.trackingButtons = false
}
}
}
Expand Down

0 comments on commit b037f7b

Please sign in to comment.