From d4bba2ce4f5a0868bfe4f5ffc81b065860e1b610 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Wed, 28 Nov 2018 01:04:55 -0500 Subject: [PATCH] milo: quantity update bug in listing --- milo/core/listing.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/milo/core/listing.lua b/milo/core/listing.lua index 79dff27..ed00a7d 100644 --- a/milo/core/listing.lua +++ b/milo/core/listing.lua @@ -163,6 +163,8 @@ function listingPage:eventHandler(event) local item = self.grid:getSelected() if item then Sound.play('ui.button.click', .3) + item = Util.shallowCopy(item) + self.grid.values[self.grid.sorted[self.grid.index]] = item item.count = Milo:craftAndEject(item, 1) self.grid:draw() end @@ -171,6 +173,8 @@ function listingPage:eventHandler(event) local item = self.grid:getSelected() if item then Sound.play('ui.button.click', .3) + item = Util.shallowCopy(item) + self.grid.values[self.grid.sorted[self.grid.index]] = item item.count = Milo:craftAndEject(item, itemDB:getMaxCount(item)) self.grid:draw() end @@ -181,7 +185,9 @@ function listingPage:eventHandler(event) Sound.play('ui.button.click', .3) local updated = Milo:getItem(Milo:listItems(), item) if updated then - Milo:craftAndEject(item, updated.count) + item = Util.shallowCopy(item) + self.grid.values[self.grid.sorted[self.grid.index]] = item + item.count = Milo:craftAndEject(item, updated.count) end end @@ -192,7 +198,9 @@ function listingPage:eventHandler(event) Sound.play('ui.button.click', .3) self.statusBar.amount:reset() self:setFocus(self.statusBar.filter) - Milo:craftAndEject(item, count) + item = Util.shallowCopy(item) + self.grid.values[self.grid.sorted[self.grid.index]] = item + item.count = Milo:craftAndEject(item, count) end elseif event.type == 'network' then @@ -266,7 +274,7 @@ function listingPage:enable() self:sync() self.timer = Event.onInterval(3, function() - for _,v in pairs(self.allItems) do + for _,v in pairs(self.grid.values) do local c = context.storage.cache[v.key] v.count = c and c.count or 0 end