refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-11-06 14:58:06 +01:00
parent efbae0d433
commit 923aa5794b
22 changed files with 130 additions and 132 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ function M.get_bids_loaded() return bids_loaded end
local current_owner_page
function M.get_current_owner_page() return current_owner_page end
local event_frame = CreateFrame'Frame'
local event_frame = CreateFrame('Frame')
for event in temp-S('ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE') do
event_frame:RegisterEvent(event)
@@ -196,7 +196,7 @@ do
end
function ADDON_LOADED.Blizzard_AuctionUI()
AuctionFrame:UnregisterEvent'AUCTION_HOUSE_SHOW'
AuctionFrame:UnregisterEvent('AUCTION_HOUSE_SHOW')
AuctionFrame:SetScript('OnHide', nil)
hook('ShowUIPanel', function(...) auto_release(arg, true)
if arg[1] == AuctionFrame then return AuctionFrame:Show() end
+1 -1
View File
@@ -33,7 +33,7 @@ do
end
function color_accessor(callback)
return function()
return index_function({ callback=callback, table=COLORS }, index_handler)
return index_function({callback=callback, table=COLORS}, index_handler)
end
end
end
+1 -1
View File
@@ -1,6 +1,6 @@
module 'aux'
local event_frame = CreateFrame'Frame'
local event_frame = CreateFrame('Frame')
local listeners, threads = t, t
+2 -4
View File
@@ -9,10 +9,8 @@ local persistence = require 'aux.util.persistence'
local MIN_ITEM_ID = 1
local MAX_ITEM_ID = 30000
--items_schema = record '#' {name='string'} {quality='number'} {level='number'} {class='string'} {subclass='string'} {slot='string'} {max_stack='number'} {texture='string'} -- TODO
local items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
local merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'}}
local items_schema = {'tuple', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
local merchant_buy_schema = {'tuple', '#', {unit_price='number'}, {limited='boolean'}}
_G.aux_items = t
_G.aux_item_ids = t
+1 -1
View File
@@ -5,7 +5,7 @@ include 'aux'
local persistence = require 'aux.util.persistence'
local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}} }
local history_schema = {'tuple', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'tuple', '@', {market_value='number'}, {time='number'}}}}}
local value_cache = t
+11 -11
View File
@@ -9,29 +9,29 @@ local cache = require 'aux.core.cache'
_G.aux_ignore_owner = true
_G.SLASH_AUX1 = '/aux'
function _G.SlashCmdList.AUX(command)
function SlashCmdList.AUX(command)
if not command then return end
local arguments = tokenize(command)
if arguments[1] == 'clear' and arguments[2] == 'history' then
persistence.dataset = nil
print'History cleared.'
persistence.dataset.history = nil
print('History cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'post' then
persistence.dataset.post = nil
print'Post settings cleared.'
print('Post settings cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then
_G.aux_datasets = t
print'Datasets cleared.'
print('Datasets cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
_G.aux_merchant_buy = t
print'Merchant buy prices cleared.'
print('Merchant buy prices cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
_G.aux_merchant_sell = t
print'Merchant sell prices cleared.'
print('Merchant sell prices cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
_G.aux_items = t
_G.aux_item_ids = t
_G.aux_auctionable_items = t
print'Item cache cleared.'
print('Item cache cleared.')
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
cache.populate_wdb()
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
@@ -59,7 +59,7 @@ function _G.SlashCmdList.AUX(command)
_G.aux_ignore_owner = not aux_ignore_owner
print('Ignoring of owner ' .. (aux_ignore_owner and 'enabled' or 'disabled') .. '.')
elseif arguments[1] == 'chars' and arguments[2] == 'add' then
local realm = GetCVar('realmName')
local realm = GetCVar'realmName'
aux_characters[realm] = aux_characters[realm] or t
for i = 3, getn(arguments) do
local name = gsub(strlower(arguments[i]), '^%l', strupper)
@@ -69,7 +69,7 @@ function _G.SlashCmdList.AUX(command)
end
end
elseif arguments[1] == 'chars' and arguments[2] == 'remove' then
local realm = GetCVar('realmName')
local realm = GetCVar'realmName'
if not aux_characters[realm] then
return
end
@@ -81,7 +81,7 @@ function _G.SlashCmdList.AUX(command)
end
end
elseif arguments[1] == 'chars' then
local realm = GetCVar('realmName')
local realm = GetCVar'realmName'
local chars = t
for name in aux_characters[realm] or t do
tinsert(chars, name)
+6 -6
View File
@@ -54,7 +54,7 @@ function extend_tooltip(tooltip, link, quantity)
local item_id, suffix_id = info.parse_link(link)
quantity = IsShiftKeyDown() and quantity or 1
if aux_tooltip_disenchant_source then
local color = { r=.7, g=.7, b=.7 }
local color = {r=.7, g=.7, b=.7}
local type, range = disenchant.source(item_id)
if type == 'CRYSTAL' then
tooltip:AddLine(format('Can disenchant from level %s |cffa335eeEpic|r and |cff0070ddRare|r items.', range), color.r, color.g, color.b, true)
@@ -71,7 +71,7 @@ function extend_tooltip(tooltip, link, quantity)
local distribution = disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
if getn(distribution) > 0 then
if aux_tooltip_disenchant_distribution then
local color = { r=.8, g=.8, b=.2 }
local color = {r=.8, g=.8, b=.2}
tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
sort(distribution, function(a,b) return a.probability > b.probability end)
@@ -80,7 +80,7 @@ function extend_tooltip(tooltip, link, quantity)
end
end
if aux_tooltip_disenchant_value then
local color = { r=.1, g=.6, b=.6 }
local color = {r=.1, g=.6, b=.6}
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level)
tooltip:AddLine('Disenchant Value: ' .. (disenchant_value and money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
@@ -88,20 +88,20 @@ function extend_tooltip(tooltip, link, quantity)
end
end
if aux_tooltip_vendor_buy then
local color = { r=.8, g=.5, b=.1 }
local color = {r=.8, g=.5, b=.1}
local _, price, limited = cache.merchant_info(item_id)
if price then
tooltip:AddLine('Vendor Buy ' .. (limited and '(limited): ' or ': ') .. money.to_string2(price * quantity), color.r, color.g, color.b)
end
end
if aux_tooltip_vendor_sell then
local color = { r=.8, g=.5, b=.1 }
local color = {r=.8, g=.5, b=.1}
local price = cache.merchant_info(item_id)
if price ~= 0 then
tooltip:AddLine('Vendor Sell: ' .. (price and money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
end
end
local color = { r=1, g=1, b=.6 }
local color = {r=1, g=1, b=.6}
local auctionable = not item_info or info.auctionable(info.tooltip(function(tooltip) tooltip:SetHyperlink(item_info.itemstring) end), item_info.quality)
local item_key = (item_id or 0) .. ':' .. (suffix_id or 0)
local value = history.value(item_key)
+4 -4
View File
@@ -18,11 +18,11 @@ do
frame:SetMovable(true)
frame:EnableMouse(true)
frame:SetClampedToScreen(true)
frame:RegisterForDrag'LeftButton'
frame:RegisterForDrag('LeftButton')
frame:SetScript('OnDragStart', function() this:StartMoving() end)
frame:SetScript('OnDragStop', function() this:StopMovingOrSizing() end)
frame:SetScript('OnShow', function() PlaySound'AuctionWindowOpen' end)
frame:SetScript('OnHide', function() PlaySound'AuctionWindowClose'; CloseAuctionHouse() end)
frame:SetScript('OnShow', function() PlaySound('AuctionWindowOpen') end)
frame:SetScript('OnHide', function() PlaySound('AuctionWindowClose'); CloseAuctionHouse() end)
frame.content = CreateFrame('Frame', nil, frame)
frame.content:SetPoint('TOPLEFT', 4, -80)
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
@@ -38,7 +38,7 @@ do
local btn = gui.button(AuxFrame)
btn:SetPoint('BOTTOMRIGHT', -5, 5)
gui.set_size(btn, 60, 24)
btn:SetText'Close'
btn:SetText('Close')
btn:SetScript('OnClick', papply(AuxFrame.Hide, AuxFrame))
close_button = btn
end
+14 -14
View File
@@ -17,11 +17,11 @@ local HEAD_HEIGHT = 27
local HEAD_SPACE = 2
local AUCTION_PCT_COLORS = {
{ color=inline_color.blue, value=50 },
{ color=inline_color.green, value=80 },
{ color=inline_color.yellow, value=110 },
{ color=inline_color.orange, value=135 },
{ color=inline_color.red, value=huge },
{color=inline_color.blue, value=50},
{color=inline_color.green, value=80},
{color=inline_color.yellow, value=110},
{color=inline_color.orange, value=135},
{color=inline_color.red, value=huge},
}
local TIME_LEFT_STRINGS = {
@@ -168,9 +168,9 @@ M.search_config = {
fill = function(cell, record)
local color
if record.high_bidder then
color = AUCTION_PCT_COLORS[2].color
color = inline_color.green
elseif record.high_bid ~= 0 then
color = AUCTION_PCT_COLORS[4].color
color = inline_color.orange
end
local price
if record.high_bidder then
@@ -920,7 +920,7 @@ local methods = {
break
end
end
tinsert(self.sorts, 1, { index=abs(arg[k]), descending=arg[k] < 0 })
tinsert(self.sorts, 1, {index=abs(arg[k]), descending=arg[k] < 0})
end
self.isSorted = nil
@@ -986,7 +986,7 @@ function M.CreateAuctionResultsTable(parent, config)
rt.handlers = t
rt.sorts = t
rt.records = t
rt.rowInfo = { numDisplayRows=0 }
rt.rowInfo = {numDisplayRows=0}
for name, func in methods do
rt[name] = func
@@ -1047,8 +1047,8 @@ function M.CreateAuctionResultsTable(parent, config)
cell:SetScript('OnClick', rt.OnHeadColumnClick)
local text = cell:CreateFontString()
text:SetJustifyH'CENTER'
text:SetJustifyV'CENTER'
text:SetJustifyH('CENTER')
text:SetJustifyV('CENTER')
text:SetFont(gui.font, 12)
text:SetTextColor(color.label.enabled())
cell:SetFontString(text)
@@ -1057,14 +1057,14 @@ function M.CreateAuctionResultsTable(parent, config)
local tex = cell:CreateTexture()
tex:SetAllPoints()
tex:SetTexture[[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]]
tex:SetTexture([[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]])
tex:SetTexCoord(.017, 1, .083, .909)
tex:SetAlpha(.5)
cell:SetNormalTexture(tex)
local tex = cell:CreateTexture()
tex:SetAllPoints()
tex:SetTexture[[Interface\Buttons\UI-Listbox-Highlight]]
tex:SetTexture([[Interface\Buttons\UI-Listbox-Highlight]])
tex:SetTexCoord(.025, .957, .087, .931)
tex:SetAlpha(.2)
cell:SetHighlightTexture(tex)
@@ -1097,7 +1097,7 @@ function M.CreateAuctionResultsTable(parent, config)
local text = cell:CreateFontString()
text:SetFont(gui.font, min(14, rt.ROW_HEIGHT))
text:SetJustifyH(rt.config[j].align or 'LEFT')
text:SetJustifyV'CENTER'
text:SetJustifyV('CENTER')
text:SetPoint('TOPLEFT', 1, -1)
text:SetPoint('BOTTOMRIGHT', -1, 1)
cell:SetFontString(text)
+18 -18
View File
@@ -19,7 +19,7 @@ function LOAD()
aux_border:SetTexture(1, 1, 1, .02)
aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2)
aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5)
aux_border:SetBlendMode'ADD'
aux_border:SetBlendMode('ADD')
aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY')
aux_background:SetTexture(color.content.background())
aux_background:SetAllPoints(DropDownList1Backdrop)
@@ -75,7 +75,7 @@ function LOAD()
text:SetShadowOffset(1, -1)
local highlight = _G['DropDownList1Button' .. i .. 'Highlight']
highlight:SetAllPoints()
highlight:SetDrawLayer'BACKGROUND'
highlight:SetDrawLayer('BACKGROUND')
local check = _G['DropDownList1Button' .. i .. 'Check']
check:SetWidth(24)
check:SetHeight(24)
@@ -173,14 +173,14 @@ function M.button(parent, text_height)
local highlight = button:CreateTexture(nil, 'HIGHLIGHT')
highlight:SetAllPoints()
highlight:SetTexture(1, 1, 1, .2)
highlight:SetBlendMode'BLEND'
highlight:SetBlendMode('BLEND')
button.highlight = highlight
do
local label = button:CreateFontString()
label:SetFont(font, text_height)
label:SetPoint('CENTER', 0, 0)
label:SetJustifyH'CENTER'
label:SetJustifyV'CENTER'
label:SetJustifyH('CENTER')
label:SetJustifyV('CENTER')
label:SetHeight(text_height)
label:SetTextColor(color.text.enabled())
button:SetFontString(label)
@@ -223,14 +223,14 @@ do
local highlight = tab:CreateTexture(nil, 'HIGHLIGHT')
highlight:SetAllPoints()
highlight:SetTexture(1, 1, 1, .2)
highlight:SetBlendMode'BLEND'
highlight:SetBlendMode('BLEND')
tab.highlight = highlight
tab.text = tab:CreateFontString()
tab.text:SetPoint('LEFT', 3, -1)
tab.text:SetPoint('RIGHT', -3, -1)
tab.text:SetJustifyH'CENTER'
tab.text:SetJustifyV'CENTER'
tab.text:SetJustifyH('CENTER')
tab.text:SetJustifyV('CENTER')
tab.text:SetFont(font, font_size.large)
tab:SetFontString(tab.text)
@@ -238,7 +238,7 @@ do
tab:SetScript('OnClick', function()
if this.id ~= this.group.selected then
PlaySound'igCharacterInfoTab'
PlaySound('igCharacterInfoTab')
this.group:select(this.id)
end
end)
@@ -335,7 +335,7 @@ function M.editbox(parent)
local last_click = T('t', 0)
editbox:SetScript('OnMouseDown', function()
if arg1 == 'RightButton' then
this:SetText''
this:SetText('')
this:ClearFocus()
this.block_focus = true
else
@@ -365,7 +365,7 @@ function M.editbox(parent)
overlay:SetPoint('RIGHT', -1.5, 0)
overlay:SetTextColor(color.text.enabled())
editbox.overlay = overlay
editbox:SetAlignment'LEFT'
editbox:SetAlignment('LEFT')
editbox:SetFontSize(font_size.medium)
return editbox
end
@@ -377,10 +377,10 @@ function M.status_bar(parent)
do
-- minor status bar (gray one)
local status_bar = CreateFrame('STATUSBAR', nil, self, 'TextStatusBar')
status_bar:SetOrientation'HORIZONTAL'
status_bar:SetOrientation('HORIZONTAL')
status_bar:SetMinMaxValues(0, 100)
status_bar:SetAllPoints()
status_bar:SetStatusBarTexture[[Interface\Buttons\WHITE8X8]]
status_bar:SetStatusBarTexture([[Interface\Buttons\WHITE8X8]])
status_bar:SetStatusBarColor(.42, .42, .42, .7)
status_bar:SetFrameLevel(level + 2)
status_bar:SetScript('OnUpdate', function()
@@ -395,10 +395,10 @@ function M.status_bar(parent)
do
-- major status bar (main blue one)
local status_bar = CreateFrame('STATUSBAR', nil, self, 'TextStatusBar')
status_bar:SetOrientation'HORIZONTAL'
status_bar:SetOrientation('HORIZONTAL')
status_bar:SetMinMaxValues(0, 100)
status_bar:SetAllPoints()
status_bar:SetStatusBarTexture[[Interface\Buttons\WHITE8X8]]
status_bar:SetStatusBarTexture([[Interface\Buttons\WHITE8X8]])
status_bar:SetStatusBarColor(.19, .22, .33, .9)
status_bar:SetFrameLevel(level + 3)
status_bar:SetScript('OnUpdate', function()
@@ -512,7 +512,7 @@ end
function M.slider(parent)
local slider = CreateFrame('Slider', nil, parent)
slider:SetOrientation'HORIZONTAL'
slider:SetOrientation('HORIZONTAL')
slider:SetHeight(6)
slider:SetHitRectInsets(0, 0, -12, -12)
slider:SetValue(0)
@@ -537,7 +537,7 @@ function M.slider(parent)
local editbox = editbox(slider)
editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0)
set_size(editbox, 45, 18)
editbox:SetAlignment'CENTER'
editbox:SetAlignment('CENTER')
editbox:SetFontSize(17)
slider.label = label
@@ -555,7 +555,7 @@ function M.checkbox(parent)
checkbox:GetHighlightTexture():SetAllPoints()
checkbox:GetHighlightTexture():SetTexture(1, 1, 1, .2)
checkbox:GetCheckedTexture():SetTexCoord(.12, .88, .12, .88)
checkbox:GetHighlightTexture'BLEND'
checkbox:GetHighlightTexture('BLEND')
return checkbox
end
+1 -1
View File
@@ -11,7 +11,7 @@ local ST_ROW_HEIGHT = 15
local ST_ROW_TEXT_SIZE = 14
local ST_HEAD_HEIGHT = 26.3
local ST_HEAD_SPACE = 2
local DEFAULT_COL_INFO = {{ width=1 }}
local DEFAULT_COL_INFO = {{width=1}}
local function GetTableIndex(tbl, value)
+4 -4
View File
@@ -28,13 +28,13 @@ end
function M.scan_auctions()
status_bar:update_status(0,0)
status_bar:set_text'Scanning auctions...'
status_bar:set_text('Scanning auctions...')
wipe(auction_records)
update_listing()
scan.start{
type = 'owner',
queries = {{ blizzard_query = t }},
queries = {{blizzard_query = t}},
on_page_loaded = function(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))
@@ -44,12 +44,12 @@ function M.scan_auctions()
end,
on_complete = function()
status_bar:update_status(100, 100)
status_bar:set_text'Scan complete'
status_bar:set_text('Scan complete')
update_listing()
end,
on_abort = function()
status_bar:update_status(100, 100)
status_bar:set_text'Scan aborted'
status_bar:set_text('Scan aborted')
end,
}
end
+3 -3
View File
@@ -32,19 +32,19 @@ do
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text''
status_bar:set_text('')
end
do
local btn = gui.button(frame)
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
btn:SetText'Cancel'
btn:SetText('Cancel')
btn:Disable()
cancel_button = btn
end
do
local btn = gui.button(frame)
btn:SetPoint('TOPLEFT', cancel_button, 'TOPRIGHT', 5, 0)
btn:SetText'Refresh'
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
scan_auctions()
end)
+4 -4
View File
@@ -28,13 +28,13 @@ end
function M.scan_bids()
status_bar:update_status(0,0)
status_bar:set_text'Scanning auctions...'
status_bar:set_text('Scanning auctions...')
wipe(auction_records)
update_listing()
scan.start{
type = 'bidder',
queries = {{ blizzard_query=t }},
queries = {{blizzard_query=t}},
on_page_loaded = function(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))
@@ -44,12 +44,12 @@ function M.scan_bids()
end,
on_complete = function()
status_bar:update_status(100, 100)
status_bar:set_text'Scan complete'
status_bar:set_text('Scan complete')
update_listing()
end,
on_abort = function()
status_bar:update_status(100, 100)
status_bar:set_text'Scan aborted'
status_bar:set_text('Scan aborted')
end,
}
end
+3 -3
View File
@@ -41,21 +41,21 @@ end
do
local btn = gui.button(frame)
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
btn:SetText'Bid'
btn:SetText('Bid')
btn:Disable()
bid_button = btn
end
do
local btn = gui.button(frame)
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
btn:SetText'Buyout'
btn:SetText('Buyout')
btn:Disable()
buyout_button = btn
end
do
local btn = gui.button(frame)
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
btn:SetText'Refresh'
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
scan_bids()
end)
+5 -5
View File
@@ -17,7 +17,7 @@ local al = require 'aux.gui.auction_listing'
TAB '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'}}
local settings_schema = {'tuple', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
function get_default_settings()
return T('duration', DURATION_8 , 'stack_size', 1, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
@@ -277,7 +277,7 @@ function update_item_configuration()
item.texture:SetTexture(nil)
item.count:SetText()
item.name:SetTextColor(color.label.enabled())
item.name:SetText'No item selected'
item.name:SetText('No item selected')
unit_start_price_input:Hide()
unit_buyout_price_input:Hide()
@@ -451,7 +451,7 @@ function refresh_entries()
existing_auctions[item_key] = nil
local query = scan_util.item_query(item_id)
status_bar:update_status(0,0)
status_bar:set_text'Scanning auctions...'
status_bar:set_text('Scanning auctions...')
scan_id = scan.start{
type = 'list',
@@ -477,13 +477,13 @@ function refresh_entries()
existing_auctions[item_key] = nil
update_historical_value_button()
status_bar:update_status(100, 100)
status_bar:set_text'Scan aborted'
status_bar:set_text('Scan aborted')
end,
on_complete = function()
existing_auctions[item_key] = existing_auctions[item_key] or t
refresh = true
status_bar:update_status(100, 100)
status_bar:set_text'Scan complete'
status_bar:set_text('Scan complete')
end,
}
end
+7 -7
View File
@@ -64,13 +64,13 @@ inventory_listing = item_listing.create(
auction_listing = listing.CreateScrollingTable(frame.auctions)
auction_listing:SetColInfo{
{ name='Auctions', width=.12, align='CENTER' },
{ name='Left', width=.1, align='CENTER' },
{ name='Qty', width=.08, align='CENTER' },
{ name='Bid/ea', width=.22, align='RIGHT' },
{ name='Bid Pct', width=.13, align='CENTER' },
{ name='Buy/ea', width=.22, align='RIGHT' },
{ name='Buy Pct', width=.13, align='CENTER' },
{name='Auctions', width=.12, align='CENTER'},
{name='Left', width=.1, align='CENTER'},
{name='Qty', width=.08, align='CENTER'},
{name='Bid/ea', width=.22, align='RIGHT'},
{name='Bid Pct', width=.13, align='CENTER'},
{name='Buy/ea', width=.22, align='RIGHT'},
{name='Buy Pct', width=.13, align='CENTER'},
}
auction_listing:EnableSorting(false)
auction_listing:DisableSelection(true)
+6 -6
View File
@@ -40,7 +40,7 @@ do
btn:SetPoint('TOPLEFT', 5, -8)
btn:SetWidth(30)
btn:SetHeight(25)
btn:SetText'<'
btn:SetText('<')
btn:SetScript('OnClick', previous_search)
previous_button = btn
end
@@ -49,7 +49,7 @@ do
btn:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0)
btn:SetWidth(30)
btn:SetHeight(25)
btn:SetText'>'
btn:SetText('>')
btn:SetScript('OnClick', next_search)
next_button = btn
end
@@ -99,7 +99,7 @@ do
local label = gui.label(editbox, gui.font_size.medium)
label:SetPoint('LEFT', editbox, 'RIGHT', 0, 0)
label:SetTextColor(color.label.enabled())
label:SetText'-'
label:SetText('-')
first_page_input = editbox
end
do
@@ -125,7 +125,7 @@ do
local btn = gui.button(frame)
btn:SetHeight(25)
btn:SetPoint('TOPRIGHT', -5, -8)
btn:SetText'Search'
btn:SetText('Search')
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
btn:SetScript('OnClick', function()
if arg1 == 'RightButton' then
@@ -358,7 +358,7 @@ do
end
local label = gui.label(editbox, gui.font_size.medium)
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText'-'
label:SetText('-')
max_level_input = editbox
end
do
@@ -488,7 +488,7 @@ do
child:SetFont('p', [[Fonts\ARIALN.TTF]], bounded(11, 23, select(2, child:GetFont()) + arg1*2))
update_filter_display()
end)
scroll_frame:RegisterForDrag'LeftButton'
scroll_frame:RegisterForDrag('LeftButton')
scroll_frame:SetScript('OnDragStart', function()
this.x, this.y = GetCursorPosition()
this.x_offset, this.y_offset = this:GetHorizontalScroll(), this:GetVerticalScroll()
+11 -11
View File
@@ -86,7 +86,7 @@ do
search.status_bar = status_bars[getn(searches)]
search.status_bar:update_status(100, 100)
search.status_bar:set_text''
search.status_bar:set_text('')
search.table = tables[getn(searches)]
search.table:SetSort(1, 2, 3, 4, 5, 6, 7, 8, 9)
@@ -159,7 +159,7 @@ function start_real_time_scan(query, search, continuation)
auto_buy_validator = search.auto_buy_validator,
on_scan_start = function()
search.status_bar:update_status(99.99, 99.99)
search.status_bar:set_text'Scanning last page ...'
search.status_bar:set_text('Scanning last page ...')
end,
on_page_loaded = function(_, _, last_page)
next_page = last_page
@@ -184,7 +184,7 @@ function start_real_time_scan(query, search, continuation)
new_records = values(map)
if getn(new_records) > 2000 then
StaticPopup_Show'AUX_SEARCH_TABLE_FULL'
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
else
search.records = new_records
search.table:SetDatabase(search.records)
@@ -196,7 +196,7 @@ function start_real_time_scan(query, search, continuation)
end,
on_abort = function()
search.status_bar:update_status(100, 100)
search.status_bar:set_text'Scan paused'
search.status_bar:set_text('Scan paused')
search.continuation = next_page or not ignore_page and query.blizzard_query.first_page or true
@@ -236,9 +236,9 @@ function start_search(queries, continuation)
on_scan_start = function()
search.status_bar:update_status(0,0)
if continuation then
search.status_bar:set_text'Resuming scan...'
search.status_bar:set_text('Resuming scan...')
else
search.status_bar:set_text'Scanning auctions...'
search.status_bar:set_text('Scanning auctions...')
end
end,
on_page_loaded = function(_, total_scan_pages)
@@ -260,13 +260,13 @@ function start_search(queries, continuation)
if getn(search.records) < 2000 then
tinsert(search.records, auction_record)
if getn(search.records) == 2000 then
StaticPopup_Show'AUX_SEARCH_TABLE_FULL'
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
end
end
end,
on_complete = function()
search.status_bar:update_status(100, 100)
search.status_bar:set_text'Scan complete'
search.status_bar:set_text('Scan complete')
if current_search == search and frame.results:IsVisible() and getn(search.records) == 0 then
subtab = SAVED
@@ -277,7 +277,7 @@ function start_search(queries, continuation)
end,
on_abort = function()
search.status_bar:update_status(100, 100)
search.status_bar:set_text'Scan paused'
search.status_bar:set_text('Scan paused')
if current_query then
search.continuation = {current_query, current_page + 1}
@@ -313,10 +313,10 @@ function M.execute(resume, real_time)
return
elseif real_time then
if getn(queries) > 1 then
print'Error: The real time mode does not support multi-queries'
print('Error: The real time mode does not support multi-queries')
return
elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then
print'Error: The real time mode does not support page ranges'
print('Error: The real time mode does not support page ranges')
return
end
end
+5 -5
View File
@@ -11,7 +11,7 @@ function update_search_listings()
for i, autobuy_filter in aux_auto_buy_filters do
local name = strsub(autobuy_filter.prettified, 1, 250)
tinsert(autobuy_filter_rows, {
cols = {{ value=name }},
cols = {{value=name}},
search = autobuy_filter,
index = i,
})
@@ -22,7 +22,7 @@ function update_search_listings()
for i, favorite_search in aux_favorite_searches do
local name = strsub(favorite_search.prettified, 1, 250)
tinsert(favorite_search_rows, {
cols = {{ value=name }},
cols = {{value=name}},
search = favorite_search,
index = i,
})
@@ -33,7 +33,7 @@ function update_search_listings()
for i, recent_search in aux_recent_searches do
local name = strsub(recent_search.prettified, 1, 250)
tinsert(recent_search_rows, {
cols = {{ value=name }},
cols = {{value=name}},
search = recent_search,
index = i,
})
@@ -136,9 +136,9 @@ function add_auto_buy(filter_string)
local queries, error = filter_util.queries(filter_string)
if queries then
if getn(queries) > 1 then
print'Error: The automatic buyout filter does not support multi-queries'
print('Error: The automatic buyout filter does not support multi-queries')
elseif size(queries[1].blizzard_query) > 0 and not filter_util.parse_filter_string(filter_string).blizzard.exact then
print'Error: The automatic buyout filter does not support Blizzard filters'
print('Error: The automatic buyout filter does not support Blizzard filters')
else
tinsert(aux_auto_buy_filters, 1, T(
'filter_string', filter_string,
+9 -9
View File
@@ -1,22 +1,22 @@
module 'aux'
do
local classes, interfaces, objects = {}, {}, setmetatable({}, { __mode='k' })
local private_mt = { __metatable=false }
local classes, interfaces, objects = {}, {}, setmetatable({}, {__mode='k'})
local private_mt = {__metatable=false}
function private_mt:__newindex(k, v)
classes[self][k] = v
end
local public_mt = { __metatable=false }
local public_mt = {__metatable=false}
function public_mt:__newindex(k, v)
classes[self][k] = v
interfaces[self][k] = function(self, ...)
return classes[self][k](objects[self][k], unpack(arg))
end
end
local proxy_mt = { __metatable=false }
local proxy_mt = {__metatable=false}
function proxy_mt:__call()
local proxy = setmetatable({}, { __metatable=false, __index=interfaces[self] })
objects[proxy] = setmetatable({}, { __index=classes[self] })
local proxy = setmetatable({}, {__metatable=false, __index=interfaces[self]})
objects[proxy] = setmetatable({}, {__index=classes[self]})
return proxy
end
function M.class()
@@ -31,12 +31,12 @@ end
do
local _state = setmetatable(t, T('__mode', 'kv'))
local __index = function(self, k)
return _state[self].handler({ public=self, private=_state[self].state }, k)
return _state[self].handler({public=self, private=_state[self].state}, k)
end
function M.index_function(state, handler) -- TODO rename table-accessor, use predicate to stop
local state, self = { handler=handler, state=state }, t
local state, self = {handler=handler, state=state}, t
_state[self] = state
return setmetatable(self, { __metatable=false, __index=__index, state=state })
return setmetatable(self, {__metatable=false, __index=__index, state=state})
end
end
+12 -12
View File
@@ -26,8 +26,8 @@ function M.read(schema, str)
return tonumber(str)
elseif type(schema) == 'table' and schema[1] == 'list' then
return read_list(schema, str)
elseif type(schema) == 'table' and schema[1] == 'record' then
return read_record(schema, str)
elseif type(schema) == 'table' and schema[1] == 'tuple' then
return read_tuple(schema, str)
else
error('Invalid schema.', 2)
end
@@ -42,14 +42,14 @@ function M.write(schema, obj)
return obj and tostring(obj) or ''
elseif type(schema) == 'table' and schema[1] == 'list' then
return write_list(schema, obj)
elseif type(schema) == 'table' and schema[1] == 'record' then
return write_record(schema, obj)
elseif type(schema) == 'table' and schema[1] == 'tuple' then
return write_tuple(schema, obj)
else
error('Invalid schema.', 2)
end
end
function M.read_list(schema, str)
function read_list(schema, str)
if str == '' then return t end
local separator = schema[2]
local element_type = schema[3]
@@ -58,7 +58,7 @@ function M.read_list(schema, str)
end)
end
function M.write_list(schema, list)
function write_list(schema, list)
local separator = schema[2]
local element_type = schema[3]
local parts = map(copy(list), function(element)
@@ -67,23 +67,23 @@ function M.write_list(schema, list)
return join(parts, separator)
end
function M.read_record(schema, str)
function read_tuple(schema, str)
local separator = schema[2]
local record = t
local tuple = t
local parts = split(str, separator)
for i = 3, getn(schema) do
local key, type = next(schema[i])
record[key] = read(type, parts[i - 2])
tuple[key] = read(type, parts[i - 2])
end
return record
return tuple
end
function M.write_record(schema, record)
function write_tuple(schema, tuple)
local separator = schema[2]
local parts = tt
for i = 3 , getn(schema) do
local key, type = next(schema[i])
tinsert(parts, write(type, record[key]))
tinsert(parts, write(type, tuple[key]))
end
return join(parts, separator)
end