milo: quantity update bug in listing
This commit is contained in:
@@ -163,6 +163,8 @@ function listingPage:eventHandler(event)
|
|||||||
local item = self.grid:getSelected()
|
local item = self.grid:getSelected()
|
||||||
if item then
|
if item then
|
||||||
Sound.play('ui.button.click', .3)
|
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)
|
item.count = Milo:craftAndEject(item, 1)
|
||||||
self.grid:draw()
|
self.grid:draw()
|
||||||
end
|
end
|
||||||
@@ -171,6 +173,8 @@ function listingPage:eventHandler(event)
|
|||||||
local item = self.grid:getSelected()
|
local item = self.grid:getSelected()
|
||||||
if item then
|
if item then
|
||||||
Sound.play('ui.button.click', .3)
|
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))
|
item.count = Milo:craftAndEject(item, itemDB:getMaxCount(item))
|
||||||
self.grid:draw()
|
self.grid:draw()
|
||||||
end
|
end
|
||||||
@@ -181,7 +185,9 @@ function listingPage:eventHandler(event)
|
|||||||
Sound.play('ui.button.click', .3)
|
Sound.play('ui.button.click', .3)
|
||||||
local updated = Milo:getItem(Milo:listItems(), item)
|
local updated = Milo:getItem(Milo:listItems(), item)
|
||||||
if updated then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -192,7 +198,9 @@ function listingPage:eventHandler(event)
|
|||||||
Sound.play('ui.button.click', .3)
|
Sound.play('ui.button.click', .3)
|
||||||
self.statusBar.amount:reset()
|
self.statusBar.amount:reset()
|
||||||
self:setFocus(self.statusBar.filter)
|
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
|
end
|
||||||
|
|
||||||
elseif event.type == 'network' then
|
elseif event.type == 'network' then
|
||||||
@@ -266,7 +274,7 @@ function listingPage:enable()
|
|||||||
self:sync()
|
self:sync()
|
||||||
|
|
||||||
self.timer = Event.onInterval(3, function()
|
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]
|
local c = context.storage.cache[v.key]
|
||||||
v.count = c and c.count or 0
|
v.count = c and c.count or 0
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user