module refactoring
This commit is contained in:
+9
-11
@@ -2,8 +2,6 @@ module 'aux'
|
|||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
|
||||||
local info = require 'aux.util.info'
|
|
||||||
|
|
||||||
_G.aux_scale = 1
|
_G.aux_scale = 1
|
||||||
|
|
||||||
_G.aux = {
|
_G.aux = {
|
||||||
@@ -93,7 +91,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
tab_info = {}
|
tab_info = {}
|
||||||
function M.TAB(name)
|
function M.tab(name)
|
||||||
local tab = T.map('name', name)
|
local tab = T.map('name', name)
|
||||||
local tab_event = {
|
local tab_event = {
|
||||||
OPEN = function(f) tab.OPEN = f end,
|
OPEN = function(f) tab.OPEN = f end,
|
||||||
@@ -107,12 +105,12 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
local index
|
local index
|
||||||
function M.get_active_tab() return tab_info[index] end
|
function M.get_tab() return tab_info[index] end
|
||||||
function on_tab_click(i)
|
function on_tab_click(i)
|
||||||
CloseDropDownMenus()
|
CloseDropDownMenus()
|
||||||
do (index and get_active_tab().CLOSE or nop)() end
|
do (index and get_tab().CLOSE or pass)() end
|
||||||
index = i
|
index = i
|
||||||
do (index and get_active_tab().OPEN or nop)() end
|
do (index and get_tab().OPEN or pass)() end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -142,7 +140,7 @@ do
|
|||||||
locked = true
|
locked = true
|
||||||
local send_signal, signal_received = signal()
|
local send_signal, signal_received = signal()
|
||||||
thread(when, signal_received, function()
|
thread(when, signal_received, function()
|
||||||
do (on_success or nop)() end
|
do (on_success or pass)() end
|
||||||
locked = false
|
locked = false
|
||||||
end)
|
end)
|
||||||
thread(when, later(5), send_signal)
|
thread(when, later(5), send_signal)
|
||||||
@@ -165,7 +163,7 @@ do
|
|||||||
CancelAuction(index)
|
CancelAuction(index)
|
||||||
local send_signal, signal_received = signal()
|
local send_signal, signal_received = signal()
|
||||||
thread(when, signal_received, function()
|
thread(when, signal_received, function()
|
||||||
do (on_success or nop)() end
|
do (on_success or pass)() end
|
||||||
locked = false
|
locked = false
|
||||||
end)
|
end)
|
||||||
thread(when, later(5), send_signal)
|
thread(when, later(5), send_signal)
|
||||||
@@ -179,12 +177,12 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
function handle.LOAD2()
|
function handle.LOAD2()
|
||||||
AuxFrame:SetScale(aux_scale)
|
frame:SetScale(aux_scale)
|
||||||
end
|
end
|
||||||
|
|
||||||
function AUCTION_HOUSE_SHOW()
|
function AUCTION_HOUSE_SHOW()
|
||||||
AuctionFrame:Hide()
|
AuctionFrame:Hide()
|
||||||
AuxFrame:Show()
|
frame:Show()
|
||||||
set_tab(1)
|
set_tab(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -200,7 +198,7 @@ do
|
|||||||
handler()
|
handler()
|
||||||
end
|
end
|
||||||
set_tab()
|
set_tab()
|
||||||
AuxFrame:Hide()
|
frame:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module 'aux'
|
|||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
|
||||||
function C(r, g, b, a)
|
function C(r, g, b, a)
|
||||||
local mt = T.map('__metatable', false, '__newindex', nop, 'color', T.list(r, g, b, a))
|
local mt = T.map('__metatable', false, '__newindex', pass, 'color', T.list(r, g, b, a))
|
||||||
function mt:__call(text)
|
function mt:__call(text)
|
||||||
local r, g, b, a = unpack(mt.color)
|
local r, g, b, a = unpack(mt.color)
|
||||||
if text then
|
if text then
|
||||||
@@ -20,7 +20,7 @@ function C(r, g, b, a)
|
|||||||
end
|
end
|
||||||
|
|
||||||
M.color = immutable-{
|
M.color = immutable-{
|
||||||
none = setmetatable({}, {__metatable=false, __newindex=nop, __call=function(_, v) return v end, __concat=function(_, v) return v end}),
|
none = setmetatable({}, {__metatable=false, __newindex=pass, __call=function(_, v) return v end, __concat=function(_, v) return v end}),
|
||||||
text = immutable-{enabled = C(255, 254, 250, 1), disabled = C(147, 151, 139, 1)},
|
text = immutable-{enabled = C(255, 254, 250, 1), disabled = C(147, 151, 139, 1)},
|
||||||
label = immutable-{enabled = C(216, 225, 211, 1), disabled = C(150, 148, 140, 1)},
|
label = immutable-{enabled = C(216, 225, 211, 1), disabled = C(150, 148, 140, 1)},
|
||||||
link = C(153, 255, 255, 1),
|
link = C(153, 255, 255, 1),
|
||||||
|
|||||||
+13
-15
@@ -1,9 +1,7 @@
|
|||||||
module 'aux.util.info'
|
module 'aux.util.info'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local persistence = require 'aux.util.persistence'
|
local persistence = require 'aux.util.persistence'
|
||||||
|
|
||||||
local MIN_ITEM_ID = 1
|
local MIN_ITEM_ID = 1
|
||||||
@@ -18,17 +16,17 @@ _G.aux_auctionable_items = {}
|
|||||||
_G.aux_merchant_buy = {}
|
_G.aux_merchant_buy = {}
|
||||||
_G.aux_merchant_sell = {}
|
_G.aux_merchant_sell = {}
|
||||||
|
|
||||||
function handle.LOAD()
|
function aux.handle.LOAD()
|
||||||
scan_wdb()
|
scan_wdb()
|
||||||
|
|
||||||
event_listener('MERCHANT_SHOW', on_merchant_show)
|
aux.event_listener('MERCHANT_SHOW', on_merchant_show)
|
||||||
event_listener('MERCHANT_CLOSED', on_merchant_closed)
|
aux.event_listener('MERCHANT_CLOSED', on_merchant_closed)
|
||||||
event_listener('MERCHANT_UPDATE', on_merchant_update)
|
aux.event_listener('MERCHANT_UPDATE', on_merchant_update)
|
||||||
event_listener('BAG_UPDATE', on_bag_update)
|
aux.event_listener('BAG_UPDATE', on_bag_update)
|
||||||
|
|
||||||
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', merchant_on_update)
|
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', merchant_on_update)
|
||||||
|
|
||||||
event_listener('NEW_AUCTION_UPDATE', function()
|
aux.event_listener('NEW_AUCTION_UPDATE', function()
|
||||||
local data = auction_sell_item()
|
local data = auction_sell_item()
|
||||||
if data then
|
if data then
|
||||||
local item_id = item_id(data.name)
|
local item_id = item_id(data.name)
|
||||||
@@ -44,8 +42,8 @@ do
|
|||||||
function M.is_player(name)
|
function M.is_player(name)
|
||||||
return not not characters[name]
|
return not not characters[name]
|
||||||
end
|
end
|
||||||
function handle.LOAD2()
|
function aux.handle.LOAD2()
|
||||||
characters = realm_data'characters'
|
characters = aux.realm_data'characters'
|
||||||
for k, v in characters do
|
for k, v in characters do
|
||||||
if GetTime() > v + 60 * 60 * 24 * 30 then
|
if GetTime() > v + 60 * 60 * 24 * 30 then
|
||||||
characters[k] = nil
|
characters[k] = nil
|
||||||
@@ -199,7 +197,7 @@ function scan_wdb(item_id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if item_id <= MAX_ITEM_ID then
|
if item_id <= MAX_ITEM_ID then
|
||||||
thread(when, later(.5), scan_wdb, item_id)
|
aux.thread(when, aux.later(.5), scan_wdb, item_id)
|
||||||
else
|
else
|
||||||
sort(aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
|
sort(aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
|
||||||
end
|
end
|
||||||
@@ -208,12 +206,12 @@ end
|
|||||||
function M.populate_wdb(item_id)
|
function M.populate_wdb(item_id)
|
||||||
item_id = item_id or MIN_ITEM_ID
|
item_id = item_id or MIN_ITEM_ID
|
||||||
if item_id > MAX_ITEM_ID then
|
if item_id > MAX_ITEM_ID then
|
||||||
print'Cache populated.'
|
aux.print('Cache populated.')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not GetItemInfo('item:' .. item_id) then
|
if not GetItemInfo('item:' .. item_id) then
|
||||||
print('Fetching item ' .. item_id .. '.')
|
aux.print('Fetching item ' .. item_id .. '.')
|
||||||
AuxTooltip:SetHyperlink('item:' .. item_id)
|
AuxTooltip:SetHyperlink('item:' .. item_id)
|
||||||
end
|
end
|
||||||
thread(populate_wdb, item_id + 1)
|
aux.thread(populate_wdb, item_id + 1)
|
||||||
end
|
end
|
||||||
+11
-13
@@ -1,16 +1,14 @@
|
|||||||
module 'aux.core.crafting'
|
module 'aux.core.crafting'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local money = require 'aux.util.money'
|
local money = require 'aux.util.money'
|
||||||
local history = require 'aux.core.history'
|
local history = require 'aux.core.history'
|
||||||
local search_tab = require 'aux.tabs.search'
|
local search_tab = require 'aux.tabs.search'
|
||||||
|
|
||||||
function handle.LOAD()
|
function aux.handle.LOAD()
|
||||||
event_listener('ADDON_LOADED', function()
|
aux.event_listener('ADDON_LOADED', function()
|
||||||
if arg1 == 'Blizzard_CraftUI' then
|
if arg1 == 'Blizzard_CraftUI' then
|
||||||
craft_ui_loaded()
|
craft_ui_loaded()
|
||||||
elseif arg1 == 'Blizzard_TradeSkillUI' then
|
elseif arg1 == 'Blizzard_TradeSkillUI' then
|
||||||
@@ -29,8 +27,8 @@ do
|
|||||||
local function hook_quest_item(f)
|
local function hook_quest_item(f)
|
||||||
f:SetScript('OnMouseUp', function()
|
f:SetScript('OnMouseUp', function()
|
||||||
if arg1 == 'RightButton' then
|
if arg1 == 'RightButton' then
|
||||||
if get_active_tab() then
|
if aux.get_tab() then
|
||||||
set_tab(1)
|
aux.set_tab(1)
|
||||||
search_tab.set_filter(_G[this:GetName() .. 'Name']:GetText() .. '/exact')
|
search_tab.set_filter(_G[this:GetName() .. 'Name']:GetText() .. '/exact')
|
||||||
search_tab.execute(nil, false)
|
search_tab.execute(nil, false)
|
||||||
end
|
end
|
||||||
@@ -38,8 +36,8 @@ do
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
function craft_ui_loaded()
|
function craft_ui_loaded()
|
||||||
hook('CraftFrame_SetSelection', T.vararg-function(arg)
|
aux.hook('CraftFrame_SetSelection', T.vararg-function(arg)
|
||||||
local ret = T.temp-T.list(orig.CraftFrame_SetSelection(unpack(arg)))
|
local ret = T.temp-T.list(aux.orig.CraftFrame_SetSelection(unpack(arg)))
|
||||||
local id = GetCraftSelectionIndex()
|
local id = GetCraftSelectionIndex()
|
||||||
local total_cost = 0
|
local total_cost = 0
|
||||||
for i = 1, GetCraftNumReagents(id) do
|
for i = 1, GetCraftNumReagents(id) do
|
||||||
@@ -49,7 +47,7 @@ do
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
local item_id, suffix_id = info.parse_link(link)
|
local item_id, suffix_id = info.parse_link(link)
|
||||||
local count = select(3, GetCraftReagentInfo(id, i))
|
local count = aux.select(3, GetCraftReagentInfo(id, i))
|
||||||
local _, price, limited = info.merchant_info(item_id)
|
local _, price, limited = info.merchant_info(item_id)
|
||||||
local value = price and not limited and price or history.value(item_id .. ':' .. suffix_id)
|
local value = price and not limited and price or history.value(item_id .. ':' .. suffix_id)
|
||||||
if not value then
|
if not value then
|
||||||
@@ -67,8 +65,8 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function trade_skill_ui_loaded()
|
function trade_skill_ui_loaded()
|
||||||
hook('TradeSkillFrame_SetSelection', T.vararg-function(arg)
|
aux.hook('TradeSkillFrame_SetSelection', T.vararg-function(arg)
|
||||||
local ret = T.temp-T.list(orig.TradeSkillFrame_SetSelection(unpack(arg)))
|
local ret = T.temp-T.list(aux.orig.TradeSkillFrame_SetSelection(unpack(arg)))
|
||||||
local id = GetTradeSkillSelectionIndex()
|
local id = GetTradeSkillSelectionIndex()
|
||||||
local total_cost = 0
|
local total_cost = 0
|
||||||
for i = 1, GetTradeSkillNumReagents(id) do
|
for i = 1, GetTradeSkillNumReagents(id) do
|
||||||
@@ -78,7 +76,7 @@ do
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
local item_id, suffix_id = info.parse_link(link)
|
local item_id, suffix_id = info.parse_link(link)
|
||||||
local count = select(3, GetTradeSkillReagentInfo(id, i))
|
local count = aux.select(3, GetTradeSkillReagentInfo(id, i))
|
||||||
local _, price, limited = info.merchant_info(item_id)
|
local _, price, limited = info.merchant_info(item_id)
|
||||||
local value = price and not limited and price or history.value(item_id .. ':' .. suffix_id)
|
local value = price and not limited and price or history.value(item_id .. ':' .. suffix_id)
|
||||||
if not value then
|
if not value then
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
module 'aux.core.disenchant'
|
module 'aux.core.disenchant'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
|
||||||
local history = require 'aux.core.history'
|
local history = require 'aux.core.history'
|
||||||
|
|
||||||
local UNCOMMON, RARE, EPIC = 2, 3, 4
|
local UNCOMMON, RARE, EPIC = 2, 3, 4
|
||||||
|
|||||||
+5
-6
@@ -1,8 +1,7 @@
|
|||||||
module 'aux.core.history'
|
module 'aux.core.history'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
|
|
||||||
local persistence = require 'aux.util.persistence'
|
local persistence = require 'aux.util.persistence'
|
||||||
|
|
||||||
@@ -10,8 +9,8 @@ local history_schema = {'tuple', '#', {next_push='number'}, {daily_min_buyout='n
|
|||||||
|
|
||||||
local value_cache = {}
|
local value_cache = {}
|
||||||
|
|
||||||
function handle.LOAD2()
|
function aux.handle.LOAD2()
|
||||||
data = faction_data'history'
|
data = aux.faction_data'history'
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -50,7 +49,7 @@ end
|
|||||||
function M.process_auction(auction_record)
|
function M.process_auction(auction_record)
|
||||||
local item_record = read_record(auction_record.item_key)
|
local item_record = read_record(auction_record.item_key)
|
||||||
local unit_buyout_price = ceil(auction_record.buyout_price / auction_record.aux_quantity)
|
local unit_buyout_price = ceil(auction_record.buyout_price / auction_record.aux_quantity)
|
||||||
if unit_buyout_price > 0 and unit_buyout_price < (item_record.daily_min_buyout or huge) then
|
if unit_buyout_price > 0 and unit_buyout_price < (item_record.daily_min_buyout or aux.huge) then
|
||||||
item_record.daily_min_buyout = unit_buyout_price
|
item_record.daily_min_buyout = unit_buyout_price
|
||||||
write_record(auction_record.item_key, item_record)
|
write_record(auction_record.item_key, item_record)
|
||||||
end
|
end
|
||||||
@@ -67,7 +66,7 @@ function M.value(item_key)
|
|||||||
if getn(item_record.data_points) > 0 then
|
if getn(item_record.data_points) > 0 then
|
||||||
local total_weight, weighted_values = 0, T.temp-T.acquire()
|
local total_weight, weighted_values = 0, T.temp-T.acquire()
|
||||||
for _, data_point in item_record.data_points do
|
for _, data_point in item_record.data_points do
|
||||||
local weight = .99 ^ round((item_record.data_points[1].time - data_point.time) / (60 * 60 * 24))
|
local weight = .99 ^ aux.round((item_record.data_points[1].time - data_point.time) / (60 * 60 * 24))
|
||||||
total_weight = total_weight + weight
|
total_weight = total_weight + weight
|
||||||
tinsert(weighted_values, T.map('value', data_point.value, 'weight', weight))
|
tinsert(weighted_values, T.map('value', data_point.value, 'weight', weight))
|
||||||
end
|
end
|
||||||
|
|||||||
+10
-11
@@ -1,13 +1,12 @@
|
|||||||
module 'aux.core.post'
|
module 'aux.core.post'
|
||||||
|
|
||||||
include 'aux'
|
local aux = require 'aux'
|
||||||
|
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local stack = require 'aux.core.stack'
|
local stack = require 'aux.core.stack'
|
||||||
|
|
||||||
local state
|
local state
|
||||||
|
|
||||||
function handle.CLOSE()
|
function aux.handle.CLOSE()
|
||||||
stop()
|
stop()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -16,8 +15,8 @@ function process()
|
|||||||
|
|
||||||
local stacking_complete
|
local stacking_complete
|
||||||
|
|
||||||
local send_signal, signal_received = signal()
|
local send_signal, signal_received = aux.signal()
|
||||||
when(signal_received, function()
|
aux.when(signal_received, function()
|
||||||
local slot = signal_received()[1]
|
local slot = signal_received()[1]
|
||||||
if slot then
|
if slot then
|
||||||
return post_auction(slot, process)
|
return post_auction(slot, process)
|
||||||
@@ -43,16 +42,16 @@ function post_auction(slot, k)
|
|||||||
ClickAuctionSellItemButton()
|
ClickAuctionSellItemButton()
|
||||||
ClearCursor()
|
ClearCursor()
|
||||||
|
|
||||||
StartAuction(max(1, round(state.unit_start_price * item_info.aux_quantity)), round(state.unit_buyout_price * item_info.aux_quantity), state.duration)
|
StartAuction(max(1, aux.round(state.unit_start_price * item_info.aux_quantity)), aux.round(state.unit_buyout_price * item_info.aux_quantity), state.duration)
|
||||||
|
|
||||||
local send_signal, signal_received = signal()
|
local send_signal, signal_received = aux.signal()
|
||||||
when(signal_received, function()
|
aux.when(signal_received, function()
|
||||||
state.posted = state.posted + 1
|
state.posted = state.posted + 1
|
||||||
return k()
|
return k()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local posted
|
local posted
|
||||||
event_listener('CHAT_MSG_SYSTEM', function(kill)
|
aux.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||||
if arg1 == ERR_AUCTION_STARTED then
|
if arg1 == ERR_AUCTION_STARTED then
|
||||||
send_signal()
|
send_signal()
|
||||||
kill()
|
kill()
|
||||||
@@ -65,7 +64,7 @@ end
|
|||||||
|
|
||||||
function M.stop()
|
function M.stop()
|
||||||
if state then
|
if state then
|
||||||
kill_thread(state.thread_id)
|
aux.kill_thread(state.thread_id)
|
||||||
|
|
||||||
local callback = state.callback
|
local callback = state.callback
|
||||||
local posted = state.posted
|
local posted = state.posted
|
||||||
@@ -81,7 +80,7 @@ end
|
|||||||
function M.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, callback)
|
function M.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, callback)
|
||||||
stop()
|
stop()
|
||||||
state = {
|
state = {
|
||||||
thread_id = thread(process),
|
thread_id = aux.thread(process),
|
||||||
item_key = item_key,
|
item_key = item_key,
|
||||||
stack_size = stack_size,
|
stack_size = stack_size,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
|
|||||||
+26
-28
@@ -1,15 +1,13 @@
|
|||||||
module 'aux.core.scan'
|
module 'aux.core.scan'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local history = require 'aux.core.history'
|
local history = require 'aux.core.history'
|
||||||
|
|
||||||
local PAGE_SIZE = 50
|
local PAGE_SIZE = 50
|
||||||
|
|
||||||
function handle.CLOSE()
|
function aux.handle.CLOSE()
|
||||||
abort()
|
abort()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -21,8 +19,8 @@ do
|
|||||||
if old_state then
|
if old_state then
|
||||||
abort(old_state.id)
|
abort(old_state.id)
|
||||||
end
|
end
|
||||||
do (params.on_scan_start or nop)() end
|
do (params.on_scan_start or pass)() end
|
||||||
local thread_id = thread(scan)
|
local thread_id = aux.thread(scan)
|
||||||
scan_states[params.type] = {
|
scan_states[params.type] = {
|
||||||
id = thread_id,
|
id = thread_id,
|
||||||
params = params,
|
params = params,
|
||||||
@@ -34,13 +32,13 @@ do
|
|||||||
local aborted = T.acquire()
|
local aborted = T.acquire()
|
||||||
for type, state in scan_states do
|
for type, state in scan_states do
|
||||||
if not scan_id or state.id == scan_id then
|
if not scan_id or state.id == scan_id then
|
||||||
kill_thread(state.id)
|
aux.kill_thread(state.id)
|
||||||
scan_states[type] = nil
|
scan_states[type] = nil
|
||||||
tinsert(aborted, state)
|
tinsert(aborted, state)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _, state in aborted do
|
for _, state in aborted do
|
||||||
do (state.params.on_abort or nop)() end
|
do (state.params.on_abort or pass)() end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -51,12 +49,12 @@ do
|
|||||||
function complete()
|
function complete()
|
||||||
local on_complete = get_state().params.on_complete
|
local on_complete = get_state().params.on_complete
|
||||||
scan_states[get_state().params.type] = nil
|
scan_states[get_state().params.type] = nil
|
||||||
do (on_complete or nop)() end
|
do (on_complete or pass)() end
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_state()
|
function get_state()
|
||||||
for _, state in scan_states do
|
for _, state in scan_states do
|
||||||
if state.id == thread_id() then
|
if state.id == aux.thread_id() then
|
||||||
return state
|
return state
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -80,9 +78,9 @@ end
|
|||||||
function scan()
|
function scan()
|
||||||
get_state().query_index = get_state().query_index and get_state().query_index + 1 or 1
|
get_state().query_index = get_state().query_index and get_state().query_index + 1 or 1
|
||||||
if get_query() and not get_state().stopped then
|
if get_query() and not get_state().stopped then
|
||||||
do (get_state().params.on_start_query or nop)(get_state().query_index) end
|
do (get_state().params.on_start_query or pass)(get_state().query_index) end
|
||||||
if get_query().blizzard_query then
|
if get_query().blizzard_query then
|
||||||
if (get_query().blizzard_query.first_page or 0) <= (get_query().blizzard_query.last_page or huge) then
|
if (get_query().blizzard_query.first_page or 0) <= (get_query().blizzard_query.last_page or aux.huge) then
|
||||||
get_state().page = get_query().blizzard_query.first_page or 0
|
get_state().page = get_query().blizzard_query.first_page or 0
|
||||||
return submit_query()
|
return submit_query()
|
||||||
end
|
end
|
||||||
@@ -122,7 +120,7 @@ do
|
|||||||
if get_state().params.type ~= 'list' then
|
if get_state().params.type ~= 'list' then
|
||||||
return submit()
|
return submit()
|
||||||
else
|
else
|
||||||
return when(CanSendAuctionQuery, submit)
|
return aux.when(CanSendAuctionQuery, submit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -131,7 +129,7 @@ function scan_page(i)
|
|||||||
i = i or 1
|
i = i or 1
|
||||||
|
|
||||||
if i > PAGE_SIZE then
|
if i > PAGE_SIZE then
|
||||||
do (get_state().params.on_page_scanned or nop)() end
|
do (get_state().params.on_page_scanned or pass)() end
|
||||||
if get_query().blizzard_query and get_state().page < last_page(get_state().total_auctions) then
|
if get_query().blizzard_query and get_state().page < last_page(get_state().total_auctions) then
|
||||||
get_state().page = get_state().page + 1
|
get_state().page = get_state().page + 1
|
||||||
return submit_query()
|
return submit_query()
|
||||||
@@ -149,12 +147,12 @@ function scan_page(i)
|
|||||||
|
|
||||||
history.process_auction(auction_info)
|
history.process_auction(auction_info)
|
||||||
|
|
||||||
if (get_state().params.auto_buy_validator or nop)(auction_info) then
|
if (get_state().params.auto_buy_validator or pass)(auction_info) then
|
||||||
local send_signal, signal_received = signal()
|
local send_signal, signal_received = aux.signal()
|
||||||
when(signal_received, scan_page, i)
|
aux.when(signal_received, scan_page, i)
|
||||||
return place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, send_signal)
|
return aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, send_signal)
|
||||||
elseif not get_query().validator or get_query().validator(auction_info) then
|
elseif not get_query().validator or get_query().validator(auction_info) then
|
||||||
do (get_state().params.on_auction or nop)(auction_info) end
|
do (get_state().params.on_auction or pass)(auction_info) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -163,7 +161,7 @@ end
|
|||||||
|
|
||||||
function wait_for_results()
|
function wait_for_results()
|
||||||
if get_state().params.type == 'bidder' then
|
if get_state().params.type == 'bidder' then
|
||||||
return when(function() return bids_loaded() end, accept_results)
|
return aux.when(function() return aux.bids_loaded() end, accept_results)
|
||||||
elseif get_state().params.type == 'owner' then
|
elseif get_state().params.type == 'owner' then
|
||||||
return wait_for_owner_results()
|
return wait_for_owner_results()
|
||||||
elseif get_state().params.type == 'list' then
|
elseif get_state().params.type == 'list' then
|
||||||
@@ -174,7 +172,7 @@ end
|
|||||||
function accept_results()
|
function accept_results()
|
||||||
_, get_state().total_auctions = GetNumAuctionItems(get_state().params.type)
|
_, get_state().total_auctions = GetNumAuctionItems(get_state().params.type)
|
||||||
do
|
do
|
||||||
(get_state().params.on_page_loaded or nop)(
|
(get_state().params.on_page_loaded or pass)(
|
||||||
get_state().page - (get_query().blizzard_query.first_page or 0) + 1,
|
get_state().page - (get_query().blizzard_query.first_page or 0) + 1,
|
||||||
last_page(get_state().total_auctions) - (get_query().blizzard_query.first_page or 0) + 1,
|
last_page(get_state().total_auctions) - (get_query().blizzard_query.first_page or 0) + 1,
|
||||||
total_pages(get_state().total_auctions) - 1
|
total_pages(get_state().total_auctions) - 1
|
||||||
@@ -184,24 +182,24 @@ function accept_results()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function wait_for_owner_results()
|
function wait_for_owner_results()
|
||||||
if get_state().page == current_owner_page() then
|
if get_state().page == aux.current_owner_page() then
|
||||||
return accept_results()
|
return accept_results()
|
||||||
else
|
else
|
||||||
local updated
|
local updated
|
||||||
on_next_event('AUCTION_OWNED_LIST_UPDATE', function() updated = true end)
|
aux.on_next_event('AUCTION_OWNED_LIST_UPDATE', function() updated = true end)
|
||||||
return when(function() return updated end, accept_results)
|
return aux.when(function() return updated end, accept_results)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function wait_for_list_results()
|
function wait_for_list_results()
|
||||||
local updated, last_update
|
local updated, last_update
|
||||||
local listener_id = event_listener('AUCTION_ITEM_LIST_UPDATE', function()
|
local listener_id = aux.event_listener('AUCTION_ITEM_LIST_UPDATE', function()
|
||||||
last_update = GetTime()
|
last_update = GetTime()
|
||||||
updated = true
|
updated = true
|
||||||
end)
|
end)
|
||||||
local timeout = later(5, get_state().last_list_query)
|
local timeout = aux.later(5, get_state().last_list_query)
|
||||||
local ignore_owner = get_state().params.ignore_owner or aux_ignore_owner
|
local ignore_owner = get_state().params.ignore_owner or aux_ignore_owner
|
||||||
return when(function()
|
return aux.when(function()
|
||||||
if not last_update and timeout() then
|
if not last_update and timeout() then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -214,7 +212,7 @@ function wait_for_list_results()
|
|||||||
end
|
end
|
||||||
updated = false
|
updated = false
|
||||||
end, function()
|
end, function()
|
||||||
kill_listener(listener_id)
|
aux.kill_listener(listener_id)
|
||||||
if not last_update and timeout() then
|
if not last_update and timeout() then
|
||||||
return submit_query()
|
return submit_query()
|
||||||
else
|
else
|
||||||
|
|||||||
+7
-9
@@ -1,20 +1,18 @@
|
|||||||
module 'aux.core.shortcut'
|
module 'aux.core.shortcut'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
|
|
||||||
do
|
do
|
||||||
local orig = SetItemRef
|
local orig = SetItemRef
|
||||||
_G.SetItemRef = T.vararg-function(arg)
|
_G.SetItemRef = T.vararg-function(arg)
|
||||||
if arg[3] ~= 'RightButton' or not index(get_active_tab(), 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then
|
if arg[3] ~= 'RightButton' or not aux.index(aux.get_tab(), 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then
|
||||||
return orig(unpack(arg))
|
return orig(unpack(arg))
|
||||||
end
|
end
|
||||||
local item_info = info.item(tonumber(select(3, strfind(arg[1], '^item:(%d+)'))))
|
local item_info = info.item(tonumber(aux.select(3, strfind(arg[1], '^item:(%d+)'))))
|
||||||
if item_info then
|
if item_info then
|
||||||
return get_active_tab().CLICK_LINK(item_info)
|
return aux.get_tab().CLICK_LINK(item_info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -22,12 +20,12 @@ end
|
|||||||
do
|
do
|
||||||
local orig = UseContainerItem
|
local orig = UseContainerItem
|
||||||
_G.UseContainerItem = T.vararg-function(arg)
|
_G.UseContainerItem = T.vararg-function(arg)
|
||||||
if modified() or not get_active_tab() then
|
if aux.modified() or not aux.get_tab() then
|
||||||
return orig(unpack(arg))
|
return orig(unpack(arg))
|
||||||
end
|
end
|
||||||
local item_info = info.container_item(arg[1], arg[2])
|
local item_info = info.container_item(arg[1], arg[2])
|
||||||
if item_info and get_active_tab().USE_ITEM then
|
if item_info and aux.get_tab().USE_ITEM then
|
||||||
get_active_tab().USE_ITEM(item_info)
|
aux.get_tab().USE_ITEM(item_info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+27
-29
@@ -1,71 +1,69 @@
|
|||||||
module 'aux.core.slash'
|
module 'aux.core.slash'
|
||||||
|
|
||||||
include 'aux'
|
local aux = require 'aux'
|
||||||
|
|
||||||
local info = require 'aux.util.info'
|
function aux.handle.LOAD2()
|
||||||
|
tooltip_settings = aux.character_data'tooltip'
|
||||||
function handle.LOAD2()
|
|
||||||
tooltip_settings = character_data'tooltip'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.aux_ignore_owner = true
|
_G.aux_ignore_owner = true
|
||||||
|
|
||||||
function status(enabled)
|
function status(enabled)
|
||||||
return (enabled and color.green'on' or color.red'off')
|
return (enabled and aux.color.green'on' or aux.color.red'off')
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.SLASH_AUX1 = '/aux'
|
_G.SLASH_AUX1 = '/aux'
|
||||||
function SlashCmdList.AUX(command)
|
function SlashCmdList.AUX(command)
|
||||||
if not command then return end
|
if not command then return end
|
||||||
local arguments = tokenize(command)
|
local arguments = aux.tokenize(command)
|
||||||
|
|
||||||
if arguments[1] == 'scale' and tonumber(arguments[2]) then
|
if arguments[1] == 'scale' and tonumber(arguments[2]) then
|
||||||
local scale = tonumber(arguments[2])
|
local scale = tonumber(arguments[2])
|
||||||
AuxFrame:SetScale(scale)
|
aux.frame:SetScale(scale)
|
||||||
_G.aux_scale = scale
|
_G.aux_scale = scale
|
||||||
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
|
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
|
||||||
_G.aux_ignore_owner = not aux_ignore_owner
|
_G.aux_ignore_owner = not aux_ignore_owner
|
||||||
print('ignore owner ' .. status(aux_ignore_owner))
|
aux.print('ignore owner ' .. status(aux_ignore_owner))
|
||||||
elseif arguments[1] == 'post' and arguments[2] == 'bid' then
|
elseif arguments[1] == 'post' and arguments[2] == 'bid' then
|
||||||
_G.aux_post_bid = not aux_post_bid
|
_G.aux_post_bid = not aux_post_bid
|
||||||
print('post bid ' .. status(aux_post_bid))
|
aux.print('post bid ' .. status(aux_post_bid))
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
|
||||||
tooltip_settings.value = not tooltip_settings.value
|
tooltip_settings.value = not tooltip_settings.value
|
||||||
print('tooltip value ' .. status(tooltip_settings.value))
|
aux.print('tooltip value ' .. status(tooltip_settings.value))
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
|
||||||
tooltip_settings.daily = not tooltip_settings.daily
|
tooltip_settings.daily = not tooltip_settings.daily
|
||||||
print('tooltip daily ' .. status(tooltip_settings.daily))
|
aux.print('tooltip daily ' .. status(tooltip_settings.daily))
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
|
||||||
tooltip_settings.merchant_buy = not tooltip_settings.merchant_buy
|
tooltip_settings.merchant_buy = not tooltip_settings.merchant_buy
|
||||||
print('tooltip merchant buy ' .. status(tooltip_settings.merchant_buy))
|
aux.print('tooltip merchant buy ' .. status(tooltip_settings.merchant_buy))
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
|
||||||
tooltip_settings.merchant_sell = not tooltip_settings.merchant_sell
|
tooltip_settings.merchant_sell = not tooltip_settings.merchant_sell
|
||||||
print('tooltip merchant sell ' .. status(tooltip_settings.merchant_sell))
|
aux.print('tooltip merchant sell ' .. status(tooltip_settings.merchant_sell))
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
|
||||||
tooltip_settings.disenchant_value = not tooltip_settings.disenchant_value
|
tooltip_settings.disenchant_value = not tooltip_settings.disenchant_value
|
||||||
print('tooltip disenchant value ' .. status(tooltip_settings.disenchant_value))
|
aux.print('tooltip disenchant value ' .. status(tooltip_settings.disenchant_value))
|
||||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
|
||||||
tooltip_settings.disenchant_distribution = not tooltip_settings.disenchant_distribution
|
tooltip_settings.disenchant_distribution = not tooltip_settings.disenchant_distribution
|
||||||
print('tooltip disenchant distribution ' .. status(tooltip_settings.disenchant_distribution))
|
aux.print('tooltip disenchant distribution ' .. status(tooltip_settings.disenchant_distribution))
|
||||||
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
|
||||||
_G.aux_items = {}
|
_G.aux_items = {}
|
||||||
_G.aux_item_ids = {}
|
_G.aux_item_ids = {}
|
||||||
_G.aux_auctionable_items = {}
|
_G.aux_auctionable_items = {}
|
||||||
print('Item cache cleared.')
|
aux.print('Item cache cleared.')
|
||||||
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
|
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
|
||||||
info.populate_wdb()
|
info.populate_wdb()
|
||||||
else
|
else
|
||||||
print('Usage:')
|
aux.print('Usage:')
|
||||||
print('- scale [' .. color.blue(aux_scale) .. ']')
|
aux.print('- scale [' .. aux.color.blue(aux_scale) .. ']')
|
||||||
print('- ignore owner [' .. status(aux_ignore_owner) .. ']')
|
aux.print('- ignore owner [' .. status(aux_ignore_owner) .. ']')
|
||||||
print('- post bid [' .. status(aux_post_bid) .. ']')
|
aux.print('- post bid [' .. status(aux_post_bid) .. ']')
|
||||||
print('- tooltip value [' .. status(tooltip_settings.value) .. ']')
|
aux.print('- tooltip value [' .. status(tooltip_settings.value) .. ']')
|
||||||
print('- tooltip daily [' .. status(tooltip_settings.daily) .. ']')
|
aux.print('- tooltip daily [' .. status(tooltip_settings.daily) .. ']')
|
||||||
print('- tooltip merchant buy [' .. status(tooltip_settings.merchant_buy) .. ']')
|
aux.print('- tooltip merchant buy [' .. status(tooltip_settings.merchant_buy) .. ']')
|
||||||
print('- tooltip merchant sell [' .. status(tooltip_settings.merchant_sell) .. ']')
|
aux.print('- tooltip merchant sell [' .. status(tooltip_settings.merchant_sell) .. ']')
|
||||||
print('- tooltip disenchant value [' .. status(tooltip_settings.disenchant_value) .. ']')
|
aux.print('- tooltip disenchant value [' .. status(tooltip_settings.disenchant_value) .. ']')
|
||||||
print('- tooltip disenchant distribution [' .. status(tooltip_settings.disenchant_distribution) .. ']')
|
aux.print('- tooltip disenchant distribution [' .. status(tooltip_settings.disenchant_distribution) .. ']')
|
||||||
print('- clear item cache')
|
aux.print('- clear item cache')
|
||||||
print('- populate wdb')
|
aux.print('- populate wdb')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+8
-10
@@ -1,14 +1,12 @@
|
|||||||
module 'aux.core.stack'
|
module 'aux.core.stack'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
|
|
||||||
local state
|
local state
|
||||||
|
|
||||||
function handle.CLOSE()
|
function aux.handle.CLOSE()
|
||||||
stop()
|
stop()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -34,7 +32,7 @@ end
|
|||||||
|
|
||||||
function find_item_slot(partial)
|
function find_item_slot(partial)
|
||||||
for slot in info.inventory() do
|
for slot in info.inventory() do
|
||||||
if matching_item(slot, partial) and not eq(slot, state.target_slot) then
|
if matching_item(slot, partial) and not aux.eq(slot, state.target_slot) then
|
||||||
return slot
|
return slot
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -63,7 +61,7 @@ end
|
|||||||
|
|
||||||
function move_item(from_slot, to_slot, amount, k)
|
function move_item(from_slot, to_slot, amount, k)
|
||||||
if locked(from_slot) or locked(to_slot) then
|
if locked(from_slot) or locked(to_slot) then
|
||||||
return wait(k)
|
return aux.wait(k)
|
||||||
end
|
end
|
||||||
|
|
||||||
amount = min(max_stack(from_slot) - stack_size(to_slot), stack_size(from_slot), amount)
|
amount = min(max_stack(from_slot) - stack_size(to_slot), stack_size(from_slot), amount)
|
||||||
@@ -73,7 +71,7 @@ function move_item(from_slot, to_slot, amount, k)
|
|||||||
SplitContainerItem(from_slot[1], from_slot[2], amount)
|
SplitContainerItem(from_slot[1], from_slot[2], amount)
|
||||||
PickupContainerItem(unpack(to_slot))
|
PickupContainerItem(unpack(to_slot))
|
||||||
|
|
||||||
return when(function() return stack_size(to_slot) == expected_size end, k)
|
return aux.when(function() return stack_size(to_slot) == expected_size end, k)
|
||||||
end
|
end
|
||||||
|
|
||||||
function process()
|
function process()
|
||||||
@@ -113,18 +111,18 @@ end
|
|||||||
|
|
||||||
function M.stop()
|
function M.stop()
|
||||||
if state then
|
if state then
|
||||||
kill_thread(state.thread_id)
|
aux.kill_thread(state.thread_id)
|
||||||
local callback, slot = state.callback, state.target_slot
|
local callback, slot = state.callback, state.target_slot
|
||||||
slot = slot and matching_item(slot) and slot or nil
|
slot = slot and matching_item(slot) and slot or nil
|
||||||
state = nil
|
state = nil
|
||||||
do (callback or nop)(slot) end
|
do (callback or pass)(slot) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.start(item_key, size, callback)
|
function M.start(item_key, size, callback)
|
||||||
stop()
|
stop()
|
||||||
state = {
|
state = {
|
||||||
thread_id = thread(process),
|
thread_id = aux.thread(process),
|
||||||
item_key = item_key,
|
item_key = item_key,
|
||||||
target_size = size,
|
target_size = size,
|
||||||
callback = callback,
|
callback = callback,
|
||||||
|
|||||||
+24
-26
@@ -1,9 +1,7 @@
|
|||||||
module 'aux.core.tooltip'
|
module 'aux.core.tooltip'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local money = require 'aux.util.money'
|
local money = require 'aux.util.money'
|
||||||
local disenchant = require 'aux.core.disenchant'
|
local disenchant = require 'aux.core.disenchant'
|
||||||
@@ -14,16 +12,16 @@ local UNKNOWN = GRAY_FONT_COLOR_CODE .. '?' .. FONT_COLOR_CODE_CLOSE
|
|||||||
|
|
||||||
local game_tooltip_hooks, game_tooltip_money = {}, 0
|
local game_tooltip_hooks, game_tooltip_money = {}, 0
|
||||||
|
|
||||||
function handle.LOAD()
|
function aux.handle.LOAD()
|
||||||
settings = character_data('tooltip', {value=true})
|
settings = aux.character_data('tooltip', {value=true})
|
||||||
do
|
do
|
||||||
local inside_hook = false
|
local inside_hook = false
|
||||||
for name, f in game_tooltip_hooks do
|
for name, f in game_tooltip_hooks do
|
||||||
local name, f = name, f
|
local name, f = name, f
|
||||||
hook(name, GameTooltip, T.vararg-function(arg)
|
aux.hook(name, GameTooltip, T.vararg-function(arg)
|
||||||
game_tooltip_money = 0
|
game_tooltip_money = 0
|
||||||
inside_hook = true
|
inside_hook = true
|
||||||
local tmp = T.list(orig[GameTooltip][name](unpack(arg)))
|
local tmp = T.list(aux.orig[GameTooltip][name](unpack(arg)))
|
||||||
inside_hook = false
|
inside_hook = false
|
||||||
f(unpack(arg))
|
f(unpack(arg))
|
||||||
return T.unpack(tmp)
|
return T.unpack(tmp)
|
||||||
@@ -43,7 +41,7 @@ function handle.LOAD()
|
|||||||
local name, _, quality = GetItemInfo(arg[1])
|
local name, _, quality = GetItemInfo(arg[1])
|
||||||
local tmp = T.list(orig(unpack(arg)))
|
local tmp = T.list(orig(unpack(arg)))
|
||||||
if not IsShiftKeyDown() and not IsControlKeyDown() and name then
|
if not IsShiftKeyDown() and not IsControlKeyDown() and name then
|
||||||
local color_code = select(4, GetItemQualityColor(quality))
|
local color_code = aux.select(4, GetItemQualityColor(quality))
|
||||||
local link = color_code .. '|H' .. arg[1] .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
local link = color_code .. '|H' .. arg[1] .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
||||||
extend_tooltip(ItemRefTooltip, link, 1)
|
extend_tooltip(ItemRefTooltip, link, 1)
|
||||||
end
|
end
|
||||||
@@ -59,28 +57,28 @@ function M.extend_tooltip(tooltip, link, quantity)
|
|||||||
local distribution = disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
|
local distribution = disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
|
||||||
if getn(distribution) > 0 then
|
if getn(distribution) > 0 then
|
||||||
if settings.disenchant_distribution then
|
if settings.disenchant_distribution then
|
||||||
tooltip:AddLine('Disenchants into:', color.tooltip.disenchant.distribution())
|
tooltip:AddLine('Disenchants into:', aux.color.tooltip.disenchant.distribution())
|
||||||
sort(distribution, function(a,b) return a.probability > b.probability end)
|
sort(distribution, function(a,b) return a.probability > b.probability end)
|
||||||
for _, event in ipairs(distribution) do
|
for _, event in ipairs(distribution) do
|
||||||
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, info.display_name(event.item_id, true) or 'item:' .. event.item_id, event.min_quantity, event.max_quantity), color.tooltip.disenchant.distribution())
|
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, info.display_name(event.item_id, true) or 'item:' .. event.item_id, event.min_quantity, event.max_quantity), aux.color.tooltip.disenchant.distribution())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if settings.disenchant_value then
|
if settings.disenchant_value then
|
||||||
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||||
tooltip:AddLine('Disenchant: ' .. (disenchant_value and money.to_string2(disenchant_value) or UNKNOWN), color.tooltip.disenchant.value())
|
tooltip:AddLine('Disenchant: ' .. (disenchant_value and money.to_string2(disenchant_value) or UNKNOWN), aux.color.tooltip.disenchant.value())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if settings.merchant_buy then
|
if settings.merchant_buy then
|
||||||
local _, price, limited = info.merchant_info(item_id)
|
local _, price, limited = info.merchant_info(item_id)
|
||||||
if price then
|
if price then
|
||||||
tooltip:AddLine('Vendor Buy ' .. (limited and '(limited): ' or ': ') .. money.to_string2(price * quantity), color.tooltip.merchant())
|
tooltip:AddLine('Vendor Buy ' .. (limited and '(limited): ' or ': ') .. money.to_string2(price * quantity), aux.color.tooltip.merchant())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if settings.merchant_sell then
|
if settings.merchant_sell then
|
||||||
local price = info.merchant_info(item_id)
|
local price = info.merchant_info(item_id)
|
||||||
if price ~= 0 then
|
if price ~= 0 then
|
||||||
tooltip:AddLine('Vendor: ' .. (price and money.to_string2(price * quantity) or UNKNOWN), color.tooltip.merchant())
|
tooltip:AddLine('Vendor: ' .. (price and money.to_string2(price * quantity) or UNKNOWN), aux.color.tooltip.merchant())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local auctionable = not item_info or info.auctionable(T.temp-info.tooltip('link', item_info.itemstring), item_info.quality)
|
local auctionable = not item_info or info.auctionable(T.temp-info.tooltip('link', item_info.itemstring), item_info.quality)
|
||||||
@@ -88,11 +86,11 @@ function M.extend_tooltip(tooltip, link, quantity)
|
|||||||
local value = history.value(item_key)
|
local value = history.value(item_key)
|
||||||
if auctionable then
|
if auctionable then
|
||||||
if settings.value then
|
if settings.value then
|
||||||
tooltip:AddLine('Value: ' .. (value and money.to_string2(value * quantity) or UNKNOWN), color.tooltip.value())
|
tooltip:AddLine('Value: ' .. (value and money.to_string2(value * quantity) or UNKNOWN), aux.color.tooltip.value())
|
||||||
end
|
end
|
||||||
if settings.daily then
|
if settings.daily then
|
||||||
local market_value = history.market_value(item_key)
|
local market_value = history.market_value(item_key)
|
||||||
tooltip:AddLine('Today: ' .. (market_value and money.to_string2(market_value * quantity) .. ' (' .. gui.percentage_historical(round(market_value / value * 100)) .. ')' or UNKNOWN), color.tooltip.value())
|
tooltip:AddLine('Today: ' .. (market_value and money.to_string2(market_value * quantity) .. ' (' .. gui.percentage_historical(aux.round(market_value / value * 100)) .. ')' or UNKNOWN), aux.color.tooltip.value())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -105,7 +103,7 @@ end
|
|||||||
function game_tooltip_hooks:SetHyperlink(itemstring)
|
function game_tooltip_hooks:SetHyperlink(itemstring)
|
||||||
local name, _, quality = GetItemInfo(itemstring)
|
local name, _, quality = GetItemInfo(itemstring)
|
||||||
if name then
|
if name then
|
||||||
local hex = select(4, GetItemQualityColor(quality))
|
local hex = aux.select(4, GetItemQualityColor(quality))
|
||||||
local link = hex .. '|H' .. itemstring .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
local link = hex .. '|H' .. itemstring .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
||||||
extend_tooltip(GameTooltip, link, 1)
|
extend_tooltip(GameTooltip, link, 1)
|
||||||
end
|
end
|
||||||
@@ -114,35 +112,35 @@ end
|
|||||||
function game_tooltip_hooks:SetAuctionItem(type, index)
|
function game_tooltip_hooks:SetAuctionItem(type, index)
|
||||||
local link = GetAuctionItemLink(type, index)
|
local link = GetAuctionItemLink(type, index)
|
||||||
if link then
|
if link then
|
||||||
extend_tooltip(GameTooltip, link, select(3, GetAuctionItemInfo(type, index)))
|
extend_tooltip(GameTooltip, link, aux.select(3, GetAuctionItemInfo(type, index)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function game_tooltip_hooks:SetLootItem(slot)
|
function game_tooltip_hooks:SetLootItem(slot)
|
||||||
local link = GetLootSlotLink(slot)
|
local link = GetLootSlotLink(slot)
|
||||||
if link then
|
if link then
|
||||||
extend_tooltip(GameTooltip, link, select(3, GetLootSlotInfo(slot)))
|
extend_tooltip(GameTooltip, link, aux.select(3, GetLootSlotInfo(slot)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function game_tooltip_hooks:SetQuestItem(qtype, slot)
|
function game_tooltip_hooks:SetQuestItem(qtype, slot)
|
||||||
local link = GetQuestItemLink(qtype, slot)
|
local link = GetQuestItemLink(qtype, slot)
|
||||||
if link then
|
if link then
|
||||||
extend_tooltip(GameTooltip, link, select(3, GetQuestItemInfo(qtype, slot)))
|
extend_tooltip(GameTooltip, link, aux.select(3, GetQuestItemInfo(qtype, slot)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function game_tooltip_hooks:SetQuestLogItem(qtype, slot)
|
function game_tooltip_hooks:SetQuestLogItem(qtype, slot)
|
||||||
local link = GetQuestLogItemLink(qtype, slot)
|
local link = GetQuestLogItemLink(qtype, slot)
|
||||||
if link then
|
if link then
|
||||||
extend_tooltip(GameTooltip, link, select(3, GetQuestLogRewardInfo(slot)))
|
extend_tooltip(GameTooltip, link, aux.select(3, GetQuestLogRewardInfo(slot)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function game_tooltip_hooks:SetBagItem(bag, slot)
|
function game_tooltip_hooks:SetBagItem(bag, slot)
|
||||||
local link = GetContainerItemLink(bag, slot)
|
local link = GetContainerItemLink(bag, slot)
|
||||||
if link then
|
if link then
|
||||||
extend_tooltip(GameTooltip, link, select(2, GetContainerItemInfo(bag, slot)))
|
extend_tooltip(GameTooltip, link, aux.select(2, GetContainerItemInfo(bag, slot)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -151,7 +149,7 @@ function game_tooltip_hooks:SetInboxItem(index)
|
|||||||
local id = name and info.item_id(name)
|
local id = name and info.item_id(name)
|
||||||
if id then
|
if id then
|
||||||
local _, itemstring, quality = GetItemInfo(id)
|
local _, itemstring, quality = GetItemInfo(id)
|
||||||
local hex = select(4, GetItemQualityColor(tonumber(quality)))
|
local hex = aux.select(4, GetItemQualityColor(tonumber(quality)))
|
||||||
local link = hex .. '|H' .. itemstring .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
local link = hex .. '|H' .. itemstring .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
||||||
extend_tooltip(GameTooltip, link, quantity)
|
extend_tooltip(GameTooltip, link, quantity)
|
||||||
end
|
end
|
||||||
@@ -167,7 +165,7 @@ end
|
|||||||
function game_tooltip_hooks:SetMerchantItem(slot)
|
function game_tooltip_hooks:SetMerchantItem(slot)
|
||||||
local link = GetMerchantItemLink(slot)
|
local link = GetMerchantItemLink(slot)
|
||||||
if link then
|
if link then
|
||||||
local quantity = select(4, GetMerchantItemInfo(slot))
|
local quantity = aux.select(4, GetMerchantItemInfo(slot))
|
||||||
extend_tooltip(GameTooltip, link, quantity)
|
extend_tooltip(GameTooltip, link, quantity)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -175,7 +173,7 @@ end
|
|||||||
function game_tooltip_hooks:SetCraftItem(skill, slot)
|
function game_tooltip_hooks:SetCraftItem(skill, slot)
|
||||||
local link, quantity
|
local link, quantity
|
||||||
if slot then
|
if slot then
|
||||||
link, quantity = GetCraftReagentItemLink(skill, slot), select(3, GetCraftReagentInfo(skill, slot))
|
link, quantity = GetCraftReagentItemLink(skill, slot), aux.select(3, GetCraftReagentInfo(skill, slot))
|
||||||
else
|
else
|
||||||
link, quantity = GetCraftItemLink(skill), 1
|
link, quantity = GetCraftItemLink(skill), 1
|
||||||
end
|
end
|
||||||
@@ -194,7 +192,7 @@ end
|
|||||||
function game_tooltip_hooks:SetTradeSkillItem(skill, slot)
|
function game_tooltip_hooks:SetTradeSkillItem(skill, slot)
|
||||||
local link, quantity
|
local link, quantity
|
||||||
if slot then
|
if slot then
|
||||||
link, quantity = GetTradeSkillReagentItemLink(skill, slot), select(3, GetTradeSkillReagentInfo(skill, slot))
|
link, quantity = GetTradeSkillReagentItemLink(skill, slot), aux.select(3, GetTradeSkillReagentInfo(skill, slot))
|
||||||
else
|
else
|
||||||
link, quantity = GetTradeSkillItemLink(skill), 1
|
link, quantity = GetTradeSkillItemLink(skill), 1
|
||||||
end
|
end
|
||||||
@@ -209,7 +207,7 @@ function game_tooltip_hooks:SetAuctionSellItem()
|
|||||||
for slot in info.inventory() do
|
for slot in info.inventory() do
|
||||||
T.temp(slot)
|
T.temp(slot)
|
||||||
local link = GetContainerItemLink(unpack(slot))
|
local link = GetContainerItemLink(unpack(slot))
|
||||||
if link and select(5, info.parse_link(link)) == name then
|
if link and aux.select(5, info.parse_link(link)) == name then
|
||||||
extend_tooltip(GameTooltip, link, quantity)
|
extend_tooltip(GameTooltip, link, quantity)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ function handle.LOAD()
|
|||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local frame = CreateFrame('Frame', 'AuxFrame', UIParent)
|
local frame = CreateFrame('Frame', 'aux_frame', UIParent)
|
||||||
tinsert(UISpecialFrames, 'AuxFrame')
|
tinsert(UISpecialFrames, 'aux_frame')
|
||||||
gui.set_window_style(frame)
|
gui.set_window_style(frame)
|
||||||
gui.set_size(frame, 768, 447)
|
gui.set_size(frame, 768, 447)
|
||||||
frame:SetPoint('LEFT', 100, 0)
|
frame:SetPoint('LEFT', 100, 0)
|
||||||
@@ -25,23 +25,23 @@ do
|
|||||||
frame.content:SetPoint('TOPLEFT', 4, -80)
|
frame.content:SetPoint('TOPLEFT', 4, -80)
|
||||||
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
|
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
M.AuxFrame = frame
|
M.frame = frame
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
tabs = gui.tabs(AuxFrame, 'DOWN')
|
tabs = gui.tabs(frame, 'DOWN')
|
||||||
tabs._on_select = on_tab_click
|
tabs._on_select = on_tab_click
|
||||||
function M.set_tab(id) tabs:select(id) end
|
function M.set_tab(id) tabs:select(id) end
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(AuxFrame)
|
local btn = gui.button(frame)
|
||||||
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', function() AuxFrame:Hide() end)
|
btn:SetScript('OnClick', function() frame:Hide() end)
|
||||||
close_button = btn
|
close_button = btn
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(AuxFrame, gui.font_size.small)
|
local btn = gui.button(frame, gui.font_size.small)
|
||||||
btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0)
|
btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0)
|
||||||
gui.set_size(btn, 60, 24)
|
gui.set_size(btn, 60, 24)
|
||||||
btn:SetText(color.blizzard'Blizzard UI')
|
btn:SetText(color.blizzard'Blizzard UI')
|
||||||
|
|||||||
+34
-36
@@ -1,9 +1,7 @@
|
|||||||
module 'aux.gui.auction_listing'
|
module 'aux.gui.auction_listing'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local sort_util = require 'aux.util.sort'
|
local sort_util = require 'aux.util.sort'
|
||||||
local money = require 'aux.util.money'
|
local money = require 'aux.util.money'
|
||||||
@@ -17,10 +15,10 @@ local HEAD_HEIGHT = 27
|
|||||||
local HEAD_SPACE = 2
|
local HEAD_SPACE = 2
|
||||||
|
|
||||||
local TIME_LEFT_STRINGS = {
|
local TIME_LEFT_STRINGS = {
|
||||||
color.red'30m', -- Short
|
aux.color.red'30m', -- Short
|
||||||
color.orange'2h', -- Medium
|
aux.color.orange'2h', -- Medium
|
||||||
color.yellow'8h', -- Long
|
aux.color.yellow'8h', -- Long
|
||||||
color.blue'24h', -- Very Long
|
aux.color.blue'24h', -- Very Long
|
||||||
}
|
}
|
||||||
|
|
||||||
function item_column_init(rt, cell)
|
function item_column_init(rt, cell)
|
||||||
@@ -81,7 +79,7 @@ M.search_columns = {
|
|||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local display_level = max(record.level, 1)
|
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 aux.color.red(display_level) or display_level
|
||||||
cell.text:SetText(display_level)
|
cell.text:SetText(display_level)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
@@ -93,9 +91,9 @@ M.search_columns = {
|
|||||||
width = .06,
|
width = .06,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record, count, own, expandable)
|
fill = function(cell, record, count, own, expandable)
|
||||||
local numAuctionsText = expandable and color.link(count) or count
|
local numAuctionsText = expandable and aux.color.link(count) or count
|
||||||
if own > 0 then
|
if own > 0 then
|
||||||
numAuctionsText = numAuctionsText .. (' ' .. color.yellow('(' .. own .. ')'))
|
numAuctionsText = numAuctionsText .. (' ' .. aux.color.yellow('(' .. own .. ')'))
|
||||||
end
|
end
|
||||||
cell.text:SetText(numAuctionsText)
|
cell.text:SetText(numAuctionsText)
|
||||||
end,
|
end,
|
||||||
@@ -139,7 +137,7 @@ M.search_columns = {
|
|||||||
width = .13,
|
width = .13,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell.text:SetText(info.is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '?'))
|
cell.text:SetText(info.is_player(record.owner) and (aux.color.yellow(record.owner)) or (record.owner or '?'))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
if not record_a.owner and not record_b.owner then
|
if not record_a.owner and not record_b.owner then
|
||||||
@@ -161,9 +159,9 @@ M.search_columns = {
|
|||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price_color
|
local price_color
|
||||||
if record.high_bidder then
|
if record.high_bidder then
|
||||||
price_color = color.green
|
price_color = aux.color.green
|
||||||
elseif record.high_bid ~= 0 then
|
elseif record.high_bid ~= 0 then
|
||||||
price_color = color.orange
|
price_color = aux.color.orange
|
||||||
end
|
end
|
||||||
local price
|
local price
|
||||||
if record.high_bidder then
|
if record.high_bidder then
|
||||||
@@ -213,8 +211,8 @@ M.search_columns = {
|
|||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
|
||||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
|
||||||
|
|
||||||
return sort_util.compare(price_a, price_b, desc)
|
return sort_util.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -228,8 +226,8 @@ M.search_columns = {
|
|||||||
cell.text:SetText((pct or bidPct) and gui.percentage_historical(pct or bidPct, not pct) or '?')
|
cell.text:SetText((pct or bidPct) and gui.percentage_historical(pct or bidPct, not pct) or '?')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local pct_a = record_percentage(record_a) or (desc and -huge or huge)
|
local pct_a = record_percentage(record_a) or (desc and -aux.huge or aux.huge)
|
||||||
local pct_b = record_percentage(record_b) or (desc and -huge or huge)
|
local pct_b = record_percentage(record_b) or (desc and -aux.huge or aux.huge)
|
||||||
return sort_util.compare(pct_a, pct_b, desc)
|
return sort_util.compare(pct_a, pct_b, desc)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@@ -251,7 +249,7 @@ M.auctions_columns = {
|
|||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local display_level = max(record.level, 1)
|
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 aux.color.red(display_level) or display_level
|
||||||
cell.text:SetText(display_level)
|
cell.text:SetText(display_level)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
@@ -263,7 +261,7 @@ M.auctions_columns = {
|
|||||||
width = .06,
|
width = .06,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record, count, own, expandable)
|
fill = function(cell, record, count, own, expandable)
|
||||||
local numAuctionsText = expandable and color.link(count) or count
|
local numAuctionsText = expandable and aux.color.link(count) or count
|
||||||
cell.text:SetText(numAuctionsText)
|
cell.text:SetText(numAuctionsText)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
@@ -343,8 +341,8 @@ M.auctions_columns = {
|
|||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
|
||||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
|
||||||
|
|
||||||
return sort_util.compare(price_a, price_b, desc)
|
return sort_util.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -354,7 +352,7 @@ M.auctions_columns = {
|
|||||||
width = .21,
|
width = .21,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell.text:SetText(record.high_bidder or color.red 'No Bids')
|
cell.text:SetText(record.high_bidder or aux.color.red 'No Bids')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
if not record_a.high_bidder and not record_b.high_bidder then
|
if not record_a.high_bidder and not record_b.high_bidder then
|
||||||
@@ -385,7 +383,7 @@ M.bids_columns = {
|
|||||||
width = .06,
|
width = .06,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record, count, own, expandable)
|
fill = function(cell, record, count, own, expandable)
|
||||||
local numAuctionsText = expandable and color.link(count) or count
|
local numAuctionsText = expandable and aux.color.link(count) or count
|
||||||
cell.text:SetText(numAuctionsText)
|
cell.text:SetText(numAuctionsText)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
@@ -428,7 +426,7 @@ M.bids_columns = {
|
|||||||
width = .13,
|
width = .13,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell.text:SetText(info.is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '?'))
|
cell.text:SetText(info.is_player(record.owner) and (aux.color.yellow(record.owner)) or (record.owner or '?'))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
if not record_a.owner and not record_b.owner then
|
if not record_a.owner and not record_b.owner then
|
||||||
@@ -484,8 +482,8 @@ M.bids_columns = {
|
|||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
|
||||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
|
||||||
|
|
||||||
return sort_util.compare(price_a, price_b, desc)
|
return sort_util.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -497,9 +495,9 @@ M.bids_columns = {
|
|||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local status
|
local status
|
||||||
if record.high_bidder then
|
if record.high_bidder then
|
||||||
status = color.yellow'High Bidder'
|
status = aux.color.yellow'High Bidder'
|
||||||
else
|
else
|
||||||
status = color.red'Outbid'
|
status = aux.color.red'Outbid'
|
||||||
end
|
end
|
||||||
cell.text:SetText(status)
|
cell.text:SetText(status)
|
||||||
end,
|
end,
|
||||||
@@ -515,9 +513,9 @@ function record_percentage(record)
|
|||||||
local historical_value = history.value(record.item_key) or 0
|
local historical_value = history.value(record.item_key) or 0
|
||||||
if historical_value > 0 then
|
if historical_value > 0 then
|
||||||
if record.unit_buyout_price > 0 then
|
if record.unit_buyout_price > 0 then
|
||||||
return round(100 * record.unit_buyout_price / historical_value)
|
return aux.round(100 * record.unit_buyout_price / historical_value)
|
||||||
end
|
end
|
||||||
return nil, round(100 * record.unit_bid_price / historical_value)
|
return nil, aux.round(100 * record.unit_bid_price / historical_value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -612,7 +610,7 @@ local methods = {
|
|||||||
if not selection or selection.record ~= this.record then
|
if not selection or selection.record ~= this.record then
|
||||||
this.rt:SetSelectedRecord(this.record)
|
this.rt:SetSelectedRecord(this.record)
|
||||||
end
|
end
|
||||||
do (this.rt.handlers.OnClick or nop)(this, button) end
|
do (this.rt.handlers.OnClick or pass)(this, button) end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@@ -645,7 +643,7 @@ local methods = {
|
|||||||
|
|
||||||
local records = self.records
|
local records = self.records
|
||||||
|
|
||||||
local single_item = all(records, function(record) return record.item_key == records[1].item_key end)
|
local single_item = aux.all(records, function(record) return record.item_key == records[1].item_key end)
|
||||||
|
|
||||||
sort(records, function(a, b) return a.search_signature < b.search_signature or a.search_signature == b.search_signature and tostring(a) < tostring(b) end)
|
sort(records, function(a, b) return a.search_signature < b.search_signature or a.search_signature == b.search_signature and tostring(a) < tostring(b) end)
|
||||||
|
|
||||||
@@ -840,7 +838,7 @@ local methods = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
RemoveAuctionRecord = function(self, record)
|
RemoveAuctionRecord = function(self, record)
|
||||||
local index = key(self.records, record)
|
local index = aux.key(self.records, record)
|
||||||
if index then
|
if index then
|
||||||
tremove(self.records, index)
|
tremove(self.records, index)
|
||||||
end
|
end
|
||||||
@@ -848,7 +846,7 @@ local methods = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
ContainsRecord = function(self, record)
|
ContainsRecord = function(self, record)
|
||||||
if key(self.records, record) then
|
if aux.key(self.records, record) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -930,7 +928,7 @@ function M.new(parent, rows, columns)
|
|||||||
scrollBar:SetWidth(10)
|
scrollBar:SetWidth(10)
|
||||||
local thumbTex = scrollBar:GetThumbTexture()
|
local thumbTex = scrollBar:GetThumbTexture()
|
||||||
thumbTex:SetPoint('CENTER', 0, 0)
|
thumbTex:SetPoint('CENTER', 0, 0)
|
||||||
thumbTex:SetTexture(color.content.background())
|
thumbTex:SetTexture(aux.color.content.background())
|
||||||
thumbTex:SetHeight(150)
|
thumbTex:SetHeight(150)
|
||||||
thumbTex:SetWidth(scrollBar:GetWidth())
|
thumbTex:SetWidth(scrollBar:GetWidth())
|
||||||
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
||||||
@@ -955,7 +953,7 @@ function M.new(parent, rows, columns)
|
|||||||
local text = cell:CreateFontString()
|
local text = cell:CreateFontString()
|
||||||
text:SetJustifyH('CENTER')
|
text:SetJustifyH('CENTER')
|
||||||
text:SetFont(gui.font, 12)
|
text:SetFont(gui.font, 12)
|
||||||
text:SetTextColor(color.label.enabled())
|
text:SetTextColor(aux.color.label.enabled())
|
||||||
cell:SetFontString(text)
|
cell:SetFontString(text)
|
||||||
if not column.isPrice then cell:SetText(column.title or '') end -- TODO
|
if not column.isPrice then cell:SetText(column.title or '') end -- TODO
|
||||||
text:SetAllPoints()
|
text:SetAllPoints()
|
||||||
|
|||||||
+46
-47
@@ -1,18 +1,17 @@
|
|||||||
module 'aux.gui'
|
module 'aux.gui'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
|
|
||||||
M.font = [[Fonts\ARIALN.TTF]]
|
M.font = [[Fonts\ARIALN.TTF]]
|
||||||
|
|
||||||
M.font_size = immutable-{
|
M.font_size = aux.immutable-{
|
||||||
small = 13,
|
small = 13,
|
||||||
medium = 15,
|
medium = 15,
|
||||||
large = 18,
|
large = 18,
|
||||||
}
|
}
|
||||||
|
|
||||||
--function handle.LOAD()
|
--function aux.handle.LOAD()
|
||||||
-- do
|
-- do
|
||||||
-- local blizzard_backdrop, aux_background, aux_border
|
-- local blizzard_backdrop, aux_background, aux_border
|
||||||
--
|
--
|
||||||
@@ -22,14 +21,14 @@ M.font_size = immutable-{
|
|||||||
-- aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5)
|
-- aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5)
|
||||||
-- aux_border:SetBlendMode('ADD')
|
-- aux_border:SetBlendMode('ADD')
|
||||||
-- aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY')
|
-- aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY')
|
||||||
-- aux_background:SetTexture(color.content.background())
|
-- aux_background:SetTexture(aux.color.content.background())
|
||||||
-- aux_background:SetAllPoints(DropDownList1Backdrop)
|
-- aux_background:SetAllPoints(DropDownList1Backdrop)
|
||||||
-- blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
|
-- blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
|
||||||
-- hook('ToggleDropDownMenu', function(...)
|
-- aux.hook('ToggleDropDownMenu', function(...)
|
||||||
-- T.temp(arg)
|
-- T.temp(arg)
|
||||||
-- local ret = T.temp-T.list(orig.ToggleDropDownMenu(unpack(arg)))
|
-- local ret = T.temp-T.list(aux.orig.ToggleDropDownMenu(unpack(arg)))
|
||||||
-- local dropdown = _G[arg[4] or ''] or this:GetParent()
|
-- local dropdown = _G[arg[4] or ''] or this:GetParent()
|
||||||
-- if strfind(dropdown:GetName() or '', '^AuxFrame%d+$') then
|
-- if strfind(dropdown:GetName() or '', '^aux.frame%d+$') then
|
||||||
-- set_aux_dropdown_style(dropdown)
|
-- set_aux_dropdown_style(dropdown)
|
||||||
-- else
|
-- else
|
||||||
-- set_blizzard_dropdown_style()
|
-- set_blizzard_dropdown_style()
|
||||||
@@ -91,7 +90,7 @@ do
|
|||||||
local id = 1
|
local id = 1
|
||||||
function M.unique_name()
|
function M.unique_name()
|
||||||
id = id + 1
|
id = id + 1
|
||||||
return 'AuxFrame' .. id
|
return 'aux.frame' .. id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -120,15 +119,15 @@ function M.set_frame_style(frame, backdrop_color, border_color, left, right, top
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.set_window_style(frame, left, right, top, bottom)
|
function M.set_window_style(frame, left, right, top, bottom)
|
||||||
set_frame_style(frame, color.window.background, color.window.border, left, right, top, bottom)
|
set_frame_style(frame, aux.color.window.background, aux.color.window.border, left, right, top, bottom)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.set_panel_style(frame, left, right, top, bottom)
|
function M.set_panel_style(frame, left, right, top, bottom)
|
||||||
set_frame_style(frame, color.panel.background, color.panel.border, left, right, top, bottom)
|
set_frame_style(frame, aux.color.panel.background, aux.color.panel.border, left, right, top, bottom)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.set_content_style(frame, left, right, top, bottom)
|
function M.set_content_style(frame, left, right, top, bottom)
|
||||||
set_frame_style(frame, color.content.background, color.content.border, left, right, top, bottom)
|
set_frame_style(frame, aux.color.content.background, aux.color.content.border, left, right, top, bottom)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.panel(parent)
|
function M.panel(parent)
|
||||||
@@ -140,13 +139,13 @@ end
|
|||||||
function M.checkbutton(parent, text_height)
|
function M.checkbutton(parent, text_height)
|
||||||
local button = button(parent, text_height)
|
local button = button(parent, text_height)
|
||||||
button.state = false
|
button.state = false
|
||||||
button:SetBackdropColor(color.state.disabled())
|
button:SetBackdropColor(aux.color.state.disabled())
|
||||||
function button:SetChecked(state)
|
function button:SetChecked(state)
|
||||||
if state then
|
if state then
|
||||||
self:SetBackdropColor(color.state.enabled())
|
self:SetBackdropColor(aux.color.state.enabled())
|
||||||
self.state = true
|
self.state = true
|
||||||
else
|
else
|
||||||
self:SetBackdropColor(color.state.disabled())
|
self:SetBackdropColor(aux.color.state.disabled())
|
||||||
self.state = false
|
self.state = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -171,19 +170,19 @@ function M.button(parent, text_height)
|
|||||||
label:SetAllPoints(button)
|
label:SetAllPoints(button)
|
||||||
label:SetJustifyH('CENTER')
|
label:SetJustifyH('CENTER')
|
||||||
label:SetJustifyV('CENTER')
|
label:SetJustifyV('CENTER')
|
||||||
label:SetTextColor(color.text.enabled())
|
label:SetTextColor(aux.color.text.enabled())
|
||||||
button:SetFontString(label)
|
button:SetFontString(label)
|
||||||
end
|
end
|
||||||
button.default_Enable = button.Enable
|
button.default_Enable = button.Enable
|
||||||
function button:Enable()
|
function button:Enable()
|
||||||
if self:IsEnabled() == 1 then return end
|
if self:IsEnabled() == 1 then return end
|
||||||
self:GetFontString():SetTextColor(color.text.enabled())
|
self:GetFontString():SetTextColor(aux.color.text.enabled())
|
||||||
return self:default_Enable()
|
return self:default_Enable()
|
||||||
end
|
end
|
||||||
button.default_Disable = button.Disable
|
button.default_Disable = button.Disable
|
||||||
function button:Disable()
|
function button:Disable()
|
||||||
if self:IsEnabled() == 0 then return end
|
if self:IsEnabled() == 0 then return end
|
||||||
self:GetFontString():SetTextColor(color.text.disabled())
|
self:GetFontString():SetTextColor(aux.color.text.disabled())
|
||||||
return self:default_Disable()
|
return self:default_Disable()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -209,7 +208,7 @@ do
|
|||||||
dock:SetPoint('TOPLEFT', 1, 1)
|
dock:SetPoint('TOPLEFT', 1, 1)
|
||||||
dock:SetPoint('TOPRIGHT', -1, 1)
|
dock:SetPoint('TOPRIGHT', -1, 1)
|
||||||
end
|
end
|
||||||
dock:SetTexture(color.panel.background())
|
dock:SetTexture(aux.color.panel.background())
|
||||||
tab.dock = dock
|
tab.dock = dock
|
||||||
local highlight = tab:CreateTexture(nil, 'HIGHLIGHT')
|
local highlight = tab:CreateTexture(nil, 'HIGHLIGHT')
|
||||||
highlight:SetAllPoints()
|
highlight:SetAllPoints()
|
||||||
@@ -253,20 +252,20 @@ do
|
|||||||
function mt.__index:select(id)
|
function mt.__index:select(id)
|
||||||
self._selected = id
|
self._selected = id
|
||||||
self:update()
|
self:update()
|
||||||
do (self._on_select or nop)(id) end
|
do (self._on_select or pass)(id) end
|
||||||
end
|
end
|
||||||
function mt.__index:update()
|
function mt.__index:update()
|
||||||
for _, tab in self._tabs do
|
for _, tab in self._tabs do
|
||||||
if tab.group._selected == tab.id then
|
if tab.group._selected == tab.id then
|
||||||
tab.text:SetTextColor(color.label.enabled())
|
tab.text:SetTextColor(aux.color.label.enabled())
|
||||||
tab:Disable()
|
tab:Disable()
|
||||||
tab:SetBackdropColor(color.panel.background())
|
tab:SetBackdropColor(aux.color.panel.background())
|
||||||
tab.dock:Show()
|
tab.dock:Show()
|
||||||
tab:SetHeight(29)
|
tab:SetHeight(29)
|
||||||
else
|
else
|
||||||
tab.text:SetTextColor(color.text.enabled())
|
tab.text:SetTextColor(aux.color.text.enabled())
|
||||||
tab:Enable()
|
tab:Enable()
|
||||||
tab:SetBackdropColor(color.content.background())
|
tab:SetBackdropColor(aux.color.content.background())
|
||||||
tab.dock:Hide()
|
tab.dock:Hide()
|
||||||
tab:SetHeight(24)
|
tab:SetHeight(24)
|
||||||
end
|
end
|
||||||
@@ -292,9 +291,9 @@ function M.editbox(parent)
|
|||||||
set_content_style(editbox)
|
set_content_style(editbox)
|
||||||
editbox:SetScript('OnEscapePressed', function()
|
editbox:SetScript('OnEscapePressed', function()
|
||||||
this:ClearFocus()
|
this:ClearFocus()
|
||||||
do (this.escape or nop)() end
|
do (this.escape or pass)() end
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnEnterPressed', function() (this.enter or nop)() end)
|
editbox:SetScript('OnEnterPressed', function() (this.enter or pass)() end)
|
||||||
editbox:SetScript('OnEditFocusGained', function()
|
editbox:SetScript('OnEditFocusGained', function()
|
||||||
if this.block_focus then
|
if this.block_focus then
|
||||||
this.block_focus = false
|
this.block_focus = false
|
||||||
@@ -302,10 +301,10 @@ function M.editbox(parent)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
this.overlay:Hide()
|
this.overlay:Hide()
|
||||||
this:SetTextColor(color.text.enabled())
|
this:SetTextColor(aux.color.text.enabled())
|
||||||
this.focused = true
|
this.focused = true
|
||||||
this:HighlightText()
|
this:HighlightText()
|
||||||
do (this.focus_gain or nop)() end
|
do (this.focus_gain or pass)() end
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnEditFocusLost', function()
|
editbox:SetScript('OnEditFocusLost', function()
|
||||||
this.overlay:Show()
|
this.overlay:Show()
|
||||||
@@ -313,13 +312,13 @@ function M.editbox(parent)
|
|||||||
this.focused = false
|
this.focused = false
|
||||||
this:HighlightText(0, 0)
|
this:HighlightText(0, 0)
|
||||||
this:SetScript('OnUpdate', nil)
|
this:SetScript('OnUpdate', nil)
|
||||||
do (this.focus_loss or nop)() end
|
do (this.focus_loss or pass)() end
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnTextChanged', function()
|
editbox:SetScript('OnTextChanged', function()
|
||||||
this.overlay:SetText(this.formatter and this.formatter(this:GetText()) or this:GetText())
|
this.overlay:SetText(this.formatter and this.formatter(this:GetText()) or this:GetText())
|
||||||
do (this.change or nop)() end
|
do (this.change or pass)() end
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnChar', function() (this.char or nop)() end)
|
editbox:SetScript('OnChar', function() (this.char or pass)() end)
|
||||||
do
|
do
|
||||||
local last_click = T.map('t', 0)
|
local last_click = T.map('t', 0)
|
||||||
editbox:SetScript('OnMouseDown', function()
|
editbox:SetScript('OnMouseDown', function()
|
||||||
@@ -332,7 +331,7 @@ function M.editbox(parent)
|
|||||||
-- local offset = x - editbox:GetLeft()*editbox:GetEffectiveScale() TODO use a fontstring to measure getstringwidth for structural highlighting
|
-- local offset = x - editbox:GetLeft()*editbox:GetEffectiveScale() TODO use a fontstring to measure getstringwidth for structural highlighting
|
||||||
-- or use an overlay with itemlinks
|
-- or use an overlay with itemlinks
|
||||||
if GetTime() - last_click.t < .5 and x == last_click.x and y == last_click.y then
|
if GetTime() - last_click.t < .5 and x == last_click.x and y == last_click.y then
|
||||||
thread(function() editbox:HighlightText() end)
|
aux.thread(function() editbox:HighlightText() end)
|
||||||
end
|
end
|
||||||
T.wipe(last_click)
|
T.wipe(last_click)
|
||||||
last_click.t = GetTime()
|
last_click.t = GetTime()
|
||||||
@@ -352,7 +351,7 @@ function M.editbox(parent)
|
|||||||
local overlay = label(editbox)
|
local overlay = label(editbox)
|
||||||
overlay:SetPoint('LEFT', 1.5, 0)
|
overlay:SetPoint('LEFT', 1.5, 0)
|
||||||
overlay:SetPoint('RIGHT', -1.5, 0)
|
overlay:SetPoint('RIGHT', -1.5, 0)
|
||||||
overlay:SetTextColor(color.text.enabled())
|
overlay:SetTextColor(aux.color.text.enabled())
|
||||||
editbox.overlay = overlay
|
editbox.overlay = overlay
|
||||||
editbox:SetAlignment('LEFT')
|
editbox:SetAlignment('LEFT')
|
||||||
editbox:SetFontSize(font_size.medium)
|
editbox:SetFontSize(font_size.medium)
|
||||||
@@ -398,7 +397,7 @@ do
|
|||||||
text_frame:SetFrameLevel(level + 4)
|
text_frame:SetFrameLevel(level + 4)
|
||||||
text_frame:SetAllPoints(self)
|
text_frame:SetAllPoints(self)
|
||||||
local text = label(text_frame, font_size.medium)
|
local text = label(text_frame, font_size.medium)
|
||||||
text:SetTextColor(color.text.enabled())
|
text:SetTextColor(aux.color.text.enabled())
|
||||||
text:SetPoint('CENTER', 0, 0)
|
text:SetPoint('CENTER', 0, 0)
|
||||||
self.text = text
|
self.text = text
|
||||||
end
|
end
|
||||||
@@ -439,7 +438,7 @@ end
|
|||||||
function M.label(parent, size)
|
function M.label(parent, size)
|
||||||
local label = parent:CreateFontString()
|
local label = parent:CreateFontString()
|
||||||
label:SetFont(font, size or font_size.small)
|
label:SetFont(font, size or font_size.small)
|
||||||
label:SetTextColor(color.label.enabled())
|
label:SetTextColor(aux.color.label.enabled())
|
||||||
return label
|
return label
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -449,9 +448,9 @@ function M.horizontal_line(parent, y_offset, inverted_color)
|
|||||||
texture:SetPoint('TOPRIGHT', parent, 'TOPRIGHT', -2, y_offset)
|
texture:SetPoint('TOPRIGHT', parent, 'TOPRIGHT', -2, y_offset)
|
||||||
texture:SetHeight(2)
|
texture:SetHeight(2)
|
||||||
if inverted_color then
|
if inverted_color then
|
||||||
texture:SetTexture(color.panel.background())
|
texture:SetTexture(aux.color.panel.background())
|
||||||
else
|
else
|
||||||
texture:SetTexture(color.content.background())
|
texture:SetTexture(aux.color.content.background())
|
||||||
end
|
end
|
||||||
return texture
|
return texture
|
||||||
end
|
end
|
||||||
@@ -462,9 +461,9 @@ function M.vertical_line(parent, x_offset, top_offset, bottom_offset, inverted_c
|
|||||||
texture:SetPoint('BOTTOMLEFT', parent, 'BOTTOMLEFT', x_offset, bottom_offset or 2)
|
texture:SetPoint('BOTTOMLEFT', parent, 'BOTTOMLEFT', x_offset, bottom_offset or 2)
|
||||||
texture:SetWidth(2)
|
texture:SetWidth(2)
|
||||||
if inverted_color then
|
if inverted_color then
|
||||||
texture:SetTexture(color.panel.background())
|
texture:SetTexture(aux.color.panel.background())
|
||||||
else
|
else
|
||||||
texture:SetTexture(color.content.background())
|
texture:SetTexture(aux.color.content.background())
|
||||||
end
|
end
|
||||||
return texture
|
return texture
|
||||||
end
|
end
|
||||||
@@ -504,7 +503,7 @@ function M.slider(parent)
|
|||||||
set_panel_style(slider)
|
set_panel_style(slider)
|
||||||
local thumb_texture = slider:CreateTexture(nil, 'ARTWORK')
|
local thumb_texture = slider:CreateTexture(nil, 'ARTWORK')
|
||||||
thumb_texture:SetPoint('CENTER', 0, 0)
|
thumb_texture:SetPoint('CENTER', 0, 0)
|
||||||
thumb_texture:SetTexture(color.content.background())
|
thumb_texture:SetTexture(aux.color.content.background())
|
||||||
thumb_texture:SetHeight(18)
|
thumb_texture:SetHeight(18)
|
||||||
thumb_texture:SetWidth(8)
|
thumb_texture:SetWidth(8)
|
||||||
set_size(thumb_texture, 8, 18)
|
set_size(thumb_texture, 8, 18)
|
||||||
@@ -516,7 +515,7 @@ function M.slider(parent)
|
|||||||
label:SetJustifyH('LEFT')
|
label:SetJustifyH('LEFT')
|
||||||
label:SetHeight(13)
|
label:SetHeight(13)
|
||||||
label:SetFont(font, font_size.small)
|
label:SetFont(font, font_size.small)
|
||||||
label:SetTextColor(color.label.enabled())
|
label:SetTextColor(aux.color.label.enabled())
|
||||||
|
|
||||||
local editbox = editbox(slider)
|
local editbox = editbox(slider)
|
||||||
editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0)
|
editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0)
|
||||||
@@ -555,16 +554,16 @@ end
|
|||||||
function M.percentage_historical(pct, bid)
|
function M.percentage_historical(pct, bid)
|
||||||
local text = (pct > 10000 and '>10000' or pct) .. '%'
|
local text = (pct > 10000 and '>10000' or pct) .. '%'
|
||||||
if bid then
|
if bid then
|
||||||
return color.gray(text)
|
return aux.color.gray(text)
|
||||||
elseif pct < 50 then
|
elseif pct < 50 then
|
||||||
return color.blue(text)
|
return aux.color.blue(text)
|
||||||
elseif pct < 80 then
|
elseif pct < 80 then
|
||||||
return color.green(text)
|
return aux.color.green(text)
|
||||||
elseif pct < 110 then
|
elseif pct < 110 then
|
||||||
return color.yellow(text)
|
return aux.color.yellow(text)
|
||||||
elseif pct < 135 then
|
elseif pct < 135 then
|
||||||
return color.orange(text)
|
return aux.color.orange(text)
|
||||||
else
|
else
|
||||||
return color.red(text)
|
return aux.color.red(text)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
module 'aux.gui.item_listing'
|
module 'aux.gui.item_listing'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
|
|
||||||
@@ -66,7 +64,7 @@ function M.new(parent, on_click, selected)
|
|||||||
scroll_bar:SetWidth(10)
|
scroll_bar:SetWidth(10)
|
||||||
local thumbTex = scroll_bar:GetThumbTexture()
|
local thumbTex = scroll_bar:GetThumbTexture()
|
||||||
thumbTex:SetPoint('CENTER', 0, 0)
|
thumbTex:SetPoint('CENTER', 0, 0)
|
||||||
thumbTex:SetTexture(color.content.background())
|
thumbTex:SetTexture(aux.color.content.background())
|
||||||
thumbTex:SetHeight(150)
|
thumbTex:SetHeight(150)
|
||||||
thumbTex:SetWidth(scroll_bar:GetWidth())
|
thumbTex:SetWidth(scroll_bar:GetWidth())
|
||||||
_G[scroll_bar:GetName() .. 'ScrollUpButton']:Hide()
|
_G[scroll_bar:GetName() .. 'ScrollUpButton']:Hide()
|
||||||
|
|||||||
+3
-5
@@ -1,9 +1,7 @@
|
|||||||
module 'aux.gui.listing'
|
module 'aux.gui.listing'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
|
|
||||||
local ROW_HEIGHT = 15
|
local ROW_HEIGHT = 15
|
||||||
@@ -175,7 +173,7 @@ local methods = {
|
|||||||
local text = col:CreateFontString()
|
local text = col:CreateFontString()
|
||||||
text:SetAllPoints()
|
text:SetAllPoints()
|
||||||
text:SetFont(gui.font, 12)
|
text:SetFont(gui.font, 12)
|
||||||
text:SetTextColor(color.label.enabled())
|
text:SetTextColor(aux.color.label.enabled())
|
||||||
col.text = text
|
col.text = text
|
||||||
|
|
||||||
local tex = col:CreateTexture()
|
local tex = col:CreateTexture()
|
||||||
@@ -283,7 +281,7 @@ function M.new(parent)
|
|||||||
scroll_bar:SetWidth(10)
|
scroll_bar:SetWidth(10)
|
||||||
local thumbTex = scroll_bar:GetThumbTexture()
|
local thumbTex = scroll_bar:GetThumbTexture()
|
||||||
thumbTex:SetPoint('CENTER', 0, 0)
|
thumbTex:SetPoint('CENTER', 0, 0)
|
||||||
thumbTex:SetTexture(color.content.background())
|
thumbTex:SetTexture(aux.color.content.background())
|
||||||
thumbTex:SetHeight(150)
|
thumbTex:SetHeight(150)
|
||||||
thumbTex:SetWidth(scroll_bar:GetWidth())
|
thumbTex:SetWidth(scroll_bar:GetWidth())
|
||||||
_G[scroll_bar:GetName() .. 'ScrollUpButton']:Hide()
|
_G[scroll_bar:GetName() .. 'ScrollUpButton']:Hide()
|
||||||
|
|||||||
+3
-3
@@ -55,7 +55,7 @@ do
|
|||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
M.temp = setmetatable({}, {__metatable=false, __newindex=nop, __call=f, __sub=f})
|
M.temp = setmetatable({}, {__metatable=false, __newindex=pass, __call=f, __sub=f})
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local function f(_, v)
|
local function f(_, v)
|
||||||
@@ -64,7 +64,7 @@ do
|
|||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
M.static = setmetatable({}, {__metatable=false, __newindex=nop, __call=f, __sub=f})
|
M.static = setmetatable({}, {__metatable=false, __newindex=pass, __call=f, __sub=f})
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -78,7 +78,7 @@ do
|
|||||||
M.unpack = unpack
|
M.unpack = unpack
|
||||||
end
|
end
|
||||||
|
|
||||||
M.empty = setmetatable({}, {__metatable=false, __newindex=nop})
|
M.empty = setmetatable({}, {__metatable=false, __newindex=pass})
|
||||||
|
|
||||||
local vararg
|
local vararg
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -1,25 +1,23 @@
|
|||||||
if module then return end
|
if module then return end
|
||||||
local _G, setfenv, setmetatable = getfenv(0), setfenv, setmetatable
|
local _G, setfenv, setmetatable = getfenv(0), setfenv, setmetatable
|
||||||
local environments, exports_data, interfaces = {}, {}, {}
|
local environments, interfaces = {}, {}
|
||||||
|
|
||||||
local function nop() end
|
local function pass() end
|
||||||
|
|
||||||
|
local environment_mt = {__index=_G}
|
||||||
|
|
||||||
local function create_module(name)
|
local function create_module(name)
|
||||||
local environment, exports = setmetatable({_G=_G, nop=nop}, {__index=_G}), {}
|
local environment = setmetatable({_G=_G, pass=pass}, environment_mt)
|
||||||
|
local exports = {}
|
||||||
environment.M = setmetatable({}, {
|
environment.M = setmetatable({}, {
|
||||||
__metatable=false,
|
__metatable=false,
|
||||||
__newindex=function(_, k, v)
|
__newindex=function(_, k, v)
|
||||||
environment[k], exports[k] = v, v
|
environment[k], exports[k] = v, v
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
environment.include = function(name)
|
|
||||||
for k, v in exports_data[name] or error('No such module.', 2) do
|
|
||||||
environment[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
environment._M = environment
|
environment._M = environment
|
||||||
interfaces[name] = setmetatable({}, {__metatable=false, __index=exports, __newindex=nop})
|
environments[name] = environment
|
||||||
environments[name], exports_data[name] = environment, exports
|
interfaces[name] = setmetatable({}, {__metatable=false, __index=exports, __newindex=pass})
|
||||||
end
|
end
|
||||||
|
|
||||||
function module(name)
|
function module(name)
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
module 'aux.tabs.auctions'
|
module 'aux.tabs.auctions'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local scan_util = require 'aux.util.scan'
|
local scan_util = require 'aux.util.scan'
|
||||||
local scan = require 'aux.core.scan'
|
local scan = require 'aux.core.scan'
|
||||||
|
|
||||||
local tab = TAB 'Auctions'
|
local tab = aux.tab 'Auctions'
|
||||||
|
|
||||||
auction_records = T.acquire()
|
auction_records = T.acquire()
|
||||||
|
|
||||||
@@ -75,7 +73,7 @@ do
|
|||||||
|
|
||||||
cancel_button:SetScript('OnClick', function()
|
cancel_button:SetScript('OnClick', function()
|
||||||
if scan_util.test(record, index) and listing:ContainsRecord(record) then
|
if scan_util.test(record, index) and listing:ContainsRecord(record) then
|
||||||
cancel_auction(index, function() listing:RemoveAuctionRecord(record) end)
|
aux.cancel_auction(index, function() listing:RemoveAuctionRecord(record) end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
cancel_button:Enable()
|
cancel_button:Enable()
|
||||||
@@ -97,7 +95,7 @@ do
|
|||||||
find_auction(selection.record)
|
find_auction(selection.record)
|
||||||
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
|
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
|
||||||
cancel_button:Disable()
|
cancel_button:Disable()
|
||||||
if not cancel_in_progress() then state = IDLE end
|
if not aux.cancel_in_progress() then state = IDLE end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1,19 +1,20 @@
|
|||||||
module 'aux.tabs.auctions'
|
module 'aux.tabs.auctions'
|
||||||
|
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
local auction_listing = require 'aux.gui.auction_listing'
|
local auction_listing = require 'aux.gui.auction_listing'
|
||||||
local search_tab = require 'aux.tabs.search'
|
local search_tab = require 'aux.tabs.search'
|
||||||
|
|
||||||
frame = CreateFrame('Frame', nil, AuxFrame)
|
frame = CreateFrame('Frame', nil, aux.frame)
|
||||||
frame:SetAllPoints()
|
frame:SetAllPoints()
|
||||||
frame:SetScript('OnUpdate', on_update)
|
frame:SetScript('OnUpdate', on_update)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
|
|
||||||
frame.listing = gui.panel(frame)
|
frame.listing = gui.panel(frame)
|
||||||
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||||
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
|
||||||
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||||
|
|
||||||
listing = auction_listing.new(frame.listing, 20, auction_listing.auctions_columns)
|
listing = auction_listing.new(frame.listing, 20, auction_listing.auctions_columns)
|
||||||
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
|
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
|
||||||
@@ -26,7 +27,7 @@ listing:SetHandler('OnClick', function(row, button)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif button == 'RightButton' then
|
elseif button == 'RightButton' then
|
||||||
set_tab(1)
|
aux.set_tab(1)
|
||||||
search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
|
search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
|
||||||
search_tab.execute(nil, false)
|
search_tab.execute(nil, false)
|
||||||
end
|
end
|
||||||
@@ -40,7 +41,7 @@ do
|
|||||||
status_bar = gui.status_bar(frame)
|
status_bar = gui.status_bar(frame)
|
||||||
status_bar:SetWidth(265)
|
status_bar:SetWidth(265)
|
||||||
status_bar:SetHeight(25)
|
status_bar:SetHeight(25)
|
||||||
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
status_bar:update_status(1, 1)
|
status_bar:update_status(1, 1)
|
||||||
status_bar:set_text('')
|
status_bar:set_text('')
|
||||||
end
|
end
|
||||||
|
|||||||
+5
-7
@@ -1,14 +1,12 @@
|
|||||||
module 'aux.tabs.bids'
|
module 'aux.tabs.bids'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local scan_util = require 'aux.util.scan'
|
local scan_util = require 'aux.util.scan'
|
||||||
local scan = require 'aux.core.scan'
|
local scan = require 'aux.core.scan'
|
||||||
|
|
||||||
local tab = TAB 'Bids'
|
local tab = aux.tab 'Bids'
|
||||||
|
|
||||||
auction_records = {}
|
auction_records = {}
|
||||||
|
|
||||||
@@ -80,7 +78,7 @@ do
|
|||||||
if not record.high_bidder then
|
if not record.high_bidder then
|
||||||
bid_button:SetScript('OnClick', function()
|
bid_button:SetScript('OnClick', function()
|
||||||
if scan_util.test(record, index) and listing:ContainsRecord(record) then
|
if scan_util.test(record, index) and listing:ContainsRecord(record) then
|
||||||
place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
aux.place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||||
info.bid_update(record)
|
info.bid_update(record)
|
||||||
listing:SetDatabase()
|
listing:SetDatabase()
|
||||||
end or function() listing:RemoveAuctionRecord(record) end)
|
end or function() listing:RemoveAuctionRecord(record) end)
|
||||||
@@ -94,7 +92,7 @@ do
|
|||||||
if record.buyout_price > 0 then
|
if record.buyout_price > 0 then
|
||||||
buyout_button:SetScript('OnClick', function()
|
buyout_button:SetScript('OnClick', function()
|
||||||
if scan_util.test(record, index) and listing:ContainsRecord(record) then
|
if scan_util.test(record, index) and listing:ContainsRecord(record) then
|
||||||
place_bid('bidder', index, record.buyout_price, function() listing:RemoveAuctionRecord(record) end)
|
aux.place_bid('bidder', index, record.buyout_price, function() listing:RemoveAuctionRecord(record) end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
buyout_button:Enable()
|
buyout_button:Enable()
|
||||||
@@ -121,7 +119,7 @@ do
|
|||||||
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
|
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
|
||||||
buyout_button:Disable()
|
buyout_button:Disable()
|
||||||
bid_button:Disable()
|
bid_button:Disable()
|
||||||
if not bid_in_progress() then state = IDLE end
|
if not aux.bid_in_progress() then state = IDLE end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+6
-5
@@ -1,19 +1,20 @@
|
|||||||
module 'aux.tabs.bids'
|
module 'aux.tabs.bids'
|
||||||
|
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
local auction_listing = require 'aux.gui.auction_listing'
|
local auction_listing = require 'aux.gui.auction_listing'
|
||||||
local search_tab = require 'aux.tabs.search'
|
local search_tab = require 'aux.tabs.search'
|
||||||
|
|
||||||
frame = CreateFrame('Frame', nil, AuxFrame)
|
frame = CreateFrame('Frame', nil, aux.frame)
|
||||||
frame:SetAllPoints()
|
frame:SetAllPoints()
|
||||||
frame:SetScript('OnUpdate', on_update)
|
frame:SetScript('OnUpdate', on_update)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
|
|
||||||
frame.listing = gui.panel(frame)
|
frame.listing = gui.panel(frame)
|
||||||
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||||
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
|
||||||
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||||
|
|
||||||
listing = auction_listing.new(frame.listing, 20, auction_listing.bids_columns)
|
listing = auction_listing.new(frame.listing, 20, auction_listing.bids_columns)
|
||||||
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
|
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
|
||||||
@@ -28,7 +29,7 @@ listing:SetHandler('OnClick', function(row, button)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif button == 'RightButton' then
|
elseif button == 'RightButton' then
|
||||||
set_tab(1)
|
aux.set_tab(1)
|
||||||
search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
|
search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
|
||||||
search_tab.execute(nil, false)
|
search_tab.execute(nil, false)
|
||||||
end
|
end
|
||||||
@@ -42,7 +43,7 @@ do
|
|||||||
status_bar = gui.status_bar(frame)
|
status_bar = gui.status_bar(frame)
|
||||||
status_bar:SetWidth(265)
|
status_bar:SetWidth(265)
|
||||||
status_bar:SetHeight(25)
|
status_bar:SetHeight(25)
|
||||||
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
status_bar:update_status(1, 0)
|
status_bar:update_status(1, 0)
|
||||||
status_bar:set_text('')
|
status_bar:set_text('')
|
||||||
end
|
end
|
||||||
|
|||||||
+17
-19
@@ -1,9 +1,7 @@
|
|||||||
module 'aux.tabs.post'
|
module 'aux.tabs.post'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local sort_util = require 'aux.util.sort'
|
local sort_util = require 'aux.util.sort'
|
||||||
local persistence = require 'aux.util.persistence'
|
local persistence = require 'aux.util.persistence'
|
||||||
@@ -16,7 +14,7 @@ local item_listing = require 'aux.gui.item_listing'
|
|||||||
local al = require 'aux.gui.auction_listing'
|
local al = require 'aux.gui.auction_listing'
|
||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
|
|
||||||
local tab = TAB 'Post'
|
local tab = aux.tab 'Post'
|
||||||
|
|
||||||
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||||
local settings_schema = {'tuple', '#', {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
local settings_schema = {'tuple', '#', {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||||
@@ -31,8 +29,8 @@ function get_default_settings()
|
|||||||
return T.map('duration', DURATION_8, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
return T.map('duration', DURATION_8, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function handle.LOAD2()
|
function aux.handle.LOAD2()
|
||||||
data = faction_data'post'
|
data = aux.faction_data'post'
|
||||||
end
|
end
|
||||||
|
|
||||||
function read_settings(item_key)
|
function read_settings(item_key)
|
||||||
@@ -102,7 +100,7 @@ function set_unit_buyout_price(amount)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function update_inventory_listing()
|
function update_inventory_listing()
|
||||||
local records = values(filter(copy(inventory_records), function(record)
|
local records = aux.values(aux.filter(aux.copy(inventory_records), function(record)
|
||||||
local settings = read_settings(record.key)
|
local settings = read_settings(record.key)
|
||||||
return record.aux_quantity > 0 and (not settings.hidden or show_hidden_checkbox:GetChecked())
|
return record.aux_quantity > 0 and (not settings.hidden or show_hidden_checkbox:GetChecked())
|
||||||
end))
|
end))
|
||||||
@@ -116,15 +114,15 @@ function update_auction_listing(listing, records, reference)
|
|||||||
local historical_value = history.value(selected_item.key)
|
local historical_value = history.value(selected_item.key)
|
||||||
local stack_size = stack_size_slider:GetValue()
|
local stack_size = stack_size_slider:GetValue()
|
||||||
for _, record in records[selected_item.key] or T.empty do
|
for _, record in records[selected_item.key] or T.empty do
|
||||||
local price_color = undercut(record, stack_size_slider:GetValue(), listing == 'bid') < reference and color.red
|
local price_color = undercut(record, stack_size_slider:GetValue(), listing == 'bid') < reference and aux.color.red
|
||||||
local price = record.unit_price * (listing == 'bid' and record.stack_size / stack_size_slider:GetValue() or 1)
|
local price = record.unit_price * (listing == 'bid' and record.stack_size / stack_size_slider:GetValue() or 1)
|
||||||
tinsert(rows, T.map(
|
tinsert(rows, T.map(
|
||||||
'cols', T.list(
|
'cols', T.list(
|
||||||
T.map('value', record.own and color.green(record.count) or record.count),
|
T.map('value', record.own and aux.color.green(record.count) or record.count),
|
||||||
T.map('value', al.time_left(record.duration)),
|
T.map('value', al.time_left(record.duration)),
|
||||||
T.map('value', record.stack_size == stack_size and color.green(record.stack_size) or record.stack_size),
|
T.map('value', record.stack_size == stack_size and aux.color.green(record.stack_size) or record.stack_size),
|
||||||
T.map('value', money.to_string(price, true, nil, price_color)),
|
T.map('value', money.to_string(price, true, nil, price_color)),
|
||||||
T.map('value', historical_value and gui.percentage_historical(round(price / historical_value * 100)) or '---')
|
T.map('value', historical_value and gui.percentage_historical(aux.round(price / historical_value * 100)) or '---')
|
||||||
),
|
),
|
||||||
'record', record
|
'record', record
|
||||||
))
|
))
|
||||||
@@ -135,7 +133,7 @@ function update_auction_listing(listing, records, reference)
|
|||||||
T.map('value', '---'),
|
T.map('value', '---'),
|
||||||
T.map('value', '---'),
|
T.map('value', '---'),
|
||||||
T.map('value', '---'),
|
T.map('value', '---'),
|
||||||
T.map('value', money.to_string(historical_value, true, nil, color.green)),
|
T.map('value', money.to_string(historical_value, true, nil, aux.color.green)),
|
||||||
T.map('value', historical_value and gui.percentage_historical(100) or '---')
|
T.map('value', historical_value and gui.percentage_historical(100) or '---')
|
||||||
),
|
),
|
||||||
'record', T.map('historical_value', true, 'stack_size', stack_size, 'unit_price', historical_value, 'own', true)
|
'record', T.map('historical_value', true, 'stack_size', stack_size, 'unit_price', historical_value, 'own', true)
|
||||||
@@ -173,7 +171,7 @@ function update_auction_listings()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.select_item(item_key)
|
function M.select_item(item_key)
|
||||||
for _, inventory_record in filter(copy(inventory_records), function(record) return record.aux_quantity > 0 end) do
|
for _, inventory_record in aux.filter(aux.copy(inventory_records), function(record) return record.aux_quantity > 0 end) do
|
||||||
if inventory_record.key == item_key then
|
if inventory_record.key == item_key then
|
||||||
update_item(inventory_record)
|
update_item(inventory_record)
|
||||||
return
|
return
|
||||||
@@ -192,8 +190,8 @@ function price_update()
|
|||||||
set_unit_buyout_price(undercut(get_buyout_selection(), stack_size_slider:GetValue()))
|
set_unit_buyout_price(undercut(get_buyout_selection(), stack_size_slider:GetValue()))
|
||||||
unit_buyout_price_input:SetText(money.to_string(get_unit_buyout_price(), true, nil, nil, true))
|
unit_buyout_price_input:SetText(money.to_string(get_unit_buyout_price(), true, nil, nil, true))
|
||||||
end
|
end
|
||||||
start_price_percentage:SetText(historical_value and gui.percentage_historical(round(get_unit_start_price() / historical_value * 100)) or '---')
|
start_price_percentage:SetText(historical_value and gui.percentage_historical(aux.round(get_unit_start_price() / historical_value * 100)) or '---')
|
||||||
buyout_price_percentage:SetText(historical_value and gui.percentage_historical(round(get_unit_buyout_price() / historical_value * 100)) or '---')
|
buyout_price_percentage:SetText(historical_value and gui.percentage_historical(aux.round(get_unit_buyout_price() / historical_value * 100)) or '---')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -275,7 +273,7 @@ function update_item_configuration()
|
|||||||
|
|
||||||
item.texture:SetTexture(nil)
|
item.texture:SetTexture(nil)
|
||||||
item.count:SetText()
|
item.count:SetText()
|
||||||
item.name:SetTextColor(color.label.enabled())
|
item.name:SetTextColor(aux.color.label.enabled())
|
||||||
item.name:SetText('No item selected')
|
item.name:SetText('No item selected')
|
||||||
|
|
||||||
unit_start_price_input:Hide()
|
unit_start_price_input:Hide()
|
||||||
@@ -314,7 +312,7 @@ function update_item_configuration()
|
|||||||
local duration_factor = UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
|
local duration_factor = UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
|
||||||
local stack_size, stack_count = selected_item.max_charges and 1 or stack_size_slider:GetValue(), stack_count_slider:GetValue()
|
local stack_size, stack_count = selected_item.max_charges and 1 or stack_size_slider:GetValue(), stack_count_slider:GetValue()
|
||||||
local amount = floor(selected_item.unit_vendor_price * deposit_factor * stack_size) * stack_count * duration_factor
|
local amount = floor(selected_item.unit_vendor_price * deposit_factor * stack_size) * stack_count * duration_factor
|
||||||
deposit:SetText('Deposit: ' .. money.to_string(amount, nil, nil, color.text.enabled))
|
deposit:SetText('Deposit: ' .. money.to_string(amount, nil, nil, aux.color.text.enabled))
|
||||||
end
|
end
|
||||||
|
|
||||||
refresh_button:Enable()
|
refresh_button:Enable()
|
||||||
@@ -391,7 +389,7 @@ function update_item(item)
|
|||||||
else
|
else
|
||||||
stack_size_slider:SetMinMaxValues(1, min(selected_item.max_stack, selected_item.aux_quantity))
|
stack_size_slider:SetMinMaxValues(1, min(selected_item.max_stack, selected_item.aux_quantity))
|
||||||
end
|
end
|
||||||
stack_size_slider:SetValue(huge)
|
stack_size_slider:SetValue(aux.huge)
|
||||||
quantity_update(true)
|
quantity_update(true)
|
||||||
|
|
||||||
unit_start_price_input:SetText(money.to_string(settings.start_price, true, nil, nil, true))
|
unit_start_price_input:SetText(money.to_string(settings.start_price, true, nil, nil, true))
|
||||||
@@ -442,7 +440,7 @@ function update_inventory_records()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
T.release(inventory_records)
|
T.release(inventory_records)
|
||||||
inventory_records = values(auctionable_map)
|
inventory_records = aux.values(auctionable_map)
|
||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+7
-6
@@ -1,5 +1,6 @@
|
|||||||
module 'aux.tabs.post'
|
module 'aux.tabs.post'
|
||||||
|
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local money = require 'aux.util.money'
|
local money = require 'aux.util.money'
|
||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
@@ -7,15 +8,15 @@ local listing = require 'aux.gui.listing'
|
|||||||
local item_listing = require 'aux.gui.item_listing'
|
local item_listing = require 'aux.gui.item_listing'
|
||||||
local search_tab = require 'aux.tabs.search'
|
local search_tab = require 'aux.tabs.search'
|
||||||
|
|
||||||
frame = CreateFrame('Frame', nil, AuxFrame)
|
frame = CreateFrame('Frame', nil, aux.frame)
|
||||||
frame:SetAllPoints()
|
frame:SetAllPoints()
|
||||||
frame:SetScript('OnUpdate', on_update)
|
frame:SetScript('OnUpdate', on_update)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
|
|
||||||
frame.content = CreateFrame('Frame', nil, frame)
|
frame.content = CreateFrame('Frame', nil, frame)
|
||||||
frame.content:SetPoint('TOP', frame, 'TOP', 0, -8)
|
frame.content:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||||
frame.content:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
frame.content:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
|
||||||
frame.content:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
frame.content:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||||
|
|
||||||
frame.inventory = gui.panel(frame.content)
|
frame.inventory = gui.panel(frame.content)
|
||||||
frame.inventory:SetWidth(212)
|
frame.inventory:SetWidth(212)
|
||||||
@@ -61,7 +62,7 @@ do
|
|||||||
if arg1 == 'LeftButton' then
|
if arg1 == 'LeftButton' then
|
||||||
update_item(this.item_record)
|
update_item(this.item_record)
|
||||||
elseif arg1 == 'RightButton' then
|
elseif arg1 == 'RightButton' then
|
||||||
set_tab(1)
|
aux.set_tab(1)
|
||||||
search_tab.set_filter(strlower(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)
|
search_tab.execute(nil, false)
|
||||||
end
|
end
|
||||||
@@ -124,7 +125,7 @@ do
|
|||||||
status_bar = gui.status_bar(frame)
|
status_bar = gui.status_bar(frame)
|
||||||
status_bar:SetWidth(265)
|
status_bar:SetWidth(265)
|
||||||
status_bar:SetHeight(25)
|
status_bar:SetHeight(25)
|
||||||
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
status_bar:update_status(1, 1)
|
status_bar:update_status(1, 1)
|
||||||
status_bar:set_text('')
|
status_bar:set_text('')
|
||||||
end
|
end
|
||||||
@@ -310,7 +311,7 @@ do
|
|||||||
deposit = label
|
deposit = label
|
||||||
end
|
end
|
||||||
|
|
||||||
function handle.LOAD()
|
function aux.handle.LOAD()
|
||||||
if not aux_post_bid then
|
if not aux_post_bid then
|
||||||
frame.bid_listing:Hide()
|
frame.bid_listing:Hide()
|
||||||
frame.buyout_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
|
frame.buyout_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
module 'aux.tabs.search'
|
module 'aux.tabs.search'
|
||||||
|
|
||||||
include 'aux'
|
local aux = require 'aux'
|
||||||
|
|
||||||
local T = require 'T'
|
|
||||||
|
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
|
|
||||||
local tab = TAB 'Search'
|
local tab = aux.tab 'Search'
|
||||||
|
|
||||||
StaticPopupDialogs.AUX_SEARCH_TABLE_FULL = {
|
StaticPopupDialogs.AUX_SEARCH_TABLE_FULL = {
|
||||||
text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.',
|
text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.',
|
||||||
@@ -20,7 +17,7 @@ RESULTS = 1
|
|||||||
SAVED = 2
|
SAVED = 2
|
||||||
FILTER = 3
|
FILTER = 3
|
||||||
|
|
||||||
function handle.LOAD()
|
function aux.handle.LOAD()
|
||||||
set_subtab(SAVED)
|
set_subtab(SAVED)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -73,7 +70,7 @@ end
|
|||||||
|
|
||||||
function add_filter(filter_string)
|
function add_filter(filter_string)
|
||||||
local old_filter_string = search_box:GetText()
|
local old_filter_string = search_box:GetText()
|
||||||
old_filter_string = trim(old_filter_string)
|
old_filter_string = aux.trim(old_filter_string)
|
||||||
|
|
||||||
if old_filter_string ~= '' then
|
if old_filter_string ~= '' then
|
||||||
old_filter_string = old_filter_string .. ';'
|
old_filter_string = old_filter_string .. ';'
|
||||||
|
|||||||
+12
-12
@@ -1,7 +1,7 @@
|
|||||||
module 'aux.tabs.search'
|
module 'aux.tabs.search'
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local money = require 'aux.util.money'
|
local money = require 'aux.util.money'
|
||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
@@ -11,7 +11,7 @@ local post_filter_index = 0
|
|||||||
|
|
||||||
function valid_level(str)
|
function valid_level(str)
|
||||||
local level = tonumber(str)
|
local level = tonumber(str)
|
||||||
return level and bounded(1, 60, level)
|
return level and aux.bounded(1, 60, level)
|
||||||
end
|
end
|
||||||
|
|
||||||
blizzard_query = setmetatable(T.acquire(), {
|
blizzard_query = setmetatable(T.acquire(), {
|
||||||
@@ -99,7 +99,7 @@ function update_form()
|
|||||||
quality_dropdown.button:Enable()
|
quality_dropdown.button:Enable()
|
||||||
end
|
end
|
||||||
|
|
||||||
if any(T.temp-T.list('min_level', 'max_level', 'usable', 'class', 'subclass', 'slot', 'quality'), function(key) return blizzard_query[key] end) then
|
if aux.any(T.temp-T.list('min_level', 'max_level', 'usable', 'class', 'subclass', 'slot', 'quality'), function(key) return blizzard_query[key] end) then
|
||||||
exact_checkbox:Disable()
|
exact_checkbox:Disable()
|
||||||
else
|
else
|
||||||
exact_checkbox:Enable()
|
exact_checkbox:Enable()
|
||||||
@@ -116,7 +116,7 @@ function get_filter_builder_query()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local name = blizzard_query.name
|
local name = blizzard_query.name
|
||||||
if not index(filter_util.parse_filter_string(name), 'blizzard', 'name') then
|
if not aux.index(filter_util.parse_filter_string(name), 'blizzard', 'name') then
|
||||||
name = filter_util.quote(name)
|
name = filter_util.quote(name)
|
||||||
end
|
end
|
||||||
add((name ~= '' or blizzard_query.exact) and name)
|
add((name ~= '' or blizzard_query.exact) and name)
|
||||||
@@ -183,8 +183,8 @@ function clear_form()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function import_filter_string()
|
function import_filter_string()
|
||||||
local filter, error = filter_util.parse_filter_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
local filter, error = filter_util.parse_filter_string(aux.select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
||||||
if filter or print(error) then
|
if filter or aux.print(error) then
|
||||||
set_form(filter)
|
set_form(filter)
|
||||||
end
|
end
|
||||||
update_form()
|
update_form()
|
||||||
@@ -206,11 +206,11 @@ function formatted_post_filter(components)
|
|||||||
end
|
end
|
||||||
str = str .. '</p><p>'
|
str = str .. '</p><p>'
|
||||||
for _ = 1, getn(stack) + 1 do
|
for _ = 1, getn(stack) + 1 do
|
||||||
str = str .. color.content.background'----'
|
str = str .. aux.color.content.background'----'
|
||||||
end
|
end
|
||||||
no_line_break = component[1] == 'operator' and component[2] == 'not'
|
no_line_break = component[1] == 'operator' and component[2] == 'not'
|
||||||
|
|
||||||
local filter_color = (post_filter_index == i and color.gold or color.orange)
|
local filter_color = (post_filter_index == i and aux.color.gold or aux.color.orange)
|
||||||
local component_text = filter_color(component[2])
|
local component_text = filter_color(component[2])
|
||||||
if component[1] == 'operator' and component[2] ~= 'not' then
|
if component[1] == 'operator' and component[2] ~= 'not' then
|
||||||
component_text = component_text .. filter_color(tonumber(component[3]) or '')
|
component_text = component_text .. filter_color(tonumber(component[3]) or '')
|
||||||
@@ -283,7 +283,7 @@ function add_form_component()
|
|||||||
filter_input:HighlightText()
|
filter_input:HighlightText()
|
||||||
filter_input:SetFocus()
|
filter_input:SetFocus()
|
||||||
elseif error then
|
elseif error then
|
||||||
print(error)
|
aux.print(error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -318,8 +318,8 @@ function set_filter_display_offset(x_offset, y_offset)
|
|||||||
local x_upper_bound = 0
|
local x_upper_bound = 0
|
||||||
local y_lower_bound = 0
|
local y_lower_bound = 0
|
||||||
local y_upper_bound = max(0, height - scroll_frame:GetHeight())
|
local y_upper_bound = max(0, height - scroll_frame:GetHeight())
|
||||||
scroll_frame:SetHorizontalScroll(bounded(x_lower_bound, x_upper_bound, x_offset))
|
scroll_frame:SetHorizontalScroll(aux.bounded(x_lower_bound, x_upper_bound, x_offset))
|
||||||
scroll_frame:SetVerticalScroll(bounded(y_lower_bound, y_upper_bound, y_offset))
|
scroll_frame:SetVerticalScroll(aux.bounded(y_lower_bound, y_upper_bound, y_offset))
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize_filter_dropdown()
|
function initialize_filter_dropdown()
|
||||||
@@ -329,7 +329,7 @@ function initialize_filter_dropdown()
|
|||||||
'value', filter,
|
'value', filter,
|
||||||
'func', function()
|
'func', function()
|
||||||
filter_input:SetText(this.value)
|
filter_input:SetText(this.value)
|
||||||
if index(filter_util.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
if aux.index(filter_util.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
||||||
add_form_component()
|
add_form_component()
|
||||||
elseif filter_util.filters[this.value] then
|
elseif filter_util.filters[this.value] then
|
||||||
filter_parameter_input:Show()
|
filter_parameter_input:Show()
|
||||||
|
|||||||
+16
-16
@@ -1,7 +1,7 @@
|
|||||||
module 'aux.tabs.search'
|
module 'aux.tabs.search'
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local completion = require 'aux.util.completion'
|
local completion = require 'aux.util.completion'
|
||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
@@ -12,19 +12,19 @@ local auction_listing = require 'aux.gui.auction_listing'
|
|||||||
|
|
||||||
local FILTER_SPACING = 28.5
|
local FILTER_SPACING = 28.5
|
||||||
|
|
||||||
frame = CreateFrame('Frame', nil, AuxFrame)
|
frame = CreateFrame('Frame', nil, aux.frame)
|
||||||
frame:SetAllPoints()
|
frame:SetAllPoints()
|
||||||
frame:SetScript('OnUpdate', on_update)
|
frame:SetScript('OnUpdate', on_update)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
|
|
||||||
frame.filter = gui.panel(frame)
|
frame.filter = gui.panel(frame)
|
||||||
frame.filter:SetAllPoints(AuxFrame.content)
|
frame.filter:SetAllPoints(aux.frame.content)
|
||||||
|
|
||||||
frame.results = gui.panel(frame)
|
frame.results = gui.panel(frame)
|
||||||
frame.results:SetAllPoints(AuxFrame.content)
|
frame.results:SetAllPoints(aux.frame.content)
|
||||||
|
|
||||||
frame.saved = CreateFrame('Frame', nil, frame)
|
frame.saved = CreateFrame('Frame', nil, frame)
|
||||||
frame.saved:SetAllPoints(AuxFrame.content)
|
frame.saved:SetAllPoints(aux.frame.content)
|
||||||
|
|
||||||
frame.saved.favorite = gui.panel(frame.saved)
|
frame.saved.favorite = gui.panel(frame.saved)
|
||||||
frame.saved.favorite:SetWidth(393)
|
frame.saved.favorite:SetWidth(393)
|
||||||
@@ -57,7 +57,7 @@ do
|
|||||||
local btn = gui.button(frame, gui.font_size.small)
|
local btn = gui.button(frame, gui.font_size.small)
|
||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetWidth(60)
|
btn:SetWidth(60)
|
||||||
btn:SetText(color.label.enabled'Range:')
|
btn:SetText(aux.color.label.enabled'Range:')
|
||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
update_real_time(true)
|
update_real_time(true)
|
||||||
end)
|
end)
|
||||||
@@ -68,7 +68,7 @@ do
|
|||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetWidth(60)
|
btn:SetWidth(60)
|
||||||
btn:Hide()
|
btn:Hide()
|
||||||
btn:SetText(color.label.enabled'Real Time')
|
btn:SetText(aux.color.label.enabled'Real Time')
|
||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
update_real_time(false)
|
update_real_time(false)
|
||||||
end)
|
end)
|
||||||
@@ -98,7 +98,7 @@ do
|
|||||||
editbox.change = change
|
editbox.change = change
|
||||||
local label = gui.label(editbox, gui.font_size.medium)
|
local label = gui.label(editbox, gui.font_size.medium)
|
||||||
label:SetPoint('LEFT', editbox, 'RIGHT', 0, 0)
|
label:SetPoint('LEFT', editbox, 'RIGHT', 0, 0)
|
||||||
label:SetTextColor(color.label.enabled())
|
label:SetTextColor(aux.color.label.enabled())
|
||||||
label:SetText('-')
|
label:SetText('-')
|
||||||
first_page_input = editbox
|
first_page_input = editbox
|
||||||
end
|
end
|
||||||
@@ -149,7 +149,7 @@ do
|
|||||||
local btn = gui.button(frame)
|
local btn = gui.button(frame)
|
||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
|
btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
|
||||||
btn:SetBackdropColor(color.state.enabled())
|
btn:SetBackdropColor(aux.color.state.enabled())
|
||||||
btn:SetText('Resume')
|
btn:SetText('Resume')
|
||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
execute(true)
|
execute(true)
|
||||||
@@ -161,7 +161,7 @@ do
|
|||||||
editbox:EnableMouse(1)
|
editbox:EnableMouse(1)
|
||||||
editbox.formatter = function(str)
|
editbox.formatter = function(str)
|
||||||
local queries = filter_util.queries(str)
|
local queries = filter_util.queries(str)
|
||||||
return queries and join(map(copy(queries), function(query) return query.prettified end), ';') or color.red(str)
|
return queries and aux.join(aux.map(aux.copy(queries), function(query) return query.prettified end), ';') or aux.color.red(str)
|
||||||
end
|
end
|
||||||
editbox.complete = completion.complete_filter
|
editbox.complete = completion.complete_filter
|
||||||
editbox.escape = function() this:SetText(get_current_search().filter_string or '') end
|
editbox.escape = function() this:SetText(get_current_search().filter_string or '') end
|
||||||
@@ -184,7 +184,7 @@ do
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame, gui.font_size.large)
|
local btn = gui.button(frame, gui.font_size.large)
|
||||||
btn:SetPoint('BOTTOMLEFT', AuxFrame.content, 'TOPLEFT', 10, 8)
|
btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8)
|
||||||
btn:SetWidth(243)
|
btn:SetWidth(243)
|
||||||
btn:SetHeight(22)
|
btn:SetHeight(22)
|
||||||
btn:SetText('Search Results')
|
btn:SetText('Search Results')
|
||||||
@@ -213,7 +213,7 @@ do
|
|||||||
local frame = CreateFrame('Frame', nil, frame)
|
local frame = CreateFrame('Frame', nil, frame)
|
||||||
frame:SetWidth(265)
|
frame:SetWidth(265)
|
||||||
frame:SetHeight(25)
|
frame:SetHeight(25)
|
||||||
frame:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
|
||||||
status_bar_frame = frame
|
status_bar_frame = frame
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
@@ -435,7 +435,7 @@ do
|
|||||||
input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0)
|
input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0)
|
||||||
input:SetWidth(150)
|
input:SetWidth(150)
|
||||||
input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end)
|
input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end)
|
||||||
input.complete = completion.complete(function() return T.temp-T.list('and', 'or', 'not', unpack(keys(filter_util.filters))) end)
|
input.complete = completion.complete(function() return T.temp-T.list('and', 'or', 'not', unpack(aux.keys(filter_util.filters))) end)
|
||||||
input.char = function() this:complete() end
|
input.char = function() this:complete() end
|
||||||
input.change = function()
|
input.change = function()
|
||||||
local text = this:GetText()
|
local text = this:GetText()
|
||||||
@@ -478,7 +478,7 @@ do
|
|||||||
scroll_frame:EnableMouseWheel(true)
|
scroll_frame:EnableMouseWheel(true)
|
||||||
scroll_frame:SetScript('OnMouseWheel', function()
|
scroll_frame:SetScript('OnMouseWheel', function()
|
||||||
local child = this:GetScrollChild()
|
local child = this:GetScrollChild()
|
||||||
child:SetFont('p', [[Fonts\ARIALN.TTF]], bounded(gui.font_size.small, gui.font_size.large, select(2, child:GetFont()) + arg1*2))
|
child:SetFont('p', [[Fonts\ARIALN.TTF]], aux.bounded(gui.font_size.small, gui.font_size.large, aux.select(2, child:GetFont()) + arg1*2))
|
||||||
update_filter_display()
|
update_filter_display()
|
||||||
end)
|
end)
|
||||||
scroll_frame:RegisterForDrag('LeftButton')
|
scroll_frame:RegisterForDrag('LeftButton')
|
||||||
@@ -504,7 +504,7 @@ do
|
|||||||
local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame)
|
local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame)
|
||||||
scroll_frame:SetScrollChild(scroll_child)
|
scroll_frame:SetScrollChild(scroll_child)
|
||||||
scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], gui.font_size.large)
|
scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], gui.font_size.large)
|
||||||
scroll_child:SetTextColor('p', color.label.enabled())
|
scroll_child:SetTextColor('p', aux.color.label.enabled())
|
||||||
scroll_child:SetWidth(1)
|
scroll_child:SetWidth(1)
|
||||||
scroll_child:SetHeight(1)
|
scroll_child:SetHeight(1)
|
||||||
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
|
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
|
||||||
@@ -531,7 +531,7 @@ for _ = 1, 5 do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif button == 'RightButton' then
|
elseif button == 'RightButton' then
|
||||||
set_tab(1)
|
aux.set_tab(1)
|
||||||
set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
|
set_filter(strlower(info.item(this.record.item_id).name) .. '/exact')
|
||||||
execute(nil, false)
|
execute(nil, false)
|
||||||
end
|
end
|
||||||
|
|||||||
+10
-10
@@ -1,7 +1,7 @@
|
|||||||
module 'aux.tabs.search'
|
module 'aux.tabs.search'
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
local scan_util = require 'aux.util.scan'
|
local scan_util = require 'aux.util.scan'
|
||||||
@@ -9,7 +9,7 @@ local scan = require 'aux.core.scan'
|
|||||||
|
|
||||||
search_scan_id = 0
|
search_scan_id = 0
|
||||||
|
|
||||||
function handle.LOAD()
|
function aux.handle.LOAD()
|
||||||
new_search()
|
new_search()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ function start_real_time_scan(query, search, continuation)
|
|||||||
map[record.sniping_signature] = record
|
map[record.sniping_signature] = record
|
||||||
end
|
end
|
||||||
T.release(new_records)
|
T.release(new_records)
|
||||||
new_records = values(map)
|
new_records = aux.values(map)
|
||||||
|
|
||||||
if getn(new_records) > 2000 then
|
if getn(new_records) > 2000 then
|
||||||
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
|
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
|
||||||
@@ -303,14 +303,14 @@ function M.execute(resume, real_time)
|
|||||||
|
|
||||||
local queries, error = filter_util.queries(filter_string)
|
local queries, error = filter_util.queries(filter_string)
|
||||||
if not queries then
|
if not queries then
|
||||||
print('Invalid filter:', error)
|
aux.print('Invalid filter:', error)
|
||||||
return
|
return
|
||||||
elseif real_time then
|
elseif real_time then
|
||||||
if getn(queries) > 1 then
|
if getn(queries) > 1 then
|
||||||
print('Error: The real time mode does not support multi-queries')
|
aux.print('Error: The real time mode does not support multi-queries')
|
||||||
return
|
return
|
||||||
elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then
|
elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then
|
||||||
print('Error: The real time mode does not support page ranges')
|
aux.print('Error: The real time mode does not support page ranges')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -324,7 +324,7 @@ function M.execute(resume, real_time)
|
|||||||
else
|
else
|
||||||
get_current_search().filter_string = filter_string
|
get_current_search().filter_string = filter_string
|
||||||
end
|
end
|
||||||
new_recent_search(filter_string, join(map(copy(queries), function(filter) return filter.prettified end), ';'))
|
new_recent_search(filter_string, aux.join(aux.map(aux.copy(queries), function(filter) return filter.prettified end), ';'))
|
||||||
else
|
else
|
||||||
local search = get_current_search()
|
local search = get_current_search()
|
||||||
search.records = T.acquire()
|
search.records = T.acquire()
|
||||||
@@ -391,7 +391,7 @@ do
|
|||||||
if not record.high_bidder then
|
if not record.high_bidder then
|
||||||
bid_button:SetScript('OnClick', function()
|
bid_button:SetScript('OnClick', function()
|
||||||
if scan_util.test(record, index) and search.table:ContainsRecord(record) then
|
if scan_util.test(record, index) and search.table:ContainsRecord(record) then
|
||||||
place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||||
info.bid_update(record)
|
info.bid_update(record)
|
||||||
search.table:SetDatabase()
|
search.table:SetDatabase()
|
||||||
end or function() search.table:RemoveAuctionRecord(record) end)
|
end or function() search.table:RemoveAuctionRecord(record) end)
|
||||||
@@ -405,7 +405,7 @@ do
|
|||||||
if record.buyout_price > 0 then
|
if record.buyout_price > 0 then
|
||||||
buyout_button:SetScript('OnClick', function()
|
buyout_button:SetScript('OnClick', function()
|
||||||
if scan_util.test(record, index) and search.table:ContainsRecord(record) then
|
if scan_util.test(record, index) and search.table:ContainsRecord(record) then
|
||||||
place_bid('list', index, record.buyout_price, function() search.table:RemoveAuctionRecord(record) end)
|
aux.place_bid('list', index, record.buyout_price, function() search.table:RemoveAuctionRecord(record) end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
buyout_button:Enable()
|
buyout_button:Enable()
|
||||||
@@ -432,7 +432,7 @@ do
|
|||||||
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
|
elseif state == FOUND and not scan_util.test(selection.record, found_index) then
|
||||||
buyout_button:Disable()
|
buyout_button:Disable()
|
||||||
bid_button:Disable()
|
bid_button:Disable()
|
||||||
if not bid_in_progress() then
|
if not aux.bid_in_progress() then
|
||||||
state = IDLE
|
state = IDLE
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+12
-12
@@ -1,12 +1,12 @@
|
|||||||
module 'aux.tabs.search'
|
module 'aux.tabs.search'
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
|
|
||||||
function handle.LOAD2()
|
function aux.handle.LOAD2()
|
||||||
recent_searches, favorite_searches = realm_data'recent_searches', realm_data'favorite_searches'
|
recent_searches, favorite_searches = aux.realm_data'recent_searches', aux.realm_data'favorite_searches'
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_search_listings()
|
function update_search_listings()
|
||||||
@@ -15,7 +15,7 @@ function update_search_listings()
|
|||||||
local search = favorite_searches[i]
|
local search = favorite_searches[i]
|
||||||
local name = strsub(search.prettified, 1, 250)
|
local name = strsub(search.prettified, 1, 250)
|
||||||
tinsert(favorite_search_rows, T.map(
|
tinsert(favorite_search_rows, T.map(
|
||||||
'cols', T.list(T.map('value', search.auto_buy and color.red'X' or ''), T.map('value', name)),
|
'cols', T.list(T.map('value', search.auto_buy and aux.color.red'X' or ''), T.map('value', name)),
|
||||||
'search', search,
|
'search', search,
|
||||||
'index', i
|
'index', i
|
||||||
))
|
))
|
||||||
@@ -92,12 +92,12 @@ function get_auto_buy_validator()
|
|||||||
if queries then
|
if queries then
|
||||||
tinsert(validators, queries[1].validator)
|
tinsert(validators, queries[1].validator)
|
||||||
else
|
else
|
||||||
print('Invalid auto buy filter:', error)
|
aux.print('Invalid auto buy filter:', error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return function(record)
|
return function(record)
|
||||||
return any(validators, function(validator) return validator(record) end)
|
return aux.any(validators, function(validator) return validator(record) end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -106,11 +106,11 @@ function add_favorite(filter_string)
|
|||||||
if queries then
|
if queries then
|
||||||
tinsert(favorite_searches, 1, T.map(
|
tinsert(favorite_searches, 1, T.map(
|
||||||
'filter_string', filter_string,
|
'filter_string', filter_string,
|
||||||
'prettified', join(map(queries, function(query) return query.prettified end), ';')
|
'prettified', aux.join(aux.map(queries, function(query) return query.prettified end), ';')
|
||||||
))
|
))
|
||||||
update_search_listings()
|
update_search_listings()
|
||||||
else
|
else
|
||||||
print('Invalid filter:', error)
|
aux.print('Invalid filter:', error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -118,14 +118,14 @@ function enable_auto_buy(search)
|
|||||||
local queries, error = filter_util.queries(search.filter_string)
|
local queries, error = filter_util.queries(search.filter_string)
|
||||||
if queries then
|
if queries then
|
||||||
if getn(queries) > 1 then
|
if getn(queries) > 1 then
|
||||||
print('Error: Auto Buy does not support multi-queries')
|
aux.print('Error: Auto Buy does not support multi-queries')
|
||||||
elseif size(queries[1].blizzard_query) > 0 and not filter_util.parse_filter_string(search.filter_string).blizzard.exact then
|
elseif aux.size(queries[1].blizzard_query) > 0 and not filter_util.parse_filter_string(search.filter_string).blizzard.exact then
|
||||||
print('Error: Auto Buy does not support Blizzard filters')
|
aux.print('Error: Auto Buy does not support Blizzard filters')
|
||||||
else
|
else
|
||||||
search.auto_buy = true
|
search.auto_buy = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print('Invalid filter:', error)
|
aux.print('Invalid filter:', error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,16 @@ local T = require 'T'
|
|||||||
|
|
||||||
M.immutable = setmetatable(T.acquire(), {
|
M.immutable = setmetatable(T.acquire(), {
|
||||||
__metatable = false,
|
__metatable = false,
|
||||||
__newindex = nop,
|
__newindex = pass,
|
||||||
__sub = function(_, t)
|
__sub = function(_, t)
|
||||||
return setmetatable(T.acquire(), T.map('__metatable', false, '__newindex', nop, '__index', t))
|
return setmetatable(T.acquire(), T.map('__metatable', false, '__newindex', pass, '__index', t))
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function M.enum(n)
|
||||||
|
if n > 0 then return immutable-{}, enum(n - 1) end
|
||||||
|
end
|
||||||
|
|
||||||
M.select = T.vararg-function(arg)
|
M.select = T.vararg-function(arg)
|
||||||
for _ = 1, arg[1] do
|
for _ = 1, arg[1] do
|
||||||
tremove(arg, 1)
|
tremove(arg, 1)
|
||||||
@@ -23,15 +27,6 @@ end
|
|||||||
|
|
||||||
M.join = table.concat
|
M.join = table.concat
|
||||||
|
|
||||||
function M.range(arg1, arg2)
|
|
||||||
local i, n = arg2 and arg1 or 1, arg2 or arg1
|
|
||||||
if i <= n then return first, range(i + 1, n) end
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.replicate(count, value)
|
|
||||||
if count > 0 then return value, replicate(count - 1, value) end
|
|
||||||
end
|
|
||||||
|
|
||||||
M.index = T.vararg-function(arg)
|
M.index = T.vararg-function(arg)
|
||||||
local t = tremove(arg, 1)
|
local t = tremove(arg, 1)
|
||||||
for _, v in ipairs(arg) do
|
for _, v in ipairs(arg) do
|
||||||
|
|||||||
+2
-3
@@ -1,7 +1,6 @@
|
|||||||
module 'aux.util.completion'
|
module 'aux.util.completion'
|
||||||
|
|
||||||
include 'aux'
|
local aux = require 'aux'
|
||||||
|
|
||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
|
|
||||||
function M:complete_filter()
|
function M:complete_filter()
|
||||||
@@ -11,7 +10,7 @@ function M:complete_filter()
|
|||||||
|
|
||||||
local filter_string = this:GetText()
|
local filter_string = this:GetText()
|
||||||
|
|
||||||
local completed_filter_string = select(3, strfind(filter_string, '([^;]*)/[^/;]*$'))
|
local completed_filter_string = aux.select(3, strfind(filter_string, '([^;]*)/[^/;]*$'))
|
||||||
local _, suggestions = filter_util.query(completed_filter_string)
|
local _, suggestions = filter_util.query(completed_filter_string)
|
||||||
|
|
||||||
local start_index, _, current_modifier = strfind(filter_string, '([^/;]*)$')
|
local start_index, _, current_modifier = strfind(filter_string, '([^/;]*)$')
|
||||||
|
|||||||
+28
-30
@@ -1,9 +1,7 @@
|
|||||||
module 'aux.util.filter'
|
module 'aux.util.filter'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local money = require 'aux.util.money'
|
local money = require 'aux.util.money'
|
||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
@@ -15,7 +13,7 @@ function default_filter(str)
|
|||||||
input_type = '',
|
input_type = '',
|
||||||
validator = function()
|
validator = function()
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
return any(auction_record.tooltip, function(entry)
|
return aux.any(auction_record.tooltip, function(entry)
|
||||||
return strfind(strlower(entry.left_text or ''), str, 1, true) or strfind(strlower(entry.right_text or ''), str, 1, true)
|
return strfind(strlower(entry.left_text or ''), str, 1, true) or strfind(strlower(entry.right_text or ''), str, 1, true)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -186,7 +184,7 @@ M.filters = {
|
|||||||
function operator(str)
|
function operator(str)
|
||||||
local operator = str == 'not' and T.list('operator', 'not', 1)
|
local operator = str == 'not' and T.list('operator', 'not', 1)
|
||||||
for name in T.temp-T.set('and', 'or') do
|
for name in T.temp-T.set('and', 'or') do
|
||||||
local arity = select(3, strfind(str, '^' .. name .. '(%d*)$'))
|
local arity = aux.select(3, strfind(str, '^' .. name .. '(%d*)$'))
|
||||||
if arity then
|
if arity then
|
||||||
arity = tonumber(arity)
|
arity = tonumber(arity)
|
||||||
operator = not (arity and arity < 2) and T.list('operator', name, arity)
|
operator = not (arity and arity < 2) and T.list('operator', name, arity)
|
||||||
@@ -203,7 +201,7 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
if self.exact then return end
|
if self.exact then return end
|
||||||
local number = tonumber(select(3, strfind(str, '^(%d+)$')))
|
local number = tonumber(aux.select(3, strfind(str, '^(%d+)$')))
|
||||||
if number then
|
if number then
|
||||||
if number >= 1 and number <= 60 then
|
if number >= 1 and number <= 60 then
|
||||||
for _, key in ipairs(T.temp-T.list('min_level', 'max_level')) do
|
for _, key in ipairs(T.temp-T.list('min_level', 'max_level')) do
|
||||||
@@ -216,20 +214,20 @@ do
|
|||||||
end
|
end
|
||||||
for _, parser in T.temp-T.list(
|
for _, parser in T.temp-T.list(
|
||||||
T.temp-T.list('class', info.item_class_index),
|
T.temp-T.list('class', info.item_class_index),
|
||||||
T.temp-T.list('subclass', T.vararg-function(arg) return info.item_subclass_index(index(self.class, 2) or 0, unpack(arg)) end),
|
T.temp-T.list('subclass', T.vararg-function(arg) return info.item_subclass_index(aux.index(self.class, 2) or 0, unpack(arg)) end),
|
||||||
T.temp-T.list('slot', T.vararg-function(arg) return info.item_slot_index(index(self.class, 2) == 2 and 2 or 0, index(self.subclass, 2) or 0, unpack(arg)) end),
|
T.temp-T.list('slot', T.vararg-function(arg) return info.item_slot_index(aux.index(self.class, 2) == 2 and 2 or 0, aux.index(self.subclass, 2) or 0, unpack(arg)) end),
|
||||||
T.temp-T.list('quality', info.item_quality_index)
|
T.temp-T.list('quality', info.item_quality_index)
|
||||||
) do
|
) do
|
||||||
if not self[parser[1]] then
|
if not self[parser[1]] then
|
||||||
tinsert(parser, str)
|
tinsert(parser, str)
|
||||||
local index, label = parser[2](select(3, unpack(parser)))
|
local index, label = parser[2](aux.select(3, unpack(parser)))
|
||||||
if index then
|
if index then
|
||||||
self[parser[1]] = T.list(label, index)
|
self[parser[1]] = T.list(label, index)
|
||||||
return T.list('blizzard', parser[1], label, index)
|
return T.list('blizzard', parser[1], label, index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not self[str] and (str == 'usable' or str == 'exact' and self.name and size(self) == 1) then
|
if not self[str] and (str == 'usable' or str == 'exact' and self.name and aux.size(self) == 1) then
|
||||||
self[str] = T.list(str, 1)
|
self[str] = T.list(str, 1)
|
||||||
return T.list('blizzard', str, str, 1)
|
return T.list('blizzard', str, str, 1)
|
||||||
elseif i == 1 and strlen(str) <= 63 then
|
elseif i == 1 and strlen(str) <= 63 then
|
||||||
@@ -254,7 +252,7 @@ function parse_parameter(input_type, str)
|
|||||||
elseif input_type == 'string' then
|
elseif input_type == 'string' then
|
||||||
return str ~= '' and str or nil
|
return str ~= '' and str or nil
|
||||||
elseif type(input_type) == 'table' then
|
elseif type(input_type) == 'table' then
|
||||||
return key(input_type, str)
|
return aux.key(input_type, str)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -262,7 +260,7 @@ function M.parse_filter_string(str)
|
|||||||
local filter, post_filter = T.acquire(), T.acquire()
|
local filter, post_filter = T.acquire(), T.acquire()
|
||||||
local blizzard_filter_parser = blizzard_filter_parser()
|
local blizzard_filter_parser = blizzard_filter_parser()
|
||||||
|
|
||||||
local parts = str and map(split(str, '/'), function(part) return strlower(trim(part)) end) or T.acquire()
|
local parts = str and aux.map(aux.split(str, '/'), function(part) return strlower(aux.trim(part)) end) or T.acquire()
|
||||||
|
|
||||||
local i = 1
|
local i = 1
|
||||||
while parts[i] do
|
while parts[i] do
|
||||||
@@ -341,7 +339,7 @@ function M.query(filter_string)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.queries(filter_string)
|
function M.queries(filter_string)
|
||||||
local parts = split(filter_string, ';')
|
local parts = aux.split(filter_string, ';')
|
||||||
local queries = T.acquire()
|
local queries = T.acquire()
|
||||||
for _, str in ipairs(parts) do
|
for _, str in ipairs(parts) do
|
||||||
local query, _, error = query(str)
|
local query, _, error = query(str)
|
||||||
@@ -357,7 +355,7 @@ end
|
|||||||
function suggestions(filter)
|
function suggestions(filter)
|
||||||
local suggestions = T.acquire()
|
local suggestions = T.acquire()
|
||||||
|
|
||||||
if filter.blizzard.name and size(filter.blizzard) == 1 then tinsert(suggestions, 'exact') end
|
if filter.blizzard.name and aux.size(filter.blizzard) == 1 then tinsert(suggestions, 'exact') end
|
||||||
|
|
||||||
tinsert(suggestions, 'and'); tinsert(suggestions, 'or'); tinsert(suggestions, 'not'); tinsert(suggestions, 'tooltip')
|
tinsert(suggestions, 'and'); tinsert(suggestions, 'or'); tinsert(suggestions, 'not'); tinsert(suggestions, 'tooltip')
|
||||||
|
|
||||||
@@ -370,14 +368,14 @@ function suggestions(filter)
|
|||||||
|
|
||||||
-- subclasses
|
-- subclasses
|
||||||
if not filter.blizzard.subclass then
|
if not filter.blizzard.subclass then
|
||||||
for _, subclass in ipairs(T.temp-T.list(GetAuctionItemSubClasses(index(filter.blizzard.class, 2) or 0))) do
|
for _, subclass in ipairs(T.temp-T.list(GetAuctionItemSubClasses(aux.index(filter.blizzard.class, 2) or 0))) do
|
||||||
tinsert(suggestions, subclass)
|
tinsert(suggestions, subclass)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- slots
|
-- slots
|
||||||
if not filter.blizzard.slot then
|
if not filter.blizzard.slot then
|
||||||
for _, invtype in ipairs(T.temp-T.list(GetAuctionInvTypes(index(filter.blizzard.class, 2) == 2 and 2 or 0, index(filter.blizzard.subclass, 2) or 0))) do
|
for _, invtype in ipairs(T.temp-T.list(GetAuctionInvTypes(aux.index(filter.blizzard.class, 2) == 2 and 2 or 0, aux.index(filter.blizzard.subclass, 2) or 0))) do
|
||||||
tinsert(suggestions, _G[invtype])
|
tinsert(suggestions, _G[invtype])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -427,35 +425,35 @@ function 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(info.item_id(component[3])) or color.orange('[' .. component[3] .. ']'))
|
prettified.append(info.display_name(info.item_id(component[3])) or aux.color.orange('[' .. component[3] .. ']'))
|
||||||
elseif component[3] ~= '' then
|
elseif component[3] ~= '' then
|
||||||
prettified.append(color.label.enabled(component[3]))
|
prettified.append(aux.color.label.enabled(component[3]))
|
||||||
end
|
end
|
||||||
elseif component[2] ~= 'exact' then
|
elseif component[2] ~= 'exact' then
|
||||||
prettified.append(color.orange(component[3]))
|
prettified.append(aux.color.orange(component[3]))
|
||||||
end
|
end
|
||||||
elseif component[1] == 'operator' then
|
elseif component[1] == 'operator' then
|
||||||
prettified.append(color.orange(component[2] .. (component[2] ~= 'not' and tonumber(component[3]) or '')))
|
prettified.append(aux.color.orange(component[2] .. (component[2] ~= 'not' and tonumber(component[3]) or '')))
|
||||||
elseif component[1] == 'filter' then
|
elseif component[1] == 'filter' then
|
||||||
if i == 1 or component[2] ~= 'tooltip' then
|
if i == 1 or component[2] ~= 'tooltip' then
|
||||||
prettified.append(color.orange(component[2]))
|
prettified.append(aux.color.orange(component[2]))
|
||||||
end
|
end
|
||||||
local parameter = component[3]
|
local parameter = component[3]
|
||||||
if parameter then
|
if parameter then
|
||||||
if component[2] == 'item' then
|
if component[2] == 'item' then
|
||||||
prettified.append(info.display_name(info.item_id(parameter)) or color.label.enabled('[' .. parameter .. ']'))
|
prettified.append(info.display_name(info.item_id(parameter)) or aux.color.label.enabled('[' .. parameter .. ']'))
|
||||||
else
|
else
|
||||||
if filters[component[2]].input_type == 'money' then
|
if filters[component[2]].input_type == 'money' then
|
||||||
prettified.append(money.to_string(money.from_string(parameter), nil, true, color.label.enabled))
|
prettified.append(money.to_string(money.from_string(parameter), nil, true, aux.color.label.enabled))
|
||||||
else
|
else
|
||||||
prettified.append(color.label.enabled(parameter))
|
prettified.append(aux.color.label.enabled(parameter))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if prettified.get() == '' then
|
if prettified.get() == '' then
|
||||||
return color.orange'<>'
|
return aux.color.orange'<>'
|
||||||
else
|
else
|
||||||
return prettified.get()
|
return prettified.get()
|
||||||
end
|
end
|
||||||
@@ -466,7 +464,7 @@ function M.quote(name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.unquote(name)
|
function M.unquote(name)
|
||||||
return select(3, strfind(name, '^<(.*)>$')) or name
|
return aux.select(3, strfind(name, '^<(.*)>$')) or name
|
||||||
end
|
end
|
||||||
|
|
||||||
function blizzard_query(filter)
|
function blizzard_query(filter)
|
||||||
@@ -490,7 +488,7 @@ function blizzard_query(filter)
|
|||||||
query.quality = item_info.quality
|
query.quality = item_info.quality
|
||||||
else
|
else
|
||||||
for key in T.temp-T.set('min_level', 'max_level', 'class', 'subclass', 'slot', 'usable', 'quality') do
|
for key in T.temp-T.set('min_level', 'max_level', 'class', 'subclass', 'slot', 'usable', 'quality') do
|
||||||
query[key] = index(filters[key], 2)
|
query[key] = aux.index(filters[key], 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return query
|
return query
|
||||||
@@ -520,15 +518,15 @@ function validator(filter)
|
|||||||
if name == 'not' then
|
if name == 'not' then
|
||||||
tinsert(stack, not args[1])
|
tinsert(stack, not args[1])
|
||||||
elseif name == 'and' then
|
elseif name == 'and' then
|
||||||
tinsert(stack, all(args))
|
tinsert(stack, aux.all(args))
|
||||||
elseif name == 'or' then
|
elseif name == 'or' then
|
||||||
tinsert(stack, any(args))
|
tinsert(stack, aux.any(args))
|
||||||
end
|
end
|
||||||
elseif type == 'filter' then
|
elseif type == 'filter' then
|
||||||
tinsert(stack, not not validators[i](record))
|
tinsert(stack, not not validators[i](record))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return all(stack)
|
return aux.all(stack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+6
-7
@@ -1,8 +1,7 @@
|
|||||||
module 'aux.util.info'
|
module 'aux.util.info'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
|
|
||||||
CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate')
|
CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate')
|
||||||
AuxTooltip:SetScript('OnTooltipAddMoney', function()
|
AuxTooltip:SetScript('OnTooltipAddMoney', function()
|
||||||
@@ -125,8 +124,8 @@ function M.auction(index, query_type)
|
|||||||
'link', link,
|
'link', link,
|
||||||
'itemstring', item_info.itemstring,
|
'itemstring', item_info.itemstring,
|
||||||
'item_key', item_id .. ':' .. suffix_id,
|
'item_key', item_id .. ':' .. suffix_id,
|
||||||
'search_signature', join(T.temp-T.list(item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
'search_signature', aux.join(T.temp-T.list(item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
||||||
'sniping_signature', join(T.temp-T.list(item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
'sniping_signature', aux.join(T.temp-T.list(item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
||||||
|
|
||||||
'name', name,
|
'name', name,
|
||||||
'texture', texture,
|
'texture', texture,
|
||||||
@@ -170,7 +169,7 @@ function M.bid_update(auction_record)
|
|||||||
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
|
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
|
||||||
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
|
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
|
||||||
auction_record.high_bidder = 1
|
auction_record.high_bidder = 1
|
||||||
auction_record.search_signature = join(T.temp-T.list(auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')), ':')
|
auction_record.search_signature = aux.join(T.temp-T.list(auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')), ':')
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.set_tooltip(itemstring, owner, anchor)
|
function M.set_tooltip(itemstring, owner, anchor)
|
||||||
@@ -210,7 +209,7 @@ function M.set_shopping_tooltip(slot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.tooltip_match(entry, tooltip)
|
function M.tooltip_match(entry, tooltip)
|
||||||
return any(tooltip, function(line)
|
return aux.any(tooltip, function(line)
|
||||||
local left_match = line.left_text and strupper(line.left_text) == strupper(entry)
|
local left_match = line.left_text and strupper(line.left_text) == strupper(entry)
|
||||||
local right_match = line.right_text and strupper(line.right_text) == strupper(entry)
|
local right_match = line.right_text and strupper(line.right_text) == strupper(entry)
|
||||||
return left_match or right_match
|
return left_match or right_match
|
||||||
@@ -254,7 +253,7 @@ function M.display_name(item_id, no_brackets, no_color)
|
|||||||
name = '[' .. name .. ']'
|
name = '[' .. name .. ']'
|
||||||
end
|
end
|
||||||
if not no_color then
|
if not no_color then
|
||||||
name = select(4, GetItemQualityColor(item_info.quality)) .. name .. FONT_COLOR_CODE_CLOSE
|
name = aux.select(4, GetItemQualityColor(item_info.quality)) .. name .. FONT_COLOR_CODE_CLOSE
|
||||||
end
|
end
|
||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
|
|||||||
+6
-7
@@ -1,8 +1,7 @@
|
|||||||
module 'aux.util.money'
|
module 'aux.util.money'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
|
|
||||||
M.GOLD_TEXT = '|cffffd70ag|r'
|
M.GOLD_TEXT = '|cffffd70ag|r'
|
||||||
M.SILVER_TEXT = '|cffc7c7cfs|r'
|
M.SILVER_TEXT = '|cffc7c7cfs|r'
|
||||||
@@ -35,7 +34,7 @@ function M.to_string2(money, exact, color)
|
|||||||
local NONE = '|cffa0a0a0' .. TEXT_NONE .. FONT_COLOR_CODE_CLOSE
|
local NONE = '|cffa0a0a0' .. TEXT_NONE .. FONT_COLOR_CODE_CLOSE
|
||||||
|
|
||||||
if not exact and money >= COPPER_PER_GOLD then
|
if not exact and money >= COPPER_PER_GOLD then
|
||||||
money = round(money / COPPER_PER_SILVER) * COPPER_PER_SILVER
|
money = aux.round(money / COPPER_PER_SILVER) * COPPER_PER_SILVER
|
||||||
end
|
end
|
||||||
local g, s, c = to_gsc(money)
|
local g, s, c = to_gsc(money)
|
||||||
|
|
||||||
@@ -83,7 +82,7 @@ function M.to_string(money, pad, trim, color, no_color)
|
|||||||
if copper > 0 or gold == 0 and silver == 0 then
|
if copper > 0 or gold == 0 and silver == 0 then
|
||||||
tinsert(parts, format_number(copper, pad, color) .. copper_text)
|
tinsert(parts, format_number(copper, pad, color) .. copper_text)
|
||||||
end
|
end
|
||||||
text = join(parts, ' ')
|
text = aux.join(parts, ' ')
|
||||||
else
|
else
|
||||||
if gold > 0 then
|
if gold > 0 then
|
||||||
text = format_number(gold, false, color) .. gold_text .. ' ' .. format_number(silver, pad, color) .. silver_text .. ' ' .. format_number(copper, pad, color) .. copper_text
|
text = format_number(gold, false, color) .. gold_text .. ' ' .. format_number(silver, pad, color) .. silver_text .. ' ' .. format_number(copper, pad, color) .. copper_text
|
||||||
@@ -109,9 +108,9 @@ function M.from_string(value)
|
|||||||
|
|
||||||
value = gsub(gsub(strlower(value), '|c%x%x%x%x%x%x%x%x', ''), FONT_COLOR_CODE_CLOSE, '')
|
value = gsub(gsub(strlower(value), '|c%x%x%x%x%x%x%x%x', ''), FONT_COLOR_CODE_CLOSE, '')
|
||||||
|
|
||||||
local gold = tonumber(select(3, strfind(value, '(%d*%.?%d+)g')))
|
local gold = tonumber(aux.select(3, strfind(value, '(%d*%.?%d+)g')))
|
||||||
local silver = tonumber(select(3, strfind(value, '(%d*%.?%d+)s')))
|
local silver = tonumber(aux.select(3, strfind(value, '(%d*%.?%d+)s')))
|
||||||
local copper = tonumber(select(3, strfind(value, '(%d*%.?%d+)c')))
|
local copper = tonumber(aux.select(3, strfind(value, '(%d*%.?%d+)c')))
|
||||||
if not gold and not silver and not copper then return end
|
if not gold and not silver and not copper then return end
|
||||||
|
|
||||||
value = gsub(value, '%d*%.?%d+g', '', 1)
|
value = gsub(value, '%d*%.?%d+g', '', 1)
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
module 'aux.util.persistence'
|
module 'aux.util.persistence'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
|
|
||||||
function M.read(schema, str)
|
function M.read(schema, str)
|
||||||
if schema == 'string' then
|
if schema == 'string' then
|
||||||
@@ -40,7 +39,7 @@ function read_list(schema, str)
|
|||||||
if str == '' then return T.acquire() end
|
if str == '' then return T.acquire() end
|
||||||
local separator = schema[2]
|
local separator = schema[2]
|
||||||
local element_type = schema[3]
|
local element_type = schema[3]
|
||||||
return map(split(str, separator), function(part)
|
return aux.map(aux.split(str, separator), function(part)
|
||||||
return read(element_type, part)
|
return read(element_type, part)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -48,16 +47,16 @@ end
|
|||||||
function write_list(schema, list)
|
function write_list(schema, list)
|
||||||
local separator = schema[2]
|
local separator = schema[2]
|
||||||
local element_type = schema[3]
|
local element_type = schema[3]
|
||||||
local parts = map(T.temp-copy(list), function(element)
|
local parts = aux.map(T.temp-aux.copy(list), function(element)
|
||||||
return write(element_type, element)
|
return write(element_type, element)
|
||||||
end)
|
end)
|
||||||
return join(parts, separator)
|
return aux.join(parts, separator)
|
||||||
end
|
end
|
||||||
|
|
||||||
function read_tuple(schema, str)
|
function read_tuple(schema, str)
|
||||||
local separator = schema[2]
|
local separator = schema[2]
|
||||||
local tuple = T.acquire()
|
local tuple = T.acquire()
|
||||||
local parts = T.temp-split(str, separator)
|
local parts = T.temp-aux.split(str, separator)
|
||||||
for i = 3, getn(schema) do
|
for i = 3, getn(schema) do
|
||||||
local key, type = next(schema[i])
|
local key, type = next(schema[i])
|
||||||
tuple[key] = read(type, parts[i - 2])
|
tuple[key] = read(type, parts[i - 2])
|
||||||
@@ -72,5 +71,5 @@ function write_tuple(schema, tuple)
|
|||||||
local key, type = next(schema[i])
|
local key, type = next(schema[i])
|
||||||
tinsert(parts, write(type, tuple[key]))
|
tinsert(parts, write(type, tuple[key]))
|
||||||
end
|
end
|
||||||
return join(parts, separator)
|
return aux.join(parts, separator)
|
||||||
end
|
end
|
||||||
+4
-6
@@ -1,9 +1,7 @@
|
|||||||
module 'aux.util.scan'
|
module 'aux.util.scan'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
local aux = require 'aux'
|
||||||
local info = require 'aux.util.info'
|
local info = require 'aux.util.info'
|
||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
local scan = require 'aux.core.scan'
|
local scan = require 'aux.core.scan'
|
||||||
@@ -18,20 +16,20 @@ function M.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
|||||||
local queries = T.list(T.acquire())
|
local queries = T.list(T.acquire())
|
||||||
|
|
||||||
if auction_record.blizzard_query then
|
if auction_record.blizzard_query then
|
||||||
local blizzard_query1 = copy(auction_record.blizzard_query)
|
local blizzard_query1 = aux.copy(auction_record.blizzard_query)
|
||||||
blizzard_query1.first_page = auction_record.page
|
blizzard_query1.first_page = auction_record.page
|
||||||
blizzard_query1.last_page = auction_record.page
|
blizzard_query1.last_page = auction_record.page
|
||||||
tinsert(queries, T.map('blizzard_query', blizzard_query1))
|
tinsert(queries, T.map('blizzard_query', blizzard_query1))
|
||||||
|
|
||||||
if auction_record.page > 0 then
|
if auction_record.page > 0 then
|
||||||
local blizzard_query2 = copy(auction_record.blizzard_query)
|
local blizzard_query2 = aux.copy(auction_record.blizzard_query)
|
||||||
blizzard_query2.first_page = auction_record.page - 1
|
blizzard_query2.first_page = auction_record.page - 1
|
||||||
blizzard_query2.last_page = auction_record.page - 1
|
blizzard_query2.last_page = auction_record.page - 1
|
||||||
tinsert(queries, T.map('blizzard_query', blizzard_query2))
|
tinsert(queries, T.map('blizzard_query', blizzard_query2))
|
||||||
end
|
end
|
||||||
|
|
||||||
local item_query = item_query(auction_record.item_id, 0, 0)
|
local item_query = item_query(auction_record.item_id, 0, 0)
|
||||||
if not eq(auction_record.blizzard_query, item_query.blizzard_query) then
|
if not aux.eq(auction_record.blizzard_query, item_query.blizzard_query) then
|
||||||
tinsert(queries, item_query)
|
tinsert(queries, item_query)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
module 'aux.util.sort'
|
module 'aux.util.sort'
|
||||||
|
|
||||||
include 'aux'
|
|
||||||
|
|
||||||
local T = require 'T'
|
local T = require 'T'
|
||||||
|
|
||||||
M.EQ = 0
|
M.EQ = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user