Skip to content

Instantly share code, notes, and snippets.

@danhp
Created July 5, 2013 00:49
Show Gist options
  • Save danhp/5930987 to your computer and use it in GitHub Desktop.
Save danhp/5930987 to your computer and use it in GitHub Desktop.
subracts the item from inventory
for i = 1, self.sellAmount do
playerItem, pageIndex, slotIndex = self.player.inventory:search(item)
if self.player.inventory.pages[pageIndex][slotIndex].quantity > 1 then
playerItem.quantity = playerItem.quantity - 1
elseif self.player.inventory.pages[pageIndex][slotIndex].quantity == 1 then
self.player.inventory:removeItem(slotIndex, pageIndex)
end
end
@danhp
Copy link
Author

danhp commented Jul 5, 2013

Assumes sell amount is correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment