aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2023-12-08 17:02:57 -0800
committerGitHub <noreply@github.com>2023-12-09 02:02:57 +0100
commite791dff4d2dff8203f5198fb4d0e90bbf457380a (patch)
treec23f478fce349745eda3fa0f3c6a162f875c7631 /src
parent5b9de0632fd1a9d14550804934785ef33df54134 (diff)
downloadskyhanni-e791dff4d2dff8203f5198fb4d0e90bbf457380a.tar.gz
skyhanni-e791dff4d2dff8203f5198fb4d0e90bbf457380a.tar.bz2
skyhanni-e791dff4d2dff8203f5198fb4d0e90bbf457380a.zip
Add Waypoints for 2023 Lobby Presents (#772)
Added Waypoints for 2023 Lobby Presents. #772
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/EventConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/ChristmasPresentConfig.java25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/HalloweenBasketConfig.java (renamed from src/main/java/at/hannibal2/skyhanni/config/features/event/HalloweenBasketConfig.java)2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/LobbyWaypointsConfig.java18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt88
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/EventWaypointsJson.java25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt114
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/Basket.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/Basket.kt)4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketEntrances.kt)2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketWaypoints.kt)16
13 files changed, 312 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index b41b894cb..33943ac0f 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -113,6 +113,8 @@ import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare
import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow
import at.hannibal2.skyhanni.features.event.jerry.HighlightJerries
import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker
+import at.hannibal2.skyhanni.features.event.lobby.waypoints.christmas.PresentWaypoints
+import at.hannibal2.skyhanni.features.event.lobby.waypoints.halloween.BasketWaypoints
import at.hannibal2.skyhanni.features.event.spook.TheGreatSpook
import at.hannibal2.skyhanni.features.event.winter.UniqueGiftCounter
import at.hannibal2.skyhanni.features.fame.AccountUpgradeReminder
@@ -204,7 +206,6 @@ import at.hannibal2.skyhanni.features.inventory.tiarelay.TiaRelayWaypoints
import at.hannibal2.skyhanni.features.itemabilities.ChickenHeadTimer
import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles
import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown
-import at.hannibal2.skyhanni.features.mainlobby.halloweenwaypoints.BasketWaypoints
import at.hannibal2.skyhanni.features.mining.HighlightMiningCommissionMobs
import at.hannibal2.skyhanni.features.mining.KingTalismanHelper
import at.hannibal2.skyhanni.features.mining.crystalhollows.CrystalHollowsNamesInCore
@@ -667,6 +668,7 @@ class SkyHanniMod {
loadModule(PestSpawnTimer)
loadModule(PestFinder())
loadModule(SprayFeatures())
+ loadModule(PresentWaypoints())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
index 0f638e22b..d375cad61 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
@@ -9,7 +9,7 @@ import com.google.gson.JsonPrimitive
object ConfigUpdaterMigrator {
val logger = LorenzLogger("ConfigMigration")
- const val CONFIG_VERSION = 12
+ const val CONFIG_VERSION = 13
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/EventConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/EventConfig.java
index ef27a42bd..0c11c7396 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/event/EventConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/EventConfig.java
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.config.features.event;
import at.hannibal2.skyhanni.config.features.event.bingo.BingoConfig;
import at.hannibal2.skyhanni.config.features.event.diana.DianaConfig;
+import at.hannibal2.skyhanni.config.features.event.waypoints.LobbyWaypointsConfig;
import at.hannibal2.skyhanni.config.features.event.winter.WinterConfig;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.Accordion;
@@ -43,9 +44,8 @@ public class EventConfig {
@Expose
public CenturyConfig century = new CenturyConfig();
+ @Category(name = "Lobby Waypoints", desc = "Lobby Event Waypoint settings")
@Expose
- @ConfigOption(name = "Main Lobby Halloween Basket Waypoints", desc = "")
- @Accordion
- public HalloweenBasketConfig halloweenBasket = new HalloweenBasketConfig();
+ public LobbyWaypointsConfig lobbyWaypoints = new LobbyWaypointsConfig();
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/ChristmasPresentConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/ChristmasPresentConfig.java
new file mode 100644
index 000000000..25da62873
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/ChristmasPresentConfig.java
@@ -0,0 +1,25 @@
+package at.hannibal2.skyhanni.config.features.event.waypoints;
+
+import at.hannibal2.skyhanni.config.FeatureToggle;
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.moulberry.moulconfig.annotations.ConfigOption;
+
+public class ChristmasPresentConfig {
+
+ @Expose
+ @ConfigOption(name = "Present Waypoints", desc = "Show all Present waypoints")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean allWaypoints = false;
+
+ @Expose
+ @ConfigOption(name = "Entrance Waypoints", desc = "Show helper waypoints to .")
+ @ConfigEditorBoolean
+ public boolean allEntranceWaypoints = false;
+
+ @Expose
+ @ConfigOption(name = "Only Closest", desc = "Only show the closest waypoint")
+ @ConfigEditorBoolean
+ public boolean onlyClosest = false;
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/HalloweenBasketConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/HalloweenBasketConfig.java
index 5cb2bfef4..93b4d96f3 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/event/HalloweenBasketConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/HalloweenBasketConfig.java
@@ -1,4 +1,4 @@
-package at.hannibal2.skyhanni.config.features.event;
+package at.hannibal2.skyhanni.config.features.event.waypoints;
import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/LobbyWaypointsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/LobbyWaypointsConfig.java
new file mode 100644
index 000000000..6cef4d81c
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/waypoints/LobbyWaypointsConfig.java
@@ -0,0 +1,18 @@
+package at.hannibal2.skyhanni.config.features.event.waypoints;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.moulconfig.annotations.Accordion;
+import io.github.moulberry.moulconfig.annotations.ConfigOption;
+
+public class LobbyWaypointsConfig {
+
+ @Expose
+ @ConfigOption(name = "Halloween Basket Waypoints", desc = "")
+ @Accordion
+ public HalloweenBasketConfig halloweenBasket = new HalloweenBasketConfig();
+
+ @Expose
+ @ConfigOption(name = "Christmas Present Waypoints", desc = "")
+ @Accordion
+ public ChristmasPresentConfig christmasPresent = new ChristmasPresentConfig();
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index 1b0b46352..8e7379365 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigManager.Companion.gson
import at.hannibal2.skyhanni.events.HypixelJoinEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
@@ -8,22 +9,34 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.features.bingo.BingoAPI
+import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TabListData
+import com.google.gson.JsonObject
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
import net.minecraft.client.Minecraft
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.network.FMLNetworkEvent
+import kotlin.concurrent.thread
+
class HypixelData {
// TODO USE SH-REPO
private val tabListProfilePattern = "§e§lProfile: §r§a(?<profile>.*)".toPattern()
+ private val lobbyTypePattern = "(?<lobbyType>.*lobby)\\d+".toPattern()
+
+ private var lastLocRaw = 0L
companion object {
var hypixelLive = false
var hypixelAlpha = false
+ var inLobby = false
+ var inLimbo = false
var skyBlock = false
var skyBlockIsland = IslandType.UNKNOWN
@@ -38,13 +51,35 @@ class HypixelData {
var joinedWorld = 0L
var skyBlockArea = "?"
+
+ // Data from locraw
+ var locrawData: JsonObject? = null
+ private var locraw: MutableMap<String, String> = mutableMapOf(
+ "server" to "",
+ "gametype" to "",
+ "lobbyname" to "",
+ "lobbytype" to "",
+ "mode" to "",
+ "map" to ""
+ )
+
+ val server get() = locraw["server"] ?: ""
+ val gameType get() = locraw["gametype"] ?: ""
+ val lobbyName get() = locraw["lobbyname"] ?: ""
+ val lobbyType get() = locraw["lobbytype"] ?: ""
+ val mode get() = locraw["mode"] ?: ""
+ val map get() = locraw["map"] ?: ""
}
private var loggerIslandChange = LorenzLogger("debug/island_change")
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
+ locrawData = null
skyBlock = false
+ inLimbo = false
+ inLobby = false
+ locraw.forEach { locraw[it.key] = "" }
joinedWorld = System.currentTimeMillis()
}
@@ -53,6 +88,9 @@ class HypixelData {
hypixelLive = false
hypixelAlpha = false
skyBlock = false
+ inLobby = false
+ locraw.forEach { locraw[it.key] = "" }
+ locrawData = null
}
@SubscribeEvent
@@ -75,6 +113,26 @@ class HypixelData {
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
+ if (!LorenzUtils.inSkyBlock) {
+ // Modified from NEU.
+ // NEU does not send locraw when not in SkyBlock.
+ // So, as requested by Hannibal, use locraw from
+ // NEU and have NEU send it.
+ // Remove this when NEU dependency is removed
+ val currentTime = System.currentTimeMillis()
+ if (Minecraft.getMinecraft().thePlayer != null &&
+ Minecraft.getMinecraft().theWorld != null &&
+ locrawData == null &&
+ currentTime - lastLocRaw > 15000
+ ) {
+ lastLocRaw = System.currentTimeMillis()
+ thread(start = true) {
+ Thread.sleep(1000)
+ NotEnoughUpdates.INSTANCE.sendChatMessage("/locraw")
+ }
+ }
+ }
+
if (event.isMod(2) && LorenzUtils.inSkyBlock) {
val originalLocation = ScoreboardData.sidebarLinesFormatted
.firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") }
@@ -193,4 +251,34 @@ class HypixelData {
return scoreboardTitle.contains("SKYBLOCK") ||
scoreboardTitle.contains("SKIBLOCK") // April 1st jokes are so funny
}
+
+ // This code is modified from NEU, and depends on NEU (or another mod) sending /locraw.
+ private val jsonBracketPattern = "^\\{.+}".toPattern()
+
+ @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
+ fun onChatMessage(event: ClientChatReceivedEvent) {
+ jsonBracketPattern.matchMatcher(event.message.unformattedText) {
+ try {
+ val obj: JsonObject = gson.fromJson(group(), JsonObject::class.java)
+ if (obj.has("server")) {
+ locrawData = obj
+ locraw.keys.forEach { key ->
+ locraw[key] = obj[key]?.asString ?: ""
+ }
+ inLimbo = locraw["server"] == "limbo"
+ inLobby = locraw["lobbyname"] != ""
+
+ if (inLobby) {
+ locraw["lobbyname"]?.let {
+ lobbyTypePattern.matchMatcher(it) {
+ locraw["lobbytype"] = group("lobbyType")
+ }
+ }
+ }
+ }
+ } catch (e: Exception) {
+ ErrorManager.logErrorWithData(e, "Failed to parse locraw data")
+ }
+ }
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/EventWaypointsJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/EventWaypointsJson.java
new file mode 100644
index 000000000..f59af9ffb
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/EventWaypointsJson.java
@@ -0,0 +1,25 @@
+package at.hannibal2.skyhanni.data.jsonobjects.repo;
+
+import at.hannibal2.skyhanni.utils.LorenzVec;
+import com.google.gson.annotations.Expose;
+
+import java.util.List;
+import java.util.Map;
+
+public class EventWaypointsJson {
+
+ @Expose
+ public Map<String, List<Waypoint>> presents;
+
+ @Expose
+ public Map<String, List<Waypoint>> presents_entrances;
+
+ public static class Waypoint {
+ @Expose
+ public String name;
+
+ //format: "x:y:z"
+ @Expose
+ public LorenzVec position;
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt
new file mode 100644
index 000000000..da537d4c0
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.features.event.lobby.waypoints
+
+import at.hannibal2.skyhanni.data.jsonobjects.repo.EventWaypointsJson
+import at.hannibal2.skyhanni.utils.LorenzVec
+
+data class EventWaypoint(
+ val name: String,
+ val position: LorenzVec,
+ var isFound: Boolean = false
+)
+
+fun loadEventWaypoints(waypoints: Map<String, List<EventWaypointsJson.Waypoint>>): Map<String, MutableSet<EventWaypoint>> {
+ return buildMap {
+ waypoints.forEach { lobby ->
+ val set = mutableSetOf<EventWaypoint>()
+ lobby.value.forEach { waypoint -> set.add(EventWaypoint(waypoint.name, waypoint.position)) }
+ this[lobby.key] = set
+ }
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt
new file mode 100644
index 000000000..c400da59b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt
@@ -0,0 +1,114 @@
+package at.hannibal2.skyhanni.features.event.lobby.waypoints.christmas
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.HypixelData
+import at.hannibal2.skyhanni.data.jsonobjects.repo.EventWaypointsJson
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.events.RepositoryReloadEvent
+import at.hannibal2.skyhanni.features.event.lobby.waypoints.EventWaypoint
+import at.hannibal2.skyhanni.features.event.lobby.waypoints.loadEventWaypoints
+import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
+import at.hannibal2.skyhanni.utils.StringUtils.matches
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+// todo: create abstract class for this and BasketWaypoints
+class PresentWaypoints {
+ private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.christmasPresent
+ private var presentLocations = mapOf<String, MutableSet<EventWaypoint>>()
+ private var presentEntranceLocations = mapOf<String, MutableSet<EventWaypoint>>()
+ private var closest: EventWaypoint? = null
+
+ private val presentSet get() = presentLocations[HypixelData.lobbyType]
+ private val presentEntranceSet get() = presentEntranceLocations[HypixelData.lobbyType]
+
+ private val presentAlreadyFoundPattern = "§cYou have already found this present!".toPattern()
+ private val presentFoundPattern = "§aYou found a.*present! §r§e\\(§r§b\\d+§r§e/§r§b\\d+§r§e\\)".toPattern()
+ private val allFoundPattern = "§aCongratulations! You found all the presents in every lobby!".toPattern()
+
+ @SubscribeEvent
+ fun onWorldChange(event: LorenzWorldChangeEvent) {
+ if (!isEnabled()) return
+ closest = null
+ }
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+ processChatMessage(event.message)
+ }
+
+ // <editor-fold desc = "Chat Message Processing">
+ private fun processChatMessage(message: String) {
+ when {
+ presentFoundPattern.matches(message) || presentAlreadyFoundPattern.matches(message) -> handlePresentFound()
+ allFoundPattern.matches(message) -> handleAllPresentsFound()
+ }
+ }
+
+ private fun handlePresentFound() {
+ presentSet?.minByOrNull { it.position.distanceSqToPlayer() }?.let { present ->
+ present.isFound = true
+ markEntranceAsFound(present)
+ if (closest == present) closest = null
+ }
+ }
+
+ private fun markEntranceAsFound(present: EventWaypoint) {
+ presentEntranceSet?.find { present.name == it.name }?.let { it.isFound = true }
+ }
+
+ private fun handleAllPresentsFound() {
+ // If all presents are found, disable the feature
+ LorenzUtils.chat("Congratulations! As all presents are found, we are disabling the Christmas Present Waypoints feature.")
+ config.allWaypoints = false
+ config.allEntranceWaypoints = false
+ }
+
+ // </editor-fold>
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!isEnabled() && config.onlyClosest && HypixelData.locrawData != null && closest == null) return
+ val notFoundPresents = presentSet?.filterNot { it.isFound }
+ if (notFoundPresents?.isEmpty() == true) return
+ closest = notFoundPresents?.minByOrNull { it.position.distanceSqToPlayer() } ?: return
+ }
+
+ @SubscribeEvent
+ fun onRenderWorld(event: LorenzRenderWorldEvent) {
+ if (!isEnabled()) return
+ presentSet?.let { event.drawWaypoints(it, config.allWaypoints, LorenzColor.GOLD, "§6") }
+ presentEntranceSet?.let { event.drawWaypoints(it, config.allEntranceWaypoints, LorenzColor.YELLOW, "§e") }
+ }
+
+ private fun LorenzRenderWorldEvent.drawWaypoints(
+ waypoints: Set<EventWaypoint>, shouldDraw: Boolean, color: LorenzColor, prefix: String
+ ) {
+ if (!shouldDraw) return
+ waypoints.forEach { waypoint ->
+ if (!waypoint.shouldShow()) return@forEach
+ this.drawWaypointFilled(waypoint.position, color.toColor())
+ this.drawDynamicText(waypoint.position, "$prefix${waypoint.name}", 1.5)
+ }
+ }
+
+ private fun EventWaypoint.shouldShow(): Boolean = !isFound && (!config.onlyClosest || closest == this)
+
+ @SubscribeEvent
+ fun onRepoReload(event: RepositoryReloadEvent) {
+ val data = event.getConstant<EventWaypointsJson>("EventWaypoints")
+ presentLocations = loadEventWaypoints(data.presents ?: error("'presents' is null in EventWaypoints!"))
+ presentEntranceLocations =
+ loadEventWaypoints(data.presents_entrances ?: error("'presents_entrances' is null in EventWaypoints!"))
+ }
+
+ private fun isEnabled(): Boolean =
+ LorenzUtils.onHypixel && HypixelData.inLobby && (config.allWaypoints || config.allEntranceWaypoints)
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/Basket.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/Basket.kt
index 8b62adf4d..af36c46e7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/Basket.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/Basket.kt
@@ -1,4 +1,4 @@
-package at.hannibal2.skyhanni.features.mainlobby.halloweenwaypoints
+package at.hannibal2.skyhanni.features.event.lobby.waypoints.halloween
import at.hannibal2.skyhanni.utils.LorenzVec
@@ -31,4 +31,4 @@ enum class Basket(val basketName: String, val waypoint: LorenzVec) {
;
var found = false
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketEntrances.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt
index a923a382a..e2904f99e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketEntrances.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt
@@ -1,4 +1,4 @@
-package at.hannibal2.skyhanni.features.mainlobby.halloweenwaypoints
+package at.hannibal2.skyhanni.features.event.lobby.waypoints.halloween
import at.hannibal2.skyhanni.utils.LorenzVec
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt
index 15902d52d..d9d90ca4a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt
@@ -1,6 +1,7 @@
-package at.hannibal2.skyhanni.features.mainlobby.halloweenwaypoints
+package at.hannibal2.skyhanni.features.event.lobby.waypoints.halloween
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.events.LorenzChatEvent
@@ -15,7 +16,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class BasketWaypoints {
- private val config get() = SkyHanniMod.feature.event.halloweenBasket
+ private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.halloweenBasket
private var closest: Basket? = null
private var isHalloween: Boolean = false
@@ -44,7 +45,7 @@ class BasketWaypoints {
if (LorenzUtils.inSkyBlock) return
if (event.repeatSeconds(1)) {
- isHalloween = chechScoreboardHalloweenSpecific()
+ isHalloween = checkScoreboardHalloweenSpecific()
}
if (isHalloween) {
@@ -92,8 +93,13 @@ class BasketWaypoints {
return if (config.onlyClosest) closest == this else true
}
- private fun chechScoreboardHalloweenSpecific(): Boolean {
+ private fun checkScoreboardHalloweenSpecific(): Boolean {
val list = ScoreboardData.sidebarLinesFormatted
return list.anyContains("Hypixel Level") && list.anyContains("Halloween") && list.anyContains("Baskets")
}
-} \ No newline at end of file
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(13, "event.halloweenBasket", "event.lobbyWaypoints.halloweenBasket")
+ }
+}