aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-25 14:00:06 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-25 14:00:06 +0200
commit22dc47339138945b60b1c417f6429d17cb2faea2 (patch)
treeffd98cd6d76fa269852434f282a66bcaedc6f960 /src/main/java/at/hannibal2/skyhanni/features
parent56a1aa791f44fa8e3f80d2e511a5b0bb61e09dc3 (diff)
downloadskyhanni-22dc47339138945b60b1c417f6429d17cb2faea2.tar.gz
skyhanni-22dc47339138945b60b1c417f6429d17cb2faea2.tar.bz2
skyhanni-22dc47339138945b60b1c417f6429d17cb2faea2.zip
used java pojo object for EnigmaSouls
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt
index 0571b8851..08cfa0753 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt
@@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.jsonobjects.EnigmaSoulsJson
import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent
import io.github.moulberry.notenoughupdates.events.SlotClickEvent
import io.github.moulberry.notenoughupdates.util.Utils
@@ -130,26 +131,21 @@ object EnigmaSoulWaypoints {
fun onRenderWorld(event: RenderWorldLastEvent) {
if (!RiftAPI.inRift()) return
for (soul in trackedSouls) {
- soulLocations[soul]?.let { event.drawWaypointFilled(it, LorenzColor.DARK_PURPLE.toColor(), true, true) }
- soulLocations[soul]?.let { event.drawDynamicText(it.add(0, 1, 0), "§5$soul Soul", 1.0) }
+ soulLocations[soul]?.let {
+ event.drawWaypointFilled(it, LorenzColor.DARK_PURPLE.toColor(), seeThroughBlocks = true, beacon = true)
+ event.drawDynamicText(it.add(0, 1, 0), "§5$soul Soul", 1.5)
+ }
}
}
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
- val data = event.getConstant("EnigmaSouls") ?: return
-
- for (area in data.entrySet()) {
- val element = area.value.asJsonArray
-
- for (i in 0 until element.size()) {
- val itemObject = element[i].asJsonObject
- val name = itemObject["name"].asString
- val position = itemObject["position"].asString
- val split = position.split(", ")
- if (split.size == 3) {
- soulLocations[name] = LorenzVec(split[0].toDouble(), split[1].toDouble(), split[2].toDouble())
- }
+ val data = event.getConstant<EnigmaSoulsJson>("EnigmaSouls") ?: return
+ val areas = data.areas ?: error("'areas' is null in EnigmaSouls!")
+ soulLocations.clear()
+ for ((area, locations) in areas) {
+ for (location in locations) {
+ soulLocations[location.name] = location.position
}
}
}
@@ -158,7 +154,6 @@ object EnigmaSoulWaypoints {
fun onChat(event: LorenzChatEvent) {
if (!RiftAPI.inRift()) return
val message = event.message.removeColor().trim()
- // not sure how this works for buying the souls
if (message == "You have already found that Enigma Soul!" || message == "SOUL! You unlocked an Enigma Soul!") {
hideClosestSoul()
}
@@ -168,13 +163,15 @@ object EnigmaSoulWaypoints {
var closestSoul = ""
var closestDistance = 8.0
- for (soul in soulLocations) {
- if (soul.value.distanceToPlayer() < closestDistance) {
- closestSoul = soul.key
- closestDistance = soul.value.distanceToPlayer()
+ for ((soul, location) in soulLocations) {
+ if (location.distanceToPlayer() < closestDistance) {
+ closestSoul = soul
+ closestDistance = location.distanceToPlayer()
}
}
- trackedSouls.remove(closestSoul)
- LorenzUtils.chat("§5Found the $closestSoul Enigma Soul!")
+ if (closestSoul in trackedSouls) {
+ trackedSouls.remove(closestSoul)
+ LorenzUtils.chat("§5Found the $closestSoul Enigma Soul!")
+ }
}
} \ No newline at end of file