aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-21 12:48:55 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-21 12:48:55 +0100
commitc9757841e10bb214e8fd7edd0f07e5c5ef88fe4a (patch)
tree0b42edf001d12972cf9152891d7f1f46865539de /src/main/java
parentfac81a0d521cbaa6b3feadf31d049fc236fbb039 (diff)
downloadskyhanni-c9757841e10bb214e8fd7edd0f07e5c5ef88fe4a.tar.gz
skyhanni-c9757841e10bb214e8fd7edd0f07e5c5ef88fe4a.tar.bz2
skyhanni-c9757841e10bb214e8fd7edd0f07e5c5ef88fe4a.zip
Highlight underbid own lowest BIN auctions that are outbid.
Diffstat (limited to 'src/main/java')
-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
+}