big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-19 11:57:12 +02:00
parent 667990f7d8
commit 7740ba2f7a
28 changed files with 271 additions and 266 deletions
+13 -13
View File
@@ -1,10 +1,10 @@
aux.module 'cache' aux.module 'cache'
private.MIN_ITEM_ID = 1 MIN_ITEM_ID = 1
private.MAX_ITEM_ID = 30000 MAX_ITEM_ID = 30000
private.items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}} items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
private.merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} } merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} }
_G.aux_items = {} _G.aux_items = {}
_G.aux_item_ids = {} _G.aux_item_ids = {}
@@ -35,29 +35,29 @@ end
do do
local sell_scan_countdown, incomplete_buy_data local sell_scan_countdown, incomplete_buy_data
function private.on_merchant_show() function on_merchant_show()
m.merchant_sell_scan() m.merchant_sell_scan()
incomplete_buy_data = not m.merchant_buy_scan() incomplete_buy_data = not m.merchant_buy_scan()
end end
function private.on_merchant_closed() function on_merchant_closed()
sell_scan_countdown = nil sell_scan_countdown = nil
incomplete_buy_data = false incomplete_buy_data = false
end end
function private.on_merchant_update() function on_merchant_update()
if incomplete_buy_data then if incomplete_buy_data then
incomplete_buy_data = not m.merchant_buy_scan() incomplete_buy_data = not m.merchant_buy_scan()
end end
end end
function private.on_bag_update() function on_bag_update()
if MerchantFrame:IsVisible() then if MerchantFrame:IsVisible() then
sell_scan_countdown = 10 sell_scan_countdown = 10
end end
end end
function private.merchant_on_update() function merchant_on_update()
if sell_scan_countdown == 0 then if sell_scan_countdown == 0 then
sell_scan_countdown = nil sell_scan_countdown = nil
m.merchant_sell_scan() m.merchant_sell_scan()
@@ -67,7 +67,7 @@ do
end end
end end
function private.merchant_loaded() function 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
@@ -107,7 +107,7 @@ function public.item_id(item_name)
return _G.aux_item_ids[strlower(item_name)] return _G.aux_item_ids[strlower(item_name)]
end end
function private.merchant_buy_scan() function merchant_buy_scan()
local incomplete_data local incomplete_data
for i=1,GetMerchantNumItems() do for i=1,GetMerchantNumItems() do
@@ -146,7 +146,7 @@ function private.merchant_buy_scan()
return not incomplete_data return not incomplete_data
end end
function private.merchant_sell_scan() function merchant_sell_scan()
for slot in aux.util.inventory() do for slot in aux.util.inventory() do
local item_info = aux.info.container_item(unpack(slot)) local item_info = aux.info.container_item(unpack(slot))
if item_info then if item_info then
@@ -155,7 +155,7 @@ function private.merchant_sell_scan()
end end
end end
function private.scan_wdb(item_id) function scan_wdb(item_id)
item_id = item_id or m.MIN_ITEM_ID item_id = item_id or m.MIN_ITEM_ID
local processed = 0 local processed = 0
+5 -5
View File
@@ -1,8 +1,8 @@
aux.module 'disenchant' aux.module 'disenchant'
private.UNCOMMON = 2 UNCOMMON = 2
private.RARE = 3 RARE = 3
private.EPIC = 4 EPIC = 4
do do
local data = { local data = {
@@ -41,7 +41,7 @@ do
end end
function m.LOAD() function m.LOAD()
private.armor = aux.util.set( armor = aux.util.set(
'INVTYPE_HEAD', 'INVTYPE_HEAD',
'INVTYPE_NECK', 'INVTYPE_NECK',
'INVTYPE_SHOULDER', 'INVTYPE_SHOULDER',
@@ -59,7 +59,7 @@ function m.LOAD()
'INVTYPE_HOLDABLE' 'INVTYPE_HOLDABLE'
) )
private.weapon = aux.util.set( weapon = aux.util.set(
'INVTYPE_2HWEAPON' , 'INVTYPE_2HWEAPON' ,
'INVTYPE_WEAPONMAINHAND', 'INVTYPE_WEAPONMAINHAND',
'INVTYPE_WEAPON', 'INVTYPE_WEAPON',
+9 -9
View File
@@ -1,25 +1,25 @@
aux.module 'history' aux.module 'history'
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'}}}}}
private.value_cache = {} value_cache = {}
function private.next_push() function next_push()
local date = date('*t') local date = date('*t')
date.hour, date.min, date.sec = 24, 0, 0 date.hour, date.min, date.sec = 24, 0, 0
return time(date) return time(date)
end end
function private.new_record() function new_record()
return { next_push = m.next_push(), data_points = {} } return { next_push = m.next_push(), data_points = {} }
end end
function private.load_data() function load_data()
local dataset = aux.persistence.load_dataset() local dataset = aux.persistence.load_dataset()
dataset.history = dataset.history or {} dataset.history = dataset.history or {}
return dataset.history return dataset.history
end end
function private.read_record(item_key) function read_record(item_key)
local data = m.load_data() local data = m.load_data()
local record local record
@@ -37,7 +37,7 @@ function private.read_record(item_key)
return record return record
end end
function private.write_record(item_key, record) function write_record(item_key, record)
m.value_cache[item_key] = nil m.value_cache[item_key] = nil
local data = m.load_data() local data = m.load_data()
data[item_key] = aux.persistence.write(history_schema, record) data[item_key] = aux.persistence.write(history_schema, record)
@@ -96,11 +96,11 @@ function public.market_value(item_key)
return m.calculate_market_value(item_record) return m.calculate_market_value(item_record)
end end
function private.calculate_market_value(item_record) 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 private.weighted_median(list) function weighted_median(list)
local sorted_list = {} local sorted_list = {}
for _, e in list do for _, e in list do
tinsert(sorted_list, e) tinsert(sorted_list, e)
@@ -116,7 +116,7 @@ function private.weighted_median(list)
end end
end end
function private.push_record(item_record) function push_record(item_record)
local market_value = m.calculate_market_value(item_record) local market_value = m.calculate_market_value(item_record)
if market_value then if market_value then
+3 -3
View File
@@ -1,8 +1,8 @@
aux.module 'post' aux.module 'post'
private.state = nil state = nil
function private.process() function process()
if m.state.posted < m.state.count then if m.state.posted < m.state.count then
local stacking_complete local stacking_complete
@@ -23,7 +23,7 @@ function private.process()
return m.stop() return m.stop()
end end
function private.post_auction(slot, k) function 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 == m.state.item_key and aux.info.auctionable(item_info.tooltip) and item_info.aux_quantity == m.state.stack_size then if item_info.item_key == m.state.item_key and aux.info.auctionable(item_info.tooltip) and item_info.aux_quantity == m.state.stack_size then
+15 -15
View File
@@ -1,6 +1,6 @@
aux.module 'scan' aux.module 'scan'
private.PAGE_SIZE = 50 PAGE_SIZE = 50
do do
local scan_states = {} local scan_states = {}
@@ -31,23 +31,23 @@ do
end end
end end
function private.complete() function complete()
local on_complete = m.state.params.on_complete local on_complete = m.state.params.on_complete
scan_states[m.state.params.type] = nil scan_states[m.state.params.type] = nil
aux.call(on_complete) aux.call(on_complete)
end end
private.state = aux.dynamic_table(scan_states, function(self) state = aux.dynamic_table(scan_states, function(self)
local _, state = next(aux.util.filter(self.private, function(state) return state.id == aux.control.thread_id end)) local _, state = next(aux.util.filter(self.private, function(state) return state.id == aux.control.thread_id end))
return state return state
end) end)
end end
private.query = aux.dynamic_table(nil, function() query = aux.dynamic_table(nil, function()
return m.state.params.queries[m.state.query_index] return m.state.params.queries[m.state.query_index]
end) end)
function private.wait_for_callback(...) function wait_for_callback(...)
local send_signal, signal_received = aux.util.signal() local send_signal, signal_received = aux.util.signal()
local suspended local suspended
local ret local ret
@@ -69,17 +69,17 @@ function private.wait_for_callback(...)
return aux.control.when(signal_received, function() return k(unpack(signal_received())) end) return aux.control.when(signal_received, function() return k(unpack(signal_received())) end)
end end
function private.total_pages(total_auctions) function total_pages(total_auctions)
return ceil(total_auctions / m.PAGE_SIZE) return ceil(total_auctions / m.PAGE_SIZE)
end end
function private.last_page(total_auctions) function last_page(total_auctions)
local last_page = max(m.total_pages(total_auctions) - 1, 0) local last_page = max(m.total_pages(total_auctions) - 1, 0)
local last_page_limit = m.query.blizzard_query and m.query.blizzard_query.last_page or last_page local last_page_limit = m.query.blizzard_query and m.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 private.scan() function scan()
m.state.query_index = m.state.query_index and m.state.query_index + 1 or 1 m.state.query_index = m.state.query_index and m.state.query_index + 1 or 1
if m.query() and (aux.index(m.query.blizzard_query, 'first_page') or 0) <= (aux.index(m.query.blizzard_query, 'last_page') or aux.huge) then if m.query() and (aux.index(m.query.blizzard_query, 'first_page') or 0) <= (aux.index(m.query.blizzard_query, 'last_page') or aux.huge) then
if m.query.blizzard_query then if m.query.blizzard_query then
@@ -93,7 +93,7 @@ function private.scan()
end end
end end
function private.process_query() function process_query()
if m.query.blizzard_query then if m.query.blizzard_query then
return m.submit_query() return m.submit_query()
else else
@@ -101,7 +101,7 @@ function private.process_query()
end end
end end
function private.submit_query() function submit_query()
aux.control.when(function() return m.state.params.type ~= 'list' or CanSendAuctionQuery() end, function() aux.control.when(function() return m.state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
aux.call(m.state.params.on_submit_query) aux.call(m.state.params.on_submit_query)
m.state.last_query_time = GetTime() m.state.last_query_time = GetTime()
@@ -127,7 +127,7 @@ function private.submit_query()
end) end)
end end
function private.scan_page(i) function scan_page(i)
i = i or 1 i = i or 1
local recurse = function(retry) local recurse = function(retry)
if i >= m.PAGE_SIZE then if i >= m.PAGE_SIZE then
@@ -172,7 +172,7 @@ function private.scan_page(i)
return recurse() return recurse()
end end
function private.wait_for_results() function wait_for_results()
local timeout = aux.util.later(m.state.last_query_time, 10) local timeout = aux.util.later(m.state.last_query_time, 10)
local send_signal, signal_received = aux.util.signal() local send_signal, signal_received = aux.util.signal()
aux.control.when(signal_received, function() aux.control.when(signal_received, function()
@@ -201,7 +201,7 @@ function private.wait_for_results()
end end
end end
function private.wait_for_owner_results(send_signal) function wait_for_owner_results(send_signal)
if m.state.page == aux.current_owner_page then if m.state.page == aux.current_owner_page then
return send_signal() return send_signal()
else else
@@ -209,7 +209,7 @@ function private.wait_for_owner_results(send_signal)
end end
end end
function private.wait_for_list_results(send_signal, signal_received) function wait_for_list_results(send_signal, signal_received)
local updated, last_update local updated, last_update
aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill) aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill)
kill(signal_received()) kill(signal_received())
@@ -225,7 +225,7 @@ function private.wait_for_list_results(send_signal, signal_received)
end, send_signal) end, send_signal)
end end
function private.owner_data_complete(type) function owner_data_complete(type)
for i=1,m.PAGE_SIZE do for i=1,m.PAGE_SIZE do
local auction_info = aux.info.auction(i, type) local auction_info = aux.info.auction(i, type)
if auction_info and not auction_info.owner then if auction_info and not auction_info.owner then
+11 -11
View File
@@ -1,28 +1,28 @@
aux.module 'stack' aux.module 'stack'
private.state = nil state = nil
function private.stack_size(slot) function stack_size(slot)
local container_item_info = aux.info.container_item(unpack(slot)) local container_item_info = aux.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 private.charges(slot) function charges(slot)
local container_item_info = aux.info.container_item(unpack(slot)) local container_item_info = aux.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 private.max_stack(slot) function max_stack(slot)
local container_item_info = aux.info.container_item(unpack(slot)) local container_item_info = aux.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 private.locked(slot) function locked(slot)
local container_item_info = aux.info.container_item(unpack(slot)) local container_item_info = aux.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 private.find_item_slot(partial) function find_item_slot(partial)
for slot in aux.util.inventory() do for slot in aux.util.inventory() do
if m.matching_item(slot, partial) and not aux.util.eq(slot, m.state.target_slot) then if m.matching_item(slot, partial) and not aux.util.eq(slot, m.state.target_slot) then
return slot return slot
@@ -30,12 +30,12 @@ function private.find_item_slot(partial)
end end
end end
function private.matching_item(slot, partial) function matching_item(slot, partial)
local item_info = aux.info.container_item(unpack(slot)) local item_info = aux.info.container_item(unpack(slot))
return item_info and item_info.item_key == m.state.item_key and aux.info.auctionable(item_info.tooltip) and (not partial or item_info.count < item_info.max_stack) return item_info and item_info.item_key == m.state.item_key and aux.info.auctionable(item_info.tooltip) and (not partial or item_info.count < item_info.max_stack)
end end
function private.find_empty_slot() function find_empty_slot()
for slot, type in aux.util.inventory() do for slot, type in aux.util.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 private.find_empty_slot()
end end
end end
function private.find_charge_item_slot() function find_charge_item_slot()
for slot in aux.util.inventory() do for slot in aux.util.inventory() do
if m.matching_item(slot) and m.charges(slot) == m.state.target_size then if m.matching_item(slot) and m.charges(slot) == m.state.target_size then
return slot return slot
@@ -51,7 +51,7 @@ function private.find_charge_item_slot()
end end
end end
function private.move_item(from_slot, to_slot, amount, k) function move_item(from_slot, to_slot, amount, k)
if m.locked(from_slot) or m.locked(to_slot) then if m.locked(from_slot) or m.locked(to_slot) then
return aux.control.wait(k) return aux.control.wait(k)
end end
@@ -66,7 +66,7 @@ function private.move_item(from_slot, to_slot, amount, k)
return aux.control.when(function() return m.stack_size(to_slot) == expected_size end, k) return aux.control.when(function() return m.stack_size(to_slot) == expected_size end, k)
end end
function private.process() function process()
if not m.state.target_slot or not m.matching_item(m.state.target_slot) then if not m.state.target_slot or not m.matching_item(m.state.target_slot) then
m.state.target_slot = m.find_item_slot() m.state.target_slot = m.find_item_slot()
+4 -4
View File
@@ -2,9 +2,9 @@ aux.module 'tooltip'
_G.aux_tooltip_value = true _G.aux_tooltip_value = true
private.game_tooltip_hooks = {} game_tooltip_hooks = {}
private.hooked_setter = nil hooked_setter = nil
private.game_tooltip_money = nil game_tooltip_money = nil
function m.LOAD() function m.LOAD()
for func, hook in m.game_tooltip_hooks do for func, hook in m.game_tooltip_hooks do
@@ -43,7 +43,7 @@ function m.LOAD()
end) end)
end end
function private.extend_tooltip(tooltip, link, quantity) function extend_tooltip(tooltip, link, quantity)
local item_id, suffix_id = aux.info.parse_link(link) local item_id, suffix_id = aux.info.parse_link(link)
quantity = IsShiftKeyDown() and quantity or 1 quantity = IsShiftKeyDown() and quantity or 1
+6 -6
View File
@@ -1,8 +1,8 @@
aux.module 'control' aux.module 'control'
private.event_frame = CreateFrame('Frame') event_frame = CreateFrame('Frame')
private.listeners = {} listeners = {}
private.threads = {} threads = {}
public.thread_id = nil public.thread_id = nil
function m.LOAD() function m.LOAD()
@@ -10,7 +10,7 @@ function m.LOAD()
m.event_frame:SetScript('OnEvent', m.EVENT) m.event_frame:SetScript('OnEvent', m.EVENT)
end end
function private.EVENT() function EVENT()
for _, listener in m.listeners do for _, listener in m.listeners do
if event == listener.event and not listener.killed then if event == listener.event and not listener.killed then
listener.cb(listener.kill) listener.cb(listener.kill)
@@ -18,7 +18,7 @@ function private.EVENT()
end end
end end
function private.UPDATE() function UPDATE()
for _, listener in m.listeners do for _, listener in m.listeners do
if not aux.util.any(m.listeners, function(l) return not l.killed and l.event == listener.event end) then if not aux.util.any(m.listeners, function(l) return not l.killed and l.event == listener.event end) then
m.event_frame:UnregisterEvent(listener.event) m.event_frame:UnregisterEvent(listener.event)
@@ -44,7 +44,7 @@ end
do do
local id = 0 local id = 0
function private.id() function id()
id = id + 1 id = id + 1
return id return id
end end
+12 -12
View File
@@ -45,7 +45,7 @@ function public.L(body_string)
return loadstring 'function()' return loadstring 'function()'
end end
private.tabs = {} tabs = {}
function public.tab(index, name) function public.tab(index, name)
local module_env = getfenv(2) local module_env = getfenv(2)
local tab = {name=name, env=module_env} local tab = {name=name, env=module_env}
@@ -53,16 +53,16 @@ function public.tab(index, name)
return tab == m.active_tab() return tab == m.active_tab()
end end
for _, handler in {'OPEN', 'CLOSE', 'CLICK_LINK', 'USE_ITEM'} do for _, handler in {'OPEN', 'CLOSE', 'CLICK_LINK', 'USE_ITEM'} do
module_env.private[handler] = nil module_env.mutable[handler] = nil
end end
m.tabs[index] = tab m.tabs[index] = tab
end end
do do
local active_tab_index local active_tab_index
private.active_tab = m.dynamic_table(nil, function() active_tab = m.dynamic_table(nil, function()
return m.tabs[active_tab_index] return m.tabs[active_tab_index]
end) end)
function private.on_tab_click(index) function on_tab_click(index)
if active_tab_index then if active_tab_index then
m.call(m.active_tab.env.m.CLOSE) m.call(m.active_tab.env.m.CLOSE)
end end
@@ -140,13 +140,13 @@ function public.VARIABLES_LOADED()
end end
end end
function private.AUCTION_HOUSE_SHOW() function AUCTION_HOUSE_SHOW()
AuctionFrame:Hide() AuctionFrame:Hide()
m.frame:Show() m.frame:Show()
m.set_tab(1) m.set_tab(1)
end end
function private.AUCTION_HOUSE_CLOSED() function AUCTION_HOUSE_CLOSED()
m.bids_loaded = false m.bids_loaded = false
m.current_owner_page = nil m.current_owner_page = nil
m.post.stop() m.post.stop()
@@ -156,11 +156,11 @@ function private.AUCTION_HOUSE_CLOSED()
m.frame:Hide() m.frame:Hide()
end end
function private.AUCTION_BIDDER_LIST_UPDATE() function AUCTION_BIDDER_LIST_UPDATE()
m.bids_loaded = true m.bids_loaded = true
end end
function private.AUCTION_OWNED_LIST_UPDATE() function AUCTION_OWNED_LIST_UPDATE()
m.current_owner_page = m.last_owner_page_requested or 0 m.current_owner_page = m.last_owner_page_requested or 0
end end
@@ -271,19 +271,19 @@ function public.hook(name, handler, object)
object[name] = handler object[name] = handler
end end
function private.GetOwnerAuctionItems(...) function GetOwnerAuctionItems(...)
local page = arg[1] local page = arg[1]
m.last_owner_page_requested = page m.last_owner_page_requested = page
return m.orig.GetOwnerAuctionItems(unpack(arg)) return m.orig.GetOwnerAuctionItems(unpack(arg))
end end
function private.AuctionFrameAuctions_OnEvent(...) function AuctionFrameAuctions_OnEvent(...)
if AuctionFrameAuctions:IsVisible() then if AuctionFrameAuctions:IsVisible() then
return m.orig.AuctionFrameAuctions_OnEvent(unpack(arg)) return m.orig.AuctionFrameAuctions_OnEvent(unpack(arg))
end end
end end
function private.SetItemRef(...) function SetItemRef(...)
if arg[3] ~= 'RightButton' or not m.index(m.active_tab(), 'env', 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then if arg[3] ~= 'RightButton' or not m.index(m.active_tab(), 'env', 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then
return m.orig.SetItemRef(unpack(arg)) return m.orig.SetItemRef(unpack(arg))
end end
@@ -292,7 +292,7 @@ function private.SetItemRef(...)
end end
end end
function private.UseContainerItem(...) function UseContainerItem(...)
if m.modified() or not m.index(m.active_tab(), 'env', 'USE_ITEM') then if m.modified() or not m.index(m.active_tab(), 'env', 'USE_ITEM') then
return m.orig.UseContainerItem(unpack(arg)) return m.orig.UseContainerItem(unpack(arg))
end end
+18 -13
View File
@@ -1,7 +1,7 @@
aux.module 'gui' aux.module 'gui'
public.config = { public.config = {
color = { 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,17 +31,22 @@ public.config = {
huge_font_size = 23, huge_font_size = 23,
} }
function private.color_accessor(callback) do
return aux.index_function({callback=callback, table=m.config.color}, function(self, key) local function index_handler(self, key)
self.private.table = self.private.table[key] self.private.table = self.private.table[key]
if getn(self.private.table) == 0 then if getn(self.private.table) == 0 then
return self.public return self.public
else else
local color = aux.util.copy(self.private.table) local color = aux.util.copy(self.private.table)
self.private.table = m.config.color self.private.table = config.colors
return callback(color) return self.private.callback(color)
end end
end) end
function color_accessor(callback)
return function()
return aux.index_function({callback=callback, table=config.colors}, index_handler)
end
end
end end
do do
@@ -55,13 +60,13 @@ do
end end
end end
} }
public.color = m.color_accessor(function(color) public.accessor.color = m.color_accessor(function(color)
local r, g, b, a = unpack(color) local r, g, b, a = unpack(color)
return setmetatable({r/255, g/255, b/255, a}, mt) return setmetatable({r/255, g/255, b/255, a}, mt)
end) end)
end end
public.inline_color = m.color_accessor(function(color) public.accessor.inline_color = m.color_accessor(function(color)
local r, g, b, a = unpack(color) local r, g, b, a = unpack(color)
return format('|c%02X%02X%02X%02X', a, r, g, b) return format('|c%02X%02X%02X%02X', a, r, g, b)
end) end)
@@ -70,7 +75,7 @@ do
local id = 0 local id = 0
function public.name() function public.name()
id = id + 1 id = id + 1
return '_G.aux_frame'..id return 'aux_frame'..id
end end
end end
@@ -83,7 +88,7 @@ do
menu:Show() menu:Show()
end end
function private.initialize_menu() function initialize_menu()
menu = CreateFrame('Frame', m.name(), UIParent, 'UIMenuTemplate') menu = CreateFrame('Frame', m.name(), UIParent, 'UIMenuTemplate')
local orig = menu:GetScript('OnShow') local orig = menu:GetScript('OnShow')
menu:SetScript('OnShow', function() menu:SetScript('OnShow', function()
@@ -108,7 +113,7 @@ end
do do
local blizzard_backdrop, aux_background, aux_border local blizzard_backdrop, aux_background, aux_border
function private.initialize_dropdown() function initialize_dropdown()
aux_border = DropDownList1:CreateTexture() aux_border = DropDownList1:CreateTexture()
aux_border:SetTexture(1, 1, 1, .02) aux_border:SetTexture(1, 1, 1, .02)
aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2) aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2)
@@ -130,7 +135,7 @@ do
end) end)
end end
function private.set_aux_dropdown_style(dropdown) function set_aux_dropdown_style(dropdown)
DropDownList1Backdrop:SetBackdrop{} DropDownList1Backdrop:SetBackdrop{}
aux_border:Show() aux_border:Show()
aux_background:Show() aux_background:Show()
@@ -159,7 +164,7 @@ do
end end
end end
function private.set_blizzard_dropdown_style() function set_blizzard_dropdown_style()
DropDownList1Backdrop:SetBackdrop(blizzard_backdrop) DropDownList1Backdrop:SetBackdrop(blizzard_backdrop)
aux_border:Hide() aux_border:Hide()
aux_background:Hide() aux_background:Hide()
+3 -3
View File
@@ -2,7 +2,7 @@ setglobal('aux', aux_module())
public.version = '4.0.0' public.version = '4.0.0'
private.module_envs = {} module_envs = {}
function public.module(path) function public.module(path)
local env local env
if path == '' then if path == '' then
@@ -16,7 +16,7 @@ function public.module(path)
env = m.module_envs[qualified_name] env = m.module_envs[qualified_name]
if not env then if not env then
(prefix and m.module_envs[prefix].public or public)[name], env = (function() return aux_module(), getfenv() end)() (prefix and m.module_envs[prefix].public or public)[name], env = (function() return aux_module(), getfenv() end)()
env.private.LOAD = nil env.LOAD = nil
m.module_envs[qualified_name] = env m.module_envs[qualified_name] = env
end end
prefix = qualified_name prefix = qualified_name
@@ -29,7 +29,7 @@ local event_frame = CreateFrame 'Frame'
for _, event in {'VARIABLES_LOADED', 'ADDON_LOADED', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE'} do for _, event in {'VARIABLES_LOADED', 'ADDON_LOADED', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE'} do
event_frame:RegisterEvent(event) event_frame:RegisterEvent(event)
end end
private.ADDON_LOADED = {} ADDON_LOADED = {}
event_frame:SetScript('OnEvent', function() event_frame:SetScript('OnEvent', function()
if event == 'ADDON_LOADED' then if event == 'ADDON_LOADED' then
if m.ADDON_LOADED[arg1] then if m.ADDON_LOADED[arg1] then
+1 -1
View File
@@ -33,7 +33,7 @@ local interface_mt = {
if mask(ACCESSOR+PUBLIC, properties) == PUBLIC then if mask(ACCESSOR+PUBLIC, properties) == PUBLIC then
return value return value
elseif mask(PUBLIC, properties) == PUBLIC then elseif mask(PUBLIC, properties) == PUBLIC then
return value() return value(key)
else else
error('No key "'..key..'".', 2) error('No key "'..key..'".', 2)
end end
+3 -3
View File
@@ -21,7 +21,7 @@ local TIME_LEFT_STRINGS = {
aux.gui.color.blue '24h', -- Very Long aux.gui.color.blue '24h', -- Very Long
} }
function private.item_column_init(rt, cell) function 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)
@@ -518,7 +518,7 @@ public.bids_config = {
}, },
} }
function private.record_percentage(record) function 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
@@ -530,7 +530,7 @@ function private.record_percentage(record)
end end
end end
function private.percentage_color(pct) function 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
+5 -5
View File
@@ -1,7 +1,7 @@
aux.module 'auctions_tab' aux.module 'auctions_tab'
aux.tab(3, 'Auctions') aux.tab(3, 'Auctions')
private.auction_records = nil auction_records = nil
function m.LOAD() function m.LOAD()
m.create_frames() m.create_frames()
@@ -16,7 +16,7 @@ function m.CLOSE()
m.frame:Hide() m.frame:Hide()
end end
function private.update_listing() function update_listing()
if not m:ACTIVE() then if not m:ACTIVE() then
return return
end end
@@ -53,7 +53,7 @@ function public.scan_auctions()
} }
end end
function private.test(record) function 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
@@ -66,7 +66,7 @@ do
local state = IDLE local state = IDLE
local found_index local found_index
function private.find_auction(record) function find_auction(record)
if not m.listing:ContainsRecord(record) then if not m.listing:ContainsRecord(record) then
return return
end end
@@ -97,7 +97,7 @@ do
) )
end end
function private.on_update() function on_update()
if state == IDLE or state == SEARCHING then if state == IDLE or state == SEARCHING then
m.cancel_button:Disable() m.cancel_button:Disable()
end end
+5 -5
View File
@@ -1,7 +1,7 @@
aux.module 'auctions_tab' aux.module 'auctions_tab'
function private.create_frames() function create_frames()
private.frame = CreateFrame('Frame', nil, aux.frame) frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints() m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide() m.frame:Hide()
@@ -11,7 +11,7 @@ function private.create_frames()
m.frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) m.frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
m.frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) m.frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.auctions_config) listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.auctions_config)
m.listing:SetSort(1,2,3,4,5,6,7,8) m.listing:SetSort(1,2,3,4,5,6,7,8)
m.listing:Reset() m.listing:Reset()
m.listing:SetHandler('OnCellClick', function(cell, button) m.listing:SetHandler('OnCellClick', function(cell, button)
@@ -31,7 +31,7 @@ function private.create_frames()
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100) status_bar:update_status(100, 100)
status_bar:set_text('') status_bar:set_text('')
private.status_bar = status_bar status_bar = status_bar
end end
do do
local btn = aux.gui.button(m.frame, 16) local btn = aux.gui.button(m.frame, 16)
@@ -40,7 +40,7 @@ function private.create_frames()
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Cancel') btn:SetText('Cancel')
btn:Disable() btn:Disable()
private.cancel_button = btn cancel_button = btn
end end
do do
local btn = aux.gui.button(m.frame, 16) local btn = aux.gui.button(m.frame, 16)
+5 -5
View File
@@ -1,7 +1,7 @@
aux.module 'bids_tab' aux.module 'bids_tab'
aux.tab(4, 'Bids') aux.tab(4, 'Bids')
private.auction_records = nil auction_records = nil
function m.LOAD() function m.LOAD()
m.create_frames() m.create_frames()
@@ -16,7 +16,7 @@ function m.CLOSE()
m.frame:Hide() m.frame:Hide()
end end
function private.update_listing() function update_listing()
if not m:ACTIVE() then if not m:ACTIVE() then
return return
end end
@@ -53,7 +53,7 @@ function public.scan_bids()
} }
end end
function private.test(record) function 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
@@ -66,7 +66,7 @@ do
local state = IDLE local state = IDLE
local found_index local found_index
function private.find_auction(record) function find_auction(record)
if not m.listing:ContainsRecord(record) then if not m.listing:ContainsRecord(record) then
return return
end end
@@ -111,7 +111,7 @@ do
) )
end end
function private.on_update() function on_update()
if state == IDLE or state == SEARCHING then if state == IDLE or state == SEARCHING then
m.buyout_button:Disable() m.buyout_button:Disable()
m.bid_button:Disable() m.bid_button:Disable()
+6 -6
View File
@@ -1,7 +1,7 @@
aux.module 'bids_tab' aux.module 'bids_tab'
function private.create_frames() function create_frames()
private.frame = CreateFrame('Frame', nil, aux.frame) frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints() m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide() m.frame:Hide()
@@ -11,7 +11,7 @@ function private.create_frames()
m.frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) m.frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
m.frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) m.frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.bids_config) listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.bids_config)
m.listing:SetSort(1,2,3,4,5,6,7,8) m.listing:SetSort(1,2,3,4,5,6,7,8)
m.listing:Reset() m.listing:Reset()
m.listing:SetHandler('OnCellClick', function(cell, button) m.listing:SetHandler('OnCellClick', function(cell, button)
@@ -35,7 +35,7 @@ function private.create_frames()
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 0) status_bar:update_status(100, 0)
status_bar:set_text('') status_bar:set_text('')
private.status_bar = status_bar status_bar = status_bar
end end
do do
local btn = aux.gui.button(m.frame, 16) local btn = aux.gui.button(m.frame, 16)
@@ -44,7 +44,7 @@ function private.create_frames()
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Bid') btn:SetText('Bid')
btn:Disable() btn:Disable()
private.bid_button = btn bid_button = btn
end end
do do
local btn = aux.gui.button(m.frame, 16) local btn = aux.gui.button(m.frame, 16)
@@ -53,7 +53,7 @@ function private.create_frames()
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Buyout') btn:SetText('Buyout')
btn:Disable() btn:Disable()
private.buyout_button = btn buyout_button = btn
end end
do do
local btn = aux.gui.button(m.frame, 16) local btn = aux.gui.button(m.frame, 16)
+28 -28
View File
@@ -4,11 +4,11 @@ aux.tab(2, 'Post')
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440 local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}} local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
private.existing_auctions = {} existing_auctions = {}
private.inventory_records = nil inventory_records = nil
private.scan_id = 0 scan_id = 0
private.selected_item = nil selected_item = nil
private.refresh = nil refresh = nil
function m.LOAD() function m.LOAD()
m.create_frames() m.create_frames()
@@ -36,7 +36,7 @@ function m.USE_ITEM(item_info)
m.select_item(item_info.item_key) m.select_item(item_info.item_key)
end end
function private.default_settings() function default_settings()
return { return {
duration = DURATION_8, duration = DURATION_8,
stack_size = 1, stack_size = 1,
@@ -46,7 +46,7 @@ function private.default_settings()
} }
end end
function private.read_settings(item_key) function read_settings(item_key)
item_key = item_key or m.selected_item.key item_key = item_key or m.selected_item.key
local dataset = aux.persistence.load_dataset() local dataset = aux.persistence.load_dataset()
dataset.post = dataset.post or {} dataset.post = dataset.post or {}
@@ -60,7 +60,7 @@ function private.read_settings(item_key)
return settings return settings
end end
function private.write_settings(settings, item_key) function write_settings(settings, item_key)
item_key = item_key or m.selected_item.key item_key = item_key or m.selected_item.key
local dataset = aux.persistence.load_dataset() local dataset = aux.persistence.load_dataset()
@@ -69,25 +69,25 @@ function private.write_settings(settings, item_key)
dataset.post[item_key] = aux.persistence.write(settings_schema, settings) dataset.post[item_key] = aux.persistence.write(settings_schema, settings)
end end
function private.get_unit_start_price() function get_unit_start_price()
local money_text = m.unit_start_price:GetText() local money_text = m.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 private.set_unit_start_price(amount) function set_unit_start_price(amount)
m.unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3)) m.unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3))
end end
function private.get_unit_buyout_price() function get_unit_buyout_price()
local money_text = m.unit_buyout_price:GetText() local money_text = m.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 private.set_unit_buyout_price(amount) function set_unit_buyout_price(amount)
m.unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3)) m.unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3))
end end
function private.update_inventory_listing() function update_inventory_listing()
if not m.ACTIVE() then if not m.ACTIVE() then
return return
end end
@@ -98,7 +98,7 @@ function private.update_inventory_listing()
end))) end)))
end end
function private.update_auction_listing() function update_auction_listing()
if not m.ACTIVE() then if not m.ACTIVE() then
return return
end end
@@ -183,7 +183,7 @@ function public.select_item(item_key)
end end
end end
function private.price_update() function price_update()
if m.selected_item then if m.selected_item then
local settings = m.read_settings() local settings = m.read_settings()
@@ -201,7 +201,7 @@ function private.price_update()
end end
end end
function private.post_auctions() function post_auctions()
if m.selected_item then if m.selected_item then
local unit_start_price = m.get_unit_start_price() local unit_start_price = m.get_unit_start_price()
local unit_buyout_price = m.get_unit_buyout_price() local unit_buyout_price = m.get_unit_buyout_price()
@@ -247,7 +247,7 @@ function private.post_auctions()
end end
end end
function private.validate_parameters() function validate_parameters()
if not m.selected_item then if not m.selected_item then
m.post_button:Disable() m.post_button:Disable()
@@ -272,7 +272,7 @@ function private.validate_parameters()
m.post_button:Enable() m.post_button:Enable()
end end
function private.update_item_configuration() function update_item_configuration()
if not m.selected_item then if not m.selected_item then
m.refresh_button:Disable() m.refresh_button:Disable()
@@ -327,7 +327,7 @@ function private.update_item_configuration()
end end
end end
function private.undercut(record, stack_size, stack) function undercut(record, stack_size, stack)
local start_price = aux.util.round(record.unit_blizzard_bid * (stack and record.stack_size or stack_size)) local start_price = aux.util.round(record.unit_blizzard_bid * (stack and record.stack_size or stack_size))
local buyout_price = aux.util.round(record.unit_buyout_price * (stack and record.stack_size or stack_size)) local buyout_price = aux.util.round(record.unit_buyout_price * (stack and record.stack_size or stack_size))
@@ -339,7 +339,7 @@ function private.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 private.quantity_update(max_count) function quantity_update(max_count)
if m.selected_item then if m.selected_item then
local max_stack_count = m.selected_item.max_charges and m.selected_item.availability[m.stack_size_slider:GetValue()] or floor(m.selected_item.availability[0] / m.stack_size_slider:GetValue()) local max_stack_count = m.selected_item.max_charges and m.selected_item.availability[m.stack_size_slider:GetValue()] or floor(m.selected_item.availability[0] / m.stack_size_slider:GetValue())
m.stack_count_slider:SetMinMaxValues(1, max_stack_count) m.stack_count_slider:SetMinMaxValues(1, max_stack_count)
@@ -350,7 +350,7 @@ function private.quantity_update(max_count)
m.refresh = true m.refresh = true
end end
function private.unit_vendor_price(item_key) function unit_vendor_price(item_key)
for slot in aux.util.inventory() do for slot in aux.util.inventory() do
@@ -374,7 +374,7 @@ function private.unit_vendor_price(item_key)
end end
end end
function private.update_historical_value_button() function update_historical_value_button()
if m.selected_item then if m.selected_item then
local historical_value = aux.history.value(m.selected_item.key) local historical_value = aux.history.value(m.selected_item.key)
m.historical_value_button.amount = historical_value m.historical_value_button.amount = historical_value
@@ -382,7 +382,7 @@ function private.update_historical_value_button()
end end
end end
function private.set_item(item) function set_item(item)
local settings = m.read_settings(item.key) local settings = m.read_settings(item.key)
item.unit_vendor_price = m.unit_vendor_price(item.key) item.unit_vendor_price = m.unit_vendor_price(item.key)
@@ -417,7 +417,7 @@ function private.set_item(item)
m.refresh = true m.refresh = true
end end
function private.update_inventory_records() function update_inventory_records()
m.inventory_records = {} m.inventory_records = {}
m.refresh = true m.refresh = true
@@ -470,7 +470,7 @@ function private.update_inventory_records()
m.refresh = true m.refresh = true
end end
function private.refresh_entries() function refresh_entries()
if m.selected_item then if m.selected_item then
local item_id, suffix_id = m.selected_item.item_id, m.selected_item.suffix_id local item_id, suffix_id = m.selected_item.item_id, m.selected_item.suffix_id
local item_key = item_id..':'..suffix_id local item_key = item_id..':'..suffix_id
@@ -518,7 +518,7 @@ function private.refresh_entries()
end end
end end
function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price, duration, owner) function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price, duration, owner)
m.existing_auctions[key] = m.existing_auctions[key] or {} m.existing_auctions[key] = m.existing_auctions[key] or {}
local entry local entry
for _, existing_entry in m.existing_auctions[key] do for _, existing_entry in m.existing_auctions[key] do
@@ -544,7 +544,7 @@ function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyou
return entry return entry
end end
function private.on_update() function on_update()
if m.refresh then if m.refresh then
m.refresh = false m.refresh = false
m.price_update() m.price_update()
@@ -557,7 +557,7 @@ function private.on_update()
m.validate_parameters() m.validate_parameters()
end end
function private.initialize_duration_dropdown() function initialize_duration_dropdown()
local function on_click() local function on_click()
UIDropDownMenu_SetSelectedValue(m.duration_dropdown, this.value) UIDropDownMenu_SetSelectedValue(m.duration_dropdown, this.value)
+21 -21
View File
@@ -1,7 +1,7 @@
aux.module 'post_tab' aux.module 'post_tab'
function private.create_frames() function create_frames()
private.frame = CreateFrame('Frame', nil, aux.frame) frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints() m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide() m.frame:Hide()
@@ -35,12 +35,12 @@ function private.create_frames()
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText('Show hidden items') label:SetText('Show hidden items')
private.show_hidden_checkbox = checkbox show_hidden_checkbox = checkbox
end end
aux.gui.horizontal_line(m.frame.inventory, -48) aux.gui.horizontal_line(m.frame.inventory, -48)
private.item_listing = aux.item_listing.create( item_listing = aux.item_listing.create(
m.frame.inventory, m.frame.inventory,
function() function()
if arg1 == 'LeftButton' then if arg1 == 'LeftButton' then
@@ -56,7 +56,7 @@ function private.create_frames()
end end
) )
private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions) auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions)
m.auction_listing:SetColInfo({ m.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' },
@@ -87,7 +87,7 @@ function private.create_frames()
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100) status_bar:update_status(100, 100)
status_bar:set_text('') status_bar:set_text('')
private.status_bar = status_bar status_bar = status_bar
end end
do do
local btn = aux.gui.button(m.frame.parameters, 16) local btn = aux.gui.button(m.frame.parameters, 16)
@@ -96,7 +96,7 @@ function private.create_frames()
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Post') btn:SetText('Post')
btn:SetScript('OnClick', m.post_auctions) btn:SetScript('OnClick', m.post_auctions)
private.post_button = btn post_button = btn
end end
do do
local btn = aux.gui.button(m.frame.parameters, 16) local btn = aux.gui.button(m.frame.parameters, 16)
@@ -109,7 +109,7 @@ function private.create_frames()
m.refresh_entries() m.refresh_entries()
m.refresh = true m.refresh = true
end) end)
private.refresh_button = btn refresh_button = btn
end end
do do
local item = aux.gui.item(m.frame.parameters) local item = aux.gui.item(m.frame.parameters)
@@ -122,7 +122,7 @@ function private.create_frames()
item.button:SetScript('OnLeave', function() item.button:SetScript('OnLeave', function()
GameTooltip:Hide() GameTooltip:Hide()
end) end)
private.item = item item = item
end end
do do
local slider = aux.gui.slider(m.frame.parameters) local slider = aux.gui.slider(m.frame.parameters)
@@ -153,7 +153,7 @@ function private.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')
private.stack_size_slider = slider stack_size_slider = slider
end end
do do
local slider = aux.gui.slider(m.frame.parameters) local slider = aux.gui.slider(m.frame.parameters)
@@ -176,7 +176,7 @@ function private.create_frames()
end) end)
slider.editbox:SetNumeric(true) slider.editbox:SetNumeric(true)
slider.label:SetText('Stack Count') slider.label:SetText('Stack Count')
private.stack_count_slider = slider stack_count_slider = slider
end end
do do
local dropdown = aux.gui.dropdown(m.frame.parameters) local dropdown = aux.gui.dropdown(m.frame.parameters)
@@ -189,12 +189,12 @@ function private.create_frames()
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown) UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown)
end) end)
private.duration_dropdown = dropdown duration_dropdown = dropdown
end end
do do
local label = aux.gui.label(m.frame.parameters, aux.gui.config.medium_font_size) local label = aux.gui.label(m.frame.parameters, aux.gui.config.medium_font_size)
label:SetPoint('LEFT', m.duration_dropdown, 'RIGHT', 25, 0) label:SetPoint('LEFT', m.duration_dropdown, 'RIGHT', 25, 0)
private.deposit = label deposit = label
end end
do do
local checkbox = aux.gui.checkbox(m.frame.parameters) local checkbox = aux.gui.checkbox(m.frame.parameters)
@@ -208,11 +208,11 @@ function private.create_frames()
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText('Hide this item') label:SetText('Hide this item')
private.hide_checkbox = checkbox hide_checkbox = checkbox
end end
do do
local frame = CreateFrame('Frame', nil, m.frame.parameters) local frame = CreateFrame('Frame', nil, m.frame.parameters)
private.start_price_frame = frame start_price_frame = frame
aux.gui.set_content_style(frame) aux.gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60) frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60)
frame:SetWidth(180) frame:SetWidth(180)
@@ -260,13 +260,13 @@ function private.create_frames()
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50) label:SetWidth(50)
label:SetJustifyH('CENTER') label:SetJustifyH('CENTER')
private.start_price_percentage = label start_price_percentage = label
end end
private.unit_start_price = editbox unit_start_price = editbox
end end
do do
local frame = CreateFrame('Frame', nil, m.frame.parameters) local frame = CreateFrame('Frame', nil, m.frame.parameters)
private.buyout_price_frame = frame buyout_price_frame = frame
aux.gui.set_content_style(frame) aux.gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19) frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19)
frame:SetWidth(180) frame:SetWidth(180)
@@ -315,9 +315,9 @@ function private.create_frames()
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50) label:SetWidth(50)
label:SetJustifyH('CENTER') label:SetJustifyH('CENTER')
private.buyout_price_percentage = label buyout_price_percentage = label
end end
private.unit_buyout_price = editbox unit_buyout_price = editbox
end end
do do
local btn = aux.gui.button(m.frame.parameters, 14) local btn = aux.gui.button(m.frame.parameters, 14)
@@ -335,6 +335,6 @@ function private.create_frames()
local label = aux.gui.label(btn, aux.gui.config.small_font_size) local label = aux.gui.label(btn, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText('Historical Value') label:SetText('Historical Value')
private.historical_value_button = btn historical_value_button = btn
end end
end end
+3 -3
View File
@@ -48,7 +48,7 @@ do
} }
end end
private.RESULTS, private.SAVED, private.FILTER = 1, 2, 3 RESULTS, SAVED, FILTER = 1, 2, 3
function m.LOAD() function m.LOAD()
m.create_frames() m.create_frames()
@@ -79,7 +79,7 @@ function m.USE_ITEM(item_info)
m.execute(nil, false) m.execute(nil, false)
end end
function private.update_tab(tab) function update_tab(tab)
m.search_results_button:UnlockHighlight() m.search_results_button:UnlockHighlight()
m.saved_searches_button:UnlockHighlight() m.saved_searches_button:UnlockHighlight()
@@ -115,7 +115,7 @@ function public.add_filter(filter_string)
m.search_box:SetText(old_filter_string..filter_string) m.search_box:SetText(old_filter_string..filter_string)
end end
function private.blizzard_page_index(str) function 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
View File
@@ -1,11 +1,11 @@
aux.module 'search_tab' aux.module 'search_tab'
function private.valid_level(str) function valid_level(str)
local level = tonumber(str) local level = tonumber(str)
return level and aux.util.bound(1, 60, level) return level and aux.util.bound(1, 60, level)
end end
private.blizzard_query = setmetatable({}, { blizzard_query = setmetatable({}, {
__newindex = function(_, key, value) __newindex = function(_, key, value)
if key == 'name' then if key == 'name' then
m.name_input:SetText(value) m.name_input:SetText(value)
@@ -58,7 +58,7 @@ private.blizzard_query = setmetatable({}, {
end, end,
}) })
function private.update_form() function update_form()
if m.blizzard_query.class and GetAuctionItemSubClasses(m.blizzard_query.class) then if m.blizzard_query.class and GetAuctionItemSubClasses(m.blizzard_query.class) then
m.subclass_dropdown.button:Enable() m.subclass_dropdown.button:Enable()
else else
@@ -99,7 +99,7 @@ function private.update_form()
end end
end end
function private.get_filter_builder_query() function get_filter_builder_query()
local query_string local query_string
local function add(part) local function add(part)
@@ -140,7 +140,7 @@ function private.get_filter_builder_query()
return query_string or '' return query_string or ''
end end
function private.set_form(components) function set_form(components)
m.clear_form() m.clear_form()
for key, filter in components.blizzard do for key, filter in components.blizzard do
m.blizzard_query[key] = filter[2] m.blizzard_query[key] = filter[2]
@@ -151,7 +151,7 @@ function private.set_form(components)
m.update_filter_display() m.update_filter_display()
end end
function private.clear_form() function clear_form()
m.blizzard_query.name = '' m.blizzard_query.name = ''
m.name_input:ClearFocus() m.name_input:ClearFocus()
m.blizzard_query.exact = false m.blizzard_query.exact = false
@@ -170,7 +170,7 @@ function private.clear_form()
m.update_filter_display() m.update_filter_display()
end end
function private.import_query_string() function import_query_string()
local components, error = aux.filter.parse_query_string(aux.util.select(3, strfind(m.search_box:GetText(), '^([^;]*)'))) local components, error = aux.filter.parse_query_string(aux.util.select(3, strfind(m.search_box:GetText(), '^([^;]*)')))
if components then if components then
m.set_form(components) m.set_form(components)
@@ -179,7 +179,7 @@ function private.import_query_string()
end end
end end
function private.export_query_string() function export_query_string()
m.search_box:SetText(m.get_filter_builder_query()) m.search_box:SetText(m.get_filter_builder_query())
m.filter_parameter_input:ClearFocus() m.filter_parameter_input:ClearFocus()
end end
@@ -228,14 +228,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 private.data_link(id, str) function data_link(id, str)
return '|H'..id..'|h'..str..'|h' return '|H'..id..'|h'..str..'|h'
end end
private.post_filter = {} post_filter = {}
private.filter_builder_state = {selected = 0} filter_builder_state = {selected = 0}
function private.data_link_click() function 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
@@ -246,7 +246,7 @@ function private.data_link_click()
m.update_filter_display() m.update_filter_display()
end end
function private.remove_component(index) function remove_component(index)
index = index or m.filter_builder_state.selected index = index or m.filter_builder_state.selected
if m.filter_builder_state.selected >= index then if m.filter_builder_state.selected >= index then
m.filter_builder_state.selected = max(m.filter_builder_state.selected - 1, min(1, getn(m.post_filter))) m.filter_builder_state.selected = max(m.filter_builder_state.selected - 1, min(1, getn(m.post_filter)))
@@ -255,12 +255,12 @@ function private.remove_component(index)
tremove(m.post_filter, index) tremove(m.post_filter, index)
end end
function private.add_component(component) function add_component(component)
m.filter_builder_state.selected = m.filter_builder_state.selected + 1 m.filter_builder_state.selected = m.filter_builder_state.selected + 1
tinsert(m.post_filter, m.filter_builder_state.selected, component) tinsert(m.post_filter, m.filter_builder_state.selected, component)
end end
function private.add_post_filter() function add_post_filter()
for str in aux.util.present(m.filter_input:GetText()) do for str in aux.util.present(m.filter_input:GetText()) do
for filter in aux.util.present(aux.filter.filters[str]) do for filter in aux.util.present(aux.filter.filters[str]) do
if filter.input_type ~= '' then if filter.input_type ~= '' then
@@ -285,14 +285,14 @@ end
do do
local text = '' local text = ''
function private.update_filter_display() function update_filter_display()
text = m.formatted_post_filter(m.post_filter) text = m.formatted_post_filter(m.post_filter)
m.filter_display:SetWidth(m.filter_display_size()) m.filter_display:SetWidth(m.filter_display_size())
m.set_filter_display_offset() m.set_filter_display_offset()
m.filter_display:SetText(text) m.filter_display:SetText(text)
end end
function private.filter_display_size() function filter_display_size()
local font, font_size = m.filter_display:GetFont() local font, font_size = m.filter_display:GetFont()
m.filter_display.measure:SetFont(font, font_size) m.filter_display.measure:SetFont(font, font_size)
local lines = 0 local lines = 0
@@ -306,7 +306,7 @@ do
end end
end end
function private.set_filter_display_offset(x_offset, y_offset) function set_filter_display_offset(x_offset, y_offset)
local scroll_frame = m.filter_display:GetParent() local scroll_frame = m.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 = m.filter_display_size() local width, height = m.filter_display_size()
@@ -318,7 +318,7 @@ function private.set_filter_display_offset(x_offset, y_offset)
scroll_frame:SetVerticalScroll(aux.util.bound(y_lower_bound, y_upper_bound, y_offset)) scroll_frame:SetVerticalScroll(aux.util.bound(y_lower_bound, y_upper_bound, y_offset))
end end
function private.initialize_filter_dropdown() function initialize_filter_dropdown()
for _, filter in {'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 {'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{ UIDropDownMenu_AddButton{
text = filter, text = filter,
@@ -338,7 +338,7 @@ function private.initialize_filter_dropdown()
end end
end end
function private.initialize_class_dropdown() function initialize_class_dropdown()
local function on_click() local function on_click()
if this.value ~= m.blizzard_query.class then if this.value ~= m.blizzard_query.class then
UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value) UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value)
@@ -365,7 +365,7 @@ function private.initialize_class_dropdown()
end end
end end
function private.initialize_subclass_dropdown() function initialize_subclass_dropdown()
local function on_click() local function on_click()
if this.value ~= m.blizzard_query.subclass then if this.value ~= m.blizzard_query.subclass then
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value) UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value)
@@ -394,7 +394,7 @@ function private.initialize_subclass_dropdown()
end end
end end
function private.initialize_slot_dropdown() function initialize_slot_dropdown()
local function on_click() local function on_click()
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, this.value) UIDropDownMenu_SetSelectedValue(m.slot_dropdown, this.value)
m.update_form() m.update_form()
@@ -420,7 +420,7 @@ function private.initialize_slot_dropdown()
end end
end end
function private.initialize_quality_dropdown() function initialize_quality_dropdown()
local function on_click() local function on_click()
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, this.value) UIDropDownMenu_SetSelectedValue(m.quality_dropdown, this.value)
m.update_form() m.update_form()
+39 -39
View File
@@ -1,9 +1,9 @@
aux.module 'search_tab' aux.module 'search_tab'
private.FILTER_SPACING = 28.5 FILTER_SPACING = 28.5
function private.create_frames() function create_frames()
private.frame = CreateFrame('Frame', nil, aux.frame) frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints() m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide() m.frame:Hide()
@@ -49,7 +49,7 @@ function private.create_frames()
fake_icon_part:SetText('_') fake_icon_part:SetText('_')
end end
private.settings_button = btn settings_button = btn
end end
do do
local panel = CreateFrame('Frame', nil, m.frame) local panel = CreateFrame('Frame', nil, m.frame)
@@ -59,14 +59,14 @@ function private.create_frames()
panel:SetPoint('RIGHT', 0, 0) panel:SetPoint('RIGHT', 0, 0)
panel:SetHeight(42) panel:SetHeight(42)
panel:Hide() panel:Hide()
private.settings = panel settings = panel
end end
do do
local panel = CreateFrame('Frame', nil, m.frame) local panel = CreateFrame('Frame', nil, m.frame)
panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 1) panel:SetPoint('RIGHT', 0, 1)
panel:SetHeight(40) panel:SetHeight(40)
private.controls = panel controls = panel
end end
do do
local editbox = aux.gui.editbox(m.settings) local editbox = aux.gui.editbox(m.settings)
@@ -97,7 +97,7 @@ function private.create_frames()
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0) label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages') label:SetText('Pages')
label:SetTextColor(unpack(aux.gui.color.text.enabled)) label:SetTextColor(unpack(aux.gui.color.text.enabled))
private.first_page_input = editbox first_page_input = editbox
end end
do do
local editbox = aux.gui.editbox(m.settings) local editbox = aux.gui.editbox(m.settings)
@@ -128,7 +128,7 @@ function private.create_frames()
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0) label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
label:SetText('-') label:SetText('-')
label:SetTextColor(unpack(aux.gui.color.text.enabled)) label:SetTextColor(unpack(aux.gui.color.text.enabled))
private.last_page_input = editbox last_page_input = editbox
end end
do do
local btn = aux.gui.checkbutton(m.settings) local btn = aux.gui.checkbutton(m.settings)
@@ -158,7 +158,7 @@ function private.create_frames()
StaticPopup_Show('AUX_SEARCH_AUTO_BUY') StaticPopup_Show('AUX_SEARCH_AUTO_BUY')
end end
end) end)
private.auto_buy_button = btn auto_buy_button = btn
end end
do do
local btn = aux.gui.checkbutton(m.settings) local btn = aux.gui.checkbutton(m.settings)
@@ -186,7 +186,7 @@ function private.create_frames()
btn:SetScript('OnLeave', function() btn:SetScript('OnLeave', function()
GameTooltip:Hide() GameTooltip:Hide()
end) end)
private.auto_buy_filter_button = btn auto_buy_filter_button = btn
end end
do do
local btn = aux.gui.button(m.controls, 25) local btn = aux.gui.button(m.controls, 25)
@@ -195,7 +195,7 @@ function private.create_frames()
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('<') btn:SetText('<')
btn:SetScript('OnClick', m.previous_search) btn:SetScript('OnClick', m.previous_search)
private.previous_button = btn previous_button = btn
end end
do do
local btn = aux.gui.button(m.controls, 25) local btn = aux.gui.button(m.controls, 25)
@@ -204,7 +204,7 @@ function private.create_frames()
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('>') btn:SetText('>')
btn:SetScript('OnClick', m.next_search) btn:SetScript('OnClick', m.next_search)
private.next_button = btn next_button = btn
end end
do do
local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size)
@@ -219,7 +219,7 @@ function private.create_frames()
end end
m.execute() m.execute()
end) end)
private.start_button = btn start_button = btn
end end
do do
local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size)
@@ -230,7 +230,7 @@ function private.create_frames()
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
aux.scan.abort(m.search_scan_id) aux.scan.abort(m.search_scan_id)
end) end)
private.stop_button = btn stop_button = btn
end end
do do
local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size)
@@ -241,7 +241,7 @@ function private.create_frames()
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
m.execute(true) m.execute(true)
end) end)
private.resume_button = btn resume_button = btn
end end
do do
local editbox = aux.gui.editbox(m.controls) local editbox = aux.gui.editbox(m.controls)
@@ -257,7 +257,7 @@ function private.create_frames()
this:HighlightText(0, 0) this:HighlightText(0, 0)
end) end)
editbox:SetScript('OnEnterPressed', m.execute) editbox:SetScript('OnEnterPressed', m.execute)
private.search_box = editbox search_box = editbox
end end
do do
aux.gui.horizontal_line(m.frame, -40) aux.gui.horizontal_line(m.frame, -40)
@@ -269,7 +269,7 @@ function private.create_frames()
btn:SetHeight(22) btn:SetHeight(22)
btn:SetText('Search Results') btn:SetText('Search Results')
btn:SetScript('OnClick', function() m.update_tab(m.RESULTS) end) btn:SetScript('OnClick', function() m.update_tab(m.RESULTS) end)
private.search_results_button = btn search_results_button = btn
end end
do do
local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2)
@@ -278,7 +278,7 @@ function private.create_frames()
btn:SetHeight(22) btn:SetHeight(22)
btn:SetText('Saved Searches') btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() m.update_tab(m.SAVED) end) btn:SetScript('OnClick', function() m.update_tab(m.SAVED) end)
private.saved_searches_button = btn saved_searches_button = btn
end end
do do
local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2)
@@ -287,14 +287,14 @@ function private.create_frames()
btn:SetHeight(22) btn:SetHeight(22)
btn:SetText('Filter Builder') btn:SetText('Filter Builder')
btn:SetScript('OnClick', function() m.update_tab(m.FILTER) end) btn:SetScript('OnClick', function() m.update_tab(m.FILTER) end)
private.new_filter_button = btn new_filter_button = btn
end end
do do
local frame = CreateFrame('Frame', nil, m.frame) local frame = CreateFrame('Frame', nil, m.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)
private.status_bar_frame = frame status_bar_frame = frame
end end
do do
local btn = aux.gui.button(m.frame.results, 16) local btn = aux.gui.button(m.frame.results, 16)
@@ -303,7 +303,7 @@ function private.create_frames()
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Bid') btn:SetText('Bid')
btn:Disable() btn:Disable()
private.bid_button = btn bid_button = btn
end end
do do
local btn = aux.gui.button(m.frame.results, 16) local btn = aux.gui.button(m.frame.results, 16)
@@ -312,7 +312,7 @@ function private.create_frames()
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Buyout') btn:SetText('Buyout')
btn:Disable() btn:Disable()
private.buyout_button = btn buyout_button = btn
end end
do do
local btn = aux.gui.button(m.frame.results, 16) local btn = aux.gui.button(m.frame.results, 16)
@@ -392,7 +392,7 @@ function private.create_frames()
local label = aux.gui.label(editbox, aux.gui.config.small_font_size) local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name') label:SetText('Name')
private.name_input = editbox name_input = editbox
end end
do do
local checkbox = aux.gui.checkbox(m.frame.filter) local checkbox = aux.gui.checkbox(m.frame.filter)
@@ -401,7 +401,7 @@ function private.create_frames()
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Exact') label:SetText('Exact')
private.exact_checkbox = checkbox exact_checkbox = checkbox
end end
do do
local editbox = aux.gui.editbox(m.frame.filter) local editbox = aux.gui.editbox(m.frame.filter)
@@ -426,7 +426,7 @@ function private.create_frames()
local label = aux.gui.label(editbox, aux.gui.config.small_font_size) local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Level Range') label:SetText('Level Range')
private.min_level_input = editbox min_level_input = editbox
end end
do do
local editbox = aux.gui.editbox(m.frame.filter) local editbox = aux.gui.editbox(m.frame.filter)
@@ -451,7 +451,7 @@ function private.create_frames()
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size) local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0) label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText('-') label:SetText('-')
private.max_level_input = editbox max_level_input = editbox
end end
do do
local checkbox = aux.gui.checkbox(m.frame.filter) local checkbox = aux.gui.checkbox(m.frame.filter)
@@ -460,11 +460,11 @@ function private.create_frames()
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Usable') label:SetText('Usable')
private.usable_checkbox = checkbox usable_checkbox = checkbox
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
private.class_dropdown = dropdown class_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, 5 - m.FILTER_SPACING) dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, 5 - m.FILTER_SPACING)
dropdown:SetWidth(300) dropdown:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
@@ -477,7 +477,7 @@ function private.create_frames()
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
private.subclass_dropdown = dropdown subclass_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING)
dropdown:SetWidth(300) dropdown:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
@@ -490,7 +490,7 @@ function private.create_frames()
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
private.slot_dropdown = dropdown slot_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING)
dropdown:SetWidth(300) dropdown:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
@@ -503,7 +503,7 @@ function private.create_frames()
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
private.quality_dropdown = dropdown quality_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING)
dropdown:SetWidth(300) dropdown:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
@@ -527,7 +527,7 @@ function private.create_frames()
local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size) local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size)
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0) label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
label:SetText('Post Filter') label:SetText('Post Filter')
private.filter_dropdown = dropdown filter_dropdown = dropdown
end end
do do
local input = aux.gui.editbox(m.frame.filter) local input = aux.gui.editbox(m.frame.filter)
@@ -558,7 +558,7 @@ function private.create_frames()
m.add_post_filter() m.add_post_filter()
end end
end) end)
private.filter_input = input filter_input = input
end end
do do
local input = aux.gui.editbox(m.frame.filter) local input = aux.gui.editbox(m.frame.filter)
@@ -572,7 +572,7 @@ function private.create_frames()
end) end)
input:SetScript('OnEnterPressed', m.add_post_filter) input:SetScript('OnEnterPressed', m.add_post_filter)
input:Hide() input:Hide()
private.filter_parameter_input = input filter_parameter_input = input
end end
do do
local scroll_frame = CreateFrame('ScrollFrame', nil, m.frame.filter) local scroll_frame = CreateFrame('ScrollFrame', nil, m.frame.filter)
@@ -615,11 +615,11 @@ function private.create_frames()
scroll_child:SetScript('OnHyperlinkClick', m.data_link_click) scroll_child:SetScript('OnHyperlinkClick', m.data_link_click)
-- scroll_child:SetHyperlinkFormat("format") -- scroll_child:SetHyperlinkFormat("format")
scroll_child.measure = scroll_child:CreateFontString() scroll_child.measure = scroll_child:CreateFontString()
private.filter_display = scroll_child filter_display = scroll_child
end end
private.status_bars = {} status_bars = {}
private.tables = {} tables = {}
for _=1,5 do for _=1,5 do
local status_bar = aux.gui.status_bar(m.frame) local status_bar = aux.gui.status_bar(m.frame)
status_bar:SetAllPoints(m.status_bar_frame) status_bar:SetAllPoints(m.status_bar_frame)
@@ -689,7 +689,7 @@ function private.create_frames()
end end
} }
private.recent_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.recent) recent_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.recent)
m.recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}} m.recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
m.recent_searches_listing:EnableSorting(false) m.recent_searches_listing:EnableSorting(false)
m.recent_searches_listing:DisableSelection(true) m.recent_searches_listing:DisableSelection(true)
@@ -697,7 +697,7 @@ function private.create_frames()
m.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter) m.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave) m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
private.favorite_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.favorite) favorite_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.favorite)
m.favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}} m.favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}}
m.favorite_searches_listing:EnableSorting(false) m.favorite_searches_listing:EnableSorting(false)
m.favorite_searches_listing:DisableSelection(true) m.favorite_searches_listing:DisableSelection(true)
+16 -16
View File
@@ -2,18 +2,18 @@ aux.module 'search_tab'
_G.aux_auto_buy_filter = '' _G.aux_auto_buy_filter = ''
private.search_scan_id = 0 search_scan_id = 0
private.auto_buy_validator = nil auto_buy_validator = nil
do do
local searches = {} local searches = {}
local search_index = 1 local search_index = 1
function private.current_search() function current_search()
return searches[search_index] return searches[search_index]
end end
function private.update_search(index) function 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()
@@ -40,7 +40,7 @@ do
m.update_continuation() m.update_continuation()
end end
function private.new_search(filter_string) function new_search(filter_string)
while getn(searches) > search_index do while getn(searches) > search_index do
tremove(searches) tremove(searches)
end end
@@ -68,26 +68,26 @@ do
m.update_search(getn(searches)) m.update_search(getn(searches))
end end
function private.previous_search() function previous_search()
m.search_box:ClearFocus() m.search_box:ClearFocus()
m.update_search(search_index - 1) m.update_search(search_index - 1)
m.update_tab(m.RESULTS) m.update_tab(m.RESULTS)
end end
function private.next_search() function next_search()
m.search_box:ClearFocus() m.search_box:ClearFocus()
m.update_search(search_index + 1) m.update_search(search_index + 1)
m.update_tab(m.RESULTS) m.update_tab(m.RESULTS)
end end
end end
function private.close_settings() function close_settings()
if m.settings_button.open then if m.settings_button.open then
m.settings_button:Click() m.settings_button:Click()
end end
end end
function private.update_continuation() function update_continuation()
if m.current_search().continuation then if m.current_search().continuation then
m.resume_button:Show() m.resume_button:Show()
m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0) m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0)
@@ -97,7 +97,7 @@ function private.update_continuation()
end end
end end
function private.discard_continuation() function discard_continuation()
aux.scan.abort(m.search_scan_id) aux.scan.abort(m.search_scan_id)
m.current_search().continuation = nil m.current_search().continuation = nil
m.update_continuation() m.update_continuation()
@@ -113,7 +113,7 @@ function private:update_start_stop()
end end
end end
function private.update_auto_buy_filter() function update_auto_buy_filter()
if _G.aux_auto_buy_filter ~= '' then if _G.aux_auto_buy_filter ~= '' then
local queries = aux.filter.queries(_G.aux_auto_buy_filter) local queries = aux.filter.queries(_G.aux_auto_buy_filter)
if queries then if queries then
@@ -132,7 +132,7 @@ function private.update_auto_buy_filter()
_G.aux_auto_buy_filter = '' _G.aux_auto_buy_filter = ''
end end
function private.start_real_time_scan(query, search, continuation) function start_real_time_scan(query, search, continuation)
local ignore_page local ignore_page
if not search then if not search then
@@ -209,7 +209,7 @@ function private.start_real_time_scan(query, search, continuation)
} }
end end
function private.start_search(queries, continuation) function 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 = m.current_search() local search = m.current_search()
@@ -365,7 +365,7 @@ function public.execute(resume, real_time)
end end
end end
function private.test(record) function test(record)
return function(index) return function(index)
local auction_info = aux.info.auction(index) local auction_info = aux.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
@@ -378,7 +378,7 @@ do
local state = IDLE local state = IDLE
local found_index local found_index
function private.find_auction(record) function find_auction(record)
local search = m.current_search() local search = m.current_search()
if not search.table:ContainsRecord(record) or aux.is_player(record.owner) then if not search.table:ContainsRecord(record) or aux.is_player(record.owner) then
@@ -429,7 +429,7 @@ do
) )
end end
function private.on_update() function on_update()
if state == IDLE or state == SEARCHING then if state == IDLE or state == SEARCHING then
m.buyout_button:Disable() m.buyout_button:Disable()
m.bid_button:Disable() m.bid_button:Disable()
+2 -2
View File
@@ -3,7 +3,7 @@ aux.module 'search_tab'
_G.aux_favorite_searches = {} _G.aux_favorite_searches = {}
_G.aux_recent_searches = {} _G.aux_recent_searches = {}
function private.update_search_listings() function update_search_listings()
local favorite_search_rows = {} local favorite_search_rows = {}
for i, favorite_search in _G.aux_favorite_searches do for i, favorite_search in _G.aux_favorite_searches do
local name = strsub(favorite_search.prettified, 1, 250) local name = strsub(favorite_search.prettified, 1, 250)
@@ -27,7 +27,7 @@ function private.update_search_listings()
m.recent_searches_listing:SetData(recent_search_rows) m.recent_searches_listing:SetData(recent_search_rows)
end end
function private.new_recent_search(filter_string, prettified) function new_recent_search(filter_string, prettified)
tinsert(_G.aux_recent_searches, 1, { tinsert(_G.aux_recent_searches, 1, {
filter_string = filter_string, filter_string = filter_string,
prettified = prettified, prettified = prettified,
+8 -8
View File
@@ -1,6 +1,6 @@
aux.module 'filter' aux.module 'filter'
function private.default_filter(str) function default_filter(str)
return { return {
input_type = '', input_type = '',
validator = function() validator = function()
@@ -202,7 +202,7 @@ public.filters = {
}, },
} }
function private.operator(str) function operator(str)
local operator = str == 'not' and {'operator', 'not', 1} local operator = str == 'not' and {'operator', 'not', 1}
for _, name in {'and', 'or'} do for _, name in {'and', 'or'} do
for arity in aux.util.present(aux.util.select(3, strfind(str, '^'..name..'(%d*)$'))) do for arity in aux.util.present(aux.util.select(3, strfind(str, '^'..name..'(%d*)$'))) do
@@ -259,12 +259,12 @@ do
end, end,
} }
function private.blizzard_filter_parser() function blizzard_filter_parser()
return setmetatable({}, mt) return setmetatable({}, mt)
end end
end end
function private.parse_parameter(input_type, str) function 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
@@ -372,7 +372,7 @@ function public.queries(query_string)
return queries return queries
end end
function private.suggestions(components) function suggestions(components)
local suggestions = {} local suggestions = {}
if components.blizzard.name and aux.util.size(components.blizzard) == 1 then if components.blizzard.name and aux.util.size(components.blizzard) == 1 then
@@ -455,7 +455,7 @@ function public.query_string(components)
return query_builder.get() return query_builder.get()
end end
function private.prettified_query_string(components) function prettified_query_string(components)
local prettified = m.query_builder() local prettified = m.query_builder()
for key, filter in components.blizzard do for key, filter in components.blizzard do
@@ -505,7 +505,7 @@ function public.unquote(name)
return aux.util.select(3, strfind(name, '^<(.*)>$')) or name return aux.util.select(3, strfind(name, '^<(.*)>$')) or name
end end
function private.blizzard_query(components) function blizzard_query(components)
local filters = components.blizzard local filters = components.blizzard
local query = {name=filters.name and filters.name[2]} local query = {name=filters.name and filters.name[2]}
@@ -534,7 +534,7 @@ function private.blizzard_query(components)
return query return query
end end
function private.validator(components) function validator(components)
local validators = {} local validators = {}
for i, component in components.post do for i, component in components.post do
+1 -1
View File
@@ -287,7 +287,7 @@ function public.tooltip(setter)
return tooltip, AuxTooltip.money return tooltip, AuxTooltip.money
end end
function private.item_charges(tooltip) function 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+)')..'$'
+5 -5
View File
@@ -1,11 +1,11 @@
aux.module 'money' aux.module 'money'
private.GOLD_TEXT = '|cffffd70ag|r' GOLD_TEXT = '|cffffd70ag|r'
private.SILVER_TEXT = '|cffc7c7cfs|r' SILVER_TEXT = '|cffc7c7cfs|r'
private.COPPER_TEXT = '|cffeda55fc|r' COPPER_TEXT = '|cffeda55fc|r'
private.COPPER_PER_SILVER = 100 COPPER_PER_SILVER = 100
private.COPPER_PER_GOLD = 10000 COPPER_PER_GOLD = 10000
function public.gsc(money) function public.gsc(money)
local gold = floor(money / m.COPPER_PER_GOLD) local gold = floor(money / m.COPPER_PER_GOLD)
+1 -1
View File
@@ -10,7 +10,7 @@ do
realm = GetCVar('realmName') realm = GetCVar('realmName')
end end
function private.get_dataset_key() function get_dataset_key()
return realm..'|'..faction return realm..'|'..faction
end end
end end