added item query abstraction

This commit is contained in:
Manuel Simon Hirsig
2016-01-28 00:05:14 +01:00
parent 77c4841ede
commit bada64f629
3 changed files with 37 additions and 38 deletions
+23 -1
View File
@@ -11,7 +11,6 @@ function m.find(test, query, page, status_bar, on_failure, on_success)
local pages = page > 0 and { page, page - 1 } or { page }
query = Aux.util.copy_table(query)
query.page = page
query.next_page = function()
if getn(pages) == 1 then
status_bar:update_status(50, 50)
@@ -42,4 +41,27 @@ function m.find(test, query, page, status_bar, on_failure, on_success)
end,
}
end)
end
function m.create_item_query(item_id, type, start_page, next_page)
local item_info = Aux.static.item_info(item_id)
-- local class_index = Aux.item_class_index(item_info.class)
-- local subclass_index = class_index and Aux.item_subclass_index(class_index, item_info.subclass) -- TODO test if needed
return item_info and {
type = type,
start_page = start_page,
next_page = next_page,
name = item_info.name,
min_level = item_info.level,
min_level = item_info.level,
slot = item_info.slot,
-- class = class_index,
-- subclass = subclass_index,
-- class = Aux.item_class_index(item_info.class),
-- subclass = item_info.subclass,
quality = item_info.quality,
usable = item_info.usable,
}
end