aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorminhperry <46137516+minhperry@users.noreply.github.com>2024-09-12 02:15:38 +0200
committerGitHub <noreply@github.com>2024-09-12 02:15:38 +0200
commit5459fc8aa33915e8d4be0c538dbb19a5e80d29db (patch)
tree77ebeae8e135166b39222f38038050d030f4dbca /src/main/java/at
parent5151e1a0a73e9e194f0b5ec06c49be2c853cc23f (diff)
downloadskyhanni-5459fc8aa33915e8d4be0c538dbb19a5e80d29db.tar.gz
skyhanni-5459fc8aa33915e8d4be0c538dbb19a5e80d29db.tar.bz2
skyhanni-5459fc8aa33915e8d4be0c538dbb19a5e80d29db.zip
Improvement: Chocolate Factory time to next instead of max milestone (#2503)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/HoppityEggLocationsJson.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt13
3 files changed, 24 insertions, 21 deletions
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 5e601ed32..4ad81b06a 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
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data.jsonobjects.repo
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.utils.LorenzVec
import com.google.gson.annotations.Expose
+import java.util.TreeSet
data class HoppityEggLocationsJson(
@Expose val eggLocations: Map<IslandType, List<LorenzVec>>,
@@ -21,7 +22,7 @@ data class HoppityEggLocationsJson(
@Expose val coachRabbitIndex: Int,
@Expose val maxRabbits: Int,
@Expose val maxPrestige: Int,
- @Expose val maxMilestoneChocolate: Long,
+ @Expose val chocolateMilestones: TreeSet<Long>,
@Expose val apiEggLocations: Map<IslandType, Map<String, LorenzVec>>,
@Expose val specialRabbits: List<String>,
)
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 {