autocrafting fix

This commit is contained in:
kepler155c
2018-01-26 07:19:42 -05:00
parent fcaaf87052
commit bcf08b0fe3

View File

@@ -1233,20 +1233,21 @@ function craftPage.wizard:eventHandler(event)
return UI.Wizard.eventHandler(self, event) return UI.Wizard.eventHandler(self, event)
end end
function craftPage:eventHandler(event) function craftPage.wizard.pags.resources:enable()
if event.type == 'cancel' then
UI:setPreviousPage()
elseif event.type == 'enable_view' and event.next then
local items = listItems() local items = listItems()
local count = tonumber(self.wizard.pages.quantity.count.value) local count = tonumber(self.parent.quantity.count.value)
local recipe = Craft.findRecipe(self.item) local recipe = Craft.findRecipe(self.item)
local ingredients = Craft.getResourceList4(recipe, items, count) local ingredients = Craft.getResourceList4(recipe, items, count)
for _,v in pairs(ingredients) do for _,v in pairs(ingredients) do
v.displayName = itemDB:getName(v) v.displayName = itemDB:getName(v)
end end
self.wizard.pages.resources.grid:setValues(ingredients) self.grid:setValues(ingredients)
return false return UI.Window.enable(self)
end
function craftPage:eventHandler(event)
if event.type == 'cancel' then
UI:setPreviousPage()
elseif event.type == 'accept' then elseif event.type == 'accept' then
local key = uniqueKey(self.item) local key = uniqueKey(self.item)