nicer layout for settings
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
## Interface: 11200
|
||||
## Title: Aux
|
||||
## SavedVariablesPerCharacter: aux_ignore_owner, aux_recent_searches, aux_favorite_searches, aux_price_per_unit, aux_tooltip_value, aux_tooltip_daily, aux_tooltip_vendor_buy, aux_tooltip_vendor_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
|
||||
## SavedVariablesPerCharacter: aux_ignore_owner, aux_recent_searches, aux_favorite_searches, aux_auto_buy_filter, aux_price_per_unit, aux_tooltip_value, aux_tooltip_daily, aux_tooltip_vendor_buy, aux_tooltip_vendor_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
|
||||
## SavedVariables: aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters
|
||||
|
||||
module.lua
|
||||
|
||||
@@ -198,6 +198,9 @@ function private.scan_auctions_helper(i, k)
|
||||
|
||||
Aux.history.process_auction(auction_info)
|
||||
|
||||
if m.current_thread().params.auto_buy_validator and m.current_thread().params.auto_buy_validator(auction_info) then
|
||||
Aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price)
|
||||
end
|
||||
if not m.current_query().validator or m.current_query().validator(auction_info) then
|
||||
return m.wait_for_callback(m.current_thread().params.on_auction, auction_info, recurse)
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ end
|
||||
|
||||
function private.find_item_slot(partial)
|
||||
for slot in Aux.util.inventory() do
|
||||
if m.matching_item(slot, partial) and not Aux.util.table_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
|
||||
end
|
||||
end
|
||||
|
||||
@@ -214,7 +214,9 @@ do
|
||||
listener:set_action(function()
|
||||
if arg1 == ERR_AUCTION_BID_PLACED then
|
||||
listener:stop()
|
||||
on_success()
|
||||
if on_success then
|
||||
on_success()
|
||||
end
|
||||
locked = false
|
||||
end
|
||||
end)
|
||||
@@ -243,7 +245,9 @@ do
|
||||
listener:set_action(function()
|
||||
if arg1 == ERR_AUCTION_REMOVED then
|
||||
listener:stop()
|
||||
on_success()
|
||||
if on_success then
|
||||
on_success()
|
||||
end
|
||||
locked = false
|
||||
end
|
||||
end)
|
||||
@@ -355,7 +359,7 @@ function private.SetItemRef(...)
|
||||
local item_info = m.info.item(tonumber(({strfind(itemstring, '^item:(%d+)')})[3]))
|
||||
if item_info then
|
||||
m.search_tab.set_filter(strlower(item_info.name)..'/exact')
|
||||
m.search_tab.disable_sniping()
|
||||
m.search_tab.real_time_checkbox:SetChecked(nil)
|
||||
m.search_tab.execute()
|
||||
return
|
||||
end
|
||||
@@ -374,7 +378,7 @@ function private.UseContainerItem(...)
|
||||
item_info = item_info and m.info.item(item_info.item_id)
|
||||
if item_info then
|
||||
m.search_tab.set_filter(strlower(item_info.name)..'/exact')
|
||||
m.search_tab.disable_sniping()
|
||||
m.search_tab.real_time_checkbox:SetChecked(nil)
|
||||
m.search_tab.execute()
|
||||
end
|
||||
return
|
||||
|
||||
@@ -655,7 +655,7 @@ local methods = {
|
||||
elseif Aux.unmodified() and button == 'RightButton' then -- TODO not when alt (how?)
|
||||
Aux.tab_group:set_tab(1)
|
||||
Aux.search_tab.set_filter(strlower(Aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
||||
Aux.search_tab.disable_sniping()
|
||||
Aux.search_tab.real_time_checkbox:SetChecked(nil)
|
||||
Aux.search_tab.execute()
|
||||
else
|
||||
local selection = this.rt:GetSelection()
|
||||
|
||||
@@ -46,12 +46,12 @@ function public.scan_auctions()
|
||||
end,
|
||||
on_complete = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Scanning')
|
||||
m.status_bar:set_text('Scan complete')
|
||||
m.update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Scanning')
|
||||
m.status_bar:set_text('Scan aborted')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
+2
-2
@@ -46,12 +46,12 @@ function public.scan_bids()
|
||||
end,
|
||||
on_complete = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Scanning')
|
||||
m.status_bar:set_text('Scan complete')
|
||||
m.update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Scanning')
|
||||
m.status_bar:set_text('Scan aborted')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
+2
-2
@@ -505,13 +505,13 @@ function private.refresh_entries()
|
||||
m.existing_auctions[item_key] = nil
|
||||
m.update_historical_value_button()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Scanning')
|
||||
m.status_bar:set_text('Scan aborted')
|
||||
end,
|
||||
on_complete = function()
|
||||
m.existing_auctions[item_key] = m.existing_auctions[item_key] or {}
|
||||
m.refresh = true
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Scanning')
|
||||
m.status_bar:set_text('Scan complete')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -82,7 +82,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
|
||||
elseif arg1 == 'RightButton' then
|
||||
Aux.tab_group:set_tab(1)
|
||||
Aux.search_tab.set_filter(strlower(Aux.info.item(this.item_record.item_id).name)..'/exact')
|
||||
Aux.search_tab.disable_sniping()
|
||||
Aux.search_tab.real_time_checkbox:SetChecked(nil)
|
||||
Aux.search_tab.execute()
|
||||
end
|
||||
end,
|
||||
|
||||
+66
-50
@@ -2,10 +2,10 @@ local m, public, private = Aux.tab(1, 'search_tab')
|
||||
|
||||
aux_favorite_searches = {}
|
||||
aux_recent_searches = {}
|
||||
aux_auto_buy_filter = ''
|
||||
|
||||
private.search_scan_id = 0
|
||||
private.snipe_auto = nil
|
||||
private.snipe = nil
|
||||
private.auto_buy_validator = nil
|
||||
|
||||
private.popup_info = {
|
||||
rename = {}
|
||||
@@ -49,7 +49,7 @@ StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = {
|
||||
hideOnEscape = 1,
|
||||
}
|
||||
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
text = 'Do you want to activate automatic buyout?',
|
||||
text = 'Are you sure you want to activate automatic buyout?',
|
||||
button1 = 'Yes',
|
||||
button2 = 'No',
|
||||
OnAccept = function()
|
||||
@@ -59,11 +59,28 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
hideOnEscape = 1,
|
||||
}
|
||||
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY_FILTER'] = {
|
||||
text = 'Do you want to activate the automatic buyout filter?',
|
||||
text = 'Are you sure you want to set this filter for automatic buyout?',
|
||||
button1 = 'Yes',
|
||||
button2 = 'No',
|
||||
OnAccept = function()
|
||||
m.auto_buy_filter_checkbox:SetChecked(1)
|
||||
local queries = Aux.scan_util.parse_filter_string(m.auto_buy_filter_editbox:GetText())
|
||||
if queries then
|
||||
|
||||
if getn(queries) > 1 then
|
||||
Aux.log('Error: The auto buy filter supports only one query')
|
||||
return
|
||||
end
|
||||
|
||||
if Aux.util.size(queries[1].blizzard_query) > 0 then
|
||||
Aux.log('Error: The real time mode does not support blizzard filters')
|
||||
return
|
||||
end
|
||||
|
||||
aux_auto_buy_filter = m.auto_buy_filter_editbox:GetText()
|
||||
m.auto_buy_validator = queries[1].validator
|
||||
m.auto_buy_filter_checkbox:SetChecked(1)
|
||||
m.auto_buy_filter_editbox:ClearFocus()
|
||||
end
|
||||
end,
|
||||
timeout = 0,
|
||||
hideOnEscape = 1,
|
||||
@@ -83,7 +100,6 @@ end
|
||||
|
||||
function public.LOAD()
|
||||
m.create_frames(m, public, private)
|
||||
m:disable_sniping()
|
||||
m.update_search()
|
||||
m.update_tab(m.SAVED)
|
||||
end
|
||||
@@ -94,6 +110,7 @@ function public.OPEN()
|
||||
end
|
||||
|
||||
function public.CLOSE()
|
||||
m.close_settings()
|
||||
m.results_listing:SetSelectedRecord()
|
||||
m.frame:Hide()
|
||||
end
|
||||
@@ -166,6 +183,12 @@ function private.add_filter(filter_string, replace)
|
||||
m.search_box:SetText((old_filter_string or '')..filter_string)
|
||||
end
|
||||
|
||||
function private.close_settings()
|
||||
if m.settings_button.open then
|
||||
m.settings_button:Click()
|
||||
end
|
||||
end
|
||||
|
||||
function private.clear_form()
|
||||
m.name_input:SetText('')
|
||||
m.exact_checkbox:SetChecked(nil)
|
||||
@@ -176,8 +199,6 @@ function private.clear_form()
|
||||
UIDropDownMenu_ClearAll(m.subclass_dropdown)
|
||||
UIDropDownMenu_ClearAll(m.slot_dropdown)
|
||||
UIDropDownMenu_ClearAll(m.quality_dropdown)
|
||||
m.first_page_editbox:SetText('')
|
||||
m.last_page_editbox:SetText('')
|
||||
end
|
||||
|
||||
function private.get_form_filter()
|
||||
@@ -225,20 +246,13 @@ function private.get_form_filter()
|
||||
add(strlower(getglobal('ITEM_QUALITY'..quality..'_DESC')))
|
||||
end
|
||||
|
||||
local first_page, last_page = tonumber(m.first_page_editbox:GetText()), tonumber(m.last_page_editbox:GetText())
|
||||
first_page = first_page and max(1, first_page)
|
||||
last_page = last_page and max(1, last_page)
|
||||
if first_page or last_page then
|
||||
add((first_page or '') .. ':' .. (last_page or ''))
|
||||
end
|
||||
|
||||
return filter_term
|
||||
end
|
||||
|
||||
function private.discard_continuation()
|
||||
Aux.scan.abort(m.search_scan_id)
|
||||
m.current_search().continuation = nil
|
||||
m.update_resume()
|
||||
m.update_continuation()
|
||||
end
|
||||
|
||||
function private:enable_stop()
|
||||
@@ -252,19 +266,7 @@ function private:enable_start()
|
||||
m.stop_button:Hide()
|
||||
end
|
||||
|
||||
function public.enable_sniping()
|
||||
Aux.scan.abort(m.search_scan_id)
|
||||
m.snipe = true
|
||||
m.settings_button:LockHighlight()
|
||||
end
|
||||
|
||||
function public.disable_sniping()
|
||||
Aux.scan.abort(m.search_scan_id)
|
||||
m.snipe = false
|
||||
m.settings_button:UnlockHighlight()
|
||||
end
|
||||
|
||||
function private.start_sniping(query, search, continuation)
|
||||
function private.start_real_time_scan(query, search, continuation)
|
||||
|
||||
local ignore_page
|
||||
if not search then
|
||||
@@ -279,9 +281,10 @@ function private.start_sniping(query, search, continuation)
|
||||
m.search_scan_id = Aux.scan.start{
|
||||
type = 'list',
|
||||
queries = {query},
|
||||
auto_buy_validator = m.auto_buy_validator,
|
||||
on_scan_start = function()
|
||||
m.status_bar:update_status(99.99, 99.99)
|
||||
m.status_bar:set_text('Sniping ...')
|
||||
m.status_bar:set_text('Scanning last page ...')
|
||||
end,
|
||||
on_page_loaded = function(_, _, last_page)
|
||||
next_page = last_page
|
||||
@@ -289,10 +292,11 @@ function private.start_sniping(query, search, continuation)
|
||||
ignore_page = false
|
||||
end
|
||||
end,
|
||||
on_auction = function(auction_record)
|
||||
on_auction = function(auction_record, ctrl)
|
||||
if not ignore_page then
|
||||
if m.settings_button.auto then
|
||||
PlaceAuctionBid('list', auction_record.index, auction_record.buyout_price)
|
||||
if m.auto_buy_checkbox:GetChecked() then
|
||||
ctrl.suspend()
|
||||
Aux.place_bid('list', auction_record.index, auction_record.buyout_price, ctrl.resume)
|
||||
else
|
||||
tinsert(new_records, auction_record)
|
||||
end
|
||||
@@ -320,16 +324,16 @@ function private.start_sniping(query, search, continuation)
|
||||
|
||||
query.blizzard_query.first_page = next_page
|
||||
query.blizzard_query.last_page = next_page
|
||||
m.start_sniping(query, search)
|
||||
m.start_real_time_scan(query, search)
|
||||
end,
|
||||
on_abort = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Sniping')
|
||||
m.status_bar:set_text('Scan paused')
|
||||
|
||||
search.continuation = next_page or not ignore_page and query.blizzard_query.first_page or true
|
||||
|
||||
if m.current_search() == search then
|
||||
m.update_resume()
|
||||
m.update_continuation()
|
||||
end
|
||||
|
||||
m:enable_start()
|
||||
@@ -357,6 +361,7 @@ function private.start_search(queries, continuation)
|
||||
m.search_scan_id = Aux.scan.start{
|
||||
type = 'list',
|
||||
queries = queries,
|
||||
auto_buy_validator = m.auto_buy_validator,
|
||||
on_scan_start = function()
|
||||
m.status_bar:update_status(0,0)
|
||||
if continuation then
|
||||
@@ -380,8 +385,11 @@ function private.start_search(queries, continuation)
|
||||
current_query = current_query and current_query + 1 or start_query
|
||||
current_page = current_page and 0 or start_page - 1
|
||||
end,
|
||||
on_auction = function(auction_record)
|
||||
if getn(search.records) < 1000 then
|
||||
on_auction = function(auction_record, ctrl)
|
||||
if m.auto_buy_checkbox:GetChecked() then
|
||||
ctrl.suspend()
|
||||
Aux.place_bid('list', auction_record.index, auction_record.buyout_price, ctrl.resume)
|
||||
elseif getn(search.records) < 1000 then
|
||||
tinsert(search.records, auction_record)
|
||||
if getn(search.records) == 1000 then
|
||||
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
|
||||
@@ -390,7 +398,7 @@ function private.start_search(queries, continuation)
|
||||
end,
|
||||
on_complete = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Scanning')
|
||||
m.status_bar:set_text('Scan complete')
|
||||
|
||||
if m.current_search() == search and m.frame.results:IsVisible() and getn(search.records) == 0 then
|
||||
m.update_tab(m.SAVED)
|
||||
@@ -400,7 +408,7 @@ function private.start_search(queries, continuation)
|
||||
end,
|
||||
on_abort = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Done Scanning')
|
||||
m.status_bar:set_text('Scan paused')
|
||||
|
||||
if current_query then
|
||||
search.continuation = {current_query, current_page + 1}
|
||||
@@ -408,7 +416,7 @@ function private.start_search(queries, continuation)
|
||||
search.continuation = {start_query, start_page}
|
||||
end
|
||||
if m.current_search() == search then
|
||||
m.update_resume()
|
||||
m.update_continuation()
|
||||
end
|
||||
|
||||
m.enable_start()
|
||||
@@ -425,7 +433,7 @@ function public.execute(resume)
|
||||
local queries = Aux.scan_util.parse_filter_string(filter_string)
|
||||
if not queries then
|
||||
return
|
||||
elseif m.snipe then
|
||||
elseif m.real_time_checkbox:GetChecked() then
|
||||
if getn(queries) > 1 then
|
||||
Aux.log('Invalid filter: The sniping mode does not support multiple queries')
|
||||
return
|
||||
@@ -442,7 +450,7 @@ function public.execute(resume)
|
||||
if resume then
|
||||
m.results_listing:SetSelectedRecord()
|
||||
else
|
||||
if m.current_search().snipe ~= m.snipe then
|
||||
if m.current_search().real_time ~= m.real_time_checkbox:GetChecked() then
|
||||
m.results_listing:Reset()
|
||||
end
|
||||
m.current_search().records = {}
|
||||
@@ -454,12 +462,20 @@ function public.execute(resume)
|
||||
m.discard_continuation()
|
||||
m:enable_stop()
|
||||
|
||||
m.close_settings()
|
||||
m.update_tab(m.RESULTS)
|
||||
if m.snipe then
|
||||
m.current_search().snipe = true
|
||||
m.start_sniping(queries[1], nil, continuation)
|
||||
m.current_search().real_time = m.real_time_checkbox:GetChecked()
|
||||
if m.real_time_checkbox:GetChecked() then
|
||||
m.start_real_time_scan(queries[1], nil, continuation)
|
||||
else
|
||||
m.current_search().snipe = false
|
||||
for _, query in queries do
|
||||
if tonumber(m.first_page_input:GetText()) then
|
||||
query.blizzard_query.first_page = Aux.round(max(0, m.first_page_input:GetNumber() - 1))
|
||||
end
|
||||
if tonumber(m.last_page_input:GetText()) then
|
||||
query.blizzard_query.last_page = Aux.round(max(0, m.last_page_input:GetNumber() - 1))
|
||||
end
|
||||
end
|
||||
m.start_search(queries, continuation)
|
||||
end
|
||||
end
|
||||
@@ -557,8 +573,8 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function private.update_resume()
|
||||
if m.current_search().continuation and m.current_search().snipe == m.snipe then
|
||||
function private.update_continuation()
|
||||
if m.current_search().continuation and m.current_search().real_time == m.real_time_checkbox:GetChecked() then
|
||||
m.resume_button:Show()
|
||||
m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0)
|
||||
else
|
||||
@@ -596,7 +612,7 @@ do
|
||||
m.next_button:Show()
|
||||
m.search_box:SetPoint('LEFT', m.next_button, 'RIGHT', 4, 0)
|
||||
end
|
||||
m.update_resume()
|
||||
m.update_continuation()
|
||||
end
|
||||
|
||||
function private.new_search(filter_string, prettified)
|
||||
|
||||
+54
-62
@@ -30,31 +30,29 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
local t1 = btn:CreateTexture()
|
||||
t1:SetTexture(unpack(Aux.gui.config.text_color.enabled))
|
||||
t1:SetWidth(20)
|
||||
t1:SetHeight(3)
|
||||
t1:SetPoint('CENTER', 0, 7)
|
||||
t1:SetHeight(2.5)
|
||||
t1:SetPoint('CENTER', 0, 6.7)
|
||||
local t2 = btn:CreateTexture()
|
||||
t2:SetTexture(unpack(Aux.gui.config.text_color.enabled))
|
||||
t2:SetWidth(20)
|
||||
t2:SetHeight(3)
|
||||
t2:SetHeight(2.5)
|
||||
t2:SetPoint('CENTER', 0, 0)
|
||||
local t3 = btn:CreateTexture()
|
||||
t3:SetTexture(unpack(Aux.gui.config.text_color.enabled))
|
||||
t3:SetWidth(20)
|
||||
t3:SetHeight(3)
|
||||
t3:SetPoint('CENTER', 0, -7)
|
||||
-- btn:SetText('_\n_\n_')
|
||||
-- btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
t3:SetHeight(2.5)
|
||||
t3:SetPoint('CENTER', 0, -6.7)
|
||||
btn:SetScript('OnClick', function()
|
||||
this.open = not this.open
|
||||
if this.open then
|
||||
m.settings:Show()
|
||||
m.controls:Hide()
|
||||
else
|
||||
m.settings:Hide()
|
||||
m.controls:Show()
|
||||
else
|
||||
Aux.scan.abort(m.search_scan_id)
|
||||
m.settings:Show()
|
||||
m.controls:Hide()
|
||||
end
|
||||
this.open = not this.open
|
||||
end)
|
||||
btn.open = false
|
||||
private.settings_button = btn
|
||||
end
|
||||
do
|
||||
@@ -75,66 +73,62 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.settings)
|
||||
editbox:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
||||
editbox:SetPoint('LEFT', 55, 0)
|
||||
editbox:SetPoint('LEFT', 49, 0)
|
||||
editbox:SetWidth(30)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.max_level_input:SetFocus()
|
||||
else
|
||||
m.last_page_editbox:SetFocus()
|
||||
end
|
||||
m.last_page_input:SetFocus()
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 15)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -10, 0)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -5, 0)
|
||||
label:SetText('Pages')
|
||||
private.first_page_editbox = editbox
|
||||
private.first_page_input = editbox
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.settings)
|
||||
editbox:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
||||
editbox:SetPoint('LEFT', m.first_page_editbox, 'RIGHT', 10, 0)
|
||||
editbox:SetPoint('LEFT', m.first_page_input, 'RIGHT', 10, 0)
|
||||
editbox:SetWidth(30)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.first_page_editbox:SetFocus()
|
||||
else
|
||||
m.name_input:SetFocus()
|
||||
end
|
||||
m.first_page_input:SetFocus()
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 15)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
||||
label:SetText('-')
|
||||
private.last_page_editbox = editbox
|
||||
private.last_page_input = editbox
|
||||
end
|
||||
do
|
||||
local checkbox = CreateFrame('CheckButton', nil, m.settings, 'UICheckButtonTemplate')
|
||||
checkbox:SetWidth(22)
|
||||
checkbox:SetHeight(22)
|
||||
checkbox:SetPoint('LEFT', 190, 0)
|
||||
checkbox:SetPoint('LEFT', 194, 0)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
if m.snipe then
|
||||
m.disable_sniping()
|
||||
m.update_continuation()
|
||||
if this:GetChecked() then
|
||||
m.first_page_input:EnableMouse(nil)
|
||||
m.last_page_input:EnableMouse(nil)
|
||||
m.first_page_input:ClearFocus()
|
||||
m.last_page_input:ClearFocus()
|
||||
else
|
||||
m.enable_sniping()
|
||||
m.first_page_input:EnableMouse(true)
|
||||
m.last_page_input:EnableMouse(true)
|
||||
end
|
||||
m.update_resume()
|
||||
end)
|
||||
local label = Aux.gui.label(checkbox, 15)
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -7, 0)
|
||||
label:SetText('Sniping')
|
||||
private.snipe_checkbox = checkbox
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -2, 0)
|
||||
label:SetText('Real Time')
|
||||
public.real_time_checkbox = checkbox
|
||||
end
|
||||
do
|
||||
local checkbox = CreateFrame('CheckButton', nil, m.settings, 'UICheckButtonTemplate')
|
||||
@@ -148,7 +142,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
end)
|
||||
local label = Aux.gui.label(checkbox, 15)
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -7, 0)
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -2, 0)
|
||||
label:SetText('Auto Buy')
|
||||
private.auto_buy_checkbox = checkbox
|
||||
end
|
||||
@@ -156,17 +150,17 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
local checkbox = CreateFrame('CheckButton', nil, m.settings, 'UICheckButtonTemplate')
|
||||
checkbox:SetWidth(22)
|
||||
checkbox:SetHeight(22)
|
||||
checkbox:SetPoint('LEFT', 405, 0)
|
||||
checkbox:SetPoint('LEFT', 400, 0)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
if this:GetChecked() then
|
||||
this:SetChecked(nil)
|
||||
if Aux.scan_util.parse_filter_string(m.auto_buy_filter_editbox:GetText()) then
|
||||
StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER')
|
||||
end
|
||||
StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER')
|
||||
else
|
||||
m.auto_buy_validator = nil
|
||||
end
|
||||
end)
|
||||
local label = Aux.gui.label(checkbox, 15)
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -7, 0)
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -2, 0)
|
||||
label:SetText('Auto Buy Filter')
|
||||
private.auto_buy_filter_checkbox = checkbox
|
||||
end
|
||||
@@ -176,8 +170,8 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:EnableMouse(1)
|
||||
editbox.complete = Aux.completion.complete_filter
|
||||
editbox:SetPoint('LEFT', 430, 0)
|
||||
editbox:SetWidth(290)
|
||||
editbox:SetPoint('RIGHT', -9, 0)
|
||||
editbox:SetWidth(293)
|
||||
editbox:SetHeight(25)
|
||||
editbox:SetScript('OnChar', function()
|
||||
this:complete()
|
||||
@@ -188,8 +182,11 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:HighlightText(0, 0)
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
m.auto_buy_filter_checkbox:SetChecked(nil)
|
||||
end)
|
||||
editbox:SetText(aux_auto_buy_filter)
|
||||
private.auto_buy_filter_editbox = editbox
|
||||
end
|
||||
do
|
||||
@@ -212,7 +209,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(m.controls, 22)
|
||||
btn:SetPoint('TOPRIGHT', -5, -7)
|
||||
btn:SetPoint('RIGHT', -5, 0)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Start')
|
||||
@@ -227,7 +224,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(m.controls, 22)
|
||||
btn:SetPoint('TOPRIGHT', -5, -7)
|
||||
btn:SetPoint('RIGHT', -5, 0)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Stop')
|
||||
@@ -270,7 +267,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
local item_info = Aux.cursor_item() and Aux.info.item(Aux.cursor_item().item_id)
|
||||
if item_info then
|
||||
m.set_filter(strlower(item_info.name)..'/exact')
|
||||
m.disable_sniping()
|
||||
m.real_time_checkbox:SetChecked(nil)
|
||||
m.execute()
|
||||
end
|
||||
ClearCursor()
|
||||
@@ -398,7 +395,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.frame.filter)
|
||||
editbox.complete_item = Aux.completion.complete(function() return aux_auctionable_items end)
|
||||
editbox:SetPoint('TOPLEFT', 14, -20)
|
||||
editbox:SetPoint('TOPLEFT', 14, -26)
|
||||
editbox:SetWidth(260)
|
||||
editbox:SetScript('OnChar', function()
|
||||
if m.exact_checkbox:GetChecked() then
|
||||
@@ -407,7 +404,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.last_page_editbox:SetFocus()
|
||||
m.max_level_input:SetFocus()
|
||||
else
|
||||
m.min_level_input:SetFocus()
|
||||
end
|
||||
@@ -433,7 +430,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.frame.filter)
|
||||
editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -22)
|
||||
editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -28)
|
||||
editbox:SetWidth(125)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(2)
|
||||
@@ -463,7 +460,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
if IsShiftKeyDown() then
|
||||
m.min_level_input:SetFocus()
|
||||
else
|
||||
m.first_page_editbox:SetFocus()
|
||||
m.name_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
@@ -471,7 +468,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
m.execute()
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
||||
label:SetText('-')
|
||||
private.max_level_input = editbox
|
||||
end
|
||||
@@ -487,7 +484,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
do
|
||||
local dropdown = Aux.gui.dropdown(m.frame.filter)
|
||||
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -18)
|
||||
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -26)
|
||||
dropdown:SetWidth(300)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
@@ -501,7 +498,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
do
|
||||
local dropdown = Aux.gui.dropdown(m.frame.filter)
|
||||
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -18)
|
||||
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -22)
|
||||
dropdown:SetWidth(300)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
@@ -515,7 +512,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
do
|
||||
local dropdown = Aux.gui.dropdown(m.frame.filter)
|
||||
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -18)
|
||||
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -22)
|
||||
dropdown:SetWidth(300)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
@@ -529,7 +526,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
do
|
||||
local dropdown = Aux.gui.dropdown(m.frame.filter)
|
||||
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -18)
|
||||
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -22)
|
||||
dropdown:SetWidth(300)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
@@ -542,11 +539,6 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
private.quality_dropdown = dropdown
|
||||
end
|
||||
Aux.gui.vertical_line(m.frame.filter, 332)
|
||||
do
|
||||
local label = Aux.gui.label(m.usable_checkbox, 13)
|
||||
label:SetPoint('BOTTOMLEFT', m.usable_checkbox, 'TOPLEFT', 1, -3)
|
||||
label:SetText('Usable')
|
||||
end
|
||||
local function add_modifier(...)
|
||||
local current_filter_string = m.search_box:GetText()
|
||||
for i=1,arg.n do
|
||||
|
||||
+9
-1
@@ -7,7 +7,15 @@ function public.id(object)
|
||||
return object
|
||||
end
|
||||
|
||||
function public.table_eq(t1, t2)
|
||||
function public.size(table)
|
||||
local x = 0
|
||||
for _ in table do
|
||||
x = x + 1
|
||||
end
|
||||
return x
|
||||
end
|
||||
|
||||
function public.eq(t1, t2)
|
||||
if not t1 or not t2 then
|
||||
return false
|
||||
end
|
||||
|
||||
+24
-32
@@ -339,7 +339,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
||||
end
|
||||
|
||||
local item_query = m.item_query(auction_record.item_id, 1, 1)
|
||||
if not Aux.util.table_eq(auction_record.blizzard_query, item_query.blizzard_query) then
|
||||
if not Aux.util.eq(auction_record.blizzard_query, item_query.blizzard_query) then
|
||||
tinsert(queries, item_query)
|
||||
end
|
||||
end
|
||||
@@ -402,7 +402,9 @@ function public.item_query(item_id, first_page, last_page)
|
||||
local item_info = Aux.info.item(item_id)
|
||||
|
||||
if item_info then
|
||||
local filter = m.filter_from_string(item_info.name..'/exact/'..(first_page or '')..':'..(last_page or ''))
|
||||
local filter = m.filter_from_string(item_info.name..'/exact')
|
||||
filter.blizzard_query.first_page = first_page
|
||||
filter.blizzard_query.last_page = last_page
|
||||
return {
|
||||
validator = filter.validator,
|
||||
blizzard_query = filter.blizzard_query,
|
||||
@@ -489,18 +491,6 @@ function public.filter_from_string(filter_term)
|
||||
return false, suggestions, error
|
||||
end
|
||||
end
|
||||
elseif strfind(str, '^%d*:%d*$') then
|
||||
if not blizzard_filter.first_page and not blizzard_filter.last_page then
|
||||
local _, _, first_page, last_page = strfind(str, '^(%d*):(%d*)$')
|
||||
if tonumber(first_page) and tonumber(first_page) < 1 or tonumber(last_page) and tonumber(last_page) < 1 then
|
||||
return false, {}, 'Erroneous page range modifier'
|
||||
end
|
||||
blizzard_filter.first_page = tonumber(first_page)
|
||||
blizzard_filter.last_page = tonumber(last_page)
|
||||
prettified:append(Aux.gui.inline_color({216, 225, 211, 1})..str..'|r')
|
||||
else
|
||||
return false, {}, 'Erroneous page range modifier'
|
||||
end
|
||||
elseif tonumber(str) then
|
||||
if tonumber(str) < 1 or tonumber(str) > 60 then
|
||||
return false, {}, 'Erroneous level range modifier'
|
||||
@@ -676,6 +666,7 @@ function public.suggestions(blizzard_filter, num_parts)
|
||||
end
|
||||
|
||||
function public.blizzard_query(filter)
|
||||
local query = { name=filter.name }
|
||||
|
||||
local item_info, class_index, subclass_index, slot_index
|
||||
if filter.exact then
|
||||
@@ -686,18 +677,25 @@ function public.blizzard_query(filter)
|
||||
slot_index = subclass_index and item_info.slot and Aux.item_slot_index(class_index, subclass_index, item_info.slot)
|
||||
end
|
||||
|
||||
return {
|
||||
first_page = filter.first_page and filter.first_page - 1,
|
||||
last_page = filter.last_page and filter.last_page - 1,
|
||||
name = filter.name,
|
||||
min_level = item_info and item_info.level or filter.min_level,
|
||||
max_level = item_info and item_info.level or filter.max_level,
|
||||
class = item_info and class_index or filter.class,
|
||||
subclass = item_info and subclass_index or filter.subclass,
|
||||
slot = item_info and item_info.class and slot_index or filter.slot,
|
||||
usable = item_info and item_info.usable or filter.usable and 1 or 0,
|
||||
quality = item_info and item_info.quality or filter.quality,
|
||||
}
|
||||
if item_info then
|
||||
query.min_level = item_info.level
|
||||
query.max_level = item_info.level
|
||||
query.class = class_index
|
||||
query.subclass = subclass_index
|
||||
query.slot = item_info.class
|
||||
query.usable = item_info.usable
|
||||
query.quality = item_info.quality
|
||||
else
|
||||
query.min_level = filter.min_level
|
||||
query.max_level = filter.max_level
|
||||
query.class = filter.class
|
||||
query.subclass = filter.subclass
|
||||
query.slot = filter.slot
|
||||
query.usable = filter.usable and 1
|
||||
query.quality = filter.quality
|
||||
end
|
||||
|
||||
return query
|
||||
end
|
||||
|
||||
function public.validator(blizzard_filter, post_filter)
|
||||
@@ -706,12 +704,6 @@ function public.validator(blizzard_filter, post_filter)
|
||||
if blizzard_filter.exact and strlower(Aux.info.item(record.item_id).name) ~= blizzard_filter.name then
|
||||
return
|
||||
end
|
||||
if blizzard_filter.min_level and record.level < blizzard_filter.min_level then
|
||||
return
|
||||
end
|
||||
if blizzard_filter.max_level and record.level > blizzard_filter.max_level then
|
||||
return
|
||||
end
|
||||
if getn(post_filter) > 0 then
|
||||
local stack = {}
|
||||
for i=getn(post_filter),1,-1 do
|
||||
|
||||
Reference in New Issue
Block a user