working on module refactoring
This commit is contained in:
+7
-7
@@ -1,6 +1,6 @@
|
|||||||
module 'aux'
|
module'aux'
|
||||||
|
|
||||||
use 'green_t'
|
include'green_t'
|
||||||
|
|
||||||
--aux_account_settings = {} -- TODO clean up the mess of savedvariables
|
--aux_account_settings = {} -- TODO clean up the mess of savedvariables
|
||||||
--aux_character_settings = {}
|
--aux_character_settings = {}
|
||||||
@@ -21,7 +21,7 @@ function public.bids_loaded.get() return bids_loaded end
|
|||||||
local current_owner_page
|
local current_owner_page
|
||||||
function public.current_owner_page.get() return current_owner_page end
|
function public.current_owner_page.get() return current_owner_page end
|
||||||
|
|
||||||
local event_frame = CreateFrame('Frame')
|
local event_frame = CreateFrame'Frame'
|
||||||
|
|
||||||
for event in temp-S('ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE') do
|
for event in temp-S('ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE') do
|
||||||
event_frame:RegisterEvent(event)
|
event_frame:RegisterEvent(event)
|
||||||
@@ -150,12 +150,12 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
function public.is_player(name, current)
|
function public.is_player(name, current)
|
||||||
local realm = GetCVar('realmName')
|
local realm = GetCVar'realmName'
|
||||||
return not current and index(aux_characters, realm, name) or UnitName('player') == name
|
return not current and index(aux_characters, realm, name) or UnitName'player' == name
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.neutral_faction()
|
function public.neutral_faction()
|
||||||
return not UnitFactionGroup('npc')
|
return not UnitFactionGroup'npc'
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.min_bid_increment(current_bid)
|
function public.min_bid_increment(current_bid)
|
||||||
@@ -195,7 +195,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ADDON_LOADED.Blizzard_AuctionUI()
|
function ADDON_LOADED.Blizzard_AuctionUI()
|
||||||
AuctionFrame:UnregisterEvent('AUCTION_HOUSE_SHOW')
|
AuctionFrame:UnregisterEvent'AUCTION_HOUSE_SHOW'
|
||||||
AuctionFrame:SetScript('OnHide', nil)
|
AuctionFrame:SetScript('OnHide', nil)
|
||||||
hook('ShowUIPanel', function(...) auto[arg] = true
|
hook('ShowUIPanel', function(...) auto[arg] = true
|
||||||
if arg[1] == AuctionFrame then return AuctionFrame:Show() end
|
if arg[1] == AuctionFrame then return AuctionFrame:Show() end
|
||||||
|
|||||||
+5
-5
@@ -1,10 +1,10 @@
|
|||||||
module 'aux_control'
|
module'aux.control'
|
||||||
|
|
||||||
use 'green_t'
|
include'green_t'
|
||||||
use 'aux'
|
include'aux'
|
||||||
use 'aux_util'
|
include'aux.util'
|
||||||
|
|
||||||
local event_frame = CreateFrame('Frame')
|
local event_frame = CreateFrame'Frame'
|
||||||
|
|
||||||
local listeners, threads = t, t
|
local listeners, threads = t, t
|
||||||
|
|
||||||
|
|||||||
+10
-12
@@ -1,14 +1,12 @@
|
|||||||
module 'aux_cache'
|
module'aux.cache'
|
||||||
|
|
||||||
import 'aux.*'
|
include'green_t'
|
||||||
import 'aux_util.*'
|
include'aux'
|
||||||
import 'aux_control.*'
|
include'aux.util'
|
||||||
import 'aux_util_color.*'
|
include'aux.control'
|
||||||
|
include'aux.util.color'
|
||||||
|
|
||||||
import 'aux_info'
|
local info, persistence = M'aux.info', M'aux.persistence'
|
||||||
import 'aux_persistence'
|
|
||||||
|
|
||||||
local info, persistence = aux_info, aux_persistence
|
|
||||||
|
|
||||||
local MIN_ITEM_ID = 1
|
local MIN_ITEM_ID = 1
|
||||||
local MAX_ITEM_ID = 30000
|
local MAX_ITEM_ID = 30000
|
||||||
@@ -36,9 +34,9 @@ function LOAD()
|
|||||||
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', merchant_on_update)
|
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', merchant_on_update)
|
||||||
|
|
||||||
event_listener('NEW_AUCTION_UPDATE', function()
|
event_listener('NEW_AUCTION_UPDATE', function()
|
||||||
for info in present(info.auction_sell_item()) do
|
for data in present(info.auction_sell_item()) do
|
||||||
for item_id in present(item_id(info.name)) do
|
for item_id in present(item_id(data.name)) do
|
||||||
aux_merchant_sell[_M.item_id(info.name)] = info.vendor_price / (aux_info.max_item_charges(item_id) or info.count)
|
aux_merchant_sell[_M.item_id(data.name)] = data.vendor_price / (info.max_item_charges(item_id) or data.count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
+9
-7
@@ -1,10 +1,12 @@
|
|||||||
aux_disenchant = module
|
module'aux.disenchant'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
|
local history = M'aux.history'
|
||||||
|
|
||||||
local UNCOMMON, RARE, EPIC = 2, 3, 4
|
local UNCOMMON, RARE, EPIC = 2, 3, 4
|
||||||
|
|
||||||
@@ -75,7 +77,7 @@ local WEAPON = S(
|
|||||||
function public.value(slot, quality, level)
|
function public.value(slot, quality, level)
|
||||||
local expectation
|
local expectation
|
||||||
for _, event in distribution(slot, quality, level) do
|
for _, event in distribution(slot, quality, level) do
|
||||||
local value = aux_history.value(event.item_id .. ':' .. 0)
|
local value = history.value(event.item_id .. ':' .. 0)
|
||||||
if not value then
|
if not value then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
|
|||||||
+7
-7
@@ -1,12 +1,12 @@
|
|||||||
aux_history = module
|
module'aux.history'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local persistence = aux_persistence
|
local persistence = M'aux.persistence'
|
||||||
|
|
||||||
local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}} }
|
local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}} }
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
aux_post = module
|
module'aux.post'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local state
|
local state
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
aux_scan = module
|
module'aux.scan'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local info, history = aux_info, aux_history
|
local info, history = aux_info, aux_history
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -1,12 +1,12 @@
|
|||||||
aux_slash = module
|
module'aux.slash'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local persistence = aux_persistence
|
local persistence = M'aux.persistence'
|
||||||
|
|
||||||
aux_ignore_owner = true
|
aux_ignore_owner = true
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -1,12 +1,12 @@
|
|||||||
aux_stack = module
|
module'aux.stack'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local info = aux_info
|
local info = M'aux.info'
|
||||||
|
|
||||||
local state
|
local state
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -1,12 +1,12 @@
|
|||||||
aux_tooltip = module
|
module'aux.tooltip'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local info, disenchant, cache, money, history = aux_info, aux_disenchant, aux_cache, aux_money, aux_history
|
local info, disenchant, cache, money, history = M'aux.info', M'aux.disenchant', M'aux.cache', M'aux.money', M'aux.history'
|
||||||
|
|
||||||
aux_tooltip_value = true
|
aux_tooltip_value = true
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
module 'aux.frame'
|
module'aux.frame'
|
||||||
|
|
||||||
use 'aux.frame'
|
local gui = M'aux.gui'
|
||||||
|
|
||||||
use 'aux_init'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local gui = aux_gui
|
|
||||||
|
|
||||||
function public.create()
|
function public.create()
|
||||||
setfenv(1, getfenv(2))
|
setfenv(1, getfenv(2))
|
||||||
@@ -20,11 +14,11 @@ function public.create()
|
|||||||
frame:SetMovable(true)
|
frame:SetMovable(true)
|
||||||
frame:EnableMouse(true)
|
frame:EnableMouse(true)
|
||||||
frame:SetClampedToScreen(true)
|
frame:SetClampedToScreen(true)
|
||||||
frame:RegisterForDrag('LeftButton')
|
frame:RegisterForDrag'LeftButton'
|
||||||
frame:SetScript('OnDragStart', function() this:StartMoving() end)
|
frame:SetScript('OnDragStart', function() this:StartMoving() end)
|
||||||
frame:SetScript('OnDragStop', function() this:StopMovingOrSizing() end)
|
frame:SetScript('OnDragStop', function() this:StopMovingOrSizing() end)
|
||||||
frame:SetScript('OnShow', function() PlaySound('AuctionWindowOpen') end)
|
frame:SetScript('OnShow', function() PlaySound'AuctionWindowOpen' end)
|
||||||
frame:SetScript('OnHide', function() PlaySound('AuctionWindowClose'); CloseAuctionHouse() end)
|
frame:SetScript('OnHide', function() PlaySound'AuctionWindowClose'; CloseAuctionHouse() end)
|
||||||
frame.content = CreateFrame('Frame', nil, frame)
|
frame.content = CreateFrame('Frame', nil, frame)
|
||||||
frame.content:SetPoint('TOPLEFT', 4, -80)
|
frame.content:SetPoint('TOPLEFT', 4, -80)
|
||||||
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
|
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
|
||||||
@@ -40,7 +34,7 @@ function public.create()
|
|||||||
local btn = gui.button(AuxFrame)
|
local btn = gui.button(AuxFrame)
|
||||||
btn:SetPoint('BOTTOMRIGHT', -5, 5)
|
btn:SetPoint('BOTTOMRIGHT', -5, 5)
|
||||||
gui.set_size(btn, 60, 24)
|
gui.set_size(btn, 60, 24)
|
||||||
btn:SetText('Close')
|
btn:SetText'Close'
|
||||||
btn:SetScript('OnClick', papply(AuxFrame.Hide, AuxFrame))
|
btn:SetScript('OnClick', papply(AuxFrame.Hide, AuxFrame))
|
||||||
public.close_button = btn
|
public.close_button = btn
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
aux_auction_listing = module
|
module'aux.auction_listing'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local gui, sorting, money, info = aux_gui, aux_sorting, aux_money, aux_info
|
local gui, sorting, money, info = M'aux.gui', M'aux.sorting', M'aux.money', M'aux.info'
|
||||||
|
|
||||||
aux_price_per_unit = false
|
aux_price_per_unit = false
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
aux_gui = module
|
module'aux.gui'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
public.font = [[Fonts\ARIALN.TTF]]
|
public.font = [[Fonts\ARIALN.TTF]]
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
aux_item_listing = module
|
module'aux.item_listing'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local gui, info = aux_gui, aux_info
|
local gui, info = M'aux.gui', M'aux.info'
|
||||||
|
|
||||||
local ROW_HEIGHT = 39
|
local ROW_HEIGHT = 39
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -1,12 +1,12 @@
|
|||||||
aux_listing = module
|
module'aux.listing'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local gui = aux_gui
|
local gui = M'aux.gui'
|
||||||
|
|
||||||
local ST_COUNT = 0
|
local ST_COUNT = 0
|
||||||
|
|
||||||
|
|||||||
+8
-15
@@ -1,5 +1,5 @@
|
|||||||
if module then return end
|
if module then return end
|
||||||
local strfind, gfind, type, setmetatable, setfenv, _G = strfind, string.gfind, type, setmetatable, setfenv, getfenv(0)
|
local strfind, type, setmetatable, setfenv, _G = strfind, type, setmetatable, setfenv, getfenv(0)
|
||||||
|
|
||||||
local PRIVATE, PUBLIC, FIELD, ACCESSOR, MUTATOR = 0, 1, 2, 4, 6
|
local PRIVATE, PUBLIC, FIELD, ACCESSOR, MUTATOR = 0, 1, 2, 4, 6
|
||||||
local MODES = { FIELD, ACCESSOR, MUTATOR }
|
local MODES = { FIELD, ACCESSOR, MUTATOR }
|
||||||
@@ -32,26 +32,19 @@ function definition_helper_mt:__newindex(k, v)
|
|||||||
_access[self], _name[self] = nil, nil
|
_access[self], _name[self] = nil, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local function import(self, path)
|
local function include(self, name)
|
||||||
local module_name, key
|
local module = name and _module[name] or error('No module "%s".', name)
|
||||||
for part in gfind(path, '[^.]*') do
|
|
||||||
if module_name then key = part else module_name = part end
|
|
||||||
end
|
|
||||||
local _, _, module_name, key = strfind(path, '([^.]*)%.?(.*)')
|
|
||||||
local module = _module[module_name] or error('No module "%s".', module_name)
|
|
||||||
if not key then --define module
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
for _, mode in MODES do
|
for _, mode in MODES do
|
||||||
for k, v in module[PUBLIC + mode] do
|
for k, v in module[PUBLIC + mode] do
|
||||||
if (key == '*' or key == k) and (not self.defined[k .. OPERATION[mode]] or error('Import conflict for "%s".', k)) then
|
if not self.defined[k .. OPERATION[mode]] or error('Import conflict for "%s".', k) then
|
||||||
self.defined[k .. OPERATION[mode]], self[mode][k] = true, v
|
self.defined[k .. OPERATION[mode]], self[mode][k] = true, v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fetch_interface(name) return _interface[name] end
|
||||||
|
|
||||||
local nop_default_mt = { __index=function() return nop end }
|
local nop_default_mt = { __index=function() return nop end }
|
||||||
|
|
||||||
function module(name)
|
function module(name)
|
||||||
@@ -61,7 +54,7 @@ function module(name)
|
|||||||
accessors = { private=function() _access[definition_helper] = PRIVATE; return definition_helper end, public=function() _access[definition_helper] = PUBLIC; return definition_helper end }
|
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 })
|
mutators = setmetatable({ _=nop }, { __index=function(_, k) return function(v) _G[k] = v end end })
|
||||||
fields = setmetatable(
|
fields = setmetatable(
|
||||||
{ _M=environment, _G=_G, import=function(interface) import(module, interface) end, error=error, nop=nop, id=id },
|
{ _M=environment, _G=_G, M=fetch_interface, 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 }
|
{ __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_accessors = setmetatable({}, nop_default_mt)
|
||||||
@@ -70,7 +63,7 @@ function module(name)
|
|||||||
setmetatable(environment, proxy_mt(fields, mutators))
|
setmetatable(environment, proxy_mt(fields, mutators))
|
||||||
setmetatable(interface, proxy_mt(public_fields, public_mutators))
|
setmetatable(interface, proxy_mt(public_fields, public_mutators))
|
||||||
module = {
|
module = {
|
||||||
defined = { _M=true, _G=true, import=true, error=true, nop=true, id=true, public=true, private=true, ['_=']=true },
|
defined = { _M=true, _G=true, M=true, include=true, error=true, nop=true, id=true, public=true, private=true, ['_=']=true },
|
||||||
[ACCESSOR] = accessors,
|
[ACCESSOR] = accessors,
|
||||||
[MUTATOR] = mutators,
|
[MUTATOR] = mutators,
|
||||||
[FIELD] = fields,
|
[FIELD] = fields,
|
||||||
|
|||||||
+11
-11
@@ -1,14 +1,14 @@
|
|||||||
aux_auctions_tab = module
|
module'aux.auctions_tab'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
TAB 'Auctions'
|
TAB'Auctions'
|
||||||
|
|
||||||
local scan = aux_scan
|
local scan = M'aux.scan'
|
||||||
|
|
||||||
private.auction_records = t
|
private.auction_records = t
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ end
|
|||||||
function public.scan_auctions()
|
function public.scan_auctions()
|
||||||
|
|
||||||
status_bar:update_status(0,0)
|
status_bar:update_status(0,0)
|
||||||
status_bar:set_text('Scanning auctions...')
|
status_bar:set_text'Scanning auctions...'
|
||||||
|
|
||||||
wipe(auction_records)
|
wipe(auction_records)
|
||||||
update_listing()
|
update_listing()
|
||||||
@@ -49,12 +49,12 @@ function public.scan_auctions()
|
|||||||
end,
|
end,
|
||||||
on_complete = function()
|
on_complete = function()
|
||||||
status_bar:update_status(100, 100)
|
status_bar:update_status(100, 100)
|
||||||
status_bar:set_text('Scan complete')
|
status_bar:set_text'Scan complete'
|
||||||
update_listing()
|
update_listing()
|
||||||
end,
|
end,
|
||||||
on_abort = function()
|
on_abort = function()
|
||||||
status_bar:update_status(100, 100)
|
status_bar:update_status(100, 100)
|
||||||
status_bar:set_text('Scan aborted')
|
status_bar:set_text'Scan aborted'
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
aux_auctions_tab_frame = module
|
module'aux.auctions_tab.frame'
|
||||||
|
|
||||||
local gui, auction_listing = aux_gui, aux_auction_listing
|
local gui, auction_listing = M'aux.gui', M'aux.auction_listing'
|
||||||
|
|
||||||
function public.create()
|
function public.create()
|
||||||
setfenv(1, getfenv(2))
|
setfenv(1, getfenv(2))
|
||||||
@@ -33,19 +33,19 @@ function public.create()
|
|||||||
status_bar:SetHeight(25)
|
status_bar:SetHeight(25)
|
||||||
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
status_bar:update_status(100, 100)
|
status_bar:update_status(100, 100)
|
||||||
status_bar:set_text('')
|
status_bar:set_text''
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Cancel')
|
btn:SetText'Cancel'
|
||||||
btn:Disable()
|
btn:Disable()
|
||||||
private.cancel_button = btn
|
private.cancel_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
btn:SetPoint('TOPLEFT', cancel_button, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', cancel_button, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Refresh')
|
btn:SetText'Refresh'
|
||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
scan_auctions()
|
scan_auctions()
|
||||||
end)
|
end)
|
||||||
|
|||||||
+8
-8
@@ -1,14 +1,14 @@
|
|||||||
aux_bids_tab = module
|
module'aux.bids_tab'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
TAB 'Bids'
|
TAB'Bids'
|
||||||
|
|
||||||
local scan = aux_scan
|
local scan = M'aux.scan'
|
||||||
|
|
||||||
private.auction_records = t
|
private.auction_records = t
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
aux_bids_tab_frame = module
|
module'aux.bids_tab.frame'
|
||||||
|
|
||||||
local gui, auction_listing = aux_gui, aux_auction_listing
|
local gui, auction_listing = M'aux.gui', M'aux.auction_listing'
|
||||||
|
|
||||||
function public.create()
|
function public.create()
|
||||||
setfenv(1, getfenv(2))
|
setfenv(1, getfenv(2))
|
||||||
@@ -42,21 +42,21 @@ function public.create()
|
|||||||
do
|
do
|
||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Bid')
|
btn:SetText'Bid'
|
||||||
btn:Disable()
|
btn:Disable()
|
||||||
private.bid_button = btn
|
private.bid_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Buyout')
|
btn:SetText'Buyout'
|
||||||
btn:Disable()
|
btn:Disable()
|
||||||
private.buyout_button = btn
|
private.buyout_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
|
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
|
||||||
btn:SetText('Refresh')
|
btn:SetText'Refresh'
|
||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
scan_bids()
|
scan_bids()
|
||||||
end)
|
end)
|
||||||
|
|||||||
+8
-8
@@ -1,14 +1,14 @@
|
|||||||
aux_post_tab = module
|
module'aux.post_tab'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
TAB 'Post'
|
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 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 DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
aux_post_tab_frame = module
|
module'aux.post_tab.frame'
|
||||||
|
|
||||||
local gui, listing, item_listing, money, search_tab = aux_gui, aux_listing, aux_item_listing, aux_money, aux_search_tab
|
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'
|
||||||
|
|
||||||
function public.create()
|
function public.create()
|
||||||
setfenv(1, getfenv(2))
|
setfenv(1, getfenv(2))
|
||||||
|
|||||||
+5
-5
@@ -1,9 +1,9 @@
|
|||||||
aux_util_color = module
|
module'aux.util.color'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
|
|
||||||
local COLORS = {
|
local COLORS = {
|
||||||
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
|
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
|
||||||
|
|||||||
+7
-7
@@ -1,12 +1,12 @@
|
|||||||
aux_completion = module
|
module'aux.completion'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local filter_util = aux_filter_util
|
local filter_util = M'aux.filter_util'
|
||||||
|
|
||||||
function public:complete_filter()
|
function public:complete_filter()
|
||||||
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
aux_util = module
|
module'aux.util'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
|
|
||||||
do
|
do
|
||||||
local classes, interfaces, objects = {}, {}, setmetatable({}, { __mode='k' })
|
local classes, interfaces, objects = {}, {}, setmetatable({}, { __mode='k' })
|
||||||
|
|||||||
+23
-23
@@ -1,12 +1,12 @@
|
|||||||
aux_filter_util = module
|
module'aux.filter_util'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local info = aux_info
|
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'
|
||||||
|
|
||||||
function private.default_filter(str)
|
function private.default_filter(str)
|
||||||
return {
|
return {
|
||||||
@@ -124,7 +124,7 @@ public.filters = {
|
|||||||
input_type = 'number',
|
input_type = 'number',
|
||||||
validator = function(pct)
|
validator = function(pct)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
return aux_history.value(auction_record.item_key) and auction_record.unit_bid_price / aux_history.value(auction_record.item_key) * 100 <= pct
|
return history.value(auction_record.item_key) and auction_record.unit_bid_price / history.value(auction_record.item_key) * 100 <= pct
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
@@ -134,8 +134,8 @@ public.filters = {
|
|||||||
validator = function(pct)
|
validator = function(pct)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
return auction_record.unit_buyout_price > 0
|
return auction_record.unit_buyout_price > 0
|
||||||
and aux_history.value(auction_record.item_key)
|
and history.value(auction_record.item_key)
|
||||||
and auction_record.unit_buyout_price / aux_history.value(auction_record.item_key) * 100 <= pct
|
and auction_record.unit_buyout_price / history.value(auction_record.item_key) * 100 <= pct
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
@@ -144,7 +144,7 @@ public.filters = {
|
|||||||
input_type = 'money',
|
input_type = 'money',
|
||||||
validator = function(amount)
|
validator = function(amount)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
return aux_history.value(auction_record.item_key) and aux_history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
|
return history.value(auction_record.item_key) and history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
@@ -153,7 +153,7 @@ public.filters = {
|
|||||||
input_type = 'money',
|
input_type = 'money',
|
||||||
validator = function(amount)
|
validator = function(amount)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
return auction_record.buyout_price > 0 and aux_history.value(auction_record.item_key) and aux_history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
return auction_record.buyout_price > 0 and history.value(auction_record.item_key) and history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
@@ -162,7 +162,7 @@ public.filters = {
|
|||||||
input_type = 'money',
|
input_type = 'money',
|
||||||
validator = function(amount)
|
validator = function(amount)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
local disenchant_value = aux_disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||||
return disenchant_value and disenchant_value - auction_record.bid_price >= amount
|
return disenchant_value and disenchant_value - auction_record.bid_price >= amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -172,7 +172,7 @@ public.filters = {
|
|||||||
input_type = 'money',
|
input_type = 'money',
|
||||||
validator = function(amount)
|
validator = function(amount)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
local disenchant_value = aux_disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||||
return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
|
return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -182,7 +182,7 @@ public.filters = {
|
|||||||
input_type = 'money',
|
input_type = 'money',
|
||||||
validator = function(amount)
|
validator = function(amount)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
local vendor_price = aux_cache.merchant_info(auction_record.item_id)
|
local vendor_price = cache.merchant_info(auction_record.item_id)
|
||||||
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
|
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -192,7 +192,7 @@ public.filters = {
|
|||||||
input_type = 'money',
|
input_type = 'money',
|
||||||
validator = function(amount)
|
validator = function(amount)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
local vendor_price = aux_cache.merchant_info(auction_record.item_id)
|
local vendor_price = cache.merchant_info(auction_record.item_id)
|
||||||
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -269,7 +269,7 @@ end
|
|||||||
|
|
||||||
function private.parse_parameter(input_type, str)
|
function private.parse_parameter(input_type, str)
|
||||||
if input_type == 'money' then
|
if input_type == 'money' then
|
||||||
local money = aux_money.from_string(str)
|
local money = money.from_string(str)
|
||||||
return money and money > 0 and money or nil
|
return money and money > 0 and money or nil
|
||||||
elseif input_type == 'number' then
|
elseif input_type == 'number' then
|
||||||
local number = tonumber(str)
|
local number = tonumber(str)
|
||||||
@@ -435,8 +435,8 @@ function public.filter_string(components)
|
|||||||
elseif component[1] == 'filter' then
|
elseif component[1] == 'filter' then
|
||||||
query_builder.append(component[2])
|
query_builder.append(component[2])
|
||||||
for parameter in present(component[3]) do
|
for parameter in present(component[3]) do
|
||||||
if aux_filter_util.filters[component[2]].input_type == 'money' then
|
if filter_util.filters[component[2]].input_type == 'money' then
|
||||||
parameter = aux_money.to_string(aux_money.from_string(parameter), nil, true, nil, nil, true)
|
parameter = money.to_string(money.from_string(parameter), nil, true, nil, nil, true)
|
||||||
end
|
end
|
||||||
query_builder.append(parameter)
|
query_builder.append(parameter)
|
||||||
end
|
end
|
||||||
@@ -453,7 +453,7 @@ function private.prettified_filter_string(filter)
|
|||||||
if component[1] == 'blizzard' then
|
if component[1] == 'blizzard' then
|
||||||
if component[2] == 'name' then
|
if component[2] == 'name' then
|
||||||
if filter.blizzard.exact then
|
if filter.blizzard.exact then
|
||||||
prettified.append(info.display_name(aux_cache.item_id(component[4])) or color.orange('[' .. component[4] .. ']'))
|
prettified.append(info.display_name(cache.item_id(component[4])) or color.orange('[' .. component[4] .. ']'))
|
||||||
elseif component[4] ~= '' then
|
elseif component[4] ~= '' then
|
||||||
prettified.append(color.orange(component[4]))
|
prettified.append(color.orange(component[4]))
|
||||||
end
|
end
|
||||||
@@ -468,10 +468,10 @@ function private.prettified_filter_string(filter)
|
|||||||
end
|
end
|
||||||
for parameter in present(component[3]) do
|
for parameter in present(component[3]) do
|
||||||
if component[2] == 'item' then
|
if component[2] == 'item' then
|
||||||
prettified.append(info.display_name(aux_cache.item_id(parameter)) or color.label.enabled('[' .. parameter .. ']'))
|
prettified.append(info.display_name(cache.item_id(parameter)) or color.label.enabled('[' .. parameter .. ']'))
|
||||||
else
|
else
|
||||||
if filters[component[2]].input_type == 'money' then
|
if filters[component[2]].input_type == 'money' then
|
||||||
prettified.append(aux_money.to_string(aux_money.from_string(parameter), nil, true, nil, inline_color.label.enabled))
|
prettified.append(money.to_string(money.from_string(parameter), nil, true, nil, inline_color.label.enabled))
|
||||||
else
|
else
|
||||||
prettified.append(color.label.enabled(parameter))
|
prettified.append(color.label.enabled(parameter))
|
||||||
end
|
end
|
||||||
@@ -498,7 +498,7 @@ function private.blizzard_query(filter)
|
|||||||
local filters = filter.blizzard
|
local filters = filter.blizzard
|
||||||
local query = T('name', filters.name and filters.name[2])
|
local query = T('name', filters.name and filters.name[2])
|
||||||
local item_info, class_index, subclass_index, slot_index
|
local item_info, class_index, subclass_index, slot_index
|
||||||
local item_id = filters.name and aux_cache.item_id(filters.name[2])
|
local item_id = filters.name and cache.item_id(filters.name[2])
|
||||||
item_info = item_id and info.item(item_id)
|
item_info = item_id and info.item(item_id)
|
||||||
if filters.exact and item_info then
|
if filters.exact and item_info then
|
||||||
item_info = info.item(item_id)
|
item_info = info.item(item_id)
|
||||||
|
|||||||
+9
-7
@@ -1,10 +1,12 @@
|
|||||||
aux_info = module
|
module'aux.info'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
|
local cache = M'aux.cache'
|
||||||
|
|
||||||
CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate')
|
CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate')
|
||||||
AuxTooltip:SetScript('OnTooltipAddMoney', function()
|
AuxTooltip:SetScript('OnTooltipAddMoney', function()
|
||||||
@@ -371,7 +373,7 @@ function public.item(item_id, suffix_id)
|
|||||||
'slot', slot,
|
'slot', slot,
|
||||||
'max_stack', max_stack,
|
'max_stack', max_stack,
|
||||||
'texture', texture
|
'texture', texture
|
||||||
) or aux_cache.item_info(item_id)
|
) or cache.item_info(item_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.item_class_index(item_class)
|
function public.item_class_index(item_class)
|
||||||
|
|||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
aux_money = module
|
module'aux.money'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
public.GOLD_TEXT = '|cffffd70ag|r'
|
public.GOLD_TEXT = '|cffffd70ag|r'
|
||||||
public.SILVER_TEXT = '|cffc7c7cfs|r'
|
public.SILVER_TEXT = '|cffc7c7cfs|r'
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
aux_persistence = module
|
module'aux.persistence'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
aux_datasets = t
|
aux_datasets = t
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ do
|
|||||||
local dataset
|
local dataset
|
||||||
function public.dataset.get()
|
function public.dataset.get()
|
||||||
if not dataset then
|
if not dataset then
|
||||||
local dataset_key = format('%s|%s', GetCVar 'realmName', UnitFactionGroup 'player')
|
local dataset_key = format('%s|%s', GetCVar'realmName', UnitFactionGroup'player')
|
||||||
dataset = aux_datasets[dataset_key] or t
|
dataset = aux_datasets[dataset_key] or t
|
||||||
aux_datasets[dataset_key] = dataset
|
aux_datasets[dataset_key] = dataset
|
||||||
end
|
end
|
||||||
|
|||||||
+8
-8
@@ -1,12 +1,12 @@
|
|||||||
aux_scan_util = module
|
module'aux.scan_util'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
local info , filter_util = aux_info, aux_filter_util
|
local info , filter_util, scan = M'aux.info', M'aux.filter_util', M'aux.scan'
|
||||||
|
|
||||||
function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
|||||||
end
|
end
|
||||||
|
|
||||||
local found
|
local found
|
||||||
return aux_scan.start{
|
return scan.start{
|
||||||
type = auction_record.query_type,
|
type = auction_record.query_type,
|
||||||
queries = queries,
|
queries = queries,
|
||||||
on_scan_start = function()
|
on_scan_start = function()
|
||||||
|
|||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
aux_sorting = module
|
module'aux.sorting'
|
||||||
|
|
||||||
include (green_t)
|
include'green_t'
|
||||||
include (aux)
|
include'aux'
|
||||||
include (aux_util)
|
include'aux.util'
|
||||||
include (aux_control)
|
include'aux.control'
|
||||||
include (aux_util_color)
|
include'aux.util.color'
|
||||||
|
|
||||||
public.EQ = 0
|
public.EQ = 0
|
||||||
public.LT = 1
|
public.LT = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user