aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryAPI.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryStats.kt5
2 files changed, 21 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryAPI.kt
index 9f77ea0cf..d0cbd71fe 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryAPI.kt
@@ -74,6 +74,10 @@ object ChocolateFactoryAPI {
"leaderboard.place",
"§7You are §8#§b(?<position>[\\d,]+)"
)
+ private val leaderboardPercentilePattern by patternGroup.pattern(
+ "leaderboard.percentile",
+ "§7§8You are in the top §.(?<percent>[\\d.]+)%§8 of players!"
+ )
var rabbitSlots = mapOf<Int, Int>()
var otherUpgradeSlots = setOf<Int>()
@@ -95,6 +99,7 @@ object ChocolateFactoryAPI {
var chocolateThisPrestige = 0L
var chocolateMultiplier = 1.0
var leaderboardPosition: Int? = null
+ var leaderboardPercentile: Double? = null
val upgradeableSlots: MutableSet<Int> = mutableSetOf()
var bestUpgrade: Int? = null
@@ -178,6 +183,11 @@ object ChocolateFactoryAPI {
productionItem: ItemStack,
leaderboardItem: ItemStack,
) {
+ leaderboardPosition = null
+ leaderboardPercentile = null
+
+ chocolateMultiplier = 1.0
+
chocolateAmountPattern.matchMatcher(chocolateItem.name.removeColor()) {
chocolateCurrent = group("amount").formatLong()
}
@@ -198,9 +208,15 @@ object ChocolateFactoryAPI {
productionItem.getLore().matchFirst(chocolateMultiplierPattern) {
chocolateMultiplier = group("amount").formatDouble()
}
- leaderboardItem.getLore().matchFirst(leaderboardPlacePattern) {
- leaderboardPosition = group("position").formatInt()
+ for (line in leaderboardItem.getLore()) {
+ leaderboardPlacePattern.matchMatcher(line) {
+ leaderboardPosition = group("position").formatInt()
+ }
+ leaderboardPercentilePattern.matchMatcher(line) {
+ leaderboardPercentile = group("percent").formatDouble()
+ }
}
+
if (!config.statsDisplay) return
ChocolateFactoryStats.updateDisplay()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryStats.kt b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryStats.kt
index e1df1672d..721d54892 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryStats.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/ChocolateFactoryStats.kt
@@ -25,6 +25,7 @@ object ChocolateFactoryStats {
val perHour = perMinute * 60
val perDay = perHour * 24
val position = ChocolateFactoryAPI.leaderboardPosition?.addSeparators() ?: "???"
+ val percentile = ChocolateFactoryAPI.leaderboardPercentile?.let { "§7Top §a$it%" } ?: ""
displayList = formatList(buildList {
add("§6§lChocolate Factory Stats")
@@ -41,7 +42,7 @@ object ChocolateFactoryStats {
add("§eChocolate Multiplier: §6${ChocolateFactoryAPI.chocolateMultiplier}")
add("§eBarn: §6${ChocolateFactoryBarnManager.barnStatus()}")
- add("§ePosition: §7#§b$position")
+ add("§ePosition: §7#§b$position $percentile")
add("")
add("")
@@ -66,7 +67,7 @@ object ChocolateFactoryStats {
PER_DAY("§ePer Day: §6326,654,208"),
MULTIPLIER("§eChocolate Multiplier: §61.77"),
BARN("§eBarn: §6171/190 Rabbits"),
- LEADERBOARD_POS("§ePosition: §7#§b103"),
+ LEADERBOARD_POS("§ePosition: §7#§b103 §7Top §a0.87%"),
EMPTY(""),
EMPTY_2(""),
EMPTY_3(""),