aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-02 14:08:43 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-02 14:08:43 +0100
commit017edfa6eaca6b682a68c16fc0a9c621ebaf1177 (patch)
tree01953452b6043374d384eb5024d11c006f52e8cb
parentbed5c3e71c36086b7dcdfaeb8db357ba28472ab9 (diff)
downloadskyhanni-017edfa6eaca6b682a68c16fc0a9c621ebaf1177.tar.gz
skyhanni-017edfa6eaca6b682a68c16fc0a9c621ebaf1177.tar.bz2
skyhanni-017edfa6eaca6b682a68c16fc0a9c621ebaf1177.zip
Show the price for copper inside the visitor gui.
-rw-r--r--CHANGELOG.md1
-rw-r--r--FEATURES.md1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt22
4 files changed, 25 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d7fd7571..eb1b58e72 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@
+ Added **Plot Price** - Show the price of the plot in coins when inside the Configure Plots inventory.
+ Added **Garden Crop Milestone Display** - Shows the progress and ETA until the next crop milestone is reached and the current crops/minute value. (Requires a tool with either a counter or cultivating enchantment)
+ Added **Best Crop Display** - Lists all crops and their ETA till next milestone. Sorts for best crop for getting garden level or skyblock level.
+* Added **Copper Price** - Show the price for copper inside the visitor gui.
### Features from other Mods
diff --git a/FEATURES.md b/FEATURES.md
index 0d0de684b..225d50b7b 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -171,6 +171,7 @@
+ **Plot Price** - Show the price of the plot in coins when inside the Configure Plots inventory.
+ **Garden Crop Milestone Display** - Shows the progress and ETA until the next crop milestone is reached and the current crops/minute value. (Requires a tool with either a counter or cultivating enchantment)
+ **Best Crop Display** - Lists all crops and their ETA till next milestone. Sorts for best crop for getting garden level or skyblock level.
++ **Copper Price** - Show the price for copper inside the visitor gui.
## Commands
- /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki)
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 d05b29442..a50d9201d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -96,12 +96,18 @@ public class Garden {
public boolean visitorHighlight = true;
@Expose
- @ConfigOption(name = "Show Price", desc = "Show the bazaar price of the items required for the visitors.")
+ @ConfigOption(name = "Visitor Price", desc = "Show the bazaar price of the items required for the visitors.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
public boolean visitorShowPrice = true;
@Expose
+ @ConfigOption(name = "Copper Price", desc = "Show the price for copper inside the visitor gui.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean visitorCopperPrice = false;
+
+ @Expose
@ConfigOption(name = "Numbers", desc = "")
@ConfigEditorAccordion(id = 4)
public boolean numbers = false;
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 0a064401e..b9fb4ee5f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -19,6 +19,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import java.util.*
+import java.util.regex.Pattern
class GardenVisitorFeatures {
@@ -27,6 +28,7 @@ class GardenVisitorFeatures {
private var lastClickedNpc = 0
private var nearby = false
private var tick = 0
+ private val copperPattern = Pattern.compile(" §8\\+§c(.*) Copper")
private val config: Garden get() = SkyHanniMod.feature.garden
companion object {
@@ -134,21 +136,21 @@ class GardenVisitorFeatures {
val name = event.itemStack.name ?: return
if (name != "§aAccept Offer") return
- var i = 0
val list = event.toolTip
var totalPrice = 0.0
var amountDifferentItems = 0
- for (l in list) {
+ var endReached = false
+ for ((i, l) in list.withIndex()) {
val line = l.substring(4)
if (line == "") {
if (amountDifferentItems > 1) {
val format = NumberUtil.format(totalPrice)
list[1] = list[1] + "$line §f(§6Total §6$format§f)"
}
- break
+ endReached = true
}
- if (i > 1) {
+ if (i > 1 && !endReached) {
val (itemName, amount) = ItemUtils.readItemAmount(line)
if (itemName != null) {
val lowestBin: Double
@@ -159,7 +161,7 @@ class GardenVisitorFeatures {
println(message)
LorenzUtils.error(message)
e.printStackTrace()
- continue
+ return
}
val price = lowestBin * amount
totalPrice += price
@@ -168,7 +170,15 @@ class GardenVisitorFeatures {
amountDifferentItems++
}
}
- i++
+
+ if (config.visitorCopperPrice) {
+ val matcher = copperPattern.matcher(line)
+ if (matcher.matches()) {
+ val coppers = matcher.group(1).replace(",", "").toInt()
+ val pricePerCopper = NumberUtil.format((totalPrice / coppers).toInt())
+ list[i] = list[i] + " §f(§7Copper price §6$pricePerCopper§f)"
+ }
+ }
}
}