diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-21 12:48:55 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-21 12:48:55 +0100 |
commit | c9757841e10bb214e8fd7edd0f07e5c5ef88fe4a (patch) | |
tree | 0b42edf001d12972cf9152891d7f1f46865539de /src/main/java/at/hannibal2/skyhanni/features | |
parent | fac81a0d521cbaa6b3feadf31d049fc236fbb039 (diff) | |
download | skyhanni-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/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt | 25 |
1 files changed, 23 insertions, 2 deletions
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 +} |