aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-15 16:42:11 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-15 16:42:11 +0100
commitecdd0502e7aef26b1fba17f763d769b25c1a34d4 (patch)
tree70dc3c90acf29544e9c11d2f88ff1503f68cb595 /src
parent1f220684fc455edfc9f202d8c7ab61dfaf875e1d (diff)
downloadskyhanni-ecdd0502e7aef26b1fba17f763d769b25c1a34d4.tar.gz
skyhanni-ecdd0502e7aef26b1fba17f763d769b25c1a34d4.tar.bz2
skyhanni-ecdd0502e7aef26b1fba17f763d769b25c1a34d4.zip
Added option to calculate with fix Blocks per Second values for all crops in Time Needed for Medal GUI.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt47
2 files changed, 56 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java
index a5d9847ca..6b563c5cc 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java
@@ -1433,14 +1433,34 @@ public class GardenConfig {
@Expose
@ConfigOption(
- name = "Contest Time Needed",
- desc = "Show the time and missing FF for every crop inside Jacob's Farming Contest inventory."
+ name = "Contest Time Needed",
+ desc = "Show the time and missing FF for every crop inside Jacob's Farming Contest inventory."
)
@ConfigEditorBoolean
@FeatureToggle
+ // TODO rename to jacobContestTimes
public boolean jacobContextTimes = true;
@Expose
+ @ConfigOption(
+ name = "Assume Fix BPS",
+ desc = "Use a fixed Block Per Seconds value for the Contest Time Needed and Contest Summary Feature. When disabled, using the last tracked BPS value."
+ )
+ @ConfigEditorBoolean
+ public boolean jacobContestAssumeFixBps = true;
+
+ // TODO moulconfig runnable support
+ @Expose
+ @ConfigOption(name = "Fix BPS Value", desc = "Set your fix Blocks per Second here.")
+ @ConfigEditorSlider(
+ minValue = 15,
+ maxValue = 20,
+ minStep = 0.1f
+ )
+ public double jacobContestAssumeFixBpsValue = 19.9;
+
+ @Expose
+ // TODO rename to jacobContestTimesPos
public Position jacobContextTimesPos = new Position(-359, 149, false, true);
@Expose
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 c02835270..6d1913112 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
@@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.InventoryUpdatedEvent
import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay.Companion.getLatestTrueFarmingFortune
import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getLatestBlocksPerSecond
-import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector
@@ -63,8 +62,9 @@ class JacobContestTimeNeeded {
sorted: MutableMap<CropType, Double>,
map: MutableMap<CropType, Renderable>
) {
- val speed = crop.getSpeed()
- if (speed == null) {
+
+ val bps = crop.getBps()
+ if (bps == null) {
sorted[crop] = Double.MAX_VALUE
map[crop] = Renderable.hoverTips(
"§9${crop.cropName} §cNo speed data!",
@@ -72,6 +72,15 @@ class JacobContestTimeNeeded {
)
return
}
+ val ff = crop.getLatestTrueFarmingFortune()
+ if (ff == null) {
+ sorted[crop] = Double.MAX_VALUE
+ map[crop] = Renderable.hoverTips(
+ "§9${crop.cropName} §cNo Farming Fortune data!",
+ listOf("§cHold a ${crop.cropName} specific", "§cfarming tool in hand to show data!")
+ )
+ return
+ }
val averages = FarmingContestAPI.calculateAverages(crop).second
if (averages.isEmpty()) {
@@ -86,6 +95,8 @@ class JacobContestTimeNeeded {
return
}
+ val speed = (ff * crop.baseDrops * bps / 100).round(1).toInt()
+
renderCrop(speed, crop, averages, sorted, map)
}
@@ -98,7 +109,7 @@ class JacobContestTimeNeeded {
) {
var lowBPSWarning = listOf<String>()
val rawSpeed = speed.toDouble()
- val speedForFormular = crop.getLatestBlocksPerSecond()?.let {
+ val speedForFormular = crop.getBps()?.let {
if (it < 15) {
val v = rawSpeed / it
(v * 19.9).toInt()
@@ -106,13 +117,18 @@ class JacobContestTimeNeeded {
} ?: speed
var showLine = ""
val brackets = mutableListOf<String>()
- for ((bracket, amount) in averages) {
+ for (bracket in ContestBracket.entries) {
+ val amount = averages[bracket]
+ if (amount == null) {
+ brackets.add("${bracket.displayName} §cNo contest data found!")
+ continue
+ }
val timeInMinutes = amount.toDouble() / speedForFormular / 60
val formatDuration = TimeUtils.formatDuration((timeInMinutes * 60 * 1000).toLong())
val color = if (timeInMinutes < 20) "§b" else "§c"
var marking = ""
var bracketText = "${bracket.displayName} $color$formatDuration"
- var blocksPerSecond = crop.getLatestBlocksPerSecond()
+ var blocksPerSecond = crop.getBps()
if (blocksPerSecond == null) {
marking += "§0§l !" //hoping this never shows
blocksPerSecond = 19.9
@@ -125,18 +141,17 @@ class JacobContestTimeNeeded {
listOf("§cYour Blocks/second is too low,", "§cshowing 19.9 Blocks/second instead!")
} else {
marking += " "
- lowBPSWarning = listOf("§aYour Blocks/second is good :)")
}
}
val line = if (timeInMinutes < 20) {
- "§9${crop.cropName} §b$formatDuration" + marking
+ "§9${crop.cropName} §7in §b$formatDuration" + marking
} else {
val cropFF = crop.getLatestTrueFarmingFortune() ?: 0.0
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!)"
- "§9${crop.cropName} §cNo ${currentBracket.displayName} §cMedal possible!" + marking
+ bracketText += " §7(Need ${missing.addSeparators()} FF more)"
+ "§9${crop.cropName} §cNo ${currentBracket.displayName} §cmedal possible!" + marking
}
brackets.add(bracketText)
if (bracket == currentBracket) {
@@ -150,12 +165,18 @@ class JacobContestTimeNeeded {
add("")
val latestFF = crop.getLatestTrueFarmingFortune() ?: 0.0
add("§7Latest FF: §e${(latestFF).addSeparators()}")
- val bps = crop.getLatestBlocksPerSecond()?.round(1) ?: 0
- add("§7Blocks/Second: §e${bps.addSeparators()}")
+ val bps = crop.getBps()?.round(1) ?: 0
+ add("§7${addBpsTitle()}§e${bps.addSeparators()}")
addAll(lowBPSWarning)
})
}
+ private fun addBpsTitle() = if (config.jacobContestAssumeFixBps) "Fix Blocks/Second: " else "Your Blocks/Second: "
+
+ private fun CropType.getBps() = if (config.jacobContestAssumeFixBps) {
+ config.jacobContestAssumeFixBpsValue
+ } else getLatestBlocksPerSecond()
+
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) {
if (!isEnabled()) return
@@ -164,4 +185,4 @@ class JacobContestTimeNeeded {
}
fun isEnabled() = LorenzUtils.inSkyBlock && config.jacobContextTimes
-} \ No newline at end of file
+}