using the new persistence features for the item cache
This commit is contained in:
@@ -9,7 +9,8 @@ aux_auctionable_items = {}
|
|||||||
aux_merchant_buy = {}
|
aux_merchant_buy = {}
|
||||||
aux_merchant_sell = {}
|
aux_merchant_sell = {}
|
||||||
|
|
||||||
local merchant_buy_schema = {'record', '#', {'number', 'boolean'}}
|
local items_schema = {'record', '#', {'string', 'number', 'number', 'string', 'string', 'string', 'number', 'string'}}
|
||||||
|
local merchant_buy_schema = {'record', '#', {'number', 'boolean'} }
|
||||||
|
|
||||||
function public.on_load()
|
function public.on_load()
|
||||||
private.scan_wdb()
|
private.scan_wdb()
|
||||||
@@ -42,17 +43,17 @@ end
|
|||||||
function public.item_info(item_id)
|
function public.item_info(item_id)
|
||||||
local data_string = aux_items[item_id]
|
local data_string = aux_items[item_id]
|
||||||
if data_string then
|
if data_string then
|
||||||
local fields = Aux.util.split(data_string, '#')
|
local name, quality, level, class, subclass, slot, max_stack, texture = Aux.persistence.read(items_schema, data_string)
|
||||||
return {
|
return {
|
||||||
name = fields[1],
|
name = name,
|
||||||
itemstring = 'item:'..item_id..':0:0:0',
|
itemstring = 'item:'..item_id..':0:0:0',
|
||||||
quality = tonumber(fields[2]),
|
quality = quality,
|
||||||
level = tonumber(fields[3]),
|
level = level,
|
||||||
class = fields[4],
|
class = class,
|
||||||
subclass = fields[5],
|
subclass = subclass,
|
||||||
slot = fields[6],
|
slot = slot,
|
||||||
max_stack = fields[7],
|
max_stack = max_stack,
|
||||||
texture = fields[8],
|
texture = texture,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -106,16 +107,16 @@ function private.scan_wdb()
|
|||||||
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
|
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
|
||||||
if name and not aux_item_ids[strlower(name)] then
|
if name and not aux_item_ids[strlower(name)] then
|
||||||
aux_item_ids[strlower(name)] = item_id
|
aux_item_ids[strlower(name)] = item_id
|
||||||
aux_items[item_id] = Aux.util.join({
|
aux_items[item_id] = Aux.persistence.write(items_schema,
|
||||||
name,
|
name,
|
||||||
quality or '',
|
quality,
|
||||||
level or '',
|
level,
|
||||||
class or '',
|
class,
|
||||||
subclass or '',
|
subclass,
|
||||||
slot or '',
|
slot,
|
||||||
max_stack or '',
|
max_stack,
|
||||||
texture or ''
|
texture
|
||||||
}, '#')
|
)
|
||||||
local tooltip = Aux.info.tooltip(function(tt) tt:SetHyperlink(itemstring) end)
|
local tooltip = Aux.info.tooltip(function(tt) tt:SetHyperlink(itemstring) end)
|
||||||
if Aux.info.auctionable(tooltip, quality) then
|
if Aux.info.auctionable(tooltip, quality) then
|
||||||
tinsert(aux_auctionable_items, strlower(name))
|
tinsert(aux_auctionable_items, strlower(name))
|
||||||
|
|||||||
Reference in New Issue
Block a user