aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-03-27 23:01:48 +0100
committerGitHub <noreply@github.com>2024-03-27 23:01:48 +0100
commit03b5b4b427d57b34eca47f206d3266782b855d92 (patch)
tree6d2dca8387622da5a1d29500cb70a16f309573fa /src/main/java/at/hannibal2/skyhanni/features
parent45b21ea54bc21d87ea0650afadcc474ddccf5249 (diff)
downloadskyhanni-03b5b4b427d57b34eca47f206d3266782b855d92.tar.gz
skyhanni-03b5b4b427d57b34eca47f206d3266782b855d92.tar.bz2
skyhanni-03b5b4b427d57b34eca47f206d3266782b855d92.zip
Fix: Seconds per Copper (#1295)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index cfa4fdfb3..fb1fe12bf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -50,7 +50,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import at.hannibal2.skyhanni.utils.TimeUtils
+import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.getLorenzVec
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
@@ -310,7 +310,7 @@ object GardenVisitorFeatures {
private fun readToolTip(visitor: VisitorAPI.Visitor, itemStack: ItemStack?) {
val stack = itemStack ?: error("Accept offer item not found for visitor ${visitor.visitorName}")
var totalPrice = 0.0
- var farmingTimeRequired = -1L
+ var farmingTimeRequired = 0.seconds
var readingShoppingList = true
lastFullPrice = 0.0
val foundRewards = mutableListOf<NEUInternalName>()
@@ -367,11 +367,11 @@ object GardenVisitorFeatures {
copperPattern.matchMatcher(formattedLine) {
val copper = group("amount").formatInt()
val pricePerCopper = NumberUtil.format((totalPrice / copper).toInt())
- val timePerCopper = TimeUtils.formatDuration((farmingTimeRequired / copper) * 1000)
+ val timePerCopper = (farmingTimeRequired / copper).format()
var copperLine = formattedLine
if (config.inventory.copperPrice) copperLine += " §7(§6$pricePerCopper §7per)"
if (config.inventory.copperTime) {
- copperLine += if (farmingTimeRequired != -1L) " §7(§b$timePerCopper §7per)" else " §7(§cno speed data!§7)"
+ copperLine += if (farmingTimeRequired != 0.seconds) " §7(§b$timePerCopper §7per)" else " §7(§cno speed data!§7)"
}
finalList.set(index, copperLine)
}
@@ -400,8 +400,8 @@ object GardenVisitorFeatures {
val cropAmount = multiplier.second.toLong() * amount
val formattedName = "§e${cropAmount.addSeparators()}§7x ${cropType.cropName} "
val formattedSpeed = cropType.getSpeed()?.let { speed ->
- farmingTimeRequired = cropAmount / speed
- val duration = TimeUtils.formatDuration(farmingTimeRequired * 1000)
+ val duration = (cropAmount / speed).seconds
+ farmingTimeRequired += duration
"in §b$duration"
} ?: "§cno speed data!"
if (config.inventory.exactAmountAndTime) {