aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-10-07 12:09:22 +0200
committerGitHub <noreply@github.com>2024-10-07 12:09:22 +0200
commit1de910a9ae9ab96fa75044367f9546d671fbcba1 (patch)
tree1ed32dbc6e6357613a2ad136965a55e1996d0867 /src/main
parent129bc896df29ed5cedd915b094365058b19137a1 (diff)
downloadskyhanni-1de910a9ae9ab96fa75044367f9546d671fbcba1.tar.gz
skyhanni-1de910a9ae9ab96fa75044367f9546d671fbcba1.tar.bz2
skyhanni-1de910a9ae9ab96fa75044367f9546d671fbcba1.zip
Fix: Hoppity > max (#2688)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt5
5 files changed, 23 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java
index 754eea3bb..4ccb0823d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java
@@ -103,6 +103,9 @@ public class ProfileSpecificStorage {
public long currentChocolate = 0;
@Expose
+ public long maxChocolate = 0;
+
+ @Expose
public long chocolateThisPrestige = 0;
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt
index 7f0694e2a..1f1f6d0c0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt
@@ -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
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 112e8a7a7..195ea51d3 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
@@ -239,4 +239,8 @@ object ChocolateFactoryAPI {
it.rabbit.removeColor() == rabbitName.removeColor()
}
}
+
+ fun isMax(): Boolean = profileStorage?.let {
+ it.maxChocolate == it.currentChocolate
+ } ?: false
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt
index eebbb19e9..64a99a8c9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt
@@ -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.*",
@@ -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
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 8d08e485e..36c79728c 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
@@ -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}")