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

Fix: auction price comparison inventory close #3165

Merged
merged 1 commit into from
Jan 7, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryOpenEvent
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.features.inventory.AuctionsHighlighter
Expand Down Expand Up @@ -34,9 +35,8 @@ object AuctionHousePriceComparison {

@SubscribeEvent
fun onInventoryOpen(event: InventoryOpenEvent) {
inInventory = false
if (!event.inventoryName.startsWith("Auctions")) return
inInventory = true
inInventory = event.inventoryName.startsWith("Auctions")
if (!inInventory) return

bestPrice = 0L
worstPrice = 0L
Expand All @@ -56,6 +56,11 @@ object AuctionHousePriceComparison {
this.slotPriceMap = map
}

@SubscribeEvent
fun onInventoryClose(event: InventoryCloseEvent) {
inInventory = false
}

private fun MutableMap<Int, Long>.add(stack: ItemStack, binPrice: Long, slot: Int) {
val (totalPrice, basePrice) = EstimatedItemValueCalculator.calculate(stack, mutableListOf())
if (totalPrice == basePrice) return
Expand Down
Loading