diff options
2 files changed, 21 insertions, 2 deletions
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 679001939..9351dac40 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 @@ -78,5 +78,21 @@ enum class ChocolateAmount(val chocolate: () -> Long) { return basePerSecond + towerCalc } + + fun addToAll(amount: Long) { + profileStorage?.let { + it.currentChocolate += amount + it.chocolateThisPrestige += amount + it.chocolateAllTime += amount + updateBestUpgrade(amount) + } + } + + private fun updateBestUpgrade(price: Long) { + profileStorage?.let { + val canAffordAt = SimpleTimeMark.now() + CURRENT.timeUntilGoal(it.bestUpgradeCost) + it.bestUpgradeAvailableAt = canAffordAt.toMillis() + } + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt index 10440ee96..5d0a5c817 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -22,7 +23,7 @@ object ChocolateFactoryBarnManager { ) private val rabbitDuplicatePattern by ChocolateFactoryAPI.patternGroup.pattern( "rabbit.duplicate", - "§7§lDUPLICATE RABBIT! §6\\+[\\d,]+ Chocolate" + "§7§lDUPLICATE RABBIT! §6\\+(?<amount>[\\d,]+) Chocolate" ) /** @@ -30,7 +31,7 @@ object ChocolateFactoryBarnManager { */ private val rabbitCrashedPattern by ChocolateFactoryAPI.patternGroup.pattern( "rabbit.crushed", - "§c§lBARN FULL! §f\\D+ §7got §ccrushed§7! §6.+ Chocolate" + "§c§lBARN FULL! §f\\D+ §7got §ccrushed§7! §6\\+(?<amount>[\\d,]+) Chocolate" ) var barnFull = false @@ -49,10 +50,12 @@ object ChocolateFactoryBarnManager { rabbitDuplicatePattern.matchMatcher(event.message) { HoppityEggsManager.shareWaypointPrompt() + ChocolateAmount.addToAll(group("amount").formatLong()) } rabbitCrashedPattern.matchMatcher(event.message) { HoppityEggsManager.shareWaypointPrompt() + ChocolateAmount.addToAll(group("amount").formatLong()) } } |