aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax <max_bodifee@sfu.ca>2024-05-30 03:28:47 -0700
committerGitHub <noreply@github.com>2024-05-30 12:28:47 +0200
commit6140a0c4a50c3508bbf8fcc278296557765f8fc5 (patch)
treeb8b024b10c1f4df5995de53878a9c9480ae44443
parentfca0126e4bbc63f8f8218d25be12f9795b70fadc (diff)
downloadskyhanni-6140a0c4a50c3508bbf8fcc278296557765f8fc5.tar.gz
skyhanni-6140a0c4a50c3508bbf8fcc278296557765f8fc5.tar.bz2
skyhanni-6140a0c4a50c3508bbf8fcc278296557765f8fc5.zip
Improvement: Hoppity eggs timer outside sb (#1926)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt35
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt3
4 files changed, 39 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java
index 5361991e1..59f2d7516 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java
@@ -85,6 +85,12 @@ public class HoppityEggsConfig {
public boolean showDuringContest = false;
@Expose
+ @ConfigOption(name = "Show outside Skyblock", desc = "Show on Hypixel even when not playing Skyblock.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean showOutsideSkyblock = false;
+
+ @Expose
@ConfigOption(name = "Shared Hoppity Waypoints", desc = "Enable being able to share and receive egg waypoints in your lobby.")
@ConfigEditorBoolean
@FeatureToggle
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt
index d67e9550a..87df6c3cb 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt
@@ -6,14 +6,14 @@ import kotlin.time.Duration
enum class HoppityEggType(
val mealName: String,
- val resetsAt: Int,
private val mealColour: String,
+ val resetsAt: Int,
var lastResetDay: Int = -1,
private var claimed: Boolean = false,
) {
- BREAKFAST("Breakfast", 7, "§6"),
- LUNCH("Lunch", 14, "§9"),
- DINNER("Dinner", 21, "§a"),
+ BREAKFAST("Breakfast", "§6", 7),
+ LUNCH("Lunch", "§9", 14),
+ DINNER("Dinner", "§a", 21),
;
fun timeUntil(): Duration {
@@ -62,5 +62,9 @@ enum class HoppityEggType(
fun eggsRemaining(): Boolean {
return entries.any { !it.claimed }
}
+
+ fun allEggsRemaining(): Boolean {
+ return entries.all { !it.claimed }
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
index f6332219e..771e55c59 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
@@ -180,19 +180,19 @@ object HoppityEggsManager {
}
}
+ // TODO move logic into second passed event and cache
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!isActive()) return
if (!config.showClaimedEggs) return
- if (isBuzy()) return
- if (!ChocolateFactoryAPI.isHoppityEvent()) return
+ if (isBusy()) return
val displayList = HoppityEggType.entries
.map { "§7 - ${it.formattedName} ${it.timeUntil().format()}" }
.toMutableList()
displayList.add(0, "§bUnclaimed Eggs:")
- if (config.showCollectedLocationCount) {
+ if (config.showCollectedLocationCount && LorenzUtils.inSkyBlock) {
val totalEggs = HoppityEggLocator.getCurrentIslandEggLocations()?.size
if (totalEggs != null) {
val collectedEggs = HoppityUniqueEggLocations.collectedEggsThisIsland()
@@ -222,11 +222,11 @@ object HoppityEggsManager {
private fun checkWarn() {
if (!warningActive) {
- warningActive = HoppityEggType.entries.all { it.isClaimed() }
+ warningActive = !HoppityEggType.allEggsRemaining()
}
if (warningActive) {
- if (HoppityEggType.entries.all { !it.isClaimed() }) {
+ if (HoppityEggType.allEggsRemaining()) {
warn()
}
}
@@ -234,24 +234,32 @@ object HoppityEggsManager {
private fun warn() {
if (!config.warnUnclaimedEggs) return
- if (isBuzy()) return
+ if (isBusy()) return
if (lastWarnTime.passedSince() < 30.seconds) return
lastWarnTime = now()
val amount = HoppityEggType.entries.size
val message = "All $amount Hoppity Eggs are ready to be found!"
if (config.warpUnclaimedEggs) {
- ChatUtils.clickableChat(
- message,
- onClick = { HypixelCommands.warp(config.warpDestination) },
- "§eClick to /warp ${config.warpDestination}!"
- )
+ if (LorenzUtils.inSkyBlock) {
+ ChatUtils.clickableChat(
+ message,
+ onClick = { HypixelCommands.warp(config.warpDestination) },
+ "§eClick to /warp ${config.warpDestination}!"
+ )
+ } else {
+ ChatUtils.clickableChat(
+ message,
+ onClick = { HypixelCommands.skyblock() },
+ "§eClick to join /skyblock!"
+ )
+ }
} else ChatUtils.chat(message)
LorenzUtils.sendTitle("§e$amount Hoppity Eggs!", 5.seconds)
SoundUtils.repeatSound(100, 10, SoundUtils.plingSound)
}
- private fun isBuzy() = ReminderUtils.isBusy(config.showDuringContest)
+ private fun isBusy() = ReminderUtils.isBusy(config.showDuringContest)
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
@@ -263,5 +271,6 @@ object HoppityEggsManager {
event.move(44, "event.chocolateFactory.hoppityEggs", "event.hoppityEggs")
}
- fun isActive() = LorenzUtils.inSkyBlock && ChocolateFactoryAPI.isHoppityEvent()
+ fun isActive() = (LorenzUtils.inSkyBlock || (LorenzUtils.onHypixel && config.showOutsideSkyblock)) &&
+ ChocolateFactoryAPI.isHoppityEvent()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt
index a515262a8..3ae6548e9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt
@@ -1,6 +1,9 @@
package at.hannibal2.skyhanni.utils
object HypixelCommands {
+ fun skyblock() {
+ send("skyblock")
+ }
fun bazaar(searchTerm: String) {
send("bz $searchTerm")