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
+5 -5
View File
@@ -1,7 +1,7 @@
aux.module 'auctions_tab'
aux.tab(3, 'Auctions')
private.auction_records = nil
auction_records = nil
function m.LOAD()
m.create_frames()
@@ -16,7 +16,7 @@ function m.CLOSE()
m.frame:Hide()
end
function private.update_listing()
function update_listing()
if not m:ACTIVE() then
return
end
@@ -53,7 +53,7 @@ function public.scan_auctions()
}
end
function private.test(record)
function test(record)
return function(index)
local auction_info = aux.info.auction(index, 'owner')
return auction_info and auction_info.search_signature == record.search_signature
@@ -66,7 +66,7 @@ do
local state = IDLE
local found_index
function private.find_auction(record)
function find_auction(record)
if not m.listing:ContainsRecord(record) then
return
end
@@ -97,7 +97,7 @@ do
)
end
function private.on_update()
function on_update()
if state == IDLE or state == SEARCHING then
m.cancel_button:Disable()
end
+5 -5
View File
@@ -1,7 +1,7 @@
aux.module 'auctions_tab'
function private.create_frames()
private.frame = CreateFrame('Frame', nil, aux.frame)
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
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('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:Reset()
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:update_status(100, 100)
status_bar:set_text('')
private.status_bar = status_bar
status_bar = status_bar
end
do
local btn = aux.gui.button(m.frame, 16)
@@ -40,7 +40,7 @@ function private.create_frames()
btn:SetHeight(24)
btn:SetText('Cancel')
btn:Disable()
private.cancel_button = btn
cancel_button = btn
end
do
local btn = aux.gui.button(m.frame, 16)
+5 -5
View File
@@ -1,7 +1,7 @@
aux.module 'bids_tab'
aux.tab(4, 'Bids')
private.auction_records = nil
auction_records = nil
function m.LOAD()
m.create_frames()
@@ -16,7 +16,7 @@ function m.CLOSE()
m.frame:Hide()
end
function private.update_listing()
function update_listing()
if not m:ACTIVE() then
return
end
@@ -53,7 +53,7 @@ function public.scan_bids()
}
end
function private.test(record)
function test(record)
return function(index)
local auction_info = aux.info.auction(index, 'bidder')
return auction_info and auction_info.search_signature == record.search_signature
@@ -66,7 +66,7 @@ do
local state = IDLE
local found_index
function private.find_auction(record)
function find_auction(record)
if not m.listing:ContainsRecord(record) then
return
end
@@ -111,7 +111,7 @@ do
)
end
function private.on_update()
function on_update()
if state == IDLE or state == SEARCHING then
m.buyout_button:Disable()
m.bid_button:Disable()
+6 -6
View File
@@ -1,7 +1,7 @@
aux.module 'bids_tab'
function private.create_frames()
private.frame = CreateFrame('Frame', nil, aux.frame)
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
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('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:Reset()
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:update_status(100, 0)
status_bar:set_text('')
private.status_bar = status_bar
status_bar = status_bar
end
do
local btn = aux.gui.button(m.frame, 16)
@@ -44,7 +44,7 @@ function private.create_frames()
btn:SetHeight(24)
btn:SetText('Bid')
btn:Disable()
private.bid_button = btn
bid_button = btn
end
do
local btn = aux.gui.button(m.frame, 16)
@@ -53,7 +53,7 @@ function private.create_frames()
btn:SetHeight(24)
btn:SetText('Buyout')
btn:Disable()
private.buyout_button = btn
buyout_button = btn
end
do
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 settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
private.existing_auctions = {}
private.inventory_records = nil
private.scan_id = 0
private.selected_item = nil
private.refresh = nil
existing_auctions = {}
inventory_records = nil
scan_id = 0
selected_item = nil
refresh = nil
function m.LOAD()
m.create_frames()
@@ -36,7 +36,7 @@ function m.USE_ITEM(item_info)
m.select_item(item_info.item_key)
end
function private.default_settings()
function default_settings()
return {
duration = DURATION_8,
stack_size = 1,
@@ -46,7 +46,7 @@ function private.default_settings()
}
end
function private.read_settings(item_key)
function read_settings(item_key)
item_key = item_key or m.selected_item.key
local dataset = aux.persistence.load_dataset()
dataset.post = dataset.post or {}
@@ -60,7 +60,7 @@ function private.read_settings(item_key)
return settings
end
function private.write_settings(settings, item_key)
function write_settings(settings, item_key)
item_key = item_key or m.selected_item.key
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)
end
function private.get_unit_start_price()
function get_unit_start_price()
local money_text = m.unit_start_price:GetText()
return aux.money.from_string(money_text) or 0
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))
end
function private.get_unit_buyout_price()
function get_unit_buyout_price()
local money_text = m.unit_buyout_price:GetText()
return aux.money.from_string(money_text) or 0
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))
end
function private.update_inventory_listing()
function update_inventory_listing()
if not m.ACTIVE() then
return
end
@@ -98,7 +98,7 @@ function private.update_inventory_listing()
end)))
end
function private.update_auction_listing()
function update_auction_listing()
if not m.ACTIVE() then
return
end
@@ -183,7 +183,7 @@ function public.select_item(item_key)
end
end
function private.price_update()
function price_update()
if m.selected_item then
local settings = m.read_settings()
@@ -201,7 +201,7 @@ function private.price_update()
end
end
function private.post_auctions()
function post_auctions()
if m.selected_item then
local unit_start_price = m.get_unit_start_price()
local unit_buyout_price = m.get_unit_buyout_price()
@@ -247,7 +247,7 @@ function private.post_auctions()
end
end
function private.validate_parameters()
function validate_parameters()
if not m.selected_item then
m.post_button:Disable()
@@ -272,7 +272,7 @@ function private.validate_parameters()
m.post_button:Enable()
end
function private.update_item_configuration()
function update_item_configuration()
if not m.selected_item then
m.refresh_button:Disable()
@@ -327,7 +327,7 @@ function private.update_item_configuration()
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 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
end
function private.quantity_update(max_count)
function quantity_update(max_count)
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())
m.stack_count_slider:SetMinMaxValues(1, max_stack_count)
@@ -350,7 +350,7 @@ function private.quantity_update(max_count)
m.refresh = true
end
function private.unit_vendor_price(item_key)
function unit_vendor_price(item_key)
for slot in aux.util.inventory() do
@@ -374,7 +374,7 @@ function private.unit_vendor_price(item_key)
end
end
function private.update_historical_value_button()
function update_historical_value_button()
if m.selected_item then
local historical_value = aux.history.value(m.selected_item.key)
m.historical_value_button.amount = historical_value
@@ -382,7 +382,7 @@ function private.update_historical_value_button()
end
end
function private.set_item(item)
function set_item(item)
local settings = m.read_settings(item.key)
item.unit_vendor_price = m.unit_vendor_price(item.key)
@@ -417,7 +417,7 @@ function private.set_item(item)
m.refresh = true
end
function private.update_inventory_records()
function update_inventory_records()
m.inventory_records = {}
m.refresh = true
@@ -470,7 +470,7 @@ function private.update_inventory_records()
m.refresh = true
end
function private.refresh_entries()
function refresh_entries()
if m.selected_item then
local item_id, suffix_id = m.selected_item.item_id, m.selected_item.suffix_id
local item_key = item_id..':'..suffix_id
@@ -518,7 +518,7 @@ function private.refresh_entries()
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 {}
local entry
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
end
function private.on_update()
function on_update()
if m.refresh then
m.refresh = false
m.price_update()
@@ -557,7 +557,7 @@ function private.on_update()
m.validate_parameters()
end
function private.initialize_duration_dropdown()
function initialize_duration_dropdown()
local function on_click()
UIDropDownMenu_SetSelectedValue(m.duration_dropdown, this.value)
+21 -21
View File
@@ -1,7 +1,7 @@
aux.module 'post_tab'
function private.create_frames()
private.frame = CreateFrame('Frame', nil, aux.frame)
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide()
@@ -35,12 +35,12 @@ function private.create_frames()
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText('Show hidden items')
private.show_hidden_checkbox = checkbox
show_hidden_checkbox = checkbox
end
aux.gui.horizontal_line(m.frame.inventory, -48)
private.item_listing = aux.item_listing.create(
item_listing = aux.item_listing.create(
m.frame.inventory,
function()
if arg1 == 'LeftButton' then
@@ -56,7 +56,7 @@ function private.create_frames()
end
)
private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions)
auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions)
m.auction_listing:SetColInfo({
{ name='Auctions', width=.12, 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:update_status(100, 100)
status_bar:set_text('')
private.status_bar = status_bar
status_bar = status_bar
end
do
local btn = aux.gui.button(m.frame.parameters, 16)
@@ -96,7 +96,7 @@ function private.create_frames()
btn:SetHeight(24)
btn:SetText('Post')
btn:SetScript('OnClick', m.post_auctions)
private.post_button = btn
post_button = btn
end
do
local btn = aux.gui.button(m.frame.parameters, 16)
@@ -109,7 +109,7 @@ function private.create_frames()
m.refresh_entries()
m.refresh = true
end)
private.refresh_button = btn
refresh_button = btn
end
do
local item = aux.gui.item(m.frame.parameters)
@@ -122,7 +122,7 @@ function private.create_frames()
item.button:SetScript('OnLeave', function()
GameTooltip:Hide()
end)
private.item = item
item = item
end
do
local slider = aux.gui.slider(m.frame.parameters)
@@ -153,7 +153,7 @@ function private.create_frames()
slider.editbox:SetNumeric(true)
slider.editbox:SetMaxLetters(3)
slider.label:SetText('Stack Size')
private.stack_size_slider = slider
stack_size_slider = slider
end
do
local slider = aux.gui.slider(m.frame.parameters)
@@ -176,7 +176,7 @@ function private.create_frames()
end)
slider.editbox:SetNumeric(true)
slider.label:SetText('Stack Count')
private.stack_count_slider = slider
stack_count_slider = slider
end
do
local dropdown = aux.gui.dropdown(m.frame.parameters)
@@ -189,12 +189,12 @@ function private.create_frames()
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown)
end)
private.duration_dropdown = dropdown
duration_dropdown = dropdown
end
do
local label = aux.gui.label(m.frame.parameters, aux.gui.config.medium_font_size)
label:SetPoint('LEFT', m.duration_dropdown, 'RIGHT', 25, 0)
private.deposit = label
deposit = label
end
do
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)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText('Hide this item')
private.hide_checkbox = checkbox
hide_checkbox = checkbox
end
do
local frame = CreateFrame('Frame', nil, m.frame.parameters)
private.start_price_frame = frame
start_price_frame = frame
aux.gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60)
frame:SetWidth(180)
@@ -260,13 +260,13 @@ function private.create_frames()
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
private.start_price_percentage = label
start_price_percentage = label
end
private.unit_start_price = editbox
unit_start_price = editbox
end
do
local frame = CreateFrame('Frame', nil, m.frame.parameters)
private.buyout_price_frame = frame
buyout_price_frame = frame
aux.gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19)
frame:SetWidth(180)
@@ -315,9 +315,9 @@ function private.create_frames()
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
private.buyout_price_percentage = label
buyout_price_percentage = label
end
private.unit_buyout_price = editbox
unit_buyout_price = editbox
end
do
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)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText('Historical Value')
private.historical_value_button = btn
historical_value_button = btn
end
end
+3 -3
View File
@@ -48,7 +48,7 @@ do
}
end
private.RESULTS, private.SAVED, private.FILTER = 1, 2, 3
RESULTS, SAVED, FILTER = 1, 2, 3
function m.LOAD()
m.create_frames()
@@ -79,7 +79,7 @@ function m.USE_ITEM(item_info)
m.execute(nil, false)
end
function private.update_tab(tab)
function update_tab(tab)
m.search_results_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)
end
function private.blizzard_page_index(str)
function blizzard_page_index(str)
if tonumber(str) then
return max(0, tonumber(str) - 1)
end
+23 -23
View File
@@ -1,11 +1,11 @@
aux.module 'search_tab'
function private.valid_level(str)
function valid_level(str)
local level = tonumber(str)
return level and aux.util.bound(1, 60, level)
end
private.blizzard_query = setmetatable({}, {
blizzard_query = setmetatable({}, {
__newindex = function(_, key, value)
if key == 'name' then
m.name_input:SetText(value)
@@ -58,7 +58,7 @@ private.blizzard_query = setmetatable({}, {
end,
})
function private.update_form()
function update_form()
if m.blizzard_query.class and GetAuctionItemSubClasses(m.blizzard_query.class) then
m.subclass_dropdown.button:Enable()
else
@@ -99,7 +99,7 @@ function private.update_form()
end
end
function private.get_filter_builder_query()
function get_filter_builder_query()
local query_string
local function add(part)
@@ -140,7 +140,7 @@ function private.get_filter_builder_query()
return query_string or ''
end
function private.set_form(components)
function set_form(components)
m.clear_form()
for key, filter in components.blizzard do
m.blizzard_query[key] = filter[2]
@@ -151,7 +151,7 @@ function private.set_form(components)
m.update_filter_display()
end
function private.clear_form()
function clear_form()
m.blizzard_query.name = ''
m.name_input:ClearFocus()
m.blizzard_query.exact = false
@@ -170,7 +170,7 @@ function private.clear_form()
m.update_filter_display()
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(), '^([^;]*)')))
if components then
m.set_form(components)
@@ -179,7 +179,7 @@ function private.import_query_string()
end
end
function private.export_query_string()
function export_query_string()
m.search_box:SetText(m.get_filter_builder_query())
m.filter_parameter_input:ClearFocus()
end
@@ -228,14 +228,14 @@ function public.formatted_post_filter(components)
return '<html><body><p>'..str..'</p></body></html>'
end
function private.data_link(id, str)
function data_link(id, str)
return '|H'..id..'|h'..str..'|h'
end
private.post_filter = {}
private.filter_builder_state = {selected = 0}
post_filter = {}
filter_builder_state = {selected = 0}
function private.data_link_click()
function data_link_click()
local button = arg3
local index = tonumber(arg1)
if button == 'LeftButton' then
@@ -246,7 +246,7 @@ function private.data_link_click()
m.update_filter_display()
end
function private.remove_component(index)
function remove_component(index)
index = index or m.filter_builder_state.selected
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)))
@@ -255,12 +255,12 @@ function private.remove_component(index)
tremove(m.post_filter, index)
end
function private.add_component(component)
function add_component(component)
m.filter_builder_state.selected = m.filter_builder_state.selected + 1
tinsert(m.post_filter, m.filter_builder_state.selected, component)
end
function private.add_post_filter()
function add_post_filter()
for str in aux.util.present(m.filter_input:GetText()) do
for filter in aux.util.present(aux.filter.filters[str]) do
if filter.input_type ~= '' then
@@ -285,14 +285,14 @@ end
do
local text = ''
function private.update_filter_display()
function update_filter_display()
text = m.formatted_post_filter(m.post_filter)
m.filter_display:SetWidth(m.filter_display_size())
m.set_filter_display_offset()
m.filter_display:SetText(text)
end
function private.filter_display_size()
function filter_display_size()
local font, font_size = m.filter_display:GetFont()
m.filter_display.measure:SetFont(font, font_size)
local lines = 0
@@ -306,7 +306,7 @@ do
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()
x_offset, y_offset = x_offset or scroll_frame:GetHorizontalScroll(), y_offset or scroll_frame:GetVerticalScroll()
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))
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
UIDropDownMenu_AddButton{
text = filter,
@@ -338,7 +338,7 @@ function private.initialize_filter_dropdown()
end
end
function private.initialize_class_dropdown()
function initialize_class_dropdown()
local function on_click()
if this.value ~= m.blizzard_query.class then
UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value)
@@ -365,7 +365,7 @@ function private.initialize_class_dropdown()
end
end
function private.initialize_subclass_dropdown()
function initialize_subclass_dropdown()
local function on_click()
if this.value ~= m.blizzard_query.subclass then
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value)
@@ -394,7 +394,7 @@ function private.initialize_subclass_dropdown()
end
end
function private.initialize_slot_dropdown()
function initialize_slot_dropdown()
local function on_click()
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, this.value)
m.update_form()
@@ -420,7 +420,7 @@ function private.initialize_slot_dropdown()
end
end
function private.initialize_quality_dropdown()
function initialize_quality_dropdown()
local function on_click()
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, this.value)
m.update_form()
+39 -39
View File
@@ -1,9 +1,9 @@
aux.module 'search_tab'
private.FILTER_SPACING = 28.5
FILTER_SPACING = 28.5
function private.create_frames()
private.frame = CreateFrame('Frame', nil, aux.frame)
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide()
@@ -49,7 +49,7 @@ function private.create_frames()
fake_icon_part:SetText('_')
end
private.settings_button = btn
settings_button = btn
end
do
local panel = CreateFrame('Frame', nil, m.frame)
@@ -59,14 +59,14 @@ function private.create_frames()
panel:SetPoint('RIGHT', 0, 0)
panel:SetHeight(42)
panel:Hide()
private.settings = panel
settings = panel
end
do
local panel = CreateFrame('Frame', nil, m.frame)
panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 1)
panel:SetHeight(40)
private.controls = panel
controls = panel
end
do
local editbox = aux.gui.editbox(m.settings)
@@ -97,7 +97,7 @@ function private.create_frames()
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages')
label:SetTextColor(unpack(aux.gui.color.text.enabled))
private.first_page_input = editbox
first_page_input = editbox
end
do
local editbox = aux.gui.editbox(m.settings)
@@ -128,7 +128,7 @@ function private.create_frames()
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
label:SetText('-')
label:SetTextColor(unpack(aux.gui.color.text.enabled))
private.last_page_input = editbox
last_page_input = editbox
end
do
local btn = aux.gui.checkbutton(m.settings)
@@ -158,7 +158,7 @@ function private.create_frames()
StaticPopup_Show('AUX_SEARCH_AUTO_BUY')
end
end)
private.auto_buy_button = btn
auto_buy_button = btn
end
do
local btn = aux.gui.checkbutton(m.settings)
@@ -186,7 +186,7 @@ function private.create_frames()
btn:SetScript('OnLeave', function()
GameTooltip:Hide()
end)
private.auto_buy_filter_button = btn
auto_buy_filter_button = btn
end
do
local btn = aux.gui.button(m.controls, 25)
@@ -195,7 +195,7 @@ function private.create_frames()
btn:SetHeight(25)
btn:SetText('<')
btn:SetScript('OnClick', m.previous_search)
private.previous_button = btn
previous_button = btn
end
do
local btn = aux.gui.button(m.controls, 25)
@@ -204,7 +204,7 @@ function private.create_frames()
btn:SetHeight(25)
btn:SetText('>')
btn:SetScript('OnClick', m.next_search)
private.next_button = btn
next_button = btn
end
do
local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size)
@@ -219,7 +219,7 @@ function private.create_frames()
end
m.execute()
end)
private.start_button = btn
start_button = btn
end
do
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()
aux.scan.abort(m.search_scan_id)
end)
private.stop_button = btn
stop_button = btn
end
do
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()
m.execute(true)
end)
private.resume_button = btn
resume_button = btn
end
do
local editbox = aux.gui.editbox(m.controls)
@@ -257,7 +257,7 @@ function private.create_frames()
this:HighlightText(0, 0)
end)
editbox:SetScript('OnEnterPressed', m.execute)
private.search_box = editbox
search_box = editbox
end
do
aux.gui.horizontal_line(m.frame, -40)
@@ -269,7 +269,7 @@ function private.create_frames()
btn:SetHeight(22)
btn:SetText('Search Results')
btn:SetScript('OnClick', function() m.update_tab(m.RESULTS) end)
private.search_results_button = btn
search_results_button = btn
end
do
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:SetText('Saved Searches')
btn:SetScript('OnClick', function() m.update_tab(m.SAVED) end)
private.saved_searches_button = btn
saved_searches_button = btn
end
do
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:SetText('Filter Builder')
btn:SetScript('OnClick', function() m.update_tab(m.FILTER) end)
private.new_filter_button = btn
new_filter_button = btn
end
do
local frame = CreateFrame('Frame', nil, m.frame)
frame:SetWidth(265)
frame:SetHeight(25)
frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
private.status_bar_frame = frame
status_bar_frame = frame
end
do
local btn = aux.gui.button(m.frame.results, 16)
@@ -303,7 +303,7 @@ function private.create_frames()
btn:SetHeight(24)
btn:SetText('Bid')
btn:Disable()
private.bid_button = btn
bid_button = btn
end
do
local btn = aux.gui.button(m.frame.results, 16)
@@ -312,7 +312,7 @@ function private.create_frames()
btn:SetHeight(24)
btn:SetText('Buyout')
btn:Disable()
private.buyout_button = btn
buyout_button = btn
end
do
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)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name')
private.name_input = editbox
name_input = editbox
end
do
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)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Exact')
private.exact_checkbox = checkbox
exact_checkbox = checkbox
end
do
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)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Level Range')
private.min_level_input = editbox
min_level_input = editbox
end
do
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)
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText('-')
private.max_level_input = editbox
max_level_input = editbox
end
do
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)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Usable')
private.usable_checkbox = checkbox
usable_checkbox = checkbox
end
do
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:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
@@ -477,7 +477,7 @@ function private.create_frames()
end
do
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:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
@@ -490,7 +490,7 @@ function private.create_frames()
end
do
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:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
@@ -503,7 +503,7 @@ function private.create_frames()
end
do
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:SetWidth(300)
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)
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
label:SetText('Post Filter')
private.filter_dropdown = dropdown
filter_dropdown = dropdown
end
do
local input = aux.gui.editbox(m.frame.filter)
@@ -558,7 +558,7 @@ function private.create_frames()
m.add_post_filter()
end
end)
private.filter_input = input
filter_input = input
end
do
local input = aux.gui.editbox(m.frame.filter)
@@ -572,7 +572,7 @@ function private.create_frames()
end)
input:SetScript('OnEnterPressed', m.add_post_filter)
input:Hide()
private.filter_parameter_input = input
filter_parameter_input = input
end
do
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:SetHyperlinkFormat("format")
scroll_child.measure = scroll_child:CreateFontString()
private.filter_display = scroll_child
filter_display = scroll_child
end
private.status_bars = {}
private.tables = {}
status_bars = {}
tables = {}
for _=1,5 do
local status_bar = aux.gui.status_bar(m.frame)
status_bar:SetAllPoints(m.status_bar_frame)
@@ -689,7 +689,7 @@ function private.create_frames()
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:EnableSorting(false)
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('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:EnableSorting(false)
m.favorite_searches_listing:DisableSelection(true)
+16 -16
View File
@@ -2,18 +2,18 @@ aux.module 'search_tab'
_G.aux_auto_buy_filter = ''
private.search_scan_id = 0
private.auto_buy_validator = nil
search_scan_id = 0
auto_buy_validator = nil
do
local searches = {}
local search_index = 1
function private.current_search()
function current_search()
return searches[search_index]
end
function private.update_search(index)
function update_search(index)
searches[search_index].status_bar:Hide()
searches[search_index].table:Hide()
searches[search_index].table:SetSelectedRecord()
@@ -40,7 +40,7 @@ do
m.update_continuation()
end
function private.new_search(filter_string)
function new_search(filter_string)
while getn(searches) > search_index do
tremove(searches)
end
@@ -68,26 +68,26 @@ do
m.update_search(getn(searches))
end
function private.previous_search()
function previous_search()
m.search_box:ClearFocus()
m.update_search(search_index - 1)
m.update_tab(m.RESULTS)
end
function private.next_search()
function next_search()
m.search_box:ClearFocus()
m.update_search(search_index + 1)
m.update_tab(m.RESULTS)
end
end
function private.close_settings()
function close_settings()
if m.settings_button.open then
m.settings_button:Click()
end
end
function private.update_continuation()
function update_continuation()
if m.current_search().continuation then
m.resume_button:Show()
m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0)
@@ -97,7 +97,7 @@ function private.update_continuation()
end
end
function private.discard_continuation()
function discard_continuation()
aux.scan.abort(m.search_scan_id)
m.current_search().continuation = nil
m.update_continuation()
@@ -113,7 +113,7 @@ function private:update_start_stop()
end
end
function private.update_auto_buy_filter()
function update_auto_buy_filter()
if _G.aux_auto_buy_filter ~= '' then
local queries = aux.filter.queries(_G.aux_auto_buy_filter)
if queries then
@@ -132,7 +132,7 @@ function private.update_auto_buy_filter()
_G.aux_auto_buy_filter = ''
end
function private.start_real_time_scan(query, search, continuation)
function start_real_time_scan(query, search, continuation)
local ignore_page
if not search then
@@ -209,7 +209,7 @@ function private.start_real_time_scan(query, search, continuation)
}
end
function private.start_search(queries, continuation)
function start_search(queries, continuation)
local current_query, current_page, total_queries, start_query, start_page
local search = m.current_search()
@@ -365,7 +365,7 @@ function public.execute(resume, real_time)
end
end
function private.test(record)
function test(record)
return function(index)
local auction_info = aux.info.auction(index)
return auction_info and auction_info.search_signature == record.search_signature
@@ -378,7 +378,7 @@ do
local state = IDLE
local found_index
function private.find_auction(record)
function find_auction(record)
local search = m.current_search()
if not search.table:ContainsRecord(record) or aux.is_player(record.owner) then
@@ -429,7 +429,7 @@ do
)
end
function private.on_update()
function on_update()
if state == IDLE or state == SEARCHING then
m.buyout_button:Disable()
m.bid_button:Disable()
+2 -2
View File
@@ -3,7 +3,7 @@ aux.module 'search_tab'
_G.aux_favorite_searches = {}
_G.aux_recent_searches = {}
function private.update_search_listings()
function update_search_listings()
local favorite_search_rows = {}
for i, favorite_search in _G.aux_favorite_searches do
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)
end
function private.new_recent_search(filter_string, prettified)
function new_recent_search(filter_string, prettified)
tinsert(_G.aux_recent_searches, 1, {
filter_string = filter_string,
prettified = prettified,