refactoring
This commit is contained in:
+39
-45
@@ -1,27 +1,16 @@
|
||||
aux = module
|
||||
|
||||
include (green_t)
|
||||
|
||||
--aux_account_settings = {} -- TODO clean up the mess of savedvariables
|
||||
--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'
|
||||
|
||||
function public.p.set(v)
|
||||
inspect(nil, v)
|
||||
end
|
||||
|
||||
function public.print(...) auto[arg] = true
|
||||
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE .. '[aux] ' .. join(map(arg, tostring), ' '))
|
||||
end
|
||||
@@ -56,23 +45,28 @@ do
|
||||
for _, f in handlers2 do f() end
|
||||
print('v' .. version .. ' loaded.')
|
||||
else
|
||||
_E[event]()
|
||||
_M[event]()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function LOAD()
|
||||
include (aux_util)
|
||||
include (aux_control)
|
||||
include (aux_util_color)
|
||||
aux_frame.create()
|
||||
end
|
||||
|
||||
private.tab_info = t
|
||||
do
|
||||
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', info[2])
|
||||
local env = (function() _G.aux(info[1]) return _E end)()
|
||||
function env.private.OPEN.set(f) tab.OPEN = 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.CLICK_LINK.set(f) tab.CLICK_LINK = f end
|
||||
function env.public.ACTIVE.get() return tab == active_tab end
|
||||
tinsert(tab_info, tab)
|
||||
end
|
||||
function public.TAB(name)
|
||||
local tab = T('name', name)
|
||||
local env = getfenv(2)
|
||||
function env.private.OPEN.set(f) tab.OPEN = 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.CLICK_LINK.set(f) tab.CLICK_LINK = f end
|
||||
function env.public.ACTIVE.get() return tab == active_tab end
|
||||
tinsert(tab_info, tab)
|
||||
end
|
||||
|
||||
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
|
||||
return orig.SetItemRef(unpack(arg))
|
||||
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)
|
||||
end
|
||||
end
|
||||
@@ -98,7 +92,7 @@ function private.UseContainerItem(...) auto[arg] = true
|
||||
if modified or not index(active_tab, 'USE_ITEM') then
|
||||
return orig.UseContainerItem(unpack(arg))
|
||||
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)
|
||||
end
|
||||
end
|
||||
@@ -170,18 +164,18 @@ end
|
||||
|
||||
function private.AUCTION_HOUSE_SHOW()
|
||||
AuctionFrame:Hide()
|
||||
aux_frame:Show()
|
||||
AuxFrame:Show()
|
||||
tab = 1
|
||||
end
|
||||
|
||||
function private.AUCTION_HOUSE_CLOSED()
|
||||
bids_loaded = false
|
||||
current_owner_page = nil
|
||||
aux.post.stop()
|
||||
aux.stack.stop()
|
||||
aux.scan.abort()
|
||||
aux_post.stop()
|
||||
aux_stack.stop()
|
||||
aux_scan.abort()
|
||||
tab = nil
|
||||
aux_frame:Hide()
|
||||
AuxFrame:Hide()
|
||||
end
|
||||
|
||||
function private.AUCTION_BIDDER_LIST_UPDATE()
|
||||
@@ -213,7 +207,7 @@ end
|
||||
do
|
||||
local function cost_label(cost)
|
||||
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
|
||||
return label
|
||||
end
|
||||
@@ -229,10 +223,10 @@ do
|
||||
total_cost = nil
|
||||
break
|
||||
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 _, 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 _, price, limited = aux_cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or aux_history.value(item_id .. ':' .. suffix_id)
|
||||
if not value then
|
||||
total_cost = nil
|
||||
break
|
||||
@@ -256,10 +250,10 @@ do
|
||||
total_cost = nil
|
||||
break
|
||||
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 _, 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 _, price, limited = aux_cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or aux_history.value(item_id .. ':' .. suffix_id)
|
||||
if not value then
|
||||
total_cost = nil
|
||||
break
|
||||
|
||||
+5
-1
@@ -1,4 +1,8 @@
|
||||
aux 'core'
|
||||
aux_control = module
|
||||
|
||||
include (green_t)
|
||||
include (aux)
|
||||
include (aux_util)
|
||||
|
||||
local event_frame = CreateFrame('Frame')
|
||||
|
||||
|
||||
+10
-2
@@ -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 MAX_ITEM_ID = 30000
|
||||
@@ -28,7 +36,7 @@ function LOAD()
|
||||
event_listener('NEW_AUCTION_UPDATE', function()
|
||||
for info in present(info.auction_sell_item()) 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)
|
||||
|
||||
+8
-2
@@ -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
|
||||
|
||||
@@ -69,7 +75,7 @@ local WEAPON = S(
|
||||
function public.value(slot, quality, level)
|
||||
local expectation
|
||||
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
|
||||
return
|
||||
else
|
||||
|
||||
+9
-1
@@ -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'}}}} }
|
||||
|
||||
|
||||
+10
-4
@@ -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
|
||||
|
||||
@@ -17,15 +23,15 @@ function private.process()
|
||||
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
|
||||
|
||||
return stop()
|
||||
end
|
||||
|
||||
function private.post_auction(slot, k)
|
||||
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
|
||||
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
|
||||
|
||||
ClearCursor()
|
||||
ClickAuctionSellItemButton()
|
||||
|
||||
+9
-1
@@ -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
|
||||
|
||||
|
||||
+10
-2
@@ -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
|
||||
|
||||
@@ -27,7 +35,7 @@ function SlashCmdList.AUX(command)
|
||||
aux_auctionable_items = t
|
||||
print 'Item cache cleared.'
|
||||
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
|
||||
aux_tooltip_value = not aux_tooltip_value
|
||||
print('Historical value in tooltip ' .. (aux_tooltip_value and 'enabled' or 'disabled') .. '.')
|
||||
|
||||
+9
-1
@@ -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
|
||||
|
||||
|
||||
+10
-2
@@ -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
|
||||
|
||||
@@ -101,7 +109,7 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
end
|
||||
if aux_tooltip_daily then
|
||||
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
|
||||
|
||||
|
||||
@@ -1,49 +1,53 @@
|
||||
aux 'core' local gui = aux.gui
|
||||
aux_frame = module
|
||||
|
||||
function LOAD()
|
||||
for _, info in tab_info do tabs:create_tab(info.name) end
|
||||
end
|
||||
local gui = aux_gui
|
||||
|
||||
do
|
||||
local frame = CreateFrame('Frame', 'aux_frame', UIParent)
|
||||
tinsert(UISpecialFrames, 'aux_frame')
|
||||
gui.set_window_style(frame)
|
||||
gui.set_size(frame, 768, 447)
|
||||
frame:SetPoint('LEFT', 100, 0)
|
||||
frame:SetToplevel(true)
|
||||
frame:SetMovable(true)
|
||||
frame:EnableMouse(true)
|
||||
frame:SetClampedToScreen(true)
|
||||
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.content = CreateFrame('Frame', nil, frame)
|
||||
frame.content:SetPoint('TOPLEFT', 4, -80)
|
||||
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
|
||||
frame:Hide()
|
||||
public.aux_frame = frame
|
||||
end
|
||||
do
|
||||
private.tabs = gui.tabs(aux_frame, 'DOWN')
|
||||
tabs._on_select = on_tab_click
|
||||
function public.tab.set(id) tabs:select(id) end
|
||||
end
|
||||
do
|
||||
local btn = gui.button(aux_frame)
|
||||
btn:SetPoint('BOTTOMRIGHT', -5, 5)
|
||||
gui.set_size(btn, 60, 24)
|
||||
btn:SetText('Close')
|
||||
btn:SetScript('OnClick', papply(aux_frame.Hide, aux_frame))
|
||||
public.close_button = btn
|
||||
end
|
||||
do
|
||||
local btn = gui.button(aux_frame, gui.font_size.small)
|
||||
btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0)
|
||||
gui.set_size(btn, 60, 24)
|
||||
btn:SetText(color.blizzard'Blizzard UI')
|
||||
btn:SetScript('OnClick',function()
|
||||
if AuctionFrame:IsVisible() then HideUIPanel(AuctionFrame) else ShowUIPanel(AuctionFrame) end
|
||||
end)
|
||||
function public.create()
|
||||
setfenv(1, getfenv(2))
|
||||
do
|
||||
local frame = CreateFrame('Frame', 'AuxFrame', UIParent)
|
||||
tinsert(UISpecialFrames, 'AuxFrame')
|
||||
gui.set_window_style(frame)
|
||||
gui.set_size(frame, 768, 447)
|
||||
frame:SetPoint('LEFT', 100, 0)
|
||||
frame:SetToplevel(true)
|
||||
frame:SetMovable(true)
|
||||
frame:EnableMouse(true)
|
||||
frame:SetClampedToScreen(true)
|
||||
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.content = CreateFrame('Frame', nil, frame)
|
||||
frame.content:SetPoint('TOPLEFT', 4, -80)
|
||||
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
|
||||
frame:Hide()
|
||||
public.AuxFrame = frame
|
||||
end
|
||||
do
|
||||
private.tabs = gui.tabs(AuxFrame, 'DOWN')
|
||||
tabs._on_select = on_tab_click
|
||||
function public.tab.set(id) tabs:select(id) end
|
||||
end
|
||||
do
|
||||
local btn = gui.button(AuxFrame)
|
||||
btn:SetPoint('BOTTOMRIGHT', -5, 5)
|
||||
gui.set_size(btn, 60, 24)
|
||||
btn:SetText('Close')
|
||||
btn:SetScript('OnClick', papply(AuxFrame.Hide, AuxFrame))
|
||||
public.close_button = btn
|
||||
end
|
||||
do
|
||||
local btn = gui.button(AuxFrame, gui.font_size.small)
|
||||
btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0)
|
||||
gui.set_size(btn, 60, 24)
|
||||
btn:SetText(color.blizzard'Blizzard UI')
|
||||
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
|
||||
+12
-4
@@ -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
|
||||
|
||||
@@ -521,7 +529,7 @@ public.bids_config = {
|
||||
function private.record_percentage(record)
|
||||
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 record.unit_buyout_price > 0 then
|
||||
return round(100 * record.unit_buyout_price / historical_value, 1)
|
||||
@@ -634,8 +642,8 @@ local methods = {
|
||||
ChatFrameEditBox:Insert(this.row.data.record.link)
|
||||
elseif not modified and button == 'RightButton' then -- TODO not when alt (how?)
|
||||
tab = 1
|
||||
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.set_filter(strlower(info.item(this.row.data.record.item_id).name) .. '/exact')
|
||||
aux_search_tab.execute(nil, false)
|
||||
else
|
||||
local selection = this.rt:GetSelection()
|
||||
if not selection or selection.record ~= this.row.data.record then
|
||||
|
||||
+9
-3
@@ -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]]
|
||||
|
||||
@@ -25,7 +31,7 @@ function LOAD()
|
||||
hook('ToggleDropDownMenu', function(...) auto[arg] = true
|
||||
local ret = temp-A(orig.ToggleDropDownMenu(unpack(arg)))
|
||||
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)
|
||||
else
|
||||
set_blizzard_dropdown_style()
|
||||
@@ -87,7 +93,7 @@ do
|
||||
local id = 1
|
||||
function public.name.get()
|
||||
id = id + 1
|
||||
return 'aux_frame' .. id
|
||||
return 'AuxFrame' .. id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+9
-1
@@ -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
|
||||
|
||||
|
||||
+40
-37
@@ -5,7 +5,6 @@ local PRIVATE, PUBLIC, FIELD, ACCESSOR, MUTATOR = 0, 1, 2, 4, 6
|
||||
local TYPES = { FIELD, ACCESSOR, MUTATOR }
|
||||
local READ, WRITE = '', '='
|
||||
local OPERATION = { [FIELD]=READ, [ACCESSOR]=READ, [MUTATOR]=WRITE }
|
||||
local ACCESS = { private=PRIVATE, public=PUBLIC }
|
||||
local META = { get=ACCESSOR, set=MUTATOR }
|
||||
|
||||
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 }
|
||||
end
|
||||
|
||||
local _module, _modifiers = {}, {}
|
||||
local _module, _access, _modifiers = {}, {}, {}
|
||||
|
||||
local definition_helper_mt = { __metatable=false }
|
||||
function definition_helper_mt:__index(k)
|
||||
@@ -27,17 +26,16 @@ function definition_helper_mt:__index(k)
|
||||
return self
|
||||
end
|
||||
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
|
||||
if type(name) ~= 'string' or not strfind(name, '^[_%a][_%w]*') then error('Invalid identifier "%s".', name) end
|
||||
local type = META[k] or FIELD
|
||||
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
|
||||
module[type][name], module[access+type][name] = v, v
|
||||
module[type][name], module[_access[self]+type][name] = v, v
|
||||
setn(modifiers, 0)
|
||||
end
|
||||
|
||||
local function import(self, interface)
|
||||
local function include(self, interface)
|
||||
local module = (interface < INTERFACE or error'Import error.') and _module[interface]
|
||||
for _, type in TYPES do
|
||||
for k, v in module[PUBLIC+type] do
|
||||
@@ -50,35 +48,40 @@ end
|
||||
|
||||
local nop_default_mt = { __index=function() return nop end }
|
||||
|
||||
local global_mt = { __metatable=false }
|
||||
function global_mt:__index(key)
|
||||
if key ~= 'module' then return end
|
||||
local module, environment, interface, definition_helper, accessors, mutators, fields, public_accessors, public_mutators, public_fields
|
||||
environment, interface, definition_helper = {}, {}, setmetatable({}, definition_helper_mt)
|
||||
accessors = { private=function() return definition_helper.private end, public=function() return definition_helper.public end }
|
||||
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 })
|
||||
fields = setmetatable(
|
||||
{ _E=environment, _I=interface, _G=_G, import=function(interface) import(module, interface) end, error=error, nop=nop, id=id },
|
||||
{ __index=function(_, key) local accessor = accessors[key]; if accessor then return accessor() else return _G[key] end end }
|
||||
)
|
||||
public_accessors = setmetatable({}, nop_default_mt)
|
||||
public_mutators = setmetatable({}, nop_default_mt)
|
||||
public_fields = setmetatable({}, { __index=function(_, key) return public_accessors[key]() end })
|
||||
setmetatable(environment, proxy_mt(fields, mutators))
|
||||
setmetatable(interface, proxy_mt(public_fields, public_mutators, interface_lt))
|
||||
module = {
|
||||
defined = { _E=true, _I=true, _G=true, import=true, error=true, nop=true, id=true, public=true, private=true, ['_=']=true },
|
||||
[ACCESSOR] = accessors,
|
||||
[MUTATOR] = mutators,
|
||||
[FIELD] = fields,
|
||||
[PUBLIC+ACCESSOR] = public_accessors,
|
||||
[PUBLIC+MUTATOR] = public_mutators,
|
||||
[PUBLIC+FIELD] = public_fields,
|
||||
interface = interface,
|
||||
}
|
||||
_module[definition_helper], _module[interface] = module, module
|
||||
_modifiers[definition_helper] = {}
|
||||
setfenv(2, environment)
|
||||
return interface
|
||||
end
|
||||
setmetatable(_G, global_mt)
|
||||
local env = setmetatable({}, {
|
||||
__metatable = false,
|
||||
__newindex = function(_, k)
|
||||
if _G[k] then _G.error(nil) end
|
||||
local module, environment, interface, definition_helper, modifiers, accessors, mutators, fields, public_accessors, public_mutators, public_fields
|
||||
environment, interface, definition_helper, modifiers = {}, {}, setmetatable({}, definition_helper_mt), {}
|
||||
accessors = { private=function() _access[definition_helper] = PRIVATE; return definition_helper end, public=function() _access[definition_helper] = PUBLIC; return definition_helper end }
|
||||
mutators = setmetatable({ _=nop }, { __index=function(_, k) return function(v) _G[k] = v end end })
|
||||
fields = setmetatable(
|
||||
{ _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_fields = setmetatable({}, { __index=function(_, k) return public_accessors[k]() end })
|
||||
setmetatable(environment, proxy_mt(fields, mutators))
|
||||
setmetatable(interface, proxy_mt(public_fields, public_mutators, interface_lt))
|
||||
module = {
|
||||
defined = { _M=true, _G=true, include=true, error=true, nop=true, id=true, public=true, private=true, ['_=']=true },
|
||||
[ACCESSOR] = accessors,
|
||||
[MUTATOR] = mutators,
|
||||
[FIELD] = fields,
|
||||
[PUBLIC+ACCESSOR] = public_accessors,
|
||||
[PUBLIC+MUTATOR] = public_mutators,
|
||||
[PUBLIC+FIELD] = public_fields,
|
||||
}
|
||||
_module[definition_helper], _module[interface] = module, module
|
||||
_modifiers[definition_helper] = modifiers
|
||||
_G[k] = interface
|
||||
setfenv(2, environment)
|
||||
end,
|
||||
})
|
||||
|
||||
setmetatable(_G, {
|
||||
__metatable = false,
|
||||
__index = function(_, k) if k == 'module' then setfenv(2, env) end end,
|
||||
})
|
||||
+14
-4
@@ -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
|
||||
|
||||
function LOAD()
|
||||
create_frames()
|
||||
aux_auctions_tab_frame.create()
|
||||
end
|
||||
|
||||
function OPEN()
|
||||
@@ -51,7 +61,7 @@ end
|
||||
|
||||
function private.test(record)
|
||||
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
|
||||
end
|
||||
end
|
||||
@@ -67,7 +77,7 @@ do
|
||||
|
||||
scan.abort(scan_id)
|
||||
state = SEARCHING
|
||||
scan_id = aux.scan_util.find(
|
||||
scan_id = aux_scan_util.find(
|
||||
record,
|
||||
status_bar,
|
||||
function() state = IDLE end,
|
||||
|
||||
+10
-7
@@ -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()
|
||||
private.frame = CreateFrame('Frame', nil, aux_frame)
|
||||
local gui, auction_listing = aux_gui, aux_auction_listing
|
||||
|
||||
function public.create()
|
||||
setfenv(1, getfenv(2))
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
frame:SetAllPoints()
|
||||
frame:SetScript('OnUpdate', on_update)
|
||||
frame:Hide()
|
||||
|
||||
frame.listing = gui.panel(frame)
|
||||
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||
frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
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:SetHandler('OnCellClick', function(cell, button)
|
||||
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)
|
||||
status_bar:SetWidth(265)
|
||||
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:set_text('')
|
||||
end
|
||||
|
||||
+15
-5
@@ -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
|
||||
|
||||
function LOAD()
|
||||
create_frames()
|
||||
aux_bids_tab_frame.create()
|
||||
end
|
||||
|
||||
function OPEN()
|
||||
@@ -51,7 +61,7 @@ end
|
||||
|
||||
function private.test(record)
|
||||
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
|
||||
end
|
||||
end
|
||||
@@ -67,7 +77,7 @@ do
|
||||
|
||||
scan.abort(scan_id)
|
||||
state = SEARCHING
|
||||
scan_id = aux.scan_util.find(
|
||||
scan_id = aux_scan_util.find(
|
||||
record,
|
||||
status_bar,
|
||||
function() state = IDLE end,
|
||||
@@ -83,7 +93,7 @@ do
|
||||
bid_button:SetScript('OnClick', function()
|
||||
if test(record)(index) and listing:ContainsRecord(record) then
|
||||
place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||
aux.info.bid_update(record)
|
||||
aux_info.bid_update(record)
|
||||
listing:SetDatabase()
|
||||
end or papply(listing.RemoveAuctionRecord, listing, record))
|
||||
end
|
||||
|
||||
+10
-7
@@ -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()
|
||||
private.frame = CreateFrame('Frame', nil, aux_frame)
|
||||
local gui, auction_listing = aux_gui, aux_auction_listing
|
||||
|
||||
function public.create()
|
||||
setfenv(1, getfenv(2))
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
frame:SetAllPoints()
|
||||
frame:SetScript('OnUpdate', on_update)
|
||||
frame:Hide()
|
||||
|
||||
frame.listing = gui.panel(frame)
|
||||
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||
frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
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:SetHandler('OnCellClick', function(cell, button)
|
||||
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)
|
||||
status_bar:SetWidth(265)
|
||||
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:set_text('')
|
||||
end
|
||||
|
||||
+28
-18
@@ -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
|
||||
@@ -33,7 +43,7 @@ end
|
||||
local scan_id, inventory_records, existing_auctions = 0, t, t
|
||||
|
||||
function private.refresh_button_click()
|
||||
aux.scan.abort(scan_id)
|
||||
aux_scan.abort(scan_id)
|
||||
refresh_entries()
|
||||
refresh = true
|
||||
end
|
||||
@@ -51,7 +61,7 @@ do
|
||||
end
|
||||
|
||||
function LOAD()
|
||||
create_frames()
|
||||
aux_post_tab_frame.create()
|
||||
end
|
||||
|
||||
function OPEN()
|
||||
@@ -71,20 +81,20 @@ end
|
||||
|
||||
function private.get_unit_start_price()
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
function private.get_unit_buyout_price()
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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))
|
||||
buyout_price_undercut = aux.money.from_string(aux.money.to_string(buyout_price_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))
|
||||
|
||||
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_buyout_price_undercut = aux.money.from_string(aux.money.to_string(stack_buyout_price_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))
|
||||
|
||||
local stack_size = stack_size_slider:GetValue()
|
||||
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=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=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=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 '---'},
|
||||
},
|
||||
record = auction_record,
|
||||
@@ -214,7 +224,7 @@ function private.post_auctions()
|
||||
duration_code = 4
|
||||
end
|
||||
|
||||
aux.post.start(
|
||||
aux_post.start(
|
||||
key,
|
||||
stack_size,
|
||||
duration,
|
||||
@@ -307,7 +317,7 @@ function private.update_item_configuration()
|
||||
local deposit_factor = neutral_faction() and .25 or .05
|
||||
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
|
||||
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
|
||||
|
||||
refresh_button:Enable()
|
||||
@@ -359,7 +369,7 @@ function private.update_historical_value_button()
|
||||
if selected_item then
|
||||
local historical_value = history.value(selected_item.key)
|
||||
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
|
||||
|
||||
@@ -387,8 +397,8 @@ function private.set_item(item)
|
||||
stack_size_slider:SetValue(settings.stack_size)
|
||||
quantity_update(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_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))
|
||||
|
||||
if not existing_auctions[selected_item.key] then
|
||||
refresh_entries()
|
||||
|
||||
+11
-8
@@ -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()
|
||||
private.frame = CreateFrame('Frame', nil, aux_frame)
|
||||
local gui, listing, item_listing, money, search_tab = aux_gui, aux_listing, aux_item_listing, aux_money, aux_search_tab
|
||||
|
||||
function public.create()
|
||||
setfenv(1, getfenv(2))
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
frame:SetAllPoints()
|
||||
frame:SetScript('OnUpdate', on_update)
|
||||
frame:Hide()
|
||||
|
||||
frame.content = CreateFrame('Frame', nil, frame)
|
||||
frame.content:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||
frame.content:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.content:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
frame.content:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.content:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
frame.inventory = gui.panel(frame.content)
|
||||
frame.inventory:SetWidth(212)
|
||||
@@ -47,7 +50,7 @@ function private.create_frames()
|
||||
set_item(this.item_record)
|
||||
elseif arg1 == 'RightButton' then
|
||||
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)
|
||||
end
|
||||
end,
|
||||
@@ -84,7 +87,7 @@ function private.create_frames()
|
||||
private.status_bar = gui.status_bar(frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('')
|
||||
end
|
||||
@@ -107,7 +110,7 @@ function private.create_frames()
|
||||
item:SetPoint('TOPLEFT', 10, -6)
|
||||
item.button:SetScript('OnEnter', function()
|
||||
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)
|
||||
item.button:SetScript('OnLeave', function()
|
||||
|
||||
+16
-8
@@ -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.',
|
||||
button1 = 'Ok',
|
||||
showAlert = 1,
|
||||
timeout = 0,
|
||||
hideOnEscape = 1,
|
||||
}
|
||||
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
StaticPopupDialogs.AUX_SEARCH_AUTO_BUY = {
|
||||
text = 'Are you sure you want to activate automatic buyout?',
|
||||
button1 = 'Yes',
|
||||
button2 = 'No',
|
||||
@@ -20,10 +28,10 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
do
|
||||
local function action()
|
||||
aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText()
|
||||
update_auto_buy_filter()
|
||||
aux_search_tab_results.update_auto_buy_filter()
|
||||
end
|
||||
|
||||
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY_FILTER'] = {
|
||||
StaticPopupDialogs.AUX_SEARCH_AUTO_BUY_FILTER = {
|
||||
text = 'Enter a filter for automatic buyout.',
|
||||
button1 = 'Accept',
|
||||
button2 = 'Cancel',
|
||||
@@ -52,10 +60,10 @@ private.SAVED = 2
|
||||
private.FILTER = 3
|
||||
|
||||
function LOAD()
|
||||
create_frames()
|
||||
aux_search_tab_frame.create()
|
||||
subtab = SAVED
|
||||
update_auto_buy_filter()
|
||||
new_search('')
|
||||
aux_search_tab_results.update_auto_buy_filter()
|
||||
aux_search_tab_results.new_search('')
|
||||
current_search.placeholder = true
|
||||
end
|
||||
|
||||
|
||||
+14
-6
@@ -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)
|
||||
local level = tonumber(str)
|
||||
@@ -73,7 +81,7 @@ function private.update_form()
|
||||
|
||||
if blizzard_query.exact then
|
||||
for key in temp-S('class', 'subclass', 'slot', 'quality') do
|
||||
_E[key .. '_dropdown'].button:Disable()
|
||||
_M[key .. '_dropdown'].button:Disable()
|
||||
end
|
||||
else
|
||||
class_dropdown.button:Enable()
|
||||
@@ -81,9 +89,9 @@ function private.update_form()
|
||||
end
|
||||
for key in temp-S('min_level', 'max_level') do
|
||||
if blizzard_query.exact then
|
||||
_E[key .. '_input']:EnableMouse(false)
|
||||
_M[key .. '_input']:EnableMouse(false)
|
||||
else
|
||||
_E[key .. '_input']:EnableMouse(true)
|
||||
_M[key .. '_input']:EnableMouse(true)
|
||||
end
|
||||
end
|
||||
if blizzard_query.exact then
|
||||
@@ -210,9 +218,9 @@ function public.formatted_post_filter(components)
|
||||
elseif component[1] == 'filter' then
|
||||
for parameter in present(component[3]) do
|
||||
if component[2] == 'item' then
|
||||
parameter = aux.info.display_name(aux.cache.item_id(parameter)) or '[' .. parameter .. ']'
|
||||
parameter = aux_info.display_name(aux_cache.item_id(parameter)) or '[' .. parameter .. ']'
|
||||
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
|
||||
component_text = component_text .. filter_color(': ') .. parameter
|
||||
end
|
||||
|
||||
+18
-15
@@ -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()
|
||||
private.frame = CreateFrame('Frame', nil, aux_frame)
|
||||
local FILTER_SPACING = 28.5
|
||||
|
||||
function public.create()
|
||||
setfenv(1, getfenv(2))
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
frame:SetAllPoints()
|
||||
frame:SetScript('OnUpdate', on_update)
|
||||
frame:Hide()
|
||||
|
||||
frame.filter = gui.panel(frame)
|
||||
frame.filter:SetAllPoints(aux_frame.content)
|
||||
frame.filter:SetAllPoints(AuxFrame.content)
|
||||
|
||||
frame.results = gui.panel(frame)
|
||||
frame.results:SetAllPoints(aux_frame.content)
|
||||
frame.results:SetAllPoints(AuxFrame.content)
|
||||
|
||||
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:SetWidth(378.5)
|
||||
@@ -149,9 +152,9 @@ function private.create_frames()
|
||||
btn:SetScript('OnClick', function()
|
||||
if this:GetChecked() then
|
||||
this:SetChecked(false)
|
||||
aux_auto_buy_filter = nil
|
||||
aux_search_tab_results.aux_auto_buy_filter = nil
|
||||
this.prettified = nil
|
||||
auto_buy_validator = nil
|
||||
aux_search_tab_results.auto_buy_validator = nil
|
||||
else
|
||||
StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER')
|
||||
end
|
||||
@@ -208,7 +211,7 @@ function private.create_frames()
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Stop')
|
||||
btn:SetScript('OnClick', function()
|
||||
aux.scan.abort(search_scan_id)
|
||||
aux_scan.abort(aux_search_tab_results.search_scan_id)
|
||||
end)
|
||||
private.stop_button = btn
|
||||
end
|
||||
@@ -227,7 +230,7 @@ function private.create_frames()
|
||||
local editbox = gui.editbox(controls)
|
||||
editbox:EnableMouse(1)
|
||||
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)
|
||||
end
|
||||
editbox.complete = completion.complete_filter
|
||||
@@ -247,7 +250,7 @@ function private.create_frames()
|
||||
end
|
||||
do
|
||||
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:SetHeight(22)
|
||||
btn:SetText('Search Results')
|
||||
@@ -276,7 +279,7 @@ function private.create_frames()
|
||||
local frame = CreateFrame('Frame', nil, frame)
|
||||
frame:SetWidth(265)
|
||||
frame:SetHeight(25)
|
||||
frame:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
frame:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
||||
private.status_bar_frame = frame
|
||||
end
|
||||
do
|
||||
@@ -583,8 +586,8 @@ function private.create_frames()
|
||||
private.filter_display = scroll_child
|
||||
end
|
||||
|
||||
private.status_bars = t
|
||||
private.tables = t
|
||||
public.status_bars = t
|
||||
public.tables = t
|
||||
for _ = 1, 5 do
|
||||
local status_bar = gui.status_bar(frame)
|
||||
status_bar:SetAllPoints(status_bar_frame)
|
||||
|
||||
+23
-15
@@ -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 = ''
|
||||
|
||||
do
|
||||
local id = 0
|
||||
function private.search_scan_id.get() return id end
|
||||
function private.search_scan_id.set(v) id = v end
|
||||
function public.search_scan_id.get() return id end
|
||||
function public.search_scan_id.set(v) id = v end
|
||||
end
|
||||
do
|
||||
local validator
|
||||
function private.auto_buy_validator.get() return validator end
|
||||
function private.auto_buy_validator.set(v) validator = v end
|
||||
function public.auto_buy_validator.get() return validator end
|
||||
function public.auto_buy_validator.set(v) validator = v end
|
||||
end
|
||||
|
||||
do
|
||||
@@ -46,7 +54,7 @@ do
|
||||
update_continuation()
|
||||
end
|
||||
|
||||
function private.new_search(filter_string)
|
||||
function public.new_search(filter_string)
|
||||
while getn(searches) > search_index do
|
||||
tremove(searches)
|
||||
end
|
||||
@@ -54,16 +62,16 @@ do
|
||||
tinsert(searches, search)
|
||||
if getn(searches) > 5 then
|
||||
tremove(searches, 1)
|
||||
tinsert(status_bars, tremove(status_bars, 1))
|
||||
tinsert(tables, tremove(tables, 1))
|
||||
tinsert(aux_search_tab.status_bars, tremove(aux_search_tab.status_bars, 1))
|
||||
tinsert(aux_search_tab.tables, tremove(aux_search_tab.tables, 1))
|
||||
search_index = 4
|
||||
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: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:Reset()
|
||||
search.table:SetDatabase(search.records)
|
||||
@@ -116,9 +124,9 @@ function update_start_stop()
|
||||
end
|
||||
end
|
||||
|
||||
function private.update_auto_buy_filter()
|
||||
function public.update_auto_buy_filter()
|
||||
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 getn(queries) > 1 then
|
||||
print 'Error: The automatic buyout filter does not support multi-queries'
|
||||
@@ -312,7 +320,7 @@ function public.execute(resume, real_time)
|
||||
end
|
||||
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
|
||||
print('Invalid filter:', error)
|
||||
return
|
||||
@@ -338,7 +346,7 @@ function public.execute(resume, real_time)
|
||||
else
|
||||
new_search(filter_string)
|
||||
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
|
||||
current_search.records = t
|
||||
current_search.table:SetDatabase(current_search.records)
|
||||
@@ -390,7 +398,7 @@ do
|
||||
|
||||
scan.abort(scan_id)
|
||||
state = SEARCHING
|
||||
scan_id = aux.scan_util.find(
|
||||
scan_id = aux_scan_util.find(
|
||||
record,
|
||||
current_search.status_bar,
|
||||
function()
|
||||
|
||||
+10
-4
@@ -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_recent_searches = t
|
||||
@@ -13,7 +19,7 @@ function private.update_search_listings()
|
||||
index = i,
|
||||
})
|
||||
end
|
||||
favorite_searches_listing:SetData(favorite_search_rows)
|
||||
aux_search_tab.favorite_searches_listing:SetData(favorite_search_rows)
|
||||
|
||||
local recent_search_rows = t
|
||||
for i, recent_search in aux_recent_searches do
|
||||
@@ -24,10 +30,10 @@ function private.update_search_listings()
|
||||
index = i,
|
||||
})
|
||||
end
|
||||
recent_searches_listing:SetData(recent_search_rows)
|
||||
aux_search_tab.recent_searches_listing:SetData(recent_search_rows)
|
||||
end
|
||||
|
||||
function private.new_recent_search(filter_string, prettified)
|
||||
function public.new_recent_search(filter_string, prettified)
|
||||
tinsert(aux_recent_searches, 1, {
|
||||
filter_string = filter_string,
|
||||
prettified = prettified,
|
||||
|
||||
+6
-1
@@ -1,4 +1,9 @@
|
||||
aux 'core'
|
||||
aux_util_color = module
|
||||
|
||||
include (green_t)
|
||||
include (aux)
|
||||
include (aux_util)
|
||||
include (aux_control)
|
||||
|
||||
local COLORS = {
|
||||
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
|
||||
|
||||
+9
-1
@@ -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()
|
||||
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
||||
|
||||
+34
-21
@@ -1,29 +1,42 @@
|
||||
aux 'core'
|
||||
aux_util = module
|
||||
|
||||
include (green_t)
|
||||
include (aux)
|
||||
|
||||
do
|
||||
local state = setmetatable({}, { __mode='k' })
|
||||
|
||||
function class(object, ...)
|
||||
local interface = {}
|
||||
for i = 1, arg.n do
|
||||
local key = arg[i]
|
||||
interface[key] = function(self, ...)
|
||||
local object = state[self]
|
||||
return object[key](object, unpack(arg))
|
||||
end
|
||||
end
|
||||
return function()
|
||||
local proxy = setmetatable({}, { __metatable=false, __index=interface })
|
||||
state[proxy] = setmetatable({}, { __index=object })
|
||||
return proxy
|
||||
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 }
|
||||
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 }
|
||||
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
|
||||
|
||||
-- alternatively rely on module encapsulation, modifier "method" to declare methods
|
||||
|
||||
do
|
||||
local _state = setmetatable(t, T('__mode', 'kv'))
|
||||
local __index = function(self, key)
|
||||
return _state[self].handler({ public=self, private=_state[self].state }, key)
|
||||
local __index = function(self, k)
|
||||
return _state[self].handler({ public=self, private=_state[self].state }, k)
|
||||
end
|
||||
function public.index_function(state, handler) -- TODO rename table-accessor, use predicate to stop
|
||||
local state, self = { handler=handler, state=state }, t
|
||||
@@ -89,7 +102,7 @@ function public.modified.get()
|
||||
end
|
||||
|
||||
function public.copy(t)
|
||||
local copy = _E.t
|
||||
local copy = _M.t
|
||||
for k, v in t do copy[k] = v end
|
||||
table.setn(copy, getn(t))
|
||||
return setmetatable(copy, getmetatable(t))
|
||||
@@ -106,13 +119,13 @@ function public.key(value, t)
|
||||
end
|
||||
|
||||
function public.keys(t)
|
||||
local keys = _E.t
|
||||
local keys = _M.t
|
||||
for k in t do tinsert(keys, k) end
|
||||
return keys
|
||||
end
|
||||
|
||||
function public.values(t)
|
||||
local values = _E.t
|
||||
local values = _M.t
|
||||
for _, v in t do tinsert(values, v) end
|
||||
return values
|
||||
end
|
||||
|
||||
+26
-18
@@ -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)
|
||||
return {
|
||||
@@ -116,7 +124,7 @@ public.filters = {
|
||||
input_type = 'number',
|
||||
validator = function(pct)
|
||||
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
|
||||
},
|
||||
@@ -126,8 +134,8 @@ public.filters = {
|
||||
validator = function(pct)
|
||||
return function(auction_record)
|
||||
return auction_record.unit_buyout_price > 0
|
||||
and aux.history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
|
||||
and aux_history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / aux_history.value(auction_record.item_key) * 100 <= pct
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -136,7 +144,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
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
|
||||
},
|
||||
@@ -145,7 +153,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
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
|
||||
},
|
||||
@@ -154,7 +162,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
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
|
||||
end
|
||||
end
|
||||
@@ -164,7 +172,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
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
|
||||
end
|
||||
end
|
||||
@@ -174,7 +182,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
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
|
||||
end
|
||||
end
|
||||
@@ -184,7 +192,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
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
|
||||
end
|
||||
end
|
||||
@@ -261,7 +269,7 @@ end
|
||||
|
||||
function private.parse_parameter(input_type, str)
|
||||
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
|
||||
elseif input_type == 'number' then
|
||||
local number = tonumber(str)
|
||||
@@ -352,7 +360,7 @@ function public.query(filter_string)
|
||||
blizzard_query = blizzard_query(filter),
|
||||
validator = validator(filter),
|
||||
prettified = prettified_filter_string(filter),
|
||||
}, _E.suggestions(filter)
|
||||
}, _M.suggestions(filter)
|
||||
end
|
||||
|
||||
function public.queries(filter_string)
|
||||
@@ -427,8 +435,8 @@ function public.filter_string(components)
|
||||
elseif component[1] == 'filter' then
|
||||
query_builder.append(component[2])
|
||||
for parameter in present(component[3]) do
|
||||
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)
|
||||
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)
|
||||
end
|
||||
query_builder.append(parameter)
|
||||
end
|
||||
@@ -445,7 +453,7 @@ function private.prettified_filter_string(filter)
|
||||
if component[1] == 'blizzard' then
|
||||
if component[2] == 'name' 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
|
||||
prettified.append(color.blizzard(component[4]))
|
||||
end
|
||||
@@ -460,10 +468,10 @@ function private.prettified_filter_string(filter)
|
||||
end
|
||||
for parameter in present(component[3]) do
|
||||
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
|
||||
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
|
||||
prettified.append(color.label.enabled(parameter))
|
||||
end
|
||||
@@ -490,7 +498,7 @@ function private.blizzard_query(filter)
|
||||
local filters = filter.blizzard
|
||||
local query = T('name', filters.name and filters.name[2])
|
||||
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)
|
||||
if filters.exact and item_info then
|
||||
item_info = info.item(item_id)
|
||||
|
||||
+8
-2
@@ -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')
|
||||
AuxTooltip:SetScript('OnTooltipAddMoney', function()
|
||||
@@ -365,7 +371,7 @@ function public.item(item_id, suffix_id)
|
||||
'slot', slot,
|
||||
'max_stack', max_stack,
|
||||
'texture', texture
|
||||
) or aux.cache.item_info(item_id)
|
||||
) or aux_cache.item_info(item_id)
|
||||
end
|
||||
|
||||
function public.item_class_index(item_class)
|
||||
|
||||
+7
-1
@@ -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.SILVER_TEXT = '|cffc7c7cfs|r'
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+10
-2
@@ -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)
|
||||
|
||||
@@ -31,7 +39,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
||||
end
|
||||
|
||||
local found
|
||||
return aux.scan.start{
|
||||
return aux_scan.start{
|
||||
type = auction_record.query_type,
|
||||
queries = queries,
|
||||
on_scan_start = function()
|
||||
|
||||
+7
-1
@@ -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.LT = 1
|
||||
|
||||
Reference in New Issue
Block a user