Skip to content

Commit

Permalink
Improvement: Add Toggle for Unclaimed Egg Warp (hannibal002#2211)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
  • Loading branch information
2 people authored and Nealkitt committed Aug 16, 2024
1 parent abd1821 commit 52d459c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class HoppityEggsConfig {
public boolean warnUnclaimedEggs = false;

@Expose
@ConfigOption(name = "Click to Warp", desc = "Make the eggs ready chat message clickable to warp you to an island.")
@ConfigOption(name = "Click to Warp", desc = "Make the eggs ready chat message & unclaimed timer display clickable to warp you to an island.")
@ConfigEditorBoolean
public boolean warpUnclaimedEggs = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ object HoppityEggDisplayManager {

private fun updateDisplay(): List<Renderable> {
if (!HoppityEggsManager.isActive()) return emptyList()
if (!HoppityEggsManager.config.showClaimedEggs) return emptyList()
if (ReminderUtils.isBusy() && !HoppityEggsManager.config.showWhileBusy) return emptyList()
if (!config.showClaimedEggs) return emptyList()
if (ReminderUtils.isBusy() && !config.showWhileBusy) return emptyList()

val displayList =
HoppityEggType.entries.map { "§7 - ${it.formattedName} ${it.timeUntil().format()}" }.toMutableList()
displayList.add(0, "§bUnclaimed Eggs:")

if (HoppityEggsManager.config.showCollectedLocationCount && LorenzUtils.inSkyBlock) {
if (config.showCollectedLocationCount && LorenzUtils.inSkyBlock) {
val totalEggs = HoppityEggLocations.islandLocations.size
if (totalEggs > 0) {
val collectedEggs = HoppityEggLocations.islandCollectedLocations.size
Expand All @@ -89,20 +89,21 @@ object HoppityEggDisplayManager {
}
if (displayList.size == 1) return emptyList()

val container = Renderable.verticalContainer(displayList.map(Renderable::string))
return listOf(
Renderable.clickAndHover(
Renderable.verticalContainer(displayList.map(Renderable::string)),
tips = listOf("§eClick to ${"/warp ${HoppityEggsManager.config.warpDestination}".trim()}!"),
onClick = { HypixelCommands.warp(HoppityEggsManager.config.warpDestination) },
),
if (config.warpUnclaimedEggs) Renderable.clickAndHover(
container,
tips = listOf("§eClick to ${"/warp ${config.warpDestination}".trim()}!"),
onClick = { HypixelCommands.warp(config.warpDestination) },
) else container
)
}


@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent) {
if (!HoppityEggsManager.isActive()) return
HoppityEggsManager.config.position.renderRenderables(display, posLabel = "Hoppity Eggs")
config.position.renderRenderables(display, posLabel = "Hoppity Eggs")
}

private fun formatEggsCollected(collectedEggs: Int): String =
Expand Down

0 comments on commit 52d459c

Please sign in to comment.