refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-09-30 18:32:19 +02:00
parent 4414ccf084
commit f29cb9ae1d
36 changed files with 531 additions and 298 deletions
+39 -45
View File
@@ -1,27 +1,16 @@
aux = module
include (green_t)
--aux_account_settings = {} -- TODO clean up the mess of savedvariables --aux_account_settings = {} -- TODO clean up the mess of savedvariables
--aux_character_settings = {} --aux_character_settings = {}
do
local modules = {}
local mt = {__metatable=false, __index=function(_, key) return modules[key]._I end, __newindex=error}
aux = function(name)
if not modules[name] then
(function()
modules[name] = module and _E
import (green_t)
private.aux = setmetatable(t, mt)
private.p.set = function(v) inspect(nil, v) end
end)()
end
modules[name].import (modules.core._I)
setfenv(2, modules[name])
end
end
aux 'core'
public.version = '5.0.0' public.version = '5.0.0'
function public.p.set(v)
inspect(nil, v)
end
function public.print(...) auto[arg] = true function public.print(...) auto[arg] = true
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE .. '[aux] ' .. join(map(arg, tostring), ' ')) DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE .. '[aux] ' .. join(map(arg, tostring), ' '))
end end
@@ -56,23 +45,28 @@ do
for _, f in handlers2 do f() end for _, f in handlers2 do f() end
print('v' .. version .. ' loaded.') print('v' .. version .. ' loaded.')
else else
_E[event]() _M[event]()
end end
end) end)
end end
function LOAD()
include (aux_util)
include (aux_control)
include (aux_util_color)
aux_frame.create()
end
private.tab_info = t private.tab_info = t
do function public.TAB(name)
for _, info in temp-A(temp-A('search_tab', 'Search'), temp-A('post_tab', 'Post'), temp-A('auctions_tab', 'Auctions'), temp-A('bids_tab', 'Bids')) do local tab = T('name', name)
local tab = T('name', info[2]) local env = getfenv(2)
local env = (function() _G.aux(info[1]) return _E end)() function env.private.OPEN.set(f) tab.OPEN = f end
function env.private.OPEN.set(f) tab.OPEN = f end function env.private.CLOSE.set(f) tab.CLOSE = f end
function env.private.CLOSE.set(f) tab.CLOSE = f end function env.private.USE_ITEM.set(f) tab.USE_ITEM = f end
function env.private.USE_ITEM.set(f) tab.USE_ITEM = f end function env.private.CLICK_LINK.set(f) tab.CLICK_LINK = f end
function env.private.CLICK_LINK.set(f) tab.CLICK_LINK = f end function env.public.ACTIVE.get() return tab == active_tab end
function env.public.ACTIVE.get() return tab == active_tab end tinsert(tab_info, tab)
tinsert(tab_info, tab)
end
end end
do do
@@ -89,7 +83,7 @@ function private.SetItemRef(...) auto[arg] = true
if arg[3] ~= 'RightButton' or not index(active_tab, 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then if arg[3] ~= 'RightButton' or not index(active_tab, 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then
return orig.SetItemRef(unpack(arg)) return orig.SetItemRef(unpack(arg))
end end
for item_info in present(aux.info.item(tonumber(select(3, strfind(arg[1], '^item:(%d+)'))))) do for item_info in present(aux_info.item(tonumber(select(3, strfind(arg[1], '^item:(%d+)'))))) do
return active_tab.CLICK_LINK(item_info) return active_tab.CLICK_LINK(item_info)
end end
end end
@@ -98,7 +92,7 @@ function private.UseContainerItem(...) auto[arg] = true
if modified or not index(active_tab, 'USE_ITEM') then if modified or not index(active_tab, 'USE_ITEM') then
return orig.UseContainerItem(unpack(arg)) return orig.UseContainerItem(unpack(arg))
end end
for item_info in present(aux.info.container_item(arg[1], arg[2])) do for item_info in present(aux_info.container_item(arg[1], arg[2])) do
return active_tab.USE_ITEM(item_info) return active_tab.USE_ITEM(item_info)
end end
end end
@@ -170,18 +164,18 @@ end
function private.AUCTION_HOUSE_SHOW() function private.AUCTION_HOUSE_SHOW()
AuctionFrame:Hide() AuctionFrame:Hide()
aux_frame:Show() AuxFrame:Show()
tab = 1 tab = 1
end end
function private.AUCTION_HOUSE_CLOSED() function private.AUCTION_HOUSE_CLOSED()
bids_loaded = false bids_loaded = false
current_owner_page = nil current_owner_page = nil
aux.post.stop() aux_post.stop()
aux.stack.stop() aux_stack.stop()
aux.scan.abort() aux_scan.abort()
tab = nil tab = nil
aux_frame:Hide() AuxFrame:Hide()
end end
function private.AUCTION_BIDDER_LIST_UPDATE() function private.AUCTION_BIDDER_LIST_UPDATE()
@@ -213,7 +207,7 @@ end
do do
local function cost_label(cost) local function cost_label(cost)
local label = LIGHTYELLOW_FONT_COLOR_CODE .. '(Total Cost: ' .. FONT_COLOR_CODE_CLOSE local label = LIGHTYELLOW_FONT_COLOR_CODE .. '(Total Cost: ' .. FONT_COLOR_CODE_CLOSE
label = label .. (cost and aux.money.to_string2(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE) label = label .. (cost and aux_money.to_string2(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE)
label = label .. LIGHTYELLOW_FONT_COLOR_CODE .. ')' .. FONT_COLOR_CODE_CLOSE label = label .. LIGHTYELLOW_FONT_COLOR_CODE .. ')' .. FONT_COLOR_CODE_CLOSE
return label return label
end end
@@ -229,10 +223,10 @@ do
total_cost = nil total_cost = nil
break break
end end
local item_id, suffix_id = aux.info.parse_link(link) local item_id, suffix_id = aux_info.parse_link(link)
local count = select(3, GetCraftReagentInfo(id, i)) local count = select(3, GetCraftReagentInfo(id, i))
local _, price, limited = aux.cache.merchant_info(item_id) local _, price, limited = aux_cache.merchant_info(item_id)
local value = price and not limited and price or aux.history.value(item_id .. ':' .. suffix_id) local value = price and not limited and price or aux_history.value(item_id .. ':' .. suffix_id)
if not value then if not value then
total_cost = nil total_cost = nil
break break
@@ -256,10 +250,10 @@ do
total_cost = nil total_cost = nil
break break
end end
local item_id, suffix_id = aux.info.parse_link(link) local item_id, suffix_id = aux_info.parse_link(link)
local count = select(3, GetTradeSkillReagentInfo(id, i)) local count = select(3, GetTradeSkillReagentInfo(id, i))
local _, price, limited = aux.cache.merchant_info(item_id) local _, price, limited = aux_cache.merchant_info(item_id)
local value = price and not limited and price or aux.history.value(item_id .. ':' .. suffix_id) local value = price and not limited and price or aux_history.value(item_id .. ':' .. suffix_id)
if not value then if not value then
total_cost = nil total_cost = nil
break break
+5 -1
View File
@@ -1,4 +1,8 @@
aux 'core' aux_control = module
include (green_t)
include (aux)
include (aux_util)
local event_frame = CreateFrame('Frame') local event_frame = CreateFrame('Frame')
+10 -2
View File
@@ -1,4 +1,12 @@
aux 'cache' local info, persistence = aux.info, aux.persistence aux_cache = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local info, persistence = aux_info, aux_persistence
local MIN_ITEM_ID = 1 local MIN_ITEM_ID = 1
local MAX_ITEM_ID = 30000 local MAX_ITEM_ID = 30000
@@ -28,7 +36,7 @@ function LOAD()
event_listener('NEW_AUCTION_UPDATE', function() event_listener('NEW_AUCTION_UPDATE', function()
for info in present(info.auction_sell_item()) do for info in present(info.auction_sell_item()) do
for item_id in present(item_id(info.name)) do for item_id in present(item_id(info.name)) do
aux_merchant_sell[_E.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count) aux_merchant_sell[_M.item_id(info.name)] = info.vendor_price / (aux_info.max_item_charges(item_id) or info.count)
end end
end end
end) end)
+8 -2
View File
@@ -1,4 +1,10 @@
aux 'disenchant' aux_disenchant = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local UNCOMMON, RARE, EPIC = 2, 3, 4 local UNCOMMON, RARE, EPIC = 2, 3, 4
@@ -69,7 +75,7 @@ local WEAPON = S(
function public.value(slot, quality, level) function public.value(slot, quality, level)
local expectation local expectation
for _, event in distribution(slot, quality, level) do for _, event in distribution(slot, quality, level) do
local value = aux.history.value(event.item_id .. ':' .. 0) local value = aux_history.value(event.item_id .. ':' .. 0)
if not value then if not value then
return return
else else
+9 -1
View File
@@ -1,4 +1,12 @@
aux 'history' local persistence = aux.persistence aux_history = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local persistence = aux_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 = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}} }
+10 -4
View File
@@ -1,4 +1,10 @@
aux 'post' aux_post = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local state local state
@@ -17,15 +23,15 @@ function private.process()
end end
end) end)
return aux.stack.start(state.item_key, state.stack_size, send_signal) return aux_stack.start(state.item_key, state.stack_size, send_signal)
end end
return stop() return stop()
end end
function private.post_auction(slot, k) function private.post_auction(slot, k)
local item_info = aux.info.container_item(unpack(slot)) local item_info = aux_info.container_item(unpack(slot))
if item_info.item_key == state.item_key and aux.info.auctionable(item_info.tooltip) and item_info.aux_quantity == state.stack_size then if item_info.item_key == state.item_key and aux_info.auctionable(item_info.tooltip) and item_info.aux_quantity == state.stack_size then
ClearCursor() ClearCursor()
ClickAuctionSellItemButton() ClickAuctionSellItemButton()
+9 -1
View File
@@ -1,4 +1,12 @@
aux 'scan' local info, history = aux.info, aux.history aux_scan = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local info, history = aux_info, aux_history
local PAGE_SIZE = 50 local PAGE_SIZE = 50
+10 -2
View File
@@ -1,4 +1,12 @@
aux 'slash' local persistence = aux.persistence aux_slash = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local persistence = aux_persistence
aux_ignore_owner = true aux_ignore_owner = true
@@ -27,7 +35,7 @@ function SlashCmdList.AUX(command)
aux_auctionable_items = t aux_auctionable_items = t
print 'Item cache cleared.' print 'Item cache cleared.'
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
aux.cache.populate_wdb() aux_cache.populate_wdb()
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
aux_tooltip_value = not aux_tooltip_value aux_tooltip_value = not aux_tooltip_value
print('Historical value in tooltip ' .. (aux_tooltip_value and 'enabled' or 'disabled') .. '.') print('Historical value in tooltip ' .. (aux_tooltip_value and 'enabled' or 'disabled') .. '.')
+9 -1
View File
@@ -1,4 +1,12 @@
aux 'stack' local info = aux.info aux_stack = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local info = aux_info
local state local state
+10 -2
View File
@@ -1,4 +1,12 @@
aux 'tooltip' local info, disenchant, cache, money, history = aux.info, aux.disenchant, aux.cache, aux.money, aux.history aux_tooltip = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local info, disenchant, cache, money, history = aux_info, aux_disenchant, aux_cache, aux_money, aux_history
aux_tooltip_value = true aux_tooltip_value = true
@@ -101,7 +109,7 @@ function extend_tooltip(tooltip, link, quantity)
end end
if aux_tooltip_daily then if aux_tooltip_daily then
local market_value = history.market_value(item_key) local market_value = history.market_value(item_key)
tooltip:AddLine('Today: ' .. (market_value and money.to_string2(market_value * quantity) .. ' (' .. aux.auction_listing.percentage_historical(round(market_value / value * 100)) .. ')' or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b) tooltip:AddLine('Today: ' .. (market_value and money.to_string2(market_value * quantity) .. ' (' .. aux_auction_listing.percentage_historical(round(market_value / value * 100)) .. ')' or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
end end
end end
+50 -46
View File
@@ -1,49 +1,53 @@
aux 'core' local gui = aux.gui aux_frame = module
function LOAD() local gui = aux_gui
for _, info in tab_info do tabs:create_tab(info.name) end
end
do function public.create()
local frame = CreateFrame('Frame', 'aux_frame', UIParent) setfenv(1, getfenv(2))
tinsert(UISpecialFrames, 'aux_frame') do
gui.set_window_style(frame) local frame = CreateFrame('Frame', 'AuxFrame', UIParent)
gui.set_size(frame, 768, 447) tinsert(UISpecialFrames, 'AuxFrame')
frame:SetPoint('LEFT', 100, 0) gui.set_window_style(frame)
frame:SetToplevel(true) gui.set_size(frame, 768, 447)
frame:SetMovable(true) frame:SetPoint('LEFT', 100, 0)
frame:EnableMouse(true) frame:SetToplevel(true)
frame:SetClampedToScreen(true) frame:SetMovable(true)
frame:RegisterForDrag('LeftButton') frame:EnableMouse(true)
frame:SetScript('OnDragStart', function() this:StartMoving() end) frame:SetClampedToScreen(true)
frame:SetScript('OnDragStop', function() this:StopMovingOrSizing() end) frame:RegisterForDrag('LeftButton')
frame:SetScript('OnShow', function() PlaySound('AuctionWindowOpen') end) frame:SetScript('OnDragStart', function() this:StartMoving() end)
frame:SetScript('OnHide', function() PlaySound('AuctionWindowClose'); CloseAuctionHouse() end) frame:SetScript('OnDragStop', function() this:StopMovingOrSizing() end)
frame.content = CreateFrame('Frame', nil, frame) frame:SetScript('OnShow', function() PlaySound('AuctionWindowOpen') end)
frame.content:SetPoint('TOPLEFT', 4, -80) frame:SetScript('OnHide', function() PlaySound('AuctionWindowClose'); CloseAuctionHouse() end)
frame.content:SetPoint('BOTTOMRIGHT', -4, 35) frame.content = CreateFrame('Frame', nil, frame)
frame:Hide() frame.content:SetPoint('TOPLEFT', 4, -80)
public.aux_frame = frame frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
end frame:Hide()
do public.AuxFrame = frame
private.tabs = gui.tabs(aux_frame, 'DOWN') end
tabs._on_select = on_tab_click do
function public.tab.set(id) tabs:select(id) end private.tabs = gui.tabs(AuxFrame, 'DOWN')
end tabs._on_select = on_tab_click
do function public.tab.set(id) tabs:select(id) end
local btn = gui.button(aux_frame) end
btn:SetPoint('BOTTOMRIGHT', -5, 5) do
gui.set_size(btn, 60, 24) local btn = gui.button(AuxFrame)
btn:SetText('Close') btn:SetPoint('BOTTOMRIGHT', -5, 5)
btn:SetScript('OnClick', papply(aux_frame.Hide, aux_frame)) gui.set_size(btn, 60, 24)
public.close_button = btn btn:SetText('Close')
end btn:SetScript('OnClick', papply(AuxFrame.Hide, AuxFrame))
do public.close_button = btn
local btn = gui.button(aux_frame, gui.font_size.small) end
btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0) do
gui.set_size(btn, 60, 24) local btn = gui.button(AuxFrame, gui.font_size.small)
btn:SetText(color.blizzard'Blizzard UI') btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0)
btn:SetScript('OnClick',function() gui.set_size(btn, 60, 24)
if AuctionFrame:IsVisible() then HideUIPanel(AuctionFrame) else ShowUIPanel(AuctionFrame) end btn:SetText(color.blizzard'Blizzard UI')
end) btn:SetScript('OnClick',function()
if AuctionFrame:IsVisible() then HideUIPanel(AuctionFrame) else ShowUIPanel(AuctionFrame) end
end)
end
for _, info in tab_info do
tabs:create_tab(info.name)
end
end end
+12 -4
View File
@@ -1,4 +1,12 @@
aux 'auction_listing' local gui, sorting, money, info = aux.gui, aux.sorting, aux.money, aux.info aux_auction_listing = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local gui, sorting, money, info = aux_gui, aux_sorting, aux_money, aux_info
aux_price_per_unit = false aux_price_per_unit = false
@@ -521,7 +529,7 @@ public.bids_config = {
function private.record_percentage(record) function private.record_percentage(record)
if not record then return end if not record then return end
local historical_value = aux.history.value(record.item_key) or 0 local historical_value = aux_history.value(record.item_key) or 0
if historical_value > 0 then if historical_value > 0 then
if record.unit_buyout_price > 0 then if record.unit_buyout_price > 0 then
return round(100 * record.unit_buyout_price / historical_value, 1) return round(100 * record.unit_buyout_price / historical_value, 1)
@@ -634,8 +642,8 @@ local methods = {
ChatFrameEditBox:Insert(this.row.data.record.link) ChatFrameEditBox:Insert(this.row.data.record.link)
elseif not modified and button == 'RightButton' then -- TODO not when alt (how?) elseif not modified and button == 'RightButton' then -- TODO not when alt (how?)
tab = 1 tab = 1
aux.search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name) .. '/exact') aux_search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name) .. '/exact')
aux.search_tab.execute(nil, false) aux_search_tab.execute(nil, false)
else else
local selection = this.rt:GetSelection() local selection = this.rt:GetSelection()
if not selection or selection.record ~= this.row.data.record then if not selection or selection.record ~= this.row.data.record then
+9 -3
View File
@@ -1,4 +1,10 @@
aux 'gui' aux_gui = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
public.font = [[Fonts\ARIALN.TTF]] public.font = [[Fonts\ARIALN.TTF]]
@@ -25,7 +31,7 @@ function LOAD()
hook('ToggleDropDownMenu', function(...) auto[arg] = true hook('ToggleDropDownMenu', function(...) auto[arg] = true
local ret = temp-A(orig.ToggleDropDownMenu(unpack(arg))) local ret = temp-A(orig.ToggleDropDownMenu(unpack(arg)))
local dropdown = _G[arg[4] or ''] or this:GetParent() local dropdown = _G[arg[4] or ''] or this:GetParent()
if strfind(dropdown:GetName() or '', '^aux_frame%d+$') then if strfind(dropdown:GetName() or '', '^AuxFrame%d+$') then
set_aux_dropdown_style(dropdown) set_aux_dropdown_style(dropdown)
else else
set_blizzard_dropdown_style() set_blizzard_dropdown_style()
@@ -87,7 +93,7 @@ do
local id = 1 local id = 1
function public.name.get() function public.name.get()
id = id + 1 id = id + 1
return 'aux_frame' .. id return 'AuxFrame' .. id
end end
end end
+9 -1
View File
@@ -1,4 +1,12 @@
aux 'item_listing' local gui, info = aux.gui, aux.info aux_item_listing = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local gui, info = aux_gui, aux_info
local ROW_HEIGHT = 39 local ROW_HEIGHT = 39
+9 -1
View File
@@ -1,4 +1,12 @@
aux 'listing' local gui = aux.gui aux_listing = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local gui = aux_gui
local ST_COUNT = 0 local ST_COUNT = 0
+40 -37
View File
@@ -5,7 +5,6 @@ local PRIVATE, PUBLIC, FIELD, ACCESSOR, MUTATOR = 0, 1, 2, 4, 6
local TYPES = { FIELD, ACCESSOR, MUTATOR } local TYPES = { FIELD, ACCESSOR, MUTATOR }
local READ, WRITE = '', '=' local READ, WRITE = '', '='
local OPERATION = { [FIELD]=READ, [ACCESSOR]=READ, [MUTATOR]=WRITE } local OPERATION = { [FIELD]=READ, [ACCESSOR]=READ, [MUTATOR]=WRITE }
local ACCESS = { private=PRIVATE, public=PUBLIC }
local META = { get=ACCESSOR, set=MUTATOR } local META = { get=ACCESSOR, set=MUTATOR }
local function error(msg, ...) return _G.error(format(msg or '', unpack(arg)) .. '\n' .. debugstack(), 0) end local function error(msg, ...) return _G.error(format(msg or '', unpack(arg)) .. '\n' .. debugstack(), 0) end
@@ -19,7 +18,7 @@ local function proxy_mt(fields, mutators, lt)
return { __metatable=false, __index=fields, __newindex=function(_, k, v) return mutators[k](v) end, __lt=lt } return { __metatable=false, __index=fields, __newindex=function(_, k, v) return mutators[k](v) end, __lt=lt }
end end
local _module, _modifiers = {}, {} local _module, _access, _modifiers = {}, {}, {}
local definition_helper_mt = { __metatable=false } local definition_helper_mt = { __metatable=false }
function definition_helper_mt:__index(k) function definition_helper_mt:__index(k)
@@ -27,17 +26,16 @@ function definition_helper_mt:__index(k)
return self return self
end end
function definition_helper_mt:__newindex(k, v) local module, modifiers = _module[self], _modifiers[self] function definition_helper_mt:__newindex(k, v) local module, modifiers = _module[self], _modifiers[self]
local access = ACCESS[tremove(modifiers, 1)] or error'Definition missing access modifier.'
local name = META[k] and (tremove(modifiers) or error'Definition missing identifier.') or k local name = META[k] and (tremove(modifiers) or error'Definition missing identifier.') or k
if type(name) ~= 'string' or not strfind(name, '^[_%a][_%w]*') then error('Invalid identifier "%s".', name) end if type(name) ~= 'string' or not strfind(name, '^[_%a][_%w]*') then error('Invalid identifier "%s".', name) end
local type = META[k] or FIELD local type = META[k] or FIELD
module.defined[name .. OPERATION[type]] = module.defined[name .. OPERATION[type]] and error('Duplicate identifier "%s".', name) or true module.defined[name .. OPERATION[type]] = module.defined[name .. OPERATION[type]] and error('Duplicate identifier "%s".', name) or true
for i = getn(modifiers), 1, -1 do v = module[FIELD][modifiers[i]](v) end for i = getn(modifiers), 1, -1 do v = module[FIELD][modifiers[i]](v) end
module[type][name], module[access+type][name] = v, v module[type][name], module[_access[self]+type][name] = v, v
setn(modifiers, 0) setn(modifiers, 0)
end end
local function import(self, interface) local function include(self, interface)
local module = (interface < INTERFACE or error'Import error.') and _module[interface] local module = (interface < INTERFACE or error'Import error.') and _module[interface]
for _, type in TYPES do for _, type in TYPES do
for k, v in module[PUBLIC+type] do for k, v in module[PUBLIC+type] do
@@ -50,35 +48,40 @@ end
local nop_default_mt = { __index=function() return nop end } local nop_default_mt = { __index=function() return nop end }
local global_mt = { __metatable=false } local env = setmetatable({}, {
function global_mt:__index(key) __metatable = false,
if key ~= 'module' then return end __newindex = function(_, k)
local module, environment, interface, definition_helper, accessors, mutators, fields, public_accessors, public_mutators, public_fields if _G[k] then _G.error(nil) end
environment, interface, definition_helper = {}, {}, setmetatable({}, definition_helper_mt) local module, environment, interface, definition_helper, modifiers, accessors, mutators, fields, public_accessors, public_mutators, public_fields
accessors = { private=function() return definition_helper.private end, public=function() return definition_helper.public end } environment, interface, definition_helper, modifiers = {}, {}, setmetatable({}, definition_helper_mt), {}
mutators = setmetatable({ _=nop }, { __index=function(_, k) return function(v) _G[k] = v == interface and _G[k] ~= nil and _G.error(nil) or v end end }) accessors = { private=function() _access[definition_helper] = PRIVATE; return definition_helper end, public=function() _access[definition_helper] = PUBLIC; return definition_helper end }
fields = setmetatable( mutators = setmetatable({ _=nop }, { __index=function(_, k) return function(v) _G[k] = v end end })
{ _E=environment, _I=interface, _G=_G, import=function(interface) import(module, interface) end, error=error, nop=nop, id=id }, fields = setmetatable(
{ __index=function(_, key) local accessor = accessors[key]; if accessor then return accessor() else return _G[key] end end } { _M=environment, _G=_G, include=function(interface) include(module, interface) end, error=error, nop=nop, id=id },
) { __index=function(_, k) local accessor = accessors[k]; if accessor then return accessor() else return _G[k] end end }
public_accessors = setmetatable({}, nop_default_mt) )
public_mutators = setmetatable({}, nop_default_mt) public_accessors = setmetatable({}, nop_default_mt)
public_fields = setmetatable({}, { __index=function(_, key) return public_accessors[key]() end }) public_mutators = setmetatable({}, nop_default_mt)
setmetatable(environment, proxy_mt(fields, mutators)) public_fields = setmetatable({}, { __index=function(_, k) return public_accessors[k]() end })
setmetatable(interface, proxy_mt(public_fields, public_mutators, interface_lt)) setmetatable(environment, proxy_mt(fields, mutators))
module = { setmetatable(interface, proxy_mt(public_fields, public_mutators, interface_lt))
defined = { _E=true, _I=true, _G=true, import=true, error=true, nop=true, id=true, public=true, private=true, ['_=']=true }, module = {
[ACCESSOR] = accessors, defined = { _M=true, _G=true, include=true, error=true, nop=true, id=true, public=true, private=true, ['_=']=true },
[MUTATOR] = mutators, [ACCESSOR] = accessors,
[FIELD] = fields, [MUTATOR] = mutators,
[PUBLIC+ACCESSOR] = public_accessors, [FIELD] = fields,
[PUBLIC+MUTATOR] = public_mutators, [PUBLIC+ACCESSOR] = public_accessors,
[PUBLIC+FIELD] = public_fields, [PUBLIC+MUTATOR] = public_mutators,
interface = interface, [PUBLIC+FIELD] = public_fields,
} }
_module[definition_helper], _module[interface] = module, module _module[definition_helper], _module[interface] = module, module
_modifiers[definition_helper] = {} _modifiers[definition_helper] = modifiers
setfenv(2, environment) _G[k] = interface
return interface setfenv(2, environment)
end end,
setmetatable(_G, global_mt) })
setmetatable(_G, {
__metatable = false,
__index = function(_, k) if k == 'module' then setfenv(2, env) end end,
})
+14 -4
View File
@@ -1,9 +1,19 @@
aux 'auctions_tab' local scan = aux.scan aux_auctions_tab = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
TAB 'Auctions'
local scan = aux_scan
private.auction_records = t private.auction_records = t
function LOAD() function LOAD()
create_frames() aux_auctions_tab_frame.create()
end end
function OPEN() function OPEN()
@@ -51,7 +61,7 @@ end
function private.test(record) function private.test(record)
return function(index) return function(index)
local auction_info = aux.info.auction(index, 'owner') local auction_info = aux_info.auction(index, 'owner')
return auction_info and auction_info.search_signature == record.search_signature return auction_info and auction_info.search_signature == record.search_signature
end end
end end
@@ -67,7 +77,7 @@ do
scan.abort(scan_id) scan.abort(scan_id)
state = SEARCHING state = SEARCHING
scan_id = aux.scan_util.find( scan_id = aux_scan_util.find(
record, record,
status_bar, status_bar,
function() state = IDLE end, function() state = IDLE end,
+10 -7
View File
@@ -1,18 +1,21 @@
aux 'auctions_tab' local gui, auction_listing = aux.gui, aux.auction_listing aux_auctions_tab_frame = module
function private.create_frames() local gui, auction_listing = aux_gui, aux_auction_listing
private.frame = CreateFrame('Frame', nil, aux_frame)
function public.create()
setfenv(1, getfenv(2))
private.frame = CreateFrame('Frame', nil, AuxFrame)
frame:SetAllPoints() frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update) frame:SetScript('OnUpdate', on_update)
frame:Hide() frame:Hide()
frame.listing = gui.panel(frame) frame.listing = gui.panel(frame)
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8) frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0) frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0) frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
private.listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.auctions_config) private.listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.auctions_config)
listing:SetSort(1,2,3,4,5,6,7,8) listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
listing:Reset() listing:Reset()
listing:SetHandler('OnCellClick', function(cell, button) listing:SetHandler('OnCellClick', function(cell, button)
if IsAltKeyDown() and listing:GetSelection().record == cell.row.data.record and cancel_button:IsEnabled() then if IsAltKeyDown() and listing:GetSelection().record == cell.row.data.record and cancel_button:IsEnabled() then
@@ -28,7 +31,7 @@ function private.create_frames()
private.status_bar = gui.status_bar(frame) private.status_bar = gui.status_bar(frame)
status_bar:SetWidth(265) status_bar:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100) status_bar:update_status(100, 100)
status_bar:set_text('') status_bar:set_text('')
end end
+15 -5
View File
@@ -1,9 +1,19 @@
aux 'bids_tab' local scan = aux.scan aux_bids_tab = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
TAB 'Bids'
local scan = aux_scan
private.auction_records = t private.auction_records = t
function LOAD() function LOAD()
create_frames() aux_bids_tab_frame.create()
end end
function OPEN() function OPEN()
@@ -51,7 +61,7 @@ end
function private.test(record) function private.test(record)
return function(index) return function(index)
local auction_info = aux.info.auction(index, 'bidder') local auction_info = aux_info.auction(index, 'bidder')
return auction_info and auction_info.search_signature == record.search_signature return auction_info and auction_info.search_signature == record.search_signature
end end
end end
@@ -67,7 +77,7 @@ do
scan.abort(scan_id) scan.abort(scan_id)
state = SEARCHING state = SEARCHING
scan_id = aux.scan_util.find( scan_id = aux_scan_util.find(
record, record,
status_bar, status_bar,
function() state = IDLE end, function() state = IDLE end,
@@ -83,7 +93,7 @@ do
bid_button:SetScript('OnClick', function() bid_button:SetScript('OnClick', function()
if test(record)(index) and listing:ContainsRecord(record) then if test(record)(index) and listing:ContainsRecord(record) then
place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function() place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
aux.info.bid_update(record) aux_info.bid_update(record)
listing:SetDatabase() listing:SetDatabase()
end or papply(listing.RemoveAuctionRecord, listing, record)) end or papply(listing.RemoveAuctionRecord, listing, record))
end end
+10 -7
View File
@@ -1,18 +1,21 @@
aux 'bids_tab' local gui, auction_listing = aux.gui, aux.auction_listing aux_bids_tab_frame = module
function private.create_frames() local gui, auction_listing = aux_gui, aux_auction_listing
private.frame = CreateFrame('Frame', nil, aux_frame)
function public.create()
setfenv(1, getfenv(2))
private.frame = CreateFrame('Frame', nil, AuxFrame)
frame:SetAllPoints() frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update) frame:SetScript('OnUpdate', on_update)
frame:Hide() frame:Hide()
frame.listing = gui.panel(frame) frame.listing = gui.panel(frame)
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8) frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0) frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0) frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
private.listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.bids_config) private.listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.bids_config)
listing:SetSort(1,2,3,4,5,6,7,8) listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
listing:Reset() listing:Reset()
listing:SetHandler('OnCellClick', function(cell, button) listing:SetHandler('OnCellClick', function(cell, button)
if IsAltKeyDown() and listing:GetSelection().record == cell.row.data.record then if IsAltKeyDown() and listing:GetSelection().record == cell.row.data.record then
@@ -32,7 +35,7 @@ function private.create_frames()
private.status_bar = gui.status_bar(frame) private.status_bar = gui.status_bar(frame)
status_bar:SetWidth(265) status_bar:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 0) status_bar:update_status(100, 0)
status_bar:set_text('') status_bar:set_text('')
end end
+28 -18
View File
@@ -1,4 +1,14 @@
aux 'post_tab' local scan, scan_util, history, info, persistence, item_listing, al, sorting = aux.scan, aux.scan_util, aux.history, aux.info, aux.persistence, aux.item_listing, aux.auction_listing, aux.sorting aux_post_tab = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
TAB 'Post'
local scan, scan_util, history, info, persistence, item_listing, al, sorting = aux_scan, aux_scan_util, aux_history, aux_info, aux_persistence, aux_item_listing, aux_auction_listing, aux_sorting
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440 local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
@@ -33,7 +43,7 @@ end
local scan_id, inventory_records, existing_auctions = 0, t, t local scan_id, inventory_records, existing_auctions = 0, t, t
function private.refresh_button_click() function private.refresh_button_click()
aux.scan.abort(scan_id) aux_scan.abort(scan_id)
refresh_entries() refresh_entries()
refresh = true refresh = true
end end
@@ -51,7 +61,7 @@ do
end end
function LOAD() function LOAD()
create_frames() aux_post_tab_frame.create()
end end
function OPEN() function OPEN()
@@ -71,20 +81,20 @@ end
function private.get_unit_start_price() function private.get_unit_start_price()
local money_text = unit_start_price:GetText() local money_text = unit_start_price:GetText()
return aux.money.from_string(money_text) or 0 return aux_money.from_string(money_text) or 0
end end
function private.set_unit_start_price(amount) function private.set_unit_start_price(amount)
unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3, nil, true)) unit_start_price:SetText(aux_money.to_string(amount, true, nil, 3, nil, true))
end end
function private.get_unit_buyout_price() function private.get_unit_buyout_price()
local money_text = unit_buyout_price:GetText() local money_text = unit_buyout_price:GetText()
return aux.money.from_string(money_text) or 0 return aux_money.from_string(money_text) or 0
end end
function private.set_unit_buyout_price(amount) function private.set_unit_buyout_price(amount)
unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3, nil, true)) unit_buyout_price:SetText(aux_money.to_string(amount, true, nil, 3, nil, true))
end end
function private.update_inventory_listing() function private.update_inventory_listing()
@@ -105,12 +115,12 @@ function private.update_auction_listing()
for i, auction_record in existing_auctions[selected_item.key] or tt do for i, auction_record in existing_auctions[selected_item.key] or tt do
local blizzard_bid_undercut, buyout_price_undercut = undercut(auction_record, stack_size_slider:GetValue()) local blizzard_bid_undercut, buyout_price_undercut = undercut(auction_record, stack_size_slider:GetValue())
blizzard_bid_undercut = aux.money.from_string(aux.money.to_string(blizzard_bid_undercut, true, nil, 3)) 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)) buyout_price_undercut = aux_money.from_string(aux_money.to_string(buyout_price_undercut, true, nil, 3))
local stack_blizzard_bid_undercut, stack_buyout_price_undercut = undercut(auction_record, stack_size_slider:GetValue(), true) local stack_blizzard_bid_undercut, stack_buyout_price_undercut = undercut(auction_record, 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_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_buyout_price_undercut = aux_money.from_string(aux_money.to_string(stack_buyout_price_undercut, true, nil, 3))
local stack_size = stack_size_slider:GetValue() local stack_size = stack_size_slider:GetValue()
local historical_value = history.value(selected_item.key) local historical_value = history.value(selected_item.key)
@@ -138,9 +148,9 @@ function private.update_auction_listing()
{value=auction_record.own and color.yellow(auction_record.count) or auction_record.count}, {value=auction_record.own and color.yellow(auction_record.count) or auction_record.count},
{value=al.time_left(auction_record.duration)}, {value=al.time_left(auction_record.duration)},
{value=auction_record.stack_size == stack_size and color.yellow(auction_record.stack_size) or auction_record.stack_size}, {value=auction_record.stack_size == stack_size and 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=aux_money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color)},
{value=historical_value and al.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'}, {value=historical_value and al.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 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 al.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'}, {value=auction_record.unit_buyout_price > 0 and historical_value and al.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'},
}, },
record = auction_record, record = auction_record,
@@ -214,7 +224,7 @@ function private.post_auctions()
duration_code = 4 duration_code = 4
end end
aux.post.start( aux_post.start(
key, key,
stack_size, stack_size,
duration, duration,
@@ -307,7 +317,7 @@ function private.update_item_configuration()
local deposit_factor = neutral_faction() and .25 or .05 local deposit_factor = neutral_faction() and .25 or .05
local stack_size, stack_count = stack_size_slider:GetValue(), stack_count_slider:GetValue() local stack_size, stack_count = stack_size_slider:GetValue(), stack_count_slider:GetValue()
local amount = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120 local amount = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
deposit:SetText('Deposit: ' .. aux.money.to_string(amount, nil, nil, nil, inline_color.text.enabled)) deposit:SetText('Deposit: ' .. aux_money.to_string(amount, nil, nil, nil, inline_color.text.enabled))
end end
refresh_button:Enable() refresh_button:Enable()
@@ -359,7 +369,7 @@ function private.update_historical_value_button()
if selected_item then if selected_item then
local historical_value = history.value(selected_item.key) local historical_value = history.value(selected_item.key)
historical_value_button.amount = historical_value historical_value_button.amount = historical_value
historical_value_button:SetText(historical_value and aux.money.to_string(historical_value, true, nil, 3) or '---') historical_value_button:SetText(historical_value and aux_money.to_string(historical_value, true, nil, 3) or '---')
end end
end end
@@ -387,8 +397,8 @@ function private.set_item(item)
stack_size_slider:SetValue(settings.stack_size) stack_size_slider:SetValue(settings.stack_size)
quantity_update(true) quantity_update(true)
unit_start_price:SetText(aux.money.to_string(settings.start_price, true, nil, 3, nil, true)) unit_start_price:SetText(aux_money.to_string(settings.start_price, true, nil, 3, nil, true))
unit_buyout_price:SetText(aux.money.to_string(settings.buyout_price, true, nil, 3, nil, true)) unit_buyout_price:SetText(aux_money.to_string(settings.buyout_price, true, nil, 3, nil, true))
if not existing_auctions[selected_item.key] then if not existing_auctions[selected_item.key] then
refresh_entries() refresh_entries()
+11 -8
View File
@@ -1,15 +1,18 @@
aux 'post_tab' local gui, listing, item_listing, money, search_tab = aux.gui, aux.listing, aux.item_listing, aux.money, aux.search_tab aux_post_tab_frame = module
function private.create_frames() local gui, listing, item_listing, money, search_tab = aux_gui, aux_listing, aux_item_listing, aux_money, aux_search_tab
private.frame = CreateFrame('Frame', nil, aux_frame)
function public.create()
setfenv(1, getfenv(2))
private.frame = CreateFrame('Frame', nil, AuxFrame)
frame:SetAllPoints() frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update) frame:SetScript('OnUpdate', on_update)
frame:Hide() frame:Hide()
frame.content = CreateFrame('Frame', nil, frame) frame.content = CreateFrame('Frame', nil, frame)
frame.content:SetPoint('TOP', frame, 'TOP', 0, -8) frame.content:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.content:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0) frame.content:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
frame.content:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0) frame.content:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
frame.inventory = gui.panel(frame.content) frame.inventory = gui.panel(frame.content)
frame.inventory:SetWidth(212) frame.inventory:SetWidth(212)
@@ -47,7 +50,7 @@ function private.create_frames()
set_item(this.item_record) set_item(this.item_record)
elseif arg1 == 'RightButton' then elseif arg1 == 'RightButton' then
tab = 1 tab = 1
search_tab.set_filter(strlower(aux.info.item(this.item_record.item_id).name) .. '/exact') search_tab.set_filter(strlower(aux_info.item(this.item_record.item_id).name) .. '/exact')
search_tab.execute(nil, false) search_tab.execute(nil, false)
end end
end, end,
@@ -84,7 +87,7 @@ function private.create_frames()
private.status_bar = gui.status_bar(frame) private.status_bar = gui.status_bar(frame)
status_bar:SetWidth(265) status_bar:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100) status_bar:update_status(100, 100)
status_bar:set_text('') status_bar:set_text('')
end end
@@ -107,7 +110,7 @@ function private.create_frames()
item:SetPoint('TOPLEFT', 10, -6) item:SetPoint('TOPLEFT', 10, -6)
item.button:SetScript('OnEnter', function() item.button:SetScript('OnEnter', function()
if selected_item then if selected_item then
aux.info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT') aux_info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
end end
end) end)
item.button:SetScript('OnLeave', function() item.button:SetScript('OnLeave', function()
+16 -8
View File
@@ -1,13 +1,21 @@
aux 'search_tab' local scan, scan_util = aux.scan, aux.scan_util aux_search_tab = module
StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = { include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
TAB 'Search'
StaticPopupDialogs.AUX_SEARCH_TABLE_FULL = {
text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.', text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.',
button1 = 'Ok', button1 = 'Ok',
showAlert = 1, showAlert = 1,
timeout = 0, timeout = 0,
hideOnEscape = 1, hideOnEscape = 1,
} }
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = { StaticPopupDialogs.AUX_SEARCH_AUTO_BUY = {
text = 'Are you sure you want to activate automatic buyout?', text = 'Are you sure you want to activate automatic buyout?',
button1 = 'Yes', button1 = 'Yes',
button2 = 'No', button2 = 'No',
@@ -20,10 +28,10 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
do do
local function action() local function action()
aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText() aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText()
update_auto_buy_filter() aux_search_tab_results.update_auto_buy_filter()
end end
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY_FILTER'] = { StaticPopupDialogs.AUX_SEARCH_AUTO_BUY_FILTER = {
text = 'Enter a filter for automatic buyout.', text = 'Enter a filter for automatic buyout.',
button1 = 'Accept', button1 = 'Accept',
button2 = 'Cancel', button2 = 'Cancel',
@@ -52,10 +60,10 @@ private.SAVED = 2
private.FILTER = 3 private.FILTER = 3
function LOAD() function LOAD()
create_frames() aux_search_tab_frame.create()
subtab = SAVED subtab = SAVED
update_auto_buy_filter() aux_search_tab_results.update_auto_buy_filter()
new_search('') aux_search_tab_results.new_search('')
current_search.placeholder = true current_search.placeholder = true
end end
+14 -6
View File
@@ -1,4 +1,12 @@
aux 'search_tab' local filter_util = aux.filter_util aux_search_tab_filter = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local filter_util = aux_filter_util
function private.valid_level(str) function private.valid_level(str)
local level = tonumber(str) local level = tonumber(str)
@@ -73,7 +81,7 @@ function private.update_form()
if blizzard_query.exact then if blizzard_query.exact then
for key in temp-S('class', 'subclass', 'slot', 'quality') do for key in temp-S('class', 'subclass', 'slot', 'quality') do
_E[key .. '_dropdown'].button:Disable() _M[key .. '_dropdown'].button:Disable()
end end
else else
class_dropdown.button:Enable() class_dropdown.button:Enable()
@@ -81,9 +89,9 @@ function private.update_form()
end end
for key in temp-S('min_level', 'max_level') do for key in temp-S('min_level', 'max_level') do
if blizzard_query.exact then if blizzard_query.exact then
_E[key .. '_input']:EnableMouse(false) _M[key .. '_input']:EnableMouse(false)
else else
_E[key .. '_input']:EnableMouse(true) _M[key .. '_input']:EnableMouse(true)
end end
end end
if blizzard_query.exact then if blizzard_query.exact then
@@ -210,9 +218,9 @@ function public.formatted_post_filter(components)
elseif component[1] == 'filter' then elseif component[1] == 'filter' then
for parameter in present(component[3]) do for parameter in present(component[3]) do
if component[2] == 'item' then if component[2] == 'item' then
parameter = aux.info.display_name(aux.cache.item_id(parameter)) or '[' .. parameter .. ']' parameter = aux_info.display_name(aux_cache.item_id(parameter)) or '[' .. parameter .. ']'
elseif filter_util.filters[component[2]].input_type == 'money' then elseif filter_util.filters[component[2]].input_type == 'money' then
parameter = aux.money.to_string(aux.money.from_string(parameter), nil, true) parameter = aux_money.to_string(aux_money.from_string(parameter), nil, true)
end end
component_text = component_text .. filter_color(': ') .. parameter component_text = component_text .. filter_color(': ') .. parameter
end end
+18 -15
View File
@@ -1,21 +1,24 @@
aux 'search_tab' local gui, completion, listing, auction_listing, filter_util = aux.gui, aux.completion, aux.listing, aux.auction_listing, aux.filter_util aux_search_tab_frame = module
FILTER_SPACING = 28.5 local gui, completion, listing, auction_listing, filter_util = aux_gui, aux_completion, aux_listing, aux_auction_listing, aux_filter_util
function private.create_frames() local FILTER_SPACING = 28.5
private.frame = CreateFrame('Frame', nil, aux_frame)
function public.create()
setfenv(1, getfenv(2))
private.frame = CreateFrame('Frame', nil, AuxFrame)
frame:SetAllPoints() frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update) frame:SetScript('OnUpdate', on_update)
frame:Hide() frame:Hide()
frame.filter = gui.panel(frame) frame.filter = gui.panel(frame)
frame.filter:SetAllPoints(aux_frame.content) frame.filter:SetAllPoints(AuxFrame.content)
frame.results = gui.panel(frame) frame.results = gui.panel(frame)
frame.results:SetAllPoints(aux_frame.content) frame.results:SetAllPoints(AuxFrame.content)
frame.saved = CreateFrame('Frame', nil, frame) frame.saved = CreateFrame('Frame', nil, frame)
frame.saved:SetAllPoints(aux_frame.content) frame.saved:SetAllPoints(AuxFrame.content)
frame.saved.favorite = gui.panel(frame.saved) frame.saved.favorite = gui.panel(frame.saved)
frame.saved.favorite:SetWidth(378.5) frame.saved.favorite:SetWidth(378.5)
@@ -149,9 +152,9 @@ function private.create_frames()
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
if this:GetChecked() then if this:GetChecked() then
this:SetChecked(false) this:SetChecked(false)
aux_auto_buy_filter = nil aux_search_tab_results.aux_auto_buy_filter = nil
this.prettified = nil this.prettified = nil
auto_buy_validator = nil aux_search_tab_results.auto_buy_validator = nil
else else
StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER') StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER')
end end
@@ -208,7 +211,7 @@ function private.create_frames()
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('Stop') btn:SetText('Stop')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
aux.scan.abort(search_scan_id) aux_scan.abort(aux_search_tab_results.search_scan_id)
end) end)
private.stop_button = btn private.stop_button = btn
end end
@@ -227,7 +230,7 @@ function private.create_frames()
local editbox = gui.editbox(controls) local editbox = gui.editbox(controls)
editbox:EnableMouse(1) editbox:EnableMouse(1)
editbox.formatter = function(str) editbox.formatter = function(str)
local queries = aux.filter_util.queries(str) local queries = aux_filter_util.queries(str)
return queries and join(map(copy(queries), function(query) return query.prettified end), ';') or color.red(str) return queries and join(map(copy(queries), function(query) return query.prettified end), ';') or color.red(str)
end end
editbox.complete = completion.complete_filter editbox.complete = completion.complete_filter
@@ -247,7 +250,7 @@ function private.create_frames()
end end
do do
local btn = gui.button(frame, gui.font_size.large) local btn = gui.button(frame, gui.font_size.large)
btn:SetPoint('BOTTOMLEFT', aux_frame.content, 'TOPLEFT', 10, 8) btn:SetPoint('BOTTOMLEFT', AuxFrame.content, 'TOPLEFT', 10, 8)
btn:SetWidth(243) btn:SetWidth(243)
btn:SetHeight(22) btn:SetHeight(22)
btn:SetText('Search Results') btn:SetText('Search Results')
@@ -276,7 +279,7 @@ function private.create_frames()
local frame = CreateFrame('Frame', nil, frame) local frame = CreateFrame('Frame', nil, frame)
frame:SetWidth(265) frame:SetWidth(265)
frame:SetHeight(25) frame:SetHeight(25)
frame:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6) frame:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
private.status_bar_frame = frame private.status_bar_frame = frame
end end
do do
@@ -583,8 +586,8 @@ function private.create_frames()
private.filter_display = scroll_child private.filter_display = scroll_child
end end
private.status_bars = t public.status_bars = t
private.tables = t public.tables = t
for _ = 1, 5 do for _ = 1, 5 do
local status_bar = gui.status_bar(frame) local status_bar = gui.status_bar(frame)
status_bar:SetAllPoints(status_bar_frame) status_bar:SetAllPoints(status_bar_frame)
+23 -15
View File
@@ -1,16 +1,24 @@
aux 'search_tab' local info, scan = aux.info, aux.scan aux_search_tab_results = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local info, scan = aux_info, aux_scan
aux_auto_buy_filter = '' aux_auto_buy_filter = ''
do do
local id = 0 local id = 0
function private.search_scan_id.get() return id end function public.search_scan_id.get() return id end
function private.search_scan_id.set(v) id = v end function public.search_scan_id.set(v) id = v end
end end
do do
local validator local validator
function private.auto_buy_validator.get() return validator end function public.auto_buy_validator.get() return validator end
function private.auto_buy_validator.set(v) validator = v end function public.auto_buy_validator.set(v) validator = v end
end end
do do
@@ -46,7 +54,7 @@ do
update_continuation() update_continuation()
end end
function private.new_search(filter_string) function public.new_search(filter_string)
while getn(searches) > search_index do while getn(searches) > search_index do
tremove(searches) tremove(searches)
end end
@@ -54,16 +62,16 @@ do
tinsert(searches, search) tinsert(searches, search)
if getn(searches) > 5 then if getn(searches) > 5 then
tremove(searches, 1) tremove(searches, 1)
tinsert(status_bars, tremove(status_bars, 1)) tinsert(aux_search_tab.status_bars, tremove(aux_search_tab.status_bars, 1))
tinsert(tables, tremove(tables, 1)) tinsert(aux_search_tab.tables, tremove(aux_search_tab.tables, 1))
search_index = 4 search_index = 4
end end
search.status_bar = status_bars[getn(searches)] search.status_bar = aux_search_tab.status_bars[getn(searches)]
search.status_bar:update_status(100, 100) search.status_bar:update_status(100, 100)
search.status_bar:set_text('') search.status_bar:set_text('')
search.table = tables[getn(searches)] search.table = aux_search_tab.tables[getn(searches)]
search.table:SetSort(1, 2, 3, 4, 5, 6, 7, 8, 9) search.table:SetSort(1, 2, 3, 4, 5, 6, 7, 8, 9)
search.table:Reset() search.table:Reset()
search.table:SetDatabase(search.records) search.table:SetDatabase(search.records)
@@ -116,9 +124,9 @@ function update_start_stop()
end end
end end
function private.update_auto_buy_filter() function public.update_auto_buy_filter()
if aux_auto_buy_filter ~= '' then if aux_auto_buy_filter ~= '' then
local queries, error = aux.filter_util.queries(aux_auto_buy_filter) local queries, error = aux_filter_util.queries(aux_auto_buy_filter)
if queries then if queries then
if getn(queries) > 1 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'
@@ -312,7 +320,7 @@ function public.execute(resume, real_time)
end end
local filter_string = search_box:GetText() local filter_string = search_box:GetText()
local queries, error = aux.filter_util.queries(filter_string) local queries, error = aux_filter_util.queries(filter_string)
if not queries then if not queries then
print('Invalid filter:', error) print('Invalid filter:', error)
return return
@@ -338,7 +346,7 @@ function public.execute(resume, real_time)
else else
new_search(filter_string) new_search(filter_string)
end end
new_recent_search(filter_string, join(map(copy(queries), function(filter) return filter.prettified end), ';')) aux_search_tab_saved.new_recent_search(filter_string, join(map(copy(queries), function(filter) return filter.prettified end), ';'))
else else
current_search.records = t current_search.records = t
current_search.table:SetDatabase(current_search.records) current_search.table:SetDatabase(current_search.records)
@@ -390,7 +398,7 @@ do
scan.abort(scan_id) scan.abort(scan_id)
state = SEARCHING state = SEARCHING
scan_id = aux.scan_util.find( scan_id = aux_scan_util.find(
record, record,
current_search.status_bar, current_search.status_bar,
function() function()
+10 -4
View File
@@ -1,4 +1,10 @@
aux 'search_tab' aux_search_tab_saved = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
aux_favorite_searches = t aux_favorite_searches = t
aux_recent_searches = t aux_recent_searches = t
@@ -13,7 +19,7 @@ function private.update_search_listings()
index = i, index = i,
}) })
end end
favorite_searches_listing:SetData(favorite_search_rows) aux_search_tab.favorite_searches_listing:SetData(favorite_search_rows)
local recent_search_rows = t local recent_search_rows = t
for i, recent_search in aux_recent_searches do for i, recent_search in aux_recent_searches do
@@ -24,10 +30,10 @@ function private.update_search_listings()
index = i, index = i,
}) })
end end
recent_searches_listing:SetData(recent_search_rows) aux_search_tab.recent_searches_listing:SetData(recent_search_rows)
end end
function private.new_recent_search(filter_string, prettified) function public.new_recent_search(filter_string, prettified)
tinsert(aux_recent_searches, 1, { tinsert(aux_recent_searches, 1, {
filter_string = filter_string, filter_string = filter_string,
prettified = prettified, prettified = prettified,
+6 -1
View File
@@ -1,4 +1,9 @@
aux 'core' aux_util_color = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
local COLORS = { local COLORS = {
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}}, text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
+9 -1
View File
@@ -1,4 +1,12 @@
aux 'completion' local filter_util = aux.filter_util aux_completion = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local filter_util = aux_filter_util
function public:complete_filter() function public:complete_filter()
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
+34 -21
View File
@@ -1,29 +1,42 @@
aux 'core' aux_util = module
include (green_t)
include (aux)
do do
local state = setmetatable({}, { __mode='k' }) local classes, interfaces, objects = {}, {}, setmetatable({}, { __mode='k' })
local private_mt = { __metatable=false }
function class(object, ...) function private_mt:__newindex(k, v)
local interface = {} classes[self][k] = v
for i = 1, arg.n do end
local key = arg[i] local public_mt = { __metatable=false }
interface[key] = function(self, ...) function public_mt:__newindex(k, v)
local object = state[self] classes[self][k] = v
return object[key](object, unpack(arg)) interfaces[self][k] = function(self, ...)
end return classes[self][k](objects[self][k], unpack(arg))
end
return function()
local proxy = setmetatable({}, { __metatable=false, __index=interface })
state[proxy] = setmetatable({}, { __index=object })
return proxy
end end
end end
local proxy_mt = { __metatable=false }
function proxy_mt:__call()
local proxy = setmetatable({}, { __metatable=false, __index=interfaces[self] })
objects[proxy] = setmetatable({}, { __index=classes[self] })
return proxy
end
function public.class()
local class, interface = {}, {}
local private, public, proxy = setmetatable({}, private_mt), setmetatable({}, public_mt), setmetatable({}, proxy_mt)
classes[private], classes[public], classes[proxy] = class, class, class
interfaces[public], interfaces[proxy] = interface, interface
return private, public, proxy
end
end end
-- alternatively rely on module encapsulation, modifier "method" to declare methods
do do
local _state = setmetatable(t, T('__mode', 'kv')) local _state = setmetatable(t, T('__mode', 'kv'))
local __index = function(self, key) local __index = function(self, k)
return _state[self].handler({ public=self, private=_state[self].state }, key) return _state[self].handler({ public=self, private=_state[self].state }, k)
end end
function public.index_function(state, handler) -- TODO rename table-accessor, use predicate to stop function public.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
@@ -89,7 +102,7 @@ function public.modified.get()
end end
function public.copy(t) function public.copy(t)
local copy = _E.t local copy = _M.t
for k, v in t do copy[k] = v end for k, v in t do copy[k] = v end
table.setn(copy, getn(t)) table.setn(copy, getn(t))
return setmetatable(copy, getmetatable(t)) return setmetatable(copy, getmetatable(t))
@@ -106,13 +119,13 @@ function public.key(value, t)
end end
function public.keys(t) function public.keys(t)
local keys = _E.t local keys = _M.t
for k in t do tinsert(keys, k) end for k in t do tinsert(keys, k) end
return keys return keys
end end
function public.values(t) function public.values(t)
local values = _E.t local values = _M.t
for _, v in t do tinsert(values, v) end for _, v in t do tinsert(values, v) end
return values return values
end end
+26 -18
View File
@@ -1,4 +1,12 @@
aux 'filter_util' local info = aux.info aux_filter_util = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local info = aux_info
function private.default_filter(str) function private.default_filter(str)
return { return {
@@ -116,7 +124,7 @@ public.filters = {
input_type = 'number', input_type = 'number',
validator = function(pct) validator = function(pct)
return function(auction_record) return function(auction_record)
return aux.history.value(auction_record.item_key) and auction_record.unit_bid_price / aux.history.value(auction_record.item_key) * 100 <= pct return aux_history.value(auction_record.item_key) and auction_record.unit_bid_price / aux_history.value(auction_record.item_key) * 100 <= pct
end end
end end
}, },
@@ -126,8 +134,8 @@ public.filters = {
validator = function(pct) validator = function(pct)
return function(auction_record) return function(auction_record)
return auction_record.unit_buyout_price > 0 return auction_record.unit_buyout_price > 0
and aux.history.value(auction_record.item_key) and aux_history.value(auction_record.item_key)
and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct and auction_record.unit_buyout_price / aux_history.value(auction_record.item_key) * 100 <= pct
end end
end end
}, },
@@ -136,7 +144,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
return aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount return aux_history.value(auction_record.item_key) and aux_history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
end end
end end
}, },
@@ -145,7 +153,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
return auction_record.buyout_price > 0 and aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount return auction_record.buyout_price > 0 and aux_history.value(auction_record.item_key) and aux_history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
end end
end end
}, },
@@ -154,7 +162,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level) local disenchant_value = aux_disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
return disenchant_value and disenchant_value - auction_record.bid_price >= amount return disenchant_value and disenchant_value - auction_record.bid_price >= amount
end end
end end
@@ -164,7 +172,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level) local disenchant_value = aux_disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
end end
end end
@@ -174,7 +182,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local vendor_price = aux.cache.merchant_info(auction_record.item_id) local vendor_price = aux_cache.merchant_info(auction_record.item_id)
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
end end
end end
@@ -184,7 +192,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local vendor_price = aux.cache.merchant_info(auction_record.item_id) local vendor_price = aux_cache.merchant_info(auction_record.item_id)
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
end end
end end
@@ -261,7 +269,7 @@ end
function private.parse_parameter(input_type, str) function private.parse_parameter(input_type, str)
if input_type == 'money' then if input_type == 'money' then
local money = aux.money.from_string(str) local money = aux_money.from_string(str)
return money and money > 0 and money or nil return money and money > 0 and money or nil
elseif input_type == 'number' then elseif input_type == 'number' then
local number = tonumber(str) local number = tonumber(str)
@@ -352,7 +360,7 @@ function public.query(filter_string)
blizzard_query = blizzard_query(filter), blizzard_query = blizzard_query(filter),
validator = validator(filter), validator = validator(filter),
prettified = prettified_filter_string(filter), prettified = prettified_filter_string(filter),
}, _E.suggestions(filter) }, _M.suggestions(filter)
end end
function public.queries(filter_string) function public.queries(filter_string)
@@ -427,8 +435,8 @@ function public.filter_string(components)
elseif component[1] == 'filter' then elseif component[1] == 'filter' then
query_builder.append(component[2]) query_builder.append(component[2])
for parameter in present(component[3]) do for parameter in present(component[3]) do
if aux.filter_util.filters[component[2]].input_type == 'money' then if aux_filter_util.filters[component[2]].input_type == 'money' then
parameter = aux.money.to_string(aux.money.from_string(parameter), nil, true, nil, nil, true) parameter = aux_money.to_string(aux_money.from_string(parameter), nil, true, nil, nil, true)
end end
query_builder.append(parameter) query_builder.append(parameter)
end end
@@ -445,7 +453,7 @@ function private.prettified_filter_string(filter)
if component[1] == 'blizzard' then if component[1] == 'blizzard' then
if component[2] == 'name' then if component[2] == 'name' then
if filter.blizzard.exact then if filter.blizzard.exact then
prettified.append(info.display_name(aux.cache.item_id(component[4])) or color.blizzard('[' .. component[4] .. ']')) prettified.append(info.display_name(aux_cache.item_id(component[4])) or color.blizzard('[' .. component[4] .. ']'))
elseif component[4] ~= '' then elseif component[4] ~= '' then
prettified.append(color.blizzard(component[4])) prettified.append(color.blizzard(component[4]))
end end
@@ -460,10 +468,10 @@ function private.prettified_filter_string(filter)
end end
for parameter in present(component[3]) do for parameter in present(component[3]) do
if component[2] == 'item' then if component[2] == 'item' then
prettified.append(info.display_name(aux.cache.item_id(parameter)) or color.label.enabled('[' .. parameter .. ']')) prettified.append(info.display_name(aux_cache.item_id(parameter)) or color.label.enabled('[' .. parameter .. ']'))
else else
if filters[component[2]].input_type == 'money' then if filters[component[2]].input_type == 'money' then
prettified.append(aux.money.to_string(aux.money.from_string(parameter), nil, true, nil, inline_color.label.enabled)) prettified.append(aux_money.to_string(aux_money.from_string(parameter), nil, true, nil, inline_color.label.enabled))
else else
prettified.append(color.label.enabled(parameter)) prettified.append(color.label.enabled(parameter))
end end
@@ -490,7 +498,7 @@ function private.blizzard_query(filter)
local filters = filter.blizzard local filters = filter.blizzard
local query = T('name', filters.name and filters.name[2]) local query = T('name', filters.name and filters.name[2])
local item_info, class_index, subclass_index, slot_index local item_info, class_index, subclass_index, slot_index
local item_id = filters.name and aux.cache.item_id(filters.name[2]) local item_id = filters.name and aux_cache.item_id(filters.name[2])
item_info = item_id and info.item(item_id) item_info = item_id and info.item(item_id)
if filters.exact and item_info then if filters.exact and item_info then
item_info = info.item(item_id) item_info = info.item(item_id)
+8 -2
View File
@@ -1,4 +1,10 @@
aux 'info' aux_info = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate') CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate')
AuxTooltip:SetScript('OnTooltipAddMoney', function() AuxTooltip:SetScript('OnTooltipAddMoney', function()
@@ -365,7 +371,7 @@ function public.item(item_id, suffix_id)
'slot', slot, 'slot', slot,
'max_stack', max_stack, 'max_stack', max_stack,
'texture', texture 'texture', texture
) or aux.cache.item_info(item_id) ) or aux_cache.item_info(item_id)
end end
function public.item_class_index(item_class) function public.item_class_index(item_class)
+7 -1
View File
@@ -1,4 +1,10 @@
aux 'money' aux_money = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
public.GOLD_TEXT = '|cffffd70ag|r' public.GOLD_TEXT = '|cffffd70ag|r'
public.SILVER_TEXT = '|cffc7c7cfs|r' public.SILVER_TEXT = '|cffc7c7cfs|r'
+7 -1
View File
@@ -1,4 +1,10 @@
aux 'persistence' aux_persistence = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
aux_datasets = t aux_datasets = t
+10 -2
View File
@@ -1,4 +1,12 @@
aux 'scan_util' local info , filter_util = aux.info, aux.filter_util aux_scan_util = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
local info , filter_util = aux_info, aux_filter_util
function public.find(auction_record, status_bar, on_abort, on_failure, on_success) function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
@@ -31,7 +39,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
end end
local found local found
return aux.scan.start{ return aux_scan.start{
type = auction_record.query_type, type = auction_record.query_type,
queries = queries, queries = queries,
on_scan_start = function() on_scan_start = function()
+7 -1
View File
@@ -1,4 +1,10 @@
aux 'sorting' aux_sorting = module
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include (aux_util_color)
public.EQ = 0 public.EQ = 0
public.LT = 1 public.LT = 1