diff options
author | SeRaid <77941535+SeRaid743@users.noreply.github.com> | 2024-04-23 19:20:23 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 09:20:23 +0200 |
commit | fc19e6b99f4a8b97300b98d14222fb22fbb7fbd0 (patch) | |
tree | a4a2323d62cafd5f3b31110dc58dfbbd8d6211ef /src/main/java/at | |
parent | 68175690b3109f8e94c2a0f93a7a38b9ad993510 (diff) | |
download | skyhanni-fc19e6b99f4a8b97300b98d14222fb22fbb7fbd0.tar.gz skyhanni-fc19e6b99f4a8b97300b98d14222fb22fbb7fbd0.tar.bz2 skyhanni-fc19e6b99f4a8b97300b98d14222fb22fbb7fbd0.zip |
Add percent to hoppity display (#1501)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java/at')
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(""), |