From b75c249c2b5f6a319c076b6dfbb4ae9003814fe1 Mon Sep 17 00:00:00 2001 From: Phoebe <77941535+catgirlseraid@users.noreply.github.com> Date: Sun, 28 Jul 2024 21:43:46 +1200 Subject: Chocolate Factory Milestones instead of maxed prestige not showing (#2226) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../jsonobjects/repo/HoppityEggLocationsJson.kt | 1 + .../chocolatefactory/ChocolateFactoryAPI.kt | 2 + .../chocolatefactory/ChocolateFactoryStats.kt | 61 ++++++++++++++-------- 3 files changed, 42 insertions(+), 22 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/HoppityEggLocationsJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/HoppityEggLocationsJson.kt index d83d66249..5e601ed32 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/HoppityEggLocationsJson.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/HoppityEggLocationsJson.kt @@ -21,6 +21,7 @@ data class HoppityEggLocationsJson( @Expose val coachRabbitIndex: Int, @Expose val maxRabbits: Int, @Expose val maxPrestige: Int, + @Expose val maxMilestoneChocolate: Long, @Expose val apiEggLocations: Map>, @Expose val specialRabbits: List, ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt index f1cb4be05..36e8a206a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt @@ -56,6 +56,7 @@ object ChocolateFactoryAPI { var shrineIndex = 41 var coachRabbitIndex = 42 var maxRabbits = 395 + var maxMilestoneChocolate = 700_000_000_000L private var maxPrestige = 5 var inChocolateFactory = false @@ -117,6 +118,7 @@ object ChocolateFactoryAPI { coachRabbitIndex = data.coachRabbitIndex maxRabbits = data.maxRabbits maxPrestige = data.maxPrestige + maxMilestoneChocolate = data.maxMilestoneChocolate specialRabbitTextures = data.specialRabbits ChocolateFactoryUpgrade.updateIgnoredSlots() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt index 4491a1423..cc193f2ef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt @@ -73,7 +73,7 @@ object ChocolateFactoryStats { val upgradeAvailableAt = ChocolateAmount.CURRENT.formattedTimeUntilGoal(profileStorage.bestUpgradeCost) - val map = buildMap { + val map = buildMap { put(ChocolateFactoryStat.HEADER, "§6§lChocolate Factory ${ChocolateFactoryAPI.currentPrestige.toRoman()}") put(ChocolateFactoryStat.CURRENT, "§eCurrent Chocolate: §6${ChocolateAmount.CURRENT.formatted}") @@ -104,32 +104,47 @@ object ChocolateFactoryStats { } else { "§eFull Tower Charges: §b${timeTowerFull.timeUntil().format()}\n" + "§eHappens at: §b${timeTowerFull.formattedDate("EEEE, MMM d h:mm a")}" - } - + }, ) put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Prestige: $prestigeEstimate") put( ChocolateFactoryStat.RAW_PER_SECOND, - "§eRaw Per Second: §6${profileStorage.rawChocPerSecond.addSeparators()}" - ) - put( - ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE, - "§eChocolate To Prestige: $chocolateUntilPrestige" + "§eRaw Per Second: §6${profileStorage.rawChocPerSecond.addSeparators()}", ) + + if (ChocolateFactoryAPI.isMaxPrestige()) { + val chocolateUntilMaxMilestone = ChocolateFactoryAPI.maxMilestoneChocolate + val amountUntilMaxMilestone = chocolateUntilMaxMilestone - ChocolateAmount.ALL_TIME.chocolate() + val maxMilestoneEstimate = ChocolateAmount.ALL_TIME.formattedTimeUntilGoal(chocolateUntilMaxMilestone) + + if (amountUntilMaxMilestone >= 0) { + put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Max Milestone: $maxMilestoneEstimate") + put( + ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE, + "§eChocolate To Max Milestone: §6${amountUntilMaxMilestone.addSeparators()}", + ) + } + } else { + put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Prestige: $prestigeEstimate") + put(ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE, "§eChocolate To Prestige: §6$chocolateUntilPrestige") + } + put(ChocolateFactoryStat.TIME_TO_BEST_UPGRADE, "§eBest Upgrade: $upgradeAvailableAt") } val text = config.statsDisplayList.filter { it.shouldDisplay() }.flatMap { map[it]?.split("\n") ?: listOf() } - display = listOf(Renderable.clickAndHover( - Renderable.verticalContainer(text.map(Renderable::string)), - tips = listOf("§bCopy to Clipboard!"), - onClick = { - val list = text.toMutableList() - list.add(0, "${LorenzUtils.getPlayerName()}'s Chocolate Factory Stats") - - ClipboardUtils.copyToClipboard(list.joinToString("\n") { it.removeColor() }) - } - )) + display = listOf( + Renderable.clickAndHover( + Renderable.verticalContainer(text.map(Renderable::string)), + tips = listOf("§bCopy to Clipboard!"), + onClick = { + val list = text.toMutableList() + list.add(0, "${LorenzUtils.getPlayerName()}'s Chocolate Factory Stats") + + ClipboardUtils.copyToClipboard(list.joinToString("\n") { it.removeColor() }) + }, + ), + ) } @SubscribeEvent @@ -167,13 +182,15 @@ object ChocolateFactoryStats { TIME_TOWER("§eTime Tower: §62/3 Charges", { ChocolateFactoryTimeTowerManager.currentCharges() != -1 }), TIME_TOWER_FULL( "§eTime Tower Full Charges: §b5h 13m 59s\n§bHappens at: Monday, May 13 5:32 AM", - { ChocolateFactoryTimeTowerManager.currentCharges() != -1 || ChocolateFactoryTimeTowerManager.timeTowerFull() }), - TIME_TO_PRESTIGE("§eTime To Prestige: §b1d 13h 59m 4s", { !ChocolateFactoryAPI.isMaxPrestige() }), + { ChocolateFactoryTimeTowerManager.currentCharges() != -1 || ChocolateFactoryTimeTowerManager.timeTowerFull() }, + ), + TIME_TO_PRESTIGE("§eTime To Prestige: §b1d 13h 59m 4s"), RAW_PER_SECOND("§eRaw Per Second: §62,136"), - CHOCOLATE_UNTIL_PRESTIGE("§eChocolate To Prestige: §65,851", { !ChocolateFactoryAPI.isMaxPrestige() }), + CHOCOLATE_UNTIL_PRESTIGE("§eChocolate To Prestige: §65,851"), TIME_TO_BEST_UPGRADE( "§eBest Upgrade: §b 59m 4s", - { ChocolateFactoryAPI.profileStorage?.bestUpgradeCost != 0L }), + { ChocolateFactoryAPI.profileStorage?.bestUpgradeCost != 0L }, + ), ; override fun toString(): String { -- cgit