Skip to content

Commit

Permalink
Fix Bazaar instant buy counting to item trackers
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Feb 6, 2025
1 parent 7285192 commit c05791e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ object BazaarApi {
private var currentSearchedItem = ""

var currentlyOpenedProduct: NeuInternalName? = null
var orderOptionProduct: NeuInternalName? = null
private var lastOpenedProduct: NeuInternalName? = null
private var orderOptionProduct: NeuInternalName? = null

private val patternGroup = RepoPattern.group("inventory.bazaar")

Expand Down Expand Up @@ -123,6 +124,7 @@ object BazaarApi {
if (inBazaarInventory) {
val openedProduct = getOpenedProduct(event.inventoryItems) ?: return
currentlyOpenedProduct = openedProduct
lastOpenedProduct = openedProduct
BazaarOpenedProductEvent(openedProduct, event).post()
}
}
Expand All @@ -144,6 +146,13 @@ object BazaarApi {
// pickup items from own bazaar order
OwnInventoryData.ignoreItem(1.seconds) { it == orderOptionProduct }
}

if (inBazaarInventory) {
if (item.getLore().lastOrNull()?.removeColor() == "Click to buy now!") {
// instant buy
OwnInventoryData.ignoreItem(1.seconds) { it == lastOpenedProduct }
}
}
}

private fun getOpenedProduct(inventoryItems: Map<Int, ItemStack>): NeuInternalName? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ object SlayerRngMeterDisplay {
}

private fun makeLink(text: String) =

Renderable.clickAndHover(
text, listOf("§eClick to open RNG Meter Inventory."),
onClick = {
Expand Down

0 comments on commit c05791e

Please sign in to comment.