aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-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")