From 885f00f5a6ea4539a6dab2a44f0dd2951c1247bc Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 21 Mar 2023 20:26:31 +0100 Subject: Added price per garden exp in visitor gui --- .../java/at/hannibal2/skyhanni/config/features/Garden.java | 8 +++++++- .../skyhanni/features/garden/GardenVisitorFeatures.kt | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java index 75f934584..bfa578547 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -97,11 +97,17 @@ public class Garden { public boolean visitorExactAmountAndTime = true; @Expose - @ConfigOption(name = "Copper Price", desc = "Show the price for copper inside the visitor gui.") + @ConfigOption(name = "Copper Price", desc = "Show the price per copper inside the visitor gui.") @ConfigEditorBoolean @ConfigAccordionId(id = 4) public boolean visitorCopperPrice = false; + @Expose + @ConfigOption(name = "Experience Price", desc = "Show the price per garden experience inside the visitor gui.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 4) + public boolean visitorExperiencePrice = false; + @Expose @ConfigOption(name = "Notification Chat", desc = "Show in chat when a new visitor is visiting your island.") @ConfigEditorBoolean 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 fb08d212c..85b311c10 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt @@ -34,6 +34,7 @@ class GardenVisitorFeatures { private var onBarnPlot = false private var tick = 0 private val copperPattern = Pattern.compile(" §8\\+§c(.*) Copper") + private val gardenExperiencePattern = Pattern.compile(" §8\\+§2(.*) §7Garden Experience") private val offerAcceptedPattern = Pattern.compile("§6§lOFFER ACCEPTED §r§8with §r(.*) §r.*") private val config get() = SkyHanniMod.feature.garden @@ -256,7 +257,15 @@ class GardenVisitorFeatures { if (matcher.matches()) { val coppers = matcher.group(1).replace(",", "").toInt() val pricePerCopper = NumberUtil.format((totalPrice / coppers).toInt()) - list[i + itemsWithSpeedCounter] = "$line §7(Copper price §6$pricePerCopper§7)" + list[i + itemsWithSpeedCounter] = "$line §7(price per §6$pricePerCopper§7)" + } + } + if (config.visitorExperiencePrice) { + val matcher = gardenExperiencePattern.matcher(line) + if (matcher.matches()) { + val gardenExp = matcher.group(1).replace(",", "").toInt() + val pricePerCopper = NumberUtil.format((totalPrice / gardenExp).toInt()) + list[i + itemsWithSpeedCounter] = "$line §7(price per §6$pricePerCopper§7)" } } } -- cgit