module refactoring

This commit is contained in:
Manuel Simon Hirsig
2017-11-25 17:53:39 +01:00
parent 6f71167e48
commit ab94acc2be
38 changed files with 402 additions and 453 deletions
+4 -6
View File
@@ -1,13 +1,11 @@
module 'aux.tabs.auctions'
include 'aux'
local T = require 'T'
local aux = require 'aux'
local scan_util = require 'aux.util.scan'
local scan = require 'aux.core.scan'
local tab = TAB 'Auctions'
local tab = aux.tab 'Auctions'
auction_records = T.acquire()
@@ -75,7 +73,7 @@ do
cancel_button:SetScript('OnClick', function()
if scan_util.test(record, index) and listing:ContainsRecord(record) then
cancel_auction(index, function() listing:RemoveAuctionRecord(record) end)
aux.cancel_auction(index, function() listing:RemoveAuctionRecord(record) end)
end
end)
cancel_button:Enable()
@@ -97,7 +95,7 @@ do
find_auction(selection.record)
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
cancel_button:Disable()
if not cancel_in_progress() then state = IDLE end
if not aux.cancel_in_progress() then state = IDLE end
end
end
end
+6 -5
View File
@@ -1,19 +1,20 @@
module 'aux.tabs.auctions'
local aux = require 'aux'
local info = require 'aux.util.info'
local gui = require 'aux.gui'
local auction_listing = require 'aux.gui.auction_listing'
local search_tab = require 'aux.tabs.search'
frame = CreateFrame('Frame', nil, AuxFrame)
frame = CreateFrame('Frame', nil, aux.frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
frame.listing = gui.panel(frame)
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
listing = auction_listing.new(frame.listing, 20, auction_listing.auctions_columns)
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
@@ -26,7 +27,7 @@ listing:SetHandler('OnClick', function(row, button)
end
end
elseif button == 'RightButton' then
set_tab(1)
aux.set_tab(1)
search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
search_tab.execute(nil, false)
end
@@ -40,7 +41,7 @@ do
status_bar = gui.status_bar(frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(1, 1)
status_bar:set_text('')
end
+5 -7
View File
@@ -1,14 +1,12 @@
module 'aux.tabs.bids'
include 'aux'
local T = require 'T'
local aux = require 'aux'
local info = require 'aux.util.info'
local scan_util = require 'aux.util.scan'
local scan = require 'aux.core.scan'
local tab = TAB 'Bids'
local tab = aux.tab 'Bids'
auction_records = {}
@@ -80,7 +78,7 @@ do
if not record.high_bidder then
bid_button:SetScript('OnClick', function()
if scan_util.test(record, index) and listing:ContainsRecord(record) then
place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
aux.place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
info.bid_update(record)
listing:SetDatabase()
end or function() listing:RemoveAuctionRecord(record) end)
@@ -94,7 +92,7 @@ do
if record.buyout_price > 0 then
buyout_button:SetScript('OnClick', function()
if scan_util.test(record, index) and listing:ContainsRecord(record) then
place_bid('bidder', index, record.buyout_price, function() listing:RemoveAuctionRecord(record) end)
aux.place_bid('bidder', index, record.buyout_price, function() listing:RemoveAuctionRecord(record) end)
end
end)
buyout_button:Enable()
@@ -121,7 +119,7 @@ do
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
buyout_button:Disable()
bid_button:Disable()
if not bid_in_progress() then state = IDLE end
if not aux.bid_in_progress() then state = IDLE end
end
end
end
+6 -5
View File
@@ -1,19 +1,20 @@
module 'aux.tabs.bids'
local aux = require 'aux'
local info = require 'aux.util.info'
local gui = require 'aux.gui'
local auction_listing = require 'aux.gui.auction_listing'
local search_tab = require 'aux.tabs.search'
frame = CreateFrame('Frame', nil, AuxFrame)
frame = CreateFrame('Frame', nil, aux.frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
frame.listing = gui.panel(frame)
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
listing = auction_listing.new(frame.listing, 20, auction_listing.bids_columns)
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
@@ -28,7 +29,7 @@ listing:SetHandler('OnClick', function(row, button)
end
end
elseif button == 'RightButton' then
set_tab(1)
aux.set_tab(1)
search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
search_tab.execute(nil, false)
end
@@ -42,7 +43,7 @@ do
status_bar = gui.status_bar(frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(1, 0)
status_bar:set_text('')
end
+17 -19
View File
@@ -1,9 +1,7 @@
module 'aux.tabs.post'
include 'aux'
local T = require 'T'
local aux = require 'aux'
local info = require 'aux.util.info'
local sort_util = require 'aux.util.sort'
local persistence = require 'aux.util.persistence'
@@ -16,7 +14,7 @@ local item_listing = require 'aux.gui.item_listing'
local al = require 'aux.gui.auction_listing'
local gui = require 'aux.gui'
local tab = TAB 'Post'
local tab = aux.tab 'Post'
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
local settings_schema = {'tuple', '#', {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
@@ -31,8 +29,8 @@ function get_default_settings()
return T.map('duration', DURATION_8, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
end
function handle.LOAD2()
data = faction_data'post'
function aux.handle.LOAD2()
data = aux.faction_data'post'
end
function read_settings(item_key)
@@ -102,7 +100,7 @@ function set_unit_buyout_price(amount)
end
function update_inventory_listing()
local records = values(filter(copy(inventory_records), function(record)
local records = aux.values(aux.filter(aux.copy(inventory_records), function(record)
local settings = read_settings(record.key)
return record.aux_quantity > 0 and (not settings.hidden or show_hidden_checkbox:GetChecked())
end))
@@ -116,15 +114,15 @@ function update_auction_listing(listing, records, reference)
local historical_value = history.value(selected_item.key)
local stack_size = stack_size_slider:GetValue()
for _, record in records[selected_item.key] or T.empty do
local price_color = undercut(record, stack_size_slider:GetValue(), listing == 'bid') < reference and color.red
local price_color = undercut(record, stack_size_slider:GetValue(), listing == 'bid') < reference and aux.color.red
local price = record.unit_price * (listing == 'bid' and record.stack_size / stack_size_slider:GetValue() or 1)
tinsert(rows, T.map(
'cols', T.list(
T.map('value', record.own and color.green(record.count) or record.count),
T.map('value', record.own and aux.color.green(record.count) or record.count),
T.map('value', al.time_left(record.duration)),
T.map('value', record.stack_size == stack_size and color.green(record.stack_size) or record.stack_size),
T.map('value', record.stack_size == stack_size and aux.color.green(record.stack_size) or record.stack_size),
T.map('value', money.to_string(price, true, nil, price_color)),
T.map('value', historical_value and gui.percentage_historical(round(price / historical_value * 100)) or '---')
T.map('value', historical_value and gui.percentage_historical(aux.round(price / historical_value * 100)) or '---')
),
'record', record
))
@@ -135,7 +133,7 @@ function update_auction_listing(listing, records, reference)
T.map('value', '---'),
T.map('value', '---'),
T.map('value', '---'),
T.map('value', money.to_string(historical_value, true, nil, color.green)),
T.map('value', money.to_string(historical_value, true, nil, aux.color.green)),
T.map('value', historical_value and gui.percentage_historical(100) or '---')
),
'record', T.map('historical_value', true, 'stack_size', stack_size, 'unit_price', historical_value, 'own', true)
@@ -173,7 +171,7 @@ function update_auction_listings()
end
function M.select_item(item_key)
for _, inventory_record in filter(copy(inventory_records), function(record) return record.aux_quantity > 0 end) do
for _, inventory_record in aux.filter(aux.copy(inventory_records), function(record) return record.aux_quantity > 0 end) do
if inventory_record.key == item_key then
update_item(inventory_record)
return
@@ -192,8 +190,8 @@ function price_update()
set_unit_buyout_price(undercut(get_buyout_selection(), stack_size_slider:GetValue()))
unit_buyout_price_input:SetText(money.to_string(get_unit_buyout_price(), true, nil, nil, true))
end
start_price_percentage:SetText(historical_value and gui.percentage_historical(round(get_unit_start_price() / historical_value * 100)) or '---')
buyout_price_percentage:SetText(historical_value and gui.percentage_historical(round(get_unit_buyout_price() / historical_value * 100)) or '---')
start_price_percentage:SetText(historical_value and gui.percentage_historical(aux.round(get_unit_start_price() / historical_value * 100)) or '---')
buyout_price_percentage:SetText(historical_value and gui.percentage_historical(aux.round(get_unit_buyout_price() / historical_value * 100)) or '---')
end
end
@@ -275,7 +273,7 @@ function update_item_configuration()
item.texture:SetTexture(nil)
item.count:SetText()
item.name:SetTextColor(color.label.enabled())
item.name:SetTextColor(aux.color.label.enabled())
item.name:SetText('No item selected')
unit_start_price_input:Hide()
@@ -314,7 +312,7 @@ function update_item_configuration()
local duration_factor = UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
local stack_size, stack_count = selected_item.max_charges and 1 or stack_size_slider:GetValue(), stack_count_slider:GetValue()
local amount = floor(selected_item.unit_vendor_price * deposit_factor * stack_size) * stack_count * duration_factor
deposit:SetText('Deposit: ' .. money.to_string(amount, nil, nil, color.text.enabled))
deposit:SetText('Deposit: ' .. money.to_string(amount, nil, nil, aux.color.text.enabled))
end
refresh_button:Enable()
@@ -391,7 +389,7 @@ function update_item(item)
else
stack_size_slider:SetMinMaxValues(1, min(selected_item.max_stack, selected_item.aux_quantity))
end
stack_size_slider:SetValue(huge)
stack_size_slider:SetValue(aux.huge)
quantity_update(true)
unit_start_price_input:SetText(money.to_string(settings.start_price, true, nil, nil, true))
@@ -442,7 +440,7 @@ function update_inventory_records()
end
end
T.release(inventory_records)
inventory_records = values(auctionable_map)
inventory_records = aux.values(auctionable_map)
refresh = true
end
+7 -6
View File
@@ -1,5 +1,6 @@
module 'aux.tabs.post'
local aux = require 'aux'
local info = require 'aux.util.info'
local money = require 'aux.util.money'
local gui = require 'aux.gui'
@@ -7,15 +8,15 @@ local listing = require 'aux.gui.listing'
local item_listing = require 'aux.gui.item_listing'
local search_tab = require 'aux.tabs.search'
frame = CreateFrame('Frame', nil, AuxFrame)
frame = CreateFrame('Frame', nil, aux.frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
frame.content = CreateFrame('Frame', nil, frame)
frame.content:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.content:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
frame.content:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
frame.content:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
frame.content:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
frame.inventory = gui.panel(frame.content)
frame.inventory:SetWidth(212)
@@ -61,7 +62,7 @@ do
if arg1 == 'LeftButton' then
update_item(this.item_record)
elseif arg1 == 'RightButton' then
set_tab(1)
aux.set_tab(1)
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name) .. '/exact')
search_tab.execute(nil, false)
end
@@ -124,7 +125,7 @@ do
status_bar = gui.status_bar(frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(1, 1)
status_bar:set_text('')
end
@@ -310,7 +311,7 @@ do
deposit = label
end
function handle.LOAD()
function aux.handle.LOAD()
if not aux_post_bid then
frame.bid_listing:Hide()
frame.buyout_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
+4 -7
View File
@@ -1,12 +1,9 @@
module 'aux.tabs.search'
include 'aux'
local T = require 'T'
local aux = require 'aux'
local info = require 'aux.util.info'
local tab = TAB 'Search'
local tab = aux.tab 'Search'
StaticPopupDialogs.AUX_SEARCH_TABLE_FULL = {
text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.',
@@ -20,7 +17,7 @@ RESULTS = 1
SAVED = 2
FILTER = 3
function handle.LOAD()
function aux.handle.LOAD()
set_subtab(SAVED)
end
@@ -73,7 +70,7 @@ end
function add_filter(filter_string)
local old_filter_string = search_box:GetText()
old_filter_string = trim(old_filter_string)
old_filter_string = aux.trim(old_filter_string)
if old_filter_string ~= '' then
old_filter_string = old_filter_string .. ';'
+12 -12
View File
@@ -1,7 +1,7 @@
module 'aux.tabs.search'
local T = require 'T'
local aux = require 'aux'
local info = require 'aux.util.info'
local money = require 'aux.util.money'
local filter_util = require 'aux.util.filter'
@@ -11,7 +11,7 @@ local post_filter_index = 0
function valid_level(str)
local level = tonumber(str)
return level and bounded(1, 60, level)
return level and aux.bounded(1, 60, level)
end
blizzard_query = setmetatable(T.acquire(), {
@@ -99,7 +99,7 @@ function update_form()
quality_dropdown.button:Enable()
end
if any(T.temp-T.list('min_level', 'max_level', 'usable', 'class', 'subclass', 'slot', 'quality'), function(key) return blizzard_query[key] end) then
if aux.any(T.temp-T.list('min_level', 'max_level', 'usable', 'class', 'subclass', 'slot', 'quality'), function(key) return blizzard_query[key] end) then
exact_checkbox:Disable()
else
exact_checkbox:Enable()
@@ -116,7 +116,7 @@ function get_filter_builder_query()
end
local name = blizzard_query.name
if not index(filter_util.parse_filter_string(name), 'blizzard', 'name') then
if not aux.index(filter_util.parse_filter_string(name), 'blizzard', 'name') then
name = filter_util.quote(name)
end
add((name ~= '' or blizzard_query.exact) and name)
@@ -183,8 +183,8 @@ function clear_form()
end
function import_filter_string()
local filter, error = filter_util.parse_filter_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
if filter or print(error) then
local filter, error = filter_util.parse_filter_string(aux.select(3, strfind(search_box:GetText(), '^([^;]*)')))
if filter or aux.print(error) then
set_form(filter)
end
update_form()
@@ -206,11 +206,11 @@ function formatted_post_filter(components)
end
str = str .. '</p><p>'
for _ = 1, getn(stack) + 1 do
str = str .. color.content.background'----'
str = str .. aux.color.content.background'----'
end
no_line_break = component[1] == 'operator' and component[2] == 'not'
local filter_color = (post_filter_index == i and color.gold or color.orange)
local filter_color = (post_filter_index == i and aux.color.gold or aux.color.orange)
local component_text = filter_color(component[2])
if component[1] == 'operator' and component[2] ~= 'not' then
component_text = component_text .. filter_color(tonumber(component[3]) or '')
@@ -283,7 +283,7 @@ function add_form_component()
filter_input:HighlightText()
filter_input:SetFocus()
elseif error then
print(error)
aux.print(error)
end
end
end
@@ -318,8 +318,8 @@ function set_filter_display_offset(x_offset, y_offset)
local x_upper_bound = 0
local y_lower_bound = 0
local y_upper_bound = max(0, height - scroll_frame:GetHeight())
scroll_frame:SetHorizontalScroll(bounded(x_lower_bound, x_upper_bound, x_offset))
scroll_frame:SetVerticalScroll(bounded(y_lower_bound, y_upper_bound, y_offset))
scroll_frame:SetHorizontalScroll(aux.bounded(x_lower_bound, x_upper_bound, x_offset))
scroll_frame:SetVerticalScroll(aux.bounded(y_lower_bound, y_upper_bound, y_offset))
end
function initialize_filter_dropdown()
@@ -329,7 +329,7 @@ function initialize_filter_dropdown()
'value', filter,
'func', function()
filter_input:SetText(this.value)
if index(filter_util.filters[this.value], 'input_type') == '' or this.value == 'not' then
if aux.index(filter_util.filters[this.value], 'input_type') == '' or this.value == 'not' then
add_form_component()
elseif filter_util.filters[this.value] then
filter_parameter_input:Show()
+16 -16
View File
@@ -1,7 +1,7 @@
module 'aux.tabs.search'
local T = require 'T'
local aux = require 'aux'
local info = require 'aux.util.info'
local completion = require 'aux.util.completion'
local filter_util = require 'aux.util.filter'
@@ -12,19 +12,19 @@ local auction_listing = require 'aux.gui.auction_listing'
local FILTER_SPACING = 28.5
frame = CreateFrame('Frame', nil, AuxFrame)
frame = CreateFrame('Frame', nil, aux.frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
frame.filter = gui.panel(frame)
frame.filter:SetAllPoints(AuxFrame.content)
frame.filter:SetAllPoints(aux.frame.content)
frame.results = gui.panel(frame)
frame.results:SetAllPoints(AuxFrame.content)
frame.results:SetAllPoints(aux.frame.content)
frame.saved = CreateFrame('Frame', nil, frame)
frame.saved:SetAllPoints(AuxFrame.content)
frame.saved:SetAllPoints(aux.frame.content)
frame.saved.favorite = gui.panel(frame.saved)
frame.saved.favorite:SetWidth(393)
@@ -57,7 +57,7 @@ do
local btn = gui.button(frame, gui.font_size.small)
btn:SetHeight(25)
btn:SetWidth(60)
btn:SetText(color.label.enabled'Range:')
btn:SetText(aux.color.label.enabled'Range:')
btn:SetScript('OnClick', function()
update_real_time(true)
end)
@@ -68,7 +68,7 @@ do
btn:SetHeight(25)
btn:SetWidth(60)
btn:Hide()
btn:SetText(color.label.enabled'Real Time')
btn:SetText(aux.color.label.enabled'Real Time')
btn:SetScript('OnClick', function()
update_real_time(false)
end)
@@ -98,7 +98,7 @@ do
editbox.change = change
local label = gui.label(editbox, gui.font_size.medium)
label:SetPoint('LEFT', editbox, 'RIGHT', 0, 0)
label:SetTextColor(color.label.enabled())
label:SetTextColor(aux.color.label.enabled())
label:SetText('-')
first_page_input = editbox
end
@@ -149,7 +149,7 @@ do
local btn = gui.button(frame)
btn:SetHeight(25)
btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
btn:SetBackdropColor(color.state.enabled())
btn:SetBackdropColor(aux.color.state.enabled())
btn:SetText('Resume')
btn:SetScript('OnClick', function()
execute(true)
@@ -161,7 +161,7 @@ do
editbox:EnableMouse(1)
editbox.formatter = function(str)
local queries = filter_util.queries(str)
return queries and join(map(copy(queries), function(query) return query.prettified end), ';') or color.red(str)
return queries and aux.join(aux.map(aux.copy(queries), function(query) return query.prettified end), ';') or aux.color.red(str)
end
editbox.complete = completion.complete_filter
editbox.escape = function() this:SetText(get_current_search().filter_string or '') end
@@ -184,7 +184,7 @@ do
end
do
local btn = gui.button(frame, gui.font_size.large)
btn:SetPoint('BOTTOMLEFT', AuxFrame.content, 'TOPLEFT', 10, 8)
btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8)
btn:SetWidth(243)
btn:SetHeight(22)
btn:SetText('Search Results')
@@ -213,7 +213,7 @@ do
local frame = CreateFrame('Frame', nil, frame)
frame:SetWidth(265)
frame:SetHeight(25)
frame:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar_frame = frame
end
do
@@ -435,7 +435,7 @@ do
input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0)
input:SetWidth(150)
input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end)
input.complete = completion.complete(function() return T.temp-T.list('and', 'or', 'not', unpack(keys(filter_util.filters))) end)
input.complete = completion.complete(function() return T.temp-T.list('and', 'or', 'not', unpack(aux.keys(filter_util.filters))) end)
input.char = function() this:complete() end
input.change = function()
local text = this:GetText()
@@ -478,7 +478,7 @@ do
scroll_frame:EnableMouseWheel(true)
scroll_frame:SetScript('OnMouseWheel', function()
local child = this:GetScrollChild()
child:SetFont('p', [[Fonts\ARIALN.TTF]], bounded(gui.font_size.small, gui.font_size.large, select(2, child:GetFont()) + arg1*2))
child:SetFont('p', [[Fonts\ARIALN.TTF]], aux.bounded(gui.font_size.small, gui.font_size.large, aux.select(2, child:GetFont()) + arg1*2))
update_filter_display()
end)
scroll_frame:RegisterForDrag('LeftButton')
@@ -504,7 +504,7 @@ do
local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame)
scroll_frame:SetScrollChild(scroll_child)
scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], gui.font_size.large)
scroll_child:SetTextColor('p', color.label.enabled())
scroll_child:SetTextColor('p', aux.color.label.enabled())
scroll_child:SetWidth(1)
scroll_child:SetHeight(1)
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
@@ -531,7 +531,7 @@ for _ = 1, 5 do
end
end
elseif button == 'RightButton' then
set_tab(1)
aux.set_tab(1)
set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
execute(nil, false)
end
+10 -10
View File
@@ -1,7 +1,7 @@
module 'aux.tabs.search'
local T = require 'T'
local aux = require 'aux'
local info = require 'aux.util.info'
local filter_util = require 'aux.util.filter'
local scan_util = require 'aux.util.scan'
@@ -9,7 +9,7 @@ local scan = require 'aux.core.scan'
search_scan_id = 0
function handle.LOAD()
function aux.handle.LOAD()
new_search()
end
@@ -175,7 +175,7 @@ function start_real_time_scan(query, search, continuation)
map[record.sniping_signature] = record
end
T.release(new_records)
new_records = values(map)
new_records = aux.values(map)
if getn(new_records) > 2000 then
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
@@ -303,14 +303,14 @@ function M.execute(resume, real_time)
local queries, error = filter_util.queries(filter_string)
if not queries then
print('Invalid filter:', error)
aux.print('Invalid filter:', error)
return
elseif real_time then
if getn(queries) > 1 then
print('Error: The real time mode does not support multi-queries')
aux.print('Error: The real time mode does not support multi-queries')
return
elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then
print('Error: The real time mode does not support page ranges')
aux.print('Error: The real time mode does not support page ranges')
return
end
end
@@ -324,7 +324,7 @@ function M.execute(resume, real_time)
else
get_current_search().filter_string = filter_string
end
new_recent_search(filter_string, join(map(copy(queries), function(filter) return filter.prettified end), ';'))
new_recent_search(filter_string, aux.join(aux.map(aux.copy(queries), function(filter) return filter.prettified end), ';'))
else
local search = get_current_search()
search.records = T.acquire()
@@ -391,7 +391,7 @@ do
if not record.high_bidder then
bid_button:SetScript('OnClick', function()
if scan_util.test(record, index) and search.table:ContainsRecord(record) then
place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
info.bid_update(record)
search.table:SetDatabase()
end or function() search.table:RemoveAuctionRecord(record) end)
@@ -405,7 +405,7 @@ do
if record.buyout_price > 0 then
buyout_button:SetScript('OnClick', function()
if scan_util.test(record, index) and search.table:ContainsRecord(record) then
place_bid('list', index, record.buyout_price, function() search.table:RemoveAuctionRecord(record) end)
aux.place_bid('list', index, record.buyout_price, function() search.table:RemoveAuctionRecord(record) end)
end
end)
buyout_button:Enable()
@@ -432,7 +432,7 @@ do
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
buyout_button:Disable()
bid_button:Disable()
if not bid_in_progress() then
if not aux.bid_in_progress() then
state = IDLE
end
end
+12 -12
View File
@@ -1,12 +1,12 @@
module 'aux.tabs.search'
local T = require 'T'
local aux = require 'aux'
local filter_util = require 'aux.util.filter'
local gui = require 'aux.gui'
function handle.LOAD2()
recent_searches, favorite_searches = realm_data'recent_searches', realm_data'favorite_searches'
function aux.handle.LOAD2()
recent_searches, favorite_searches = aux.realm_data'recent_searches', aux.realm_data'favorite_searches'
end
function update_search_listings()
@@ -15,7 +15,7 @@ function update_search_listings()
local search = favorite_searches[i]
local name = strsub(search.prettified, 1, 250)
tinsert(favorite_search_rows, T.map(
'cols', T.list(T.map('value', search.auto_buy and color.red'X' or ''), T.map('value', name)),
'cols', T.list(T.map('value', search.auto_buy and aux.color.red'X' or ''), T.map('value', name)),
'search', search,
'index', i
))
@@ -92,12 +92,12 @@ function get_auto_buy_validator()
if queries then
tinsert(validators, queries[1].validator)
else
print('Invalid auto buy filter:', error)
aux.print('Invalid auto buy filter:', error)
end
end
end
return function(record)
return any(validators, function(validator) return validator(record) end)
return aux.any(validators, function(validator) return validator(record) end)
end
end
@@ -106,11 +106,11 @@ function add_favorite(filter_string)
if queries then
tinsert(favorite_searches, 1, T.map(
'filter_string', filter_string,
'prettified', join(map(queries, function(query) return query.prettified end), ';')
'prettified', aux.join(aux.map(queries, function(query) return query.prettified end), ';')
))
update_search_listings()
else
print('Invalid filter:', error)
aux.print('Invalid filter:', error)
end
end
@@ -118,14 +118,14 @@ function enable_auto_buy(search)
local queries, error = filter_util.queries(search.filter_string)
if queries then
if getn(queries) > 1 then
print('Error: Auto Buy does not support multi-queries')
elseif size(queries[1].blizzard_query) > 0 and not filter_util.parse_filter_string(search.filter_string).blizzard.exact then
print('Error: Auto Buy does not support Blizzard filters')
aux.print('Error: Auto Buy does not support multi-queries')
elseif aux.size(queries[1].blizzard_query) > 0 and not filter_util.parse_filter_string(search.filter_string).blizzard.exact then
aux.print('Error: Auto Buy does not support Blizzard filters')
else
search.auto_buy = true
end
else
print('Invalid filter:', error)
aux.print('Invalid filter:', error)
end
end