aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-12 15:39:42 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-12 15:39:42 +0200
commit8076ecb3af5c41429afc6e0cd2e14fa9c17d1294 (patch)
tree325e4aea6543917f3c1a1f22590dc8b5b305af30 /src/main/java
parent78093386e000704e7aba3163467456d79b728629 (diff)
downloadskyhanni-8076ecb3af5c41429afc6e0cd2e14fa9c17d1294.tar.gz
skyhanni-8076ecb3af5c41429afc6e0cd2e14fa9c17d1294.tar.bz2
skyhanni-8076ecb3af5c41429afc6e0cd2e14fa9c17d1294.zip
code cleanup, package and config moved, added support for hiding basket waypoints once you have clicked on them
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/Basket.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/Basket.kt)12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketEntrances.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/BasketEntrances.kt)19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketWaypoints.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/BasketWaypoints.kt)45
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt2
8 files changed, 67 insertions, 51 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index d3f4e54e0..9978b5b08 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -155,6 +155,7 @@ import at.hannibal2.skyhanni.features.inventory.SkyBlockLevelGuideHelper
import at.hannibal2.skyhanni.features.inventory.StatsTuning
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
@@ -203,7 +204,6 @@ import at.hannibal2.skyhanni.features.misc.compacttablist.TabListReader
import at.hannibal2.skyhanni.features.misc.compacttablist.TabListRenderer
import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager
import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostCounter
-import at.hannibal2.skyhanni.features.misc.halloweenlobbywaypoints.BasketWaypoints
import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue
import at.hannibal2.skyhanni.features.misc.items.EstimatedWardrobePrice
import at.hannibal2.skyhanni.features.misc.items.GlowingDroppedItems
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java
index 73861a546..0e3257043 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java
@@ -349,4 +349,22 @@ public class EventConfig {
public boolean enableActiveAlert = false;
}
+ @Expose
+ @ConfigOption(name = "Main Lobby Halloween Basket Waypoints", desc = "")
+ @Accordion
+ public halloweenBasketConfig halloweenBasket = new halloweenBasketConfig();
+
+ public static class halloweenBasketConfig {
+
+ @Expose
+ @ConfigOption(name = "Basket Waypoints", desc = "Show all Halloween Basket waypoints.\nShoutout to §bTobbbb §7for the coordinates.\n(AS OF 2023)")
+ @ConfigEditorBoolean
+ public boolean allWaypoints = false;
+
+ @Expose
+ @ConfigOption(name = "Helper Waypoints", desc = "Show helper waypoints to Baskets #23, #24, and #25. Coordinates by §bErymanthus§7.")
+ @ConfigEditorBoolean
+ public boolean allEntranceWaypoints = false;
+ }
+
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
index ebeb2059d..db8f21131 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
@@ -799,24 +799,6 @@ public class MiscConfig {
@FeatureToggle
public boolean fixNeuHeavyPearls = true;
- @Expose
- @ConfigOption(name = "Main Lobby Halloween Basket Waypoints", desc = "")
- @Accordion
- public halloweenBasketConfig halloweenBasket = new halloweenBasketConfig();
-
- public static class halloweenBasketConfig {
-
- @Expose
- @ConfigOption(name = "Basket Waypoints", desc = "Show all Halloween Basket waypoints.\nShoutout to §bTobbbb §7for the coordinates.\n(AS OF 2023)")
- @ConfigEditorBoolean
- public boolean allWaypoints = false;
-
- @Expose
- @ConfigOption(name = "Helper Waypoints", desc = "Show helper waypoints to Baskets #23, #24, and #25. Coordinates by §bErymanthus§7.")
- @ConfigEditorBoolean
- public boolean allEntranceWaypoints = false;
- }
-
@Expose
@ConfigOption(
name = "Time In Limbo",
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/Basket.kt b/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/Basket.kt
index 45d1a4162..8b62adf4d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/Basket.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/Basket.kt
@@ -1,11 +1,8 @@
-package at.hannibal2.skyhanni.features.misc.halloweenlobbywaypoints
+package at.hannibal2.skyhanni.features.mainlobby.halloweenwaypoints
import at.hannibal2.skyhanni.utils.LorenzVec
-enum class Basket(
- val basketName: String,
- val waypoint: LorenzVec
-) {
+enum class Basket(val basketName: String, val waypoint: LorenzVec) {
BASKET_1("#1", LorenzVec(-31, 91, -19)),
BASKET_2("#2", LorenzVec(-14, 85, -78)),
BASKET_3("#3", LorenzVec(24, 68, -29)),
@@ -31,4 +28,7 @@ enum class Basket(
BASKET_23("#23", LorenzVec(-84, 72, 8)),
BASKET_24("#24", LorenzVec(-13, 31, -26)),
BASKET_25("#25 (get your code first!)", LorenzVec(-32, 14, 102)),
-}
+ ;
+
+ var found = false
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/BasketEntrances.kt b/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketEntrances.kt
index 07110d528..1fd106965 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/BasketEntrances.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketEntrances.kt
@@ -1,16 +1,17 @@
-package at.hannibal2.skyhanni.features.misc.halloweenlobbywaypoints
+package at.hannibal2.skyhanni.features.mainlobby.halloweenwaypoints
import at.hannibal2.skyhanni.utils.LorenzVec
enum class BasketEntrances(
val basketEntranceName: String,
- val waypoint: LorenzVec
+ val waypoint: LorenzVec,
+ val basket: Basket
) {
- BASKET_ENTER_23("#23, #24 (behind the lava)", LorenzVec(-138, 74, -4)),
- BASKET_ENTER_24("#24 (within this tunnel)", LorenzVec(-80, 72, -4)),
- BASKET_ENTER_25_1("#25 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30)),
- BASKET_ENTER_25_2("#25 (3rd digit, open chest)", LorenzVec(205, 34, -157)),
- BASKET_ENTER_25_3("#25 (inside this well)", LorenzVec(10, 63, 0)),
- BASKET_ENTER_25_4("#25 (left turn [<--] here)", LorenzVec(-28, 41, 14)),
- BASKET_ENTER_25_5("#25 Vault (brute force 2nd digit)", LorenzVec(-35, 25, 63)),
+ BASKET_ENTER_23("#23, #24 (behind the lava)", LorenzVec(-138, 74, -4), Basket.BASKET_23),
+ BASKET_ENTER_24("#24 (within this tunnel)", LorenzVec(-80, 72, -4), Basket.BASKET_24),
+ BASKET_ENTER_25_1("#25 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30), Basket.BASKET_25),
+ BASKET_ENTER_25_2("#25 (3rd digit, open chest)", LorenzVec(205, 34, -157), Basket.BASKET_25),
+ BASKET_ENTER_25_3("#25 (inside this well)", LorenzVec(10, 63, 0), Basket.BASKET_25),
+ BASKET_ENTER_25_4("#25 (left turn [<--] here)", LorenzVec(-28, 41, 14), Basket.BASKET_25),
+ BASKET_ENTER_25_5("#25 Vault (brute force 2nd digit)", LorenzVec(-35, 25, 63), Basket.BASKET_25),
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/BasketWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketWaypoints.kt
index c6ba348d2..ec51358ae 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/halloweenlobbywaypoints/BasketWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mainlobby/halloweenwaypoints/BasketWaypoints.kt
@@ -1,31 +1,48 @@
-package at.hannibal2.skyhanni.features.misc.halloweenlobbywaypoints
+package at.hannibal2.skyhanni.features.mainlobby.halloweenwaypoints
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.ScoreboardData
+import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
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.LorenzUtils.anyContains
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
-import net.minecraft.client.Minecraft
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class BasketWaypoints {
- private val config get() = SkyHanniMod.feature.misc.halloweenBasket
+ private val config get() = SkyHanniMod.feature.event.halloweenBasket
private var waypoint: LorenzVec? = null
private var waypointName: String? = null
private var isHalloween: Boolean = false
@SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!config.allWaypoints && !config.allEntranceWaypoints) return
+ if (!isHalloween) return
+
+ val message = event.message
+ if (message.startsWith("§a§lYou found a Candy Basket! §r") || message == "§cYou already found this Candy Basket!") {
+ val basket = Basket.entries.minByOrNull { it.waypoint.distanceSqToPlayer() }!!
+ basket.found = true
+ }
+
+ }
+
+ @SubscribeEvent
fun onTick(event: LorenzTickEvent) {
if (!config.allWaypoints && !config.allEntranceWaypoints) return
- if (!HypixelData.hypixelLive) return //dont show outside of live hypixel network
- if (LorenzUtils.inSkyBlock) return
- if (!event.repeatSeconds(1)) return
- isHalloween = chechScoreboardHalloweenSpecific()
+ if (!HypixelData.hypixelLive) return // don't show outside live hypixel network (it's disabled on alpha)
+ if (LorenzUtils.inSkyBlock) return
+
+ if (event.repeatSeconds(1)) {
+ isHalloween = chechScoreboardHalloweenSpecific()
+ }
}
@SubscribeEvent
@@ -34,6 +51,7 @@ class BasketWaypoints {
if (config.allWaypoints) {
for (basket in Basket.entries) {
+ if (basket.found) continue
event.drawWaypointFilled(basket.waypoint, LorenzColor.GOLD.toColor())
event.drawDynamicText(basket.waypoint, "§6" + basket.basketName, 1.5)
}
@@ -41,6 +59,7 @@ class BasketWaypoints {
if (config.allEntranceWaypoints) {
for (basketEntrance in BasketEntrances.entries) {
+ if (basketEntrance.basket.found) continue
event.drawWaypointFilled(basketEntrance.waypoint, LorenzColor.YELLOW.toColor())
event.drawDynamicText(basketEntrance.waypoint, "§e" + basketEntrance.basketEntranceName, 1.5)
}
@@ -56,15 +75,7 @@ class BasketWaypoints {
}
private fun chechScoreboardHalloweenSpecific(): Boolean {
- //am checking separate lines of scoreboard, cannot do `it.contains("xyz") && it.contains("ABC")`
- val theScoreboardList = ScoreboardData.sidebarLinesFormatted
- return ( theScoreboardList.any {
- it.contains("Hypixel Level")
- } && theScoreboardList.any {
- it.contains("Halloween")
- } && theScoreboardList.any {
- it.contains("Baskets")
- }
- )
+ val list = ScoreboardData.sidebarLinesFormatted
+ return list.anyContains("Hypixel Level") && list.anyContains("Halloween") && list.anyContains("Baskets")
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
index 70ac2a3e9..99b95f734 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
@@ -14,6 +14,8 @@ object LocationUtils {
fun LorenzVec.distanceToPlayer() = distance(playerLocation())
+ fun LorenzVec.distanceSqToPlayer() = distanceSq(playerLocation())
+
fun LorenzVec.distanceToPlayerSqIgnoreY() = distanceSqIgnoreY(playerLocation())
fun Entity.distanceToPlayer() = getLorenzVec().distance(playerLocation())
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index b5f07ba0d..2559e31dd 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -528,4 +528,6 @@ object LorenzUtils {
fun sendTitle(text: String, duration: Duration, height: Double = 1.8) {
TitleManager.sendTitle(text, duration, height)
}
+
+ fun Iterable<String>.anyContains(element: String) = any { it.contains(element) }
}