Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Auction outbid warning #1818

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern
import at.hannibal2.skyhanni.features.gui.quiver.QuiverDisplay
import at.hannibal2.skyhanni.features.gui.quiver.QuiverWarning
import at.hannibal2.skyhanni.features.inventory.AuctionOutbidWarning
import at.hannibal2.skyhanni.features.inventory.AuctionsHighlighter
import at.hannibal2.skyhanni.features.inventory.ChestValue
import at.hannibal2.skyhanni.features.inventory.DojoRankDisplay
Expand Down Expand Up @@ -939,6 +940,7 @@ class SkyHanniMod {
loadModule(ColdOverlay())
loadModule(QuiverDisplay())
loadModule(QuiverWarning())
loadModule(AuctionOutbidWarning)

init()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ public class AuctionHouseConfig {
@ConfigEditorBoolean
@FeatureToggle
public boolean openPriceWebsite = false;

@Expose
@ConfigOption(name = "Outbid alert", desc = "Sends a warning when you're outbid on an auction.")
@ConfigEditorBoolean
@FeatureToggle
public boolean auctionOutbid = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package at.hannibal2.skyhanni.features.inventory

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.TitleManager
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds

object AuctionOutbidWarning {
private val outbidPattern by RepoPattern.pattern(
"auction.outbid",
"§6\\[Auction].*§eoutbid you by.*§e§lCLICK"
)

@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!SkyHanniMod.feature.inventory.auctions.auctionOutbid) return
if (!outbidPattern.matches(event.message)) return

TitleManager.sendTitle("§cYou have been outbid!", 5.seconds, 3.6, 7.0f)
SoundUtils.playBeepSound()
}
}
Loading