some bugfixes and refactorings
This commit is contained in:
@@ -14,10 +14,10 @@ aux_characters = {}
|
||||
function public.LOAD()
|
||||
m.scan_wdb()
|
||||
|
||||
Aux.control.event_listener('MERCHANT_SHOW', m.on_merchant_show):start()
|
||||
Aux.control.event_listener('MERCHANT_CLOSED', m.on_merchant_closed):start()
|
||||
Aux.control.event_listener('MERCHANT_UPDATE', m.on_merchant_update):start()
|
||||
Aux.control.event_listener('BAG_UPDATE', m.on_bag_update):start()
|
||||
Aux.control.event_listener('MERCHANT_SHOW', m.on_merchant_show)
|
||||
Aux.control.event_listener('MERCHANT_CLOSED', m.on_merchant_closed)
|
||||
Aux.control.event_listener('MERCHANT_UPDATE', m.on_merchant_update)
|
||||
Aux.control.event_listener('BAG_UPDATE', m.on_bag_update)
|
||||
|
||||
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update)
|
||||
|
||||
@@ -29,7 +29,7 @@ function public.LOAD()
|
||||
aux_merchant_sell[Aux.cache.item_id(info.name)] = info.vendor_price / (Aux.info.max_item_charges(item_id) or info.count)
|
||||
end
|
||||
end
|
||||
end):start()
|
||||
end)
|
||||
end
|
||||
|
||||
do
|
||||
|
||||
+2
-5
@@ -40,15 +40,12 @@ function private.post_auction(slot, k)
|
||||
end)
|
||||
|
||||
local posted
|
||||
local listener = Aux.control.event_listener('CHAT_MSG_SYSTEM')
|
||||
listener:set_action(function()
|
||||
Aux.control.event_listener('CHAT_MSG_SYSTEM', function()
|
||||
if arg1 == ERR_AUCTION_STARTED then
|
||||
listener:stop()
|
||||
c()
|
||||
return Aux.control.kill
|
||||
end
|
||||
end)
|
||||
listener:start()
|
||||
|
||||
else
|
||||
return m.stop()
|
||||
end
|
||||
|
||||
+9
-10
@@ -89,27 +89,26 @@ end
|
||||
|
||||
function private.wait_for_list_results(c)
|
||||
local updated, last_update
|
||||
local listener = Aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function()
|
||||
Aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function()
|
||||
if -c then
|
||||
return Aux.control.kill
|
||||
end
|
||||
last_update = GetTime()
|
||||
updated = true
|
||||
end)
|
||||
listener:start()
|
||||
local type = m.th.params.type
|
||||
local ignore_owner = m.th.params.ignore_owner or aux_ignore_owner
|
||||
Aux.control.as_soon_as(function()
|
||||
-- short circuiting order important, owner_data_complete must be called iif an update has happened.
|
||||
-- if no update has happened it must not be called for performance reasons, otherwise it must be called to request further missing data if there is any
|
||||
local ok = updated and (ignore_owner or m.owner_data_complete()) or last_update and GetTime() - last_update > 5
|
||||
local ok = updated and (ignore_owner or m.owner_data_complete(type)) or last_update and GetTime() - last_update > 5
|
||||
updated = false
|
||||
return ok
|
||||
end, function()
|
||||
listener:stop()
|
||||
return c()
|
||||
end)
|
||||
end, c)
|
||||
end
|
||||
|
||||
function private.owner_data_complete()
|
||||
function private.owner_data_complete(type)
|
||||
for i=1,PAGE_SIZE do
|
||||
local auction_info = Aux.info.auction(i, m.th.params.type)
|
||||
local auction_info = Aux.info.auction(i, type)
|
||||
if auction_info and not auction_info.owner then
|
||||
return false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user