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
}
var item: Item
val amountLeft: Int = offer.amount - amountInInventory(player, offer.itemID)
val remove = removeItem(player, Item(offer.itemID, offer.amount).also { item = it })
var note: Int
if (amountLeft > 0) {
if (item.noteChange.also { note = it } > 0) {
removeItem(player, Item(note, amountLeft))
} else if (remove) {
addItem(player, offer.itemID, offer.amount - amountLeft)
return
}
}
val amountUnnoted = amountInInventory(player, offer.itemID)
val amountLeft = offer.amount - amountUnnoted
val removedUnnoted = removeItem(player, Item(offer.itemID, amountUnnoted).also { item = it })
val removeNoted = if (amountLeft > 0) removeItem(player, Item(itemDefinition(offer.itemID).noteId, amountLeft)) else true
if (!removedUnnoted || !removeNoted) return
if(GrandExchange.dispatch(player, offer))
{
player.removeAttribute("ge-temp")