From 86d4b87aa98996fd9db5662609662a448cac3158 Mon Sep 17 00:00:00 2001 From: ReyMaratov Date: Sat, 2 Sep 2023 14:06:32 +0200 Subject: hopefully fixed low bps causing impossible ff --- .../features/garden/contest/JacobContestTimeNeeded.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt index 7b0f01015..f3b09d370 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt @@ -71,11 +71,21 @@ class JacobContestTimeNeeded { line = "§9${crop.cropName} §cNo ${currentBracket.displayName} §cMedal!" val cropFF = crop.getLatestTrueFarmingFortune() ?: 0.0 - val blocksPerSecond = crop.getLatestBlocksPerSecond() ?: 20.0 + var blocksPerSecond = crop.getLatestBlocksPerSecond() + if (blocksPerSecond == null) { + bracketText += "§0§l !" //hoping this never shows + blocksPerSecond = 19.9 + } else { + if (blocksPerSecond < 15.0) { + bracketText += "§4§l !" + blocksPerSecond = 19.9 + } + } val cropsPerSecond = amount.toDouble() / blocksPerSecond / 60 val ffNeeded = cropsPerSecond * 100 / 20 / crop.baseDrops val missing = (ffNeeded - cropFF).toInt() bracketText += " §7(${missing.addSeparators()} more FF needed!)" + } brackets.add(bracketText) if (bracket == currentBracket) { @@ -83,6 +93,7 @@ class JacobContestTimeNeeded { showLine = line } } + map[crop] = Renderable.hoverTips(showLine, buildList { add("§7Time Needed for §9${crop.cropName} Medals§7:") addAll(brackets) @@ -112,6 +123,7 @@ class JacobContestTimeNeeded { val text = map[crop]!! add(listOf(crop.icon, text)) } + addAsSingletonList("§eA§4§l ! §eindicates too low Blocks/Second. \nCalculations will use 19.9 instead.") } } -- cgit From a378688a554ecfed7fb497557392eb3e40850332 Mon Sep 17 00:00:00 2001 From: ReyMaratov Date: Sat, 2 Sep 2023 22:23:29 +0200 Subject: hopefully made it work as intended --- .../garden/contest/JacobContestTimeNeeded.kt | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt index f3b09d370..b75250777 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt @@ -63,24 +63,27 @@ class JacobContestTimeNeeded { val timeInMinutes = amount.toDouble() / speed / 60 val formatDuration = TimeUtils.formatDuration((timeInMinutes * 60 * 1000).toLong()) val color = if (timeInMinutes < 20) "§b" else "§c" - val line: String + var line: String + var marking: String = "" var bracketText = "${bracket.displayName} $color$formatDuration" - if (timeInMinutes < 20) { - line = "§9${crop.cropName} §b$formatDuration" + var blocksPerSecond = crop.getLatestBlocksPerSecond() + if (blocksPerSecond == null) { + marking += "§0§l !" //hoping this never shows + blocksPerSecond = 19.9 } else { - line = - "§9${crop.cropName} §cNo ${currentBracket.displayName} §cMedal!" - val cropFF = crop.getLatestTrueFarmingFortune() ?: 0.0 - var blocksPerSecond = crop.getLatestBlocksPerSecond() - if (blocksPerSecond == null) { - bracketText += "§0§l !" //hoping this never shows + if (blocksPerSecond < 15.0) { + marking += "§4§l !" blocksPerSecond = 19.9 } else { - if (blocksPerSecond < 15.0) { - bracketText += "§4§l !" - blocksPerSecond = 19.9 - } + marking += " " } + } + if (timeInMinutes < 20) { + line = "§9${crop.cropName} §b$formatDuration" + marking + } else { + line = + "§9${crop.cropName} §cNo ${currentBracket.displayName} §cMedal!" + marking + val cropFF = crop.getLatestTrueFarmingFortune() ?: 0.0 val cropsPerSecond = amount.toDouble() / blocksPerSecond / 60 val ffNeeded = cropsPerSecond * 100 / 20 / crop.baseDrops val missing = (ffNeeded - cropFF).toInt() @@ -123,7 +126,7 @@ class JacobContestTimeNeeded { val text = map[crop]!! add(listOf(crop.icon, text)) } - addAsSingletonList("§eA§4§l ! §eindicates too low Blocks/Second. \nCalculations will use 19.9 instead.") + addAsSingletonList("§eA§4§l ! §eindicates too low Blocks/Second. Calculations will use 19.9 instead.") } } -- cgit From e38cdf57f48cfbe4563a54505465918fa64a157a Mon Sep 17 00:00:00 2001 From: ReyMaratov Date: Thu, 7 Sep 2023 23:36:01 +0200 Subject: changed the way the bps status is displayed, hope it looks good now :) --- .../skyhanni/features/garden/contest/JacobContestTimeNeeded.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt index b75250777..e885ad7a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt @@ -23,6 +23,7 @@ class JacobContestTimeNeeded { private val config get() = SkyHanniMod.feature.garden private var display = emptyList>() private var currentBracket = ContestBracket.GOLD + private var lowBPSWarning = "" @SubscribeEvent(priority = EventPriority.LOW) fun onLateInventoryOpen(event: InventoryUpdatedEvent) { @@ -70,12 +71,15 @@ class JacobContestTimeNeeded { if (blocksPerSecond == null) { marking += "§0§l !" //hoping this never shows blocksPerSecond = 19.9 + lowBPSWarning = "§cYour Blocks/second is too low, showing 19.9 Blocks/second instead!" } else { if (blocksPerSecond < 15.0) { marking += "§4§l !" blocksPerSecond = 19.9 + lowBPSWarning = "§cYour Blocks/second is too low, showing 19.9 Blocks/second instead!" } else { marking += " " + lowBPSWarning = "§aYour Blocks/second is good :)" } } if (timeInMinutes < 20) { @@ -105,7 +109,7 @@ class JacobContestTimeNeeded { add("§7Latest FF: §e${(latestFF).addSeparators()}") val bps = crop.getLatestBlocksPerSecond()?.round(1) ?: 0 add("§7Blocks/Second: §e${bps.addSeparators()}") - + add(lowBPSWarning) }) } @@ -126,7 +130,6 @@ class JacobContestTimeNeeded { val text = map[crop]!! add(listOf(crop.icon, text)) } - addAsSingletonList("§eA§4§l ! §eindicates too low Blocks/Second. Calculations will use 19.9 instead.") } } -- cgit