aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt25
2 files changed, 30 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java
index 01d9a29fe..1478df3ad 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java
@@ -163,6 +163,13 @@ public class InventoryConfig {
public boolean highlightAuctions = true;
@Expose
+ @ConfigOption(name = "Highlight Underbid Auctions",
+ desc = "Highlight underbid own lowest BIN auctions that are outbid.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean highlightAuctionsUnderbid = false;
+
+ @Expose
@ConfigOption(name = "Copy Underbid Price",
desc = "Copies the price of an item in the \"Create BIN Auction\" minus 1 coin into the clipboard for faster under-bidding.")
@ConfigEditorBoolean
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt
index 453707c5b..f512733b8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt
@@ -3,20 +3,27 @@ package at.hannibal2.skyhanni.features.inventory
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull
+import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class AuctionsHighlighter {
+ private val config get() = SkyHanniMod.feature.inventory
+ private val buyItNowPattern by RepoPattern.pattern("auctions.highlight.buyitnow", "§7Buy it now: §6(?<coins>.*) coins")
@SubscribeEvent
fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.inventory.highlightAuctions) return
+ if (!config.highlightAuctions) return
if (event.gui !is GuiChest) return
val guiChest = event.gui
@@ -31,10 +38,24 @@ class AuctionsHighlighter {
val lore = stack.getLore()
if (lore.any { it == "§7Status: §aSold!" }) {
slot highlight LorenzColor.GREEN
+ continue
}
if (lore.any { it == "§7Status: §cExpired!" }) {
slot highlight LorenzColor.RED
+ continue
+ }
+ if (config.highlightAuctionsUnderbid) {
+ for (line in lore) {
+ buyItNowPattern.matchMatcher(line) {
+ val coins = group("coins").formatNumber()
+ stack.getInternalNameOrNull()?.getPriceOrNull()?.let {
+ if (coins > it) {
+ slot highlight LorenzColor.GOLD
+ }
+ }
+ }
+ }
}
}
}
-} \ No newline at end of file
+}