diff --git a/scan.lua b/scan.lua index 2b7f553..66e0a05 100644 --- a/scan.lua +++ b/scan.lua @@ -68,7 +68,11 @@ function wait_for_results(k) end function wait_for_owner_data(k) + local t0 = time() return controller().wait(function() + if time() - t0 > 5 then -- we won't wait longer than 5 seconds + return true + end local count, _ = GetNumAuctionItems(state.job.type) for i=1,count do local auction_info = Aux.info.auction(i, state.job.type) diff --git a/static.lua b/static.lua index 9bb1151..350bee9 100644 --- a/static.lua +++ b/static.lua @@ -3,6 +3,9 @@ Aux.static = public aux_auctionable_items = {} +private.last_query_time = 0 +private.uncached_item_ids = {} + function public.on_event() if event == 'VARIABLES_LOADED' then @@ -14,11 +17,34 @@ function public.on_event() local name = GetItemInfo(item_id) if name then tinsert(Aux.localized_auctionable_items, { name=name, id=item_id }) - end + else + tinsert(private.uncached_item_ids, item_id) + end end end end +function public.on_update() + while private.uncached_item_ids[1] do + local name = GetItemInfo(private.uncached_item_ids[1]) + if name then + local item_id = tremove(private.uncached_item_ids, 1) + tinsert(Aux.localized_auctionable_items, { name=name, id=item_id }) + else + break + end + end + + if private.uncached_item_ids[1] then + local now = time() + if now - private.last_query_time > 1 then + private.last_query_time = now + Aux.log('querying data for item id '..private.uncached_item_ids[1]) + AuxStaticTooltip:SetHyperlink('item:'..private.uncached_item_ids[1]) + end + end +end + function private.find_auctionable_items(i) for j=i, i+1000 do local name = GetItemInfo('item:'..j) @@ -7247,4 +7273,4 @@ private.auctionable_items = { [7205] = 24281, [7206] = 24282, [7207] = 24283, -} \ No newline at end of file +} diff --git a/static.xml b/static.xml index 6de6d49..f225fbc 100644 --- a/static.xml +++ b/static.xml @@ -9,7 +9,11 @@ Aux.static.on_event() - + + + Aux.static.on_update() + + diff --git a/statistics.lua b/statistics.lua new file mode 100644 index 0000000..e69de29