big refactoring
This commit is contained in:
+20
-20
@@ -16,17 +16,17 @@ g.aux_characters = {}
|
||||
function LOAD()
|
||||
scan_wdb()
|
||||
|
||||
aux.control.event_listener('MERCHANT_SHOW', on_merchant_show)
|
||||
aux.control.event_listener('MERCHANT_CLOSED', on_merchant_closed)
|
||||
aux.control.event_listener('MERCHANT_UPDATE', on_merchant_update)
|
||||
aux.control.event_listener('BAG_UPDATE', on_bag_update)
|
||||
control.event_listener('MERCHANT_SHOW', on_merchant_show)
|
||||
control.event_listener('MERCHANT_CLOSED', on_merchant_closed)
|
||||
control.event_listener('MERCHANT_UPDATE', on_merchant_update)
|
||||
control.event_listener('BAG_UPDATE', on_bag_update)
|
||||
|
||||
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', merchant_on_update)
|
||||
|
||||
aux.control.event_listener('NEW_AUCTION_UPDATE', function()
|
||||
for _, info in {aux.info.auction_sell_item()} do
|
||||
for _, item_id in {aux.cache.item_id(info.name)} do
|
||||
g.aux_merchant_sell[aux.cache.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count)
|
||||
control.event_listener('NEW_AUCTION_UPDATE', function()
|
||||
for _, info in {info.auction_sell_item()} do
|
||||
for _, item_id in {cache.item_id(info.name)} do
|
||||
g.aux_merchant_sell[cache.item_id(info.name)] = info.vendor_price / (info.max_item_charges(item_id) or info.count)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -79,7 +79,7 @@ end
|
||||
function public.merchant_info(item_id)
|
||||
local buy_info
|
||||
if g.aux_merchant_buy[item_id] then
|
||||
buy_info = aux.persistence.read(merchant_buy_schema, g.aux_merchant_buy[item_id])
|
||||
buy_info = persistence.read(merchant_buy_schema, g.aux_merchant_buy[item_id])
|
||||
end
|
||||
|
||||
return g.aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
|
||||
@@ -88,7 +88,7 @@ end
|
||||
function public.item_info(item_id)
|
||||
local data_string = g.aux_items[item_id]
|
||||
if data_string then
|
||||
local cached_data = aux.persistence.read(items_schema, data_string)
|
||||
local cached_data = persistence.read(items_schema, data_string)
|
||||
return {
|
||||
name = cached_data.name,
|
||||
itemstring = 'item:'..item_id..':0:0:0',
|
||||
@@ -114,10 +114,10 @@ function merchant_buy_scan()
|
||||
local _, _, price, count, stock = GetMerchantItemInfo(i)
|
||||
local link = GetMerchantItemLink(i)
|
||||
if link then
|
||||
local item_id = aux.info.parse_link(link)
|
||||
local item_id = info.parse_link(link)
|
||||
local new_unit_price, new_limited = price / count, stock >= 0
|
||||
if g.aux_merchant_buy[item_id] then
|
||||
local buy_info = aux.persistence.read(merchant_buy_schema, g.aux_merchant_buy[item_id])
|
||||
local buy_info = persistence.read(merchant_buy_schema, g.aux_merchant_buy[item_id])
|
||||
|
||||
local unit_price
|
||||
if buy_info.limited and not new_limited then
|
||||
@@ -128,12 +128,12 @@ function merchant_buy_scan()
|
||||
unit_price = min(buy_info.unit_price, new_unit_price)
|
||||
end
|
||||
|
||||
g.aux_merchant_buy[item_id] = aux.persistence.write(merchant_buy_schema, {
|
||||
g.aux_merchant_buy[item_id] = persistence.write(merchant_buy_schema, {
|
||||
unit_price = unit_price,
|
||||
limited = buy_info.limited and new_limited,
|
||||
})
|
||||
else
|
||||
g.aux_merchant_buy[item_id] = aux.persistence.write(merchant_buy_schema, {
|
||||
g.aux_merchant_buy[item_id] = persistence.write(merchant_buy_schema, {
|
||||
unit_price = new_unit_price,
|
||||
limited = new_limited,
|
||||
})
|
||||
@@ -148,7 +148,7 @@ end
|
||||
|
||||
function merchant_sell_scan()
|
||||
for slot in inventory do
|
||||
local item_info = aux.info.container_item(unpack(slot))
|
||||
local item_info = info.container_item(unpack(slot))
|
||||
if item_info then
|
||||
g.aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
|
||||
end
|
||||
@@ -164,7 +164,7 @@ function scan_wdb(item_id)
|
||||
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
|
||||
if name and not g.aux_item_ids[strlower(name)] then
|
||||
g.aux_item_ids[strlower(name)] = item_id
|
||||
g.aux_items[item_id] = aux.persistence.write(items_schema, {
|
||||
g.aux_items[item_id] = persistence.write(items_schema, {
|
||||
name = name,
|
||||
quality = quality,
|
||||
level = level,
|
||||
@@ -174,8 +174,8 @@ function scan_wdb(item_id)
|
||||
max_stack = max_stack,
|
||||
texture = texture,
|
||||
})
|
||||
local tooltip = aux.info.tooltip(function(tt) tt:SetHyperlink(itemstring) end)
|
||||
if aux.info.auctionable(tooltip, quality) then
|
||||
local tooltip = info.tooltip(function(tt) tt:SetHyperlink(itemstring) end)
|
||||
if info.auctionable(tooltip, quality) then
|
||||
tinsert(g.aux_auctionable_items, strlower(name))
|
||||
end
|
||||
processed = processed + 1
|
||||
@@ -185,7 +185,7 @@ function scan_wdb(item_id)
|
||||
|
||||
if item_id <= MAX_ITEM_ID then
|
||||
local t0 = GetTime()
|
||||
aux.control.thread(aux.control.when, function() return GetTime() - t0 > 0.1 end, scan_wdb, item_id)
|
||||
control.thread(control.when, function() return GetTime() - t0 > 0.1 end, scan_wdb, item_id)
|
||||
else
|
||||
sort(g.aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
|
||||
end
|
||||
@@ -204,5 +204,5 @@ function public.populate_wdb(item_id)
|
||||
AuxTooltip:SetHyperlink('item:'..item_id)
|
||||
end
|
||||
|
||||
aux.control.thread(populate_wdb, item_id + 1)
|
||||
control.thread(populate_wdb, item_id + 1)
|
||||
end
|
||||
@@ -73,7 +73,7 @@ end
|
||||
function public.value(slot, quality, level)
|
||||
local expectation
|
||||
for _, event in m.distribution(slot, quality, level) do
|
||||
local value = aux.history.value(event.item_id..':'..0)
|
||||
local value = history.value(event.item_id..':'..0)
|
||||
if not value then
|
||||
return
|
||||
else
|
||||
|
||||
@@ -14,7 +14,7 @@ function new_record()
|
||||
end
|
||||
|
||||
function load_data()
|
||||
local dataset = aux.persistence.load_dataset()
|
||||
local dataset = persistence.load_dataset()
|
||||
dataset.history = dataset.history or {}
|
||||
return dataset.history
|
||||
end
|
||||
@@ -24,7 +24,7 @@ function read_record(item_key)
|
||||
|
||||
local record
|
||||
if data[item_key] then
|
||||
record = aux.persistence.read(history_schema, data[item_key])
|
||||
record = persistence.read(history_schema, data[item_key])
|
||||
else
|
||||
record = m.new_record()
|
||||
end
|
||||
@@ -40,7 +40,7 @@ end
|
||||
function write_record(item_key, record)
|
||||
m.value_cache[item_key] = nil
|
||||
local data = m.load_data()
|
||||
data[item_key] = aux.persistence.write(history_schema, record)
|
||||
data[item_key] = persistence.write(history_schema, record)
|
||||
end
|
||||
|
||||
function public.process_auction(auction_record)
|
||||
|
||||
+8
-8
@@ -8,7 +8,7 @@ function process()
|
||||
local stacking_complete
|
||||
|
||||
local send_signal, signal_received = signal()
|
||||
aux.control.when(signal_received, function()
|
||||
control.when(signal_received, function()
|
||||
local slot = signal_received()[1]
|
||||
if slot then
|
||||
return m.post_auction(slot, m.process)
|
||||
@@ -17,15 +17,15 @@ function process()
|
||||
end
|
||||
end)
|
||||
|
||||
return aux.stack.start(m.state.item_key, m.state.stack_size, send_signal)
|
||||
return stack.start(m.state.item_key, m.state.stack_size, send_signal)
|
||||
end
|
||||
|
||||
return m.stop()
|
||||
end
|
||||
|
||||
function post_auction(slot, k)
|
||||
local item_info = aux.info.container_item(unpack(slot))
|
||||
if item_info.item_key == m.state.item_key and aux.info.auctionable(item_info.tooltip) and item_info.aux_quantity == m.state.stack_size then
|
||||
local item_info = info.container_item(unpack(slot))
|
||||
if item_info.item_key == m.state.item_key and info.auctionable(item_info.tooltip) and item_info.aux_quantity == m.state.stack_size then
|
||||
|
||||
ClearCursor()
|
||||
ClickAuctionSellItemButton()
|
||||
@@ -37,13 +37,13 @@ function post_auction(slot, k)
|
||||
StartAuction(max(1, round(m.state.unit_start_price * item_info.aux_quantity)), round(m.state.unit_buyout_price * item_info.aux_quantity), m.state.duration)
|
||||
|
||||
local send_signal, signal_received = signal()
|
||||
aux.control.when(signal_received, function()
|
||||
control.when(signal_received, function()
|
||||
m.state.posted = m.state.posted + 1
|
||||
return k()
|
||||
end)
|
||||
|
||||
local posted
|
||||
aux.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_STARTED then
|
||||
send_signal()
|
||||
kill()
|
||||
@@ -56,7 +56,7 @@ end
|
||||
|
||||
function public.stop()
|
||||
if m.state then
|
||||
aux.control.kill_thread(m.state.thread_id)
|
||||
control.kill_thread(m.state.thread_id)
|
||||
|
||||
local callback = m.state.callback
|
||||
local posted = m.state.posted
|
||||
@@ -72,7 +72,7 @@ end
|
||||
function public.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, callback)
|
||||
m.stop()
|
||||
|
||||
local thread_id = aux.control.thread(m.process)
|
||||
local thread_id = control.thread(m.process)
|
||||
|
||||
m.state = {
|
||||
thread_id = thread_id,
|
||||
|
||||
+18
-18
@@ -9,7 +9,7 @@ do
|
||||
for _, old_state in {scan_states[params.type]} do
|
||||
abort(old_state.id)
|
||||
end
|
||||
local thread_id = aux.control.thread(L(wait_for_callback, params.on_scan_start, scan))
|
||||
local thread_id = control.thread(L(wait_for_callback, params.on_scan_start, scan))
|
||||
scan_states[params.type] = {
|
||||
id = thread_id,
|
||||
params = params,
|
||||
@@ -21,7 +21,7 @@ do
|
||||
local aborted = {}
|
||||
for type, state in scan_states do
|
||||
if not scan_id or state.id == scan_id then
|
||||
aux.control.kill_thread(state.id)
|
||||
control.kill_thread(state.id)
|
||||
scan_states[type] = nil
|
||||
tinsert(aborted, state)
|
||||
end
|
||||
@@ -38,7 +38,7 @@ do
|
||||
end
|
||||
|
||||
function accessor.state()
|
||||
local _, state = next(filter(scan_states, function(state) return state.id == aux.control.thread_id end))
|
||||
local _, state = next(filter(scan_states, function(state) return state.id == control.thread_id end))
|
||||
return state
|
||||
end
|
||||
end
|
||||
@@ -66,7 +66,7 @@ function wait_for_callback(...)
|
||||
send_signal()
|
||||
end
|
||||
|
||||
return aux.control.when(signal_received, function() return k(unpack(signal_received())) end)
|
||||
return control.when(signal_received, function() return k(unpack(signal_received())) end)
|
||||
end
|
||||
|
||||
function total_pages(total_auctions)
|
||||
@@ -102,7 +102,7 @@ function process_query()
|
||||
end
|
||||
|
||||
function submit_query()
|
||||
aux.control.when(function() return state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
|
||||
control.when(function() return state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
|
||||
call(state.params.on_submit_query)
|
||||
state.last_query_time = GetTime()
|
||||
if state.params.type == 'bidder' then
|
||||
@@ -144,20 +144,20 @@ function scan_page(i)
|
||||
end
|
||||
end
|
||||
|
||||
local auction_info = aux.info.auction(i, state.params.type)
|
||||
local auction_info = info.auction(i, state.params.type)
|
||||
if auction_info and (auction_info.owner or state.params.ignore_owner or g.aux_ignore_owner) then
|
||||
auction_info.index = i
|
||||
auction_info.page = state.page
|
||||
auction_info.blizzard_query = query.blizzard_query
|
||||
auction_info.query_type = state.params.type
|
||||
|
||||
aux.history.process_auction(auction_info)
|
||||
history.process_auction(auction_info)
|
||||
|
||||
if call(state.params.auto_buy_validator, auction_info) then
|
||||
local send_signal, signal_received = signal()
|
||||
aux.control.when(signal_received, recurse)
|
||||
aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, L(send_signal, true))
|
||||
return aux.control.thread(aux.control.when, later(GetTime(), 10), L(send_signal, false))
|
||||
control.when(signal_received, recurse)
|
||||
place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, L(send_signal, true))
|
||||
return control.thread(control.when, later(GetTime(), 10), L(send_signal, false))
|
||||
elseif not query.validator or query.validator(auction_info) then
|
||||
return wait_for_callback(state.params.on_auction, auction_info, function(removed)
|
||||
if removed then
|
||||
@@ -175,7 +175,7 @@ end
|
||||
function wait_for_results()
|
||||
local timeout = later(state.last_query_time, 10)
|
||||
local send_signal, signal_received = signal()
|
||||
aux.control.when(signal_received, function()
|
||||
control.when(signal_received, function()
|
||||
if timeout() then
|
||||
return submit_query()
|
||||
else
|
||||
@@ -190,10 +190,10 @@ function wait_for_results()
|
||||
end
|
||||
end)
|
||||
|
||||
aux.control.thread(aux.control.when, timeout, send_signal)
|
||||
control.thread(control.when, timeout, send_signal)
|
||||
|
||||
if state.params.type == 'bidder' then
|
||||
return aux.control.thread(aux.control.when, function() return aux.bids_loaded end, send_signal)
|
||||
return control.thread(control.when, function() return bids_loaded end, send_signal)
|
||||
elseif state.params.type == 'owner' then
|
||||
return wait_for_owner_results(send_signal)
|
||||
elseif state.params.type == 'list' then
|
||||
@@ -202,22 +202,22 @@ function wait_for_results()
|
||||
end
|
||||
|
||||
function wait_for_owner_results(send_signal)
|
||||
if state.page == aux.current_owner_page then
|
||||
if state.page == current_owner_page then
|
||||
return send_signal()
|
||||
else
|
||||
return aux.control.on_next_event('AUCTION_OWNED_LIST_UPDATE', send_signal)
|
||||
return control.on_next_event('AUCTION_OWNED_LIST_UPDATE', send_signal)
|
||||
end
|
||||
end
|
||||
|
||||
function wait_for_list_results(send_signal, signal_received)
|
||||
local updated, last_update
|
||||
aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill)
|
||||
control.event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill)
|
||||
kill(signal_received())
|
||||
last_update = GetTime()
|
||||
updated = true
|
||||
end)
|
||||
local ignore_owner = state.params.ignore_owner or g.aux_ignore_owner
|
||||
return aux.control.thread(aux.control.when, function()
|
||||
return control.thread(control.when, function()
|
||||
-- short circuiting order important, owner_data_complete must be called iif an update has happened.
|
||||
local ok = updated and (ignore_owner or owner_data_complete('list')) or last_update and GetTime() - last_update > 5
|
||||
updated = false
|
||||
@@ -227,7 +227,7 @@ end
|
||||
|
||||
function owner_data_complete(type)
|
||||
for i=1,PAGE_SIZE do
|
||||
local auction_info = aux.info.auction(i, type)
|
||||
local auction_info = info.auction(i, type)
|
||||
if auction_info and not auction_info.owner then
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -3,10 +3,10 @@ function SlashCmdList.AUX(command)
|
||||
if not command then return end
|
||||
local arguments = tokenize(command)
|
||||
if arguments[1] == 'clear' and arguments[2] == 'history' then
|
||||
aux.persistence.load_dataset().history = nil
|
||||
persistence.load_dataset().history = nil
|
||||
log 'History cleared.'
|
||||
elseif arguments[1] == 'clear' and arguments[2] == 'post' then
|
||||
aux.persistence.load_dataset().post = nil
|
||||
persistence.load_dataset().post = nil
|
||||
log 'Post settings cleared.'
|
||||
elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then
|
||||
g.aux_datasets = {}
|
||||
@@ -23,7 +23,7 @@ function SlashCmdList.AUX(command)
|
||||
g.aux_auctionable_items = {}
|
||||
log 'Item cache cleared.'
|
||||
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
|
||||
aux.cache.populate_wdb()
|
||||
cache.populate_wdb()
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
|
||||
g.aux_tooltip_value = not g.aux_tooltip_value
|
||||
log('Historical value in tooltip '..(g.aux_tooltip_value and 'enabled' or 'disabled')..'.')
|
||||
|
||||
+10
-10
@@ -3,22 +3,22 @@ aux.module 'stack'
|
||||
state = nil
|
||||
|
||||
function stack_size(slot)
|
||||
local container_item_info = aux.info.container_item(unpack(slot))
|
||||
local container_item_info = info.container_item(unpack(slot))
|
||||
return container_item_info and container_item_info.count or 0
|
||||
end
|
||||
|
||||
function charges(slot)
|
||||
local container_item_info = aux.info.container_item(unpack(slot))
|
||||
local container_item_info = info.container_item(unpack(slot))
|
||||
return container_item_info and container_item_info.charges
|
||||
end
|
||||
|
||||
function max_stack(slot)
|
||||
local container_item_info = aux.info.container_item(unpack(slot))
|
||||
local container_item_info = info.container_item(unpack(slot))
|
||||
return container_item_info and container_item_info.max_stack
|
||||
end
|
||||
|
||||
function locked(slot)
|
||||
local container_item_info = aux.info.container_item(unpack(slot))
|
||||
local container_item_info = info.container_item(unpack(slot))
|
||||
return container_item_info and container_item_info.locked
|
||||
end
|
||||
|
||||
@@ -31,8 +31,8 @@ function find_item_slot(partial)
|
||||
end
|
||||
|
||||
function matching_item(slot, partial)
|
||||
local item_info = aux.info.container_item(unpack(slot))
|
||||
return item_info and item_info.item_key == m.state.item_key and aux.info.auctionable(item_info.tooltip) and (not partial or item_info.count < item_info.max_stack)
|
||||
local item_info = info.container_item(unpack(slot))
|
||||
return item_info and item_info.item_key == m.state.item_key and info.auctionable(item_info.tooltip) and (not partial or item_info.count < item_info.max_stack)
|
||||
end
|
||||
|
||||
function find_empty_slot()
|
||||
@@ -53,7 +53,7 @@ end
|
||||
|
||||
function move_item(from_slot, to_slot, amount, k)
|
||||
if m.locked(from_slot) or m.locked(to_slot) then
|
||||
return aux.control.wait(k)
|
||||
return control.wait(k)
|
||||
end
|
||||
|
||||
amount = min(m.max_stack(from_slot) - m.stack_size(to_slot), m.stack_size(from_slot), amount)
|
||||
@@ -63,7 +63,7 @@ function move_item(from_slot, to_slot, amount, k)
|
||||
SplitContainerItem(from_slot[1], from_slot[2], amount)
|
||||
PickupContainerItem(unpack(to_slot))
|
||||
|
||||
return aux.control.when(function() return m.stack_size(to_slot) == expected_size end, k)
|
||||
return control.when(function() return m.stack_size(to_slot) == expected_size end, k)
|
||||
end
|
||||
|
||||
function process()
|
||||
@@ -105,7 +105,7 @@ end
|
||||
|
||||
function public.stop()
|
||||
if m.state then
|
||||
aux.control.kill_thread(m.state.thread_id)
|
||||
control.kill_thread(m.state.thread_id)
|
||||
local callback, slot = m.state.callback, m.state.target_slot
|
||||
if slot and not m.matching_item(slot) then
|
||||
slot = nil
|
||||
@@ -118,7 +118,7 @@ end
|
||||
function public.start(item_key, size, callback)
|
||||
m.stop()
|
||||
|
||||
local thread_id = aux.control.thread(m.process)
|
||||
local thread_id = control.thread(m.process)
|
||||
m.state = {
|
||||
thread_id = thread_id,
|
||||
item_key = item_key,
|
||||
|
||||
+20
-20
@@ -9,12 +9,12 @@ game_tooltip_money = nil
|
||||
function LOAD()
|
||||
for func, hook in game_tooltip_hooks do
|
||||
local func, hook = func, hook
|
||||
aux.hook(
|
||||
hook(
|
||||
func,
|
||||
function(...)
|
||||
hooked_setter = true
|
||||
game_tooltip_money = 0
|
||||
local results = {aux.orig[GameTooltip][func](unpack(arg)) }
|
||||
local results = {orig[GameTooltip][func](unpack(arg)) }
|
||||
hooked_setter = false
|
||||
hook(unpack(arg))
|
||||
return unpack(results)
|
||||
@@ -44,13 +44,13 @@ function LOAD()
|
||||
end
|
||||
|
||||
function extend_tooltip(tooltip, link, quantity)
|
||||
local item_id, suffix_id = aux.info.parse_link(link)
|
||||
local item_id, suffix_id = info.parse_link(link)
|
||||
quantity = IsShiftKeyDown() and quantity or 1
|
||||
|
||||
if g.aux_tooltip_disenchant_source then
|
||||
local color = {r=0.7, g=0.7, b=0.7}
|
||||
|
||||
local type, range = aux.disenchant.source(item_id)
|
||||
local type, range = disenchant.source(item_id)
|
||||
|
||||
if type == 'CRYSTAL' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cffa335eeEpic|r and |cff0070ddRare|r items.', range), color.r, color.g, color.b, true)
|
||||
@@ -63,9 +63,9 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
end
|
||||
end
|
||||
|
||||
local item_info = aux.info.item(item_id)
|
||||
local item_info = info.item(item_id)
|
||||
if item_info then
|
||||
local distribution = aux.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
|
||||
|
||||
@@ -75,15 +75,15 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
|
||||
sort(distribution, function(a,b) return a.probability > b.probability end)
|
||||
for _, event in distribution do
|
||||
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, aux.info.display_name(event.item_id, true) or 'item:'..event.item_id, event.min_quantity, event.max_quantity), color.r, color.g, color.b)
|
||||
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.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
if g.aux_tooltip_disenchant_value then
|
||||
local color = {r=0.1, g=0.6, b=0.6}
|
||||
|
||||
local disenchant_value = aux.disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and aux.money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -91,33 +91,33 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
if g.aux_tooltip_vendor_buy then
|
||||
local color = {r=0.8, g=0.5, b=0.1}
|
||||
|
||||
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||
local _, price, limited = cache.merchant_info(item_id)
|
||||
if price then
|
||||
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..aux.money.to_string2(price * quantity), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..money.to_string2(price * quantity), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
if g.aux_tooltip_vendor_sell then
|
||||
local color = {r=0.8, g=0.5, b=0.1}
|
||||
|
||||
local price = aux.cache.merchant_info(item_id)
|
||||
local price = cache.merchant_info(item_id)
|
||||
if price ~= 0 then
|
||||
tooltip:AddLine('Vendor Sell: '..(price and aux.money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Vendor Sell: '..(price and money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
local color = {r=1, g=1, b=0.6}
|
||||
|
||||
local auctionable = not item_info or aux.info.auctionable(aux.info.tooltip(function(tt) tt:SetHyperlink(item_info.itemstring) end), item_info.quality)
|
||||
local auctionable = not item_info or info.auctionable(info.tooltip(function(tt) tt:SetHyperlink(item_info.itemstring) end), item_info.quality)
|
||||
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
||||
|
||||
local value = aux.history.value(item_key)
|
||||
local value = history.value(item_key)
|
||||
if auctionable then
|
||||
if g.aux_tooltip_value then
|
||||
tooltip:AddLine('Value: '..(value and aux.money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Value: '..(value and money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
if g.aux_tooltip_daily then
|
||||
local market_value = aux.history.market_value(item_key)
|
||||
tooltip:AddLine('Today: '..(market_value and aux.money.to_string2(market_value * quantity)..' ('..aux.auction_listing.percentage_historical(round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
local market_value = history.market_value(item_key)
|
||||
tooltip:AddLine('Today: '..(market_value and money.to_string2(market_value * quantity)..' ('..auction_listing.percentage_historical(round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -179,7 +179,7 @@ end
|
||||
function game_tooltip_hooks:SetInboxItem(index)
|
||||
local name, _, quantity = GetInboxItem(index)
|
||||
|
||||
local id = name and aux.cache.item_id(name)
|
||||
local id = name and cache.item_id(name)
|
||||
if id then
|
||||
local _, itemstring, quality = GetItemInfo(id)
|
||||
local _, _, _, hex = GetItemQualityColor(tonumber(quality))
|
||||
@@ -243,7 +243,7 @@ function game_tooltip_hooks:SetAuctionSellItem()
|
||||
if name then
|
||||
for slot in inventory do
|
||||
local link = GetContainerItemLink(unpack(slot))
|
||||
if link and ({aux.info.parse_link(link)})[5] == name then
|
||||
if link and ({info.parse_link(link)})[5] == name then
|
||||
extend_tooltip(GameTooltip, link, quantity)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -2,25 +2,6 @@ aux.module 'core'
|
||||
|
||||
public.bids_loaded = false
|
||||
public.current_owner_page = nil
|
||||
public.last_owner_page_requested = nil
|
||||
|
||||
tabs = {}
|
||||
function public.tab(index, name)
|
||||
local module_env = getfenv(2)
|
||||
local tab = {name=name, env=module_env}
|
||||
module_env.public.ACTIVE = function() return tab == active_tab end
|
||||
for handler in temp-set{'OPEN', 'CLOSE', 'CLICK_LINK', 'USE_ITEM'} do module_env.mutable[handler] = nil end
|
||||
tabs[index] = tab
|
||||
end
|
||||
do
|
||||
local active_tab_index
|
||||
function accessor.active_tab() return tabs[active_tab_index] end
|
||||
function on_tab_click(index)
|
||||
call(active_tab_index and active_tab.env.CLOSE)
|
||||
active_tab_index = index
|
||||
call(active_tab_index and active_tab.env.OPEN)
|
||||
end
|
||||
end
|
||||
|
||||
function LOAD()
|
||||
do
|
||||
@@ -72,6 +53,99 @@ function LOAD()
|
||||
end
|
||||
end
|
||||
|
||||
function public.log(...)
|
||||
local msg = '[aux]'
|
||||
for i=1,arg.n do msg = msg..' '..tostring(arg[i]) end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE..msg)
|
||||
end
|
||||
|
||||
tabs = {}
|
||||
function public.tab(index, name)
|
||||
local module_env = getfenv(2)
|
||||
local tab = {name=name, env=module_env}
|
||||
module_env.public.accessor.ACTIVE = function() return tab == active_tab end
|
||||
for _, handler in temp-{'OPEN', 'CLOSE', 'CLICK_LINK', 'USE_ITEM'} do module_env.mutable[handler] = nil end
|
||||
tabs[index] = tab
|
||||
end
|
||||
do
|
||||
local active_tab_index
|
||||
function accessor.active_tab() return tabs[active_tab_index] end
|
||||
function on_tab_click(index)
|
||||
call(active_tab_index and active_tab.env.CLOSE)
|
||||
active_tab_index = index
|
||||
call(active_tab_index and active_tab.env.OPEN)
|
||||
end
|
||||
end
|
||||
|
||||
public.orig = {}
|
||||
function public.hook(name, handler, object)
|
||||
local orig
|
||||
if object then
|
||||
m.orig[object] = m.orig[object] or {}
|
||||
orig = m.orig[object]
|
||||
else
|
||||
object = g
|
||||
orig = m.orig
|
||||
end
|
||||
assert(not orig[name], '"'..name..'" is already hooked.')
|
||||
orig[name] = object[name]
|
||||
object[name] = handler
|
||||
end
|
||||
|
||||
do
|
||||
local locked
|
||||
function public.accessor.bid_in_progress() return locked end
|
||||
function public.place_bid(type, index, amount, on_success)
|
||||
if locked then
|
||||
return
|
||||
end
|
||||
local money = GetMoney()
|
||||
PlaceAuctionBid(type, index, amount)
|
||||
if money >= amount then
|
||||
locked = true
|
||||
control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_BID_PLACED then
|
||||
call(on_success)
|
||||
locked = false
|
||||
kill()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local locked
|
||||
function public.accessor.cancel_in_progress() return locked end
|
||||
function public.cancel_auction(index, on_success)
|
||||
if locked then
|
||||
return
|
||||
end
|
||||
locked = true
|
||||
CancelAuction(index)
|
||||
control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_REMOVED then
|
||||
call(on_success)
|
||||
locked = false
|
||||
kill()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function public.is_player(name, current)
|
||||
local realm = GetCVar 'realmName'
|
||||
return not current and index(g.aux_characters, realm, name) or UnitName 'player' == name
|
||||
end
|
||||
|
||||
function public.neutral_faction()
|
||||
return not UnitFactionGroup 'npc'
|
||||
end
|
||||
|
||||
function public.min_bid_increment(current_bid)
|
||||
return max(1, floor(current_bid / 100) * 5)
|
||||
end
|
||||
|
||||
function AUCTION_HOUSE_SHOW()
|
||||
AuctionFrame:Hide()
|
||||
frame:Show()
|
||||
@@ -92,8 +166,16 @@ function AUCTION_BIDDER_LIST_UPDATE()
|
||||
bids_loaded = true
|
||||
end
|
||||
|
||||
function AUCTION_OWNED_LIST_UPDATE()
|
||||
current_owner_page = last_owner_page_requested or 0
|
||||
do
|
||||
local last_owner_page_requested
|
||||
function GetOwnerAuctionItems(...)
|
||||
local page = arg[1]
|
||||
last_owner_page_requested = page
|
||||
return orig.GetOwnerAuctionItems(unpack(arg))
|
||||
end
|
||||
function AUCTION_OWNED_LIST_UPDATE()
|
||||
current_owner_page = last_owner_page_requested or 0
|
||||
end
|
||||
end
|
||||
|
||||
function ADDON_LOADED.Blizzard_AuctionUI()
|
||||
@@ -172,27 +254,6 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
public.orig = {}
|
||||
function public.hook(name, handler, object)
|
||||
local orig
|
||||
if object then
|
||||
m.orig[object] = m.orig[object] or {}
|
||||
orig = m.orig[object]
|
||||
else
|
||||
object = g
|
||||
orig = m.orig
|
||||
end
|
||||
assert(not orig[name], '"'..name..'" is already hooked.')
|
||||
orig[name] = object[name]
|
||||
object[name] = handler
|
||||
end
|
||||
|
||||
function GetOwnerAuctionItems(...)
|
||||
local page = arg[1]
|
||||
last_owner_page_requested = page
|
||||
return orig.GetOwnerAuctionItems(unpack(arg))
|
||||
end
|
||||
|
||||
function AuctionFrameAuctions_OnEvent(...)
|
||||
if AuctionFrameAuctions:IsVisible() then
|
||||
return orig.AuctionFrameAuctions_OnEvent(unpack(arg))
|
||||
@@ -215,58 +276,4 @@ function UseContainerItem(...)
|
||||
for item_info in present(info.container_item(arg[1], arg[2])) do
|
||||
return active_tab.env.USE_ITEM(item_info)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local locked
|
||||
function public.bid_in_progress() return locked end
|
||||
function public.place_bid(type, index, amount, on_success)
|
||||
if locked then
|
||||
return
|
||||
end
|
||||
local money = GetMoney()
|
||||
PlaceAuctionBid(type, index, amount)
|
||||
if money >= amount then
|
||||
locked = true
|
||||
control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_BID_PLACED then
|
||||
call(on_success)
|
||||
locked = false
|
||||
kill()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local locked
|
||||
function public.cancel_in_progress() return locked end
|
||||
function public.cancel_auction(index, on_success)
|
||||
if locked then
|
||||
return
|
||||
end
|
||||
locked = true
|
||||
CancelAuction(index)
|
||||
control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_REMOVED then
|
||||
call(on_success)
|
||||
locked = false
|
||||
kill()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function public.is_player(name, current)
|
||||
local realm = GetCVar 'realmName'
|
||||
return not current and index(g.aux_characters, realm, name) or UnitName 'player' == name
|
||||
end
|
||||
|
||||
function public.neutral_faction()
|
||||
return not UnitFactionGroup 'npc'
|
||||
end
|
||||
|
||||
function public.min_bid_increment(current_bid)
|
||||
return max(1, floor(current_bid / 100) * 5)
|
||||
end
|
||||
@@ -123,8 +123,8 @@ do
|
||||
aux_background:SetTexture(color.content.background())
|
||||
aux_background:SetAllPoints(DropDownList1Backdrop)
|
||||
blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
|
||||
aux.hook('ToggleDropDownMenu', function(...)
|
||||
local ret = {aux.orig.ToggleDropDownMenu(unpack(arg))}
|
||||
hook('ToggleDropDownMenu', function(...)
|
||||
local ret = {orig.ToggleDropDownMenu(unpack(arg))}
|
||||
local dropdown = getglobal(arg[4] or '') or this:GetParent()
|
||||
if strfind(dropdown:GetName() or '', '^aux_frame%d+$') then
|
||||
set_aux_dropdown_style(dropdown)
|
||||
@@ -418,7 +418,7 @@ function public.editbox(parent)
|
||||
-- editbox:Insert'<ksejfkj>' TODO use insert with special tags to determine cursor position
|
||||
-- or use an overlay with itemlinks
|
||||
if last_click and GetTime() - last_click.t < .5 and x == last_click.x and y == last_click.y then
|
||||
aux.control.thread(function() editbox:HighlightText() end)
|
||||
control.thread(function() editbox:HighlightText() end)
|
||||
end
|
||||
last_click = {t=GetTime(), x=x, y=y}
|
||||
end)
|
||||
@@ -440,12 +440,12 @@ function public.editbox(parent)
|
||||
self:SetFont(config.font, size)
|
||||
self.display:SetFont(config.font, size)
|
||||
end
|
||||
local display = aux.gui.label(editbox)
|
||||
local display = gui.label(editbox)
|
||||
display:SetPoint('LEFT', 1.5, 0)
|
||||
display:SetPoint('RIGHT', -1.5, 0)
|
||||
display:SetTextColor(color.text.enabled())
|
||||
editbox.display = display
|
||||
local cursor = aux.gui.label(editbox, config.large_font_size)
|
||||
local cursor = gui.label(editbox, config.large_font_size)
|
||||
cursor:SetText '|'
|
||||
cursor:SetTextColor(color.text.enabled())
|
||||
cursor:SetAlpha(0)
|
||||
@@ -537,7 +537,7 @@ function public.item(parent)
|
||||
btn:RegisterForClicks()
|
||||
item.texture = getglobal(btn:GetName()..'Icon')
|
||||
item.texture:SetTexCoord(.06, .94, .06, .94)
|
||||
item.name = aux.gui.label(btn, 15)
|
||||
item.name = gui.label(btn, 15)
|
||||
item.name:SetJustifyH 'LEFT'
|
||||
item.name:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
|
||||
item.name:SetPoint('RIGHT', item, 'RIGHT', -10, .5)
|
||||
|
||||
@@ -1,49 +1,43 @@
|
||||
local aux_module, getn, setn, tinsert, tremove, setfenv, gfind = aux_module, getn, table.setn, tinsert, tremove, setfenv, string.gfind
|
||||
do
|
||||
local env, interface = aux_module 'core'
|
||||
local env, interface = aux_module '/core'
|
||||
setfenv(1, env)
|
||||
g.aux = interface
|
||||
end
|
||||
|
||||
public.version = '5.0.0'
|
||||
|
||||
local t, temp, recycle
|
||||
do
|
||||
local table_pool, locked = {}, {}
|
||||
local recycle_frame = CreateFrame 'Frame'
|
||||
local table_pool, auto_recycle = {}, {}
|
||||
local function wipe(t) -- like with a cloth or something
|
||||
for k in t do t[k] = nil end
|
||||
setn(t, 0)
|
||||
return t
|
||||
end
|
||||
function recycle(t)
|
||||
locked[t] = nil
|
||||
function public.recycle(t)
|
||||
auto_recycle[t] = nil
|
||||
tinsert(table_pool, wipe(t))
|
||||
log(getn(table_pool))
|
||||
end
|
||||
public.recycle = recycle
|
||||
temp = setmetatable({}, {
|
||||
__call = function()
|
||||
local t = tremove(table_pool) or {}
|
||||
locked[t] = true
|
||||
return t
|
||||
end,
|
||||
__sub = function(_, t) locked[t] = true return t end,
|
||||
})
|
||||
public.temp = temp
|
||||
function t()
|
||||
return tremove(table_pool) or {}
|
||||
end
|
||||
public.accessor.t = t
|
||||
public.accessor.temp = setmetatable({}, {__sub = function(_, t) auto_recycle[t] = true return t end})
|
||||
function public.accessor.t() return tremove(table_pool) or {} end
|
||||
end
|
||||
|
||||
do
|
||||
local module_envs = t
|
||||
function public.module(path)
|
||||
local env, parts, parent, name
|
||||
parts, parent, name = gfind(path, '[%a_][%w_]*'), aux_module 'modules', ''
|
||||
parts, parent, name = gfind(path, '[%a_][%w_]*'), aux_module '/modules', ''
|
||||
for part in parts do
|
||||
name = name..'/'..part
|
||||
env, parent.public[part] = aux_module(name)
|
||||
env.import('modules', 'core', 'util')
|
||||
if not module_envs[name] then
|
||||
env, parent.public[part] = aux_module(name)
|
||||
env.import(temp-{'modules', 'core', 'util'})
|
||||
module_envs[name] = env
|
||||
else
|
||||
env = module_envs[name]
|
||||
end
|
||||
parent = env
|
||||
end
|
||||
setfenv(2, env)
|
||||
@@ -51,13 +45,13 @@ do
|
||||
end
|
||||
|
||||
local event_frame = CreateFrame 'Frame'
|
||||
for _, event in {'VARIABLES_LOADED', 'ADDON_LOADED', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE'} do
|
||||
for _, event in temp-{'VARIABLES_LOADED', 'ADDON_LOADED', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE'} do
|
||||
event_frame:RegisterEvent(event)
|
||||
end
|
||||
|
||||
ADDON_LOADED = {}
|
||||
do
|
||||
local variables_loaded_hooks, player_login_hooks = {}, {}
|
||||
local variables_loaded_hooks, player_login_hooks = t, t
|
||||
function public.mutator.LOAD(f) tinsert(variables_loaded_hooks, f) end
|
||||
function public.mutator.LOAD2(f) tinsert(player_login_hooks, f) end
|
||||
event_frame:SetScript('OnEvent', function()
|
||||
@@ -74,10 +68,4 @@ do
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function public.log(...)
|
||||
local msg = '[aux]'
|
||||
for i=1,arg.n do msg = msg..' '..tostring(arg[i]) end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE..msg)
|
||||
end
|
||||
end
|
||||
+22
-21
@@ -1,16 +1,16 @@
|
||||
local setmetatable, unpack, mask, add, g = setmetatable, unpack, bit.band, bit.bor, getfenv(0)
|
||||
local setmetatable, unpack, mask, g = setmetatable, unpack, bit.band, getfenv(0)
|
||||
local PRIVATE, PUBLIC, MUTABLE, ACCESSOR, MUTATOR = 1, 2, 4, 8, 16
|
||||
local MODIFIER = {private=PRIVATE, public=PUBLIC, mutable=MUTABLE, accessor=ACCESSOR, mutator=MUTATOR}
|
||||
local MASK = {private=MUTABLE+ACCESSOR+MUTATOR, public=MUTABLE+ACCESSOR+MUTATOR, mutable=PRIVATE+PUBLIC, accessor=PRIVATE+PUBLIC+MUTATOR, mutator=PRIVATE+PUBLIC+ACCESSOR}
|
||||
local MASK = {private=PUBLIC+MUTABLE+ACCESSOR+MUTATOR, public=PRIVATE+MUTABLE+ACCESSOR+MUTATOR, mutable=PRIVATE+PUBLIC, accessor=PRIVATE+PUBLIC+MUTATOR, mutator=PRIVATE+PUBLIC+ACCESSOR}
|
||||
local _10, _01, tf, ft = {[true]=1, [false]=0}, {[true]=0, [false]=1}, {true, false}, {false, true}
|
||||
local importer_mt, declarator_mt, env_mt, interface_mt, lock_mt
|
||||
local define_property, declarator_accessor, private_accessor, public_accessor, mutable_accessor, accessor_accessor, mutator_accessor, index, error
|
||||
local _modules, _metadata, _data, _accessors, _mutators, _imports, _declarators, _declarator_state = setmetatable({}, lock_mt), {}, {}, {}, {}, {}, {}, {}
|
||||
function error(message, ...) g.error(format(message, unpack(arg))..'\n'..debugstack(3, 5, 0), 3) end
|
||||
importer_mt = {__metatable=false}
|
||||
function importer_mt.__call(self, ...)
|
||||
function importer_mt.__call(self, t)
|
||||
local imports = _imports[self]
|
||||
for i=1,arg.n do imports[arg[i]] = true end
|
||||
for _, name in t do imports[name] = true end
|
||||
end
|
||||
function declarator_accessor(modifier)
|
||||
return function(declarator) return function() _declarator_state[declarator] = PRIVATE+modifier return declarator end end
|
||||
@@ -36,6 +36,7 @@ function index(access, default)
|
||||
return function(self, key)
|
||||
local modifiers = _metadata[self][key] or 0
|
||||
if mask(access+ACCESSOR+MUTATOR, modifiers) == access then
|
||||
-- DEFAULT_CHAT_FRAME:AddMessage(access)
|
||||
return _data[self][key]
|
||||
elseif mask(access+ACCESSOR, modifiers) == access+ACCESSOR then
|
||||
return _accessors[self][key]()
|
||||
@@ -65,22 +66,21 @@ function interface_mt.__newindex(self, key, value)
|
||||
end
|
||||
lock_mt = {}
|
||||
function g.aux_module(name)
|
||||
if not _modules[name] then
|
||||
local metadata, data, accessors, mutators, imports, importer, declarator, env, interface
|
||||
imports, importer, declarator, env, interface = {}, setmetatable({}, importer_mt), setmetatable({}, declarator_mt), setmetatable({}, env_mt), setmetatable({}, interface_mt)
|
||||
metadata = setmetatable({g=PRIVATE, m=PRIVATE, import=PRIVATE, private=PRIVATE+ACCESSOR, public=PRIVATE+ACCESSOR, mutable=PRIVATE+ACCESSOR, accessor=PRIVATE+ACCESSOR, mutator=PRIVATE+ACCESSOR}, lock_mt)
|
||||
data = {g=g, m=env, import=importer}
|
||||
accessors = {private=private_accessor(declarator), public=public_accessor(declarator), mutable=mutable_accessor(declarator), accessor=accessor_accessor(declarator), mutator=mutator_accessor(declarator)}
|
||||
mutators = {}
|
||||
_metadata[name], _metadata[declarator], _metadata[env], _metadata[interface] = metadata, metadata, metadata, metadata
|
||||
_data[name], _data[declarator], _data[env], _data[interface] = data, data, data, data
|
||||
_accessors[name], _accessors[declarator], _accessors[env], _accessors[interface] = accessors, accessors, accessors, accessors
|
||||
_mutators[name], _mutators[declarator], _mutators[env], _mutators[interface] = mutators, mutators, mutators, mutators
|
||||
_imports[name], _imports[importer] = imports, imports
|
||||
_declarators[name] = declarator
|
||||
_modules[name] = {env, interface}
|
||||
end
|
||||
return unpack(_modules[name])
|
||||
if _modules[name] then error('Module %s already exists.', name) end
|
||||
local metadata, data, accessors, mutators, imports, importer, declarator, env, interface
|
||||
imports, importer, declarator, env, interface = {}, setmetatable({}, importer_mt), setmetatable({}, declarator_mt), setmetatable({}, env_mt), setmetatable({}, interface_mt)
|
||||
metadata = setmetatable({g=PRIVATE, m=PRIVATE, import=PRIVATE, private=PRIVATE+ACCESSOR, public=PRIVATE+ACCESSOR, mutable=PRIVATE+ACCESSOR, accessor=PRIVATE+ACCESSOR, mutator=PRIVATE+ACCESSOR}, lock_mt)
|
||||
data = {g=g, m=env, import=importer}
|
||||
accessors = {private=private_accessor(declarator), public=public_accessor(declarator), mutable=mutable_accessor(declarator), accessor=accessor_accessor(declarator), mutator=mutator_accessor(declarator)}
|
||||
mutators = {}
|
||||
_metadata[name], _metadata[declarator], _metadata[env], _metadata[interface] = metadata, metadata, metadata, metadata
|
||||
_data[name], _data[declarator], _data[env], _data[interface] = data, data, data, data
|
||||
_accessors[name], _accessors[declarator], _accessors[env], _accessors[interface] = accessors, accessors, accessors, accessors
|
||||
_mutators[name], _mutators[declarator], _mutators[env], _mutators[interface] = mutators, mutators, mutators, mutators
|
||||
_imports[name], _imports[importer] = imports, imports
|
||||
_declarators[name] = declarator
|
||||
_modules[name] = true
|
||||
return env, interface
|
||||
end
|
||||
local frame = CreateFrame 'Frame'
|
||||
frame:RegisterEvent 'PLAYER_LOGIN'
|
||||
@@ -95,11 +95,12 @@ frame:SetScript('OnEvent', function()
|
||||
local data = _data[import_name]
|
||||
for key, modifiers in _metadata[import_name] do
|
||||
if mask(PUBLIC, modifiers) ~= 0 then
|
||||
count = count + 1
|
||||
_declarator_state[declarator] = modifiers
|
||||
declarator[key] = data[key]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
aux.log('imported: '..count..' in '..(GetTime()-t0))
|
||||
log('imported: '..count..' in '..(GetTime()-t0))
|
||||
end)
|
||||
+83
-81
@@ -6,20 +6,22 @@ local RT_COUNT = 1
|
||||
local HEAD_HEIGHT = 27
|
||||
local HEAD_SPACE = 2
|
||||
|
||||
local AUCTION_PCT_COLORS = {
|
||||
{color=aux.gui.inline_color.blue, value=50},
|
||||
{color=aux.gui.inline_color.green, value=80},
|
||||
{color=aux.gui.inline_color.yellow, value=110},
|
||||
{color=aux.gui.inline_color.orange, value=135},
|
||||
{color=aux.gui.inline_color.red, value=huge},
|
||||
}
|
||||
function LOAD()
|
||||
AUCTION_PCT_COLORS = {
|
||||
{color=gui.inline_color.blue, value=50},
|
||||
{color=gui.inline_color.green, value=80},
|
||||
{color=gui.inline_color.yellow, value=110},
|
||||
{color=gui.inline_color.orange, value=135},
|
||||
{color=gui.inline_color.red, value=huge},
|
||||
}
|
||||
|
||||
local TIME_LEFT_STRINGS = {
|
||||
aux.gui.color.red '30m', -- Short
|
||||
aux.gui.color.orange '2h', -- Medium
|
||||
aux.gui.color.yellow '8h', -- Long
|
||||
aux.gui.color.blue '24h', -- Very Long
|
||||
}
|
||||
TIME_LEFT_STRINGS = {
|
||||
gui.color.red '30m', -- Short
|
||||
gui.color.orange '2h', -- Medium
|
||||
gui.color.yellow '8h', -- Long
|
||||
gui.color.blue '24h', -- Very Long
|
||||
}
|
||||
end
|
||||
|
||||
function item_column_init(rt, cell)
|
||||
local spacer = CreateFrame('Frame', nil, cell)
|
||||
@@ -69,7 +71,7 @@ public.search_config = {
|
||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.name, record_b.name, desc)
|
||||
return sorting.compare(record_a.name, record_b.name, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -78,11 +80,11 @@ public.search_config = {
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record)
|
||||
local display_level = max(record.level, 1)
|
||||
display_level = UnitLevel('player') < record.level and aux.gui.color.red(display_level) or display_level
|
||||
display_level = UnitLevel('player') < record.level and gui.color.red(display_level) or display_level
|
||||
cell:SetText(display_level)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.level, record_b.level, desc)
|
||||
return sorting.compare(record_a.level, record_b.level, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -90,14 +92,14 @@ public.search_config = {
|
||||
width = 0.06,
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record, count, own, expandable)
|
||||
local numAuctionsText = expandable and aux.gui.color.link(count) or count
|
||||
local numAuctionsText = expandable and gui.color.link(count) or count
|
||||
if own > 0 then
|
||||
numAuctionsText = numAuctionsText..(' '..aux.gui.color.yellow('('..own..')'))
|
||||
numAuctionsText = numAuctionsText..(' '..gui.color.yellow('('..own..')'))
|
||||
end
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.EQ
|
||||
return sorting.EQ
|
||||
-- if sortKey == 'numAuctions' then
|
||||
-- if a.children then
|
||||
-- aVal = a.totalAuctions
|
||||
@@ -117,7 +119,7 @@ public.search_config = {
|
||||
cell:SetText(record.aux_quantity)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
return sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -128,7 +130,7 @@ public.search_config = {
|
||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
return sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -136,17 +138,17 @@ public.search_config = {
|
||||
width = 0.13,
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record)
|
||||
cell:SetText(aux.is_player(record.owner) and (aux.gui.color.yellow(record.owner)) or (record.owner or '---'))
|
||||
cell:SetText(is_player(record.owner) and (gui.color.yellow(record.owner)) or (record.owner or '---'))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
if not record_a.owner and not record_b.owner then
|
||||
return aux.sorting.EQ
|
||||
return sorting.EQ
|
||||
elseif not record_a.owner then
|
||||
return aux.sorting.GT
|
||||
return sorting.GT
|
||||
elseif not record_b.owner then
|
||||
return aux.sorting.LT
|
||||
return sorting.LT
|
||||
else
|
||||
return aux.sorting.compare(record_a.owner, record_b.owner, desc)
|
||||
return sorting.compare(record_a.owner, record_b.owner, desc)
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -168,7 +170,7 @@ public.search_config = {
|
||||
else
|
||||
price = g.aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||
end
|
||||
cell:SetText(aux.money.to_string(price, true, false, nil, color))
|
||||
cell:SetText(money.to_string(price, true, false, nil, color))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a
|
||||
@@ -183,7 +185,7 @@ public.search_config = {
|
||||
else
|
||||
price_b = g.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||
end
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
return sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -193,7 +195,7 @@ public.search_config = {
|
||||
isPrice = true,
|
||||
fill = function(cell, record)
|
||||
local price = g.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
cell:SetText(price > 0 and aux.money.to_string(price, true, false) or '---')
|
||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a = g.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
@@ -201,7 +203,7 @@ public.search_config = {
|
||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
return sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -215,7 +217,7 @@ public.search_config = {
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local pct_a = record_percentage(record_a) or (desc and -huge or huge)
|
||||
local pct_b = record_percentage(record_b) or (desc and -huge or huge)
|
||||
return aux.sorting.compare(pct_a, pct_b, desc)
|
||||
return sorting.compare(pct_a, pct_b, desc)
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -239,7 +241,7 @@ public.auctions_config = {
|
||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.name, record_b.name, desc)
|
||||
return sorting.compare(record_a.name, record_b.name, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -248,11 +250,11 @@ public.auctions_config = {
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record)
|
||||
local display_level = max(record.level, 1)
|
||||
display_level = UnitLevel('player') < record.level and aux.gui.color.red(display_level) or display_level
|
||||
display_level = UnitLevel('player') < record.level and gui.color.red(display_level) or display_level
|
||||
cell:SetText(display_level)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.level, record_b.level, desc)
|
||||
return sorting.compare(record_a.level, record_b.level, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -260,11 +262,11 @@ public.auctions_config = {
|
||||
width = 0.06,
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record, count, own, expandable)
|
||||
local numAuctionsText = expandable and aux.gui.inline_color.link..count..FONT_COLOR_CODE_CLOSE or count
|
||||
local numAuctionsText = expandable and gui.inline_color.link..count..FONT_COLOR_CODE_CLOSE or count
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.EQ
|
||||
return sorting.EQ
|
||||
-- if sortKey == 'numAuctions' then
|
||||
-- if a.children then
|
||||
-- aVal = a.totalAuctions
|
||||
@@ -284,7 +286,7 @@ public.auctions_config = {
|
||||
cell:SetText(record.aux_quantity)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
return sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -295,7 +297,7 @@ public.auctions_config = {
|
||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
return sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -310,7 +312,7 @@ public.auctions_config = {
|
||||
else
|
||||
price = g.aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price
|
||||
end
|
||||
cell:SetText(aux.money.to_string(price, true, false))
|
||||
cell:SetText(money.to_string(price, true, false))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a
|
||||
@@ -325,7 +327,7 @@ public.auctions_config = {
|
||||
else
|
||||
price_b = g.aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
|
||||
end
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
return sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -335,7 +337,7 @@ public.auctions_config = {
|
||||
isPrice = true,
|
||||
fill = function(cell, record)
|
||||
local price = g.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
cell:SetText(price > 0 and aux.money.to_string(price, true, false) or '---')
|
||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a = g.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
@@ -343,7 +345,7 @@ public.auctions_config = {
|
||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
return sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -351,17 +353,17 @@ public.auctions_config = {
|
||||
width = 0.21,
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record)
|
||||
cell:SetText(record.high_bidder or aux.gui.color.red 'No Bids')
|
||||
cell:SetText(record.high_bidder or gui.color.red 'No Bids')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
if not record_a.high_bidder and not record_b.high_bidder then
|
||||
return aux.sorting.EQ
|
||||
return sorting.EQ
|
||||
elseif not record_a.high_bidder then
|
||||
return aux.sorting.GT
|
||||
return sorting.GT
|
||||
elseif not record_b.high_bidder then
|
||||
return aux.sorting.LT
|
||||
return sorting.LT
|
||||
else
|
||||
return aux.sorting.compare(record_a.high_bidder, record_b.high_bidder, desc)
|
||||
return sorting.compare(record_a.high_bidder, record_b.high_bidder, desc)
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -386,7 +388,7 @@ public.bids_config = {
|
||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.name, record_b.name, desc)
|
||||
return sorting.compare(record_a.name, record_b.name, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -394,11 +396,11 @@ public.bids_config = {
|
||||
width = 0.06,
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record, count, own, expandable)
|
||||
local numAuctionsText = expandable and aux.gui.inline_color.link..count..FONT_COLOR_CODE_CLOSE or count
|
||||
local numAuctionsText = expandable and gui.inline_color.link..count..FONT_COLOR_CODE_CLOSE or count
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.EQ
|
||||
return sorting.EQ
|
||||
-- if sortKey == 'numAuctions' then
|
||||
-- if a.children then
|
||||
-- aVal = a.totalAuctions
|
||||
@@ -418,7 +420,7 @@ public.bids_config = {
|
||||
cell:SetText(record.aux_quantity)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
return sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -429,7 +431,7 @@ public.bids_config = {
|
||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
return sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -437,17 +439,17 @@ public.bids_config = {
|
||||
width = 0.13,
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record)
|
||||
cell:SetText(aux.is_player(record.owner) and (aux.gui.color.yellow(record.owner)) or (record.owner or '---'))
|
||||
cell:SetText(is_player(record.owner) and (gui.color.yellow(record.owner)) or (record.owner or '---'))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
if not record_a.owner and not record_b.owner then
|
||||
return aux.sorting.EQ
|
||||
return sorting.EQ
|
||||
elseif not record_a.owner then
|
||||
return aux.sorting.GT
|
||||
return sorting.GT
|
||||
elseif not record_b.owner then
|
||||
return aux.sorting.LT
|
||||
return sorting.LT
|
||||
else
|
||||
return aux.sorting.compare(record_a.owner, record_b.owner, desc)
|
||||
return sorting.compare(record_a.owner, record_b.owner, desc)
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -463,7 +465,7 @@ public.bids_config = {
|
||||
else
|
||||
price = g.aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||
end
|
||||
cell:SetText(aux.money.to_string(price))
|
||||
cell:SetText(money.to_string(price))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a
|
||||
@@ -478,7 +480,7 @@ public.bids_config = {
|
||||
else
|
||||
price_b = g.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||
end
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
return sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -488,7 +490,7 @@ public.bids_config = {
|
||||
isPrice = true,
|
||||
fill = function(cell, record)
|
||||
local price = g.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
cell:SetText(price > 0 and aux.money.to_string(price, true, false) or '---')
|
||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a = g.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
@@ -496,7 +498,7 @@ public.bids_config = {
|
||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
return sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -506,14 +508,14 @@ public.bids_config = {
|
||||
fill = function(cell, record)
|
||||
local status
|
||||
if record.high_bidder then
|
||||
status = aux.gui.color.yellow 'High Bidder'
|
||||
status = gui.color.yellow 'High Bidder'
|
||||
else
|
||||
status = aux.gui.color.red 'Outbid'
|
||||
status = gui.color.red 'Outbid'
|
||||
end
|
||||
cell:SetText(status)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sorting.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
|
||||
return sorting.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -521,7 +523,7 @@ public.bids_config = {
|
||||
function record_percentage(record)
|
||||
if not record then return end
|
||||
|
||||
local historical_value = aux.history.value(record.item_key) or 0
|
||||
local historical_value = history.value(record.item_key) or 0
|
||||
if historical_value > 0 then
|
||||
if record.unit_buyout_price > 0 then
|
||||
return round(100 * record.unit_buyout_price / historical_value, 1)
|
||||
@@ -539,7 +541,7 @@ function percentage_color(pct)
|
||||
end
|
||||
|
||||
function public.percentage_historical(pct, bid)
|
||||
return (bid and aux.gui.inline_color.gray or percentage_color(pct))..(pct > 10000 and '>10000' or pct)..'%'..FONT_COLOR_CODE_CLOSE
|
||||
return (bid and gui.inline_color.gray or percentage_color(pct))..(pct > 10000 and '>10000' or pct)..'%'..FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
|
||||
function public.time_left(code)
|
||||
@@ -586,8 +588,8 @@ local methods = {
|
||||
local rt = this:GetParent().row.rt
|
||||
local rowData = this:GetParent().row.data
|
||||
if rowData and rowData.record then
|
||||
aux.info.set_tooltip(rowData.record.itemstring, this, 'ANCHOR_RIGHT')
|
||||
aux.info.set_shopping_tooltip(rowData.record.slot)
|
||||
info.set_tooltip(rowData.record.itemstring, this, 'ANCHOR_RIGHT')
|
||||
info.set_shopping_tooltip(rowData.record.slot)
|
||||
rt.isShowingItemTooltip = true
|
||||
end
|
||||
end,
|
||||
@@ -645,9 +647,9 @@ local methods = {
|
||||
elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Insert(this.row.data.record.link)
|
||||
elseif not modified and button == 'RightButton' then -- TODO not when alt (how?)
|
||||
aux.set_tab(1)
|
||||
aux.search_tab.set_filter(strlower(aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
||||
aux.search_tab.execute(nil, false)
|
||||
set_tab(1)
|
||||
search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name)..'/exact')
|
||||
search_tab.execute(nil, false)
|
||||
else
|
||||
local selection = this.rt:GetSelection()
|
||||
if not selection or selection.record ~= this.row.data.record then
|
||||
@@ -684,7 +686,7 @@ local methods = {
|
||||
self.isSorted = nil
|
||||
self:SetSelectedRecord(nil, true)
|
||||
|
||||
sort(self.records, function(a, b) return aux.sorting.multi_lt({a.search_signature, tostring(a)}, {b.search_signature, tostring(b)}) end)
|
||||
sort(self.records, function(a, b) return sorting.multi_lt({a.search_signature, tostring(a)}, {b.search_signature, tostring(b)}) end)
|
||||
|
||||
local records = self.records
|
||||
if getn(records) == 0 then return end
|
||||
@@ -714,7 +716,7 @@ local methods = {
|
||||
local totalAuctions, totalPlayerAuctions = 0, 0
|
||||
for _, childInfo in info.children do
|
||||
totalAuctions = totalAuctions + childInfo.numAuctions
|
||||
if aux.is_player(childInfo.record.owner) then
|
||||
if is_player(childInfo.record.owner) then
|
||||
totalPlayerAuctions = totalPlayerAuctions + childInfo.numAuctions
|
||||
end
|
||||
end
|
||||
@@ -765,11 +767,11 @@ local methods = {
|
||||
end
|
||||
|
||||
for _, sort in self.sorts do
|
||||
local ordering = self.config[sort.index].cmp and self.config[sort.index].cmp(record_a, record_b, sort.descending) or aux.sorting.EQ
|
||||
local ordering = self.config[sort.index].cmp and self.config[sort.index].cmp(record_a, record_b, sort.descending) or sorting.EQ
|
||||
|
||||
if ordering == aux.sorting.LT then
|
||||
if ordering == sorting.LT then
|
||||
return true
|
||||
elseif ordering == aux.sorting.GT then
|
||||
elseif ordering == sorting.GT then
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -1019,7 +1021,7 @@ function public.CreateAuctionResultsTable(parent, config)
|
||||
rt.contentFrame = contentFrame
|
||||
|
||||
-- frame to hold the header columns and the rows
|
||||
local scrollFrame = CreateFrame('ScrollFrame', aux.gui.name, rt, 'FauxScrollFrameTemplate')
|
||||
local scrollFrame = CreateFrame('ScrollFrame', gui.name, rt, 'FauxScrollFrameTemplate')
|
||||
scrollFrame:SetScript('OnVerticalScroll', function()
|
||||
if not rt.scrollDisabled then
|
||||
FauxScrollFrame_OnVerticalScroll(rt.ROW_HEIGHT, function() rt:UpdateRows() end)
|
||||
@@ -1036,7 +1038,7 @@ function public.CreateAuctionResultsTable(parent, config)
|
||||
scrollBar:SetWidth(10)
|
||||
local thumbTex = scrollBar:GetThumbTexture()
|
||||
thumbTex:SetPoint('CENTER', 0, 0)
|
||||
thumbTex:SetTexture(unpack(aux.gui.color.content.background))
|
||||
thumbTex:SetTexture(unpack(gui.color.content.background))
|
||||
thumbTex:SetHeight(150)
|
||||
thumbTex:SetWidth(scrollBar:GetWidth())
|
||||
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
|
||||
@@ -1062,8 +1064,8 @@ function public.CreateAuctionResultsTable(parent, config)
|
||||
local text = cell:CreateFontString()
|
||||
text:SetJustifyH 'CENTER'
|
||||
text:SetJustifyV 'CENTER'
|
||||
text:SetFont(aux.gui.config.font, 12)
|
||||
text:SetTextColor(unpack(aux.gui.color.label.enabled))
|
||||
text:SetFont(gui.config.font, 12)
|
||||
text:SetTextColor(unpack(gui.color.label.enabled))
|
||||
cell:SetFontString(text)
|
||||
if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO
|
||||
text:SetAllPoints()
|
||||
@@ -1108,7 +1110,7 @@ function public.CreateAuctionResultsTable(parent, config)
|
||||
for j=1, getn(rt.config) do
|
||||
local cell = CreateFrame('Button', nil, row)
|
||||
local text = cell:CreateFontString()
|
||||
text:SetFont(aux.gui.config.font, min(14, rt.ROW_HEIGHT))
|
||||
text:SetFont(gui.config.font, min(14, rt.ROW_HEIGHT))
|
||||
text:SetJustifyH(rt.config[j].align or 'LEFT')
|
||||
text:SetJustifyV 'CENTER'
|
||||
text:SetPoint('TOPLEFT', 1, -1)
|
||||
|
||||
@@ -60,7 +60,7 @@ function public.create(parent, on_click, selected)
|
||||
scrollBar:SetWidth(12)
|
||||
local thumbTex = scrollBar:GetThumbTexture()
|
||||
thumbTex:SetPoint('CENTER', 0, 0)
|
||||
thumbTex:SetTexture(unpack(aux.gui.color.content.background))
|
||||
thumbTex:SetTexture(unpack(gui.color.content.background))
|
||||
thumbTex:SetHeight(50)
|
||||
thumbTex:SetWidth(12)
|
||||
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
|
||||
@@ -86,12 +86,12 @@ function public.create(parent, on_click, selected)
|
||||
end
|
||||
end)
|
||||
|
||||
row.item = aux.gui.item(row)
|
||||
row.item = gui.item(row)
|
||||
row.item:SetScale(0.9)
|
||||
row.item:SetPoint('LEFT', 2.5, 0)
|
||||
row.item:SetPoint('RIGHT', -2.5, 0)
|
||||
row.item.button:SetScript('OnEnter', function()
|
||||
aux.info.set_tooltip(row.item_record.itemstring, this, 'ANCHOR_RIGHT')
|
||||
info.set_tooltip(row.item_record.itemstring, this, 'ANCHOR_RIGHT')
|
||||
end)
|
||||
row.item.button:SetScript('OnLeave', function()
|
||||
GameTooltip:Hide()
|
||||
|
||||
+7
-7
@@ -305,8 +305,8 @@ local methods = {
|
||||
|
||||
local text = col:CreateFontString()
|
||||
text:SetJustifyV('CENTER')
|
||||
text:SetFont(aux.gui.config.font, 16)
|
||||
text:SetTextColor(unpack(aux.gui.color.text.enabled))
|
||||
text:SetFont(gui.config.font, 16)
|
||||
text:SetTextColor(unpack(gui.color.text.enabled))
|
||||
text:SetAllPoints()
|
||||
col.text = text
|
||||
col:SetFontString(text)
|
||||
@@ -333,7 +333,7 @@ local methods = {
|
||||
local colNum = getn(row.cols) + 1
|
||||
local col = CreateFrame('Button', nil, row)
|
||||
local text = col:CreateFontString()
|
||||
text:SetFont(aux.gui.config.font, ST_ROW_TEXT_SIZE)
|
||||
text:SetFont(gui.config.font, ST_ROW_TEXT_SIZE)
|
||||
text:SetJustifyV 'CENTER'
|
||||
text:SetPoint('TOPLEFT', 1, -1)
|
||||
text:SetPoint('BOTTOMRIGHT', -1, 1)
|
||||
@@ -389,9 +389,9 @@ local methods = {
|
||||
-- update the text size of the head cols
|
||||
for _, col in st.headCols do
|
||||
if st.sizes.headFontSize then
|
||||
col.text:SetFont(aux.gui.config.font, st.sizes.headFontSize)
|
||||
col.text:SetFont(gui.config.font, st.sizes.headFontSize)
|
||||
else
|
||||
col.text:SetFont(aux.gui.config.font, aux.gui.config.medium_font_size)
|
||||
col.text:SetFont(gui.config.font, gui.config.medium_font_size)
|
||||
end
|
||||
end
|
||||
st:Redraw()
|
||||
@@ -429,14 +429,14 @@ function public.CreateScrollingTable(parent)
|
||||
st.scrollBar = scrollBar
|
||||
local thumbTex = scrollBar:GetThumbTexture()
|
||||
thumbTex:SetPoint('CENTER', 0, 0)
|
||||
thumbTex:SetTexture(unpack(aux.gui.color.content.background))
|
||||
thumbTex:SetTexture(unpack(gui.color.content.background))
|
||||
thumbTex:SetHeight(50)
|
||||
thumbTex:SetWidth(12)
|
||||
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
|
||||
getglobal(scrollBar:GetName()..'ScrollDownButton'):Hide()
|
||||
|
||||
-- create head line at default position
|
||||
st.headLine = aux.gui.horizontal_line(st, 0)
|
||||
st.headLine = gui.horizontal_line(st, 0)
|
||||
|
||||
-- add all the methods
|
||||
for name, func in methods do
|
||||
|
||||
+41
-55
@@ -1,61 +1,58 @@
|
||||
aux.module 'auctions_tab'
|
||||
aux.tab(3, 'Auctions')
|
||||
g.aux.tab(3, 'Auctions')
|
||||
|
||||
auction_records = nil
|
||||
|
||||
function m.LOAD()
|
||||
m.create_frames()
|
||||
function LOAD()
|
||||
create_frames()
|
||||
end
|
||||
|
||||
function m.OPEN()
|
||||
m.frame:Show()
|
||||
m.scan_auctions()
|
||||
function OPEN()
|
||||
frame:Show()
|
||||
scan_auctions()
|
||||
end
|
||||
|
||||
function m.CLOSE()
|
||||
m.frame:Hide()
|
||||
function CLOSE()
|
||||
frame:Hide()
|
||||
end
|
||||
|
||||
function update_listing()
|
||||
if not m:ACTIVE() then
|
||||
return
|
||||
end
|
||||
|
||||
m.listing:SetDatabase(m.auction_records)
|
||||
if not ACTIVE then return end
|
||||
listing:SetDatabase(auction_records)
|
||||
end
|
||||
|
||||
function public.scan_auctions()
|
||||
|
||||
m.status_bar:update_status(0,0)
|
||||
m.status_bar:set_text('Scanning auctions...')
|
||||
status_bar:update_status(0,0)
|
||||
status_bar:set_text('Scanning auctions...')
|
||||
|
||||
m.auction_records = {}
|
||||
m.update_listing()
|
||||
aux.scan.start{
|
||||
auction_records = {}
|
||||
update_listing()
|
||||
scan.start{
|
||||
type = 'owner',
|
||||
queries = {{ blizzard_query = {} }},
|
||||
on_page_loaded = function(page, total_pages)
|
||||
m.status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
||||
m.status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
||||
status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
||||
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
||||
end,
|
||||
on_auction = function(auction_record)
|
||||
tinsert(m.auction_records, auction_record)
|
||||
tinsert(auction_records, auction_record)
|
||||
end,
|
||||
on_complete = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Scan complete')
|
||||
m.update_listing()
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('Scan complete')
|
||||
update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Scan aborted')
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('Scan aborted')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function test(record)
|
||||
return function(index)
|
||||
local auction_info = aux.info.auction(index, 'owner')
|
||||
local auction_info = info.auction(index, 'owner')
|
||||
return auction_info and auction_info.search_signature == record.search_signature
|
||||
end
|
||||
end
|
||||
@@ -67,55 +64,44 @@ do
|
||||
local found_index
|
||||
|
||||
function find_auction(record)
|
||||
if not m.listing:ContainsRecord(record) then
|
||||
return
|
||||
end
|
||||
if not listing:ContainsRecord(record) then return end
|
||||
|
||||
aux.scan.abort(scan_id)
|
||||
scan.abort(scan_id)
|
||||
state = SEARCHING
|
||||
scan_id = aux.scan_util.find(
|
||||
scan_id = scan_util.find(
|
||||
record,
|
||||
m.status_bar,
|
||||
function()
|
||||
state = IDLE
|
||||
end,
|
||||
function()
|
||||
state = IDLE
|
||||
m.listing:RemoveAuctionRecord(record)
|
||||
end,
|
||||
status_bar,
|
||||
function() state = IDLE end,
|
||||
function() state = IDLE; listing:RemoveAuctionRecord(record) end,
|
||||
function(index)
|
||||
state = FOUND
|
||||
found_index = index
|
||||
|
||||
m.cancel_button:SetScript('OnClick', function()
|
||||
if m.test(record)(index) and m.listing:ContainsRecord(record) then
|
||||
aux.cancel_auction(index, L(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
cancel_button:SetScript('OnClick', function()
|
||||
if test(record)(index) and listing:ContainsRecord(record) then
|
||||
cancel_auction(index, L(listing.RemoveAuctionRecord, listing, record))
|
||||
end
|
||||
end)
|
||||
m.cancel_button:Enable()
|
||||
cancel_button:Enable()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function on_update()
|
||||
if state == IDLE or state == SEARCHING then
|
||||
m.cancel_button:Disable()
|
||||
cancel_button:Disable()
|
||||
end
|
||||
|
||||
if state == SEARCHING then
|
||||
return
|
||||
end
|
||||
if state == SEARCHING then return end
|
||||
|
||||
local selection = m.listing:GetSelection()
|
||||
local selection = listing:GetSelection()
|
||||
if not selection then
|
||||
state = IDLE
|
||||
elseif selection and state == IDLE then
|
||||
m.find_auction(selection.record)
|
||||
elseif state == FOUND and not m.test(selection.record)(found_index) then
|
||||
m.cancel_button:Disable()
|
||||
if not aux.cancel_in_progress() then
|
||||
state = IDLE
|
||||
end
|
||||
find_auction(selection.record)
|
||||
elseif state == FOUND and not test(selection.record)(found_index) then
|
||||
cancel_button:Disable()
|
||||
if not cancel_in_progress then state = IDLE end
|
||||
end
|
||||
end
|
||||
end
|
||||
+10
-10
@@ -1,17 +1,17 @@
|
||||
aux.module 'auctions_tab'
|
||||
|
||||
function create_frames()
|
||||
frame = CreateFrame('Frame', nil, aux.frame)
|
||||
frame = CreateFrame('Frame', nil, frame)
|
||||
frame:SetAllPoints()
|
||||
frame:SetScript('OnUpdate', on_update)
|
||||
frame:Hide()
|
||||
|
||||
frame.listing = aux.gui.panel(frame)
|
||||
frame.listing:SetPoint('TOP', aux.frame, 'TOP', 0, -8)
|
||||
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
frame.listing = gui.panel(frame)
|
||||
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||
frame.listing:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
listing = aux.auction_listing.CreateAuctionResultsTable(frame.listing, aux.auction_listing.auctions_config)
|
||||
listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.auctions_config)
|
||||
listing:SetSort(1,2,3,4,5,6,7,8)
|
||||
listing:Reset()
|
||||
listing:SetHandler('OnCellClick', function(cell, button)
|
||||
@@ -25,15 +25,15 @@ function create_frames()
|
||||
end)
|
||||
|
||||
do
|
||||
status_bar = aux.gui.status_bar(frame)
|
||||
status_bar = gui.status_bar(frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('')
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame, 16)
|
||||
local btn = gui.button(frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
@@ -42,7 +42,7 @@ function create_frames()
|
||||
cancel_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
local btn = gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
|
||||
+50
-61
@@ -1,61 +1,58 @@
|
||||
aux.module 'bids_tab'
|
||||
aux.tab(4, 'Bids')
|
||||
g.aux.tab(4, 'Bids')
|
||||
|
||||
auction_records = nil
|
||||
|
||||
function m.LOAD()
|
||||
m.create_frames()
|
||||
function LOAD()
|
||||
create_frames()
|
||||
end
|
||||
|
||||
function m.OPEN()
|
||||
m.frame:Show()
|
||||
m.scan_bids()
|
||||
function OPEN()
|
||||
frame:Show()
|
||||
scan_bids()
|
||||
end
|
||||
|
||||
function m.CLOSE()
|
||||
m.frame:Hide()
|
||||
function CLOSE()
|
||||
frame:Hide()
|
||||
end
|
||||
|
||||
function update_listing()
|
||||
if not m:ACTIVE() then
|
||||
return
|
||||
end
|
||||
|
||||
m.listing:SetDatabase(m.auction_records)
|
||||
if not ACTIVE then return end
|
||||
listing:SetDatabase(auction_records)
|
||||
end
|
||||
|
||||
function public.scan_bids()
|
||||
|
||||
m.status_bar:update_status(0,0)
|
||||
m.status_bar:set_text('Scanning auctions...')
|
||||
status_bar:update_status(0,0)
|
||||
status_bar:set_text('Scanning auctions...')
|
||||
|
||||
m.auction_records = {}
|
||||
m.update_listing()
|
||||
aux.scan.start{
|
||||
auction_records = {}
|
||||
update_listing()
|
||||
scan.start{
|
||||
type = 'bidder',
|
||||
queries = {{ blizzard_query = {} }},
|
||||
on_page_loaded = function(page, total_pages)
|
||||
m.status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
||||
m.status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
||||
status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
||||
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
||||
end,
|
||||
on_auction = function(auction_record)
|
||||
tinsert(m.auction_records, auction_record)
|
||||
tinsert(auction_records, auction_record)
|
||||
end,
|
||||
on_complete = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Scan complete')
|
||||
m.update_listing()
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('Scan complete')
|
||||
update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
m.status_bar:update_status(100, 100)
|
||||
m.status_bar:set_text('Scan aborted')
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('Scan aborted')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function test(record)
|
||||
return function(index)
|
||||
local auction_info = aux.info.auction(index, 'bidder')
|
||||
local auction_info = info.auction(index, 'bidder')
|
||||
return auction_info and auction_info.search_signature == record.search_signature
|
||||
end
|
||||
end
|
||||
@@ -67,45 +64,41 @@ do
|
||||
local found_index
|
||||
|
||||
function find_auction(record)
|
||||
if not m.listing:ContainsRecord(record) then
|
||||
return
|
||||
end
|
||||
if not listing:ContainsRecord(record) then return end
|
||||
|
||||
aux.scan.abort(scan_id)
|
||||
scan.abort(scan_id)
|
||||
state = SEARCHING
|
||||
scan_id = aux.scan_util.find(
|
||||
scan_id = scan_util.find(
|
||||
record,
|
||||
m.status_bar,
|
||||
status_bar,
|
||||
function() state = IDLE end,
|
||||
function()
|
||||
state = IDLE
|
||||
end,
|
||||
function()
|
||||
state = IDLE
|
||||
m.listing:RemoveAuctionRecord(record)
|
||||
listing:RemoveAuctionRecord(record)
|
||||
end,
|
||||
function(index)
|
||||
state = FOUND
|
||||
found_index = index
|
||||
|
||||
if not record.high_bidder then
|
||||
m.bid_button:SetScript('OnClick', function()
|
||||
if m.test(record)(index) and m.listing:ContainsRecord(record) then
|
||||
aux.place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||
aux.info.bid_update(record)
|
||||
m.listing:SetDatabase()
|
||||
end or L(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
bid_button:SetScript('OnClick', function()
|
||||
if test(record)(index) and listing:ContainsRecord(record) then
|
||||
place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||
info.bid_update(record)
|
||||
listing:SetDatabase()
|
||||
end or L(listing.RemoveAuctionRecord, listing, record))
|
||||
end
|
||||
end)
|
||||
m.bid_button:Enable()
|
||||
bid_button:Enable()
|
||||
end
|
||||
|
||||
if record.buyout_price > 0 then
|
||||
m.buyout_button:SetScript('OnClick', function()
|
||||
if m.test(record)(index) and m.listing:ContainsRecord(record) then
|
||||
aux.place_bid('bidder', index, record.buyout_price, L(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
buyout_button:SetScript('OnClick', function()
|
||||
if test(record)(index) and listing:ContainsRecord(record) then
|
||||
place_bid('bidder', index, record.buyout_price, L(listing.RemoveAuctionRecord, listing, record))
|
||||
end
|
||||
end)
|
||||
m.buyout_button:Enable()
|
||||
buyout_button:Enable()
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -113,25 +106,21 @@ do
|
||||
|
||||
function on_update()
|
||||
if state == IDLE or state == SEARCHING then
|
||||
m.buyout_button:Disable()
|
||||
m.bid_button:Disable()
|
||||
buyout_button:Disable()
|
||||
bid_button:Disable()
|
||||
end
|
||||
|
||||
if state == SEARCHING then
|
||||
return
|
||||
end
|
||||
if state == SEARCHING then return end
|
||||
|
||||
local selection = m.listing:GetSelection()
|
||||
local selection = listing:GetSelection()
|
||||
if not selection then
|
||||
state = IDLE
|
||||
elseif selection and state == IDLE then
|
||||
m.find_auction(selection.record)
|
||||
elseif state == FOUND and not m.test(selection.record)(found_index) then
|
||||
m.buyout_button:Disable()
|
||||
m.bid_button:Disable()
|
||||
if not aux.bid_in_progress() then
|
||||
state = IDLE
|
||||
end
|
||||
find_auction(selection.record)
|
||||
elseif state == FOUND and not test(selection.record)(found_index) then
|
||||
buyout_button:Disable()
|
||||
bid_button:Disable()
|
||||
if not bid_in_progress() then state = IDLE end
|
||||
end
|
||||
end
|
||||
end
|
||||
+11
-11
@@ -1,17 +1,17 @@
|
||||
aux.module 'bids_tab'
|
||||
|
||||
function create_frames()
|
||||
frame = CreateFrame('Frame', nil, aux.frame)
|
||||
frame = CreateFrame('Frame', nil, frame)
|
||||
frame:SetAllPoints()
|
||||
frame:SetScript('OnUpdate', on_update)
|
||||
frame:Hide()
|
||||
|
||||
frame.listing = aux.gui.panel(frame)
|
||||
frame.listing:SetPoint('TOP', aux.frame, 'TOP', 0, -8)
|
||||
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
frame.listing = gui.panel(frame)
|
||||
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||
frame.listing:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.listing:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
listing = aux.auction_listing.CreateAuctionResultsTable(frame.listing, aux.auction_listing.bids_config)
|
||||
listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.bids_config)
|
||||
listing:SetSort(1,2,3,4,5,6,7,8)
|
||||
listing:Reset()
|
||||
listing:SetHandler('OnCellClick', function(cell, button)
|
||||
@@ -29,15 +29,15 @@ function create_frames()
|
||||
end)
|
||||
|
||||
do
|
||||
status_bar = aux.gui.status_bar(frame)
|
||||
status_bar = gui.status_bar(frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 0)
|
||||
status_bar:set_text('')
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame, 16)
|
||||
local btn = gui.button(frame, 16)
|
||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
@@ -46,7 +46,7 @@ function create_frames()
|
||||
bid_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame, 16)
|
||||
local btn = gui.button(frame, 16)
|
||||
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
@@ -55,7 +55,7 @@ function create_frames()
|
||||
buyout_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame, 16)
|
||||
local btn = gui.button(frame, 16)
|
||||
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
|
||||
+54
-60
@@ -1,5 +1,5 @@
|
||||
aux.module 'post_tab'
|
||||
aux.tab(2, 'Post')
|
||||
g.aux.tab(2, 'Post')
|
||||
|
||||
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||
@@ -17,7 +17,7 @@ end
|
||||
function m.OPEN()
|
||||
m.frame:Show()
|
||||
|
||||
m.deposit:SetText('Deposit: '..aux.money.to_string(0, nil, nil, nil, aux.gui.inline_color.text.enabled))
|
||||
m.deposit:SetText('Deposit: '..money.to_string(0, nil, nil, nil, gui.inline_color.text.enabled))
|
||||
|
||||
m.set_unit_start_price(0)
|
||||
m.set_unit_buyout_price(0)
|
||||
@@ -48,12 +48,12 @@ end
|
||||
|
||||
function read_settings(item_key)
|
||||
item_key = item_key or m.selected_item.key
|
||||
local dataset = aux.persistence.load_dataset()
|
||||
local dataset = persistence.load_dataset()
|
||||
dataset.post = dataset.post or {}
|
||||
|
||||
local settings
|
||||
if dataset.post[item_key] then
|
||||
settings = aux.persistence.read(settings_schema, dataset.post[item_key])
|
||||
settings = persistence.read(settings_schema, dataset.post[item_key])
|
||||
else
|
||||
settings = m.default_settings()
|
||||
end
|
||||
@@ -63,46 +63,40 @@ end
|
||||
function write_settings(settings, item_key)
|
||||
item_key = item_key or m.selected_item.key
|
||||
|
||||
local dataset = aux.persistence.load_dataset()
|
||||
local dataset = persistence.load_dataset()
|
||||
dataset.post = dataset.post or {}
|
||||
|
||||
dataset.post[item_key] = aux.persistence.write(settings_schema, settings)
|
||||
dataset.post[item_key] = persistence.write(settings_schema, settings)
|
||||
end
|
||||
|
||||
function get_unit_start_price()
|
||||
local money_text = m.unit_start_price:GetText()
|
||||
return aux.money.from_string(money_text) or 0
|
||||
return money.from_string(money_text) or 0
|
||||
end
|
||||
|
||||
function set_unit_start_price(amount)
|
||||
m.unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3))
|
||||
m.unit_start_price:SetText(money.to_string(amount, true, nil, 3))
|
||||
end
|
||||
|
||||
function get_unit_buyout_price()
|
||||
local money_text = m.unit_buyout_price:GetText()
|
||||
return aux.money.from_string(money_text) or 0
|
||||
return money.from_string(money_text) or 0
|
||||
end
|
||||
|
||||
function set_unit_buyout_price(amount)
|
||||
m.unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3))
|
||||
m.unit_buyout_price:SetText(money.to_string(amount, true, nil, 3))
|
||||
end
|
||||
|
||||
function update_inventory_listing()
|
||||
if not m.ACTIVE() then
|
||||
return
|
||||
end
|
||||
|
||||
aux.item_listing.populate(m.item_listing, values(filter(m.inventory_records, function(record)
|
||||
if not ACTIVE then return end
|
||||
item_listing.populate(m.item_listing, values(filter(m.inventory_records, function(record)
|
||||
local settings = m.read_settings(record.key)
|
||||
return record.aux_quantity > 0 and (not settings.hidden or m.show_hidden_checkbox:GetChecked())
|
||||
end)))
|
||||
end
|
||||
|
||||
function update_auction_listing()
|
||||
if not m.ACTIVE() then
|
||||
return
|
||||
end
|
||||
|
||||
if not ACTIVE then return end
|
||||
local auction_rows = {}
|
||||
if m.selected_item then
|
||||
local unit_start_price = m.get_unit_start_price()
|
||||
@@ -111,49 +105,49 @@ function update_auction_listing()
|
||||
for i, auction_record in m.existing_auctions[m.selected_item.key] or {} do
|
||||
|
||||
local blizzard_bid_undercut, buyout_price_undercut = m.undercut(auction_record, m.stack_size_slider:GetValue())
|
||||
blizzard_bid_undercut = aux.money.from_string(aux.money.to_string(blizzard_bid_undercut, true, nil, 3))
|
||||
buyout_price_undercut = aux.money.from_string(aux.money.to_string(buyout_price_undercut, true, nil, 3))
|
||||
blizzard_bid_undercut = money.from_string(money.to_string(blizzard_bid_undercut, true, nil, 3))
|
||||
buyout_price_undercut = money.from_string(money.to_string(buyout_price_undercut, true, nil, 3))
|
||||
|
||||
local stack_blizzard_bid_undercut, stack_buyout_price_undercut = m.undercut(auction_record, m.stack_size_slider:GetValue(), true)
|
||||
stack_blizzard_bid_undercut = aux.money.from_string(aux.money.to_string(stack_blizzard_bid_undercut, true, nil, 3))
|
||||
stack_buyout_price_undercut = aux.money.from_string(aux.money.to_string(stack_buyout_price_undercut, true, nil, 3))
|
||||
stack_blizzard_bid_undercut = money.from_string(money.to_string(stack_blizzard_bid_undercut, true, nil, 3))
|
||||
stack_buyout_price_undercut = money.from_string(money.to_string(stack_buyout_price_undercut, true, nil, 3))
|
||||
|
||||
local stack_size = m.stack_size_slider:GetValue()
|
||||
local historical_value = aux.history.value(m.selected_item.key)
|
||||
local historical_value = history.value(m.selected_item.key)
|
||||
|
||||
local bid_color
|
||||
if blizzard_bid_undercut < unit_start_price and stack_blizzard_bid_undercut < unit_start_price then
|
||||
bid_color = aux.gui.inline_color.red
|
||||
bid_color = gui.inline_color.red
|
||||
elseif blizzard_bid_undercut < unit_start_price then
|
||||
bid_color = aux.gui.inline_color.orange
|
||||
bid_color = gui.inline_color.orange
|
||||
elseif stack_blizzard_bid_undercut < unit_start_price then
|
||||
bid_color = aux.gui.inline_color.yellow
|
||||
bid_color = gui.inline_color.yellow
|
||||
end
|
||||
|
||||
local buyout_color
|
||||
if buyout_price_undercut < unit_buyout_price and stack_buyout_price_undercut < unit_buyout_price then
|
||||
buyout_color = aux.gui.inline_color.red
|
||||
buyout_color = gui.inline_color.red
|
||||
elseif buyout_price_undercut < unit_buyout_price then
|
||||
buyout_color = aux.gui.inline_color.orange
|
||||
buyout_color = gui.inline_color.orange
|
||||
elseif stack_buyout_price_undercut < unit_buyout_price then
|
||||
buyout_color = aux.gui.inline_color.yellow
|
||||
buyout_color = gui.inline_color.yellow
|
||||
end
|
||||
|
||||
tinsert(auction_rows, {
|
||||
cols = {
|
||||
{value=auction_record.own and aux.gui.color.yellow(auction_record.count) or auction_record.count},
|
||||
{value=aux.auction_listing.time_left(auction_record.duration)},
|
||||
{value=auction_record.stack_size == stack_size and aux.gui.color.yellow(auction_record.stack_size) or auction_record.stack_size},
|
||||
{value=aux.money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color) },
|
||||
{value=historical_value and aux.auction_listing.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'},
|
||||
{value=auction_record.unit_buyout_price > 0 and aux.money.to_string(auction_record.unit_buyout_price, true, nil, 3, buyout_color) or '---'},
|
||||
{value=auction_record.unit_buyout_price > 0 and historical_value and aux.auction_listing.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'},
|
||||
{value=auction_record.own and gui.color.yellow(auction_record.count) or auction_record.count},
|
||||
{value=auction_listing.time_left(auction_record.duration)},
|
||||
{value=auction_record.stack_size == stack_size and gui.color.yellow(auction_record.stack_size) or auction_record.stack_size},
|
||||
{value=money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color) },
|
||||
{value=historical_value and auction_listing.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'},
|
||||
{value=auction_record.unit_buyout_price > 0 and money.to_string(auction_record.unit_buyout_price, true, nil, 3, buyout_color) or '---'},
|
||||
{value=auction_record.unit_buyout_price > 0 and historical_value and auction_listing.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'},
|
||||
},
|
||||
record = auction_record,
|
||||
})
|
||||
end
|
||||
sort(auction_rows, function(a, b)
|
||||
return aux.sorting.multi_lt(
|
||||
return sorting.multi_lt(
|
||||
{
|
||||
a.record.unit_buyout_price == 0 and huge or a.record.unit_buyout_price,
|
||||
a.record.unit_blizzard_bid,
|
||||
@@ -189,13 +183,13 @@ function price_update()
|
||||
|
||||
local start_price_input = m.get_unit_start_price()
|
||||
settings.start_price = start_price_input
|
||||
local historical_value = aux.history.value(m.selected_item.key)
|
||||
m.start_price_percentage:SetText(historical_value and aux.auction_listing.percentage_historical(round(start_price_input / historical_value * 100)) or '---')
|
||||
local historical_value = history.value(m.selected_item.key)
|
||||
m.start_price_percentage:SetText(historical_value and auction_listing.percentage_historical(round(start_price_input / historical_value * 100)) or '---')
|
||||
|
||||
local buyout_price_input = m.get_unit_buyout_price()
|
||||
settings.buyout_price = buyout_price_input
|
||||
local historical_value = aux.history.value(m.selected_item.key)
|
||||
m.buyout_price_percentage:SetText(historical_value and aux.auction_listing.percentage_historical(round(buyout_price_input / historical_value * 100)) or '---')
|
||||
local historical_value = history.value(m.selected_item.key)
|
||||
m.buyout_price_percentage:SetText(historical_value and auction_listing.percentage_historical(round(buyout_price_input / historical_value * 100)) or '---')
|
||||
|
||||
m.write_settings(settings)
|
||||
end
|
||||
@@ -220,7 +214,7 @@ function post_auctions()
|
||||
duration_code = 4
|
||||
end
|
||||
|
||||
aux.post.start(
|
||||
post.start(
|
||||
key,
|
||||
stack_size,
|
||||
duration,
|
||||
@@ -279,7 +273,7 @@ function update_item_configuration()
|
||||
|
||||
item.texture:SetTexture(nil)
|
||||
item.count:SetText()
|
||||
item.name:SetTextColor(unpack(aux.gui.color.label.enabled))
|
||||
item.name:SetTextColor(unpack(gui.color.label.enabled))
|
||||
item.name:SetText('No item selected')
|
||||
|
||||
start_price_frame:Hide()
|
||||
@@ -314,13 +308,13 @@ function update_item_configuration()
|
||||
m.stack_count_slider.editbox:SetNumber(m.stack_count_slider:GetValue())
|
||||
|
||||
do
|
||||
local deposit_factor = aux.neutral_faction() and 0.25 or 0.05
|
||||
local deposit_factor = neutral_faction() and 0.25 or 0.05
|
||||
local stack_size = m.stack_size_slider:GetValue()
|
||||
local stack_count
|
||||
stack_count = m.stack_count_slider:GetValue()
|
||||
local deposit = floor(m.selected_item.unit_vendor_price * deposit_factor * (m.selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(m.duration_dropdown) / 120
|
||||
|
||||
m.deposit:SetText('Deposit: '..aux.money.to_string(deposit, nil, nil, nil, aux.gui.inline_color.text.enabled))
|
||||
m.deposit:SetText('Deposit: '..money.to_string(deposit, nil, nil, nil, gui.inline_color.text.enabled))
|
||||
end
|
||||
|
||||
m.refresh_button:Enable()
|
||||
@@ -354,14 +348,14 @@ function unit_vendor_price(item_key)
|
||||
|
||||
for slot in inventory do
|
||||
|
||||
local item_info = aux.info.container_item(unpack(slot))
|
||||
local item_info = info.container_item(unpack(slot))
|
||||
if item_info and item_info.item_key == item_key then
|
||||
|
||||
if aux.info.auctionable(item_info.tooltip, nil, item_info.lootable) then
|
||||
if info.auctionable(item_info.tooltip, nil, item_info.lootable) then
|
||||
ClearCursor()
|
||||
PickupContainerItem(unpack(slot))
|
||||
ClickAuctionSellItemButton()
|
||||
local auction_sell_item = aux.info.auction_sell_item()
|
||||
local auction_sell_item = info.auction_sell_item()
|
||||
ClearCursor()
|
||||
ClickAuctionSellItemButton()
|
||||
ClearCursor()
|
||||
@@ -376,9 +370,9 @@ end
|
||||
|
||||
function update_historical_value_button()
|
||||
if m.selected_item then
|
||||
local historical_value = aux.history.value(m.selected_item.key)
|
||||
local historical_value = history.value(m.selected_item.key)
|
||||
m.historical_value_button.amount = historical_value
|
||||
m.historical_value_button:SetText(historical_value and aux.money.to_string(historical_value, true, nil, 3) or '---')
|
||||
m.historical_value_button:SetText(historical_value and money.to_string(historical_value, true, nil, 3) or '---')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -393,7 +387,7 @@ function set_item(item)
|
||||
return
|
||||
end
|
||||
|
||||
aux.scan.abort(m.scan_id)
|
||||
scan.abort(m.scan_id)
|
||||
|
||||
m.selected_item = item
|
||||
|
||||
@@ -406,8 +400,8 @@ function set_item(item)
|
||||
m.stack_size_slider:SetValue(settings.stack_size)
|
||||
m.quantity_update(true)
|
||||
|
||||
m.unit_start_price:SetText(aux.money.to_string(settings.start_price, true, nil, 3, nil, true))
|
||||
m.unit_buyout_price:SetText(aux.money.to_string(settings.buyout_price, true, nil, 3, nil, true))
|
||||
m.unit_start_price:SetText(money.to_string(settings.start_price, true, nil, 3, nil, true))
|
||||
m.unit_buyout_price:SetText(money.to_string(settings.buyout_price, true, nil, 3, nil, true))
|
||||
|
||||
if not m.existing_auctions[m.selected_item.key] then
|
||||
m.refresh_entries()
|
||||
@@ -425,11 +419,11 @@ function update_inventory_records()
|
||||
|
||||
for slot in inventory do
|
||||
|
||||
local item_info = aux.info.container_item(unpack(slot))
|
||||
local item_info = info.container_item(unpack(slot))
|
||||
if item_info then
|
||||
local charge_class = item_info.charges or 0
|
||||
|
||||
if aux.info.auctionable(item_info.tooltip, nil, item_info.lootable) then
|
||||
if info.auctionable(item_info.tooltip, nil, item_info.lootable) then
|
||||
if not auction_candidate_map[item_info.item_key] then
|
||||
|
||||
local availability = {}
|
||||
@@ -477,12 +471,12 @@ function refresh_entries()
|
||||
|
||||
m.existing_auctions[item_key] = nil
|
||||
|
||||
local query = aux.scan_util.item_query(item_id)
|
||||
local query = scan_util.item_query(item_id)
|
||||
|
||||
m.status_bar:update_status(0,0)
|
||||
m.status_bar:set_text('Scanning auctions...')
|
||||
|
||||
m.scan_id = aux.scan.start{
|
||||
m.scan_id = scan.start{
|
||||
type = 'list',
|
||||
ignore_owner = true,
|
||||
queries = { query },
|
||||
@@ -522,7 +516,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
|
||||
m.existing_auctions[key] = m.existing_auctions[key] or {}
|
||||
local entry
|
||||
for _, existing_entry in m.existing_auctions[key] do
|
||||
if unit_blizzard_bid == existing_entry.unit_blizzard_bid and unit_buyout_price == existing_entry.unit_buyout_price and aux_quantity == existing_entry.stack_size and duration == existing_entry.duration and aux.is_player(owner) == existing_entry.own then
|
||||
if unit_blizzard_bid == existing_entry.unit_blizzard_bid and unit_buyout_price == existing_entry.unit_buyout_price and aux_quantity == existing_entry.stack_size and duration == existing_entry.duration and is_player(owner) == existing_entry.own then
|
||||
entry = existing_entry
|
||||
end
|
||||
end
|
||||
@@ -533,7 +527,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
|
||||
unit_blizzard_bid = unit_blizzard_bid,
|
||||
unit_buyout_price = unit_buyout_price,
|
||||
duration = duration,
|
||||
own = aux.is_player(owner),
|
||||
own = is_player(owner),
|
||||
count = 0,
|
||||
}
|
||||
tinsert(m.existing_auctions[key], entry)
|
||||
|
||||
+48
-48
@@ -1,54 +1,54 @@
|
||||
aux.module 'post_tab'
|
||||
|
||||
function create_frames()
|
||||
frame = CreateFrame('Frame', nil, aux.frame)
|
||||
frame = CreateFrame('Frame', nil, frame)
|
||||
frame:SetAllPoints()
|
||||
frame:SetScript('OnUpdate', on_update)
|
||||
frame:Hide()
|
||||
|
||||
frame.content = CreateFrame('Frame', nil, frame)
|
||||
frame.content:SetPoint('TOP', aux.frame, 'TOP', 0, -8)
|
||||
frame.content:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.content:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
frame.content:SetPoint('TOP', frame, 'TOP', 0, -8)
|
||||
frame.content:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0)
|
||||
frame.content:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
frame.inventory = aux.gui.panel(frame.content)
|
||||
frame.inventory = gui.panel(frame.content)
|
||||
frame.inventory:SetWidth(212)
|
||||
frame.inventory:SetPoint('TOPLEFT', 0, 0)
|
||||
frame.inventory:SetPoint('BOTTOMLEFT', 0, 0)
|
||||
|
||||
frame.parameters = aux.gui.panel(frame.content)
|
||||
frame.parameters = gui.panel(frame.content)
|
||||
frame.parameters:SetHeight(173)
|
||||
frame.parameters:SetPoint('TOPLEFT', frame.inventory, 'TOPRIGHT', 2.5, 0)
|
||||
frame.parameters:SetPoint('TOPRIGHT', 0, 0)
|
||||
|
||||
frame.auctions = aux.gui.panel(frame.content)
|
||||
frame.auctions = gui.panel(frame.content)
|
||||
frame.auctions:SetHeight(228)
|
||||
frame.auctions:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
|
||||
frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0)
|
||||
|
||||
do
|
||||
local checkbox = aux.gui.checkbox(frame.inventory)
|
||||
local checkbox = gui.checkbox(frame.inventory)
|
||||
checkbox:SetPoint('TOPLEFT', 49, -16)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
refresh = true
|
||||
end)
|
||||
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
|
||||
local label = gui.label(checkbox, gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||
label:SetText('Show hidden items')
|
||||
show_hidden_checkbox = checkbox
|
||||
end
|
||||
|
||||
aux.gui.horizontal_line(frame.inventory, -48)
|
||||
gui.horizontal_line(frame.inventory, -48)
|
||||
|
||||
item_listing = aux.item_listing.create(
|
||||
item_listing = item_listing.create(
|
||||
frame.inventory,
|
||||
function()
|
||||
if arg1 == 'LeftButton' then
|
||||
set_item(this.item_record)
|
||||
elseif arg1 == 'RightButton' then
|
||||
aux.set_tab(1)
|
||||
aux.search_tab.set_filter(strlower(aux.info.item(this.item_record.item_id).name)..'/exact')
|
||||
aux.search_tab.execute(nil, false)
|
||||
set_tab(1)
|
||||
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name)..'/exact')
|
||||
search_tab.execute(nil, false)
|
||||
end
|
||||
end,
|
||||
function(item_record)
|
||||
@@ -56,7 +56,7 @@ function create_frames()
|
||||
end
|
||||
)
|
||||
|
||||
auction_listing = aux.listing.CreateScrollingTable(frame.auctions)
|
||||
auction_listing = listing.CreateScrollingTable(frame.auctions)
|
||||
auction_listing:SetColInfo({
|
||||
{ name='Auctions', width=.12, align='CENTER' },
|
||||
{ name='Left', width=.1, align='CENTER' },
|
||||
@@ -81,15 +81,15 @@ function create_frames()
|
||||
end)
|
||||
|
||||
do
|
||||
status_bar = aux.gui.status_bar(frame)
|
||||
status_bar = gui.status_bar(frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('')
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame.parameters, 16)
|
||||
local btn = gui.button(frame.parameters, 16)
|
||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
@@ -98,24 +98,24 @@ function create_frames()
|
||||
post_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame.parameters, 16)
|
||||
local btn = gui.button(frame.parameters, 16)
|
||||
btn:SetPoint('TOPLEFT', post_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
aux.scan.abort(scan_id)
|
||||
scan.abort(scan_id)
|
||||
refresh_entries()
|
||||
refresh = true
|
||||
end)
|
||||
refresh_button = btn
|
||||
end
|
||||
do
|
||||
item = aux.gui.item(frame.parameters)
|
||||
item = gui.item(frame.parameters)
|
||||
item:SetPoint('TOPLEFT', 10, -6)
|
||||
item.button:SetScript('OnEnter', function()
|
||||
if selected_item then
|
||||
aux.info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
|
||||
info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
|
||||
end
|
||||
end)
|
||||
item.button:SetScript('OnLeave', function()
|
||||
@@ -123,7 +123,7 @@ function create_frames()
|
||||
end)
|
||||
end
|
||||
do
|
||||
local slider = aux.gui.slider(frame.parameters)
|
||||
local slider = gui.slider(frame.parameters)
|
||||
slider:SetValueStep(1)
|
||||
slider:SetPoint('TOPLEFT', 13, -74)
|
||||
slider:SetWidth(190)
|
||||
@@ -154,7 +154,7 @@ function create_frames()
|
||||
stack_size_slider = slider
|
||||
end
|
||||
do
|
||||
local slider = aux.gui.slider(frame.parameters)
|
||||
local slider = gui.slider(frame.parameters)
|
||||
slider:SetValueStep(1)
|
||||
slider:SetPoint('TOPLEFT', stack_size_slider, 'BOTTOMLEFT', 0, -32)
|
||||
slider:SetWidth(190)
|
||||
@@ -177,10 +177,10 @@ function create_frames()
|
||||
stack_count_slider = slider
|
||||
end
|
||||
do
|
||||
local dropdown = aux.gui.dropdown(frame.parameters)
|
||||
local dropdown = gui.dropdown(frame.parameters)
|
||||
dropdown:SetPoint('TOPLEFT', stack_count_slider, 'BOTTOMLEFT', 0, -19)
|
||||
dropdown:SetWidth(90)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
|
||||
local label = gui.label(dropdown, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
|
||||
label:SetText('Duration')
|
||||
UIDropDownMenu_Initialize(dropdown, initialize_duration_dropdown)
|
||||
@@ -190,12 +190,12 @@ function create_frames()
|
||||
duration_dropdown = dropdown
|
||||
end
|
||||
do
|
||||
local label = aux.gui.label(frame.parameters, aux.gui.config.medium_font_size)
|
||||
local label = gui.label(frame.parameters, gui.config.medium_font_size)
|
||||
label:SetPoint('LEFT', duration_dropdown, 'RIGHT', 25, 0)
|
||||
deposit = label
|
||||
end
|
||||
do
|
||||
local checkbox = aux.gui.checkbox(frame.parameters)
|
||||
local checkbox = gui.checkbox(frame.parameters)
|
||||
checkbox:SetPoint('TOPRIGHT', -83, -6)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
local settings = read_settings()
|
||||
@@ -203,7 +203,7 @@ function create_frames()
|
||||
write_settings(settings)
|
||||
refresh = true
|
||||
end)
|
||||
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
|
||||
local label = gui.label(checkbox, gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||
label:SetText 'Hide this item'
|
||||
hide_checkbox = checkbox
|
||||
@@ -215,11 +215,11 @@ function create_frames()
|
||||
do
|
||||
local frame = CreateFrame('Frame', nil, frame.parameters)
|
||||
start_price_frame = frame
|
||||
aux.gui.set_content_style(frame)
|
||||
gui.set_content_style(frame)
|
||||
frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60)
|
||||
frame:SetWidth(180)
|
||||
frame:SetHeight(22)
|
||||
local editbox = aux.gui.editbox(frame)
|
||||
local editbox = gui.editbox(frame)
|
||||
editbox:SetAllPoints()
|
||||
editbox:SetAlignment 'RIGHT'
|
||||
editbox:SetFontSize(17)
|
||||
@@ -233,7 +233,7 @@ function create_frames()
|
||||
end
|
||||
end)
|
||||
editbox.change = function()
|
||||
this.pretty:SetText(aux.money.to_string(get_unit_start_price(), true, nil, 3))
|
||||
this.pretty:SetText(money.to_string(get_unit_start_price(), true, nil, 3))
|
||||
refresh = true
|
||||
end
|
||||
editbox.enter = function() this:ClearFocus() end
|
||||
@@ -242,23 +242,23 @@ function create_frames()
|
||||
this:SetAlpha(1)
|
||||
end
|
||||
editbox.focus_loss = function()
|
||||
this:SetText(aux.money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
|
||||
this:SetText(money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
this:SetAlpha(0)
|
||||
end
|
||||
editbox:SetAlpha(0)
|
||||
editbox.pretty = aux.gui.label(frame, 17)
|
||||
editbox.pretty = gui.label(frame, 17)
|
||||
editbox.pretty:SetPoint('LEFT', 1, 0)
|
||||
editbox.pretty:SetPoint('RIGHT', -2, 0)
|
||||
editbox.pretty:SetJustifyH 'RIGHT'
|
||||
editbox.pretty:SetTextColor(aux.gui.color.text.enabled())
|
||||
editbox.pretty:SetTextColor(gui.color.text.enabled())
|
||||
do
|
||||
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
|
||||
local label = gui.label(frame, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
|
||||
label:SetText 'Unit Starting Price'
|
||||
end
|
||||
do
|
||||
local label = aux.gui.label(frame, 14)
|
||||
local label = gui.label(frame, 14)
|
||||
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
|
||||
label:SetWidth(50)
|
||||
label:SetJustifyH 'CENTER'
|
||||
@@ -269,11 +269,11 @@ function create_frames()
|
||||
do
|
||||
local frame = CreateFrame('Frame', nil, frame.parameters)
|
||||
buyout_price_frame = frame
|
||||
aux.gui.set_content_style(frame)
|
||||
gui.set_content_style(frame)
|
||||
frame:SetPoint('TOPRIGHT', unit_start_price, 'BOTTOMRIGHT', 0, -19)
|
||||
frame:SetWidth(180)
|
||||
frame:SetHeight(22)
|
||||
local editbox = aux.gui.editbox(frame)
|
||||
local editbox = gui.editbox(frame)
|
||||
editbox:SetAllPoints()
|
||||
editbox:SetAlignment 'RIGHT'
|
||||
editbox:SetFontSize(17)
|
||||
@@ -285,7 +285,7 @@ function create_frames()
|
||||
end
|
||||
end)
|
||||
editbox.change = function()
|
||||
this.pretty:SetText(aux.money.to_string(get_unit_buyout_price(), true, nil, 3))
|
||||
this.pretty:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3))
|
||||
refresh = true
|
||||
end
|
||||
editbox.enter = function() this:ClearFocus() end
|
||||
@@ -294,23 +294,23 @@ function create_frames()
|
||||
this:SetAlpha(1)
|
||||
end
|
||||
editbox.focus_loss = function()
|
||||
this:SetText(aux.money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
|
||||
this:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
this:SetAlpha(0)
|
||||
end
|
||||
editbox:SetAlpha(0)
|
||||
editbox.pretty = aux.gui.label(frame, 17)
|
||||
editbox.pretty = gui.label(frame, 17)
|
||||
editbox.pretty:SetPoint('LEFT', 1, 0)
|
||||
editbox.pretty:SetPoint('RIGHT', -2, 0)
|
||||
editbox.pretty:SetJustifyH 'RIGHT'
|
||||
editbox.pretty:SetTextColor(aux.gui.color.text.enabled())
|
||||
editbox.pretty:SetTextColor(gui.color.text.enabled())
|
||||
do
|
||||
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
|
||||
local label = gui.label(frame, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
|
||||
label:SetText 'Unit Buyout Price'
|
||||
end
|
||||
do
|
||||
local label = aux.gui.label(frame, 14)
|
||||
local label = gui.label(frame, 14)
|
||||
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
|
||||
label:SetWidth(50)
|
||||
label:SetJustifyH 'CENTER'
|
||||
@@ -319,9 +319,9 @@ function create_frames()
|
||||
unit_buyout_price = editbox
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame.parameters, 14)
|
||||
local btn = gui.button(frame.parameters, 14)
|
||||
btn:SetPoint('TOPRIGHT', -10, -146)
|
||||
aux.gui.set_size(btn, 150, 20)
|
||||
gui.set_size(btn, 150, 20)
|
||||
btn:GetFontString():SetJustifyH 'RIGHT'
|
||||
btn:GetFontString():SetPoint('RIGHT', -2, 0)
|
||||
btn:SetScript('OnClick', function()
|
||||
@@ -330,7 +330,7 @@ function create_frames()
|
||||
set_unit_buyout_price(this.amount)
|
||||
end
|
||||
end)
|
||||
local label = aux.gui.label(btn, aux.gui.config.small_font_size)
|
||||
local label = gui.label(btn, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
|
||||
label:SetText 'Historical Value'
|
||||
historical_value_button = btn
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
aux.module 'search_tab'
|
||||
aux.tab(1, 'Search')
|
||||
g.aux.tab(1, 'Search')
|
||||
|
||||
StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = {
|
||||
text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.',
|
||||
|
||||
+13
-13
@@ -109,8 +109,8 @@ function get_filter_builder_query()
|
||||
end
|
||||
|
||||
local name = blizzard_query.name
|
||||
if not index(aux.filter.parse_query_string(name), 'blizzard', 'name') then
|
||||
name = aux.filter.quote(name)
|
||||
if not index(filter.parse_query_string(name), 'blizzard', 'name') then
|
||||
name = filter.quote(name)
|
||||
end
|
||||
add((name ~= '' or blizzard_query.exact) and name)
|
||||
|
||||
@@ -134,7 +134,7 @@ function get_filter_builder_query()
|
||||
add(strlower(getglobal('ITEM_QUALITY'..quality..'_DESC')))
|
||||
end
|
||||
|
||||
local post_filter_string = aux.filter.query_string{blizzard={}, post=post_filter}
|
||||
local post_filter_string = filter.query_string{blizzard={}, post=post_filter}
|
||||
add(post_filter_string ~= '' and post_filter_string)
|
||||
|
||||
return query_string or ''
|
||||
@@ -171,7 +171,7 @@ function clear_form()
|
||||
end
|
||||
|
||||
function import_query_string()
|
||||
local components, error = aux.filter.parse_query_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
||||
local components, error = filter.parse_query_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
||||
if components then
|
||||
set_form(components)
|
||||
else
|
||||
@@ -195,12 +195,12 @@ function public.formatted_post_filter(components)
|
||||
elseif i > 1 then
|
||||
str = str..'</p><p>'
|
||||
for _=1,getn(stack) do
|
||||
str = str..aux.gui.color.content.background('----')
|
||||
str = str..gui.color.content.background('----')
|
||||
end
|
||||
end
|
||||
no_line_break = component[1] == 'operator' and component[2] == 'not'
|
||||
|
||||
local filter_color = (filter_builder_state.selected == i and aux.gui.color.orange or aux.gui.color.aux)
|
||||
local filter_color = (filter_builder_state.selected == i and gui.color.orange or gui.color.aux)
|
||||
local component_text = filter_color(component[2])
|
||||
if component[1] == 'operator' and component[2] ~= 'not' then
|
||||
component_text = component_text..filter_color(tonumber(component[3]) or '')
|
||||
@@ -208,9 +208,9 @@ function public.formatted_post_filter(components)
|
||||
elseif component[1] == 'filter' then
|
||||
for parameter in present(component[3]) do
|
||||
if component[2] == 'item' then
|
||||
parameter = aux.info.display_name(aux.cache.item_id(parameter)) or '['..parameter..']'
|
||||
elseif aux.filter.filters[component[2]].input_type == 'money' then
|
||||
parameter = aux.money.to_string(aux.money.from_string(parameter), nil, true)
|
||||
parameter = info.display_name(cache.item_id(parameter)) or '['..parameter..']'
|
||||
elseif filter.filters[component[2]].input_type == 'money' then
|
||||
parameter = money.to_string(money.from_string(parameter), nil, true)
|
||||
end
|
||||
component_text = component_text..filter_color(': ')..parameter
|
||||
end
|
||||
@@ -262,13 +262,13 @@ end
|
||||
|
||||
function add_post_filter()
|
||||
for str in present(filter_input:GetText()) do
|
||||
for filter in present(aux.filter.filters[str]) do
|
||||
for filter in present(filter.filters[str]) do
|
||||
if filter.input_type ~= '' then
|
||||
str = str..'/'..filter_parameter_input:GetText()
|
||||
end
|
||||
end
|
||||
|
||||
local components, error, suggestions = aux.filter.parse_query_string(str)
|
||||
local components, error, suggestions = filter.parse_query_string(str)
|
||||
|
||||
if components and getn(components.blizzard) == 0 and getn(components.post) == 1 then
|
||||
add_component(components.post[1])
|
||||
@@ -325,9 +325,9 @@ function initialize_filter_dropdown()
|
||||
value = filter,
|
||||
func = function()
|
||||
filter_input:SetText(this.value)
|
||||
if index(aux.filter.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
||||
if index(filter.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
||||
add_post_filter()
|
||||
elseif aux.filter.filters[this.value] then
|
||||
elseif filter.filters[this.value] then
|
||||
filter_parameter_input:Show()
|
||||
filter_parameter_input:SetFocus()
|
||||
else
|
||||
|
||||
+82
-82
@@ -3,31 +3,31 @@ aux.module 'search_tab'
|
||||
FILTER_SPACING = 28.5
|
||||
|
||||
function create_frames()
|
||||
frame = CreateFrame('Frame', nil, aux.frame)
|
||||
frame = CreateFrame('Frame', nil, frame)
|
||||
frame:SetAllPoints()
|
||||
frame:SetScript('OnUpdate', on_update)
|
||||
frame:Hide()
|
||||
|
||||
frame.filter = aux.gui.panel(frame)
|
||||
frame.filter:SetAllPoints(aux.frame.content)
|
||||
frame.filter = gui.panel(frame)
|
||||
frame.filter:SetAllPoints(frame.content)
|
||||
|
||||
frame.results = aux.gui.panel(frame)
|
||||
frame.results:SetAllPoints(aux.frame.content)
|
||||
frame.results = gui.panel(frame)
|
||||
frame.results:SetAllPoints(frame.content)
|
||||
|
||||
frame.saved = CreateFrame('Frame', nil, frame)
|
||||
frame.saved:SetAllPoints(aux.frame.content)
|
||||
frame.saved:SetAllPoints(frame.content)
|
||||
|
||||
frame.saved.favorite = aux.gui.panel(frame.saved)
|
||||
frame.saved.favorite = gui.panel(frame.saved)
|
||||
frame.saved.favorite:SetWidth(378.5)
|
||||
frame.saved.favorite:SetPoint('TOPLEFT', 0, 0)
|
||||
frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0)
|
||||
|
||||
frame.saved.recent = aux.gui.panel(frame.saved)
|
||||
frame.saved.recent = gui.panel(frame.saved)
|
||||
frame.saved.recent:SetWidth(378.5)
|
||||
frame.saved.recent:SetPoint('TOPRIGHT', 0, 0)
|
||||
frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0)
|
||||
do
|
||||
local btn = aux.gui.button(frame)
|
||||
local btn = gui.button(frame)
|
||||
btn:SetPoint('TOPLEFT', 0, 0)
|
||||
btn:SetWidth(42)
|
||||
btn:SetHeight(42)
|
||||
@@ -54,7 +54,7 @@ function create_frames()
|
||||
do
|
||||
local panel = CreateFrame('Frame', nil, frame)
|
||||
panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]}
|
||||
panel:SetBackdropColor(unpack(aux.gui.color.content.background))
|
||||
panel:SetBackdropColor(unpack(gui.color.content.background))
|
||||
panel:SetPoint('LEFT', settings_button, 'RIGHT', 0, 0)
|
||||
panel:SetPoint('RIGHT', 0, 0)
|
||||
panel:SetHeight(42)
|
||||
@@ -76,42 +76,42 @@ function create_frames()
|
||||
this:SetText(valid_input)
|
||||
end
|
||||
if blizzard_page_index(this:GetText()) and not real_time_button:GetChecked() then
|
||||
this:SetBackdropColor(aux.gui.color.state.enabled())
|
||||
this:SetBackdropColor(gui.color.state.enabled())
|
||||
else
|
||||
this:SetBackdropColor(aux.gui.color.state.disabled())
|
||||
this:SetBackdropColor(gui.color.state.disabled())
|
||||
end
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(settings)
|
||||
local editbox = gui.editbox(settings)
|
||||
editbox:SetPoint('LEFT', 75, 0)
|
||||
editbox:SetWidth(50)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetScript('OnTabPressed', function() last_page_input:SetFocus() end)
|
||||
editbox.enter = execute
|
||||
editbox.change = change
|
||||
local label = aux.gui.label(editbox, 16)
|
||||
local label = gui.label(editbox, 16)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
|
||||
label:SetText('Pages')
|
||||
label:SetTextColor(aux.gui.color.text.enabled())
|
||||
label:SetTextColor(gui.color.text.enabled())
|
||||
first_page_input = editbox
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(settings)
|
||||
local editbox = gui.editbox(settings)
|
||||
editbox:SetPoint('LEFT', first_page_input, 'RIGHT', 10, 0)
|
||||
editbox:SetWidth(50)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetScript('OnTabPressed', function() first_page_input:SetFocus() end)
|
||||
editbox.enter = execute
|
||||
editbox.change = change
|
||||
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
|
||||
local label = gui.label(editbox, gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
||||
label:SetText('-')
|
||||
label:SetTextColor(aux.gui.color.text.enabled())
|
||||
label:SetTextColor(gui.color.text.enabled())
|
||||
last_page_input = editbox
|
||||
end
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.checkbutton(settings)
|
||||
local btn = gui.checkbutton(settings)
|
||||
btn:SetPoint('LEFT', 230, 0)
|
||||
btn:SetWidth(140)
|
||||
btn:SetHeight(25)
|
||||
@@ -126,7 +126,7 @@ function create_frames()
|
||||
public.real_time_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.checkbutton(settings)
|
||||
local btn = gui.checkbutton(settings)
|
||||
btn:SetPoint('LEFT', real_time_button, 'RIGHT', 15, 0)
|
||||
btn:SetWidth(140)
|
||||
btn:SetHeight(25)
|
||||
@@ -141,7 +141,7 @@ function create_frames()
|
||||
auto_buy_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.checkbutton(settings)
|
||||
local btn = gui.checkbutton(settings)
|
||||
btn:SetPoint('LEFT', auto_buy_button, 'RIGHT', 15, 0)
|
||||
btn:SetWidth(140)
|
||||
btn:SetHeight(25)
|
||||
@@ -169,7 +169,7 @@ function create_frames()
|
||||
auto_buy_filter_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(controls, 25)
|
||||
local btn = gui.button(controls, 25)
|
||||
btn:SetPoint('LEFT', 5, 0)
|
||||
btn:SetWidth(30)
|
||||
btn:SetHeight(25)
|
||||
@@ -178,7 +178,7 @@ function create_frames()
|
||||
previous_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(controls, 25)
|
||||
local btn = gui.button(controls, 25)
|
||||
btn:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0)
|
||||
btn:SetWidth(30)
|
||||
btn:SetHeight(25)
|
||||
@@ -187,7 +187,7 @@ function create_frames()
|
||||
next_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(controls, aux.gui.config.huge_font_size)
|
||||
local btn = gui.button(controls, gui.config.huge_font_size)
|
||||
btn:SetPoint('RIGHT', -5, 0)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
@@ -202,31 +202,31 @@ function create_frames()
|
||||
start_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(controls, aux.gui.config.huge_font_size)
|
||||
local btn = gui.button(controls, gui.config.huge_font_size)
|
||||
btn:SetPoint('RIGHT', -5, 0)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Stop')
|
||||
btn:SetScript('OnClick', function()
|
||||
aux.scan.abort(search_scan_id)
|
||||
scan.abort(search_scan_id)
|
||||
end)
|
||||
stop_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(controls, aux.gui.config.huge_font_size)
|
||||
local btn = gui.button(controls, gui.config.huge_font_size)
|
||||
btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText(aux.gui.color.green 'Resume')
|
||||
btn:SetText(gui.color.green 'Resume')
|
||||
btn:SetScript('OnClick', function()
|
||||
execute(true)
|
||||
end)
|
||||
resume_button = btn
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(controls)
|
||||
local editbox = gui.editbox(controls)
|
||||
editbox:EnableMouse(1)
|
||||
editbox.complete = aux.completion.complete_filter
|
||||
editbox.complete = completion.complete_filter
|
||||
editbox:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
|
||||
editbox:SetHeight(25)
|
||||
editbox.char = function()
|
||||
@@ -239,11 +239,11 @@ function create_frames()
|
||||
search_box = editbox
|
||||
end
|
||||
do
|
||||
aux.gui.horizontal_line(frame, -40)
|
||||
gui.horizontal_line(frame, -40)
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
|
||||
btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8)
|
||||
local btn = gui.button(frame, gui.config.large_font_size2)
|
||||
btn:SetPoint('BOTTOMLEFT', frame.content, 'TOPLEFT', 10, 8)
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
btn:SetText 'Search Results'
|
||||
@@ -251,7 +251,7 @@ function create_frames()
|
||||
search_results_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
|
||||
local btn = gui.button(frame, gui.config.large_font_size2)
|
||||
btn:SetPoint('TOPLEFT', search_results_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
@@ -260,7 +260,7 @@ function create_frames()
|
||||
saved_searches_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
|
||||
local btn = gui.button(frame, gui.config.large_font_size2)
|
||||
btn:SetPoint('TOPLEFT', saved_searches_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
@@ -272,11 +272,11 @@ function create_frames()
|
||||
local frame = CreateFrame('Frame', nil, frame)
|
||||
frame:SetWidth(265)
|
||||
frame:SetHeight(25)
|
||||
frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
frame:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar_frame = frame
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame.results, 16)
|
||||
local btn = gui.button(frame.results, 16)
|
||||
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
@@ -285,7 +285,7 @@ function create_frames()
|
||||
bid_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame.results, 16)
|
||||
local btn = gui.button(frame.results, 16)
|
||||
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
@@ -294,7 +294,7 @@ function create_frames()
|
||||
buyout_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame.results, 16)
|
||||
local btn = gui.button(frame.results, 16)
|
||||
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
@@ -305,13 +305,13 @@ function create_frames()
|
||||
end)
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(frame.saved, 16)
|
||||
local btn = gui.button(frame.saved, 16)
|
||||
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText 'Favorite'
|
||||
btn:SetScript('OnClick', function()
|
||||
local filters = aux.filter.queries(search_box:GetText())
|
||||
local filters = filter.queries(search_box:GetText())
|
||||
if filters then
|
||||
tinsert(g.aux_favorite_searches, 1, {
|
||||
filter_string = search_box:GetText(),
|
||||
@@ -322,30 +322,30 @@ function create_frames()
|
||||
end)
|
||||
end
|
||||
do
|
||||
local btn1 = aux.gui.button(frame.filter, 16)
|
||||
local btn1 = gui.button(frame.filter, 16)
|
||||
btn1:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
|
||||
aux.gui.set_size(btn1, 80, 24)
|
||||
gui.set_size(btn1, 80, 24)
|
||||
btn1:SetText 'Search'
|
||||
btn1:SetScript('OnClick', function()
|
||||
export_query_string()
|
||||
execute()
|
||||
end)
|
||||
|
||||
local btn2 = aux.gui.button(frame.filter, 16)
|
||||
local btn2 = gui.button(frame.filter, 16)
|
||||
btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0)
|
||||
aux.gui.set_size(btn2, 80, 24)
|
||||
gui.set_size(btn2, 80, 24)
|
||||
btn2:SetText 'Export'
|
||||
btn2:SetScript('OnClick', export_query_string)
|
||||
|
||||
local btn3 = aux.gui.button(frame.filter, 16)
|
||||
local btn3 = gui.button(frame.filter, 16)
|
||||
btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0)
|
||||
aux.gui.set_size(btn3, 80, 24)
|
||||
gui.set_size(btn3, 80, 24)
|
||||
btn3:SetText 'Import'
|
||||
btn3:SetScript('OnClick', import_query_string)
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(frame.filter)
|
||||
editbox.complete_item = aux.completion.complete(function() return g.aux_auctionable_items end)
|
||||
local editbox = gui.editbox(frame.filter)
|
||||
editbox.complete_item = completion.complete(function() return g.aux_auctionable_items end)
|
||||
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
|
||||
editbox:SetWidth(260)
|
||||
editbox.char = function()
|
||||
@@ -365,22 +365,22 @@ function create_frames()
|
||||
end)
|
||||
editbox.change = update_form
|
||||
editbox.enter = L(editbox.ClearFocus, editbox)
|
||||
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
|
||||
local label = gui.label(editbox, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText 'Name'
|
||||
name_input = editbox
|
||||
end
|
||||
do
|
||||
local checkbox = aux.gui.checkbox(frame.filter)
|
||||
local checkbox = gui.checkbox(frame.filter)
|
||||
checkbox:SetPoint('TOPLEFT', name_input, 'TOPRIGHT', 16, 0)
|
||||
checkbox:SetScript('OnClick', update_form)
|
||||
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
|
||||
local label = gui.label(checkbox, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Exact')
|
||||
exact_checkbox = checkbox
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(frame.filter)
|
||||
local editbox = gui.editbox(frame.filter)
|
||||
editbox:SetPoint('TOPLEFT', name_input, 'BOTTOMLEFT', 0, -FILTER_SPACING)
|
||||
editbox:SetWidth(125)
|
||||
editbox:SetNumeric(true)
|
||||
@@ -399,13 +399,13 @@ function create_frames()
|
||||
end
|
||||
update_form()
|
||||
end
|
||||
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
|
||||
local label = gui.label(editbox, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText 'Level Range'
|
||||
min_level_input = editbox
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(frame.filter)
|
||||
local editbox = gui.editbox(frame.filter)
|
||||
editbox:SetPoint('TOPLEFT', min_level_input, 'TOPRIGHT', 10, 0)
|
||||
editbox:SetWidth(125)
|
||||
editbox:SetNumeric(true)
|
||||
@@ -424,26 +424,26 @@ function create_frames()
|
||||
end
|
||||
update_form()
|
||||
end
|
||||
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
|
||||
local label = gui.label(editbox, gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
|
||||
label:SetText('-')
|
||||
max_level_input = editbox
|
||||
end
|
||||
do
|
||||
local checkbox = aux.gui.checkbox(frame.filter)
|
||||
local checkbox = gui.checkbox(frame.filter)
|
||||
checkbox:SetPoint('TOPLEFT', max_level_input, 'TOPRIGHT', 16, 0)
|
||||
checkbox:SetScript('OnClick', update_form)
|
||||
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
|
||||
local label = gui.label(checkbox, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Usable')
|
||||
usable_checkbox = checkbox
|
||||
end
|
||||
do
|
||||
local dropdown = aux.gui.dropdown(frame.filter)
|
||||
local dropdown = gui.dropdown(frame.filter)
|
||||
class_dropdown = dropdown
|
||||
dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING)
|
||||
dropdown:SetWidth(300)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
|
||||
local label = gui.label(dropdown, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
|
||||
label:SetText('Item Class')
|
||||
UIDropDownMenu_Initialize(dropdown, initialize_class_dropdown)
|
||||
@@ -452,11 +452,11 @@ function create_frames()
|
||||
end)
|
||||
end
|
||||
do
|
||||
local dropdown = aux.gui.dropdown(frame.filter)
|
||||
local dropdown = gui.dropdown(frame.filter)
|
||||
subclass_dropdown = dropdown
|
||||
dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
||||
dropdown:SetWidth(300)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
|
||||
local label = gui.label(dropdown, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
|
||||
label:SetText('Item Subclass')
|
||||
UIDropDownMenu_Initialize(dropdown, initialize_subclass_dropdown)
|
||||
@@ -465,11 +465,11 @@ function create_frames()
|
||||
end)
|
||||
end
|
||||
do
|
||||
local dropdown = aux.gui.dropdown(frame.filter)
|
||||
local dropdown = gui.dropdown(frame.filter)
|
||||
slot_dropdown = dropdown
|
||||
dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
||||
dropdown:SetWidth(300)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
|
||||
local label = gui.label(dropdown, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
|
||||
label:SetText('Item Slot')
|
||||
UIDropDownMenu_Initialize(dropdown, initialize_slot_dropdown)
|
||||
@@ -478,11 +478,11 @@ function create_frames()
|
||||
end)
|
||||
end
|
||||
do
|
||||
local dropdown = aux.gui.dropdown(frame.filter)
|
||||
local dropdown = gui.dropdown(frame.filter)
|
||||
quality_dropdown = dropdown
|
||||
dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
|
||||
dropdown:SetWidth(300)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
|
||||
local label = gui.label(dropdown, gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
|
||||
label:SetText('Min Quality')
|
||||
UIDropDownMenu_Initialize(dropdown, initialize_quality_dropdown)
|
||||
@@ -490,9 +490,9 @@ function create_frames()
|
||||
UIDropDownMenu_Initialize(this, initialize_quality_dropdown)
|
||||
end)
|
||||
end
|
||||
aux.gui.vertical_line(frame.filter, 332)
|
||||
gui.vertical_line(frame.filter, 332)
|
||||
do
|
||||
local dropdown = aux.gui.dropdown(frame.filter)
|
||||
local dropdown = gui.dropdown(frame.filter)
|
||||
dropdown:SetPoint('TOPRIGHT', -174.5, -10)
|
||||
dropdown:SetWidth(150)
|
||||
UIDropDownMenu_Initialize(dropdown, initialize_filter_dropdown)
|
||||
@@ -500,24 +500,24 @@ function create_frames()
|
||||
UIDropDownMenu_Initialize(this, initialize_filter_dropdown)
|
||||
end)
|
||||
getglobal(dropdown:GetName()..'Text'):Hide()
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size)
|
||||
local label = gui.label(dropdown, gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
|
||||
label:SetText('Post Filter')
|
||||
filter_dropdown = dropdown
|
||||
end
|
||||
do
|
||||
local input = aux.gui.editbox(frame.filter)
|
||||
local input = gui.editbox(frame.filter)
|
||||
input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0)
|
||||
input:SetWidth(150)
|
||||
input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end)
|
||||
input.complete = aux.completion.complete(function() return {'and', 'or', 'not', unpack(keys(aux.filter.filters))} end)
|
||||
input.complete = completion.complete(function() return {'and', 'or', 'not', unpack(keys(filter.filters))} end)
|
||||
input.char = function() this:complete() end
|
||||
input.change = function()
|
||||
local filter = this:GetText()
|
||||
if aux.filter.filters[filter] and aux.filter.filters[filter].input_type ~= '' then
|
||||
local _, _, suggestions = aux.filter.parse_query_string(filter..'/')
|
||||
filter_parameter_input:SetNumeric(aux.filter.filters[filter].input_type == 'number')
|
||||
filter_parameter_input.complete = aux.completion.complete(function() return suggestions or {} end)
|
||||
if filter.filters[filter] and filter.filters[filter].input_type ~= '' then
|
||||
local _, _, suggestions = filter.parse_query_string(filter..'/')
|
||||
filter_parameter_input:SetNumeric(filter.filters[filter].input_type == 'number')
|
||||
filter_parameter_input.complete = completion.complete(function() return suggestions or {} end)
|
||||
filter_parameter_input:Show()
|
||||
else
|
||||
filter_parameter_input:Hide()
|
||||
@@ -533,7 +533,7 @@ function create_frames()
|
||||
filter_input = input
|
||||
end
|
||||
do
|
||||
local input = aux.gui.editbox(frame.filter)
|
||||
local input = gui.editbox(frame.filter)
|
||||
input:SetPoint('LEFT', filter_dropdown, 'RIGHT', 10, 0)
|
||||
input:SetWidth(150)
|
||||
input:SetScript('OnTabPressed', function()
|
||||
@@ -575,11 +575,11 @@ function create_frames()
|
||||
scroll_frame:SetScript('OnDragStop', function()
|
||||
this:SetScript('OnUpdate', nil)
|
||||
end)
|
||||
aux.gui.set_content_style(scroll_frame, -2, -2, -2, -2)
|
||||
gui.set_content_style(scroll_frame, -2, -2, -2, -2)
|
||||
local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame)
|
||||
scroll_frame:SetScrollChild(scroll_child)
|
||||
scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], 23)
|
||||
scroll_child:SetTextColor('p', aux.gui.color.label.enabled())
|
||||
scroll_child:SetTextColor('p', gui.color.label.enabled())
|
||||
scroll_child:SetWidth(1)
|
||||
scroll_child:SetHeight(1)
|
||||
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
|
||||
@@ -591,12 +591,12 @@ function create_frames()
|
||||
status_bars = {}
|
||||
tables = {}
|
||||
for _=1,5 do
|
||||
local status_bar = aux.gui.status_bar(frame)
|
||||
local status_bar = gui.status_bar(frame)
|
||||
status_bar:SetAllPoints(status_bar_frame)
|
||||
status_bar:Hide()
|
||||
tinsert(status_bars, status_bar)
|
||||
|
||||
local table = aux.auction_listing.CreateAuctionResultsTable(frame.results, aux.auction_listing.search_config)
|
||||
local table = auction_listing.CreateAuctionResultsTable(frame.results, auction_listing.search_config)
|
||||
table:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and current_search.table:GetSelection().record == cell.row.data.record then
|
||||
if button == 'LeftButton' and buyout_button:IsEnabled() then
|
||||
@@ -659,7 +659,7 @@ function create_frames()
|
||||
end
|
||||
}
|
||||
|
||||
recent_searches_listing = aux.listing.CreateScrollingTable(frame.saved.recent)
|
||||
recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
|
||||
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
|
||||
recent_searches_listing:EnableSorting(false)
|
||||
recent_searches_listing:DisableSelection(true)
|
||||
@@ -667,7 +667,7 @@ function create_frames()
|
||||
recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
|
||||
recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
|
||||
|
||||
favorite_searches_listing = aux.listing.CreateScrollingTable(frame.saved.favorite)
|
||||
favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite)
|
||||
favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}}
|
||||
favorite_searches_listing:EnableSorting(false)
|
||||
favorite_searches_listing:DisableSelection(true)
|
||||
|
||||
+17
-17
@@ -98,7 +98,7 @@ function update_continuation()
|
||||
end
|
||||
|
||||
function discard_continuation()
|
||||
aux.scan.abort(search_scan_id)
|
||||
scan.abort(search_scan_id)
|
||||
current_search.continuation = nil
|
||||
update_continuation()
|
||||
end
|
||||
@@ -115,7 +115,7 @@ end
|
||||
|
||||
function update_auto_buy_filter()
|
||||
if g.aux_auto_buy_filter ~= '' then
|
||||
local queries = aux.filter.queries(g.aux_auto_buy_filter)
|
||||
local queries = filter.queries(g.aux_auto_buy_filter)
|
||||
if queries then
|
||||
if getn(queries) > 1 then
|
||||
log('Error: The automatic buyout filter may contain only one query')
|
||||
@@ -144,7 +144,7 @@ function start_real_time_scan(query, search, continuation)
|
||||
|
||||
local next_page
|
||||
local new_records = {}
|
||||
search_scan_id = aux.scan.start{
|
||||
search_scan_id = scan.start{
|
||||
type = 'list',
|
||||
queries = {query},
|
||||
auto_buy_validator = search.auto_buy_validator,
|
||||
@@ -162,8 +162,8 @@ function start_real_time_scan(query, search, continuation)
|
||||
if not ignore_page then
|
||||
if search.auto_buy then
|
||||
ctrl.suspend()
|
||||
aux.place_bid('list', auction_record.index, auction_record.buyout_price, L(ctrl.resume, true))
|
||||
aux.control.thread(aux.control.when, later(GetTime(), 10), L(ctrl.resume, false))
|
||||
place_bid('list', auction_record.index, auction_record.buyout_price, L(ctrl.resume, true))
|
||||
control.thread(control.when, later(GetTime(), 10), L(ctrl.resume, false))
|
||||
else
|
||||
tinsert(new_records, auction_record)
|
||||
end
|
||||
@@ -228,7 +228,7 @@ function start_search(queries, continuation)
|
||||
end
|
||||
|
||||
|
||||
search_scan_id = aux.scan.start{
|
||||
search_scan_id = scan.start{
|
||||
type = 'list',
|
||||
queries = queries,
|
||||
auto_buy_validator = search.auto_buy_validator,
|
||||
@@ -258,8 +258,8 @@ function start_search(queries, continuation)
|
||||
on_auction = function(auction_record, ctrl)
|
||||
if search.auto_buy then
|
||||
ctrl.suspend()
|
||||
aux.place_bid('list', auction_record.index, auction_record.buyout_price, L(ctrl.resume, true))
|
||||
aux.control.thread(aux.control.when, later(GetTime(), 10), L(ctrl.resume, false))
|
||||
place_bid('list', auction_record.index, auction_record.buyout_price, L(ctrl.resume, true))
|
||||
control.thread(control.when, later(GetTime(), 10), L(ctrl.resume, false))
|
||||
elseif getn(search.records) < 1000 then
|
||||
tinsert(search.records, auction_record)
|
||||
if getn(search.records) == 1000 then
|
||||
@@ -310,7 +310,7 @@ function public.execute(resume, real_time)
|
||||
end
|
||||
local filter_string = search_box:GetText()
|
||||
|
||||
local queries = aux.filter.queries(filter_string)
|
||||
local queries = filter.queries(filter_string)
|
||||
if not queries then
|
||||
return
|
||||
elseif real_time then
|
||||
@@ -367,7 +367,7 @@ end
|
||||
|
||||
function test(record)
|
||||
return function(index)
|
||||
local auction_info = aux.info.auction(index)
|
||||
local auction_info = info.auction(index)
|
||||
return auction_info and auction_info.search_signature == record.search_signature
|
||||
end
|
||||
end
|
||||
@@ -381,13 +381,13 @@ do
|
||||
function find_auction(record)
|
||||
local search = current_search
|
||||
|
||||
if not search.table:ContainsRecord(record) or aux.is_player(record.owner) then
|
||||
if not search.table:ContainsRecord(record) or is_player(record.owner) then
|
||||
return
|
||||
end
|
||||
|
||||
aux.scan.abort(scan_id)
|
||||
scan.abort(scan_id)
|
||||
state = SEARCHING
|
||||
scan_id = aux.scan_util.find(
|
||||
scan_id = scan_util.find(
|
||||
record,
|
||||
current_search.status_bar,
|
||||
function()
|
||||
@@ -408,8 +408,8 @@ do
|
||||
if not record.high_bidder then
|
||||
bid_button:SetScript('OnClick', function()
|
||||
if test(record)(index) and search.table:ContainsRecord(record) then
|
||||
aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||
aux.info.bid_update(record)
|
||||
place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||
info.bid_update(record)
|
||||
search.table:SetDatabase()
|
||||
end or L(search.table.RemoveAuctionRecord, search.table, record))
|
||||
end
|
||||
@@ -420,7 +420,7 @@ do
|
||||
if record.buyout_price > 0 then
|
||||
buyout_button:SetScript('OnClick', function()
|
||||
if test(record)(index) and search.table:ContainsRecord(record) then
|
||||
aux.place_bid('list', index, record.buyout_price, L(search.table.RemoveAuctionRecord, search.table, record))
|
||||
place_bid('list', index, record.buyout_price, L(search.table.RemoveAuctionRecord, search.table, record))
|
||||
end
|
||||
end)
|
||||
buyout_button:Enable()
|
||||
@@ -447,7 +447,7 @@ do
|
||||
elseif state == FOUND and not test(selection.record)(found_index) then
|
||||
buyout_button:Disable()
|
||||
bid_button:Disable()
|
||||
if not aux.bid_in_progress() then
|
||||
if not bid_in_progress() then
|
||||
state = IDLE
|
||||
end
|
||||
end
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ function public:complete_filter()
|
||||
local filter_string = this:GetText()
|
||||
|
||||
local completed_filter_string = ({strfind(filter_string, '([^;]*)/[^/;]*$')})[3]
|
||||
local _, suggestions = aux.filter.query(completed_filter_string or '')
|
||||
local _, suggestions = filter.query(completed_filter_string or '')
|
||||
|
||||
local start_index, _, current_modifier = strfind(filter_string, '([^/;]*)$')
|
||||
current_modifier = current_modifier or ''
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
aux.module 'util'
|
||||
|
||||
local temp, recycle, getn = temp, recycle, g.getn
|
||||
local temp, recycle, getn = g.temp, g.recycle, g.getn
|
||||
|
||||
function public.copy(t)
|
||||
local copy = {}
|
||||
@@ -9,6 +9,12 @@ function public.copy(t)
|
||||
return copy
|
||||
end
|
||||
|
||||
public.join = g.table.concat
|
||||
|
||||
function public.replicate(count, value)
|
||||
if count > 0 then return value, replicate(count - 1, value) end
|
||||
end
|
||||
|
||||
do
|
||||
local value, charges
|
||||
local function setter(n)
|
||||
@@ -18,7 +24,7 @@ do
|
||||
return v
|
||||
end
|
||||
end
|
||||
for i=1,9 do public[join(replicate(i, 'x'))] = setter(i) end
|
||||
for i=1,9 do public[join{replicate(i, 'x')}] = setter(i) end
|
||||
function public.accessor.__()
|
||||
assert(charges > 0)
|
||||
charges = charges - 1
|
||||
@@ -183,10 +189,6 @@ function public.all(xs, p)
|
||||
return true
|
||||
end
|
||||
|
||||
function public.replicate(count, value)
|
||||
return value, replicate(count - 1, value)
|
||||
end
|
||||
|
||||
function public.filter(xs, p)
|
||||
local ys = {}
|
||||
for k, x in xs do
|
||||
@@ -233,8 +235,6 @@ function public.split(str, separator)
|
||||
end
|
||||
end
|
||||
|
||||
public.join = g.table.concat
|
||||
|
||||
function public.tokenize(str)
|
||||
local tokens = {}
|
||||
for token in string.gfind(str, '%S+') do tinsert(tokens, token) end
|
||||
@@ -265,9 +265,9 @@ function public.bag_type(bag)
|
||||
return 1
|
||||
end
|
||||
for link in present(GetInventoryItemLink('player', ContainerIDToInventoryID(bag))) do
|
||||
local item_id = aux.info.parse_link(link)
|
||||
local item_info = aux.info.item(item_id)
|
||||
return aux.info.item_subclass_index(3, item_info.subclass)
|
||||
local item_id = info.parse_link(link)
|
||||
local item_info = info.item(item_id)
|
||||
return info.item_subclass_index(3, item_info.subclass)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+33
-33
@@ -19,7 +19,7 @@ public.filters = {
|
||||
input_type = '',
|
||||
validator = function()
|
||||
return function(auction_record)
|
||||
return auction_record.usable and not aux.info.tooltip_match(ITEM_SPELL_KNOWN, auction_record.tooltip)
|
||||
return auction_record.usable and not info.tooltip_match(ITEM_SPELL_KNOWN, auction_record.tooltip)
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -35,7 +35,7 @@ public.filters = {
|
||||
input_type = 'string',
|
||||
validator = function(name)
|
||||
return function(auction_record)
|
||||
return strlower(aux.info.item(auction_record.item_id).name) == name
|
||||
return strlower(info.item(auction_record.item_id).name) == name
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -117,8 +117,8 @@ public.filters = {
|
||||
validator = function(pct)
|
||||
return function(auction_record)
|
||||
return auction_record.unit_buyout_price > 0
|
||||
and aux.history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
|
||||
and history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / history.value(auction_record.item_key) * 100 <= pct
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -128,8 +128,8 @@ public.filters = {
|
||||
validator = function(pct)
|
||||
return function(auction_record)
|
||||
return auction_record.unit_buyout_price > 0
|
||||
and aux.history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
|
||||
and history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / history.value(auction_record.item_key) * 100 <= pct
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -138,7 +138,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
return aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||
return history.value(auction_record.item_key) and history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -147,7 +147,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
return auction_record.buyout_price > 0 and aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||
return auction_record.buyout_price > 0 and history.value(auction_record.item_key) and history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -156,7 +156,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||
local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||
return disenchant_value and disenchant_value - auction_record.bid_price >= amount
|
||||
end
|
||||
end
|
||||
@@ -166,7 +166,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||
local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||
return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
|
||||
end
|
||||
end
|
||||
@@ -176,7 +176,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
local vendor_price = aux.cache.merchant_info(auction_record.item_id)
|
||||
local vendor_price = cache.merchant_info(auction_record.item_id)
|
||||
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||
end
|
||||
end
|
||||
@@ -186,7 +186,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
local vendor_price = aux.cache.merchant_info(auction_record.item_id)
|
||||
local vendor_price = cache.merchant_info(auction_record.item_id)
|
||||
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||
end
|
||||
end
|
||||
@@ -234,10 +234,10 @@ do
|
||||
end
|
||||
end
|
||||
for _, parser in {
|
||||
{'class', aux.info.item_class_index},
|
||||
{'subclass', L(aux.info.item_subclass_index, index(self.class, 2) or 0, _1)},
|
||||
{'slot', L(aux.info.item_slot_index, index(self.class, 2) or 0, index(self.subclass, 2) or 0, _1)},
|
||||
{'quality', aux.info.item_quality_index},
|
||||
{'class', info.item_class_index},
|
||||
{'subclass', L(info.item_subclass_index, index(self.class, 2) or 0, _1)},
|
||||
{'slot', L(info.item_slot_index, index(self.class, 2) or 0, index(self.subclass, 2) or 0, _1)},
|
||||
{'quality', info.item_quality_index},
|
||||
} do
|
||||
if not self[parser[1]] then
|
||||
tinsert(parser, str)
|
||||
@@ -266,7 +266,7 @@ end
|
||||
|
||||
function parse_parameter(input_type, str)
|
||||
if input_type == 'money' then
|
||||
local money = aux.money.from_string(str)
|
||||
local money = money.from_string(str)
|
||||
return money and money > 0 and money or nil
|
||||
elseif input_type == 'number' then
|
||||
local number = tonumber(str)
|
||||
@@ -444,8 +444,8 @@ function public.query_string(components)
|
||||
elseif component[1] == 'filter' then
|
||||
query_builder.append(component[2])
|
||||
for _, parameter in {component[3]} do
|
||||
if aux.filter.filters[component[2]].input_type == 'money' then
|
||||
parameter = aux.money.to_string(aux.money.from_string(parameter), nil, true, nil, nil, true)
|
||||
if filter.filters[component[2]].input_type == 'money' then
|
||||
parameter = money.to_string(money.from_string(parameter), nil, true, nil, nil, true)
|
||||
end
|
||||
query_builder.append(parameter)
|
||||
end
|
||||
@@ -460,38 +460,38 @@ function prettified_query_string(components)
|
||||
|
||||
for key, filter in components.blizzard do
|
||||
if key == 'exact' then
|
||||
prettified.prepend(aux.info.display_name(aux.cache.item_id(components.blizzard.name[2])) or aux.gui.color.blizzard('['..components.blizzard.name[2]..']'))
|
||||
prettified.prepend(info.display_name(cache.item_id(components.blizzard.name[2])) or gui.color.blizzard('['..components.blizzard.name[2]..']'))
|
||||
elseif key ~= 'name' then
|
||||
prettified.append(aux.gui.color.blizzard(filter[1]))
|
||||
prettified.append(gui.color.blizzard(filter[1]))
|
||||
end
|
||||
end
|
||||
|
||||
if components.blizzard.name and not components.blizzard.exact and components.blizzard.name[2] ~= '' then
|
||||
prettified.prepend(aux.gui.color.blizzard(components.blizzard.name[2]))
|
||||
prettified.prepend(gui.color.blizzard(components.blizzard.name[2]))
|
||||
end
|
||||
|
||||
for _, component in components.post do
|
||||
if component[1] == 'operator' then
|
||||
prettified.append(aux.gui.color.aux(component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')))
|
||||
prettified.append(gui.color.aux(component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')))
|
||||
elseif component[1] == 'filter' then
|
||||
if component[2] ~= 'tooltip' then
|
||||
prettified.append(aux.gui.color.aux(component[2]))
|
||||
prettified.append(gui.color.aux(component[2]))
|
||||
end
|
||||
for parameter in present(component[3]) do
|
||||
if component[2] == 'item' then
|
||||
prettified.append(aux.info.display_name(aux.cache.item_id(parameter)) or aux.gui.color.label.enabled('['..parameter..']'))
|
||||
prettified.append(info.display_name(cache.item_id(parameter)) or gui.color.label.enabled('['..parameter..']'))
|
||||
else
|
||||
if filters[component[2]].input_type == 'money' then
|
||||
prettified.append(aux.money.to_string(aux.money.from_string(parameter), nil, true, nil, aux.gui.inline_color.label.enabled))
|
||||
prettified.append(money.to_string(money.from_string(parameter), nil, true, nil, gui.inline_color.label.enabled))
|
||||
else
|
||||
prettified.append(aux.gui.color.label.enabled(parameter))
|
||||
prettified.append(gui.color.label.enabled(parameter))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if prettified.get() == '' then
|
||||
return aux.gui.color.blizzard'<>'
|
||||
return gui.color.blizzard'<>'
|
||||
else
|
||||
return prettified.get()
|
||||
end
|
||||
@@ -511,11 +511,11 @@ function blizzard_query(components)
|
||||
local query = {name=filters.name and filters.name[2]}
|
||||
|
||||
local item_info, class_index, subclass_index, slot_index
|
||||
if filters.exact and x(aux.cache.item_id(filters.name[2])) and x(aux.info.item(__)) then
|
||||
if filters.exact and x(cache.item_id(filters.name[2])) and x(info.item(__)) then
|
||||
item_info = __
|
||||
class_index = aux.info.item_class_index(item_info.class)
|
||||
subclass_index = aux.info.item_subclass_index(class_index or 0, item_info.subclass)
|
||||
slot_index = aux.info.item_slot_index(class_index or 0, subclass_index or 0, item_info.slot)
|
||||
class_index = info.item_class_index(item_info.class)
|
||||
subclass_index = info.item_subclass_index(class_index or 0, item_info.subclass)
|
||||
slot_index = info.item_slot_index(class_index or 0, subclass_index or 0, item_info.slot)
|
||||
end
|
||||
|
||||
if item_info then
|
||||
@@ -544,7 +544,7 @@ function validator(components)
|
||||
end
|
||||
|
||||
return function(record)
|
||||
if components.blizzard.exact and strlower(aux.info.item(record.item_id).name) ~= components.blizzard.name[2] then
|
||||
if components.blizzard.exact and strlower(info.item(record.item_id).name) ~= components.blizzard.name[2] then
|
||||
return false
|
||||
end
|
||||
local stack = {}
|
||||
|
||||
+6
-6
@@ -121,8 +121,8 @@ function public.auction(index, query_type)
|
||||
link = link,
|
||||
itemstring = item_info.itemstring,
|
||||
item_key = item_id..':'..suffix_id,
|
||||
search_signature = join({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), g.aux_ignore_owner and (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
|
||||
sniping_signature = join({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, g.aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
|
||||
search_signature = join({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), g.aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
|
||||
sniping_signature = join({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, g.aux_ignore_owner and (is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
|
||||
|
||||
name = name,
|
||||
texture = texture,
|
||||
@@ -161,12 +161,12 @@ end
|
||||
function public.bid_update(auction_record)
|
||||
auction_record.high_bid = auction_record.bid_price
|
||||
auction_record.blizzard_bid = auction_record.bid_price
|
||||
auction_record.min_increment = aux.min_bid_increment(auction_record.bid_price)
|
||||
auction_record.min_increment = min_bid_increment(auction_record.bid_price)
|
||||
auction_record.bid_price = auction_record.bid_price + auction_record.min_increment
|
||||
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.high_bidder = 1
|
||||
auction_record.search_signature = table.concat({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, g.aux_ignore_owner and (aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
|
||||
auction_record.search_signature = table.concat({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, g.aux_ignore_owner and (is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
|
||||
end
|
||||
|
||||
function public.set_tooltip(itemstring, owner, anchor)
|
||||
@@ -244,7 +244,7 @@ function public.load_tooltip(frame, tooltip)
|
||||
end
|
||||
|
||||
function public.display_name(item_id, no_brackets, no_color)
|
||||
for item_info in present(aux.info.item(item_id)) do
|
||||
for item_info in present(info.item(item_id)) do
|
||||
local name = item_info.name
|
||||
if not no_brackets then
|
||||
name = '['..name..']'
|
||||
@@ -368,7 +368,7 @@ function public.item(item_id, suffix_id)
|
||||
texture = texture,
|
||||
}
|
||||
end
|
||||
return aux.cache.item_info(item_id)
|
||||
return cache.item_info(item_id)
|
||||
end
|
||||
|
||||
function public.item_class_index(item_class)
|
||||
|
||||
@@ -6,7 +6,7 @@ do
|
||||
local realm, faction
|
||||
|
||||
function LOAD()
|
||||
aux.control.thread(aux.control.when, function() faction = UnitFactionGroup 'player' return faction end, function() end)
|
||||
control.thread(control.when, function() faction = UnitFactionGroup 'player' return faction end, function() end)
|
||||
realm = GetCVar 'realmName'
|
||||
end
|
||||
|
||||
|
||||
+4
-4
@@ -3,7 +3,7 @@ aux.module 'scan_util'
|
||||
function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
||||
|
||||
local function test(index)
|
||||
local auction_info = aux.info.auction(index, auction_record.query_type)
|
||||
local auction_info = info.auction(index, auction_record.query_type)
|
||||
return auction_info and auction_info.search_signature == auction_record.search_signature
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
||||
|
||||
|
||||
local found
|
||||
return aux.scan.start{
|
||||
return scan.start{
|
||||
type = auction_record.query_type,
|
||||
queries = queries,
|
||||
on_scan_start = function()
|
||||
@@ -72,10 +72,10 @@ end
|
||||
|
||||
function public.item_query(item_id, first_page, last_page)
|
||||
|
||||
local item_info = aux.info.item(item_id)
|
||||
local item_info = info.item(item_id)
|
||||
|
||||
if item_info then
|
||||
local query = aux.filter.query(item_info.name..'/exact')
|
||||
local query = filter.query(item_info.name..'/exact')
|
||||
query.blizzard_query.first_page = first_page
|
||||
query.blizzard_query.last_page = last_page
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user