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

Fix: Hoppity > max #2688

Merged
merged 1 commit into from
Oct 7, 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 @@ -102,6 +102,9 @@ public static class ChocolateFactoryStorage {
@Expose
public long currentChocolate = 0;

@Expose
public long maxChocolate = 0;

@Expose
public long chocolateThisPrestige = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ enum class ChocolateAmount(val chocolate: () -> Long) {

companion object {
fun chocolateSinceUpdate(): Long {
if (ChocolateFactoryAPI.isMax()) return 0L
val lastUpdate = profileStorage?.lastDataSave ?: return 0
val currentTime = SimpleTimeMark.now()
val secondsSinceUpdate = (currentTime - lastUpdate).inWholeSeconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,8 @@ object ChocolateFactoryAPI {
it.rabbit.removeColor() == rabbitName.removeColor()
}
}

fun isMax(): Boolean = profileStorage?.let {
it.maxChocolate == it.currentChocolate
} ?: false
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ object ChocolateFactoryDataLoader {
"chocolate.thisprestige",
"§7Chocolate this Prestige: §6(?<amount>[\\d,]+)",
)

/**
* REGEX-TEST: §7Max Chocolate: §660B
*/
private val maxChocolatePattern by ChocolateFactoryAPI.patternGroup.pattern(
"chocolate.max",
"§7Max Chocolate: §6(?<max>.*)",
)
private val chocolateForPrestigePattern by ChocolateFactoryAPI.patternGroup.pattern(
"chocolate.forprestige",
"§7§cRequires (?<amount>\\w+) Chocolate this.*",
Expand Down Expand Up @@ -230,6 +238,9 @@ object ChocolateFactoryDataLoader {
chocolateThisPrestigePattern.matchMatcher(line) {
profileStorage.chocolateThisPrestige = group("amount").formatLong()
}
maxChocolatePattern.matchMatcher(line) {
profileStorage.maxChocolate = group("max").formatLong()
}
chocolateForPrestigePattern.matchMatcher(line) {
ChocolateFactoryAPI.chocolateForPrestige = group("amount").formatLong()
prestigeCost = ChocolateFactoryAPI.chocolateForPrestige
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ object ChocolateFactoryStats {
val map = buildMap<ChocolateFactoryStat, String> {
put(ChocolateFactoryStat.HEADER, "§6§lChocolate Factory ${ChocolateFactoryAPI.currentPrestige.toRoman()}")

put(ChocolateFactoryStat.CURRENT, "§eCurrent Chocolate: §6${ChocolateAmount.CURRENT.formatted}")
val maxSuffix = if (ChocolateFactoryAPI.isMax()) {
" §cMax!"
} else ""
put(ChocolateFactoryStat.CURRENT, "§eCurrent Chocolate: §6${ChocolateAmount.CURRENT.formatted}$maxSuffix")
put(ChocolateFactoryStat.THIS_PRESTIGE, "§eThis Prestige: §6${ChocolateAmount.PRESTIGE.formatted}")
put(ChocolateFactoryStat.ALL_TIME, "§eAll-time: §6${ChocolateAmount.ALL_TIME.formatted}")

Expand Down
Loading