module refactoring
This commit is contained in:
+21
-16
@@ -1,7 +1,8 @@
|
|||||||
--aux_account_settings = {} -- TODO clean up the mess of savedvariables
|
--aux_account_settings = {} -- TODO clean up the mess of savedvariables
|
||||||
--aux_character_settings = {}
|
--aux_character_settings = {}
|
||||||
|
|
||||||
do local modules = {}
|
do
|
||||||
|
local modules = {}
|
||||||
local mt = {__metatable=false, __index=function(_, key) return modules[key]._I end, __newindex=error}
|
local mt = {__metatable=false, __index=function(_, key) return modules[key]._I end, __newindex=error}
|
||||||
aux = function(name)
|
aux = function(name)
|
||||||
if not modules[name] then
|
if not modules[name] then
|
||||||
@@ -37,11 +38,15 @@ for event in temp-S('ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'AUCTION
|
|||||||
event_frame:RegisterEvent(event)
|
event_frame:RegisterEvent(event)
|
||||||
end
|
end
|
||||||
|
|
||||||
ADDON_LOADED = t
|
private.ADDON_LOADED = t
|
||||||
do
|
do
|
||||||
local handlers, handlers2 = t, t
|
local handlers, handlers2 = t, t
|
||||||
function public.LOAD.set(f) tinsert(handlers, f) end
|
function public.LOAD.set(f)
|
||||||
function public.LOAD2.set(f) tinsert(handlers2, f) end
|
tinsert(handlers, f)
|
||||||
|
end
|
||||||
|
function public.LOAD2.set(f)
|
||||||
|
tinsert(handlers2, f)
|
||||||
|
end
|
||||||
event_frame:SetScript('OnEvent', function()
|
event_frame:SetScript('OnEvent', function()
|
||||||
if event == 'ADDON_LOADED' then
|
if event == 'ADDON_LOADED' then
|
||||||
(ADDON_LOADED[arg1] or nop)()
|
(ADDON_LOADED[arg1] or nop)()
|
||||||
@@ -56,7 +61,7 @@ do
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
tab_info = t
|
private.tab_info = t
|
||||||
do
|
do
|
||||||
for _, info in temp-A(temp-A('search_tab', 'Search'), temp-A('post_tab', 'Post'), temp-A('auctions_tab', 'Auctions'), temp-A('bids_tab', 'Bids')) do
|
for _, info in temp-A(temp-A('search_tab', 'Search'), temp-A('post_tab', 'Post'), temp-A('auctions_tab', 'Auctions'), temp-A('bids_tab', 'Bids')) do
|
||||||
local tab = T('name', info[2])
|
local tab = T('name', info[2])
|
||||||
@@ -74,13 +79,13 @@ do
|
|||||||
local index
|
local index
|
||||||
function private.active_tab.get() return tab_info[index] end
|
function private.active_tab.get() return tab_info[index] end
|
||||||
function on_tab_click(i)
|
function on_tab_click(i)
|
||||||
(index and active_tab.CLOSE or nop)()
|
do (index and active_tab.CLOSE or nop)() end
|
||||||
index = i
|
index = i
|
||||||
;(index and active_tab.OPEN or nop)()
|
do (index and active_tab.OPEN or nop)() end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SetItemRef(...) auto[arg] = true
|
function private.SetItemRef(...) auto[arg] = true
|
||||||
if arg[3] ~= 'RightButton' or not index(active_tab, 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then
|
if arg[3] ~= 'RightButton' or not index(active_tab, 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then
|
||||||
return orig.SetItemRef(unpack(arg))
|
return orig.SetItemRef(unpack(arg))
|
||||||
end
|
end
|
||||||
@@ -89,7 +94,7 @@ function SetItemRef(...) auto[arg] = true
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function UseContainerItem(...) auto[arg] = true
|
function private.UseContainerItem(...) auto[arg] = true
|
||||||
if modified or not index(active_tab, 'USE_ITEM') then
|
if modified or not index(active_tab, 'USE_ITEM') then
|
||||||
return orig.UseContainerItem(unpack(arg))
|
return orig.UseContainerItem(unpack(arg))
|
||||||
end
|
end
|
||||||
@@ -152,7 +157,7 @@ end
|
|||||||
|
|
||||||
function public.is_player(name, current)
|
function public.is_player(name, current)
|
||||||
local realm = GetCVar('realmName')
|
local realm = GetCVar('realmName')
|
||||||
return not current and index(_G.aux_characters, realm, name) or UnitName('player') == name
|
return not current and index(aux_characters, realm, name) or UnitName('player') == name
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.neutral_faction()
|
function public.neutral_faction()
|
||||||
@@ -163,13 +168,13 @@ function public.min_bid_increment(current_bid)
|
|||||||
return max(1, floor(current_bid / 100) * 5)
|
return max(1, floor(current_bid / 100) * 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
function AUCTION_HOUSE_SHOW()
|
function private.AUCTION_HOUSE_SHOW()
|
||||||
AuctionFrame:Hide()
|
AuctionFrame:Hide()
|
||||||
aux_frame:Show()
|
aux_frame:Show()
|
||||||
tab = 1
|
tab = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function AUCTION_HOUSE_CLOSED()
|
function private.AUCTION_HOUSE_CLOSED()
|
||||||
bids_loaded = false
|
bids_loaded = false
|
||||||
current_owner_page = nil
|
current_owner_page = nil
|
||||||
aux.post.stop()
|
aux.post.stop()
|
||||||
@@ -179,18 +184,18 @@ function AUCTION_HOUSE_CLOSED()
|
|||||||
aux_frame:Hide()
|
aux_frame:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
function AUCTION_BIDDER_LIST_UPDATE()
|
function private.AUCTION_BIDDER_LIST_UPDATE()
|
||||||
bids_loaded = true
|
bids_loaded = true
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local last_owner_page_requested
|
local last_owner_page_requested
|
||||||
function GetOwnerAuctionItems(...) auto[arg] = true
|
function private.GetOwnerAuctionItems(...) auto[arg] = true
|
||||||
local page = arg[1]
|
local page = arg[1]
|
||||||
last_owner_page_requested = page
|
last_owner_page_requested = page
|
||||||
return orig.GetOwnerAuctionItems(unpack(arg))
|
return orig.GetOwnerAuctionItems(unpack(arg))
|
||||||
end
|
end
|
||||||
function AUCTION_OWNED_LIST_UPDATE()
|
function private.AUCTION_OWNED_LIST_UPDATE()
|
||||||
current_owner_page = last_owner_page_requested or 0
|
current_owner_page = last_owner_page_requested or 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -268,7 +273,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function AuctionFrameAuctions_OnEvent(...) auto[arg] = true
|
function private.AuctionFrameAuctions_OnEvent(...) auto[arg] = true
|
||||||
if AuctionFrameAuctions:IsVisible() then
|
if AuctionFrameAuctions:IsVisible() then
|
||||||
return orig.AuctionFrameAuctions_OnEvent(unpack(arg))
|
return orig.AuctionFrameAuctions_OnEvent(unpack(arg))
|
||||||
end
|
end
|
||||||
|
|||||||
+27
-11
@@ -12,7 +12,7 @@ function LOAD()
|
|||||||
event_frame:SetScript('OnEvent', EVENT)
|
event_frame:SetScript('OnEvent', EVENT)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EVENT()
|
function private.EVENT()
|
||||||
for id, listener in listeners do
|
for id, listener in listeners do
|
||||||
if listener.killed then
|
if listener.killed then
|
||||||
listeners[id] = nil
|
listeners[id] = nil
|
||||||
@@ -23,11 +23,15 @@ function EVENT()
|
|||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
function UPDATE()
|
function private.UPDATE()
|
||||||
for _, listener in listeners do
|
for _, listener in listeners do
|
||||||
local event, needed = listener.event, false
|
local event, needed = listener.event, false
|
||||||
for _, listener in listeners do needed = needed or listener.event == event and not listener.killed end
|
for _, listener in listeners do
|
||||||
if not needed then event_frame:UnregisterEvent(event) end
|
needed = needed or listener.event == event and not listener.killed
|
||||||
|
end
|
||||||
|
if not needed then
|
||||||
|
event_frame:UnregisterEvent(event)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for id, thread in threads do
|
for id, thread in threads do
|
||||||
@@ -44,21 +48,33 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
do local id = 0
|
do
|
||||||
function private.unique_id.get() id = id + 1; return id end
|
local id = 0
|
||||||
|
function private.unique_id.get()
|
||||||
|
id = id + 1
|
||||||
|
return id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.kill_listener(listener_id)
|
function public.kill_listener(listener_id)
|
||||||
for listener in present(listeners[listener_id]) do listener.killed = true end
|
for listener in present(listeners[listener_id]) do
|
||||||
|
listener.killed = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.kill_thread(thread_id)
|
function public.kill_thread(thread_id)
|
||||||
for thread in present(threads[thread_id]) do thread.killed = true end
|
for thread in present(threads[thread_id]) do
|
||||||
|
thread.killed = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.event_listener(event, cb)
|
function public.event_listener(event, cb)
|
||||||
local listener_id = unique_id
|
local listener_id = unique_id
|
||||||
listeners[listener_id] = { event=event, cb=cb, kill=vararg-function(arg) if getn(arg) == 0 or arg[1] then kill_listener(listener_id) end end }
|
listeners[listener_id] = T(
|
||||||
|
'event', event,
|
||||||
|
'cb', cb,
|
||||||
|
'kill', vararg-function(arg) if getn(arg) == 0 or arg[1] then kill_listener(listener_id) end end
|
||||||
|
)
|
||||||
event_frame:RegisterEvent(event)
|
event_frame:RegisterEvent(event)
|
||||||
return listener_id
|
return listener_id
|
||||||
end
|
end
|
||||||
@@ -70,7 +86,7 @@ end
|
|||||||
function public.vararg.thread(arg)
|
function public.vararg.thread(arg)
|
||||||
local k = tremove(arg, 1)
|
local k = tremove(arg, 1)
|
||||||
local thread_id = unique_id
|
local thread_id = unique_id
|
||||||
threads[thread_id] = T('k', partial(k, unpack(arg)))
|
threads[thread_id] = T('k', papply(k, unpack(arg)))
|
||||||
return thread_id
|
return thread_id
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -79,7 +95,7 @@ function public.vararg.wait(arg)
|
|||||||
if type(k) == 'number' then
|
if type(k) == 'number' then
|
||||||
when(function() k = k - 1 return k <= 1 end, unpack(arg))
|
when(function() k = k - 1 return k <= 1 end, unpack(arg))
|
||||||
else
|
else
|
||||||
threads[thread_id].k = partial(k, unpack(arg))
|
threads[thread_id].k = papply(k, unpack(arg))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+35
-35
@@ -1,19 +1,19 @@
|
|||||||
aux 'cache' local info, persistence = aux.info, aux.persistence
|
aux 'cache' local info, persistence = aux.info, aux.persistence
|
||||||
|
|
||||||
MIN_ITEM_ID = 1
|
local MIN_ITEM_ID = 1
|
||||||
MAX_ITEM_ID = 30000
|
local MAX_ITEM_ID = 30000
|
||||||
|
|
||||||
--items_schema = record '#' {name='string'} {quality='number'} {level='number'} {class='string'} {subclass='string'} {slot='string'} {max_stack='number'} {texture='string'} -- TODO
|
--items_schema = record '#' {name='string'} {quality='number'} {level='number'} {class='string'} {subclass='string'} {slot='string'} {max_stack='number'} {texture='string'} -- TODO
|
||||||
|
|
||||||
items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
|
local items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
|
||||||
merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'}}
|
local merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'}}
|
||||||
|
|
||||||
_G.aux_items = t
|
aux_items = t
|
||||||
_G.aux_item_ids = t
|
aux_item_ids = t
|
||||||
_G.aux_auctionable_items = t
|
aux_auctionable_items = t
|
||||||
_G.aux_merchant_buy = t
|
aux_merchant_buy = t
|
||||||
_G.aux_merchant_sell = t
|
aux_merchant_sell = t
|
||||||
_G.aux_characters = t
|
aux_characters = t
|
||||||
|
|
||||||
function LOAD()
|
function LOAD()
|
||||||
scan_wdb()
|
scan_wdb()
|
||||||
@@ -28,7 +28,7 @@ function LOAD()
|
|||||||
event_listener('NEW_AUCTION_UPDATE', function()
|
event_listener('NEW_AUCTION_UPDATE', function()
|
||||||
for info in present(info.auction_sell_item()) do
|
for info in present(info.auction_sell_item()) do
|
||||||
for item_id in present(item_id(info.name)) do
|
for item_id in present(item_id(info.name)) do
|
||||||
_G.aux_merchant_sell[_E.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count)
|
aux_merchant_sell[_E.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -36,25 +36,25 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
local sell_scan_countdown, incomplete_buy_data
|
local sell_scan_countdown, incomplete_buy_data
|
||||||
function on_merchant_show()
|
function private.on_merchant_show()
|
||||||
merchant_sell_scan()
|
merchant_sell_scan()
|
||||||
incomplete_buy_data = not merchant_buy_scan()
|
incomplete_buy_data = not merchant_buy_scan()
|
||||||
end
|
end
|
||||||
function on_merchant_closed()
|
function private.on_merchant_closed()
|
||||||
sell_scan_countdown = nil
|
sell_scan_countdown = nil
|
||||||
incomplete_buy_data = false
|
incomplete_buy_data = false
|
||||||
end
|
end
|
||||||
function on_merchant_update()
|
function private.on_merchant_update()
|
||||||
if incomplete_buy_data then
|
if incomplete_buy_data then
|
||||||
incomplete_buy_data = not merchant_buy_scan()
|
incomplete_buy_data = not merchant_buy_scan()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function on_bag_update()
|
function private.on_bag_update()
|
||||||
if MerchantFrame:IsVisible() then
|
if MerchantFrame:IsVisible() then
|
||||||
sell_scan_countdown = 10
|
sell_scan_countdown = 10
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function merchant_on_update()
|
function private.merchant_on_update()
|
||||||
if sell_scan_countdown == 0 then
|
if sell_scan_countdown == 0 then
|
||||||
sell_scan_countdown = nil
|
sell_scan_countdown = nil
|
||||||
merchant_sell_scan()
|
merchant_sell_scan()
|
||||||
@@ -64,7 +64,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function merchant_loaded()
|
function private.merchant_loaded()
|
||||||
for i = 1, GetMerchantNumItems() do
|
for i = 1, GetMerchantNumItems() do
|
||||||
if not GetMerchantItemLink(i) then
|
if not GetMerchantItemLink(i) then
|
||||||
return false
|
return false
|
||||||
@@ -75,15 +75,15 @@ end
|
|||||||
|
|
||||||
function public.merchant_info(item_id)
|
function public.merchant_info(item_id)
|
||||||
local buy_info
|
local buy_info
|
||||||
if _G.aux_merchant_buy[item_id] then
|
if aux_merchant_buy[item_id] then
|
||||||
buy_info = persistence.read(merchant_buy_schema, _G.aux_merchant_buy[item_id])
|
buy_info = persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
return _G.aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
|
return aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.item_info(item_id)
|
function public.item_info(item_id)
|
||||||
local data_string = _G.aux_items[item_id]
|
local data_string = aux_items[item_id]
|
||||||
if data_string then
|
if data_string then
|
||||||
local cached_data = persistence.read(items_schema, data_string)
|
local cached_data = persistence.read(items_schema, data_string)
|
||||||
return T(
|
return T(
|
||||||
@@ -101,10 +101,10 @@ function public.item_info(item_id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function public.item_id(item_name)
|
function public.item_id(item_name)
|
||||||
return _G.aux_item_ids[strlower(item_name)]
|
return aux_item_ids[strlower(item_name)]
|
||||||
end
|
end
|
||||||
|
|
||||||
function merchant_buy_scan()
|
function private.merchant_buy_scan()
|
||||||
|
|
||||||
local incomplete_data
|
local incomplete_data
|
||||||
for i = 1, GetMerchantNumItems() do
|
for i = 1, GetMerchantNumItems() do
|
||||||
@@ -113,8 +113,8 @@ function merchant_buy_scan()
|
|||||||
if link then
|
if link then
|
||||||
local item_id = info.parse_link(link)
|
local item_id = info.parse_link(link)
|
||||||
local new_unit_price, new_limited = price / count, stock >= 0
|
local new_unit_price, new_limited = price / count, stock >= 0
|
||||||
if _G.aux_merchant_buy[item_id] then
|
if aux_merchant_buy[item_id] then
|
||||||
local buy_info = persistence.read(merchant_buy_schema, _G.aux_merchant_buy[item_id])
|
local buy_info = persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
|
||||||
|
|
||||||
local unit_price
|
local unit_price
|
||||||
if buy_info.limited and not new_limited then
|
if buy_info.limited and not new_limited then
|
||||||
@@ -125,12 +125,12 @@ function merchant_buy_scan()
|
|||||||
unit_price = min(buy_info.unit_price, new_unit_price)
|
unit_price = min(buy_info.unit_price, new_unit_price)
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.aux_merchant_buy[item_id] = persistence.write(merchant_buy_schema, T(
|
aux_merchant_buy[item_id] = persistence.write(merchant_buy_schema, T(
|
||||||
'unit_price', unit_price,
|
'unit_price', unit_price,
|
||||||
'limited', buy_info.limited and new_limited
|
'limited', buy_info.limited and new_limited
|
||||||
))
|
))
|
||||||
else
|
else
|
||||||
_G.aux_merchant_buy[item_id] = persistence.write(merchant_buy_schema, T(
|
aux_merchant_buy[item_id] = persistence.write(merchant_buy_schema, T(
|
||||||
'unit_price', new_unit_price,
|
'unit_price', new_unit_price,
|
||||||
'limited', new_limited
|
'limited', new_limited
|
||||||
))
|
))
|
||||||
@@ -143,25 +143,25 @@ function merchant_buy_scan()
|
|||||||
return not incomplete_data
|
return not incomplete_data
|
||||||
end
|
end
|
||||||
|
|
||||||
function merchant_sell_scan()
|
function private.merchant_sell_scan()
|
||||||
for slot in info.inventory do auto[slot] = true
|
for slot in info.inventory do auto[slot] = true
|
||||||
local item_info = temp-info.container_item(unpack(slot))
|
local item_info = temp-info.container_item(unpack(slot))
|
||||||
if item_info then
|
if item_info then
|
||||||
_G.aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
|
aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function scan_wdb(item_id)
|
function private.scan_wdb(item_id)
|
||||||
item_id = item_id or MIN_ITEM_ID
|
item_id = item_id or MIN_ITEM_ID
|
||||||
|
|
||||||
local processed = 0
|
local processed = 0
|
||||||
while processed <= 100 and item_id <= MAX_ITEM_ID do
|
while processed <= 100 and item_id <= MAX_ITEM_ID do
|
||||||
local itemstring = 'item:' .. item_id
|
local itemstring = 'item:' .. item_id
|
||||||
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 _G.aux_item_ids[strlower(name)] then
|
if name and not aux_item_ids[strlower(name)] then
|
||||||
_G.aux_item_ids[strlower(name)] = item_id
|
aux_item_ids[strlower(name)] = item_id
|
||||||
_G.aux_items[item_id] = persistence.write(items_schema, T(
|
aux_items[item_id] = persistence.write(items_schema, T(
|
||||||
'name', name,
|
'name', name,
|
||||||
'quality', quality,
|
'quality', quality,
|
||||||
'level', level,
|
'level', level,
|
||||||
@@ -173,7 +173,7 @@ function scan_wdb(item_id)
|
|||||||
))
|
))
|
||||||
local tooltip = info.tooltip(function(tooltip) tooltip:SetHyperlink(itemstring) end)
|
local tooltip = info.tooltip(function(tooltip) tooltip:SetHyperlink(itemstring) end)
|
||||||
if info.auctionable(tooltip, quality) then
|
if info.auctionable(tooltip, quality) then
|
||||||
tinsert(_G.aux_auctionable_items, strlower(name))
|
tinsert(aux_auctionable_items, strlower(name))
|
||||||
end
|
end
|
||||||
processed = processed + 1
|
processed = processed + 1
|
||||||
end
|
end
|
||||||
@@ -183,7 +183,7 @@ function scan_wdb(item_id)
|
|||||||
if item_id <= MAX_ITEM_ID then
|
if item_id <= MAX_ITEM_ID then
|
||||||
thread(wait, 10, scan_wdb, item_id)
|
thread(wait, 10, scan_wdb, item_id)
|
||||||
else
|
else
|
||||||
sort(_G.aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
|
sort(aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+56
-57
@@ -1,71 +1,70 @@
|
|||||||
aux 'disenchant'
|
aux 'disenchant'
|
||||||
|
|
||||||
UNCOMMON, RARE, EPIC = 2, 3, 4
|
local UNCOMMON, RARE, EPIC = 2, 3, 4
|
||||||
|
|
||||||
do
|
do
|
||||||
local data = {
|
local data = T(
|
||||||
[10940] = A('DUST', '1-20'),
|
10940, A('DUST', '1-20'),
|
||||||
[11083] = A('DUST', '21-30'),
|
11083, A('DUST', '21-30'),
|
||||||
[11137] = A('DUST', '31-40'),
|
11137, A('DUST', '31-40'),
|
||||||
[11176] = A('DUST', '41-50'),
|
11176, A('DUST', '41-50'),
|
||||||
[16204] = A('DUST', '51-60'),
|
16204, A('DUST', '51-60'),
|
||||||
|
|
||||||
[10938] = A('ESSENCE', '1-10'),
|
10938, A('ESSENCE', '1-10'),
|
||||||
[10939] = A('ESSENCE', '11-15'),
|
10939, A('ESSENCE', '11-15'),
|
||||||
[10998] = A('ESSENCE', '16-20'),
|
10998, A('ESSENCE', '16-20'),
|
||||||
[11082] = A('ESSENCE', '21-25'),
|
11082, A('ESSENCE', '21-25'),
|
||||||
[11134] = A('ESSENCE', '26-30'),
|
11134, A('ESSENCE', '26-30'),
|
||||||
[11135] = A('ESSENCE', '31-35'),
|
11135, A('ESSENCE', '31-35'),
|
||||||
[11174] = A('ESSENCE', '36-40'),
|
11174, A('ESSENCE', '36-40'),
|
||||||
[11175] = A('ESSENCE', '41-45'),
|
11175, A('ESSENCE', '41-45'),
|
||||||
[16202] = A('ESSENCE', '46-50'),
|
16202, A('ESSENCE', '46-50'),
|
||||||
[16203] = A('ESSENCE', '51-60'),
|
16203, A('ESSENCE', '51-60'),
|
||||||
|
|
||||||
[10978] = A('SHARD', '1-20'),
|
10978, A('SHARD', '1-20'),
|
||||||
[11084] = A('SHARD', '21-25'),
|
11084, A('SHARD', '21-25'),
|
||||||
[11138] = A('SHARD', '26-30'),
|
11138, A('SHARD', '26-30'),
|
||||||
[11139] = A('SHARD', '31-35'),
|
11139, A('SHARD', '31-35'),
|
||||||
[11177] = A('SHARD', '36-40'),
|
11177, A('SHARD', '36-40'),
|
||||||
[11178] = A('SHARD', '41-45'),
|
11178, A('SHARD', '41-45'),
|
||||||
[14343] = A('SHARD', '46-50'),
|
14343, A('SHARD', '46-50'),
|
||||||
[14344] = A('SHARD', '51-60'),
|
14344, A('SHARD', '51-60'),
|
||||||
|
|
||||||
[20725] = A('CRYSTAL', '51+'),
|
20725, A('CRYSTAL', '51+')
|
||||||
}
|
)
|
||||||
|
|
||||||
function public.source(item_id)
|
function public.source(item_id)
|
||||||
return unpack(data[item_id] or tt)
|
return unpack(data[item_id] or empty)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LOAD()
|
local ARMOR = S(
|
||||||
ARMOR = S(
|
'INVTYPE_HEAD',
|
||||||
'INVTYPE_HEAD',
|
'INVTYPE_NECK',
|
||||||
'INVTYPE_NECK',
|
'INVTYPE_SHOULDER',
|
||||||
'INVTYPE_SHOULDER',
|
'INVTYPE_BODY',
|
||||||
'INVTYPE_BODY',
|
'INVTYPE_CHEST',
|
||||||
'INVTYPE_CHEST',
|
'INVTYPE_ROBE',
|
||||||
'INVTYPE_ROBE',
|
'INVTYPE_WAIST',
|
||||||
'INVTYPE_WAIST',
|
'INVTYPE_LEGS',
|
||||||
'INVTYPE_LEGS',
|
'INVTYPE_FEET',
|
||||||
'INVTYPE_FEET',
|
'INVTYPE_WRIST',
|
||||||
'INVTYPE_WRIST',
|
'INVTYPE_HAND',
|
||||||
'INVTYPE_HAND',
|
'INVTYPE_FINGER',
|
||||||
'INVTYPE_FINGER',
|
'INVTYPE_TRINKET',
|
||||||
'INVTYPE_TRINKET',
|
'INVTYPE_CLOAK',
|
||||||
'INVTYPE_CLOAK',
|
'INVTYPE_HOLDABLE'
|
||||||
'INVTYPE_HOLDABLE'
|
)
|
||||||
)
|
|
||||||
WEAPON = S(
|
local WEAPON = S(
|
||||||
'INVTYPE_2HWEAPON',
|
'INVTYPE_2HWEAPON',
|
||||||
'INVTYPE_WEAPONMAINHAND',
|
'INVTYPE_WEAPONMAINHAND',
|
||||||
'INVTYPE_WEAPON',
|
'INVTYPE_WEAPON',
|
||||||
'INVTYPE_WEAPONOFFHAND',
|
'INVTYPE_WEAPONOFFHAND',
|
||||||
'INVTYPE_SHIELD',
|
'INVTYPE_SHIELD',
|
||||||
'INVTYPE_RANGED',
|
'INVTYPE_RANGED',
|
||||||
'INVTYPE_RANGEDRIGHT'
|
'INVTYPE_RANGEDRIGHT'
|
||||||
)
|
)
|
||||||
end
|
|
||||||
|
|
||||||
function public.value(slot, quality, level)
|
function public.value(slot, quality, level)
|
||||||
local expectation
|
local expectation
|
||||||
@@ -81,7 +80,7 @@ function public.value(slot, quality, level)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function public.distribution(slot, quality, level)
|
function public.distribution(slot, quality, level)
|
||||||
if not (ARMOR[slot] or WEAPON[slot]) or level == 0 then
|
if not ARMOR[slot] and not WEAPON[slot] or level == 0 then
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -2,7 +2,7 @@ aux 'history' local persistence = aux.persistence
|
|||||||
|
|
||||||
local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}} }
|
local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}} }
|
||||||
|
|
||||||
value_cache = t
|
local value_cache = t
|
||||||
|
|
||||||
do
|
do
|
||||||
local cache
|
local cache
|
||||||
@@ -32,7 +32,7 @@ function private.new_record.get()
|
|||||||
return T('next_push', next_push, 'data_points', t)
|
return T('next_push', next_push, 'data_points', t)
|
||||||
end
|
end
|
||||||
|
|
||||||
function read_record(item_key)
|
function private.read_record(item_key)
|
||||||
local record = data[item_key] and persistence.read(history_schema, data[item_key]) or new_record
|
local record = data[item_key] and persistence.read(history_schema, data[item_key]) or new_record
|
||||||
if record.next_push <= time() then
|
if record.next_push <= time() then
|
||||||
push_record(record)
|
push_record(record)
|
||||||
@@ -41,7 +41,7 @@ function read_record(item_key)
|
|||||||
return record
|
return record
|
||||||
end
|
end
|
||||||
|
|
||||||
function write_record(item_key, record)
|
function private.write_record(item_key, record)
|
||||||
value_cache[item_key] = nil
|
value_cache[item_key] = nil
|
||||||
data[item_key] = persistence.write(history_schema, record)
|
data[item_key] = persistence.write(history_schema, record)
|
||||||
end
|
end
|
||||||
@@ -100,7 +100,7 @@ function calculate_market_value(item_record)
|
|||||||
return item_record.daily_min_buyout and min(ceil(item_record.daily_min_buyout * 1.15), item_record.daily_max_price)
|
return item_record.daily_min_buyout and min(ceil(item_record.daily_min_buyout * 1.15), item_record.daily_max_price)
|
||||||
end
|
end
|
||||||
|
|
||||||
function weighted_median(list)
|
function private.weighted_median(list)
|
||||||
sort(list, function(a,b) return a.value < b.value end)
|
sort(list, function(a,b) return a.value < b.value end)
|
||||||
local weight = 0
|
local weight = 0
|
||||||
for _, element in list do
|
for _, element in list do
|
||||||
@@ -111,7 +111,7 @@ function weighted_median(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function push_record(item_record)
|
function private.push_record(item_record)
|
||||||
for market_value in present(calculate_market_value(item_record)) do
|
for market_value in present(calculate_market_value(item_record)) do
|
||||||
tinsert(item_record.data_points, 1, T('market_value', market_value, 'time', item_record.next_push))
|
tinsert(item_record.data_points, 1, T('market_value', market_value, 'time', item_record.next_push))
|
||||||
while getn(item_record.data_points) > 11 do
|
while getn(item_record.data_points) > 11 do
|
||||||
|
|||||||
+4
-7
@@ -1,8 +1,8 @@
|
|||||||
aux 'post'
|
aux 'post'
|
||||||
|
|
||||||
local state = nil
|
local state
|
||||||
|
|
||||||
function process()
|
function private.process()
|
||||||
if state.posted < state.count then
|
if state.posted < state.count then
|
||||||
|
|
||||||
local stacking_complete
|
local stacking_complete
|
||||||
@@ -23,7 +23,7 @@ function process()
|
|||||||
return stop()
|
return stop()
|
||||||
end
|
end
|
||||||
|
|
||||||
function post_auction(slot, k)
|
function private.post_auction(slot, k)
|
||||||
local item_info = aux.info.container_item(unpack(slot))
|
local item_info = aux.info.container_item(unpack(slot))
|
||||||
if item_info.item_key == state.item_key and aux.info.auctionable(item_info.tooltip) and item_info.aux_quantity == state.stack_size then
|
if item_info.item_key == state.item_key and aux.info.auctionable(item_info.tooltip) and item_info.aux_quantity == state.stack_size then
|
||||||
|
|
||||||
@@ -71,11 +71,8 @@ end
|
|||||||
|
|
||||||
function public.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, callback)
|
function public.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, callback)
|
||||||
stop()
|
stop()
|
||||||
|
|
||||||
local thread_id = thread(process)
|
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
thread_id = thread_id,
|
thread_id = thread(process),
|
||||||
item_key = item_key,
|
item_key = item_key,
|
||||||
stack_size = stack_size,
|
stack_size = stack_size,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
|
|||||||
+37
-24
@@ -27,22 +27,29 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _, state in aborted do
|
for _, state in aborted do
|
||||||
(state.params.on_abort or nop)()
|
do (state.params.on_abort or nop)() end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function complete()
|
function private.complete()
|
||||||
local on_complete = state.params.on_complete
|
local on_complete = state.params.on_complete
|
||||||
scan_states[state.params.type] = nil
|
scan_states[state.params.type] = nil
|
||||||
(on_complete or nop)()
|
-- for _ in on_complete or nop do end TODO test performance
|
||||||
|
do (on_complete or nop)() end
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.state.get()
|
function private.state.get()
|
||||||
for _, state in scan_states do if state.id == thread_id then return state end end
|
for _, state in scan_states do
|
||||||
|
if state.id == thread_id then
|
||||||
|
return state
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.query.get() return state.params.queries[state.query_index] end
|
function private.query.get()
|
||||||
|
return state.params.queries[state.query_index]
|
||||||
|
end
|
||||||
|
|
||||||
function private.vararg.wait_for_callback(arg)
|
function private.vararg.wait_for_callback(arg)
|
||||||
local send_signal, signal_received = signal()
|
local send_signal, signal_received = signal()
|
||||||
@@ -52,10 +59,14 @@ function private.vararg.wait_for_callback(arg)
|
|||||||
local k = tremove(arg)
|
local k = tremove(arg)
|
||||||
|
|
||||||
if f then
|
if f then
|
||||||
tinsert(arg, {
|
tinsert(arg, T(
|
||||||
suspend = function() suspended = true end,
|
'suspend', function() suspended = true end,
|
||||||
resume = send_signal,
|
'resume', send_signal
|
||||||
})
|
))
|
||||||
|
-- tinsert(arg, -pairs TODO
|
||||||
|
-- :suspend (function() suspended = true end)
|
||||||
|
-- :resume (send_signal)
|
||||||
|
-- )
|
||||||
f(unpack(arg))
|
f(unpack(arg))
|
||||||
end
|
end
|
||||||
if not suspended then send_signal() end
|
if not suspended then send_signal() end
|
||||||
@@ -63,17 +74,17 @@ function private.vararg.wait_for_callback(arg)
|
|||||||
return when(signal_received, function() return k(unpack(signal_received())) end)
|
return when(signal_received, function() return k(unpack(signal_received())) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function total_pages(total_auctions)
|
function private.total_pages(total_auctions)
|
||||||
return ceil(total_auctions / PAGE_SIZE)
|
return ceil(total_auctions / PAGE_SIZE)
|
||||||
end
|
end
|
||||||
|
|
||||||
function last_page(total_auctions)
|
function private.last_page(total_auctions)
|
||||||
local last_page = max(total_pages(total_auctions) - 1, 0)
|
local last_page = max(total_pages(total_auctions) - 1, 0)
|
||||||
local last_page_limit = query.blizzard_query and query.blizzard_query.last_page or last_page
|
local last_page_limit = query.blizzard_query and query.blizzard_query.last_page or last_page
|
||||||
return min(last_page_limit, last_page)
|
return min(last_page_limit, last_page)
|
||||||
end
|
end
|
||||||
|
|
||||||
function scan()
|
function private.scan()
|
||||||
state.query_index = state.query_index and state.query_index + 1 or 1
|
state.query_index = state.query_index and state.query_index + 1 or 1
|
||||||
if query and (index(query.blizzard_query, 'first_page') or 0) <= (index(query.blizzard_query, 'last_page') or huge) then
|
if query and (index(query.blizzard_query, 'first_page') or 0) <= (index(query.blizzard_query, 'last_page') or huge) then
|
||||||
if query.blizzard_query then
|
if query.blizzard_query then
|
||||||
@@ -87,13 +98,13 @@ function scan()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function process_query()
|
function private.process_query()
|
||||||
return (query.blizzard_query and submit_query or scan_page)()
|
return (query.blizzard_query and submit_query or scan_page)()
|
||||||
end
|
end
|
||||||
|
|
||||||
function submit_query()
|
function private.submit_query()
|
||||||
when(function() return state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
|
when(function() return state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
|
||||||
(state.params.on_submit_query or nop)()
|
do (state.params.on_submit_query or nop)() end
|
||||||
state.last_query_time = GetTime()
|
state.last_query_time = GetTime()
|
||||||
if state.params.type == 'bidder' then
|
if state.params.type == 'bidder' then
|
||||||
GetBidderAuctionItems(state.page)
|
GetBidderAuctionItems(state.page)
|
||||||
@@ -117,7 +128,7 @@ function submit_query()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function scan_page(i)
|
function private.scan_page(i)
|
||||||
i = i or 1
|
i = i or 1
|
||||||
local recurse = function(retry)
|
local recurse = function(retry)
|
||||||
if i >= PAGE_SIZE then
|
if i >= PAGE_SIZE then
|
||||||
@@ -135,7 +146,7 @@ function scan_page(i)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local auction_info = info.auction(i, state.params.type)
|
local auction_info = info.auction(i, state.params.type)
|
||||||
if auction_info and (auction_info.owner or state.params.ignore_owner or _G.aux_ignore_owner) then
|
if auction_info and (auction_info.owner or state.params.ignore_owner or aux_ignore_owner) then
|
||||||
auction_info.index = i
|
auction_info.index = i
|
||||||
auction_info.page = state.page
|
auction_info.page = state.page
|
||||||
auction_info.blizzard_query = query.blizzard_query
|
auction_info.blizzard_query = query.blizzard_query
|
||||||
@@ -146,7 +157,7 @@ function scan_page(i)
|
|||||||
if (state.params.auto_buy_validator or nop)(auction_info) then
|
if (state.params.auto_buy_validator or nop)(auction_info) then
|
||||||
local send_signal, signal_received = signal()
|
local send_signal, signal_received = signal()
|
||||||
when(signal_received, recurse)
|
when(signal_received, recurse)
|
||||||
place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, partial(send_signal, true))
|
place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, papply(send_signal, true))
|
||||||
return thread(when, later(GetTime(), 10), send_signal, false)
|
return thread(when, later(GetTime(), 10), send_signal, false)
|
||||||
elseif not query.validator or query.validator(auction_info) then
|
elseif not query.validator or query.validator(auction_info) then
|
||||||
return wait_for_callback(state.params.on_auction, auction_info, function(removed)
|
return wait_for_callback(state.params.on_auction, auction_info, function(removed)
|
||||||
@@ -162,7 +173,7 @@ function scan_page(i)
|
|||||||
return recurse()
|
return recurse()
|
||||||
end
|
end
|
||||||
|
|
||||||
function wait_for_results()
|
function private.wait_for_results()
|
||||||
local timeout = later(state.last_query_time, 10)
|
local timeout = later(state.last_query_time, 10)
|
||||||
local send_signal, signal_received = signal()
|
local send_signal, signal_received = signal()
|
||||||
when(signal_received, function()
|
when(signal_received, function()
|
||||||
@@ -191,7 +202,7 @@ function wait_for_results()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function wait_for_owner_results(send_signal)
|
function private.wait_for_owner_results(send_signal)
|
||||||
if state.page == current_owner_page then
|
if state.page == current_owner_page then
|
||||||
return send_signal()
|
return send_signal()
|
||||||
else
|
else
|
||||||
@@ -199,14 +210,14 @@ function wait_for_owner_results(send_signal)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function wait_for_list_results(send_signal, signal_received)
|
function private.wait_for_list_results(send_signal, signal_received)
|
||||||
local updated, last_update
|
local updated, last_update
|
||||||
event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill)
|
event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill)
|
||||||
kill(signal_received())
|
kill(signal_received())
|
||||||
last_update = GetTime()
|
last_update = GetTime()
|
||||||
updated = true
|
updated = true
|
||||||
end)
|
end)
|
||||||
local ignore_owner = state.params.ignore_owner or _G.aux_ignore_owner
|
local ignore_owner = state.params.ignore_owner or aux_ignore_owner
|
||||||
return thread(when, function()
|
return thread(when, function()
|
||||||
-- short circuiting order important, owner_data_complete must be called iif an update has happened.
|
-- short circuiting order important, owner_data_complete must be called iif an update has happened.
|
||||||
local ok = updated and (ignore_owner or owner_data_complete('list')) or last_update and GetTime() - last_update > 5
|
local ok = updated and (ignore_owner or owner_data_complete('list')) or last_update and GetTime() - last_update > 5
|
||||||
@@ -215,10 +226,12 @@ function wait_for_list_results(send_signal, signal_received)
|
|||||||
end, send_signal)
|
end, send_signal)
|
||||||
end
|
end
|
||||||
|
|
||||||
function owner_data_complete(type)
|
function private.owner_data_complete(type)
|
||||||
for i = 1, PAGE_SIZE do
|
for i = 1, PAGE_SIZE do
|
||||||
local auction_info = info.auction(i, type)
|
local auction_info = info.auction(i, type)
|
||||||
if auction_info and not auction_info.owner then return false end
|
if auction_info and not auction_info.owner then
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
+33
-33
@@ -1,9 +1,9 @@
|
|||||||
aux 'slash' local persistence = aux.persistence
|
aux 'slash' local persistence = aux.persistence
|
||||||
|
|
||||||
_G.aux_ignore_owner = true
|
aux_ignore_owner = true
|
||||||
|
|
||||||
_G.SLASH_AUX1 = '/aux'
|
SLASH_AUX1 = '/aux'
|
||||||
function _G.SlashCmdList.AUX(command)
|
function SlashCmdList.AUX(command)
|
||||||
if not command then return end
|
if not command then return end
|
||||||
local arguments = tokenize(command)
|
local arguments = tokenize(command)
|
||||||
if arguments[1] == 'clear' and arguments[2] == 'history' then
|
if arguments[1] == 'clear' and arguments[2] == 'history' then
|
||||||
@@ -13,77 +13,77 @@ function _G.SlashCmdList.AUX(command)
|
|||||||
persistence.dataset.post = nil
|
persistence.dataset.post = nil
|
||||||
print 'Post settings cleared.'
|
print 'Post settings cleared.'
|
||||||
elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then
|
||||||
_G.aux_datasets = t
|
aux_datasets = t
|
||||||
print 'Datasets cleared.'
|
print 'Datasets cleared.'
|
||||||
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
|
||||||
_G.aux_merchant_buy = t
|
aux_merchant_buy = t
|
||||||
print 'Merchant buy prices cleared.'
|
print 'Merchant buy prices cleared.'
|
||||||
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
|
||||||
_G.aux_merchant_sell = t
|
aux_merchant_sell = t
|
||||||
print 'Merchant sell prices cleared.'
|
print 'Merchant sell prices cleared.'
|
||||||
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
|
||||||
_G.aux_items = t
|
aux_items = t
|
||||||
_G.aux_item_ids = t
|
aux_item_ids = t
|
||||||
_G.aux_auctionable_items = t
|
aux_auctionable_items = t
|
||||||
print 'Item cache cleared.'
|
print 'Item cache cleared.'
|
||||||
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
|
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
|
||||||
aux.cache.populate_wdb()
|
aux.cache.populate_wdb()
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
|
||||||
_G.aux_tooltip_value = not _G.aux_tooltip_value
|
aux_tooltip_value = not aux_tooltip_value
|
||||||
print('Historical value in tooltip ' .. (_G.aux_tooltip_value and 'enabled' or 'disabled') .. '.')
|
print('Historical value in tooltip ' .. (aux_tooltip_value and 'enabled' or 'disabled') .. '.')
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
|
||||||
_G.aux_tooltip_daily = not _G.aux_tooltip_daily
|
aux_tooltip_daily = not aux_tooltip_daily
|
||||||
print('Market value in tooltip ' .. (_G.aux_tooltip_daily and 'enabled' or 'disabled') .. '.')
|
print('Market value in tooltip ' .. (aux_tooltip_daily and 'enabled' or 'disabled') .. '.')
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'buy' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'buy' then
|
||||||
_G.aux_tooltip_vendor_buy = not _G.aux_tooltip_vendor_buy
|
aux_tooltip_vendor_buy = not aux_tooltip_vendor_buy
|
||||||
print('Vendor buy price in tooltip ' .. (_G.aux_tooltip_vendor_buy and 'enabled' or 'disabled') .. '.')
|
print('Vendor buy price in tooltip ' .. (aux_tooltip_vendor_buy and 'enabled' or 'disabled') .. '.')
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'sell' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'sell' then
|
||||||
_G.aux_tooltip_vendor_sell = not _G.aux_tooltip_vendor_sell
|
aux_tooltip_vendor_sell = not aux_tooltip_vendor_sell
|
||||||
print('Vendor sell price in tooltip ' .. (_G.aux_tooltip_vendor_sell and 'enabled' or 'disabled') .. '.')
|
print('Vendor sell price in tooltip ' .. (aux_tooltip_vendor_sell and 'enabled' or 'disabled') .. '.')
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
|
||||||
_G.aux_tooltip_disenchant_value = not _G.aux_tooltip_disenchant_value
|
aux_tooltip_disenchant_value = not aux_tooltip_disenchant_value
|
||||||
print('Disenchant value in tooltip ' .. (_G.aux_tooltip_disenchant_value and 'enabled' or 'disabled') .. '.')
|
print('Disenchant value in tooltip ' .. (aux_tooltip_disenchant_value and 'enabled' or 'disabled') .. '.')
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
|
||||||
_G.aux_tooltip_disenchant_distribution = not _G.aux_tooltip_disenchant_distribution
|
aux_tooltip_disenchant_distribution = not aux_tooltip_disenchant_distribution
|
||||||
print('Disenchant distribution in tooltip ' .. (_G.aux_tooltip_disenchant_distribution and 'enabled' or 'disabled') .. '.')
|
print('Disenchant distribution in tooltip ' .. (aux_tooltip_disenchant_distribution and 'enabled' or 'disabled') .. '.')
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'source' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'source' then
|
||||||
_G.aux_tooltip_disenchant_source = not _G.aux_tooltip_disenchant_source
|
aux_tooltip_disenchant_source = not aux_tooltip_disenchant_source
|
||||||
print('Disenchant source in tooltip ' .. (_G.aux_tooltip_disenchant_source and 'enabled' or 'disabled') .. '.')
|
print('Disenchant source in tooltip ' .. (aux_tooltip_disenchant_source and 'enabled' or 'disabled') .. '.')
|
||||||
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
|
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
|
||||||
_G.aux_ignore_owner = not _G.aux_ignore_owner
|
aux_ignore_owner = not aux_ignore_owner
|
||||||
print('Ignoring of owner ' .. (_G.aux_ignore_owner and 'enabled' or 'disabled') .. '.')
|
print('Ignoring of owner ' .. (aux_ignore_owner and 'enabled' or 'disabled') .. '.')
|
||||||
elseif arguments[1] == 'chars' and arguments[2] == 'add' then
|
elseif arguments[1] == 'chars' and arguments[2] == 'add' then
|
||||||
local realm = GetCVar('realmName')
|
local realm = GetCVar('realmName')
|
||||||
_G.aux_characters[realm] = _G.aux_characters[realm] or t
|
aux_characters[realm] = aux_characters[realm] or t
|
||||||
for i = 3, getn(arguments) do
|
for i = 3, getn(arguments) do
|
||||||
local name = gsub(strlower(arguments[i]), '^%l', strupper)
|
local name = gsub(strlower(arguments[i]), '^%l', strupper)
|
||||||
if not _G.aux_characters[realm][name] then
|
if not aux_characters[realm][name] then
|
||||||
_G.aux_characters[realm][name] = true
|
aux_characters[realm][name] = true
|
||||||
print('Character "' .. name .. '" added.')
|
print('Character "' .. name .. '" added.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif arguments[1] == 'chars' and arguments[2] == 'remove' then
|
elseif arguments[1] == 'chars' and arguments[2] == 'remove' then
|
||||||
local realm = GetCVar('realmName')
|
local realm = GetCVar('realmName')
|
||||||
if not _G.aux_characters[realm] then
|
if not aux_characters[realm] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i = 3, getn(arguments) do
|
for i = 3, getn(arguments) do
|
||||||
local name = gsub(strlower(arguments[i]), '^%l', strupper)
|
local name = gsub(strlower(arguments[i]), '^%l', strupper)
|
||||||
if _G.aux_characters[realm][name] then
|
if aux_characters[realm][name] then
|
||||||
_G.aux_characters[realm][name] = nil
|
aux_characters[realm][name] = nil
|
||||||
print('Character "' .. name .. '" removed.')
|
print('Character "' .. name .. '" removed.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif arguments[1] == 'chars' then
|
elseif arguments[1] == 'chars' then
|
||||||
local realm = GetCVar('realmName')
|
local realm = GetCVar('realmName')
|
||||||
local chars = t
|
local chars = t
|
||||||
for name in _G.aux_characters[realm] or t do
|
for name in aux_characters[realm] or t do
|
||||||
tinsert(chars, name)
|
tinsert(chars, name)
|
||||||
end
|
end
|
||||||
if getn(chars) > 0 then
|
if getn(chars) > 0 then
|
||||||
print('Your characters: "' .. join(chars, ', ') .. '".')
|
print('Your characters: "' .. join(chars, ', ') .. '".')
|
||||||
else
|
else
|
||||||
print 'You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".'
|
print('You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print('Unknown command: "' .. command .. '"')
|
print('Unknown command: "' .. command .. '"')
|
||||||
|
|||||||
+14
-18
@@ -2,40 +2,40 @@ aux 'stack' local info = aux.info
|
|||||||
|
|
||||||
local state
|
local state
|
||||||
|
|
||||||
function stack_size(slot)
|
function private.stack_size(slot)
|
||||||
local container_item_info = info.container_item(unpack(slot))
|
local container_item_info = info.container_item(unpack(slot))
|
||||||
return container_item_info and container_item_info.count or 0
|
return container_item_info and container_item_info.count or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function charges(slot)
|
function private.charges(slot)
|
||||||
local container_item_info = info.container_item(unpack(slot))
|
local container_item_info = info.container_item(unpack(slot))
|
||||||
return container_item_info and container_item_info.charges
|
return container_item_info and container_item_info.charges
|
||||||
end
|
end
|
||||||
|
|
||||||
function max_stack(slot)
|
function private.max_stack(slot)
|
||||||
local container_item_info = info.container_item(unpack(slot))
|
local container_item_info = info.container_item(unpack(slot))
|
||||||
return container_item_info and container_item_info.max_stack
|
return container_item_info and container_item_info.max_stack
|
||||||
end
|
end
|
||||||
|
|
||||||
function locked(slot)
|
function private.locked(slot)
|
||||||
local container_item_info = info.container_item(unpack(slot))
|
local container_item_info = info.container_item(unpack(slot))
|
||||||
return container_item_info and container_item_info.locked
|
return container_item_info and container_item_info.locked
|
||||||
end
|
end
|
||||||
|
|
||||||
function find_item_slot(partial)
|
function private.find_item_slot(papply)
|
||||||
for slot in info.inventory do
|
for slot in info.inventory do
|
||||||
if matching_item(slot, partial) and not eq(slot, state.target_slot) then
|
if matching_item(slot, papply) and not eq(slot, state.target_slot) then
|
||||||
return slot
|
return slot
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function matching_item(slot, partial)
|
function private.matching_item(slot, papply)
|
||||||
local item_info = info.container_item(unpack(slot))
|
local item_info = info.container_item(unpack(slot))
|
||||||
return item_info and item_info.item_key == state.item_key and info.auctionable(item_info.tooltip) and (not partial or item_info.count < item_info.max_stack)
|
return item_info and item_info.item_key == state.item_key and info.auctionable(item_info.tooltip) and (not papply or item_info.count < item_info.max_stack)
|
||||||
end
|
end
|
||||||
|
|
||||||
function find_empty_slot()
|
function private.find_empty_slot()
|
||||||
for slot, type in info.inventory do
|
for slot, type in info.inventory do
|
||||||
if type == 1 and not GetContainerItemInfo(unpack(slot)) then
|
if type == 1 and not GetContainerItemInfo(unpack(slot)) then
|
||||||
return slot
|
return slot
|
||||||
@@ -43,7 +43,7 @@ function find_empty_slot()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function find_charge_item_slot()
|
function private.find_charge_item_slot()
|
||||||
for slot in info.inventory do
|
for slot in info.inventory do
|
||||||
if matching_item(slot) and charges(slot) == state.target_size then
|
if matching_item(slot) and charges(slot) == state.target_size then
|
||||||
return slot
|
return slot
|
||||||
@@ -51,7 +51,7 @@ function find_charge_item_slot()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function move_item(from_slot, to_slot, amount, k)
|
function private.move_item(from_slot, to_slot, amount, k)
|
||||||
if locked(from_slot) or locked(to_slot) then
|
if locked(from_slot) or locked(to_slot) then
|
||||||
return wait(k)
|
return wait(k)
|
||||||
end
|
end
|
||||||
@@ -66,15 +66,13 @@ function move_item(from_slot, to_slot, amount, k)
|
|||||||
return when(function() return stack_size(to_slot) == expected_size end, k)
|
return when(function() return stack_size(to_slot) == expected_size end, k)
|
||||||
end
|
end
|
||||||
|
|
||||||
function process()
|
function private.process()
|
||||||
|
|
||||||
if not state.target_slot or not matching_item(state.target_slot) then
|
if not state.target_slot or not matching_item(state.target_slot) then
|
||||||
state.target_slot = find_item_slot()
|
state.target_slot = find_item_slot()
|
||||||
if not state.target_slot then
|
if not state.target_slot then
|
||||||
return stop()
|
return stop()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if charges(state.target_slot) then
|
if charges(state.target_slot) then
|
||||||
state.target_slot = find_charge_item_slot()
|
state.target_slot = find_charge_item_slot()
|
||||||
return stop()
|
return stop()
|
||||||
@@ -109,16 +107,14 @@ function public.stop()
|
|||||||
local callback, slot = state.callback, state.target_slot
|
local callback, slot = state.callback, state.target_slot
|
||||||
slot = slot and matching_item(slot) and slot or nil
|
slot = slot and matching_item(slot) and slot or nil
|
||||||
state = nil
|
state = nil
|
||||||
(callback or nop)(slot)
|
do (callback or nop)(slot) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.start(item_key, size, callback)
|
function public.start(item_key, size, callback)
|
||||||
stop()
|
stop()
|
||||||
|
|
||||||
local thread_id = thread(process)
|
|
||||||
state = {
|
state = {
|
||||||
thread_id = thread_id,
|
thread_id = thread(process),
|
||||||
item_key = item_key,
|
item_key = item_key,
|
||||||
target_size = size,
|
target_size = size,
|
||||||
callback = callback,
|
callback = callback,
|
||||||
|
|||||||
+14
-14
@@ -1,6 +1,6 @@
|
|||||||
aux 'tooltip' local info, disenchant, cache, money, history = aux.info, aux.disenchant, aux.cache, aux.money, aux.history
|
aux 'tooltip' local info, disenchant, cache, money, history = aux.info, aux.disenchant, aux.cache, aux.money, aux.history
|
||||||
|
|
||||||
_G.aux_tooltip_value = true
|
aux_tooltip_value = true
|
||||||
|
|
||||||
local game_tooltip_hooks, game_tooltip_money = t, 0
|
local game_tooltip_hooks, game_tooltip_money = t, 0
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ end
|
|||||||
function extend_tooltip(tooltip, link, quantity)
|
function extend_tooltip(tooltip, link, quantity)
|
||||||
local item_id, suffix_id = info.parse_link(link)
|
local item_id, suffix_id = info.parse_link(link)
|
||||||
quantity = IsShiftKeyDown() and quantity or 1
|
quantity = IsShiftKeyDown() and quantity or 1
|
||||||
if _G.aux_tooltip_disenchant_source then
|
if aux_tooltip_disenchant_source then
|
||||||
local color = {r=.7, g=.7, b=.7}
|
local color = { r=.7, g=.7, b=.7 }
|
||||||
local type, range = disenchant.source(item_id)
|
local type, range = disenchant.source(item_id)
|
||||||
if type == 'CRYSTAL' then
|
if type == 'CRYSTAL' then
|
||||||
tooltip:AddLine(format('Can disenchant from level %s |cffa335eeEpic|r and |cff0070ddRare|r items.', range), color.r, color.g, color.b, true)
|
tooltip:AddLine(format('Can disenchant from level %s |cffa335eeEpic|r and |cff0070ddRare|r items.', range), color.r, color.g, color.b, true)
|
||||||
@@ -60,8 +60,8 @@ function extend_tooltip(tooltip, link, quantity)
|
|||||||
if item_info then
|
if item_info then
|
||||||
local distribution = disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
|
local distribution = disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
|
||||||
if getn(distribution) > 0 then
|
if getn(distribution) > 0 then
|
||||||
if _G.aux_tooltip_disenchant_distribution then
|
if aux_tooltip_disenchant_distribution then
|
||||||
local color = {r=.8, g=.8, b=.2}
|
local color = { r=.8, g=.8, b=.2 }
|
||||||
|
|
||||||
tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
|
tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
|
||||||
sort(distribution, function(a,b) return a.probability > b.probability end)
|
sort(distribution, function(a,b) return a.probability > b.probability end)
|
||||||
@@ -69,37 +69,37 @@ function extend_tooltip(tooltip, link, quantity)
|
|||||||
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, info.display_name(event.item_id, true) or 'item:' .. event.item_id, event.min_quantity, event.max_quantity), color.r, color.g, color.b)
|
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, info.display_name(event.item_id, true) or 'item:' .. event.item_id, event.min_quantity, event.max_quantity), color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if _G.aux_tooltip_disenchant_value then
|
if aux_tooltip_disenchant_value then
|
||||||
local color = {r=.1, g=.6, b=.6}
|
local color = { r=.1, g=.6, b=.6 }
|
||||||
|
|
||||||
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||||
tooltip:AddLine('Disenchant Value: ' .. (disenchant_value and money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
tooltip:AddLine('Disenchant Value: ' .. (disenchant_value and money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if _G.aux_tooltip_vendor_buy then
|
if aux_tooltip_vendor_buy then
|
||||||
local color = {r=.8, g=.5, b=.1}
|
local color = { r=.8, g=.5, b=.1 }
|
||||||
local _, price, limited = cache.merchant_info(item_id)
|
local _, price, limited = cache.merchant_info(item_id)
|
||||||
if price then
|
if price then
|
||||||
tooltip:AddLine('Vendor Buy ' .. (limited and '(limited): ' or ': ') .. money.to_string2(price * quantity), color.r, color.g, color.b)
|
tooltip:AddLine('Vendor Buy ' .. (limited and '(limited): ' or ': ') .. money.to_string2(price * quantity), color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if _G.aux_tooltip_vendor_sell then
|
if aux_tooltip_vendor_sell then
|
||||||
local color = {r=.8, g=.5, b=.1}
|
local color = { r=.8, g=.5, b=.1 }
|
||||||
local price = cache.merchant_info(item_id)
|
local price = cache.merchant_info(item_id)
|
||||||
if price ~= 0 then
|
if price ~= 0 then
|
||||||
tooltip:AddLine('Vendor Sell: ' .. (price and money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
tooltip:AddLine('Vendor Sell: ' .. (price and money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local color = {r=1, g=1, b=.6}
|
local color = { r=1, g=1, b=.6 }
|
||||||
local auctionable = not item_info or info.auctionable(info.tooltip(function(tooltip) tooltip:SetHyperlink(item_info.itemstring) end), item_info.quality)
|
local auctionable = not item_info or info.auctionable(info.tooltip(function(tooltip) tooltip:SetHyperlink(item_info.itemstring) end), item_info.quality)
|
||||||
local item_key = (item_id or 0) .. ':' .. (suffix_id or 0)
|
local item_key = (item_id or 0) .. ':' .. (suffix_id or 0)
|
||||||
local value = history.value(item_key)
|
local value = history.value(item_key)
|
||||||
if auctionable then
|
if auctionable then
|
||||||
if _G.aux_tooltip_value then
|
if aux_tooltip_value then
|
||||||
tooltip:AddLine('Value: ' .. (value and money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
tooltip:AddLine('Value: ' .. (value and money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
if _G.aux_tooltip_daily then
|
if aux_tooltip_daily then
|
||||||
local market_value = history.market_value(item_key)
|
local market_value = history.market_value(item_key)
|
||||||
tooltip:AddLine('Today: ' .. (market_value and money.to_string2(market_value * quantity) .. ' (' .. aux.auction_listing.percentage_historical(round(market_value / value * 100)) .. ')' or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
tooltip:AddLine('Today: ' .. (market_value and money.to_string2(market_value * quantity) .. ' (' .. aux.auction_listing.percentage_historical(round(market_value / value * 100)) .. ')' or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ do
|
|||||||
public.aux_frame = frame
|
public.aux_frame = frame
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
tabs = gui.tabs(aux_frame, 'DOWN')
|
private.tabs = gui.tabs(aux_frame, 'DOWN')
|
||||||
tabs._on_select = on_tab_click
|
tabs._on_select = on_tab_click
|
||||||
function public.tab.set(id) tabs:select(id) end
|
function public.tab.set(id) tabs:select(id) end
|
||||||
end
|
end
|
||||||
@@ -35,7 +35,7 @@ do
|
|||||||
btn:SetPoint('BOTTOMRIGHT', -5, 5)
|
btn:SetPoint('BOTTOMRIGHT', -5, 5)
|
||||||
gui.set_size(btn, 60, 24)
|
gui.set_size(btn, 60, 24)
|
||||||
btn:SetText('Close')
|
btn:SetText('Close')
|
||||||
btn:SetScript('OnClick', partial(aux_frame.Hide, aux_frame))
|
btn:SetScript('OnClick', papply(aux_frame.Hide, aux_frame))
|
||||||
public.close_button = btn
|
public.close_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
|
|||||||
+47
-49
@@ -1,29 +1,27 @@
|
|||||||
aux 'auction_listing' local gui, sorting, money, info = aux.gui, aux.sorting, aux.money, aux.info
|
aux 'auction_listing' local gui, sorting, money, info = aux.gui, aux.sorting, aux.money, aux.info
|
||||||
|
|
||||||
_G.aux_price_per_unit = false
|
aux_price_per_unit = false
|
||||||
|
|
||||||
local RT_COUNT = 1
|
local RT_COUNT = 1
|
||||||
local HEAD_HEIGHT = 27
|
local HEAD_HEIGHT = 27
|
||||||
local HEAD_SPACE = 2
|
local HEAD_SPACE = 2
|
||||||
|
|
||||||
function LOAD()
|
local AUCTION_PCT_COLORS = {
|
||||||
AUCTION_PCT_COLORS = {
|
{ color=inline_color.blue, value=50 },
|
||||||
{ color=inline_color.blue, value=50 },
|
{ color=inline_color.green, value=80 },
|
||||||
{ color=inline_color.green, value=80 },
|
{ color=inline_color.yellow, value=110 },
|
||||||
{ color=inline_color.yellow, value=110 },
|
{ color=inline_color.orange, value=135 },
|
||||||
{ color=inline_color.orange, value=135 },
|
{ color=inline_color.red, value=huge },
|
||||||
{ color=inline_color.red, value=huge },
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TIME_LEFT_STRINGS = {
|
local TIME_LEFT_STRINGS = {
|
||||||
color.red '30m', -- Short
|
color.red '30m', -- Short
|
||||||
color.orange '2h', -- Medium
|
color.orange '2h', -- Medium
|
||||||
color.yellow '8h', -- Long
|
color.yellow '8h', -- Long
|
||||||
color.blue '24h', -- Very Long
|
color.blue '24h', -- Very Long
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
function item_column_init(rt, cell)
|
function private.item_column_init(rt, cell)
|
||||||
local spacer = CreateFrame('Frame', nil, cell)
|
local spacer = CreateFrame('Frame', nil, cell)
|
||||||
spacer:SetPoint('TOPLEFT', 0, 0)
|
spacer:SetPoint('TOPLEFT', 0, 0)
|
||||||
spacer:SetHeight(rt.ROW_HEIGHT)
|
spacer:SetHeight(rt.ROW_HEIGHT)
|
||||||
@@ -166,24 +164,24 @@ public.search_config = {
|
|||||||
end
|
end
|
||||||
local price
|
local price
|
||||||
if record.high_bidder then
|
if record.high_bidder then
|
||||||
price = _G.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
price = aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||||
else
|
else
|
||||||
price = _G.aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||||
end
|
end
|
||||||
cell:SetText(money.to_string(price, true, false, nil, color))
|
cell:SetText(money.to_string(price, true, false, nil, color))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a
|
local price_a
|
||||||
if record_a.high_bidder then
|
if record_a.high_bidder then
|
||||||
price_a = _G.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
price_a = aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||||
else
|
else
|
||||||
price_a = _G.aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price
|
price_a = aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price
|
||||||
end
|
end
|
||||||
local price_b
|
local price_b
|
||||||
if record_b.high_bidder then
|
if record_b.high_bidder then
|
||||||
price_b = _G.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
price_b = aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||||
else
|
else
|
||||||
price_b = _G.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||||
end
|
end
|
||||||
return sorting.compare(price_a, price_b, desc)
|
return sorting.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -194,12 +192,12 @@ public.search_config = {
|
|||||||
align = 'RIGHT',
|
align = 'RIGHT',
|
||||||
isPrice = true,
|
isPrice = true,
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price = _G.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = _G.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
local price_b = _G.aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||||
|
|
||||||
@@ -308,24 +306,24 @@ public.auctions_config = {
|
|||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price
|
local price
|
||||||
if record.high_bidder then
|
if record.high_bidder then
|
||||||
price = _G.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
price = aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||||
else
|
else
|
||||||
price = _G.aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price
|
price = aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price
|
||||||
end
|
end
|
||||||
cell:SetText(money.to_string(price, true, false))
|
cell:SetText(money.to_string(price, true, false))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a
|
local price_a
|
||||||
if record_a.high_bidder then
|
if record_a.high_bidder then
|
||||||
price_a = _G.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
price_a = aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||||
else
|
else
|
||||||
price_a = _G.aux_price_per_unit and record_a.start_price / record_b.aux_quantity or record_a.start_price
|
price_a = aux_price_per_unit and record_a.start_price / record_b.aux_quantity or record_a.start_price
|
||||||
end
|
end
|
||||||
local price_b
|
local price_b
|
||||||
if record_b.high_bidder then
|
if record_b.high_bidder then
|
||||||
price_b = _G.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
price_b = aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||||
else
|
else
|
||||||
price_b = _G.aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
|
price_b = aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
|
||||||
end
|
end
|
||||||
return sorting.compare(price_a, price_b, desc)
|
return sorting.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -336,12 +334,12 @@ public.auctions_config = {
|
|||||||
align = 'RIGHT',
|
align = 'RIGHT',
|
||||||
isPrice = true,
|
isPrice = true,
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price = _G.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = _G.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
local price_b = _G.aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||||
|
|
||||||
@@ -461,24 +459,24 @@ public.bids_config = {
|
|||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price
|
local price
|
||||||
if record.high_bidder then
|
if record.high_bidder then
|
||||||
price = _G.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
price = aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||||
else
|
else
|
||||||
price = _G.aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||||
end
|
end
|
||||||
cell:SetText(money.to_string(price))
|
cell:SetText(money.to_string(price))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a
|
local price_a
|
||||||
if record_a.high_bidder then
|
if record_a.high_bidder then
|
||||||
price_a = _G.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
price_a = aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||||
else
|
else
|
||||||
price_a = _G.aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price
|
price_a = aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price
|
||||||
end
|
end
|
||||||
local price_b
|
local price_b
|
||||||
if record_b.high_bidder then
|
if record_b.high_bidder then
|
||||||
price_b = _G.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
price_b = aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||||
else
|
else
|
||||||
price_b = _G.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||||
end
|
end
|
||||||
return sorting.compare(price_a, price_b, desc)
|
return sorting.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -489,12 +487,12 @@ public.bids_config = {
|
|||||||
align = 'RIGHT',
|
align = 'RIGHT',
|
||||||
isPrice = true,
|
isPrice = true,
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price = _G.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = _G.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
local price_b = _G.aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||||
|
|
||||||
@@ -520,7 +518,7 @@ public.bids_config = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function record_percentage(record)
|
function private.record_percentage(record)
|
||||||
if not record then return end
|
if not record then return end
|
||||||
|
|
||||||
local historical_value = aux.history.value(record.item_key) or 0
|
local historical_value = aux.history.value(record.item_key) or 0
|
||||||
@@ -532,7 +530,7 @@ function record_percentage(record)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function percentage_color(pct)
|
function private.percentage_color(pct)
|
||||||
for i = 1, getn(AUCTION_PCT_COLORS) do
|
for i = 1, getn(AUCTION_PCT_COLORS) do
|
||||||
if pct < AUCTION_PCT_COLORS[i].value then
|
if pct < AUCTION_PCT_COLORS[i].value then
|
||||||
return AUCTION_PCT_COLORS[i].color
|
return AUCTION_PCT_COLORS[i].color
|
||||||
@@ -567,10 +565,10 @@ local methods = {
|
|||||||
if rt.disabled then return end
|
if rt.disabled then return end
|
||||||
|
|
||||||
if button == 'RightButton' and rt.headCells[this.columnIndex].info.isPrice then
|
if button == 'RightButton' and rt.headCells[this.columnIndex].info.isPrice then
|
||||||
_G.aux_price_per_unit = not _G.aux_price_per_unit
|
aux_price_per_unit = not aux_price_per_unit
|
||||||
for _, cell in rt.headCells do
|
for _, cell in rt.headCells do
|
||||||
if cell.info.isPrice then
|
if cell.info.isPrice then
|
||||||
cell:SetText(cell.info.title[_G.aux_price_per_unit and 1 or 2])
|
cell:SetText(cell.info.title[aux_price_per_unit and 1 or 2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rt:SetSort()
|
rt:SetSort()
|
||||||
@@ -997,7 +995,7 @@ function public.CreateAuctionResultsTable(parent, config)
|
|||||||
rt:SetScript('OnShow', function()
|
rt:SetScript('OnShow', function()
|
||||||
for _, cell in this.headCells do
|
for _, cell in this.headCells do
|
||||||
if cell.info.isPrice then
|
if cell.info.isPrice then
|
||||||
cell:SetText(cell.info.title[_G.aux_price_per_unit and 1 or 2])
|
cell:SetText(cell.info.title[aux_price_per_unit and 1 or 2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
+7
-7
@@ -33,7 +33,7 @@ function LOAD()
|
|||||||
return unpack(ret)
|
return unpack(ret)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function set_aux_dropdown_style(dropdown)
|
function private.set_aux_dropdown_style(dropdown)
|
||||||
DropDownList1Backdrop:SetBackdrop{}
|
DropDownList1Backdrop:SetBackdrop{}
|
||||||
aux_border:Show()
|
aux_border:Show()
|
||||||
aux_background:Show()
|
aux_background:Show()
|
||||||
@@ -62,7 +62,7 @@ function LOAD()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_blizzard_dropdown_style()
|
function private.set_blizzard_dropdown_style()
|
||||||
DropDownList1Backdrop:SetBackdrop(blizzard_backdrop)
|
DropDownList1Backdrop:SetBackdrop(blizzard_backdrop)
|
||||||
aux_border:Hide()
|
aux_border:Hide()
|
||||||
aux_background:Hide()
|
aux_background:Hide()
|
||||||
@@ -201,7 +201,7 @@ function public.resize_tab(tab, width, padding)
|
|||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local mt = {__index=t}
|
local mt = { __index=t }
|
||||||
function mt.__index:create_tab(text)
|
function mt.__index:create_tab(text)
|
||||||
local id = getn(self._tabs) + 1
|
local id = getn(self._tabs) + 1
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ do
|
|||||||
function mt.__index:select(id)
|
function mt.__index:select(id)
|
||||||
self._selected = id
|
self._selected = id
|
||||||
self:update()
|
self:update()
|
||||||
;(self._on_select or nop)(id)
|
do (self._on_select or nop)(id) end
|
||||||
end
|
end
|
||||||
function mt.__index:update()
|
function mt.__index:update()
|
||||||
for _, tab in self._tabs do
|
for _, tab in self._tabs do
|
||||||
@@ -312,7 +312,7 @@ function public.editbox(parent)
|
|||||||
this:SetTextColor(color.text.enabled())
|
this:SetTextColor(color.text.enabled())
|
||||||
this.focused = true
|
this.focused = true
|
||||||
this:HighlightText()
|
this:HighlightText()
|
||||||
;(this.focus_gain or nop)()
|
do (this.focus_gain or nop)() end
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnEditFocusLost', function()
|
editbox:SetScript('OnEditFocusLost', function()
|
||||||
this.overlay:Show()
|
this.overlay:Show()
|
||||||
@@ -320,11 +320,11 @@ function public.editbox(parent)
|
|||||||
this.focused = false
|
this.focused = false
|
||||||
this:HighlightText(0, 0)
|
this:HighlightText(0, 0)
|
||||||
this:SetScript('OnUpdate', nil)
|
this:SetScript('OnUpdate', nil)
|
||||||
;(this.focus_loss or nop)()
|
do (this.focus_loss or nop)() end
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnTextChanged', function()
|
editbox:SetScript('OnTextChanged', function()
|
||||||
this.overlay:SetText((this.formatter or id)(this:GetText()))
|
this.overlay:SetText((this.formatter or id)(this:GetText()))
|
||||||
;(this.change or nop)()
|
do (this.change or nop)() end
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnChar', function() (this.char or nop)() end)
|
editbox:SetScript('OnChar', function() (this.char or nop)() end)
|
||||||
do
|
do
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ local ST_ROW_HEIGHT = 15
|
|||||||
local ST_ROW_TEXT_SIZE = 14
|
local ST_ROW_TEXT_SIZE = 14
|
||||||
local ST_HEAD_HEIGHT = 26.3
|
local ST_HEAD_HEIGHT = 26.3
|
||||||
local ST_HEAD_SPACE = 2
|
local ST_HEAD_SPACE = 2
|
||||||
local DEFAULT_COL_INFO = {{width=1}}
|
local DEFAULT_COL_INFO = {{ width=1 }}
|
||||||
|
|
||||||
|
|
||||||
local function GetTableIndex(tbl, value)
|
local function GetTableIndex(tbl, value)
|
||||||
|
|||||||
+4
-4
@@ -27,9 +27,9 @@ function definition_helper_mt:__index(k)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
function definition_helper_mt:__newindex(k, v) local module, modifiers = _module[self], _modifiers[self]
|
function definition_helper_mt:__newindex(k, v) local module, modifiers = _module[self], _modifiers[self]
|
||||||
local access = ACCESS[tremove(modifiers, 1)] or error'Invalid definition.'
|
local access = ACCESS[tremove(modifiers, 1)] or error'Definition missing access modifier.'
|
||||||
local name = META[k] and (tremove(modifiers) or error'Invalid definition.') or k
|
local name = META[k] and (tremove(modifiers) or error'Definition missing identifier.') or k
|
||||||
if type(name) ~= 'string' or not strfind(name, '^[_%a][_%w]*') then error'Invalid definition.' end
|
if type(name) ~= 'string' or not strfind(name, '^[_%a][_%w]*') then error('"%s" is not a valid identifier.', name) end
|
||||||
local type = META[k] or FIELD
|
local type = META[k] or FIELD
|
||||||
module.defined[name .. OPERATION[type]] = module.defined[name .. OPERATION[type]] and error('"%s" already exists.', name) or true
|
module.defined[name .. OPERATION[type]] = module.defined[name .. OPERATION[type]] and error('"%s" already exists.', name) or true
|
||||||
for i = getn(modifiers), 1, -1 do v = module[FIELD][modifiers[i]](v) end
|
for i = getn(modifiers), 1, -1 do v = module[FIELD][modifiers[i]](v) end
|
||||||
@@ -56,7 +56,7 @@ function global_mt:__index(key)
|
|||||||
local module, environment, interface, definition_helper, accessors, mutators, fields, public_accessors, public_mutators, public_fields
|
local module, environment, interface, definition_helper, accessors, mutators, fields, public_accessors, public_mutators, public_fields
|
||||||
environment, interface, definition_helper = {}, {}, setmetatable({}, definition_helper_mt)
|
environment, interface, definition_helper = {}, {}, setmetatable({}, definition_helper_mt)
|
||||||
accessors = { private=function() return definition_helper.private end, public=function() return definition_helper.public end }
|
accessors = { private=function() return definition_helper.private end, public=function() return definition_helper.public end }
|
||||||
mutators = setmetatable({ _=nop }, { __index=function(_, k) return function(v) if v == interface and (_G[k] == nil or _G.error(nil)) then _G[k] = v else definition_helper.private[k] = v end end end })
|
mutators = setmetatable({ _=nop }, { __index=function(_, k) return function(v) _G[k] = v == interface and _G[k] ~= nil and _G.error(nil) or v end end })
|
||||||
fields = setmetatable(
|
fields = setmetatable(
|
||||||
{ _E=environment, _I=interface, _G=_G, import=function(interface) import(module, interface) end, error=error, nop=nop, id=id },
|
{ _E=environment, _I=interface, _G=_G, import=function(interface) import(module, interface) end, error=error, nop=nop, id=id },
|
||||||
{ __index=function(_, key) local accessor = accessors[key]; if accessor then return accessor() else return _G[key] end end }
|
{ __index=function(_, key) local accessor = accessors[key]; if accessor then return accessor() else return _G[key] end end }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
aux 'auctions_tab' local scan = aux.scan
|
aux 'auctions_tab' local scan = aux.scan
|
||||||
|
|
||||||
auction_records = t
|
private.auction_records = t
|
||||||
|
|
||||||
function LOAD()
|
function LOAD()
|
||||||
create_frames()
|
create_frames()
|
||||||
@@ -15,7 +15,7 @@ function CLOSE()
|
|||||||
frame:Hide()
|
frame:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_listing()
|
function private.update_listing()
|
||||||
if not ACTIVE then return end
|
if not ACTIVE then return end
|
||||||
listing:SetDatabase(auction_records)
|
listing:SetDatabase(auction_records)
|
||||||
end
|
end
|
||||||
@@ -29,7 +29,7 @@ function public.scan_auctions()
|
|||||||
update_listing()
|
update_listing()
|
||||||
scan.start{
|
scan.start{
|
||||||
type = 'owner',
|
type = 'owner',
|
||||||
queries = {{blizzard_query = t}},
|
queries = {{ blizzard_query = t }},
|
||||||
on_page_loaded = function(page, total_pages)
|
on_page_loaded = function(page, total_pages)
|
||||||
status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
||||||
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
||||||
@@ -49,7 +49,7 @@ function public.scan_auctions()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function test(record)
|
function private.test(record)
|
||||||
return function(index)
|
return function(index)
|
||||||
local auction_info = aux.info.auction(index, 'owner')
|
local auction_info = aux.info.auction(index, 'owner')
|
||||||
return auction_info and auction_info.search_signature == record.search_signature
|
return auction_info and auction_info.search_signature == record.search_signature
|
||||||
@@ -62,7 +62,7 @@ do
|
|||||||
local state = IDLE
|
local state = IDLE
|
||||||
local found_index
|
local found_index
|
||||||
|
|
||||||
function find_auction(record)
|
function private.find_auction(record)
|
||||||
if not listing:ContainsRecord(record) then return end
|
if not listing:ContainsRecord(record) then return end
|
||||||
|
|
||||||
scan.abort(scan_id)
|
scan.abort(scan_id)
|
||||||
@@ -78,7 +78,7 @@ do
|
|||||||
|
|
||||||
cancel_button:SetScript('OnClick', function()
|
cancel_button:SetScript('OnClick', function()
|
||||||
if test(record)(index) and listing:ContainsRecord(record) then
|
if test(record)(index) and listing:ContainsRecord(record) then
|
||||||
cancel_auction(index, partial(listing.RemoveAuctionRecord, listing, record))
|
cancel_auction(index, papply(listing.RemoveAuctionRecord, listing, record))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
cancel_button:Enable()
|
cancel_button:Enable()
|
||||||
@@ -86,7 +86,7 @@ do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_update()
|
function private.on_update()
|
||||||
if state == IDLE or state == SEARCHING then
|
if state == IDLE or state == SEARCHING then
|
||||||
cancel_button:Disable()
|
cancel_button:Disable()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
aux 'auctions_tab' local gui, auction_listing = aux.gui, aux.auction_listing
|
aux 'auctions_tab' local gui, auction_listing = aux.gui, aux.auction_listing
|
||||||
|
|
||||||
function create_frames()
|
function private.create_frames()
|
||||||
frame = CreateFrame('Frame', nil, aux_frame)
|
private.frame = CreateFrame('Frame', nil, aux_frame)
|
||||||
frame:SetAllPoints()
|
frame:SetAllPoints()
|
||||||
frame:SetScript('OnUpdate', on_update)
|
frame:SetScript('OnUpdate', on_update)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
@@ -11,7 +11,7 @@ function create_frames()
|
|||||||
frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
|
frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
|
||||||
frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
|
frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||||
|
|
||||||
listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.auctions_config)
|
private.listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.auctions_config)
|
||||||
listing:SetSort(1,2,3,4,5,6,7,8)
|
listing:SetSort(1,2,3,4,5,6,7,8)
|
||||||
listing:Reset()
|
listing:Reset()
|
||||||
listing:SetHandler('OnCellClick', function(cell, button)
|
listing:SetHandler('OnCellClick', function(cell, button)
|
||||||
@@ -25,7 +25,7 @@ function create_frames()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
do
|
do
|
||||||
status_bar = gui.status_bar(frame)
|
private.status_bar = gui.status_bar(frame)
|
||||||
status_bar:SetWidth(265)
|
status_bar:SetWidth(265)
|
||||||
status_bar:SetHeight(25)
|
status_bar:SetHeight(25)
|
||||||
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
@@ -37,7 +37,7 @@ function create_frames()
|
|||||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Cancel')
|
btn:SetText('Cancel')
|
||||||
btn:Disable()
|
btn:Disable()
|
||||||
cancel_button = btn
|
private.cancel_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
|
|||||||
+8
-8
@@ -1,6 +1,6 @@
|
|||||||
aux 'bids_tab' local scan = aux.scan
|
aux 'bids_tab' local scan = aux.scan
|
||||||
|
|
||||||
auction_records = t
|
private.auction_records = t
|
||||||
|
|
||||||
function LOAD()
|
function LOAD()
|
||||||
create_frames()
|
create_frames()
|
||||||
@@ -15,7 +15,7 @@ function CLOSE()
|
|||||||
frame:Hide()
|
frame:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_listing()
|
function private.update_listing()
|
||||||
if not ACTIVE then return end
|
if not ACTIVE then return end
|
||||||
listing:SetDatabase(auction_records)
|
listing:SetDatabase(auction_records)
|
||||||
end
|
end
|
||||||
@@ -29,7 +29,7 @@ function public.scan_bids()
|
|||||||
update_listing()
|
update_listing()
|
||||||
scan.start{
|
scan.start{
|
||||||
type = 'bidder',
|
type = 'bidder',
|
||||||
queries = {{blizzard_query=t}},
|
queries = {{ blizzard_query=t }},
|
||||||
on_page_loaded = function(page, total_pages)
|
on_page_loaded = function(page, total_pages)
|
||||||
status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
||||||
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
||||||
@@ -49,7 +49,7 @@ function public.scan_bids()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function test(record)
|
function private.test(record)
|
||||||
return function(index)
|
return function(index)
|
||||||
local auction_info = aux.info.auction(index, 'bidder')
|
local auction_info = aux.info.auction(index, 'bidder')
|
||||||
return auction_info and auction_info.search_signature == record.search_signature
|
return auction_info and auction_info.search_signature == record.search_signature
|
||||||
@@ -62,7 +62,7 @@ do
|
|||||||
local state = IDLE
|
local state = IDLE
|
||||||
local found_index
|
local found_index
|
||||||
|
|
||||||
function find_auction(record)
|
function private.find_auction(record)
|
||||||
if not listing:ContainsRecord(record) then return end
|
if not listing:ContainsRecord(record) then return end
|
||||||
|
|
||||||
scan.abort(scan_id)
|
scan.abort(scan_id)
|
||||||
@@ -85,7 +85,7 @@ do
|
|||||||
place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||||
aux.info.bid_update(record)
|
aux.info.bid_update(record)
|
||||||
listing:SetDatabase()
|
listing:SetDatabase()
|
||||||
end or partial(listing.RemoveAuctionRecord, listing, record))
|
end or papply(listing.RemoveAuctionRecord, listing, record))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
bid_button:Enable()
|
bid_button:Enable()
|
||||||
@@ -94,7 +94,7 @@ do
|
|||||||
if record.buyout_price > 0 then
|
if record.buyout_price > 0 then
|
||||||
buyout_button:SetScript('OnClick', function()
|
buyout_button:SetScript('OnClick', function()
|
||||||
if test(record)(index) and listing:ContainsRecord(record) then
|
if test(record)(index) and listing:ContainsRecord(record) then
|
||||||
place_bid('bidder', index, record.buyout_price, partial(listing.RemoveAuctionRecord, listing, record))
|
place_bid('bidder', index, record.buyout_price, papply(listing.RemoveAuctionRecord, listing, record))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
buyout_button:Enable()
|
buyout_button:Enable()
|
||||||
@@ -103,7 +103,7 @@ do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_update()
|
function private.on_update()
|
||||||
if state == IDLE or state == SEARCHING then
|
if state == IDLE or state == SEARCHING then
|
||||||
buyout_button:Disable()
|
buyout_button:Disable()
|
||||||
bid_button:Disable()
|
bid_button:Disable()
|
||||||
|
|||||||
+6
-6
@@ -1,7 +1,7 @@
|
|||||||
aux 'bids_tab' local gui, auction_listing = aux.gui, aux.auction_listing
|
aux 'bids_tab' local gui, auction_listing = aux.gui, aux.auction_listing
|
||||||
|
|
||||||
function create_frames()
|
function private.create_frames()
|
||||||
frame = CreateFrame('Frame', nil, aux_frame)
|
private.frame = CreateFrame('Frame', nil, aux_frame)
|
||||||
frame:SetAllPoints()
|
frame:SetAllPoints()
|
||||||
frame:SetScript('OnUpdate', on_update)
|
frame:SetScript('OnUpdate', on_update)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
@@ -11,7 +11,7 @@ function create_frames()
|
|||||||
frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
|
frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
|
||||||
frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
|
frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||||
|
|
||||||
listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.bids_config)
|
private.listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.bids_config)
|
||||||
listing:SetSort(1,2,3,4,5,6,7,8)
|
listing:SetSort(1,2,3,4,5,6,7,8)
|
||||||
listing:Reset()
|
listing:Reset()
|
||||||
listing:SetHandler('OnCellClick', function(cell, button)
|
listing:SetHandler('OnCellClick', function(cell, button)
|
||||||
@@ -29,7 +29,7 @@ function create_frames()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
do
|
do
|
||||||
status_bar = gui.status_bar(frame)
|
private.status_bar = gui.status_bar(frame)
|
||||||
status_bar:SetWidth(265)
|
status_bar:SetWidth(265)
|
||||||
status_bar:SetHeight(25)
|
status_bar:SetHeight(25)
|
||||||
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
@@ -41,14 +41,14 @@ function create_frames()
|
|||||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Bid')
|
btn:SetText('Bid')
|
||||||
btn:Disable()
|
btn:Disable()
|
||||||
bid_button = btn
|
private.bid_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Buyout')
|
btn:SetText('Buyout')
|
||||||
btn:Disable()
|
btn:Disable()
|
||||||
buyout_button = btn
|
private.buyout_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
|
|||||||
+23
-23
@@ -20,19 +20,19 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function read_settings(item_key)
|
function private.read_settings(item_key)
|
||||||
item_key = item_key or selected_item.key
|
item_key = item_key or selected_item.key
|
||||||
return data[item_key] and persistence.read(settings_schema, data[item_key]) or default_settings
|
return data[item_key] and persistence.read(settings_schema, data[item_key]) or default_settings
|
||||||
end
|
end
|
||||||
|
|
||||||
function write_settings(settings, item_key)
|
function private.write_settings(settings, item_key)
|
||||||
item_key = item_key or selected_item.key
|
item_key = item_key or selected_item.key
|
||||||
data[item_key] = persistence.write(settings_schema, settings)
|
data[item_key] = persistence.write(settings_schema, settings)
|
||||||
end
|
end
|
||||||
|
|
||||||
local scan_id, inventory_records, existing_auctions = 0, t, t
|
local scan_id, inventory_records, existing_auctions = 0, t, t
|
||||||
|
|
||||||
function refresh_button_click()
|
function private.refresh_button_click()
|
||||||
aux.scan.abort(scan_id)
|
aux.scan.abort(scan_id)
|
||||||
refresh_entries()
|
refresh_entries()
|
||||||
refresh = true
|
refresh = true
|
||||||
@@ -69,25 +69,25 @@ function USE_ITEM(item_info)
|
|||||||
select_item(item_info.item_key)
|
select_item(item_info.item_key)
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_unit_start_price()
|
function private.get_unit_start_price()
|
||||||
local money_text = unit_start_price:GetText()
|
local money_text = unit_start_price:GetText()
|
||||||
return aux.money.from_string(money_text) or 0
|
return aux.money.from_string(money_text) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_unit_start_price(amount)
|
function private.set_unit_start_price(amount)
|
||||||
unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3, nil, true))
|
unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3, nil, true))
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_unit_buyout_price()
|
function private.get_unit_buyout_price()
|
||||||
local money_text = unit_buyout_price:GetText()
|
local money_text = unit_buyout_price:GetText()
|
||||||
return aux.money.from_string(money_text) or 0
|
return aux.money.from_string(money_text) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_unit_buyout_price(amount)
|
function private.set_unit_buyout_price(amount)
|
||||||
unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3, nil, true))
|
unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3, nil, true))
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_inventory_listing()
|
function private.update_inventory_listing()
|
||||||
if not ACTIVE then return end
|
if not ACTIVE then return end
|
||||||
item_listing.populate(inventory_listing, values(filter(copy(inventory_records), function(record)
|
item_listing.populate(inventory_listing, values(filter(copy(inventory_records), function(record)
|
||||||
local settings = read_settings(record.key)
|
local settings = read_settings(record.key)
|
||||||
@@ -95,7 +95,7 @@ function update_inventory_listing()
|
|||||||
end)))
|
end)))
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_auction_listing()
|
function private.update_auction_listing()
|
||||||
if not ACTIVE then return end
|
if not ACTIVE then return end
|
||||||
local auction_rows = t
|
local auction_rows = t
|
||||||
if selected_item then
|
if selected_item then
|
||||||
@@ -177,7 +177,7 @@ function public.select_item(item_key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function price_update()
|
function private.price_update()
|
||||||
if selected_item then
|
if selected_item then
|
||||||
local settings = read_settings()
|
local settings = read_settings()
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ function price_update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function post_auctions()
|
function private.post_auctions()
|
||||||
if selected_item then
|
if selected_item then
|
||||||
local unit_start_price = get_unit_start_price()
|
local unit_start_price = get_unit_start_price()
|
||||||
local unit_buyout_price = get_unit_buyout_price()
|
local unit_buyout_price = get_unit_buyout_price()
|
||||||
@@ -239,7 +239,7 @@ function post_auctions()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function validate_parameters()
|
function private.validate_parameters()
|
||||||
if not selected_item then
|
if not selected_item then
|
||||||
post_button:Disable()
|
post_button:Disable()
|
||||||
return
|
return
|
||||||
@@ -259,7 +259,7 @@ function validate_parameters()
|
|||||||
post_button:Enable()
|
post_button:Enable()
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_item_configuration()
|
function private.update_item_configuration()
|
||||||
if not selected_item then
|
if not selected_item then
|
||||||
refresh_button:Disable()
|
refresh_button:Disable()
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ function update_item_configuration()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function undercut(record, stack_size, stack)
|
function private.undercut(record, stack_size, stack)
|
||||||
local start_price = round(record.unit_blizzard_bid * (stack and record.stack_size or stack_size))
|
local start_price = round(record.unit_blizzard_bid * (stack and record.stack_size or stack_size))
|
||||||
local buyout_price = round(record.unit_buyout_price * (stack and record.stack_size or stack_size))
|
local buyout_price = round(record.unit_buyout_price * (stack and record.stack_size or stack_size))
|
||||||
if not record.own then
|
if not record.own then
|
||||||
@@ -324,7 +324,7 @@ function undercut(record, stack_size, stack)
|
|||||||
return start_price / stack_size, buyout_price / stack_size
|
return start_price / stack_size, buyout_price / stack_size
|
||||||
end
|
end
|
||||||
|
|
||||||
function quantity_update(max_count)
|
function private.quantity_update(max_count)
|
||||||
if selected_item then
|
if selected_item then
|
||||||
local max_stack_count = selected_item.max_charges and selected_item.availability[stack_size_slider:GetValue()] or floor(selected_item.availability[0] / stack_size_slider:GetValue())
|
local max_stack_count = selected_item.max_charges and selected_item.availability[stack_size_slider:GetValue()] or floor(selected_item.availability[0] / stack_size_slider:GetValue())
|
||||||
stack_count_slider:SetMinMaxValues(1, max_stack_count)
|
stack_count_slider:SetMinMaxValues(1, max_stack_count)
|
||||||
@@ -335,7 +335,7 @@ function quantity_update(max_count)
|
|||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function unit_vendor_price(item_key)
|
function private.unit_vendor_price(item_key)
|
||||||
for slot in info.inventory do auto[slot] = true
|
for slot in info.inventory do auto[slot] = true
|
||||||
local item_info = info.container_item(unpack(slot))
|
local item_info = info.container_item(unpack(slot))
|
||||||
if item_info and item_info.item_key == item_key then
|
if item_info and item_info.item_key == item_key then
|
||||||
@@ -355,7 +355,7 @@ function unit_vendor_price(item_key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_historical_value_button()
|
function private.update_historical_value_button()
|
||||||
if selected_item then
|
if selected_item then
|
||||||
local historical_value = history.value(selected_item.key)
|
local historical_value = history.value(selected_item.key)
|
||||||
historical_value_button.amount = historical_value
|
historical_value_button.amount = historical_value
|
||||||
@@ -363,7 +363,7 @@ function update_historical_value_button()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_item(item)
|
function private.set_item(item)
|
||||||
local settings = read_settings(item.key)
|
local settings = read_settings(item.key)
|
||||||
|
|
||||||
item.unit_vendor_price = unit_vendor_price(item.key)
|
item.unit_vendor_price = unit_vendor_price(item.key)
|
||||||
@@ -398,7 +398,7 @@ function set_item(item)
|
|||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_inventory_records()
|
function private.update_inventory_records()
|
||||||
local auctionable_map = tt
|
local auctionable_map = tt
|
||||||
for slot in info.inventory do auto[slot] = true
|
for slot in info.inventory do auto[slot] = true
|
||||||
for item_info in present(info.container_item(unpack(slot))) do
|
for item_info in present(info.container_item(unpack(slot))) do
|
||||||
@@ -436,7 +436,7 @@ function update_inventory_records()
|
|||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function refresh_entries()
|
function private.refresh_entries()
|
||||||
if selected_item then
|
if selected_item then
|
||||||
local item_id, suffix_id = selected_item.item_id, selected_item.suffix_id
|
local item_id, suffix_id = selected_item.item_id, selected_item.suffix_id
|
||||||
local item_key = item_id .. ':' .. suffix_id
|
local item_key = item_id .. ':' .. suffix_id
|
||||||
@@ -481,7 +481,7 @@ function refresh_entries()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price, duration, owner)
|
function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price, duration, owner)
|
||||||
existing_auctions[key] = existing_auctions[key] or t
|
existing_auctions[key] = existing_auctions[key] or t
|
||||||
local entry
|
local entry
|
||||||
for _, record in existing_auctions[key] do
|
for _, record in existing_auctions[key] do
|
||||||
@@ -497,7 +497,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
|
|||||||
return entry
|
return entry
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_update()
|
function private.on_update()
|
||||||
if refresh then
|
if refresh then
|
||||||
refresh = false
|
refresh = false
|
||||||
price_update()
|
price_update()
|
||||||
@@ -509,7 +509,7 @@ function on_update()
|
|||||||
validate_parameters()
|
validate_parameters()
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize_duration_dropdown()
|
function private.initialize_duration_dropdown()
|
||||||
local function on_click()
|
local function on_click()
|
||||||
UIDropDownMenu_SetSelectedValue(duration_dropdown, this.value)
|
UIDropDownMenu_SetSelectedValue(duration_dropdown, this.value)
|
||||||
local settings = read_settings()
|
local settings = read_settings()
|
||||||
|
|||||||
+26
-26
@@ -1,7 +1,7 @@
|
|||||||
aux 'post_tab' local gui, listing, item_listing, money, search_tab = aux.gui, aux.listing, aux.item_listing, aux.money, aux.search_tab
|
aux 'post_tab' local gui, listing, item_listing, money, search_tab = aux.gui, aux.listing, aux.item_listing, aux.money, aux.search_tab
|
||||||
|
|
||||||
function create_frames()
|
function private.create_frames()
|
||||||
frame = CreateFrame('Frame', nil, aux_frame)
|
private.frame = CreateFrame('Frame', nil, aux_frame)
|
||||||
frame:SetAllPoints()
|
frame:SetAllPoints()
|
||||||
frame:SetScript('OnUpdate', on_update)
|
frame:SetScript('OnUpdate', on_update)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
@@ -35,12 +35,12 @@ function create_frames()
|
|||||||
local label = gui.label(checkbox, gui.font_size.small)
|
local label = gui.label(checkbox, gui.font_size.small)
|
||||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||||
label:SetText('Show hidden items')
|
label:SetText('Show hidden items')
|
||||||
show_hidden_checkbox = checkbox
|
private.show_hidden_checkbox = checkbox
|
||||||
end
|
end
|
||||||
|
|
||||||
gui.horizontal_line(frame.inventory, -48)
|
gui.horizontal_line(frame.inventory, -48)
|
||||||
|
|
||||||
inventory_listing = item_listing.create(
|
private.inventory_listing = item_listing.create(
|
||||||
frame.inventory,
|
frame.inventory,
|
||||||
function()
|
function()
|
||||||
if arg1 == 'LeftButton' then
|
if arg1 == 'LeftButton' then
|
||||||
@@ -56,15 +56,15 @@ function create_frames()
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
auction_listing = listing.CreateScrollingTable(frame.auctions)
|
private.auction_listing = listing.CreateScrollingTable(frame.auctions)
|
||||||
auction_listing:SetColInfo{
|
auction_listing:SetColInfo{
|
||||||
{name='Auctions', width=.12, align='CENTER'},
|
{ name='Auctions', width=.12, align='CENTER' },
|
||||||
{name='Left', width=.1, align='CENTER'},
|
{ name='Left', width=.1, align='CENTER' },
|
||||||
{name='Qty', width=.08, align='CENTER'},
|
{ name='Qty', width=.08, align='CENTER' },
|
||||||
{name='Bid/ea', width=.22, align='RIGHT'},
|
{ name='Bid/ea', width=.22, align='RIGHT' },
|
||||||
{name='Bid Pct', width=.13, align='CENTER'},
|
{ name='Bid Pct', width=.13, align='CENTER' },
|
||||||
{name='Buy/ea', width=.22, align='RIGHT'},
|
{ name='Buy/ea', width=.22, align='RIGHT' },
|
||||||
{name='Buy Pct', width=.13, align='CENTER'}
|
{ name='Buy Pct', width=.13, align='CENTER' },
|
||||||
}
|
}
|
||||||
auction_listing:EnableSorting(false)
|
auction_listing:EnableSorting(false)
|
||||||
auction_listing:DisableSelection(true)
|
auction_listing:DisableSelection(true)
|
||||||
@@ -81,7 +81,7 @@ function create_frames()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
do
|
do
|
||||||
status_bar = gui.status_bar(frame)
|
private.status_bar = gui.status_bar(frame)
|
||||||
status_bar:SetWidth(265)
|
status_bar:SetWidth(265)
|
||||||
status_bar:SetHeight(25)
|
status_bar:SetHeight(25)
|
||||||
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
@@ -93,17 +93,17 @@ function create_frames()
|
|||||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Post')
|
btn:SetText('Post')
|
||||||
btn:SetScript('OnClick', post_auctions)
|
btn:SetScript('OnClick', post_auctions)
|
||||||
post_button = btn
|
private.post_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame.parameters)
|
local btn = gui.button(frame.parameters)
|
||||||
btn:SetPoint('TOPLEFT', post_button, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', post_button, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Refresh')
|
btn:SetText('Refresh')
|
||||||
btn:SetScript('OnClick', refresh_button_click)
|
btn:SetScript('OnClick', refresh_button_click)
|
||||||
refresh_button = btn
|
private.refresh_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
item = gui.item(frame.parameters)
|
private.item = gui.item(frame.parameters)
|
||||||
item:SetPoint('TOPLEFT', 10, -6)
|
item:SetPoint('TOPLEFT', 10, -6)
|
||||||
item.button:SetScript('OnEnter', function()
|
item.button:SetScript('OnEnter', function()
|
||||||
if selected_item then
|
if selected_item then
|
||||||
@@ -143,7 +143,7 @@ function create_frames()
|
|||||||
slider.editbox:SetNumeric(true)
|
slider.editbox:SetNumeric(true)
|
||||||
slider.editbox:SetMaxLetters(3)
|
slider.editbox:SetMaxLetters(3)
|
||||||
slider.label:SetText('Stack Size')
|
slider.label:SetText('Stack Size')
|
||||||
stack_size_slider = slider
|
private.stack_size_slider = slider
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local slider = gui.slider(frame.parameters)
|
local slider = gui.slider(frame.parameters)
|
||||||
@@ -166,7 +166,7 @@ function create_frames()
|
|||||||
end)
|
end)
|
||||||
slider.editbox:SetNumeric(true)
|
slider.editbox:SetNumeric(true)
|
||||||
slider.label:SetText('Stack Count')
|
slider.label:SetText('Stack Count')
|
||||||
stack_count_slider = slider
|
private.stack_count_slider = slider
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local dropdown = gui.dropdown(frame.parameters)
|
local dropdown = gui.dropdown(frame.parameters)
|
||||||
@@ -179,12 +179,12 @@ function create_frames()
|
|||||||
dropdown:SetScript('OnShow', function()
|
dropdown:SetScript('OnShow', function()
|
||||||
UIDropDownMenu_Initialize(this, initialize_duration_dropdown)
|
UIDropDownMenu_Initialize(this, initialize_duration_dropdown)
|
||||||
end)
|
end)
|
||||||
duration_dropdown = dropdown
|
private.duration_dropdown = dropdown
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local label = gui.label(frame.parameters, gui.font_size.medium)
|
local label = gui.label(frame.parameters, gui.font_size.medium)
|
||||||
label:SetPoint('LEFT', duration_dropdown, 'RIGHT', 25, 0)
|
label:SetPoint('LEFT', duration_dropdown, 'RIGHT', 25, 0)
|
||||||
deposit = label
|
private.deposit = label
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local checkbox = gui.checkbox(frame.parameters)
|
local checkbox = gui.checkbox(frame.parameters)
|
||||||
@@ -198,7 +198,7 @@ function create_frames()
|
|||||||
local label = gui.label(checkbox, gui.font_size.small)
|
local label = gui.label(checkbox, gui.font_size.small)
|
||||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||||
label:SetText('Hide this item')
|
label:SetText('Hide this item')
|
||||||
hide_checkbox = checkbox
|
private.hide_checkbox = checkbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = gui.editbox(frame.parameters)
|
local editbox = gui.editbox(frame.parameters)
|
||||||
@@ -231,9 +231,9 @@ function create_frames()
|
|||||||
label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0)
|
label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0)
|
||||||
label:SetWidth(50)
|
label:SetWidth(50)
|
||||||
label:SetJustifyH('CENTER')
|
label:SetJustifyH('CENTER')
|
||||||
start_price_percentage = label
|
private.start_price_percentage = label
|
||||||
end
|
end
|
||||||
unit_start_price = editbox
|
private.unit_start_price = editbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = gui.editbox(frame.parameters)
|
local editbox = gui.editbox(frame.parameters)
|
||||||
@@ -266,9 +266,9 @@ function create_frames()
|
|||||||
label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0)
|
label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0)
|
||||||
label:SetWidth(50)
|
label:SetWidth(50)
|
||||||
label:SetJustifyH('CENTER')
|
label:SetJustifyH('CENTER')
|
||||||
buyout_price_percentage = label
|
private.buyout_price_percentage = label
|
||||||
end
|
end
|
||||||
unit_buyout_price = editbox
|
private.unit_buyout_price = editbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame.parameters, 14)
|
local btn = gui.button(frame.parameters, 14)
|
||||||
@@ -285,6 +285,6 @@ function create_frames()
|
|||||||
local label = gui.label(btn, gui.font_size.small)
|
local label = gui.label(btn, gui.font_size.small)
|
||||||
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
|
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
|
||||||
label:SetText('Historical Value')
|
label:SetText('Historical Value')
|
||||||
historical_value_button = btn
|
private.historical_value_button = btn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -19,7 +19,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
|||||||
}
|
}
|
||||||
do
|
do
|
||||||
local function action()
|
local function action()
|
||||||
_G.aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText()
|
aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText()
|
||||||
update_auto_buy_filter()
|
update_auto_buy_filter()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -47,7 +47,9 @@ do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
RESULTS, SAVED, FILTER = 1, 2, 3
|
private.RESULTS = 1
|
||||||
|
private.SAVED = 2
|
||||||
|
private.FILTER = 3
|
||||||
|
|
||||||
function LOAD()
|
function LOAD()
|
||||||
create_frames()
|
create_frames()
|
||||||
@@ -113,7 +115,7 @@ function public.add_filter(filter_string)
|
|||||||
search_box:SetText(old_filter_string .. filter_string)
|
search_box:SetText(old_filter_string .. filter_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
function blizzard_page_index(str)
|
function private.blizzard_page_index(str)
|
||||||
if tonumber(str) then
|
if tonumber(str) then
|
||||||
return max(0, tonumber(str) - 1)
|
return max(0, tonumber(str) - 1)
|
||||||
end
|
end
|
||||||
|
|||||||
+23
-23
@@ -1,11 +1,11 @@
|
|||||||
aux 'search_tab' local filter_util = aux.filter_util
|
aux 'search_tab' local filter_util = aux.filter_util
|
||||||
|
|
||||||
function valid_level(str)
|
function private.valid_level(str)
|
||||||
local level = tonumber(str)
|
local level = tonumber(str)
|
||||||
return level and bounded(1, 60, level)
|
return level and bounded(1, 60, level)
|
||||||
end
|
end
|
||||||
|
|
||||||
blizzard_query = setmetatable(t, {
|
private.blizzard_query = setmetatable(t, {
|
||||||
__index = function(_, key)
|
__index = function(_, key)
|
||||||
if key == 'name' then
|
if key == 'name' then
|
||||||
return name_input:GetText()
|
return name_input:GetText()
|
||||||
@@ -58,7 +58,7 @@ blizzard_query = setmetatable(t, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
function update_form()
|
function private.update_form()
|
||||||
if blizzard_query.class and GetAuctionItemSubClasses(blizzard_query.class) then
|
if blizzard_query.class and GetAuctionItemSubClasses(blizzard_query.class) then
|
||||||
subclass_dropdown.button:Enable()
|
subclass_dropdown.button:Enable()
|
||||||
else
|
else
|
||||||
@@ -99,7 +99,7 @@ function update_form()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_filter_builder_query()
|
function private.get_filter_builder_query()
|
||||||
local filter_string
|
local filter_string
|
||||||
|
|
||||||
local function add(part)
|
local function add(part)
|
||||||
@@ -143,7 +143,7 @@ function get_filter_builder_query()
|
|||||||
return filter_string or ''
|
return filter_string or ''
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_form(filter)
|
function private.set_form(filter)
|
||||||
clear_form()
|
clear_form()
|
||||||
for _, component in filter.components do
|
for _, component in filter.components do
|
||||||
if component[1] == 'blizzard' then
|
if component[1] == 'blizzard' then
|
||||||
@@ -155,7 +155,7 @@ function set_form(filter)
|
|||||||
update_filter_display()
|
update_filter_display()
|
||||||
end
|
end
|
||||||
|
|
||||||
function clear_form()
|
function private.clear_form()
|
||||||
blizzard_query.name = ''
|
blizzard_query.name = ''
|
||||||
name_input:ClearFocus()
|
name_input:ClearFocus()
|
||||||
blizzard_query.exact = false
|
blizzard_query.exact = false
|
||||||
@@ -174,14 +174,14 @@ function clear_form()
|
|||||||
update_filter_display()
|
update_filter_display()
|
||||||
end
|
end
|
||||||
|
|
||||||
function import_filter_string()
|
function private.import_filter_string()
|
||||||
local filter, error = filter_util.parse_filter_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
local filter, error = filter_util.parse_filter_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
||||||
if filter or print(error) then
|
if filter or print(error) then
|
||||||
set_form(filter)
|
set_form(filter)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function export_filter_string()
|
function private.export_filter_string()
|
||||||
search_box:SetText(get_filter_builder_query())
|
search_box:SetText(get_filter_builder_query())
|
||||||
filter_parameter_input:ClearFocus()
|
filter_parameter_input:ClearFocus()
|
||||||
end
|
end
|
||||||
@@ -230,14 +230,14 @@ function public.formatted_post_filter(components)
|
|||||||
return '<html><body><p>' .. str .. '</p></body></html>'
|
return '<html><body><p>' .. str .. '</p></body></html>'
|
||||||
end
|
end
|
||||||
|
|
||||||
function data_link(id, str)
|
function private.data_link(id, str)
|
||||||
return '|H' .. id .. '|h' .. str .. '|h'
|
return '|H' .. id .. '|h' .. str .. '|h'
|
||||||
end
|
end
|
||||||
|
|
||||||
post_filter = t
|
private.post_filter = t
|
||||||
filter_builder_state = T('selected', 0)
|
private.filter_builder_state = T('selected', 0)
|
||||||
|
|
||||||
function data_link_click()
|
function private.data_link_click()
|
||||||
local button = arg3
|
local button = arg3
|
||||||
local index = tonumber(arg1)
|
local index = tonumber(arg1)
|
||||||
if button == 'LeftButton' then
|
if button == 'LeftButton' then
|
||||||
@@ -248,7 +248,7 @@ function data_link_click()
|
|||||||
update_filter_display()
|
update_filter_display()
|
||||||
end
|
end
|
||||||
|
|
||||||
function remove_component(index)
|
function private.remove_component(index)
|
||||||
index = index or filter_builder_state.selected
|
index = index or filter_builder_state.selected
|
||||||
if filter_builder_state.selected >= index then
|
if filter_builder_state.selected >= index then
|
||||||
filter_builder_state.selected = max(filter_builder_state.selected - 1, min(1, getn(post_filter)))
|
filter_builder_state.selected = max(filter_builder_state.selected - 1, min(1, getn(post_filter)))
|
||||||
@@ -257,12 +257,12 @@ function remove_component(index)
|
|||||||
tremove(post_filter, index)
|
tremove(post_filter, index)
|
||||||
end
|
end
|
||||||
|
|
||||||
function add_component(component)
|
function private.add_component(component)
|
||||||
filter_builder_state.selected = filter_builder_state.selected + 1
|
filter_builder_state.selected = filter_builder_state.selected + 1
|
||||||
tinsert(post_filter, filter_builder_state.selected, component)
|
tinsert(post_filter, filter_builder_state.selected, component)
|
||||||
end
|
end
|
||||||
|
|
||||||
function add_post_filter()
|
function private.add_post_filter()
|
||||||
for str in present(filter_input:GetText()) do
|
for str in present(filter_input:GetText()) do
|
||||||
for filter in present(filter_util.filters[str]) do
|
for filter in present(filter_util.filters[str]) do
|
||||||
if filter.input_type ~= '' then
|
if filter.input_type ~= '' then
|
||||||
@@ -284,13 +284,13 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
local text = ''
|
local text = ''
|
||||||
function update_filter_display()
|
function private.update_filter_display()
|
||||||
text = formatted_post_filter(post_filter)
|
text = formatted_post_filter(post_filter)
|
||||||
filter_display:SetWidth(filter_display_size())
|
filter_display:SetWidth(filter_display_size())
|
||||||
set_filter_display_offset()
|
set_filter_display_offset()
|
||||||
filter_display:SetText(text)
|
filter_display:SetText(text)
|
||||||
end
|
end
|
||||||
function filter_display_size()
|
function private.filter_display_size()
|
||||||
local font, font_size = filter_display:GetFont()
|
local font, font_size = filter_display:GetFont()
|
||||||
filter_display.measure:SetFont(font, font_size)
|
filter_display.measure:SetFont(font, font_size)
|
||||||
local lines = 0
|
local lines = 0
|
||||||
@@ -304,7 +304,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_filter_display_offset(x_offset, y_offset)
|
function private.set_filter_display_offset(x_offset, y_offset)
|
||||||
local scroll_frame = filter_display:GetParent()
|
local scroll_frame = filter_display:GetParent()
|
||||||
x_offset, y_offset = x_offset or scroll_frame:GetHorizontalScroll(), y_offset or scroll_frame:GetVerticalScroll()
|
x_offset, y_offset = x_offset or scroll_frame:GetHorizontalScroll(), y_offset or scroll_frame:GetVerticalScroll()
|
||||||
local width, height = filter_display_size()
|
local width, height = filter_display_size()
|
||||||
@@ -316,7 +316,7 @@ function set_filter_display_offset(x_offset, y_offset)
|
|||||||
scroll_frame:SetVerticalScroll(bounded(y_lower_bound, y_upper_bound, y_offset))
|
scroll_frame:SetVerticalScroll(bounded(y_lower_bound, y_upper_bound, y_offset))
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize_filter_dropdown()
|
function private.initialize_filter_dropdown()
|
||||||
for filter in temp-S('and', 'or', 'not', 'min-unit-bid', 'min-unit-buy', 'max-unit-bid', 'max-unit-buy', 'bid-profit', 'buy-profit', 'bid-vend-profit', 'buy-vend-profit', 'bid-dis-profit', 'buy-dis-profit', 'bid-pct', 'buy-pct', 'item', 'tooltip', 'min-lvl', 'max-lvl', 'rarity', 'left', 'utilizable', 'discard') do
|
for filter in temp-S('and', 'or', 'not', 'min-unit-bid', 'min-unit-buy', 'max-unit-bid', 'max-unit-buy', 'bid-profit', 'buy-profit', 'bid-vend-profit', 'buy-vend-profit', 'bid-dis-profit', 'buy-dis-profit', 'bid-pct', 'buy-pct', 'item', 'tooltip', 'min-lvl', 'max-lvl', 'rarity', 'left', 'utilizable', 'discard') do
|
||||||
UIDropDownMenu_AddButton(T(
|
UIDropDownMenu_AddButton(T(
|
||||||
'text', filter,
|
'text', filter,
|
||||||
@@ -336,7 +336,7 @@ function initialize_filter_dropdown()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize_class_dropdown()
|
function private.initialize_class_dropdown()
|
||||||
local function on_click()
|
local function on_click()
|
||||||
if this.value ~= blizzard_query.class then
|
if this.value ~= blizzard_query.class then
|
||||||
UIDropDownMenu_SetSelectedValue(class_dropdown, this.value)
|
UIDropDownMenu_SetSelectedValue(class_dropdown, this.value)
|
||||||
@@ -353,7 +353,7 @@ function initialize_class_dropdown()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize_subclass_dropdown()
|
function private.initialize_subclass_dropdown()
|
||||||
local function on_click()
|
local function on_click()
|
||||||
if this.value ~= blizzard_query.subclass then
|
if this.value ~= blizzard_query.subclass then
|
||||||
UIDropDownMenu_SetSelectedValue(subclass_dropdown, this.value)
|
UIDropDownMenu_SetSelectedValue(subclass_dropdown, this.value)
|
||||||
@@ -371,7 +371,7 @@ function initialize_subclass_dropdown()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize_slot_dropdown()
|
function private.initialize_slot_dropdown()
|
||||||
local function on_click()
|
local function on_click()
|
||||||
UIDropDownMenu_SetSelectedValue(slot_dropdown, this.value)
|
UIDropDownMenu_SetSelectedValue(slot_dropdown, this.value)
|
||||||
update_form()
|
update_form()
|
||||||
@@ -386,7 +386,7 @@ function initialize_slot_dropdown()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize_quality_dropdown()
|
function private.initialize_quality_dropdown()
|
||||||
local function on_click()
|
local function on_click()
|
||||||
UIDropDownMenu_SetSelectedValue(quality_dropdown, this.value)
|
UIDropDownMenu_SetSelectedValue(quality_dropdown, this.value)
|
||||||
update_form()
|
update_form()
|
||||||
|
|||||||
+58
-58
@@ -2,8 +2,8 @@ aux 'search_tab' local gui, completion, listing, auction_listing, filter_util =
|
|||||||
|
|
||||||
FILTER_SPACING = 28.5
|
FILTER_SPACING = 28.5
|
||||||
|
|
||||||
function create_frames()
|
function private.create_frames()
|
||||||
frame = CreateFrame('Frame', nil, aux_frame)
|
private.frame = CreateFrame('Frame', nil, aux_frame)
|
||||||
frame:SetAllPoints()
|
frame:SetAllPoints()
|
||||||
frame:SetScript('OnUpdate', on_update)
|
frame:SetScript('OnUpdate', on_update)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
@@ -49,7 +49,7 @@ function create_frames()
|
|||||||
fake_icon_part:SetText('_')
|
fake_icon_part:SetText('_')
|
||||||
end
|
end
|
||||||
|
|
||||||
settings_button = btn
|
private.settings_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local panel = CreateFrame('Frame', nil, frame)
|
local panel = CreateFrame('Frame', nil, frame)
|
||||||
@@ -59,14 +59,14 @@ function create_frames()
|
|||||||
panel:SetPoint('RIGHT', 0, 0)
|
panel:SetPoint('RIGHT', 0, 0)
|
||||||
panel:SetHeight(42)
|
panel:SetHeight(42)
|
||||||
panel:Hide()
|
panel:Hide()
|
||||||
settings = panel
|
private.settings = panel
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local panel = CreateFrame('Frame', nil, frame)
|
local panel = CreateFrame('Frame', nil, frame)
|
||||||
panel:SetPoint('LEFT', settings_button, 'RIGHT', 0, 0)
|
panel:SetPoint('LEFT', settings_button, 'RIGHT', 0, 0)
|
||||||
panel:SetPoint('RIGHT', 0, 1)
|
panel:SetPoint('RIGHT', 0, 1)
|
||||||
panel:SetHeight(40)
|
panel:SetHeight(40)
|
||||||
controls = panel
|
private.controls = panel
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local function change()
|
local function change()
|
||||||
@@ -93,7 +93,7 @@ function create_frames()
|
|||||||
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
|
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
|
||||||
label:SetText('Pages')
|
label:SetText('Pages')
|
||||||
label:SetTextColor(color.text.enabled())
|
label:SetTextColor(color.text.enabled())
|
||||||
first_page_input = editbox
|
private.first_page_input = editbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = gui.editbox(settings)
|
local editbox = gui.editbox(settings)
|
||||||
@@ -107,7 +107,7 @@ function create_frames()
|
|||||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
||||||
label:SetText('-')
|
label:SetText('-')
|
||||||
label:SetTextColor(color.text.enabled())
|
label:SetTextColor(color.text.enabled())
|
||||||
last_page_input = editbox
|
private.last_page_input = editbox
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
@@ -118,9 +118,9 @@ function create_frames()
|
|||||||
btn:SetText('Real Time Mode')
|
btn:SetText('Real Time Mode')
|
||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
this:SetChecked(not this:GetChecked())
|
this:SetChecked(not this:GetChecked())
|
||||||
_G.this = first_page_input
|
this = first_page_input
|
||||||
first_page_input:GetScript('OnTextChanged')()
|
first_page_input:GetScript('OnTextChanged')()
|
||||||
_G.this = last_page_input
|
this = last_page_input
|
||||||
last_page_input:GetScript('OnTextChanged')()
|
last_page_input:GetScript('OnTextChanged')()
|
||||||
end)
|
end)
|
||||||
public.real_time_button = btn
|
public.real_time_button = btn
|
||||||
@@ -138,7 +138,7 @@ function create_frames()
|
|||||||
StaticPopup_Show('AUX_SEARCH_AUTO_BUY')
|
StaticPopup_Show('AUX_SEARCH_AUTO_BUY')
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
auto_buy_button = btn
|
private.auto_buy_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.checkbutton(settings)
|
local btn = gui.checkbutton(settings)
|
||||||
@@ -149,7 +149,7 @@ function create_frames()
|
|||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
if this:GetChecked() then
|
if this:GetChecked() then
|
||||||
this:SetChecked(false)
|
this:SetChecked(false)
|
||||||
_G.aux_auto_buy_filter = nil
|
aux_auto_buy_filter = nil
|
||||||
this.prettified = nil
|
this.prettified = nil
|
||||||
auto_buy_validator = nil
|
auto_buy_validator = nil
|
||||||
else
|
else
|
||||||
@@ -166,7 +166,7 @@ function create_frames()
|
|||||||
btn:SetScript('OnLeave', function()
|
btn:SetScript('OnLeave', function()
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
end)
|
end)
|
||||||
auto_buy_filter_button = btn
|
private.auto_buy_filter_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(controls, 25)
|
local btn = gui.button(controls, 25)
|
||||||
@@ -175,7 +175,7 @@ function create_frames()
|
|||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetText('<')
|
btn:SetText('<')
|
||||||
btn:SetScript('OnClick', previous_search)
|
btn:SetScript('OnClick', previous_search)
|
||||||
previous_button = btn
|
private.previous_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(controls, 25)
|
local btn = gui.button(controls, 25)
|
||||||
@@ -184,7 +184,7 @@ function create_frames()
|
|||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetText('>')
|
btn:SetText('>')
|
||||||
btn:SetScript('OnClick', next_search)
|
btn:SetScript('OnClick', next_search)
|
||||||
next_button = btn
|
private.next_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(controls, gui.font_size.huge)
|
local btn = gui.button(controls, gui.font_size.huge)
|
||||||
@@ -199,7 +199,7 @@ function create_frames()
|
|||||||
end
|
end
|
||||||
execute()
|
execute()
|
||||||
end)
|
end)
|
||||||
start_button = btn
|
private.start_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(controls, gui.font_size.huge)
|
local btn = gui.button(controls, gui.font_size.huge)
|
||||||
@@ -210,7 +210,7 @@ function create_frames()
|
|||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
aux.scan.abort(search_scan_id)
|
aux.scan.abort(search_scan_id)
|
||||||
end)
|
end)
|
||||||
stop_button = btn
|
private.stop_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(controls, gui.font_size.huge)
|
local btn = gui.button(controls, gui.font_size.huge)
|
||||||
@@ -221,7 +221,7 @@ function create_frames()
|
|||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
execute(true)
|
execute(true)
|
||||||
end)
|
end)
|
||||||
resume_button = btn
|
private.resume_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = gui.editbox(controls)
|
local editbox = gui.editbox(controls)
|
||||||
@@ -240,7 +240,7 @@ function create_frames()
|
|||||||
this:HighlightText(0, 0)
|
this:HighlightText(0, 0)
|
||||||
end)
|
end)
|
||||||
editbox.enter = execute
|
editbox.enter = execute
|
||||||
search_box = editbox
|
private.search_box = editbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
gui.horizontal_line(frame, -40)
|
gui.horizontal_line(frame, -40)
|
||||||
@@ -252,7 +252,7 @@ function create_frames()
|
|||||||
btn:SetHeight(22)
|
btn:SetHeight(22)
|
||||||
btn:SetText('Search Results')
|
btn:SetText('Search Results')
|
||||||
btn:SetScript('OnClick', function() subtab = RESULTS end)
|
btn:SetScript('OnClick', function() subtab = RESULTS end)
|
||||||
search_results_button = btn
|
private.search_results_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame, gui.font_size.large)
|
local btn = gui.button(frame, gui.font_size.large)
|
||||||
@@ -261,7 +261,7 @@ function create_frames()
|
|||||||
btn:SetHeight(22)
|
btn:SetHeight(22)
|
||||||
btn:SetText('Saved Searches')
|
btn:SetText('Saved Searches')
|
||||||
btn:SetScript('OnClick', function() subtab = SAVED end)
|
btn:SetScript('OnClick', function() subtab = SAVED end)
|
||||||
saved_searches_button = btn
|
private.saved_searches_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame, gui.font_size.large)
|
local btn = gui.button(frame, gui.font_size.large)
|
||||||
@@ -270,28 +270,28 @@ function create_frames()
|
|||||||
btn:SetHeight(22)
|
btn:SetHeight(22)
|
||||||
btn:SetText('Filter Builder')
|
btn:SetText('Filter Builder')
|
||||||
btn:SetScript('OnClick', function() subtab = FILTER end)
|
btn:SetScript('OnClick', function() subtab = FILTER end)
|
||||||
new_filter_button = btn
|
private.new_filter_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local frame = CreateFrame('Frame', nil, frame)
|
local frame = CreateFrame('Frame', nil, frame)
|
||||||
frame:SetWidth(265)
|
frame:SetWidth(265)
|
||||||
frame:SetHeight(25)
|
frame:SetHeight(25)
|
||||||
frame:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
frame:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
status_bar_frame = frame
|
private.status_bar_frame = frame
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame.results)
|
local btn = gui.button(frame.results)
|
||||||
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Bid')
|
btn:SetText('Bid')
|
||||||
btn:Disable()
|
btn:Disable()
|
||||||
bid_button = btn
|
private.bid_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame.results)
|
local btn = gui.button(frame.results)
|
||||||
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Buyout')
|
btn:SetText('Buyout')
|
||||||
btn:Disable()
|
btn:Disable()
|
||||||
buyout_button = btn
|
private.buyout_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame.results)
|
local btn = gui.button(frame.results)
|
||||||
@@ -340,7 +340,7 @@ function create_frames()
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = gui.editbox(frame.filter)
|
local editbox = gui.editbox(frame.filter)
|
||||||
editbox.complete_item = completion.complete(function() return _G.aux_auctionable_items end)
|
editbox.complete_item = completion.complete(function() return aux_auctionable_items end)
|
||||||
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
|
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
|
||||||
editbox:SetWidth(260)
|
editbox:SetWidth(260)
|
||||||
editbox.char = function()
|
editbox.char = function()
|
||||||
@@ -359,11 +359,11 @@ function create_frames()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
editbox.change = update_form
|
editbox.change = update_form
|
||||||
editbox.enter = partial(editbox.ClearFocus, editbox)
|
editbox.enter = papply(editbox.ClearFocus, editbox)
|
||||||
local label = gui.label(editbox, gui.font_size.small)
|
local label = gui.label(editbox, gui.font_size.small)
|
||||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||||
label:SetText('Name')
|
label:SetText('Name')
|
||||||
name_input = editbox
|
private.name_input = editbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local checkbox = gui.checkbox(frame.filter)
|
local checkbox = gui.checkbox(frame.filter)
|
||||||
@@ -372,7 +372,7 @@ function create_frames()
|
|||||||
local label = gui.label(checkbox, gui.font_size.small)
|
local label = gui.label(checkbox, gui.font_size.small)
|
||||||
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
|
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
|
||||||
label:SetText('Exact')
|
label:SetText('Exact')
|
||||||
exact_checkbox = checkbox
|
private.exact_checkbox = checkbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = gui.editbox(frame.filter)
|
local editbox = gui.editbox(frame.filter)
|
||||||
@@ -386,7 +386,7 @@ function create_frames()
|
|||||||
max_level_input:SetFocus()
|
max_level_input:SetFocus()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
editbox.enter = partial(editbox.ClearFocus, editbox)
|
editbox.enter = papply(editbox.ClearFocus, editbox)
|
||||||
editbox.change = function()
|
editbox.change = function()
|
||||||
local valid_level = valid_level(this:GetText())
|
local valid_level = valid_level(this:GetText())
|
||||||
if tostring(valid_level) ~= this:GetText() then
|
if tostring(valid_level) ~= this:GetText() then
|
||||||
@@ -397,7 +397,7 @@ function create_frames()
|
|||||||
local label = gui.label(editbox, gui.font_size.small)
|
local label = gui.label(editbox, gui.font_size.small)
|
||||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||||
label:SetText('Level Range')
|
label:SetText('Level Range')
|
||||||
min_level_input = editbox
|
private.min_level_input = editbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = gui.editbox(frame.filter)
|
local editbox = gui.editbox(frame.filter)
|
||||||
@@ -411,7 +411,7 @@ function create_frames()
|
|||||||
name_input:SetFocus()
|
name_input:SetFocus()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
editbox.enter = partial(editbox.ClearFocus, editbox)
|
editbox.enter = papply(editbox.ClearFocus, editbox)
|
||||||
editbox.change = function()
|
editbox.change = function()
|
||||||
local valid_level = valid_level(this:GetText())
|
local valid_level = valid_level(this:GetText())
|
||||||
if tostring(valid_level) ~= this:GetText() then
|
if tostring(valid_level) ~= this:GetText() then
|
||||||
@@ -422,7 +422,7 @@ function create_frames()
|
|||||||
local label = gui.label(editbox, gui.font_size.medium)
|
local label = gui.label(editbox, gui.font_size.medium)
|
||||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
|
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
|
||||||
label:SetText('-')
|
label:SetText('-')
|
||||||
max_level_input = editbox
|
private.max_level_input = editbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local checkbox = gui.checkbox(frame.filter)
|
local checkbox = gui.checkbox(frame.filter)
|
||||||
@@ -431,11 +431,11 @@ function create_frames()
|
|||||||
local label = gui.label(checkbox, gui.font_size.small)
|
local label = gui.label(checkbox, gui.font_size.small)
|
||||||
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
|
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
|
||||||
label:SetText('Usable')
|
label:SetText('Usable')
|
||||||
usable_checkbox = checkbox
|
private.usable_checkbox = checkbox
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local dropdown = gui.dropdown(frame.filter)
|
local dropdown = gui.dropdown(frame.filter)
|
||||||
class_dropdown = dropdown
|
private.class_dropdown = dropdown
|
||||||
dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING)
|
dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING)
|
||||||
dropdown:SetWidth(300)
|
dropdown:SetWidth(300)
|
||||||
local label = gui.label(dropdown, gui.font_size.small)
|
local label = gui.label(dropdown, gui.font_size.small)
|
||||||
@@ -448,7 +448,7 @@ function create_frames()
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local dropdown = gui.dropdown(frame.filter)
|
local dropdown = gui.dropdown(frame.filter)
|
||||||
subclass_dropdown = dropdown
|
private.subclass_dropdown = dropdown
|
||||||
dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
||||||
dropdown:SetWidth(300)
|
dropdown:SetWidth(300)
|
||||||
local label = gui.label(dropdown, gui.font_size.small)
|
local label = gui.label(dropdown, gui.font_size.small)
|
||||||
@@ -461,7 +461,7 @@ function create_frames()
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local dropdown = gui.dropdown(frame.filter)
|
local dropdown = gui.dropdown(frame.filter)
|
||||||
slot_dropdown = dropdown
|
private.slot_dropdown = dropdown
|
||||||
dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
||||||
dropdown:SetWidth(300)
|
dropdown:SetWidth(300)
|
||||||
local label = gui.label(dropdown, gui.font_size.small)
|
local label = gui.label(dropdown, gui.font_size.small)
|
||||||
@@ -474,7 +474,7 @@ function create_frames()
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local dropdown = gui.dropdown(frame.filter)
|
local dropdown = gui.dropdown(frame.filter)
|
||||||
quality_dropdown = dropdown
|
private.quality_dropdown = dropdown
|
||||||
dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
||||||
dropdown:SetWidth(300)
|
dropdown:SetWidth(300)
|
||||||
local label = gui.label(dropdown, gui.font_size.small)
|
local label = gui.label(dropdown, gui.font_size.small)
|
||||||
@@ -498,7 +498,7 @@ function create_frames()
|
|||||||
local label = gui.label(dropdown, gui.font_size.medium)
|
local label = gui.label(dropdown, gui.font_size.medium)
|
||||||
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
|
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
|
||||||
label:SetText('Post Filter')
|
label:SetText('Post Filter')
|
||||||
filter_dropdown = dropdown
|
private.filter_dropdown = dropdown
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local input = gui.editbox(frame.filter)
|
local input = gui.editbox(frame.filter)
|
||||||
@@ -525,7 +525,7 @@ function create_frames()
|
|||||||
add_post_filter()
|
add_post_filter()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
filter_input = input
|
private.filter_input = input
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local input = gui.editbox(frame.filter)
|
local input = gui.editbox(frame.filter)
|
||||||
@@ -537,7 +537,7 @@ function create_frames()
|
|||||||
input.char = function() this:complete() end
|
input.char = function() this:complete() end
|
||||||
input.enter = add_post_filter
|
input.enter = add_post_filter
|
||||||
input:Hide()
|
input:Hide()
|
||||||
filter_parameter_input = input
|
private.filter_parameter_input = input
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local scroll_frame = CreateFrame('ScrollFrame', nil, frame.filter)
|
local scroll_frame = CreateFrame('ScrollFrame', nil, frame.filter)
|
||||||
@@ -578,14 +578,14 @@ function create_frames()
|
|||||||
scroll_child:SetWidth(1)
|
scroll_child:SetWidth(1)
|
||||||
scroll_child:SetHeight(1)
|
scroll_child:SetHeight(1)
|
||||||
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
|
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
|
||||||
-- scroll_child:SetHyperlinkFormat("format")
|
-- scroll_child:SetHyperlinkFormat("format") TODO
|
||||||
scroll_child.measure = scroll_child:CreateFontString()
|
scroll_child.measure = scroll_child:CreateFontString()
|
||||||
filter_display = scroll_child
|
private.filter_display = scroll_child
|
||||||
end
|
end
|
||||||
|
|
||||||
status_bars = t
|
private.status_bars = t
|
||||||
tables = t
|
private.tables = t
|
||||||
for _=1,5 do
|
for _ = 1, 5 do
|
||||||
local status_bar = gui.status_bar(frame)
|
local status_bar = gui.status_bar(frame)
|
||||||
status_bar:SetAllPoints(status_bar_frame)
|
status_bar:SetAllPoints(status_bar_frame)
|
||||||
status_bar:Hide()
|
status_bar:Hide()
|
||||||
@@ -618,16 +618,16 @@ function create_frames()
|
|||||||
add_filter(data.search.filter_string)
|
add_filter(data.search.filter_string)
|
||||||
elseif button == 'LeftButton' and IsControlKeyDown() then
|
elseif button == 'LeftButton' and IsControlKeyDown() then
|
||||||
if st == favorite_searches_listing and data.index > 1 then
|
if st == favorite_searches_listing and data.index > 1 then
|
||||||
local temp = _G.aux_favorite_searches[data.index - 1]
|
local temp = aux_favorite_searches[data.index - 1]
|
||||||
_G.aux_favorite_searches[data.index - 1] = data.search
|
aux_favorite_searches[data.index - 1] = data.search
|
||||||
_G.aux_favorite_searches[data.index] = temp
|
aux_favorite_searches[data.index] = temp
|
||||||
update_search_listings()
|
update_search_listings()
|
||||||
end
|
end
|
||||||
elseif button == 'RightButton' and IsControlKeyDown() then
|
elseif button == 'RightButton' and IsControlKeyDown() then
|
||||||
if st == favorite_searches_listing and data.index < getn(_G.aux_favorite_searches) then
|
if st == favorite_searches_listing and data.index < getn(aux_favorite_searches) then
|
||||||
local temp = _G.aux_favorite_searches[data.index + 1]
|
local temp = aux_favorite_searches[data.index + 1]
|
||||||
_G.aux_favorite_searches[data.index + 1] = data.search
|
aux_favorite_searches[data.index + 1] = data.search
|
||||||
_G.aux_favorite_searches[data.index] = temp
|
aux_favorite_searches[data.index] = temp
|
||||||
update_search_listings()
|
update_search_listings()
|
||||||
end
|
end
|
||||||
elseif button == 'LeftButton' then
|
elseif button == 'LeftButton' then
|
||||||
@@ -635,9 +635,9 @@ function create_frames()
|
|||||||
execute()
|
execute()
|
||||||
elseif button == 'RightButton' then
|
elseif button == 'RightButton' then
|
||||||
if st == recent_searches_listing then
|
if st == recent_searches_listing then
|
||||||
tinsert(_G.aux_favorite_searches, 1, data.search)
|
tinsert(aux_favorite_searches, 1, data.search)
|
||||||
elseif st == favorite_searches_listing then
|
elseif st == favorite_searches_listing then
|
||||||
tremove(_G.aux_favorite_searches, data.index)
|
tremove(aux_favorite_searches, data.index)
|
||||||
end
|
end
|
||||||
update_search_listings()
|
update_search_listings()
|
||||||
end
|
end
|
||||||
@@ -654,16 +654,16 @@ function create_frames()
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
|
private.recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
|
||||||
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
|
recent_searches_listing:SetColInfo{{ name='Recent Searches', width=1 }}
|
||||||
recent_searches_listing:EnableSorting(false)
|
recent_searches_listing:EnableSorting(false)
|
||||||
recent_searches_listing:DisableSelection(true)
|
recent_searches_listing:DisableSelection(true)
|
||||||
recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
|
recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
|
||||||
recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
|
recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
|
||||||
recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
|
recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
|
||||||
|
|
||||||
favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite)
|
private.favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite)
|
||||||
favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}}
|
favorite_searches_listing:SetColInfo{{ name='Favorite Searches', width=1 }}
|
||||||
favorite_searches_listing:EnableSorting(false)
|
favorite_searches_listing:EnableSorting(false)
|
||||||
favorite_searches_listing:DisableSelection(true)
|
favorite_searches_listing:DisableSelection(true)
|
||||||
favorite_searches_listing:SetHandler('OnClick', handlers.OnClick)
|
favorite_searches_listing:SetHandler('OnClick', handlers.OnClick)
|
||||||
|
|||||||
+21
-21
@@ -1,6 +1,6 @@
|
|||||||
aux 'search_tab' local info, scan = aux.info, aux.scan
|
aux 'search_tab' local info, scan = aux.info, aux.scan
|
||||||
|
|
||||||
_G.aux_auto_buy_filter = ''
|
aux_auto_buy_filter = ''
|
||||||
|
|
||||||
do
|
do
|
||||||
local id = 0
|
local id = 0
|
||||||
@@ -19,7 +19,7 @@ do
|
|||||||
|
|
||||||
function private.current_search.get() return searches[search_index] end
|
function private.current_search.get() return searches[search_index] end
|
||||||
|
|
||||||
function update_search(index)
|
function private.update_search(index)
|
||||||
searches[search_index].status_bar:Hide()
|
searches[search_index].status_bar:Hide()
|
||||||
searches[search_index].table:Hide()
|
searches[search_index].table:Hide()
|
||||||
searches[search_index].table:SetSelectedRecord()
|
searches[search_index].table:SetSelectedRecord()
|
||||||
@@ -46,7 +46,7 @@ do
|
|||||||
update_continuation()
|
update_continuation()
|
||||||
end
|
end
|
||||||
|
|
||||||
function new_search(filter_string)
|
function private.new_search(filter_string)
|
||||||
while getn(searches) > search_index do
|
while getn(searches) > search_index do
|
||||||
tremove(searches)
|
tremove(searches)
|
||||||
end
|
end
|
||||||
@@ -71,26 +71,26 @@ do
|
|||||||
update_search(getn(searches))
|
update_search(getn(searches))
|
||||||
end
|
end
|
||||||
|
|
||||||
function previous_search()
|
function private.previous_search()
|
||||||
search_box:ClearFocus()
|
search_box:ClearFocus()
|
||||||
update_search(search_index - 1)
|
update_search(search_index - 1)
|
||||||
subtab = RESULTS
|
subtab = RESULTS
|
||||||
end
|
end
|
||||||
|
|
||||||
function next_search()
|
function private.next_search()
|
||||||
search_box:ClearFocus()
|
search_box:ClearFocus()
|
||||||
update_search(search_index + 1)
|
update_search(search_index + 1)
|
||||||
subtab = RESULTS
|
subtab = RESULTS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function close_settings()
|
function private.close_settings()
|
||||||
if settings_button.open then
|
if settings_button.open then
|
||||||
settings_button:Click()
|
settings_button:Click()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_continuation()
|
function private.update_continuation()
|
||||||
if current_search.continuation then
|
if current_search.continuation then
|
||||||
resume_button:Show()
|
resume_button:Show()
|
||||||
search_box:SetPoint('RIGHT', resume_button, 'LEFT', -4, 0)
|
search_box:SetPoint('RIGHT', resume_button, 'LEFT', -4, 0)
|
||||||
@@ -100,7 +100,7 @@ function update_continuation()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function discard_continuation()
|
function private.discard_continuation()
|
||||||
scan.abort(search_scan_id)
|
scan.abort(search_scan_id)
|
||||||
current_search.continuation = nil
|
current_search.continuation = nil
|
||||||
update_continuation()
|
update_continuation()
|
||||||
@@ -116,9 +116,9 @@ function update_start_stop()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_auto_buy_filter()
|
function private.update_auto_buy_filter()
|
||||||
if _G.aux_auto_buy_filter ~= '' then
|
if aux_auto_buy_filter ~= '' then
|
||||||
local queries, error = aux.filter_util.queries(_G.aux_auto_buy_filter)
|
local queries, error = aux.filter_util.queries(aux_auto_buy_filter)
|
||||||
if queries then
|
if queries then
|
||||||
if getn(queries) > 1 then
|
if getn(queries) > 1 then
|
||||||
print 'Error: The automatic buyout filter does not support multi-queries'
|
print 'Error: The automatic buyout filter does not support multi-queries'
|
||||||
@@ -134,10 +134,10 @@ function update_auto_buy_filter()
|
|||||||
print('Invalid auto buy filter:', error)
|
print('Invalid auto buy filter:', error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
_G.aux_auto_buy_filter = ''
|
aux_auto_buy_filter = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
function start_real_time_scan(query, search, continuation)
|
function private.start_real_time_scan(query, search, continuation)
|
||||||
|
|
||||||
local ignore_page
|
local ignore_page
|
||||||
if not search then
|
if not search then
|
||||||
@@ -167,7 +167,7 @@ function start_real_time_scan(query, search, continuation)
|
|||||||
if not ignore_page then
|
if not ignore_page then
|
||||||
if search.auto_buy then
|
if search.auto_buy then
|
||||||
ctrl.suspend()
|
ctrl.suspend()
|
||||||
place_bid('list', auction_record.index, auction_record.buyout_price, partial(ctrl.resume, true))
|
place_bid('list', auction_record.index, auction_record.buyout_price, papply(ctrl.resume, true))
|
||||||
thread(when, later(GetTime(), 10), ctrl.resume, false)
|
thread(when, later(GetTime(), 10), ctrl.resume, false)
|
||||||
else
|
else
|
||||||
tinsert(new_records, auction_record)
|
tinsert(new_records, auction_record)
|
||||||
@@ -211,7 +211,7 @@ function start_real_time_scan(query, search, continuation)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function start_search(queries, continuation)
|
function private.start_search(queries, continuation)
|
||||||
local current_query, current_page, total_queries, start_query, start_page
|
local current_query, current_page, total_queries, start_query, start_page
|
||||||
|
|
||||||
local search = current_search
|
local search = current_search
|
||||||
@@ -260,7 +260,7 @@ function start_search(queries, continuation)
|
|||||||
on_auction = function(auction_record, ctrl)
|
on_auction = function(auction_record, ctrl)
|
||||||
if search.auto_buy then
|
if search.auto_buy then
|
||||||
ctrl.suspend()
|
ctrl.suspend()
|
||||||
place_bid('list', auction_record.index, auction_record.buyout_price, partial(ctrl.resume, true))
|
place_bid('list', auction_record.index, auction_record.buyout_price, papply(ctrl.resume, true))
|
||||||
thread(when, later(GetTime(), 10), ctrl.resume, false)
|
thread(when, later(GetTime(), 10), ctrl.resume, false)
|
||||||
elseif getn(search.records) < 1000 then
|
elseif getn(search.records) < 1000 then
|
||||||
tinsert(search.records, auction_record)
|
tinsert(search.records, auction_record)
|
||||||
@@ -368,7 +368,7 @@ function public.execute(resume, real_time)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function test(record)
|
function private.test(record)
|
||||||
return function(index)
|
return function(index)
|
||||||
local auction_info = info.auction(index)
|
local auction_info = info.auction(index)
|
||||||
return auction_info and auction_info.search_signature == record.search_signature
|
return auction_info and auction_info.search_signature == record.search_signature
|
||||||
@@ -381,7 +381,7 @@ do
|
|||||||
local state = IDLE
|
local state = IDLE
|
||||||
local found_index
|
local found_index
|
||||||
|
|
||||||
function find_auction(record)
|
function private.find_auction(record)
|
||||||
local search = current_search
|
local search = current_search
|
||||||
|
|
||||||
if not search.table:ContainsRecord(record) or is_player(record.owner) then
|
if not search.table:ContainsRecord(record) or is_player(record.owner) then
|
||||||
@@ -414,7 +414,7 @@ do
|
|||||||
place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||||
info.bid_update(record)
|
info.bid_update(record)
|
||||||
search.table:SetDatabase()
|
search.table:SetDatabase()
|
||||||
end or partial(search.table.RemoveAuctionRecord, search.table, record))
|
end or papply(search.table.RemoveAuctionRecord, search.table, record))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
bid_button:Enable()
|
bid_button:Enable()
|
||||||
@@ -423,7 +423,7 @@ do
|
|||||||
if record.buyout_price > 0 then
|
if record.buyout_price > 0 then
|
||||||
buyout_button:SetScript('OnClick', function()
|
buyout_button:SetScript('OnClick', function()
|
||||||
if test(record)(index) and search.table:ContainsRecord(record) then
|
if test(record)(index) and search.table:ContainsRecord(record) then
|
||||||
place_bid('list', index, record.buyout_price, partial(search.table.RemoveAuctionRecord, search.table, record))
|
place_bid('list', index, record.buyout_price, papply(search.table.RemoveAuctionRecord, search.table, record))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
buyout_button:Enable()
|
buyout_button:Enable()
|
||||||
@@ -432,7 +432,7 @@ do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_update()
|
function private.on_update()
|
||||||
if state == IDLE or state == SEARCHING then
|
if state == IDLE or state == SEARCHING then
|
||||||
buyout_button:Disable()
|
buyout_button:Disable()
|
||||||
bid_button:Disable()
|
bid_button:Disable()
|
||||||
|
|||||||
+10
-10
@@ -1,14 +1,14 @@
|
|||||||
aux 'search_tab'
|
aux 'search_tab'
|
||||||
|
|
||||||
_G.aux_favorite_searches = t
|
aux_favorite_searches = t
|
||||||
_G.aux_recent_searches = t
|
aux_recent_searches = t
|
||||||
|
|
||||||
function update_search_listings()
|
function private.update_search_listings()
|
||||||
local favorite_search_rows = t
|
local favorite_search_rows = t
|
||||||
for i, favorite_search in _G.aux_favorite_searches do
|
for i, favorite_search in aux_favorite_searches do
|
||||||
local name = strsub(favorite_search.prettified, 1, 250)
|
local name = strsub(favorite_search.prettified, 1, 250)
|
||||||
tinsert(favorite_search_rows, {
|
tinsert(favorite_search_rows, {
|
||||||
cols = {{value=name}},
|
cols = {{ value=name }},
|
||||||
search = favorite_search,
|
search = favorite_search,
|
||||||
index = i,
|
index = i,
|
||||||
})
|
})
|
||||||
@@ -16,7 +16,7 @@ function update_search_listings()
|
|||||||
favorite_searches_listing:SetData(favorite_search_rows)
|
favorite_searches_listing:SetData(favorite_search_rows)
|
||||||
|
|
||||||
local recent_search_rows = t
|
local recent_search_rows = t
|
||||||
for i, recent_search in _G.aux_recent_searches do
|
for i, recent_search in aux_recent_searches do
|
||||||
local name = strsub(recent_search.prettified, 1, 250)
|
local name = strsub(recent_search.prettified, 1, 250)
|
||||||
tinsert(recent_search_rows, {
|
tinsert(recent_search_rows, {
|
||||||
cols = {{ value=name }},
|
cols = {{ value=name }},
|
||||||
@@ -27,13 +27,13 @@ function update_search_listings()
|
|||||||
recent_searches_listing:SetData(recent_search_rows)
|
recent_searches_listing:SetData(recent_search_rows)
|
||||||
end
|
end
|
||||||
|
|
||||||
function new_recent_search(filter_string, prettified)
|
function private.new_recent_search(filter_string, prettified)
|
||||||
tinsert(_G.aux_recent_searches, 1, {
|
tinsert(aux_recent_searches, 1, {
|
||||||
filter_string = filter_string,
|
filter_string = filter_string,
|
||||||
prettified = prettified,
|
prettified = prettified,
|
||||||
})
|
})
|
||||||
while getn(_G.aux_recent_searches) > 50 do
|
while getn(aux_recent_searches) > 50 do
|
||||||
tremove(_G.aux_recent_searches)
|
tremove(aux_recent_searches)
|
||||||
end
|
end
|
||||||
update_search_listings()
|
update_search_listings()
|
||||||
end
|
end
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
aux 'core'
|
aux 'core'
|
||||||
|
|
||||||
COLORS = {
|
local COLORS = {
|
||||||
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
|
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
|
||||||
label = {enabled = {216, 225, 211, 1}, disabled = {150, 148, 140, 1}},
|
label = {enabled = {216, 225, 211, 1}, disabled = {150, 148, 140, 1}},
|
||||||
link = {153, 255, 255, 1},
|
link = {153, 255, 255, 1},
|
||||||
@@ -31,9 +31,9 @@ do
|
|||||||
return self.private.callback(color)
|
return self.private.callback(color)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function color_accessor(callback)
|
function private.color_accessor(callback)
|
||||||
return function()
|
return function()
|
||||||
return index_function({callback=callback, table=COLORS}, index_handler)
|
return index_function({ callback=callback, table=COLORS }, index_handler)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-2
@@ -67,7 +67,7 @@ function public.vararg.select(arg)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
public.join = _G.table.concat
|
public.join = table.concat
|
||||||
|
|
||||||
function public.range(arg1, arg2)
|
function public.range(arg1, arg2)
|
||||||
local i, n = arg2 and arg1 or 1, arg2 or arg1
|
local i, n = arg2 and arg1 or 1, arg2 or arg1
|
||||||
@@ -91,7 +91,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.vararg.partial(arg)
|
function public.vararg.papply(arg)
|
||||||
local f, arg1 = tremove(arg, 1), perm-arg
|
local f, arg1 = tremove(arg, 1), perm-arg
|
||||||
return vararg(function(arg)
|
return vararg(function(arg)
|
||||||
for i = 1, getn(arg) do
|
for i = 1, getn(arg) do
|
||||||
|
|||||||
+12
-12
@@ -1,6 +1,6 @@
|
|||||||
aux 'filter_util' local info = aux.info
|
aux 'filter_util' local info = aux.info
|
||||||
|
|
||||||
function default_filter(str)
|
function private.default_filter(str)
|
||||||
return {
|
return {
|
||||||
input_type = '',
|
input_type = '',
|
||||||
validator = function()
|
validator = function()
|
||||||
@@ -200,7 +200,7 @@ public.filters = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function operator(str)
|
function private.operator(str)
|
||||||
local operator = str == 'not' and A('operator', 'not', 1)
|
local operator = str == 'not' and A('operator', 'not', 1)
|
||||||
for name in temp-S('and', 'or') do
|
for name in temp-S('and', 'or') do
|
||||||
for arity in present(select(3, strfind(str, '^' .. name .. '(%d*)$'))) do
|
for arity in present(select(3, strfind(str, '^' .. name .. '(%d*)$'))) do
|
||||||
@@ -231,8 +231,8 @@ do
|
|||||||
end
|
end
|
||||||
for _, parser in temp-A(
|
for _, parser in temp-A(
|
||||||
temp-A('class', info.item_class_index),
|
temp-A('class', info.item_class_index),
|
||||||
temp-A('subclass', partial(info.item_subclass_index, index(self.class, 2) or 0)),
|
temp-A('subclass', papply(info.item_subclass_index, index(self.class, 2) or 0)),
|
||||||
temp-A('slot', partial(info.item_slot_index, index(self.class, 2) or 0, index(self.subclass, 2) or 0)),
|
temp-A('slot', papply(info.item_slot_index, index(self.class, 2) or 0, index(self.subclass, 2) or 0)),
|
||||||
temp-A('quality', info.item_quality_index)
|
temp-A('quality', info.item_quality_index)
|
||||||
) do
|
) do
|
||||||
if not self[parser[1]] then
|
if not self[parser[1]] then
|
||||||
@@ -254,12 +254,12 @@ do
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
function blizzard_filter_parser()
|
function private.blizzard_filter_parser()
|
||||||
return setmetatable(t, mt)
|
return setmetatable(t, mt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function parse_parameter(input_type, str)
|
function private.parse_parameter(input_type, str)
|
||||||
if input_type == 'money' then
|
if input_type == 'money' then
|
||||||
local money = aux.money.from_string(str)
|
local money = aux.money.from_string(str)
|
||||||
return money and money > 0 and money or nil
|
return money and money > 0 and money or nil
|
||||||
@@ -290,7 +290,7 @@ function public.parse_filter_string(str)
|
|||||||
if input_type ~= '' then
|
if input_type ~= '' then
|
||||||
if not parts[i + 1] or not parse_parameter(input_type, parts[i + 1]) then
|
if not parts[i + 1] or not parse_parameter(input_type, parts[i + 1]) then
|
||||||
if parts[i] == 'item' then
|
if parts[i] == 'item' then
|
||||||
return nil, 'Invalid item name', _G.aux_auctionable_items
|
return nil, 'Invalid item name', aux_auctionable_items
|
||||||
elseif type(input_type) == 'table' then
|
elseif type(input_type) == 'table' then
|
||||||
return nil, 'Invalid choice for ' .. parts[i], input_type
|
return nil, 'Invalid choice for ' .. parts[i], input_type
|
||||||
else
|
else
|
||||||
@@ -370,7 +370,7 @@ function public.queries(filter_string)
|
|||||||
return queries
|
return queries
|
||||||
end
|
end
|
||||||
|
|
||||||
function suggestions(filter)
|
function private.suggestions(filter)
|
||||||
local suggestions = t
|
local suggestions = t
|
||||||
|
|
||||||
if filter.blizzard.name and size(filter.blizzard) == 1 then tinsert(suggestions, 'exact') end
|
if filter.blizzard.name and size(filter.blizzard) == 1 then tinsert(suggestions, 'exact') end
|
||||||
@@ -408,7 +408,7 @@ function suggestions(filter)
|
|||||||
|
|
||||||
-- item names
|
-- item names
|
||||||
if getn(filter.components) == 0 then
|
if getn(filter.components) == 0 then
|
||||||
for _, name in _G.aux_auctionable_items do
|
for _, name in aux_auctionable_items do
|
||||||
tinsert(suggestions, name .. '/exact')
|
tinsert(suggestions, name .. '/exact')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -438,7 +438,7 @@ function public.filter_string(components)
|
|||||||
return query_builder.get()
|
return query_builder.get()
|
||||||
end
|
end
|
||||||
|
|
||||||
function prettified_filter_string(filter)
|
function private.prettified_filter_string(filter)
|
||||||
local prettified = query_builder()
|
local prettified = query_builder()
|
||||||
|
|
||||||
for _, component in filter.components do
|
for _, component in filter.components do
|
||||||
@@ -486,7 +486,7 @@ function public.unquote(name)
|
|||||||
return select(3, strfind(name, '^<(.*)>$')) or name
|
return select(3, strfind(name, '^<(.*)>$')) or name
|
||||||
end
|
end
|
||||||
|
|
||||||
function blizzard_query(filter)
|
function private.blizzard_query(filter)
|
||||||
local filters = filter.blizzard
|
local filters = filter.blizzard
|
||||||
local query = T('name', filters.name and filters.name[2])
|
local query = T('name', filters.name and filters.name[2])
|
||||||
local item_info, class_index, subclass_index, slot_index
|
local item_info, class_index, subclass_index, slot_index
|
||||||
@@ -514,7 +514,7 @@ function blizzard_query(filter)
|
|||||||
return query
|
return query
|
||||||
end
|
end
|
||||||
|
|
||||||
function validator(filter)
|
function private.validator(filter)
|
||||||
|
|
||||||
local validators = t
|
local validators = t
|
||||||
for i, component in filter.post do
|
for i, component in filter.post do
|
||||||
|
|||||||
+4
-4
@@ -120,8 +120,8 @@ function public.auction(index, query_type)
|
|||||||
'link', link,
|
'link', link,
|
||||||
'itemstring', item_info.itemstring,
|
'itemstring', item_info.itemstring,
|
||||||
'item_key', item_id .. ':' .. suffix_id,
|
'item_key', item_id .. ':' .. suffix_id,
|
||||||
'search_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), _G.aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
'search_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
||||||
'sniping_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, _G.aux_ignore_owner and (is_player(owner, true) and 0 or 1) or (owner or '?')), ':'),
|
'sniping_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (is_player(owner, true) and 0 or 1) or (owner or '?')), ':'),
|
||||||
|
|
||||||
'name', name,
|
'name', name,
|
||||||
'texture', texture,
|
'texture', texture,
|
||||||
@@ -165,7 +165,7 @@ function public.bid_update(auction_record)
|
|||||||
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
|
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
|
||||||
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
|
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
|
||||||
auction_record.high_bidder = 1
|
auction_record.high_bidder = 1
|
||||||
auction_record.search_signature = join(temp-A(auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, _G.aux_ignore_owner and (is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')), ':')
|
auction_record.search_signature = join(temp-A(auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')), ':')
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.set_tooltip(itemstring, owner, anchor)
|
function public.set_tooltip(itemstring, owner, anchor)
|
||||||
@@ -283,7 +283,7 @@ function public.tooltip(setter)
|
|||||||
return tooltip, AuxTooltip.money
|
return tooltip, AuxTooltip.money
|
||||||
end
|
end
|
||||||
|
|
||||||
function item_charges(tooltip)
|
function private.item_charges(tooltip)
|
||||||
for _, line in tooltip do
|
for _, line in tooltip do
|
||||||
local pattern = '^' .. gsub(gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)') .. '$'
|
local pattern = '^' .. gsub(gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)') .. '$'
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@ public.GOLD_TEXT = '|cffffd70ag|r'
|
|||||||
public.SILVER_TEXT = '|cffc7c7cfs|r'
|
public.SILVER_TEXT = '|cffc7c7cfs|r'
|
||||||
public.COPPER_TEXT = '|cffeda55fc|r'
|
public.COPPER_TEXT = '|cffeda55fc|r'
|
||||||
|
|
||||||
COPPER_PER_GOLD = 10000
|
local COPPER_PER_GOLD = 10000
|
||||||
COPPER_PER_SILVER = 100
|
local COPPER_PER_SILVER = 100
|
||||||
|
|
||||||
function public.to_gsc(money)
|
function public.to_gsc(money)
|
||||||
local gold = floor(money / COPPER_PER_GOLD)
|
local gold = floor(money / COPPER_PER_GOLD)
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
aux 'persistence'
|
aux 'persistence'
|
||||||
|
|
||||||
_G.aux_datasets = t
|
aux_datasets = t
|
||||||
|
|
||||||
do
|
do
|
||||||
local dataset
|
local dataset
|
||||||
function public.dataset.get()
|
function public.dataset.get()
|
||||||
if not dataset then
|
if not dataset then
|
||||||
local dataset_key = format('%s|%s', GetCVar 'realmName', UnitFactionGroup 'player')
|
local dataset_key = format('%s|%s', GetCVar 'realmName', UnitFactionGroup 'player')
|
||||||
dataset = _G.aux_datasets[dataset_key] or t
|
dataset = aux_datasets[dataset_key] or t
|
||||||
_G.aux_datasets[dataset_key] = dataset
|
aux_datasets[dataset_key] = dataset
|
||||||
end
|
end
|
||||||
return dataset
|
return dataset
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user