Fixed item dupe in GE

This commit is contained in:
Ceikry
2023-08-11 13:09:35 +00:00
committed by Ryan
parent 98a5b95407
commit 418f239261
@@ -242,17 +242,11 @@ class StockMarket : InterfaceListener {
return return
} }
var item: Item var item: Item
val amountLeft: Int = offer.amount - amountInInventory(player, offer.itemID) val amountUnnoted = amountInInventory(player, offer.itemID)
val remove = removeItem(player, Item(offer.itemID, offer.amount).also { item = it }) val amountLeft = offer.amount - amountUnnoted
var note: Int val removedUnnoted = removeItem(player, Item(offer.itemID, amountUnnoted).also { item = it })
if (amountLeft > 0) { val removeNoted = if (amountLeft > 0) removeItem(player, Item(itemDefinition(offer.itemID).noteId, amountLeft)) else true
if (item.noteChange.also { note = it } > 0) { if (!removedUnnoted || !removeNoted) return
removeItem(player, Item(note, amountLeft))
} else if (remove) {
addItem(player, offer.itemID, offer.amount - amountLeft)
return
}
}
if(GrandExchange.dispatch(player, offer)) if(GrandExchange.dispatch(player, offer))
{ {
player.removeAttribute("ge-temp") player.removeAttribute("ge-temp")