working on module refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-10-09 13:43:47 +02:00
parent 945ff6dd87
commit 867f12d66e
31 changed files with 305 additions and 259 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
module'aux'
module 'aux'
include'green_t'
include 'green_t'
--aux_account_settings = {} -- TODO clean up the mess of savedvariables
--aux_character_settings = {}
+4 -4
View File
@@ -1,8 +1,8 @@
module'aux.control'
module 'aux.control'
include'green_t'
include'aux'
include'aux.util'
include 'green_t'
include 'aux'
include 'aux.util'
local event_frame = CreateFrame'Frame'
+8 -7
View File
@@ -1,12 +1,13 @@
module'aux.cache'
module 'aux.core.cache'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local info, persistence = M'aux.info', M'aux.persistence'
local info = require 'aux.util.info'
local persistence = require 'aux.util.persistence'
local MIN_ITEM_ID = 1
local MAX_ITEM_ID = 30000
+7 -7
View File
@@ -1,12 +1,12 @@
module'aux.disenchant'
module 'aux.core.disenchant'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local history = M'aux.history'
local history = require 'aux.core.history'
local UNCOMMON, RARE, EPIC = 2, 3, 4
+7 -7
View File
@@ -1,12 +1,12 @@
module'aux.history'
module 'aux.core.history'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local persistence = M'aux.persistence'
local persistence = require 'aux.util.persistence'
local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}} }
+12 -9
View File
@@ -1,10 +1,13 @@
module'aux.post'
module 'aux.core.post'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local info = require 'aux.util.info'
local stack = require 'aux.core.stack'
local state
@@ -23,15 +26,15 @@ function private.process()
end
end)
return aux_stack.start(state.item_key, state.stack_size, send_signal)
return 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 = info.container_item(unpack(slot))
if item_info.item_key == state.item_key and info.auctionable(item_info.tooltip) and item_info.aux_quantity == state.stack_size then
ClearCursor()
ClickAuctionSellItemButton()
+8 -7
View File
@@ -1,12 +1,13 @@
module'aux.scan'
module 'aux.core.scan'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local info, history = aux_info, aux_history
local info = require 'aux.util.info'
local history = require 'aux.core.history'
local PAGE_SIZE = 50
+9 -8
View File
@@ -1,12 +1,13 @@
module'aux.slash'
module 'aux.core.slash'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local persistence = M'aux.persistence'
local persistence = require 'aux.util.persistence'
local cache = require 'aux.core.cache'
aux_ignore_owner = true
@@ -35,7 +36,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()
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') .. '.')
+7 -7
View File
@@ -1,12 +1,12 @@
module'aux.stack'
module 'aux.core.stack'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local info = M'aux.info'
local info = require 'aux.util.info'
local state
+13 -8
View File
@@ -1,12 +1,17 @@
module'aux.tooltip'
module 'aux.core.tooltip'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local info, disenchant, cache, money, history = M'aux.info', M'aux.disenchant', M'aux.cache', M'aux.money', M'aux.history'
local info = require 'aux.util.info'
local money = require 'aux.util.money'
local cache = require 'aux.core.cache'
local disenchant = require 'aux.core.disenchant'
local history = require 'aux.core.history'
local auction_listing = require 'aux.gui.auction_listing'
aux_tooltip_value = true
@@ -109,7 +114,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) .. ' (' .. 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
+2 -2
View File
@@ -1,6 +1,6 @@
module'aux.frame'
module 'aux.frame'
local gui = M'aux.gui'
local gui = require 'aux.gui'
function public.create()
setfenv(1, getfenv(2))
+60 -55
View File
@@ -1,12 +1,17 @@
module'aux.auction_listing'
module 'aux.gui.auction_listing'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local gui, sorting, money, info = M'aux.gui', M'aux.sorting', M'aux.money', M'aux.info'
local info = require 'aux.util.info'
local sort_util = require 'aux.util.sort'
local money = require 'aux.util.money'
local history = require 'aux.core.history'
local gui = require 'aux.gui'
local search_tab = require 'aux.tabs.search'
aux_price_per_unit = false
@@ -77,7 +82,7 @@ public.search_config = {
cell:SetText(gsub(record.link, '[%[%]]', ''))
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.name, record_b.name, desc)
return sort_util.compare(record_a.name, record_b.name, desc)
end,
},
{
@@ -86,11 +91,11 @@ public.search_config = {
align = 'CENTER',
fill = function(cell, record)
local display_level = max(record.level, 1)
display_level = UnitLevel('player') < record.level and color.red(display_level) or display_level
display_level = UnitLevel'player' < record.level and color.red(display_level) or display_level
cell:SetText(display_level)
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.level, record_b.level, desc)
return sort_util.compare(record_a.level, record_b.level, desc)
end,
},
{
@@ -105,7 +110,7 @@ public.search_config = {
cell:SetText(numAuctionsText)
end,
cmp = function(record_a, record_b, desc)
return sorting.EQ
return sort_util.EQ
-- if sortKey == 'numAuctions' then
-- if a.children then
-- aVal = a.totalAuctions
@@ -125,7 +130,7 @@ public.search_config = {
cell:SetText(record.aux_quantity)
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
end,
},
{
@@ -136,7 +141,7 @@ public.search_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.duration, record_b.duration, desc)
return sort_util.compare(record_a.duration, record_b.duration, desc)
end,
},
{
@@ -148,13 +153,13 @@ public.search_config = {
end,
cmp = function(record_a, record_b, desc)
if not record_a.owner and not record_b.owner then
return sorting.EQ
return sort_util.EQ
elseif not record_a.owner then
return sorting.GT
return sort_util.GT
elseif not record_b.owner then
return sorting.LT
return sort_util.LT
else
return sorting.compare(record_a.owner, record_b.owner, desc)
return sort_util.compare(record_a.owner, record_b.owner, desc)
end
end,
},
@@ -191,7 +196,7 @@ public.search_config = {
else
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
end
return sorting.compare(price_a, price_b, desc)
return sort_util.compare(price_a, price_b, desc)
end,
},
{
@@ -209,7 +214,7 @@ public.search_config = {
price_a = price_a > 0 and price_a or (desc and -huge or huge)
price_b = price_b > 0 and price_b or (desc and -huge or huge)
return sorting.compare(price_a, price_b, desc)
return sort_util.compare(price_a, price_b, desc)
end,
},
{
@@ -223,7 +228,7 @@ public.search_config = {
cmp = function(record_a, record_b, desc)
local pct_a = record_percentage(record_a) or (desc and -huge or huge)
local pct_b = record_percentage(record_b) or (desc and -huge or huge)
return sorting.compare(pct_a, pct_b, desc)
return sort_util.compare(pct_a, pct_b, desc)
end,
},
}
@@ -247,7 +252,7 @@ public.auctions_config = {
cell:SetText(gsub(record.link, '[%[%]]', ''))
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.name, record_b.name, desc)
return sort_util.compare(record_a.name, record_b.name, desc)
end,
},
{
@@ -260,7 +265,7 @@ public.auctions_config = {
cell:SetText(display_level)
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.level, record_b.level, desc)
return sort_util.compare(record_a.level, record_b.level, desc)
end,
},
{
@@ -272,7 +277,7 @@ public.auctions_config = {
cell:SetText(numAuctionsText)
end,
cmp = function(record_a, record_b, desc)
return sorting.EQ
return sort_util.EQ
-- if sortKey == 'numAuctions' then
-- if a.children then
-- aVal = a.totalAuctions
@@ -292,7 +297,7 @@ public.auctions_config = {
cell:SetText(record.aux_quantity)
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
end,
},
{
@@ -303,7 +308,7 @@ public.auctions_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.duration, record_b.duration, desc)
return sort_util.compare(record_a.duration, record_b.duration, desc)
end,
},
{
@@ -333,7 +338,7 @@ public.auctions_config = {
else
price_b = aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
end
return sorting.compare(price_a, price_b, desc)
return sort_util.compare(price_a, price_b, desc)
end,
},
{
@@ -351,7 +356,7 @@ public.auctions_config = {
price_a = price_a > 0 and price_a or (desc and -huge or huge)
price_b = price_b > 0 and price_b or (desc and -huge or huge)
return sorting.compare(price_a, price_b, desc)
return sort_util.compare(price_a, price_b, desc)
end,
},
{
@@ -363,13 +368,13 @@ public.auctions_config = {
end,
cmp = function(record_a, record_b, desc)
if not record_a.high_bidder and not record_b.high_bidder then
return sorting.EQ
return sort_util.EQ
elseif not record_a.high_bidder then
return sorting.GT
return sort_util.GT
elseif not record_b.high_bidder then
return sorting.LT
return sort_util.LT
else
return sorting.compare(record_a.high_bidder, record_b.high_bidder, desc)
return sort_util.compare(record_a.high_bidder, record_b.high_bidder, desc)
end
end,
},
@@ -394,7 +399,7 @@ public.bids_config = {
cell:SetText(gsub(record.link, '[%[%]]', ''))
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.name, record_b.name, desc)
return sort_util.compare(record_a.name, record_b.name, desc)
end,
},
{
@@ -406,7 +411,7 @@ public.bids_config = {
cell:SetText(numAuctionsText)
end,
cmp = function(record_a, record_b, desc)
return sorting.EQ
return sort_util.EQ
-- if sortKey == 'numAuctions' then
-- if a.children then
-- aVal = a.totalAuctions
@@ -426,7 +431,7 @@ public.bids_config = {
cell:SetText(record.aux_quantity)
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
end,
},
{
@@ -437,7 +442,7 @@ public.bids_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.duration, record_b.duration, desc)
return sort_util.compare(record_a.duration, record_b.duration, desc)
end,
},
{
@@ -449,13 +454,13 @@ public.bids_config = {
end,
cmp = function(record_a, record_b, desc)
if not record_a.owner and not record_b.owner then
return sorting.EQ
return sort_util.EQ
elseif not record_a.owner then
return sorting.GT
return sort_util.GT
elseif not record_b.owner then
return sorting.LT
return sort_util.LT
else
return sorting.compare(record_a.owner, record_b.owner, desc)
return sort_util.compare(record_a.owner, record_b.owner, desc)
end
end,
},
@@ -486,7 +491,7 @@ public.bids_config = {
else
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
end
return sorting.compare(price_a, price_b, desc)
return sort_util.compare(price_a, price_b, desc)
end,
},
{
@@ -504,7 +509,7 @@ public.bids_config = {
price_a = price_a > 0 and price_a or (desc and -huge or huge)
price_b = price_b > 0 and price_b or (desc and -huge or huge)
return sorting.compare(price_a, price_b, desc)
return sort_util.compare(price_a, price_b, desc)
end,
},
{
@@ -521,7 +526,7 @@ public.bids_config = {
cell:SetText(status)
end,
cmp = function(record_a, record_b, desc)
return sorting.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
return sort_util.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
end,
},
}
@@ -529,7 +534,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 = 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)
@@ -642,8 +647,8 @@ local methods = {
ChatFrameEditBox:Insert(this.row.data.record.link)
elseif not modified and button == 'RightButton' then -- TODO not when alt (how?)
aux.tab = 1
aux_search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name) .. '/exact')
aux_search_tab.execute(nil, false)
search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name) .. '/exact')
search_tab.execute(nil, false)
else
local selection = this.rt:GetSelection()
if not selection or selection.record ~= this.row.data.record then
@@ -723,10 +728,10 @@ local methods = {
-- hide all the rows
for _, row in self.rows do row:Hide() end
-- update sorting highlights
-- update sort_util highlights
for _, cell in self.headCells do
local tex = cell:GetNormalTexture()
tex:SetTexture([[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]])
tex:SetTexture[[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]]
tex:SetTexCoord(.017, 1, .083, .909)
tex:SetAlpha(.5)
end
@@ -761,11 +766,11 @@ local methods = {
end
for _, sort in self.sorts do
local ordering = self.config[sort.index].cmp and self.config[sort.index].cmp(record_a, record_b, sort.descending) or sorting.EQ
local ordering = self.config[sort.index].cmp and self.config[sort.index].cmp(record_a, record_b, sort.descending) or sort_util.EQ
if ordering == sorting.LT then
if ordering == sort_util.LT then
return true
elseif ordering == sorting.GT then
elseif ordering == sort_util.GT then
return false
end
end
@@ -1056,8 +1061,8 @@ function public.CreateAuctionResultsTable(parent, config)
cell:SetScript('OnClick', rt.OnHeadColumnClick)
local text = cell:CreateFontString()
text:SetJustifyH('CENTER')
text:SetJustifyV('CENTER')
text:SetJustifyH'CENTER'
text:SetJustifyV'CENTER'
text:SetFont(gui.font, 12)
text:SetTextColor(color.label.enabled())
cell:SetFontString(text)
@@ -1066,14 +1071,14 @@ function public.CreateAuctionResultsTable(parent, config)
local tex = cell:CreateTexture()
tex:SetAllPoints()
tex:SetTexture([[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]])
tex:SetTexture[[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]]
tex:SetTexCoord(.017, 1, .083, .909)
tex:SetAlpha(.5)
cell:SetNormalTexture(tex)
local tex = cell:CreateTexture()
tex:SetAllPoints()
tex:SetTexture([[Interface\Buttons\UI-Listbox-Highlight]])
tex:SetTexture[[Interface\Buttons\UI-Listbox-Highlight]]
tex:SetTexCoord(.025, .957, .087, .931)
tex:SetAlpha(.2)
cell:SetHighlightTexture(tex)
@@ -1106,7 +1111,7 @@ function public.CreateAuctionResultsTable(parent, config)
local text = cell:CreateFontString()
text:SetFont(gui.font, min(14, rt.ROW_HEIGHT))
text:SetJustifyH(rt.config[j].align or 'LEFT')
text:SetJustifyV('CENTER')
text:SetJustifyV'CENTER'
text:SetPoint('TOPLEFT', 1, -1)
text:SetPoint('BOTTOMRIGHT', -1, 1)
cell:SetFontString(text)
+6 -6
View File
@@ -1,10 +1,10 @@
module'aux.gui'
module 'aux.gui'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
public.font = [[Fonts\ARIALN.TTF]]
+8 -7
View File
@@ -1,12 +1,13 @@
module'aux.item_listing'
module 'aux.gui.item_listing'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local gui, info = M'aux.gui', M'aux.info'
local info = require 'aux.util.info'
local gui = require 'aux.gui'
local ROW_HEIGHT = 39
+7 -7
View File
@@ -1,12 +1,12 @@
module'aux.listing'
module 'aux.gui.listing'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local gui = M'aux.gui'
local gui = require 'aux.gui'
local ST_COUNT = 0
+7 -7
View File
@@ -15,7 +15,7 @@ local function proxy_mt(fields, mutators)
return { __metatable=false, __index=fields, __newindex=function(_, k, v) return mutators[k](v) end }
end
local _interface, _module, _access, _name = {}, {}, {}, {}
local loaded, _module, _access, _name = {}, {}, {}, {}
local definition_helper_mt = { __metatable=false }
function definition_helper_mt:__index(k)
@@ -32,6 +32,8 @@ function definition_helper_mt:__newindex(k, v)
_access[self], _name[self] = nil, nil
end
local function require(name) return loaded[name] end
local function include(self, name)
local module = name and _module[name] or error('No module "%s".', name)
for _, mode in MODES do
@@ -43,18 +45,16 @@ local function include(self, name)
end
end
local function fetch_interface(name) return _interface[name] end
local nop_default_mt = { __index=function() return nop end }
function module(name)
if _interface[name] then _G.error(nil) end
-- if loaded[name] 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 = {}, {}, 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, M=fetch_interface, include=function(interface) include(module, interface) end, error=error, nop=nop, id=id },
{ _M=environment, _G=_G, require=require, 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)
@@ -63,7 +63,7 @@ function module(name)
setmetatable(environment, proxy_mt(fields, mutators))
setmetatable(interface, proxy_mt(public_fields, public_mutators))
module = {
defined = { _M=true, _G=true, M=true, include=true, error=true, nop=true, id=true, public=true, private=true, ['_=']=true },
defined = { _M=true, _G=true, require=true, include=true, error=true, nop=true, id=true, public=true, private=true, ['_=']=true },
[ACCESSOR] = accessors,
[MUTATOR] = mutators,
[FIELD] = fields,
@@ -72,6 +72,6 @@ function module(name)
[PUBLIC + FIELD] = public_fields,
}
_module[name], _module[definition_helper] = module, module
_interface[name] = interface
loaded[name] = interface
setfenv(2, environment)
end
+14 -11
View File
@@ -1,19 +1,22 @@
module'aux.auctions_tab'
module 'aux.tabs.auctions'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
TAB'Auctions'
local info = require 'aux.util.info'
local scan_util = require 'aux.util.scan'
local scan = require 'aux.core.scan'
local tab_frame = require 'aux.tabs.auctions.frame'
local scan = M'aux.scan'
TAB 'Auctions'
private.auction_records = t
function LOAD()
aux_auctions_tab_frame.create()
tab_frame.create()
end
function OPEN()
@@ -61,7 +64,7 @@ end
function private.test(record)
return function(index)
local auction_info = aux_info.auction(index, 'owner')
local auction_info = info.auction(index, 'owner')
return auction_info and auction_info.search_signature == record.search_signature
end
end
@@ -77,7 +80,7 @@ do
scan.abort(scan_id)
state = SEARCHING
scan_id = aux_scan_util.find(
scan_id = scan_util.find(
record,
status_bar,
function() state = IDLE end,
+3 -2
View File
@@ -1,6 +1,7 @@
module'aux.auctions_tab.frame'
module 'aux.auctions_tab.frame'
local gui, auction_listing = M'aux.gui', M'aux.auction_listing'
local gui = require 'aux.gui'
local auction_listing = require 'aux.gui.auction_listing'
function public.create()
setfenv(1, getfenv(2))
+15 -12
View File
@@ -1,19 +1,22 @@
module'aux.bids_tab'
module 'aux.tabs.bids'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
TAB'Bids'
local info = require 'aux.util.info'
local scan_util = require 'aux.util.scan'
local scan = require 'aux.core.scan'
local tab_frame = require 'aux.tabs.bids.frame'
local scan = M'aux.scan'
TAB 'Bids'
private.auction_records = t
function LOAD()
aux_bids_tab_frame.create()
tab_frame.create()
end
function OPEN()
@@ -61,7 +64,7 @@ end
function private.test(record)
return function(index)
local auction_info = aux_info.auction(index, 'bidder')
local auction_info = info.auction(index, 'bidder')
return auction_info and auction_info.search_signature == record.search_signature
end
end
@@ -77,7 +80,7 @@ do
scan.abort(scan_id)
state = SEARCHING
scan_id = aux_scan_util.find(
scan_id = scan_util.find(
record,
status_bar,
function() state = IDLE end,
@@ -93,7 +96,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)
info.bid_update(record)
listing:SetDatabase()
end or papply(listing.RemoveAuctionRecord, listing, record))
end
+2 -1
View File
@@ -1,6 +1,7 @@
module'aux.bids_tab.frame'
local gui, auction_listing = M'aux.gui', M'aux.auction_listing'
local gui = require 'aux.gui'
local auction_listing = require 'aux.gui.auction_listing'
function public.create()
setfenv(1, getfenv(2))
+35 -26
View File
@@ -6,10 +6,19 @@ include'aux.util'
include'aux.control'
include'aux.util.color'
TAB'Post'
local scan, scan_util, history, info, persistence, item_listing, al, sorting = M'aux.scan', M'aux.scan_util', M'aux.history', M'aux.info', M'aux.persistence', M'aux.item_listing', M'aux.auction_listing', M'aux.sorting'
local info = require 'aux.util.info'
local sort_util = require 'aux.util.sort'
local persistence = require 'aux.util.persistence'
local money = require 'aux.util.money'
local scan_util = require 'aux.util.scan'
local post = require 'aux.core.post'
local scan = require 'aux.core.scan'
local history = require 'aux.core.history'
local item_listing = require 'aux.gui.item_listing'
local al = require 'aux.gui.auction_listing'
local tab_frame = require 'aux.tabs.post.frame'
TAB 'Post'
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
@@ -43,7 +52,7 @@ end
local scan_id, inventory_records, existing_auctions = 0, t, t
function private.refresh_button_click()
aux_scan.abort(scan_id)
scan.abort(scan_id)
refresh_entries()
refresh = true
end
@@ -61,7 +70,7 @@ do
end
function LOAD()
aux_post_tab_frame.create()
tab_frame.create()
end
function OPEN()
@@ -81,20 +90,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 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(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 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(money.to_string(amount, true, nil, 3, nil, true))
end
function private.update_inventory_listing()
@@ -115,12 +124,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 = money.from_string(money.to_string(blizzard_bid_undercut, true, nil, 3))
buyout_price_undercut = money.from_string(money.to_string(buyout_price_undercut, true, nil, 3))
local stack_blizzard_bid_undercut, stack_buyout_price_undercut = 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 = money.from_string(money.to_string(stack_blizzard_bid_undercut, true, nil, 3))
stack_buyout_price_undercut = money.from_string(money.to_string(stack_buyout_price_undercut, true, nil, 3))
local stack_size = stack_size_slider:GetValue()
local historical_value = history.value(selected_item.key)
@@ -148,16 +157,16 @@ 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=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 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,
})
end
sort(auction_rows, function(a, b)
return sorting.multi_lt(
return sort_util.multi_lt(
a.record.unit_buyout_price == 0 and huge or a.record.unit_buyout_price,
b.record.unit_buyout_price == 0 and huge or b.record.unit_buyout_price,
@@ -224,7 +233,7 @@ function private.post_auctions()
duration_code = 4
end
aux_post.start(
post.start(
key,
stack_size,
duration,
@@ -233,7 +242,7 @@ function private.post_auctions()
stack_count,
function(posted)
for i = 1, posted do
record_auction(key, stack_size, unit_start_price, unit_buyout_price, duration_code, UnitName('player'))
record_auction(key, stack_size, unit_start_price, unit_buyout_price, duration_code, UnitName'player')
end
update_inventory_records()
selected_item = nil
@@ -276,7 +285,7 @@ function private.update_item_configuration()
item.texture:SetTexture(nil)
item.count:SetText()
item.name:SetTextColor(color.label.enabled())
item.name:SetText('No item selected')
item.name:SetText'No item selected'
unit_start_price:Hide()
unit_buyout_price:Hide()
@@ -317,7 +326,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: ' .. money.to_string(amount, nil, nil, nil, inline_color.text.enabled))
end
refresh_button:Enable()
@@ -369,7 +378,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 money.to_string(historical_value, true, nil, 3) or '---')
end
end
@@ -397,8 +406,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(money.to_string(settings.start_price, true, nil, 3, nil, true))
unit_buyout_price:SetText(money.to_string(settings.buyout_price, true, nil, 3, nil, true))
if not existing_auctions[selected_item.key] then
refresh_entries()
@@ -453,7 +462,7 @@ function private.refresh_entries()
existing_auctions[item_key] = nil
local query = scan_util.item_query(item_id)
status_bar:update_status(0,0)
status_bar:set_text('Scanning auctions...')
status_bar:set_text'Scanning auctions...'
scan_id = scan.start{
type = 'list',
@@ -479,13 +488,13 @@ function private.refresh_entries()
existing_auctions[item_key] = nil
update_historical_value_button()
status_bar:update_status(100, 100)
status_bar:set_text('Scan aborted')
status_bar:set_text'Scan aborted'
end,
on_complete = function()
existing_auctions[item_key] = existing_auctions[item_key] or t
refresh = true
status_bar:update_status(100, 100)
status_bar:set_text('Scan complete')
status_bar:set_text'Scan complete'
end,
}
end
+8 -3
View File
@@ -1,6 +1,11 @@
module'aux.post_tab.frame'
local gui, listing, item_listing, money, search_tab = M'aux.gui', M'aux.listing', M'aux.item_listing', M'aux.money', M'aux.search_tab'
local info = require 'aux.util.info'
local money = require 'aux.util.money'
local gui = require 'aux.gui'
local listing = require 'aux.gui.listing'
local item_listing = require 'aux.gui.item_listing'
local search_tab = require 'aux.tabs.search'
function public.create()
setfenv(1, getfenv(2))
@@ -50,7 +55,7 @@ function public.create()
set_item(this.item_record)
elseif arg1 == 'RightButton' then
aux.tab = 1
search_tab.set_filter(strlower(aux_info.item(this.item_record.item_id).name) .. '/exact')
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name) .. '/exact')
search_tab.execute(nil, false)
end
end,
@@ -110,7 +115,7 @@ function public.create()
item:SetPoint('TOPLEFT', 10, -6)
item.button:SetScript('OnEnter', function()
if selected_item then
aux_info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
end
end)
item.button:SetScript('OnLeave', function()
+5 -5
View File
@@ -1,9 +1,9 @@
module'aux.util.color'
module 'aux.util.color'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
local COLORS = {
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
+7 -7
View File
@@ -1,12 +1,12 @@
module'aux.completion'
module 'aux.util.completion'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local filter_util = M'aux.filter_util'
local filter_util = require 'aux.util.filter'
function public:complete_filter()
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
+3 -3
View File
@@ -1,7 +1,7 @@
module'aux.util'
module 'aux.util'
include'green_t'
include'aux'
include 'green_t'
include 'aux'
do
local classes, interfaces, objects = {}, {}, setmetatable({}, { __mode='k' })
+12 -7
View File
@@ -1,12 +1,17 @@
module'aux.filter_util'
module 'aux.util.filter'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local info, history, disenchant, cache, money, filter_util = M'aux.info', M'aux.history', M'aux.disenchant', M'aux.cache', M'aux.money', M'aux.filter_util'
local info = require 'aux.util.info'
local money = require 'aux.util.money'
local filter_util = require 'aux.util.filter'
local cache = require 'aux.core.cache'
local history = require 'aux.core.history'
local disenchant = require 'aux.core.disenchant'
function private.default_filter(str)
return {
+7 -7
View File
@@ -1,12 +1,12 @@
module'aux.info'
module 'aux.util.info'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local cache = M'aux.cache'
local cache = require 'aux.core.cache'
CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate')
AuxTooltip:SetScript('OnTooltipAddMoney', function()
+6 -6
View File
@@ -1,10 +1,10 @@
module'aux.money'
module 'aux.util.money'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
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'
+6 -6
View File
@@ -1,10 +1,10 @@
module'aux.persistence'
module 'aux.util.persistence'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
aux_datasets = t
+9 -7
View File
@@ -1,12 +1,14 @@
module'aux.scan_util'
module 'aux.util.scan'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
local info , filter_util, scan = M'aux.info', M'aux.filter_util', M'aux.scan'
local info = require 'aux.util.info'
local filter_util = require 'aux.util.filter'
local scan = require 'aux.core.scan'
function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
+6 -6
View File
@@ -1,10 +1,10 @@
module'aux.sorting'
module 'aux.util.sort'
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
include'aux.util.color'
include 'green_t'
include 'aux'
include 'aux.util'
include 'aux.control'
include 'aux.util.color'
public.EQ = 0
public.LT = 1