diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
2 files changed, 22 insertions, 20 deletions
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 59a119bf5..40cd700c4 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 @@ -20,13 +20,13 @@ import at.hannibal2.skyhanni.utils.RegexUtils.firstMatcher import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches -import at.hannibal2.skyhanni.utils.SkyblockSeason import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.UtilsPatterns import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.TreeSet import kotlin.time.Duration import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.seconds @@ -80,7 +80,7 @@ object ChocolateFactoryAPI { var shrineIndex = 41 var coachRabbitIndex = 42 var maxRabbits = 395 - var maxMilestoneChocolate = 700_000_000_000L + var chocolateMilestones = TreeSet<Long>() private var maxPrestige = 5 var inChocolateFactory = false @@ -142,7 +142,7 @@ object ChocolateFactoryAPI { coachRabbitIndex = data.coachRabbitIndex maxRabbits = data.maxRabbits maxPrestige = data.maxPrestige - maxMilestoneChocolate = data.maxMilestoneChocolate + chocolateMilestones = data.chocolateMilestones specialRabbitTextures = data.specialRabbits ChocolateFactoryUpgrade.updateIgnoredSlots() @@ -179,23 +179,24 @@ object ChocolateFactoryAPI { } } - fun getNextLevelName(stack: ItemStack): String? = - upgradeLorePattern.firstMatcher(stack.getLore()) { - val upgradeName = if (stack.getLore().any { it == "§8Employee" }) employeeNamePattern.matchMatcher(stack.name) { - groupOrNull("employee") - } else groupOrNull("upgradename") - val nextLevel = groupOrNull("nextlevel") ?: groupOrNull("nextlevelalt") - if (upgradeName == null || nextLevel == null) null - else "$upgradeName $nextLevel" - } + fun getNextLevelName(stack: ItemStack): String? = upgradeLorePattern.firstMatcher(stack.getLore()) { + val upgradeName = if (stack.getLore().any { it == "§8Employee" }) employeeNamePattern.matchMatcher(stack.name) { + groupOrNull("employee") + } else groupOrNull("upgradename") + val nextLevel = groupOrNull("nextlevel") ?: groupOrNull("nextlevelalt") + if (upgradeName == null || nextLevel == null) null + else "$upgradeName $nextLevel" + } + fun getNextMilestoneChocolate(amount: Long): Long { + return chocolateMilestones.higher(amount) ?: 0 + } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled fun isMaxPrestige() = currentPrestige >= maxPrestige - fun timeTowerChargeDuration() = - if (HoppityCollectionStats.hasFoundRabbit("Einstein")) 7.hours else 8.hours + fun timeTowerChargeDuration() = if (HoppityCollectionStats.hasFoundRabbit("Einstein")) 7.hours else 8.hours fun timeTowerMultiplier(): Double { var multiplier = (profileStorage?.timeTowerLevel ?: 0) * 0.1 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 cc193f2ef..8d08e485e 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 @@ -113,15 +113,16 @@ object ChocolateFactoryStats { ) if (ChocolateFactoryAPI.isMaxPrestige()) { - val chocolateUntilMaxMilestone = ChocolateFactoryAPI.maxMilestoneChocolate - val amountUntilMaxMilestone = chocolateUntilMaxMilestone - ChocolateAmount.ALL_TIME.chocolate() - val maxMilestoneEstimate = ChocolateAmount.ALL_TIME.formattedTimeUntilGoal(chocolateUntilMaxMilestone) + val allTime = ChocolateAmount.ALL_TIME.chocolate() + val nextChocolateMilestone = ChocolateFactoryAPI.getNextMilestoneChocolate(allTime) + val amountUntilNextMilestone = nextChocolateMilestone - allTime + val maxMilestoneEstimate = ChocolateAmount.ALL_TIME.formattedTimeUntilGoal(nextChocolateMilestone) - if (amountUntilMaxMilestone >= 0) { - put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Max Milestone: $maxMilestoneEstimate") + if (amountUntilNextMilestone >= 0) { + put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Next Milestone: $maxMilestoneEstimate") put( ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE, - "§eChocolate To Max Milestone: §6${amountUntilMaxMilestone.addSeparators()}", + "§eChocolate To Next Milestone: §6${amountUntilNextMilestone.addSeparators()}", ) } } else { |