perfected price scanning
This commit is contained in:
@@ -15,9 +15,19 @@ function public.on_load()
|
||||
private.scan_wdb()
|
||||
Aux.control.event_listener('MERCHANT_SHOW', private.scan_merchant).start()
|
||||
Aux.control.event_listener('MERCHANT_UPDATE', private.scan_merchant).start()
|
||||
-- Aux.control.event_listener('NEW_AUCTION_UPDATE', function()
|
||||
-- -- TODO GetAuctionSellItemInfo()
|
||||
-- -- end).start()
|
||||
Aux.control.event_listener('BAG_UPDATE', function()
|
||||
if MerchantFrame:IsVisible() then
|
||||
private.scan_merchant()
|
||||
end
|
||||
end).start()
|
||||
Aux.control.event_listener('NEW_AUCTION_UPDATE', function()
|
||||
local info = Aux.info.auction_sell_item()
|
||||
if info then
|
||||
if Aux.cache.item_id(info.name) then
|
||||
aux_merchant_sell[Aux.cache.item_id(info.name)] = info.vendor_price / info.aux_quantity
|
||||
end
|
||||
end
|
||||
end).start()
|
||||
end
|
||||
|
||||
function public.merchant_info(item_id)
|
||||
@@ -63,7 +73,7 @@ function private.scan_merchant()
|
||||
local merchant_item_count = GetMerchantNumItems()
|
||||
for i=1,merchant_item_count do
|
||||
local link = GetMerchantItemLink(i)
|
||||
if link then -- TODO somehow try again when the item is in the wdb?
|
||||
if link then
|
||||
local item_id = Aux.info.parse_hyperlink(link)
|
||||
local _, _, price, count, stock = GetMerchantItemInfo(i)
|
||||
local new_unit_price, new_limited = price / count, stock >= 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Aux = {
|
||||
version = '2.9.6',
|
||||
version = '2.9.7',
|
||||
blizzard_ui_shown = false,
|
||||
orig = {},
|
||||
}
|
||||
|
||||
@@ -80,23 +80,27 @@ function public.container_item(bag, slot)
|
||||
end
|
||||
|
||||
function public.auction_sell_item()
|
||||
local name, texture, stack_size, quality, usable, vendor_price = GetAuctionSellItemInfo()
|
||||
local name, texture, count, quality, usable, vendor_price = GetAuctionSellItemInfo()
|
||||
|
||||
if name then
|
||||
|
||||
local unit_vendor_price = vendor_price / stack_size
|
||||
local unit_vendor_price = vendor_price / count
|
||||
local tooltip = public.tooltip(function(tt) tt:SetAuctionSellItem() end)
|
||||
|
||||
return {
|
||||
local charges = private.item_charges(tooltip)
|
||||
local aux_quantity = charges or count
|
||||
|
||||
return {
|
||||
name = name,
|
||||
texture = texture,
|
||||
quality = quality,
|
||||
|
||||
stack_size = stack_size,
|
||||
aux_quantity = aux_quantity,
|
||||
stack_size = count,
|
||||
usable = usable,
|
||||
vendor_price = vendor_price,
|
||||
unit_vendor_price = unit_vendor_price,
|
||||
tooltip = tooltip,
|
||||
charges = private.item_charges(tooltip),
|
||||
charges = charges,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user