Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Add Toggle for Unclaimed Egg Warp #2211

Merged
merged 4 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading