big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-21 06:17:53 +02:00
parent e94eaac52c
commit 40753f2ac5
31 changed files with 709 additions and 742 deletions
+41 -55
View File
@@ -1,61 +1,58 @@
aux.module 'auctions_tab'
aux.tab(3, 'Auctions')
g.aux.tab(3, 'Auctions')
auction_records = nil
function m.LOAD()
m.create_frames()
function LOAD()
create_frames()
end
function m.OPEN()
m.frame:Show()
m.scan_auctions()
function OPEN()
frame:Show()
scan_auctions()
end
function m.CLOSE()
m.frame:Hide()
function CLOSE()
frame:Hide()
end
function update_listing()
if not m:ACTIVE() then
return
end
m.listing:SetDatabase(m.auction_records)
if not ACTIVE then return end
listing:SetDatabase(auction_records)
end
function public.scan_auctions()
m.status_bar:update_status(0,0)
m.status_bar:set_text('Scanning auctions...')
status_bar:update_status(0,0)
status_bar:set_text('Scanning auctions...')
m.auction_records = {}
m.update_listing()
aux.scan.start{
auction_records = {}
update_listing()
scan.start{
type = 'owner',
queries = {{ blizzard_query = {} }},
on_page_loaded = function(page, total_pages)
m.status_bar:update_status(100 * (page - 1) / total_pages, 0)
m.status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
status_bar:update_status(100 * (page - 1) / total_pages, 0)
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
end,
on_auction = function(auction_record)
tinsert(m.auction_records, auction_record)
tinsert(auction_records, auction_record)
end,
on_complete = function()
m.status_bar:update_status(100, 100)
m.status_bar:set_text('Scan complete')
m.update_listing()
status_bar:update_status(100, 100)
status_bar:set_text('Scan complete')
update_listing()
end,
on_abort = function()
m.status_bar:update_status(100, 100)
m.status_bar:set_text('Scan aborted')
status_bar:update_status(100, 100)
status_bar:set_text('Scan aborted')
end,
}
end
function test(record)
return function(index)
local auction_info = aux.info.auction(index, 'owner')
local auction_info = info.auction(index, 'owner')
return auction_info and auction_info.search_signature == record.search_signature
end
end
@@ -67,55 +64,44 @@ do
local found_index
function find_auction(record)
if not m.listing:ContainsRecord(record) then
return
end
if not listing:ContainsRecord(record) then return end
aux.scan.abort(scan_id)
scan.abort(scan_id)
state = SEARCHING
scan_id = aux.scan_util.find(
scan_id = scan_util.find(
record,
m.status_bar,
function()
state = IDLE
end,
function()
state = IDLE
m.listing:RemoveAuctionRecord(record)
end,
status_bar,
function() state = IDLE end,
function() state = IDLE; listing:RemoveAuctionRecord(record) end,
function(index)
state = FOUND
found_index = index
m.cancel_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then
aux.cancel_auction(index, L(m.listing.RemoveAuctionRecord, m.listing, record))
cancel_button:SetScript('OnClick', function()
if test(record)(index) and listing:ContainsRecord(record) then
cancel_auction(index, L(listing.RemoveAuctionRecord, listing, record))
end
end)
m.cancel_button:Enable()
cancel_button:Enable()
end
)
end
function on_update()
if state == IDLE or state == SEARCHING then
m.cancel_button:Disable()
cancel_button:Disable()
end
if state == SEARCHING then
return
end
if state == SEARCHING then return end
local selection = m.listing:GetSelection()
local selection = listing:GetSelection()
if not selection then
state = IDLE
elseif selection and state == IDLE then
m.find_auction(selection.record)
elseif state == FOUND and not m.test(selection.record)(found_index) then
m.cancel_button:Disable()
if not aux.cancel_in_progress() then
state = IDLE
end
find_auction(selection.record)
elseif state == FOUND and not test(selection.record)(found_index) then
cancel_button:Disable()
if not cancel_in_progress then state = IDLE end
end
end
end
+10 -10
View File
@@ -1,17 +1,17 @@
aux.module 'auctions_tab'
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
frame = CreateFrame('Frame', nil, frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
frame.listing = aux.gui.panel(frame)
frame.listing:SetPoint('TOP', aux.frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
frame.listing = gui.panel(frame)
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0)
listing = aux.auction_listing.CreateAuctionResultsTable(frame.listing, aux.auction_listing.auctions_config)
listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.auctions_config)
listing:SetSort(1,2,3,4,5,6,7,8)
listing:Reset()
listing:SetHandler('OnCellClick', function(cell, button)
@@ -25,15 +25,15 @@ function create_frames()
end)
do
status_bar = aux.gui.status_bar(frame)
status_bar = gui.status_bar(frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
end
do
local btn = aux.gui.button(frame, 16)
local btn = gui.button(frame, 16)
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -42,7 +42,7 @@ function create_frames()
cancel_button = btn
end
do
local btn = aux.gui.button(m.frame, 16)
local btn = gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
+50 -61
View File
@@ -1,61 +1,58 @@
aux.module 'bids_tab'
aux.tab(4, 'Bids')
g.aux.tab(4, 'Bids')
auction_records = nil
function m.LOAD()
m.create_frames()
function LOAD()
create_frames()
end
function m.OPEN()
m.frame:Show()
m.scan_bids()
function OPEN()
frame:Show()
scan_bids()
end
function m.CLOSE()
m.frame:Hide()
function CLOSE()
frame:Hide()
end
function update_listing()
if not m:ACTIVE() then
return
end
m.listing:SetDatabase(m.auction_records)
if not ACTIVE then return end
listing:SetDatabase(auction_records)
end
function public.scan_bids()
m.status_bar:update_status(0,0)
m.status_bar:set_text('Scanning auctions...')
status_bar:update_status(0,0)
status_bar:set_text('Scanning auctions...')
m.auction_records = {}
m.update_listing()
aux.scan.start{
auction_records = {}
update_listing()
scan.start{
type = 'bidder',
queries = {{ blizzard_query = {} }},
on_page_loaded = function(page, total_pages)
m.status_bar:update_status(100 * (page - 1) / total_pages, 0)
m.status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
status_bar:update_status(100 * (page - 1) / total_pages, 0)
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
end,
on_auction = function(auction_record)
tinsert(m.auction_records, auction_record)
tinsert(auction_records, auction_record)
end,
on_complete = function()
m.status_bar:update_status(100, 100)
m.status_bar:set_text('Scan complete')
m.update_listing()
status_bar:update_status(100, 100)
status_bar:set_text('Scan complete')
update_listing()
end,
on_abort = function()
m.status_bar:update_status(100, 100)
m.status_bar:set_text('Scan aborted')
status_bar:update_status(100, 100)
status_bar:set_text('Scan aborted')
end,
}
end
function test(record)
return function(index)
local auction_info = aux.info.auction(index, 'bidder')
local auction_info = info.auction(index, 'bidder')
return auction_info and auction_info.search_signature == record.search_signature
end
end
@@ -67,45 +64,41 @@ do
local found_index
function find_auction(record)
if not m.listing:ContainsRecord(record) then
return
end
if not listing:ContainsRecord(record) then return end
aux.scan.abort(scan_id)
scan.abort(scan_id)
state = SEARCHING
scan_id = aux.scan_util.find(
scan_id = scan_util.find(
record,
m.status_bar,
status_bar,
function() state = IDLE end,
function()
state = IDLE
end,
function()
state = IDLE
m.listing:RemoveAuctionRecord(record)
listing:RemoveAuctionRecord(record)
end,
function(index)
state = FOUND
found_index = index
if not record.high_bidder then
m.bid_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then
aux.place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
aux.info.bid_update(record)
m.listing:SetDatabase()
end or L(m.listing.RemoveAuctionRecord, m.listing, record))
bid_button:SetScript('OnClick', function()
if test(record)(index) and listing:ContainsRecord(record) then
place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
info.bid_update(record)
listing:SetDatabase()
end or L(listing.RemoveAuctionRecord, listing, record))
end
end)
m.bid_button:Enable()
bid_button:Enable()
end
if record.buyout_price > 0 then
m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then
aux.place_bid('bidder', index, record.buyout_price, L(m.listing.RemoveAuctionRecord, m.listing, record))
buyout_button:SetScript('OnClick', function()
if test(record)(index) and listing:ContainsRecord(record) then
place_bid('bidder', index, record.buyout_price, L(listing.RemoveAuctionRecord, listing, record))
end
end)
m.buyout_button:Enable()
buyout_button:Enable()
end
end
)
@@ -113,25 +106,21 @@ do
function on_update()
if state == IDLE or state == SEARCHING then
m.buyout_button:Disable()
m.bid_button:Disable()
buyout_button:Disable()
bid_button:Disable()
end
if state == SEARCHING then
return
end
if state == SEARCHING then return end
local selection = m.listing:GetSelection()
local selection = listing:GetSelection()
if not selection then
state = IDLE
elseif selection and state == IDLE then
m.find_auction(selection.record)
elseif state == FOUND and not m.test(selection.record)(found_index) then
m.buyout_button:Disable()
m.bid_button:Disable()
if not aux.bid_in_progress() then
state = IDLE
end
find_auction(selection.record)
elseif state == FOUND and not test(selection.record)(found_index) then
buyout_button:Disable()
bid_button:Disable()
if not bid_in_progress() then state = IDLE end
end
end
end
+11 -11
View File
@@ -1,17 +1,17 @@
aux.module 'bids_tab'
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
frame = CreateFrame('Frame', nil, frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
frame.listing = aux.gui.panel(frame)
frame.listing:SetPoint('TOP', aux.frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
frame.listing = gui.panel(frame)
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0)
listing = aux.auction_listing.CreateAuctionResultsTable(frame.listing, aux.auction_listing.bids_config)
listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.bids_config)
listing:SetSort(1,2,3,4,5,6,7,8)
listing:Reset()
listing:SetHandler('OnCellClick', function(cell, button)
@@ -29,15 +29,15 @@ function create_frames()
end)
do
status_bar = aux.gui.status_bar(frame)
status_bar = gui.status_bar(frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 0)
status_bar:set_text('')
end
do
local btn = aux.gui.button(frame, 16)
local btn = gui.button(frame, 16)
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -46,7 +46,7 @@ function create_frames()
bid_button = btn
end
do
local btn = aux.gui.button(frame, 16)
local btn = gui.button(frame, 16)
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -55,7 +55,7 @@ function create_frames()
buyout_button = btn
end
do
local btn = aux.gui.button(frame, 16)
local btn = gui.button(frame, 16)
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
+54 -60
View File
@@ -1,5 +1,5 @@
aux.module 'post_tab'
aux.tab(2, 'Post')
g.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'}}
@@ -17,7 +17,7 @@ end
function m.OPEN()
m.frame:Show()
m.deposit:SetText('Deposit: '..aux.money.to_string(0, nil, nil, nil, aux.gui.inline_color.text.enabled))
m.deposit:SetText('Deposit: '..money.to_string(0, nil, nil, nil, gui.inline_color.text.enabled))
m.set_unit_start_price(0)
m.set_unit_buyout_price(0)
@@ -48,12 +48,12 @@ end
function read_settings(item_key)
item_key = item_key or m.selected_item.key
local dataset = aux.persistence.load_dataset()
local dataset = persistence.load_dataset()
dataset.post = dataset.post or {}
local settings
if dataset.post[item_key] then
settings = aux.persistence.read(settings_schema, dataset.post[item_key])
settings = persistence.read(settings_schema, dataset.post[item_key])
else
settings = m.default_settings()
end
@@ -63,46 +63,40 @@ end
function write_settings(settings, item_key)
item_key = item_key or m.selected_item.key
local dataset = aux.persistence.load_dataset()
local dataset = persistence.load_dataset()
dataset.post = dataset.post or {}
dataset.post[item_key] = aux.persistence.write(settings_schema, settings)
dataset.post[item_key] = persistence.write(settings_schema, settings)
end
function get_unit_start_price()
local money_text = m.unit_start_price:GetText()
return aux.money.from_string(money_text) or 0
return money.from_string(money_text) or 0
end
function set_unit_start_price(amount)
m.unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3))
m.unit_start_price:SetText(money.to_string(amount, true, nil, 3))
end
function get_unit_buyout_price()
local money_text = m.unit_buyout_price:GetText()
return aux.money.from_string(money_text) or 0
return money.from_string(money_text) or 0
end
function set_unit_buyout_price(amount)
m.unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3))
m.unit_buyout_price:SetText(money.to_string(amount, true, nil, 3))
end
function update_inventory_listing()
if not m.ACTIVE() then
return
end
aux.item_listing.populate(m.item_listing, values(filter(m.inventory_records, function(record)
if not ACTIVE then return end
item_listing.populate(m.item_listing, values(filter(m.inventory_records, function(record)
local settings = m.read_settings(record.key)
return record.aux_quantity > 0 and (not settings.hidden or m.show_hidden_checkbox:GetChecked())
end)))
end
function update_auction_listing()
if not m.ACTIVE() then
return
end
if not ACTIVE then return end
local auction_rows = {}
if m.selected_item then
local unit_start_price = m.get_unit_start_price()
@@ -111,49 +105,49 @@ function update_auction_listing()
for i, auction_record in m.existing_auctions[m.selected_item.key] or {} do
local blizzard_bid_undercut, buyout_price_undercut = m.undercut(auction_record, m.stack_size_slider:GetValue())
blizzard_bid_undercut = aux.money.from_string(aux.money.to_string(blizzard_bid_undercut, true, nil, 3))
buyout_price_undercut = aux.money.from_string(aux.money.to_string(buyout_price_undercut, true, nil, 3))
blizzard_bid_undercut = money.from_string(money.to_string(blizzard_bid_undercut, true, nil, 3))
buyout_price_undercut = money.from_string(money.to_string(buyout_price_undercut, true, nil, 3))
local stack_blizzard_bid_undercut, stack_buyout_price_undercut = m.undercut(auction_record, m.stack_size_slider:GetValue(), true)
stack_blizzard_bid_undercut = aux.money.from_string(aux.money.to_string(stack_blizzard_bid_undercut, true, nil, 3))
stack_buyout_price_undercut = aux.money.from_string(aux.money.to_string(stack_buyout_price_undercut, true, nil, 3))
stack_blizzard_bid_undercut = money.from_string(money.to_string(stack_blizzard_bid_undercut, true, nil, 3))
stack_buyout_price_undercut = money.from_string(money.to_string(stack_buyout_price_undercut, true, nil, 3))
local stack_size = m.stack_size_slider:GetValue()
local historical_value = aux.history.value(m.selected_item.key)
local historical_value = history.value(m.selected_item.key)
local bid_color
if blizzard_bid_undercut < unit_start_price and stack_blizzard_bid_undercut < unit_start_price then
bid_color = aux.gui.inline_color.red
bid_color = gui.inline_color.red
elseif blizzard_bid_undercut < unit_start_price then
bid_color = aux.gui.inline_color.orange
bid_color = gui.inline_color.orange
elseif stack_blizzard_bid_undercut < unit_start_price then
bid_color = aux.gui.inline_color.yellow
bid_color = gui.inline_color.yellow
end
local buyout_color
if buyout_price_undercut < unit_buyout_price and stack_buyout_price_undercut < unit_buyout_price then
buyout_color = aux.gui.inline_color.red
buyout_color = gui.inline_color.red
elseif buyout_price_undercut < unit_buyout_price then
buyout_color = aux.gui.inline_color.orange
buyout_color = gui.inline_color.orange
elseif stack_buyout_price_undercut < unit_buyout_price then
buyout_color = aux.gui.inline_color.yellow
buyout_color = gui.inline_color.yellow
end
tinsert(auction_rows, {
cols = {
{value=auction_record.own and aux.gui.color.yellow(auction_record.count) or auction_record.count},
{value=aux.auction_listing.time_left(auction_record.duration)},
{value=auction_record.stack_size == stack_size and aux.gui.color.yellow(auction_record.stack_size) or auction_record.stack_size},
{value=aux.money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color) },
{value=historical_value and aux.auction_listing.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'},
{value=auction_record.unit_buyout_price > 0 and aux.money.to_string(auction_record.unit_buyout_price, true, nil, 3, buyout_color) or '---'},
{value=auction_record.unit_buyout_price > 0 and historical_value and aux.auction_listing.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'},
{value=auction_record.own and gui.color.yellow(auction_record.count) or auction_record.count},
{value=auction_listing.time_left(auction_record.duration)},
{value=auction_record.stack_size == stack_size and gui.color.yellow(auction_record.stack_size) or auction_record.stack_size},
{value=money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color) },
{value=historical_value and auction_listing.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'},
{value=auction_record.unit_buyout_price > 0 and money.to_string(auction_record.unit_buyout_price, true, nil, 3, buyout_color) or '---'},
{value=auction_record.unit_buyout_price > 0 and historical_value and auction_listing.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'},
},
record = auction_record,
})
end
sort(auction_rows, function(a, b)
return aux.sorting.multi_lt(
return sorting.multi_lt(
{
a.record.unit_buyout_price == 0 and huge or a.record.unit_buyout_price,
a.record.unit_blizzard_bid,
@@ -189,13 +183,13 @@ function price_update()
local start_price_input = m.get_unit_start_price()
settings.start_price = start_price_input
local historical_value = aux.history.value(m.selected_item.key)
m.start_price_percentage:SetText(historical_value and aux.auction_listing.percentage_historical(round(start_price_input / historical_value * 100)) or '---')
local historical_value = history.value(m.selected_item.key)
m.start_price_percentage:SetText(historical_value and auction_listing.percentage_historical(round(start_price_input / historical_value * 100)) or '---')
local buyout_price_input = m.get_unit_buyout_price()
settings.buyout_price = buyout_price_input
local historical_value = aux.history.value(m.selected_item.key)
m.buyout_price_percentage:SetText(historical_value and aux.auction_listing.percentage_historical(round(buyout_price_input / historical_value * 100)) or '---')
local historical_value = history.value(m.selected_item.key)
m.buyout_price_percentage:SetText(historical_value and auction_listing.percentage_historical(round(buyout_price_input / historical_value * 100)) or '---')
m.write_settings(settings)
end
@@ -220,7 +214,7 @@ function post_auctions()
duration_code = 4
end
aux.post.start(
post.start(
key,
stack_size,
duration,
@@ -279,7 +273,7 @@ function update_item_configuration()
item.texture:SetTexture(nil)
item.count:SetText()
item.name:SetTextColor(unpack(aux.gui.color.label.enabled))
item.name:SetTextColor(unpack(gui.color.label.enabled))
item.name:SetText('No item selected')
start_price_frame:Hide()
@@ -314,13 +308,13 @@ function update_item_configuration()
m.stack_count_slider.editbox:SetNumber(m.stack_count_slider:GetValue())
do
local deposit_factor = aux.neutral_faction() and 0.25 or 0.05
local deposit_factor = neutral_faction() and 0.25 or 0.05
local stack_size = m.stack_size_slider:GetValue()
local stack_count
stack_count = m.stack_count_slider:GetValue()
local deposit = floor(m.selected_item.unit_vendor_price * deposit_factor * (m.selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(m.duration_dropdown) / 120
m.deposit:SetText('Deposit: '..aux.money.to_string(deposit, nil, nil, nil, aux.gui.inline_color.text.enabled))
m.deposit:SetText('Deposit: '..money.to_string(deposit, nil, nil, nil, gui.inline_color.text.enabled))
end
m.refresh_button:Enable()
@@ -354,14 +348,14 @@ function unit_vendor_price(item_key)
for slot in inventory do
local item_info = aux.info.container_item(unpack(slot))
local item_info = info.container_item(unpack(slot))
if item_info and item_info.item_key == item_key then
if aux.info.auctionable(item_info.tooltip, nil, item_info.lootable) then
if info.auctionable(item_info.tooltip, nil, item_info.lootable) then
ClearCursor()
PickupContainerItem(unpack(slot))
ClickAuctionSellItemButton()
local auction_sell_item = aux.info.auction_sell_item()
local auction_sell_item = info.auction_sell_item()
ClearCursor()
ClickAuctionSellItemButton()
ClearCursor()
@@ -376,9 +370,9 @@ end
function update_historical_value_button()
if m.selected_item then
local historical_value = aux.history.value(m.selected_item.key)
local historical_value = history.value(m.selected_item.key)
m.historical_value_button.amount = historical_value
m.historical_value_button:SetText(historical_value and aux.money.to_string(historical_value, true, nil, 3) or '---')
m.historical_value_button:SetText(historical_value and money.to_string(historical_value, true, nil, 3) or '---')
end
end
@@ -393,7 +387,7 @@ function set_item(item)
return
end
aux.scan.abort(m.scan_id)
scan.abort(m.scan_id)
m.selected_item = item
@@ -406,8 +400,8 @@ function set_item(item)
m.stack_size_slider:SetValue(settings.stack_size)
m.quantity_update(true)
m.unit_start_price:SetText(aux.money.to_string(settings.start_price, true, nil, 3, nil, true))
m.unit_buyout_price:SetText(aux.money.to_string(settings.buyout_price, true, nil, 3, nil, true))
m.unit_start_price:SetText(money.to_string(settings.start_price, true, nil, 3, nil, true))
m.unit_buyout_price:SetText(money.to_string(settings.buyout_price, true, nil, 3, nil, true))
if not m.existing_auctions[m.selected_item.key] then
m.refresh_entries()
@@ -425,11 +419,11 @@ function update_inventory_records()
for slot in inventory do
local item_info = aux.info.container_item(unpack(slot))
local item_info = info.container_item(unpack(slot))
if item_info then
local charge_class = item_info.charges or 0
if aux.info.auctionable(item_info.tooltip, nil, item_info.lootable) then
if info.auctionable(item_info.tooltip, nil, item_info.lootable) then
if not auction_candidate_map[item_info.item_key] then
local availability = {}
@@ -477,12 +471,12 @@ function refresh_entries()
m.existing_auctions[item_key] = nil
local query = aux.scan_util.item_query(item_id)
local query = scan_util.item_query(item_id)
m.status_bar:update_status(0,0)
m.status_bar:set_text('Scanning auctions...')
m.scan_id = aux.scan.start{
m.scan_id = scan.start{
type = 'list',
ignore_owner = true,
queries = { query },
@@ -522,7 +516,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
m.existing_auctions[key] = m.existing_auctions[key] or {}
local entry
for _, existing_entry in m.existing_auctions[key] do
if unit_blizzard_bid == existing_entry.unit_blizzard_bid and unit_buyout_price == existing_entry.unit_buyout_price and aux_quantity == existing_entry.stack_size and duration == existing_entry.duration and aux.is_player(owner) == existing_entry.own then
if unit_blizzard_bid == existing_entry.unit_blizzard_bid and unit_buyout_price == existing_entry.unit_buyout_price and aux_quantity == existing_entry.stack_size and duration == existing_entry.duration and is_player(owner) == existing_entry.own then
entry = existing_entry
end
end
@@ -533,7 +527,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
unit_blizzard_bid = unit_blizzard_bid,
unit_buyout_price = unit_buyout_price,
duration = duration,
own = aux.is_player(owner),
own = is_player(owner),
count = 0,
}
tinsert(m.existing_auctions[key], entry)
+48 -48
View File
@@ -1,54 +1,54 @@
aux.module 'post_tab'
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
frame = CreateFrame('Frame', nil, frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
frame.content = CreateFrame('Frame', nil, frame)
frame.content:SetPoint('TOP', aux.frame, 'TOP', 0, -8)
frame.content:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
frame.content:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
frame.content:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.content:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0)
frame.content:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0)
frame.inventory = aux.gui.panel(frame.content)
frame.inventory = gui.panel(frame.content)
frame.inventory:SetWidth(212)
frame.inventory:SetPoint('TOPLEFT', 0, 0)
frame.inventory:SetPoint('BOTTOMLEFT', 0, 0)
frame.parameters = aux.gui.panel(frame.content)
frame.parameters = gui.panel(frame.content)
frame.parameters:SetHeight(173)
frame.parameters:SetPoint('TOPLEFT', frame.inventory, 'TOPRIGHT', 2.5, 0)
frame.parameters:SetPoint('TOPRIGHT', 0, 0)
frame.auctions = aux.gui.panel(frame.content)
frame.auctions = gui.panel(frame.content)
frame.auctions:SetHeight(228)
frame.auctions:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0)
do
local checkbox = aux.gui.checkbox(frame.inventory)
local checkbox = gui.checkbox(frame.inventory)
checkbox:SetPoint('TOPLEFT', 49, -16)
checkbox:SetScript('OnClick', function()
refresh = true
end)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
local label = gui.label(checkbox, gui.config.small_font_size)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText('Show hidden items')
show_hidden_checkbox = checkbox
end
aux.gui.horizontal_line(frame.inventory, -48)
gui.horizontal_line(frame.inventory, -48)
item_listing = aux.item_listing.create(
item_listing = item_listing.create(
frame.inventory,
function()
if arg1 == 'LeftButton' then
set_item(this.item_record)
elseif arg1 == 'RightButton' then
aux.set_tab(1)
aux.search_tab.set_filter(strlower(aux.info.item(this.item_record.item_id).name)..'/exact')
aux.search_tab.execute(nil, false)
set_tab(1)
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name)..'/exact')
search_tab.execute(nil, false)
end
end,
function(item_record)
@@ -56,7 +56,7 @@ function create_frames()
end
)
auction_listing = aux.listing.CreateScrollingTable(frame.auctions)
auction_listing = listing.CreateScrollingTable(frame.auctions)
auction_listing:SetColInfo({
{ name='Auctions', width=.12, align='CENTER' },
{ name='Left', width=.1, align='CENTER' },
@@ -81,15 +81,15 @@ function create_frames()
end)
do
status_bar = aux.gui.status_bar(frame)
status_bar = gui.status_bar(frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
end
do
local btn = aux.gui.button(frame.parameters, 16)
local btn = gui.button(frame.parameters, 16)
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -98,24 +98,24 @@ function create_frames()
post_button = btn
end
do
local btn = aux.gui.button(frame.parameters, 16)
local btn = gui.button(frame.parameters, 16)
btn:SetPoint('TOPLEFT', post_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
aux.scan.abort(scan_id)
scan.abort(scan_id)
refresh_entries()
refresh = true
end)
refresh_button = btn
end
do
item = aux.gui.item(frame.parameters)
item = gui.item(frame.parameters)
item:SetPoint('TOPLEFT', 10, -6)
item.button:SetScript('OnEnter', function()
if selected_item then
aux.info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
end
end)
item.button:SetScript('OnLeave', function()
@@ -123,7 +123,7 @@ function create_frames()
end)
end
do
local slider = aux.gui.slider(frame.parameters)
local slider = gui.slider(frame.parameters)
slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', 13, -74)
slider:SetWidth(190)
@@ -154,7 +154,7 @@ function create_frames()
stack_size_slider = slider
end
do
local slider = aux.gui.slider(frame.parameters)
local slider = gui.slider(frame.parameters)
slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', stack_size_slider, 'BOTTOMLEFT', 0, -32)
slider:SetWidth(190)
@@ -177,10 +177,10 @@ function create_frames()
stack_count_slider = slider
end
do
local dropdown = aux.gui.dropdown(frame.parameters)
local dropdown = gui.dropdown(frame.parameters)
dropdown:SetPoint('TOPLEFT', stack_count_slider, 'BOTTOMLEFT', 0, -19)
dropdown:SetWidth(90)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
local label = gui.label(dropdown, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Duration')
UIDropDownMenu_Initialize(dropdown, initialize_duration_dropdown)
@@ -190,12 +190,12 @@ function create_frames()
duration_dropdown = dropdown
end
do
local label = aux.gui.label(frame.parameters, aux.gui.config.medium_font_size)
local label = gui.label(frame.parameters, gui.config.medium_font_size)
label:SetPoint('LEFT', duration_dropdown, 'RIGHT', 25, 0)
deposit = label
end
do
local checkbox = aux.gui.checkbox(frame.parameters)
local checkbox = gui.checkbox(frame.parameters)
checkbox:SetPoint('TOPRIGHT', -83, -6)
checkbox:SetScript('OnClick', function()
local settings = read_settings()
@@ -203,7 +203,7 @@ function create_frames()
write_settings(settings)
refresh = true
end)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
local label = gui.label(checkbox, gui.config.small_font_size)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText 'Hide this item'
hide_checkbox = checkbox
@@ -215,11 +215,11 @@ function create_frames()
do
local frame = CreateFrame('Frame', nil, frame.parameters)
start_price_frame = frame
aux.gui.set_content_style(frame)
gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60)
frame:SetWidth(180)
frame:SetHeight(22)
local editbox = aux.gui.editbox(frame)
local editbox = gui.editbox(frame)
editbox:SetAllPoints()
editbox:SetAlignment 'RIGHT'
editbox:SetFontSize(17)
@@ -233,7 +233,7 @@ function create_frames()
end
end)
editbox.change = function()
this.pretty:SetText(aux.money.to_string(get_unit_start_price(), true, nil, 3))
this.pretty:SetText(money.to_string(get_unit_start_price(), true, nil, 3))
refresh = true
end
editbox.enter = function() this:ClearFocus() end
@@ -242,23 +242,23 @@ function create_frames()
this:SetAlpha(1)
end
editbox.focus_loss = function()
this:SetText(aux.money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
this:SetText(money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
this.pretty:Show()
this:SetAlpha(0)
end
editbox:SetAlpha(0)
editbox.pretty = aux.gui.label(frame, 17)
editbox.pretty = gui.label(frame, 17)
editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH 'RIGHT'
editbox.pretty:SetTextColor(aux.gui.color.text.enabled())
editbox.pretty:SetTextColor(gui.color.text.enabled())
do
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
local label = gui.label(frame, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
label:SetText 'Unit Starting Price'
end
do
local label = aux.gui.label(frame, 14)
local label = gui.label(frame, 14)
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50)
label:SetJustifyH 'CENTER'
@@ -269,11 +269,11 @@ function create_frames()
do
local frame = CreateFrame('Frame', nil, frame.parameters)
buyout_price_frame = frame
aux.gui.set_content_style(frame)
gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', unit_start_price, 'BOTTOMRIGHT', 0, -19)
frame:SetWidth(180)
frame:SetHeight(22)
local editbox = aux.gui.editbox(frame)
local editbox = gui.editbox(frame)
editbox:SetAllPoints()
editbox:SetAlignment 'RIGHT'
editbox:SetFontSize(17)
@@ -285,7 +285,7 @@ function create_frames()
end
end)
editbox.change = function()
this.pretty:SetText(aux.money.to_string(get_unit_buyout_price(), true, nil, 3))
this.pretty:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3))
refresh = true
end
editbox.enter = function() this:ClearFocus() end
@@ -294,23 +294,23 @@ function create_frames()
this:SetAlpha(1)
end
editbox.focus_loss = function()
this:SetText(aux.money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
this:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
this.pretty:Show()
this:SetAlpha(0)
end
editbox:SetAlpha(0)
editbox.pretty = aux.gui.label(frame, 17)
editbox.pretty = gui.label(frame, 17)
editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH 'RIGHT'
editbox.pretty:SetTextColor(aux.gui.color.text.enabled())
editbox.pretty:SetTextColor(gui.color.text.enabled())
do
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
local label = gui.label(frame, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
label:SetText 'Unit Buyout Price'
end
do
local label = aux.gui.label(frame, 14)
local label = gui.label(frame, 14)
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50)
label:SetJustifyH 'CENTER'
@@ -319,9 +319,9 @@ function create_frames()
unit_buyout_price = editbox
end
do
local btn = aux.gui.button(frame.parameters, 14)
local btn = gui.button(frame.parameters, 14)
btn:SetPoint('TOPRIGHT', -10, -146)
aux.gui.set_size(btn, 150, 20)
gui.set_size(btn, 150, 20)
btn:GetFontString():SetJustifyH 'RIGHT'
btn:GetFontString():SetPoint('RIGHT', -2, 0)
btn:SetScript('OnClick', function()
@@ -330,7 +330,7 @@ function create_frames()
set_unit_buyout_price(this.amount)
end
end)
local label = aux.gui.label(btn, aux.gui.config.small_font_size)
local label = gui.label(btn, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText 'Historical Value'
historical_value_button = btn
+1 -1
View File
@@ -1,5 +1,5 @@
aux.module 'search_tab'
aux.tab(1, 'Search')
g.aux.tab(1, '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.',
+13 -13
View File
@@ -109,8 +109,8 @@ function get_filter_builder_query()
end
local name = blizzard_query.name
if not index(aux.filter.parse_query_string(name), 'blizzard', 'name') then
name = aux.filter.quote(name)
if not index(filter.parse_query_string(name), 'blizzard', 'name') then
name = filter.quote(name)
end
add((name ~= '' or blizzard_query.exact) and name)
@@ -134,7 +134,7 @@ function get_filter_builder_query()
add(strlower(getglobal('ITEM_QUALITY'..quality..'_DESC')))
end
local post_filter_string = aux.filter.query_string{blizzard={}, post=post_filter}
local post_filter_string = filter.query_string{blizzard={}, post=post_filter}
add(post_filter_string ~= '' and post_filter_string)
return query_string or ''
@@ -171,7 +171,7 @@ function clear_form()
end
function import_query_string()
local components, error = aux.filter.parse_query_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
local components, error = filter.parse_query_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
if components then
set_form(components)
else
@@ -195,12 +195,12 @@ function public.formatted_post_filter(components)
elseif i > 1 then
str = str..'</p><p>'
for _=1,getn(stack) do
str = str..aux.gui.color.content.background('----')
str = str..gui.color.content.background('----')
end
end
no_line_break = component[1] == 'operator' and component[2] == 'not'
local filter_color = (filter_builder_state.selected == i and aux.gui.color.orange or aux.gui.color.aux)
local filter_color = (filter_builder_state.selected == i and gui.color.orange or gui.color.aux)
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 '')
@@ -208,9 +208,9 @@ function public.formatted_post_filter(components)
elseif component[1] == 'filter' then
for parameter in present(component[3]) do
if component[2] == 'item' then
parameter = aux.info.display_name(aux.cache.item_id(parameter)) or '['..parameter..']'
elseif aux.filter.filters[component[2]].input_type == 'money' then
parameter = aux.money.to_string(aux.money.from_string(parameter), nil, true)
parameter = info.display_name(cache.item_id(parameter)) or '['..parameter..']'
elseif filter.filters[component[2]].input_type == 'money' then
parameter = money.to_string(money.from_string(parameter), nil, true)
end
component_text = component_text..filter_color(': ')..parameter
end
@@ -262,13 +262,13 @@ end
function add_post_filter()
for str in present(filter_input:GetText()) do
for filter in present(aux.filter.filters[str]) do
for filter in present(filter.filters[str]) do
if filter.input_type ~= '' then
str = str..'/'..filter_parameter_input:GetText()
end
end
local components, error, suggestions = aux.filter.parse_query_string(str)
local components, error, suggestions = filter.parse_query_string(str)
if components and getn(components.blizzard) == 0 and getn(components.post) == 1 then
add_component(components.post[1])
@@ -325,9 +325,9 @@ function initialize_filter_dropdown()
value = filter,
func = function()
filter_input:SetText(this.value)
if index(aux.filter.filters[this.value], 'input_type') == '' or this.value == 'not' then
if index(filter.filters[this.value], 'input_type') == '' or this.value == 'not' then
add_post_filter()
elseif aux.filter.filters[this.value] then
elseif filter.filters[this.value] then
filter_parameter_input:Show()
filter_parameter_input:SetFocus()
else
+82 -82
View File
@@ -3,31 +3,31 @@ aux.module 'search_tab'
FILTER_SPACING = 28.5
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
frame = CreateFrame('Frame', nil, frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
frame.filter = aux.gui.panel(frame)
frame.filter:SetAllPoints(aux.frame.content)
frame.filter = gui.panel(frame)
frame.filter:SetAllPoints(frame.content)
frame.results = aux.gui.panel(frame)
frame.results:SetAllPoints(aux.frame.content)
frame.results = gui.panel(frame)
frame.results:SetAllPoints(frame.content)
frame.saved = CreateFrame('Frame', nil, frame)
frame.saved:SetAllPoints(aux.frame.content)
frame.saved:SetAllPoints(frame.content)
frame.saved.favorite = aux.gui.panel(frame.saved)
frame.saved.favorite = gui.panel(frame.saved)
frame.saved.favorite:SetWidth(378.5)
frame.saved.favorite:SetPoint('TOPLEFT', 0, 0)
frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0)
frame.saved.recent = aux.gui.panel(frame.saved)
frame.saved.recent = gui.panel(frame.saved)
frame.saved.recent:SetWidth(378.5)
frame.saved.recent:SetPoint('TOPRIGHT', 0, 0)
frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0)
do
local btn = aux.gui.button(frame)
local btn = gui.button(frame)
btn:SetPoint('TOPLEFT', 0, 0)
btn:SetWidth(42)
btn:SetHeight(42)
@@ -54,7 +54,7 @@ function create_frames()
do
local panel = CreateFrame('Frame', nil, frame)
panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]}
panel:SetBackdropColor(unpack(aux.gui.color.content.background))
panel:SetBackdropColor(unpack(gui.color.content.background))
panel:SetPoint('LEFT', settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 0)
panel:SetHeight(42)
@@ -76,42 +76,42 @@ function create_frames()
this:SetText(valid_input)
end
if blizzard_page_index(this:GetText()) and not real_time_button:GetChecked() then
this:SetBackdropColor(aux.gui.color.state.enabled())
this:SetBackdropColor(gui.color.state.enabled())
else
this:SetBackdropColor(aux.gui.color.state.disabled())
this:SetBackdropColor(gui.color.state.disabled())
end
end
do
local editbox = aux.gui.editbox(settings)
local editbox = gui.editbox(settings)
editbox:SetPoint('LEFT', 75, 0)
editbox:SetWidth(50)
editbox:SetNumeric(true)
editbox:SetScript('OnTabPressed', function() last_page_input:SetFocus() end)
editbox.enter = execute
editbox.change = change
local label = aux.gui.label(editbox, 16)
local label = gui.label(editbox, 16)
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages')
label:SetTextColor(aux.gui.color.text.enabled())
label:SetTextColor(gui.color.text.enabled())
first_page_input = editbox
end
do
local editbox = aux.gui.editbox(settings)
local editbox = gui.editbox(settings)
editbox:SetPoint('LEFT', first_page_input, 'RIGHT', 10, 0)
editbox:SetWidth(50)
editbox:SetNumeric(true)
editbox:SetScript('OnTabPressed', function() first_page_input:SetFocus() end)
editbox.enter = execute
editbox.change = change
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
local label = gui.label(editbox, gui.config.medium_font_size)
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
label:SetText('-')
label:SetTextColor(aux.gui.color.text.enabled())
label:SetTextColor(gui.color.text.enabled())
last_page_input = editbox
end
end
do
local btn = aux.gui.checkbutton(settings)
local btn = gui.checkbutton(settings)
btn:SetPoint('LEFT', 230, 0)
btn:SetWidth(140)
btn:SetHeight(25)
@@ -126,7 +126,7 @@ function create_frames()
public.real_time_button = btn
end
do
local btn = aux.gui.checkbutton(settings)
local btn = gui.checkbutton(settings)
btn:SetPoint('LEFT', real_time_button, 'RIGHT', 15, 0)
btn:SetWidth(140)
btn:SetHeight(25)
@@ -141,7 +141,7 @@ function create_frames()
auto_buy_button = btn
end
do
local btn = aux.gui.checkbutton(settings)
local btn = gui.checkbutton(settings)
btn:SetPoint('LEFT', auto_buy_button, 'RIGHT', 15, 0)
btn:SetWidth(140)
btn:SetHeight(25)
@@ -169,7 +169,7 @@ function create_frames()
auto_buy_filter_button = btn
end
do
local btn = aux.gui.button(controls, 25)
local btn = gui.button(controls, 25)
btn:SetPoint('LEFT', 5, 0)
btn:SetWidth(30)
btn:SetHeight(25)
@@ -178,7 +178,7 @@ function create_frames()
previous_button = btn
end
do
local btn = aux.gui.button(controls, 25)
local btn = gui.button(controls, 25)
btn:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0)
btn:SetWidth(30)
btn:SetHeight(25)
@@ -187,7 +187,7 @@ function create_frames()
next_button = btn
end
do
local btn = aux.gui.button(controls, aux.gui.config.huge_font_size)
local btn = gui.button(controls, gui.config.huge_font_size)
btn:SetPoint('RIGHT', -5, 0)
btn:SetWidth(70)
btn:SetHeight(25)
@@ -202,31 +202,31 @@ function create_frames()
start_button = btn
end
do
local btn = aux.gui.button(controls, aux.gui.config.huge_font_size)
local btn = gui.button(controls, gui.config.huge_font_size)
btn:SetPoint('RIGHT', -5, 0)
btn:SetWidth(70)
btn:SetHeight(25)
btn:SetText('Stop')
btn:SetScript('OnClick', function()
aux.scan.abort(search_scan_id)
scan.abort(search_scan_id)
end)
stop_button = btn
end
do
local btn = aux.gui.button(controls, aux.gui.config.huge_font_size)
local btn = gui.button(controls, gui.config.huge_font_size)
btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
btn:SetWidth(70)
btn:SetHeight(25)
btn:SetText(aux.gui.color.green 'Resume')
btn:SetText(gui.color.green 'Resume')
btn:SetScript('OnClick', function()
execute(true)
end)
resume_button = btn
end
do
local editbox = aux.gui.editbox(controls)
local editbox = gui.editbox(controls)
editbox:EnableMouse(1)
editbox.complete = aux.completion.complete_filter
editbox.complete = completion.complete_filter
editbox:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
editbox:SetHeight(25)
editbox.char = function()
@@ -239,11 +239,11 @@ function create_frames()
search_box = editbox
end
do
aux.gui.horizontal_line(frame, -40)
gui.horizontal_line(frame, -40)
end
do
local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8)
local btn = gui.button(frame, gui.config.large_font_size2)
btn:SetPoint('BOTTOMLEFT', frame.content, 'TOPLEFT', 10, 8)
btn:SetWidth(243)
btn:SetHeight(22)
btn:SetText 'Search Results'
@@ -251,7 +251,7 @@ function create_frames()
search_results_button = btn
end
do
local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
local btn = gui.button(frame, gui.config.large_font_size2)
btn:SetPoint('TOPLEFT', search_results_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243)
btn:SetHeight(22)
@@ -260,7 +260,7 @@ function create_frames()
saved_searches_button = btn
end
do
local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
local btn = gui.button(frame, gui.config.large_font_size2)
btn:SetPoint('TOPLEFT', saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243)
btn:SetHeight(22)
@@ -272,11 +272,11 @@ function create_frames()
local frame = CreateFrame('Frame', nil, frame)
frame:SetWidth(265)
frame:SetHeight(25)
frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
frame:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6)
status_bar_frame = frame
end
do
local btn = aux.gui.button(frame.results, 16)
local btn = gui.button(frame.results, 16)
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -285,7 +285,7 @@ function create_frames()
bid_button = btn
end
do
local btn = aux.gui.button(frame.results, 16)
local btn = gui.button(frame.results, 16)
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -294,7 +294,7 @@ function create_frames()
buyout_button = btn
end
do
local btn = aux.gui.button(frame.results, 16)
local btn = gui.button(frame.results, 16)
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -305,13 +305,13 @@ function create_frames()
end)
end
do
local btn = aux.gui.button(frame.saved, 16)
local btn = gui.button(frame.saved, 16)
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText 'Favorite'
btn:SetScript('OnClick', function()
local filters = aux.filter.queries(search_box:GetText())
local filters = filter.queries(search_box:GetText())
if filters then
tinsert(g.aux_favorite_searches, 1, {
filter_string = search_box:GetText(),
@@ -322,30 +322,30 @@ function create_frames()
end)
end
do
local btn1 = aux.gui.button(frame.filter, 16)
local btn1 = gui.button(frame.filter, 16)
btn1:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
aux.gui.set_size(btn1, 80, 24)
gui.set_size(btn1, 80, 24)
btn1:SetText 'Search'
btn1:SetScript('OnClick', function()
export_query_string()
execute()
end)
local btn2 = aux.gui.button(frame.filter, 16)
local btn2 = gui.button(frame.filter, 16)
btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0)
aux.gui.set_size(btn2, 80, 24)
gui.set_size(btn2, 80, 24)
btn2:SetText 'Export'
btn2:SetScript('OnClick', export_query_string)
local btn3 = aux.gui.button(frame.filter, 16)
local btn3 = gui.button(frame.filter, 16)
btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0)
aux.gui.set_size(btn3, 80, 24)
gui.set_size(btn3, 80, 24)
btn3:SetText 'Import'
btn3:SetScript('OnClick', import_query_string)
end
do
local editbox = aux.gui.editbox(frame.filter)
editbox.complete_item = aux.completion.complete(function() return g.aux_auctionable_items end)
local editbox = gui.editbox(frame.filter)
editbox.complete_item = completion.complete(function() return g.aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
editbox:SetWidth(260)
editbox.char = function()
@@ -365,22 +365,22 @@ function create_frames()
end)
editbox.change = update_form
editbox.enter = L(editbox.ClearFocus, editbox)
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
local label = gui.label(editbox, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText 'Name'
name_input = editbox
end
do
local checkbox = aux.gui.checkbox(frame.filter)
local checkbox = gui.checkbox(frame.filter)
checkbox:SetPoint('TOPLEFT', name_input, 'TOPRIGHT', 16, 0)
checkbox:SetScript('OnClick', update_form)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
local label = gui.label(checkbox, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Exact')
exact_checkbox = checkbox
end
do
local editbox = aux.gui.editbox(frame.filter)
local editbox = gui.editbox(frame.filter)
editbox:SetPoint('TOPLEFT', name_input, 'BOTTOMLEFT', 0, -FILTER_SPACING)
editbox:SetWidth(125)
editbox:SetNumeric(true)
@@ -399,13 +399,13 @@ function create_frames()
end
update_form()
end
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
local label = gui.label(editbox, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText 'Level Range'
min_level_input = editbox
end
do
local editbox = aux.gui.editbox(frame.filter)
local editbox = gui.editbox(frame.filter)
editbox:SetPoint('TOPLEFT', min_level_input, 'TOPRIGHT', 10, 0)
editbox:SetWidth(125)
editbox:SetNumeric(true)
@@ -424,26 +424,26 @@ function create_frames()
end
update_form()
end
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
local label = gui.label(editbox, gui.config.medium_font_size)
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText('-')
max_level_input = editbox
end
do
local checkbox = aux.gui.checkbox(frame.filter)
local checkbox = gui.checkbox(frame.filter)
checkbox:SetPoint('TOPLEFT', max_level_input, 'TOPRIGHT', 16, 0)
checkbox:SetScript('OnClick', update_form)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
local label = gui.label(checkbox, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Usable')
usable_checkbox = checkbox
end
do
local dropdown = aux.gui.dropdown(frame.filter)
local dropdown = gui.dropdown(frame.filter)
class_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
local label = gui.label(dropdown, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Class')
UIDropDownMenu_Initialize(dropdown, initialize_class_dropdown)
@@ -452,11 +452,11 @@ function create_frames()
end)
end
do
local dropdown = aux.gui.dropdown(frame.filter)
local dropdown = gui.dropdown(frame.filter)
subclass_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
local label = gui.label(dropdown, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Subclass')
UIDropDownMenu_Initialize(dropdown, initialize_subclass_dropdown)
@@ -465,11 +465,11 @@ function create_frames()
end)
end
do
local dropdown = aux.gui.dropdown(frame.filter)
local dropdown = gui.dropdown(frame.filter)
slot_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
local label = gui.label(dropdown, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Slot')
UIDropDownMenu_Initialize(dropdown, initialize_slot_dropdown)
@@ -478,11 +478,11 @@ function create_frames()
end)
end
do
local dropdown = aux.gui.dropdown(frame.filter)
local dropdown = gui.dropdown(frame.filter)
quality_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
local label = gui.label(dropdown, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Min Quality')
UIDropDownMenu_Initialize(dropdown, initialize_quality_dropdown)
@@ -490,9 +490,9 @@ function create_frames()
UIDropDownMenu_Initialize(this, initialize_quality_dropdown)
end)
end
aux.gui.vertical_line(frame.filter, 332)
gui.vertical_line(frame.filter, 332)
do
local dropdown = aux.gui.dropdown(frame.filter)
local dropdown = gui.dropdown(frame.filter)
dropdown:SetPoint('TOPRIGHT', -174.5, -10)
dropdown:SetWidth(150)
UIDropDownMenu_Initialize(dropdown, initialize_filter_dropdown)
@@ -500,24 +500,24 @@ function create_frames()
UIDropDownMenu_Initialize(this, initialize_filter_dropdown)
end)
getglobal(dropdown:GetName()..'Text'):Hide()
local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size)
local label = gui.label(dropdown, gui.config.medium_font_size)
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
label:SetText('Post Filter')
filter_dropdown = dropdown
end
do
local input = aux.gui.editbox(frame.filter)
local input = gui.editbox(frame.filter)
input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0)
input:SetWidth(150)
input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end)
input.complete = aux.completion.complete(function() return {'and', 'or', 'not', unpack(keys(aux.filter.filters))} end)
input.complete = completion.complete(function() return {'and', 'or', 'not', unpack(keys(filter.filters))} end)
input.char = function() this:complete() end
input.change = function()
local filter = this:GetText()
if aux.filter.filters[filter] and aux.filter.filters[filter].input_type ~= '' then
local _, _, suggestions = aux.filter.parse_query_string(filter..'/')
filter_parameter_input:SetNumeric(aux.filter.filters[filter].input_type == 'number')
filter_parameter_input.complete = aux.completion.complete(function() return suggestions or {} end)
if filter.filters[filter] and filter.filters[filter].input_type ~= '' then
local _, _, suggestions = filter.parse_query_string(filter..'/')
filter_parameter_input:SetNumeric(filter.filters[filter].input_type == 'number')
filter_parameter_input.complete = completion.complete(function() return suggestions or {} end)
filter_parameter_input:Show()
else
filter_parameter_input:Hide()
@@ -533,7 +533,7 @@ function create_frames()
filter_input = input
end
do
local input = aux.gui.editbox(frame.filter)
local input = gui.editbox(frame.filter)
input:SetPoint('LEFT', filter_dropdown, 'RIGHT', 10, 0)
input:SetWidth(150)
input:SetScript('OnTabPressed', function()
@@ -575,11 +575,11 @@ function create_frames()
scroll_frame:SetScript('OnDragStop', function()
this:SetScript('OnUpdate', nil)
end)
aux.gui.set_content_style(scroll_frame, -2, -2, -2, -2)
gui.set_content_style(scroll_frame, -2, -2, -2, -2)
local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame)
scroll_frame:SetScrollChild(scroll_child)
scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], 23)
scroll_child:SetTextColor('p', aux.gui.color.label.enabled())
scroll_child:SetTextColor('p', gui.color.label.enabled())
scroll_child:SetWidth(1)
scroll_child:SetHeight(1)
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
@@ -591,12 +591,12 @@ function create_frames()
status_bars = {}
tables = {}
for _=1,5 do
local status_bar = aux.gui.status_bar(frame)
local status_bar = gui.status_bar(frame)
status_bar:SetAllPoints(status_bar_frame)
status_bar:Hide()
tinsert(status_bars, status_bar)
local table = aux.auction_listing.CreateAuctionResultsTable(frame.results, aux.auction_listing.search_config)
local table = auction_listing.CreateAuctionResultsTable(frame.results, auction_listing.search_config)
table:SetHandler('OnCellClick', function(cell, button)
if IsAltKeyDown() and current_search.table:GetSelection().record == cell.row.data.record then
if button == 'LeftButton' and buyout_button:IsEnabled() then
@@ -659,7 +659,7 @@ function create_frames()
end
}
recent_searches_listing = aux.listing.CreateScrollingTable(frame.saved.recent)
recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
recent_searches_listing:EnableSorting(false)
recent_searches_listing:DisableSelection(true)
@@ -667,7 +667,7 @@ function create_frames()
recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
favorite_searches_listing = aux.listing.CreateScrollingTable(frame.saved.favorite)
favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite)
favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}}
favorite_searches_listing:EnableSorting(false)
favorite_searches_listing:DisableSelection(true)
+17 -17
View File
@@ -98,7 +98,7 @@ function update_continuation()
end
function discard_continuation()
aux.scan.abort(search_scan_id)
scan.abort(search_scan_id)
current_search.continuation = nil
update_continuation()
end
@@ -115,7 +115,7 @@ end
function update_auto_buy_filter()
if g.aux_auto_buy_filter ~= '' then
local queries = aux.filter.queries(g.aux_auto_buy_filter)
local queries = filter.queries(g.aux_auto_buy_filter)
if queries then
if getn(queries) > 1 then
log('Error: The automatic buyout filter may contain only one query')
@@ -144,7 +144,7 @@ function start_real_time_scan(query, search, continuation)
local next_page
local new_records = {}
search_scan_id = aux.scan.start{
search_scan_id = scan.start{
type = 'list',
queries = {query},
auto_buy_validator = search.auto_buy_validator,
@@ -162,8 +162,8 @@ function start_real_time_scan(query, search, continuation)
if not ignore_page then
if search.auto_buy then
ctrl.suspend()
aux.place_bid('list', auction_record.index, auction_record.buyout_price, L(ctrl.resume, true))
aux.control.thread(aux.control.when, later(GetTime(), 10), L(ctrl.resume, false))
place_bid('list', auction_record.index, auction_record.buyout_price, L(ctrl.resume, true))
control.thread(control.when, later(GetTime(), 10), L(ctrl.resume, false))
else
tinsert(new_records, auction_record)
end
@@ -228,7 +228,7 @@ function start_search(queries, continuation)
end
search_scan_id = aux.scan.start{
search_scan_id = scan.start{
type = 'list',
queries = queries,
auto_buy_validator = search.auto_buy_validator,
@@ -258,8 +258,8 @@ function start_search(queries, continuation)
on_auction = function(auction_record, ctrl)
if search.auto_buy then
ctrl.suspend()
aux.place_bid('list', auction_record.index, auction_record.buyout_price, L(ctrl.resume, true))
aux.control.thread(aux.control.when, later(GetTime(), 10), L(ctrl.resume, false))
place_bid('list', auction_record.index, auction_record.buyout_price, L(ctrl.resume, true))
control.thread(control.when, later(GetTime(), 10), L(ctrl.resume, false))
elseif getn(search.records) < 1000 then
tinsert(search.records, auction_record)
if getn(search.records) == 1000 then
@@ -310,7 +310,7 @@ function public.execute(resume, real_time)
end
local filter_string = search_box:GetText()
local queries = aux.filter.queries(filter_string)
local queries = filter.queries(filter_string)
if not queries then
return
elseif real_time then
@@ -367,7 +367,7 @@ end
function test(record)
return function(index)
local auction_info = aux.info.auction(index)
local auction_info = info.auction(index)
return auction_info and auction_info.search_signature == record.search_signature
end
end
@@ -381,13 +381,13 @@ do
function find_auction(record)
local search = current_search
if not search.table:ContainsRecord(record) or aux.is_player(record.owner) then
if not search.table:ContainsRecord(record) or is_player(record.owner) then
return
end
aux.scan.abort(scan_id)
scan.abort(scan_id)
state = SEARCHING
scan_id = aux.scan_util.find(
scan_id = scan_util.find(
record,
current_search.status_bar,
function()
@@ -408,8 +408,8 @@ do
if not record.high_bidder then
bid_button:SetScript('OnClick', function()
if test(record)(index) and search.table:ContainsRecord(record) then
aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
aux.info.bid_update(record)
place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
info.bid_update(record)
search.table:SetDatabase()
end or L(search.table.RemoveAuctionRecord, search.table, record))
end
@@ -420,7 +420,7 @@ do
if record.buyout_price > 0 then
buyout_button:SetScript('OnClick', function()
if test(record)(index) and search.table:ContainsRecord(record) then
aux.place_bid('list', index, record.buyout_price, L(search.table.RemoveAuctionRecord, search.table, record))
place_bid('list', index, record.buyout_price, L(search.table.RemoveAuctionRecord, search.table, record))
end
end)
buyout_button:Enable()
@@ -447,7 +447,7 @@ do
elseif state == FOUND and not test(selection.record)(found_index) then
buyout_button:Disable()
bid_button:Disable()
if not aux.bid_in_progress() then
if not bid_in_progress() then
state = IDLE
end
end