aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-03 16:31:39 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-03 16:31:39 +0100
commitf13cb64d2a22b2be72e0bb7ff394948158b33166 (patch)
tree89c08654f7ef59671b01014fa5439e5f64adbee0
parentd90e9d082e1bad2e4238eeada3e5f881b3d9a802 (diff)
downloadskyhanni-f13cb64d2a22b2be72e0bb7ff394948158b33166.tar.gz
skyhanni-f13cb64d2a22b2be72e0bb7ff394948158b33166.tar.bz2
skyhanni-f13cb64d2a22b2be72e0bb7ff394948158b33166.zip
Fixed line format when having multiple items in a visitor inventory.
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
index 1e13365e6..d9de3b11d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -130,17 +130,20 @@ class GardenVisitorFeatures {
val list = event.toolTip
var totalPrice = 0.0
var itemsCounter = 0
+ var itemsWithSpeedCounter = 0
var endReached = false
for ((i, l) in list.toMutableList().withIndex()) {
val line = l.substring(4)
if (line == "") {
- if (config.visitorShowPrice) {
- if (itemsCounter > 1) {
- val format = NumberUtil.format(totalPrice)
- list[1] = list[1] + "$line §f(§6Total §6$format§f)"
+ if (!endReached) {
+ if (config.visitorShowPrice) {
+ if (itemsCounter > 1) {
+ val format = NumberUtil.format(totalPrice)
+ list[1] = list[1] + "$line §7(§6Total §6$format§7)"
+ }
}
+ endReached = true
}
- endReached = true
}
// Items Required
@@ -180,7 +183,8 @@ class GardenVisitorFeatures {
} else {
"§cno speed data!"
}
- list.add(i + itemsCounter, " §7- $formatName($formatSpeed§7)")
+ itemsWithSpeedCounter++
+ list.add(i + itemsWithSpeedCounter, " §7- $formatName($formatSpeed§7)")
}
}
}
@@ -191,7 +195,7 @@ class GardenVisitorFeatures {
if (matcher.matches()) {
val coppers = matcher.group(1).replace(",", "").toInt()
val pricePerCopper = NumberUtil.format((totalPrice / coppers).toInt())
- list[i] = list[i] + " §7(Copper price §6$pricePerCopper§7)"
+ list[i + itemsWithSpeedCounter] = list[i + itemsWithSpeedCounter] + " §7(Copper price §6$pricePerCopper§7)"
}
}
}