refactorings

This commit is contained in:
Manuel Simon Hirsig
2016-08-04 05:50:40 +02:00
parent b43312d9b7
commit 238c19a040
34 changed files with 596 additions and 598 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
## Interface: 11200
## Title: Aux
## Title: aux
## SavedVariablesPerCharacter: aux_auto_buy_filter, aux_tooltip_value, aux_tooltip_daily, aux_tooltip_vendor_buy, aux_tooltip_vendor_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
## SavedVariables: aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters, aux_recent_searches, aux_favorite_searches, aux_ignore_owner, aux_price_per_unit
+4 -4
View File
@@ -1,4 +1,4 @@
# Aux - WoW 1.12 AddOn
# aux - WoW 1.12 AddOn
The most advanced auction house addOn for the 1.12 client with some features more advanced than anything even on retail.
@@ -111,7 +111,7 @@ AddOns do not have any additional Blizzard filters available to them beyond the
Of course it is possible for an addOn to apply arbitrary filters after the Blizzard query but only the Blizzard query will affect the number of pages to be scanned and thus the time it takes for a scan.
Since the Vanilla API will only let you request a page every 4 seconds having no Blizzard query in your filter can lead to very long scan times.
Aux queries are separated by semicolons and always contain exactly one Blizzard query. The Blizzard query may be empty, i.e., all pages are scanned, which can be useful for collecting historical data.
aux queries are separated by semicolons and always contain exactly one Blizzard query. The Blizzard query may be empty, i.e., all pages are scanned, which can be useful for collecting historical data.
The real time mode only supports empty Blizzard queries.
Semicolons always mean "or", i.e., **q1;q2;q3** means all items matching **q1** or **q2** or **q3** will be listed.
@@ -142,9 +142,9 @@ This will scan the auction house for cloth armor which has a requirement of at l
## Historical Value
Aux condenses the prices you've scanned during a day (midnight to midnight) into a single value, similarly to retail Auctioneer's "stat-simple" module.
aux condenses the prices you've scanned during a day (midnight to midnight) into a single value, similarly to retail Auctioneer's "stat-simple" module.
This daily value is calculated as the minimum buyout of the day, increased by 15% if lower than the highest price of the day, which in practice gives a very similar value to that of retail TSM while using much less memory.
Limiting the memory usage is important because like Auctioneer and unlike TSM Aux is using a day based instead of scan based interval and thus has to store the daily progress in the savedvariables.
Limiting the memory usage is important because like Auctioneer and unlike TSM aux is using a day based instead of scan based interval and thus has to store the daily progress in the savedvariables.
Finally these daily values are collected in a list of the last 11 of them from which the market value is taken as the median. The values are weighted by their age but it doesn't have a large effect unless they're older than a month.
The bottom line is that you get a fairly accurate market value for both very active markets as well as rarer items that has a reasonably short reaction time to market changes, recovers easily and never needs to be reset while still being reasonably stable and hard to manipulate and dealing with outliers very well, not getting distorted by multiple scans per day, not needing a single full scan per day but instead naturally picking up every price you scan while going about your usual business, letting you focus on a certain part of the auction house by scanning only that part regularly and avoiding information overload by giving you a single concise value for the tooltip.
+24 -24
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'cache'
local m, public, private = aux.module'cache'
local MIN_ITEM_ID, MAX_ITEM_ID = 1, 30000
local items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
@@ -14,19 +14,19 @@ aux_characters = {}
function public.LOAD()
m.scan_wdb()
Aux.control.event_listener('MERCHANT_SHOW', m.on_merchant_show)
Aux.control.event_listener('MERCHANT_CLOSED', m.on_merchant_closed)
Aux.control.event_listener('MERCHANT_UPDATE', m.on_merchant_update)
Aux.control.event_listener('BAG_UPDATE', m.on_bag_update)
aux.control.event_listener('MERCHANT_SHOW', m.on_merchant_show)
aux.control.event_listener('MERCHANT_CLOSED', m.on_merchant_closed)
aux.control.event_listener('MERCHANT_UPDATE', m.on_merchant_update)
aux.control.event_listener('BAG_UPDATE', m.on_bag_update)
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update)
Aux.control.event_listener('NEW_AUCTION_UPDATE', function()
local info = Aux.info.auction_sell_item()
aux.control.event_listener('NEW_AUCTION_UPDATE', function()
local info = aux.info.auction_sell_item()
if info then
local item_id = Aux.cache.item_id(info.name)
local item_id = aux.cache.item_id(info.name)
if item_id then
aux_merchant_sell[Aux.cache.item_id(info.name)] = info.vendor_price / (Aux.info.max_item_charges(item_id) or info.count)
aux_merchant_sell[aux.cache.item_id(info.name)] = info.vendor_price / (aux.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 aux_merchant_buy[item_id] then
buy_info = Aux.persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
buy_info = aux.persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
end
return 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 = aux_items[item_id]
if data_string then
local cached_data = Aux.persistence.read(items_schema, data_string)
local cached_data = aux.persistence.read(items_schema, data_string)
return {
name = cached_data.name,
itemstring = 'item:'..item_id..':0:0:0',
@@ -114,10 +114,10 @@ function private.merchant_buy_scan()
local _, _, price, count, stock = GetMerchantItemInfo(i)
local link = GetMerchantItemLink(i)
if link then
local item_id = Aux.info.parse_hyperlink(link)
local item_id = aux.info.parse_hyperlink(link)
local new_unit_price, new_limited = price / count, stock >= 0
if aux_merchant_buy[item_id] then
local buy_info = Aux.persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
local buy_info = aux.persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
local unit_price
if buy_info.limited and not new_limited then
@@ -128,12 +128,12 @@ function private.merchant_buy_scan()
unit_price = min(buy_info.unit_price, new_unit_price)
end
aux_merchant_buy[item_id] = Aux.persistence.write(merchant_buy_schema, {
aux_merchant_buy[item_id] = aux.persistence.write(merchant_buy_schema, {
unit_price = unit_price,
limited = buy_info.limited and new_limited,
})
else
aux_merchant_buy[item_id] = Aux.persistence.write(merchant_buy_schema, {
aux_merchant_buy[item_id] = aux.persistence.write(merchant_buy_schema, {
unit_price = new_unit_price,
limited = new_limited,
})
@@ -147,8 +147,8 @@ function private.merchant_buy_scan()
end
function private.merchant_sell_scan()
for slot in Aux.util.inventory() do
local item_info = Aux.info.container_item(unpack(slot))
for slot in aux.util.inventory() do
local item_info = aux.info.container_item(unpack(slot))
if item_info then
aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
end
@@ -164,7 +164,7 @@ function private.scan_wdb(item_id)
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
if name and not aux_item_ids[strlower(name)] then
aux_item_ids[strlower(name)] = item_id
aux_items[item_id] = Aux.persistence.write(items_schema, {
aux_items[item_id] = aux.persistence.write(items_schema, {
name = name,
quality = quality,
level = level,
@@ -174,8 +174,8 @@ function private.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 = aux.info.tooltip(function(tt) tt:SetHyperlink(itemstring) end)
if aux.info.auctionable(tooltip, quality) then
tinsert(aux_auctionable_items, strlower(name))
end
processed = processed + 1
@@ -185,7 +185,7 @@ function private.scan_wdb(item_id)
if item_id <= MAX_ITEM_ID then
local t0 = GetTime()
Aux.control.as_soon_as(function() return GetTime() - t0 > 0.1 end, m.scan_wdb, item_id)
aux.control.as_soon_as(function() return GetTime() - t0 > 0.1 end, m.scan_wdb, item_id)
else
sort(aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
end
@@ -195,14 +195,14 @@ function public.populate_wdb(item_id)
item_id = item_id or MIN_ITEM_ID
if item_id > MAX_ITEM_ID then
Aux.log('Cache populated.')
aux.log('Cache populated.')
return
end
if not GetItemInfo('item:'..item_id) then
Aux.log('Fetching item '..item_id..'.')
aux.log('Fetching item '..item_id..'.')
AuxTooltip:SetHyperlink('item:'..item_id)
end
Aux.control.thread(m.populate_wdb, item_id + 1)
aux.control.thread(m.populate_wdb, item_id + 1)
end
+4 -4
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'disenchant'
local m, public, private = aux.module'disenchant'
private.UNCOMMON = 2
private.RARE = 3
@@ -41,7 +41,7 @@ do
end
function public.LOAD()
private.armor = Aux.util.set(
private.armor = aux.util.set(
'INVTYPE_HEAD',
'INVTYPE_NECK',
'INVTYPE_SHOULDER',
@@ -59,7 +59,7 @@ function public.LOAD()
'INVTYPE_HOLDABLE'
)
private.weapon = Aux.util.set(
private.weapon = aux.util.set(
'INVTYPE_2HWEAPON' ,
'INVTYPE_WEAPONMAINHAND',
'INVTYPE_WEAPON',
@@ -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 = aux.history.value(event.item_id..':'..0)
if not value then
return
else
+5 -5
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'history'
local m, public, private = aux.module'history'
local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}}}
private.value_cache = {}
@@ -14,7 +14,7 @@ function private.new_record()
end
function private.load_data()
local dataset = Aux.persistence.load_dataset()
local dataset = aux.persistence.load_dataset()
dataset.history = dataset.history or {}
return dataset.history
end
@@ -24,7 +24,7 @@ function private.read_record(item_key)
local record
if data[item_key] then
record = Aux.persistence.read(history_schema, data[item_key])
record = aux.persistence.read(history_schema, data[item_key])
else
record = m.new_record()
end
@@ -40,7 +40,7 @@ end
function private.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] = aux.persistence.write(history_schema, record)
end
function public.process_auction(auction_record)
@@ -72,7 +72,7 @@ function public.value(item_key)
local weighted_values = {}
local total_weight = 0
for _, data_point in item_record.data_points do
local weight = 0.99^Aux.util.round((item_record.data_points[1].time - data_point.time) / (60*60*24))
local weight = 0.99^aux.util.round((item_record.data_points[1].time - data_point.time) / (60*60*24))
total_weight = total_weight + weight
tinsert(weighted_values, {value = data_point.market_value, weight = weight})
end
+10 -10
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'post'
local m, public, private = aux.module'post'
private.state = nil
@@ -7,7 +7,7 @@ function private.process()
local stacking_complete
local c = Aux.control.await(function(slot)
local c = aux.control.await(function(slot)
if slot then
return m.post_auction(slot, m.process)
else
@@ -15,15 +15,15 @@ function private.process()
end
end)
return Aux.stack.start(m.state.item_key, m.state.stack_size, c)
return aux.stack.start(m.state.item_key, m.state.stack_size, c)
end
return m.stop()
end
function private.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 = 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
ClearCursor()
ClickAuctionSellItemButton()
@@ -32,15 +32,15 @@ function private.post_auction(slot, k)
ClickAuctionSellItemButton()
ClearCursor()
StartAuction(max(1, Aux.util.round(m.state.unit_start_price * item_info.aux_quantity)), Aux.util.round(m.state.unit_buyout_price * item_info.aux_quantity), m.state.duration)
StartAuction(max(1, aux.util.round(m.state.unit_start_price * item_info.aux_quantity)), aux.util.round(m.state.unit_buyout_price * item_info.aux_quantity), m.state.duration)
local c = Aux.control.await(function()
local c = aux.control.await(function()
m.state.posted = m.state.posted + 1
return k()
end)
local posted
Aux.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
aux.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
if arg1 == ERR_AUCTION_STARTED then
c()
kill()
@@ -53,7 +53,7 @@ end
function public.stop()
if m.state then
Aux.control.kill_thread(m.state.thread_id)
aux.control.kill_thread(m.state.thread_id)
local callback = m.state.callback
local posted = m.state.posted
@@ -69,7 +69,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 = aux.control.thread(m.process)
m.state = {
thread_id = thread_id,
+25 -25
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'scan'
local m, public, private = aux.module'scan'
private.PAGE_SIZE = 50
@@ -11,7 +11,7 @@ do
for _, old_state in {scan_states[params.type]} do
m.abort(old_state.id)
end
local thread_id = Aux.control.thread(Aux.f(m.wait_for_callback, params.on_scan_start, m.scan))
local thread_id = aux.control.thread(aux.f(m.wait_for_callback, params.on_scan_start, m.scan))
scan_states[params.type] = {
id = thread_id,
params = params,
@@ -23,29 +23,29 @@ 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)
aux.control.kill_thread(state.id)
scan_states[type] = nil
tinsert(aborted, state)
end
end
for _, state in aborted do
Aux.safe_call(state.params.on_abort)
aux.safe_call(state.params.on_abort)
end
end
function private.complete()
local on_complete = m.state.params.on_complete
scan_states[m.state.params.type] = nil
Aux.safe_call(on_complete)
aux.safe_call(on_complete)
end
private.state = Aux.dynamic_table(function()
local _, state = next(Aux.util.filter(scan_states, function(state) return state.id == Aux.control.thread_id end))
private.state = aux.dynamic_table(function()
local _, state = next(aux.util.filter(scan_states, function(state) return state.id == aux.control.thread_id end))
return state
end)
end
private.query = Aux.dynamic_table(function()
private.query = aux.dynamic_table(function()
return m.state.params.queries[m.state.query_index]
end)
@@ -67,7 +67,7 @@ function private.wait_for_callback(...)
if ok then
return k()
else
return Aux.control.when(function() return ok end, function() return k(unpack(ret)) end)
return aux.control.when(function() return ok end, function() return k(unpack(ret)) end)
end
end
@@ -104,8 +104,8 @@ function private.process_query()
end
function private.submit_query()
Aux.control.when(function() return m.state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
Aux.safe_call(m.state.params.on_submit_query)
aux.control.when(function() return m.state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
aux.safe_call(m.state.params.on_submit_query)
m.last_query_time[m.state.params.type] = GetTime()
if m.state.params.type == 'bidder' then
GetBidderAuctionItems(m.state.page)
@@ -146,19 +146,19 @@ function private.scan_page(i)
end
end
local auction_info = Aux.info.auction(i, m.state.params.type)
local auction_info = aux.info.auction(i, m.state.params.type)
if auction_info and (auction_info.owner or m.state.params.ignore_owner or aux_ignore_owner) then
auction_info.index = i
auction_info.page = m.state.page
auction_info.blizzard_query = m.query.blizzard_query
auction_info.query_type = m.state.params.type
Aux.history.process_auction(auction_info)
aux.history.process_auction(auction_info)
if Aux.safe_call(m.state.params.auto_buy_validator, auction_info) then
local c = Aux.control.await(recurse)
Aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, Aux.f(c, true))
return Aux.control.thread(Aux.control.sleep, 10, Aux.f(c, false))
if aux.safe_call(m.state.params.auto_buy_validator, auction_info) then
local c = aux.control.await(recurse)
aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, aux.f(c, true))
return aux.control.thread(aux.control.sleep, 10, aux.f(c, false))
elseif not m.query.validator or m.query.validator(auction_info) then
return m.wait_for_callback(m.state.params.on_auction, auction_info, function(removed)
if removed then
@@ -178,7 +178,7 @@ function private.timeout(type)
end
function private.wait_for_results()
local c = Aux.control.await(function()
local c = aux.control.await(function()
if m.timeout(m.state.params.type) then
return m.submit_query()
else
@@ -194,10 +194,10 @@ function private.wait_for_results()
end)
local type = m.state.params.type
Aux.control.as_soon_as(function() return -c or m.timeout(type) end, c)
aux.control.as_soon_as(function() return -c or m.timeout(type) end, c)
if m.state.params.type == 'bidder' then
return Aux.control.as_soon_as(function() return Aux.bids_loaded end, c)
return aux.control.as_soon_as(function() return aux.bids_loaded end, c)
elseif m.state.params.type == 'owner' then
return m.wait_for_owner_results(c)
elseif m.state.params.type == 'list' then
@@ -206,22 +206,22 @@ function private.wait_for_results()
end
function private.wait_for_owner_results(c)
if m.state.page == Aux.current_owner_page then
if m.state.page == aux.current_owner_page then
return c()
else
return Aux.control.on_next_event('AUCTION_OWNED_LIST_UPDATE', c)
return aux.control.on_next_event('AUCTION_OWNED_LIST_UPDATE', c)
end
end
function private.wait_for_list_results(c)
local updated, last_update
Aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill)
aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill)
kill(-c)
last_update = GetTime()
updated = true
end)
local ignore_owner = m.state.params.ignore_owner or aux_ignore_owner
return Aux.control.as_soon_as(function()
return aux.control.as_soon_as(function()
-- short circuiting order important, owner_data_complete must be called iif an update has happened.
local ok = updated and (ignore_owner or m.owner_data_complete('list')) or last_update and GetTime() - last_update > 5
updated = false
@@ -231,7 +231,7 @@ end
function private.owner_data_complete(type)
for i=1,m.PAGE_SIZE do
local auction_info = Aux.info.auction(i, type)
local auction_info = aux.info.auction(i, type)
if auction_info and not auction_info.owner then
return false
end
+24 -24
View File
@@ -1,53 +1,53 @@
SLASH_AUX1 = '/aux'
function SlashCmdList.AUX(command)
function SlashCmdList.aux(command)
if not command then return end
local arguments = Aux.util.tokenize(command)
local arguments = aux.util.tokenize(command)
if arguments[1] == 'clear' and arguments[2] == 'history' then
Aux.persistence.load_dataset().history = nil
Aux.log('History cleared.')
aux.persistence.load_dataset().history = nil
aux.log('History cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'post' then
Aux.persistence.load_dataset().post = nil
Aux.log('Post settings cleared.')
aux.persistence.load_dataset().post = nil
aux.log('Post settings cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then
aux_datasets = {}
Aux.log('Datasets cleared.')
aux.log('Datasets cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
aux_merchant_buy = {}
Aux.log('Merchant buy prices cleared.')
aux.log('Merchant buy prices cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
aux_merchant_sell = {}
Aux.log('Merchant sell prices cleared.')
aux.log('Merchant sell prices cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
aux_items = {}
aux_item_ids = {}
aux_auctionable_items = {}
Aux.log('Item cache cleared.')
aux.log('Item cache cleared.')
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
Aux.cache.populate_wdb()
aux.cache.populate_wdb()
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
aux_tooltip_value = not aux_tooltip_value
Aux.log('Historical value in tooltip '..(aux_tooltip_value and 'enabled' or 'disabled')..'.')
aux.log('Historical value in tooltip '..(aux_tooltip_value and 'enabled' or 'disabled')..'.')
elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
aux_tooltip_daily = not aux_tooltip_daily
Aux.log('Market value in tooltip '..(aux_tooltip_daily and 'enabled' or 'disabled')..'.')
aux.log('Market value in tooltip '..(aux_tooltip_daily and 'enabled' or 'disabled')..'.')
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'buy' then
aux_tooltip_vendor_buy = not aux_tooltip_vendor_buy
Aux.log('Vendor buy price in tooltip '..(aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.')
aux.log('Vendor buy price in tooltip '..(aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.')
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'sell' then
aux_tooltip_vendor_sell = not aux_tooltip_vendor_sell
Aux.log('Vendor sell price in tooltip '..(aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.')
aux.log('Vendor sell price in tooltip '..(aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.')
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
aux_tooltip_disenchant_value = not aux_tooltip_disenchant_value
Aux.log('Disenchant value in tooltip '..(aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.')
aux.log('Disenchant value in tooltip '..(aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.')
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
aux_tooltip_disenchant_distribution = not aux_tooltip_disenchant_distribution
Aux.log('Disenchant distribution in tooltip '..(aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.')
aux.log('Disenchant distribution in tooltip '..(aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.')
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'source' then
aux_tooltip_disenchant_source = not aux_tooltip_disenchant_source
Aux.log('Disenchant source in tooltip '..(aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.')
aux.log('Disenchant source in tooltip '..(aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.')
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
aux_ignore_owner = not aux_ignore_owner
Aux.log('Ignoring of owner '..(aux_ignore_owner and 'enabled' or 'disabled')..'.')
aux.log('Ignoring of owner '..(aux_ignore_owner and 'enabled' or 'disabled')..'.')
elseif arguments[1] == 'chars' and arguments[2] == 'add' then
local realm = GetCVar('realmName')
aux_characters[realm] = aux_characters[realm] or {}
@@ -55,7 +55,7 @@ function SlashCmdList.AUX(command)
local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
if not aux_characters[realm][name] then
aux_characters[realm][name] = true
Aux.log('Character "'..name..'" added.')
aux.log('Character "'..name..'" added.')
end
end
elseif arguments[1] == 'chars' and arguments[2] == 'remove' then
@@ -67,7 +67,7 @@ function SlashCmdList.AUX(command)
local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
if aux_characters[realm][name] then
aux_characters[realm][name] = nil
Aux.log('Character "'..name..'" removed.')
aux.log('Character "'..name..'" removed.')
end
end
elseif arguments[1] == 'chars' then
@@ -77,11 +77,11 @@ function SlashCmdList.AUX(command)
tinsert(chars, name)
end
if getn(chars) > 0 then
Aux.log('Your characters: "'..Aux.util.join(chars, ', ')..'".')
aux.log('Your characters: "'..aux.util.join(chars, ', ')..'".')
else
Aux.log('You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".')
aux.log('You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".')
end
else
Aux.log('Unknown command: "'..command..'"')
aux.log('Unknown command: "'..command..'"')
end
end
+16 -16
View File
@@ -1,42 +1,42 @@
local m, public, private = Aux.module'stack'
local m, public, private = aux.module'stack'
private.state = nil
function private.stack_size(slot)
local container_item_info = Aux.info.container_item(unpack(slot))
local container_item_info = aux.info.container_item(unpack(slot))
return container_item_info and container_item_info.count or 0
end
function private.charges(slot)
local container_item_info = Aux.info.container_item(unpack(slot))
local container_item_info = aux.info.container_item(unpack(slot))
return container_item_info and container_item_info.charges
end
function private.max_stack(slot)
local container_item_info = Aux.info.container_item(unpack(slot))
local container_item_info = aux.info.container_item(unpack(slot))
return container_item_info and container_item_info.max_stack
end
function private.locked(slot)
local container_item_info = Aux.info.container_item(unpack(slot))
local container_item_info = aux.info.container_item(unpack(slot))
return container_item_info and container_item_info.locked
end
function private.find_item_slot(partial)
for slot in Aux.util.inventory() do
if m.matching_item(slot, partial) and not Aux.util.eq(slot, m.state.target_slot) then
for slot in aux.util.inventory() do
if m.matching_item(slot, partial) and not aux.util.eq(slot, m.state.target_slot) then
return slot
end
end
end
function private.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 = 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)
end
function private.find_empty_slot()
for slot, type in Aux.util.inventory() do
for slot, type in aux.util.inventory() do
if type == 1 and not GetContainerItemInfo(unpack(slot)) then
return slot
end
@@ -44,7 +44,7 @@ function private.find_empty_slot()
end
function private.find_charge_item_slot()
for slot in Aux.util.inventory() do
for slot in aux.util.inventory() do
if m.matching_item(slot) and m.charges(slot) == m.state.target_size then
return slot
end
@@ -53,7 +53,7 @@ end
function private.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 aux.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 private.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 aux.control.when(function() return m.stack_size(to_slot) == expected_size end, k)
end
function private.process()
@@ -105,20 +105,20 @@ end
function public.stop()
if m.state then
Aux.control.kill_thread(m.state.thread_id)
aux.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
end
m.state = nil
Aux.safe_call(callback, slot)
aux.safe_call(callback, slot)
end
end
function public.start(item_key, size, callback)
m.stop()
local thread_id = Aux.control.thread(m.process)
local thread_id = aux.control.thread(m.process)
m.state = {
thread_id = thread_id,
item_key = item_key,
+22 -22
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'tooltip'
local m, public, private = aux.module'tooltip'
aux_tooltip_value = true
@@ -9,12 +9,12 @@ private.game_tooltip_money = nil
function public.LOAD()
for func, hook in m.game_tooltip_hooks do
local func, hook = func, hook
Aux.hook(
aux.hook(
func,
function(...)
m.hooked_setter = true
m.game_tooltip_money = 0
local results = {Aux.orig[GameTooltip][func](unpack(arg)) }
local results = {aux.orig[GameTooltip][func](unpack(arg)) }
m.hooked_setter = false
hook(unpack(arg))
return unpack(results)
@@ -44,13 +44,13 @@ function public.LOAD()
end
function private.extend_tooltip(tooltip, hyperlink, quantity)
local item_id, suffix_id = Aux.info.parse_hyperlink(hyperlink)
local item_id, suffix_id = aux.info.parse_hyperlink(hyperlink)
quantity = IsShiftKeyDown() and quantity or 1
if 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 = aux.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 private.extend_tooltip(tooltip, hyperlink, quantity)
end
end
local item_info = Aux.info.item(item_id)
local item_info = aux.info.item(item_id)
if item_info then
local distribution = Aux.disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
local distribution = aux.disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
if getn(distribution) > 0 then
@@ -75,15 +75,15 @@ function private.extend_tooltip(tooltip, hyperlink, 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, 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)
end
end
if 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.util.format_money(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
local disenchant_value = aux.disenchant.value(item_info.slot, item_info.quality, item_info.level)
tooltip:AddLine('Disenchant Value: '..(disenchant_value and aux.util.format_money(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 private.extend_tooltip(tooltip, hyperlink, quantity)
if 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 = aux.cache.merchant_info(item_id)
if price then
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..Aux.util.format_money(price * quantity), color.r, color.g, color.b)
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..aux.util.format_money(price * quantity), color.r, color.g, color.b)
end
end
if 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 = aux.cache.merchant_info(item_id)
if price ~= 0 then
tooltip:AddLine('Vendor Sell: '..(price and Aux.util.format_money(price * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
tooltip:AddLine('Vendor Sell: '..(price and aux.util.format_money(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 aux.info.auctionable(aux.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 = aux.history.value(item_key)
if auctionable then
if aux_tooltip_value then
tooltip:AddLine('Value: '..(value and Aux.util.format_money(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
tooltip:AddLine('Value: '..(value and aux.util.format_money(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
end
if aux_tooltip_daily then
local market_value = Aux.history.market_value(item_key)
tooltip:AddLine('Today: '..(market_value and Aux.util.format_money(market_value * quantity)..' ('..Aux.auction_listing.percentage_historical(Aux.util.round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
local market_value = aux.history.market_value(item_key)
tooltip:AddLine('Today: '..(market_value and aux.util.format_money(market_value * quantity)..' ('..aux.auction_listing.percentage_historical(aux.util.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 m.game_tooltip_hooks:SetInboxItem(index)
local name, _, quantity = GetInboxItem(index)
local id = name and Aux.cache.item_id(name)
local id = name and aux.cache.item_id(name)
if id then
local _, itemstring, quality = GetItemInfo(id)
local _, _, _, hex = GetItemQualityColor(tonumber(quality))
@@ -241,9 +241,9 @@ end
function m.game_tooltip_hooks:SetAuctionSellItem()
local name, _, quantity, _, _, _ = GetAuctionSellItemInfo()
if name then
for slot in Aux.util.inventory() do
for slot in aux.util.inventory() do
local link = GetContainerItemLink(unpack(slot))
if link and ({Aux.info.parse_hyperlink(link)})[5] == name then
if link and ({aux.info.parse_hyperlink(link)})[5] == name then
m.extend_tooltip(GameTooltip, link, quantity)
return
end
+9 -9
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'control'
local m, public, private = aux.module'control'
private.event_frame = CreateFrame('Frame')
private.listeners = {}
@@ -20,13 +20,13 @@ end
function private.on_update()
for _, listener in m.listeners do
if not Aux.util.any(m.listeners, function(l) return not l.killed and l.event == listener.event end) then
if not aux.util.any(m.listeners, function(l) return not l.killed and l.event == listener.event end) then
m.event_frame:UnregisterEvent(listener.event)
end
end
m.listeners = Aux.util.filter(m.listeners, function(l) return not l.killed end)
m.threads = Aux.util.filter(m.threads, function(th) return not th.killed end)
m.listeners = aux.util.filter(m.listeners, function(l) return not l.killed end)
m.threads = aux.util.filter(m.threads, function(th) return not th.killed end)
for thread_id, thread in m.threads do
if not thread.killed then
@@ -55,7 +55,7 @@ function public.kill_thread(thread_id)
end
function public.event_listener(event, cb)
local listener_id = Aux.unique()
local listener_id = aux.unique()
m.listeners[listener_id] = { event=event, cb=cb, kill=function(...) if arg.n == 0 or arg[1] then m.kill_listener(listener_id) end end }
m.event_frame:RegisterEvent(event)
return listener_id
@@ -73,8 +73,8 @@ function public.as_soon_as(p, ...)
end
function public.thread(k, ...)
local thread_id = Aux.unique()
m.threads[thread_id] = { k = Aux.f(k, unpack(arg)) }
local thread_id = aux.unique()
m.threads[thread_id] = { k = aux.f(k, unpack(arg)) }
return thread_id
end
@@ -100,7 +100,7 @@ function public.wait(k, ...)
if type(k) == 'number' then
m.when(function() k = k - 1 return k <= 1 end, unpack(arg))
else
m.threads[m.thread_id].k = Aux.f(k, unpack(arg))
m.threads[m.thread_id].k = aux.f(k, unpack(arg))
end
end
@@ -108,6 +108,6 @@ function public.when(p, k, ...)
if p() then
return k(unpack(arg))
else
return m.wait(m.when, p, Aux.f(k, unpack(arg)))
return m.wait(m.when, p, aux.f(k, unpack(arg)))
end
end
+12 -12
View File
@@ -1,9 +1,9 @@
local addon = Aux_module()
Aux = tremove(addon, 1)
local addon = aux_module()
aux = tremove(addon, 1)
local m, public, private = unpack(addon)
--m.enum TODO
--setmetatable({}, { AUX -> aux
--setmetatable({}, { aux -> aux
-- __index = function(self, key)
-- self[key] = true
-- return self
@@ -24,9 +24,9 @@ local m, public, private = unpack(addon)
-- ipairs TODO
private.modules = { Aux }
private.modules = { aux }
function public.module(name)
local module = Aux_module()
local module = aux_module()
local public_interface = tremove(module, 1)
tinsert(m.modules, public_interface)
public[name] = public_interface
@@ -117,12 +117,12 @@ function public.on_load()
public.last_owner_page_requested = nil
private.auction_frame_loaded = nil
m.log('Aux v'..m.version..' loaded.')
m.log('aux v'..m.version..' loaded.')
Aux.gui.set_window_style(AuxFrame)
aux.gui.set_window_style(AuxFrame)
tinsert(UISpecialFrames, 'AuxFrame')
Aux.control.event_listener('CURSOR_UPDATE', m.CURSOR_UPDATE)
aux.control.event_listener('CURSOR_UPDATE', m.CURSOR_UPDATE)
do
local tab_group = m.gui.tab_group(AuxFrame, 'DOWN')
@@ -296,7 +296,7 @@ do
m.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
if arg1 == ERR_AUCTION_BID_PLACED then
Aux.safe_call(on_success)
aux.safe_call(on_success)
locked = false
kill()
end
@@ -323,7 +323,7 @@ do
CancelAuction(index)
m.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
if arg1 == ERR_AUCTION_REMOVED then
Aux.safe_call(on_success)
aux.safe_call(on_success)
locked = false
kill()
end
@@ -396,7 +396,7 @@ do -- TODO make it work for other ways to pick up things
end
function private.PickupContainerItem(...)
local bag, slot = unpack(arg)
Aux.control.thread(function()
aux.control.thread(function()
last_picked_up = {bag, slot}
end)
return m.orig.PickupContainerItem(unpack(arg))
@@ -450,7 +450,7 @@ end
function public.is_player(name, current)
local realm = GetCVar('realmName')
return not current and Aux.safe_index(aux_characters, realm, name) or UnitName('player') == name
return not current and aux.safe_index(aux_characters, realm, name) or UnitName('player') == name
end
function public.unmodified()
+1 -1
View File
@@ -13,7 +13,7 @@
this:RegisterEvent('AUCTION_OWNED_LIST_UPDATE')
</OnLoad>
<OnEvent>
Aux:on_event()
aux:on_event()
</OnEvent>
</Scripts>
</Frame>
+8 -8
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'gui'
local m, public, private = aux.module'gui'
public.config = {
link_color = { 153, 255, 255, 1 }, -- TODO inline color needs 255, others need /255
@@ -121,7 +121,7 @@ do
id = id,
frame = parent,
tabs = {},
on_select = Aux.util.pass,
on_select = aux.util.pass,
}
function self:create_tab(text)
@@ -226,14 +226,14 @@ function public.editbox(parent)
editbox:SetShadowColor(0, 0, 0, 0)
m.set_content_style(editbox)
editbox:SetScript('OnEditFocusLost', Aux.f(editbox.HighlightText, editbox, 0, 0))
editbox:SetScript('OnEditFocusLost', aux.f(editbox.HighlightText, editbox, 0, 0))
editbox:SetScript('OnEscapePressed', Aux.f(editbox.ClearFocus, editbox))
editbox:SetScript('OnEscapePressed', aux.f(editbox.ClearFocus, editbox))
do
local last_time, last_x, last_y
editbox:SetScript('OnEditFocusGained', Aux.f(editbox.HighlightText, editbox))
editbox:SetScript('OnEditFocusGained', aux.f(editbox.HighlightText, editbox))
editbox:SetScript('OnMouseUp', function()
local x, y = GetCursorPosition()
@@ -325,14 +325,14 @@ function public.item(parent)
local item = CreateFrame('Button', nil, parent)
item:SetWidth(193)
item:SetHeight(40)
local icon = CreateFrame('CheckButton', 'aux_frame'..Aux.unique(), item, 'ActionButtonTemplate')
local icon = CreateFrame('CheckButton', 'aux_frame'..aux.unique(), item, 'ActionButtonTemplate')
icon:SetPoint('LEFT', 2, 0.5)
icon:SetHighlightTexture(nil)
icon:RegisterForClicks()
icon:EnableMouse(nil)
item.texture = getglobal(icon:GetName()..'Icon')
item.texture:SetTexCoord(0.06,0.94,0.06,0.94)
item.name = Aux.gui.label(icon)
item.name = aux.gui.label(icon)
item.name:SetJustifyH('LEFT')
item.name:SetPoint('LEFT', icon, 'RIGHT', 10, 0)
item.name:SetPoint('RIGHT', item, 'RIGHT', -10, 0.5)
@@ -377,7 +377,7 @@ end
function public.dropdown(parent)
local dropdown = CreateFrame('Frame', 'aux_frame'..Aux.unique(), parent, 'UIDropDownMenuTemplate')
local dropdown = CreateFrame('Frame', 'aux_frame'..aux.unique(), parent, 'UIDropDownMenuTemplate')
dropdown:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size, insets={top=5,bottom=5}}
dropdown:SetBackdropColor(unpack(m.config.content_color.backdrop))
+1 -1
View File
@@ -1,4 +1,4 @@
function Aux_module()
function aux_module()
local data, is_public, is_declared, public_interface, private_interface, public, private = {}, {}, {}, {}, {}, {}, {}
setmetatable(public_interface, {
__newindex = function()
+81 -81
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'auction_listing'
local m, public, private = aux.module'auction_listing'
local RT_COUNT = 1
local HEAD_HEIGHT = 27
@@ -8,7 +8,7 @@ local AUCTION_PCT_COLORS = {
{color='|cff16ff16', value=80}, -- green
{color='|cffffff00', value=110}, -- yellow
{color='|cffff9218', value=135}, -- orange
{color='|cffff0000', value=Aux.huge}, -- red
{color='|cffff0000', value=aux.huge}, -- red
}
local TIME_LEFT_STRINGS = {
'|cffff000030m|r', -- Short
@@ -65,7 +65,7 @@ public.search_config = {
cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.name, record_b.name, desc)
return aux.sort.compare(record_a.name, record_b.name, desc)
end,
},
{
@@ -78,7 +78,7 @@ public.search_config = {
cell:SetText(display_level)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.level, record_b.level, desc)
return aux.sort.compare(record_a.level, record_b.level, desc)
end,
},
{
@@ -86,14 +86,14 @@ public.search_config = {
width = 0.06,
align = 'CENTER',
set = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color)..count..'|r') or count
local numAuctionsText = expandable and (aux.gui.inline_color(aux.gui.config.link_color)..count..'|r') or count
if own > 0 then
numAuctionsText = numAuctionsText..(' |cffffff00('..own..')|r')
end
cell:SetText(numAuctionsText)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.EQ
return aux.sort.EQ
-- if sortKey == 'numAuctions' then
-- if a.children then
-- aVal = a.totalAuctions
@@ -113,7 +113,7 @@ public.search_config = {
cell:SetText(record.aux_quantity)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
return aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
end,
},
{
@@ -124,7 +124,7 @@ public.search_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.duration, record_b.duration, desc)
return aux.sort.compare(record_a.duration, record_b.duration, desc)
end,
},
{
@@ -132,17 +132,17 @@ public.search_config = {
width = 0.13,
align = 'CENTER',
set = function(cell, record)
cell:SetText(Aux.is_player(record.owner) and ('|cffffff00'..record.owner..'|r') or (record.owner or '---'))
cell:SetText(aux.is_player(record.owner) and ('|cffffff00'..record.owner..'|r') 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.sort.EQ
return aux.sort.EQ
elseif not record_a.owner then
return Aux.sort.GT
return aux.sort.GT
elseif not record_b.owner then
return Aux.sort.LT
return aux.sort.LT
else
return Aux.sort.compare(record_a.owner, record_b.owner, desc)
return aux.sort.compare(record_a.owner, record_b.owner, desc)
end
end,
},
@@ -164,7 +164,7 @@ public.search_config = {
else
price = 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(aux.money.to_string(price, true, false, nil, color))
end,
cmp = function(record_a, record_b, desc)
local price_a
@@ -179,7 +179,7 @@ public.search_config = {
else
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
end
return Aux.sort.compare(price_a, price_b, desc)
return aux.sort.compare(price_a, price_b, desc)
end,
},
{
@@ -189,15 +189,15 @@ public.search_config = {
isPrice = true,
set = function(cell, record)
local price = 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 aux.money.to_string(price, true, false) or '---')
end,
cmp = function(record_a, record_b, desc)
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
price_a = price_a > 0 and price_a or (desc and -Aux.huge or Aux.huge)
price_b = price_b > 0 and price_b or (desc and -Aux.huge or Aux.huge)
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
return Aux.sort.compare(price_a, price_b, desc)
return aux.sort.compare(price_a, price_b, desc)
end,
},
{
@@ -209,9 +209,9 @@ public.search_config = {
cell:SetText((pct or bidPct) and m.percentage_historical(pct or bidPct, not pct) or '---')
end,
cmp = function(record_a, record_b, desc)
local pct_a = m.record_percentage(record_a) or (desc and -Aux.huge or Aux.huge)
local pct_b = m.record_percentage(record_b) or (desc and -Aux.huge or Aux.huge)
return Aux.sort.compare(pct_a, pct_b, desc)
local pct_a = m.record_percentage(record_a) or (desc and -aux.huge or aux.huge)
local pct_b = m.record_percentage(record_b) or (desc and -aux.huge or aux.huge)
return aux.sort.compare(pct_a, pct_b, desc)
end,
},
}
@@ -235,7 +235,7 @@ public.auctions_config = {
cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.name, record_b.name, desc)
return aux.sort.compare(record_a.name, record_b.name, desc)
end,
},
{
@@ -248,7 +248,7 @@ public.auctions_config = {
cell:SetText(display_level)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.level, record_b.level, desc)
return aux.sort.compare(record_a.level, record_b.level, desc)
end,
},
{
@@ -256,11 +256,11 @@ public.auctions_config = {
width = 0.06,
align = 'CENTER',
set = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color)..count..'|r') or count
local numAuctionsText = expandable and (aux.gui.inline_color(aux.gui.config.link_color)..count..'|r') or count
cell:SetText(numAuctionsText)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.EQ
return aux.sort.EQ
-- if sortKey == 'numAuctions' then
-- if a.children then
-- aVal = a.totalAuctions
@@ -280,7 +280,7 @@ public.auctions_config = {
cell:SetText(record.aux_quantity)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
return aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
end,
},
{
@@ -291,7 +291,7 @@ public.auctions_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.duration, record_b.duration, desc)
return aux.sort.compare(record_a.duration, record_b.duration, desc)
end,
},
{
@@ -306,7 +306,7 @@ public.auctions_config = {
else
price = 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(aux.money.to_string(price, true, false))
end,
cmp = function(record_a, record_b, desc)
local price_a
@@ -321,7 +321,7 @@ public.auctions_config = {
else
price_b = aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
end
return Aux.sort.compare(price_a, price_b, desc)
return aux.sort.compare(price_a, price_b, desc)
end,
},
{
@@ -331,15 +331,15 @@ public.auctions_config = {
isPrice = true,
set = function(cell, record)
local price = 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 aux.money.to_string(price, true, false) or '---')
end,
cmp = function(record_a, record_b, desc)
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
price_a = price_a > 0 and price_a or (desc and -Aux.huge or Aux.huge)
price_b = price_b > 0 and price_b or (desc and -Aux.huge or Aux.huge)
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
return Aux.sort.compare(price_a, price_b, desc)
return aux.sort.compare(price_a, price_b, desc)
end,
},
{
@@ -351,13 +351,13 @@ public.auctions_config = {
end,
cmp = function(record_a, record_b, desc)
if not record_a.high_bidder and not record_b.high_bidder then
return Aux.sort.EQ
return aux.sort.EQ
elseif not record_a.high_bidder then
return Aux.sort.GT
return aux.sort.GT
elseif not record_b.high_bidder then
return Aux.sort.LT
return aux.sort.LT
else
return Aux.sort.compare(record_a.high_bidder, record_b.high_bidder, desc)
return aux.sort.compare(record_a.high_bidder, record_b.high_bidder, desc)
end
end,
},
@@ -382,7 +382,7 @@ public.bids_config = {
cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.name, record_b.name, desc)
return aux.sort.compare(record_a.name, record_b.name, desc)
end,
},
{
@@ -390,11 +390,11 @@ public.bids_config = {
width = 0.06,
align = 'CENTER',
set = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color)..count..'|r') or count
local numAuctionsText = expandable and (aux.gui.inline_color(aux.gui.config.link_color)..count..'|r') or count
cell:SetText(numAuctionsText)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.EQ
return aux.sort.EQ
-- if sortKey == 'numAuctions' then
-- if a.children then
-- aVal = a.totalAuctions
@@ -414,7 +414,7 @@ public.bids_config = {
cell:SetText(record.aux_quantity)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
return aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
end,
},
{
@@ -425,7 +425,7 @@ public.bids_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.duration, record_b.duration, desc)
return aux.sort.compare(record_a.duration, record_b.duration, desc)
end,
},
{
@@ -433,17 +433,17 @@ public.bids_config = {
width = 0.13,
align = 'CENTER',
set = function(cell, record)
cell:SetText(Aux.is_player(record.owner) and ('|cffffff00'..record.owner..'|r') or (record.owner or '---'))
cell:SetText(aux.is_player(record.owner) and ('|cffffff00'..record.owner..'|r') 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.sort.EQ
return aux.sort.EQ
elseif not record_a.owner then
return Aux.sort.GT
return aux.sort.GT
elseif not record_b.owner then
return Aux.sort.LT
return aux.sort.LT
else
return Aux.sort.compare(record_a.owner, record_b.owner, desc)
return aux.sort.compare(record_a.owner, record_b.owner, desc)
end
end,
},
@@ -459,7 +459,7 @@ public.bids_config = {
else
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
end
cell:SetText(Aux.money.to_string(price))
cell:SetText(aux.money.to_string(price))
end,
cmp = function(record_a, record_b, desc)
local price_a
@@ -474,7 +474,7 @@ public.bids_config = {
else
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
end
return Aux.sort.compare(price_a, price_b, desc)
return aux.sort.compare(price_a, price_b, desc)
end,
},
{
@@ -484,15 +484,15 @@ public.bids_config = {
isPrice = true,
set = function(cell, record)
local price = 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 aux.money.to_string(price, true, false) or '---')
end,
cmp = function(record_a, record_b, desc)
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
price_a = price_a > 0 and price_a or (desc and -Aux.huge or Aux.huge)
price_b = price_b > 0 and price_b or (desc and -Aux.huge or Aux.huge)
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
return Aux.sort.compare(price_a, price_b, desc)
return aux.sort.compare(price_a, price_b, desc)
end,
},
{
@@ -509,7 +509,7 @@ public.bids_config = {
cell:SetText(status)
end,
cmp = function(record_a, record_b, desc)
return Aux.sort.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
return aux.sort.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
end,
},
}
@@ -517,12 +517,12 @@ public.bids_config = {
function private.record_percentage(record)
if not record then return end
local historical_value = Aux.history.value(record.item_key) or 0
local historical_value = aux.history.value(record.item_key) or 0
if historical_value > 0 then
if record.unit_buyout_price > 0 then
return Aux.util.round(100 * record.unit_buyout_price / historical_value, 1)
return aux.util.round(100 * record.unit_buyout_price / historical_value, 1)
end
return nil, Aux.util.round(100 * record.unit_bid_price / historical_value, 1)
return nil, aux.util.round(100 * record.unit_bid_price / historical_value, 1)
end
end
@@ -594,8 +594,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)
aux.info.set_tooltip(rowData.record.itemstring, this, 'ANCHOR_RIGHT')
aux.info.set_shopping_tooltip(rowData.record.slot)
rt.isShowingItemTooltip = true
end
end,
@@ -652,10 +652,10 @@ local methods = {
DressUpItemLink(this.row.data.record.hyperlink)
elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
elseif Aux.unmodified() and button == 'RightButton' then -- TODO not when alt (how?)
Aux.tab_group: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)
elseif aux.unmodified() and button == 'RightButton' then -- TODO not when alt (how?)
aux.tab_group: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)
else
local selection = this.rt:GetSelection()
if not selection or selection.record ~= this.row.data.record then
@@ -687,12 +687,12 @@ local methods = {
-- ============================================================================
UpdateRowInfo = function(self)
Aux.util.wipe(self.rowInfo)
aux.util.wipe(self.rowInfo)
self.rowInfo.numDisplayRows = 0
self.isSorted = nil
self:SetSelectedRecord(nil, true)
sort(self.records, function(a, b) return Aux.sort.multi_lt({a.search_signature, tostring(a)}, {b.search_signature, tostring(b)}) end)
sort(self.records, function(a, b) return aux.sort.multi_lt({a.search_signature, tostring(a)}, {b.search_signature, tostring(b)}) end)
local records = self.records
if getn(records) == 0 then return end
@@ -722,7 +722,7 @@ local methods = {
local totalAuctions, totalPlayerAuctions = 0, 0
for _, childInfo in ipairs(info.children) do
totalAuctions = totalAuctions + childInfo.numAuctions
if Aux.is_player(childInfo.record.owner) then
if aux.is_player(childInfo.record.owner) then
totalPlayerAuctions = totalPlayerAuctions + childInfo.numAuctions
end
end
@@ -738,7 +738,7 @@ local methods = {
-- update sorting highlights
for _, cell in ipairs(self.headCells) do
local tex = cell:GetNormalTexture()
tex:SetTexture([[Interface\AddOns\Aux-AddOn\WorldStateFinalScore-Highlight]])
tex:SetTexture([[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]])
tex:SetTexCoord(0.017, 1, 0.083, 0.909)
tex:SetAlpha(0.5)
end
@@ -773,11 +773,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.sort.EQ
local ordering = self.config[sort.index].cmp and self.config[sort.index].cmp(record_a, record_b, sort.descending) or aux.sort.EQ
if ordering == Aux.sort.LT then
if ordering == aux.sort.LT then
return true
elseif ordering == Aux.sort.GT then
elseif ordering == aux.sort.GT then
return false
end
end
@@ -855,7 +855,7 @@ local methods = {
-- ============================================================================
Reset = function(rt)
Aux.util.wipe(rt.expanded)
aux.util.wipe(rt.expanded)
rt:UpdateRowInfo()
rt:UpdateRows()
rt:SetSelectedRecord()
@@ -900,7 +900,7 @@ local methods = {
end,
RemoveAuctionRecord = function(self, record)
local index = Aux.util.key(record, self.records)
local index = aux.util.key(record, self.records)
if index then
tremove(self.records, index)
end
@@ -910,7 +910,7 @@ local methods = {
RemoveSelectedRecord = function(self, count)
count = count or 1
for i=1, count do
local index = Aux.util.key(self.selected, self.records)
local index = aux.util.key(self.selected, self.records)
if index then
tremove(self.records, index)
end
@@ -927,7 +927,7 @@ local methods = {
end,
ContainsRecord = function(rt, record)
if Aux.util.key(record, rt.records) then
if aux.util.key(record, rt.records) then
return true
end
end,
@@ -996,7 +996,7 @@ local methods = {
function public.CreateAuctionResultsTable(parent, config)
local rtName = 'AuxAuctionResultsTable'..RT_COUNT
local rtName = 'aux_frame'..aux.unique()
RT_COUNT = RT_COUNT + 1
local rt = CreateFrame('Frame', rtName, parent)
rt.config = config
@@ -1047,7 +1047,7 @@ function public.CreateAuctionResultsTable(parent, config)
scrollBar:SetWidth(10)
local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(unpack(Aux.gui.config.content_color.backdrop))
thumbTex:SetTexture(unpack(aux.gui.config.content_color.backdrop))
thumbTex:SetHeight(150)
thumbTex:SetWidth(scrollBar:GetWidth())
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
@@ -1073,15 +1073,15 @@ function public.CreateAuctionResultsTable(parent, config)
local text = cell:CreateFontString()
text:SetJustifyH('CENTER')
text:SetJustifyV('CENTER')
text:SetFont(Aux.gui.config.font, Aux.gui.config.tiny_font_size)
text:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
text:SetFont(aux.gui.config.font, aux.gui.config.tiny_font_size)
text:SetTextColor(unpack(aux.gui.config.label_color.enabled))
cell:SetFontString(text)
if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO
text:SetAllPoints()
local tex = cell:CreateTexture()
tex:SetAllPoints()
tex:SetTexture([[Interface\AddOns\Aux-AddOn\WorldStateFinalScore-Highlight]])
tex:SetTexture([[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]])
tex:SetTexCoord(0.017, 1, 0.083, 0.909)
tex:SetAlpha(0.5)
cell:SetNormalTexture(tex)
@@ -1119,7 +1119,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(aux.gui.config.font, min(14, rt.ROW_HEIGHT))
text:SetJustifyH(rt.config[j].align or 'LEFT')
text:SetJustifyV('CENTER')
text:SetPoint('TOPLEFT', 1, -1)
+3 -3
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'item_listing'
local m, public, private = aux.module'item_listing'
local ROW_HEIGHT = 39
@@ -60,7 +60,7 @@ function public.create(parent, on_click, on_enter, on_leave, selected)
scrollBar:SetWidth(12)
local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(unpack(Aux.gui.config.content_color.backdrop))
thumbTex:SetTexture(unpack(aux.gui.config.content_color.backdrop))
thumbTex:SetHeight(50)
thumbTex:SetWidth(12)
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
@@ -87,7 +87,7 @@ function public.create(parent, on_click, on_enter, on_leave, selected)
on_leave()
end)
row.item = Aux.gui.item(row)
row.item = aux.gui.item(row)
row.item:EnableMouse(nil)
row.item:SetScale(0.9)
row.item:SetPoint('LEFT', 2.5, 0)
+8 -8
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'listing'
local m, public, private = aux.module'listing'
local ST_COUNT = 0
@@ -308,8 +308,8 @@ local methods = {
local text = col:CreateFontString()
text:SetJustifyV('CENTER')
text:SetFont(Aux.gui.config.font, Aux.gui.config.medium_font_size)
text:SetTextColor(unpack(Aux.gui.config.text_color.enabled))
text:SetFont(aux.gui.config.font, aux.gui.config.medium_font_size)
text:SetTextColor(unpack(aux.gui.config.text_color.enabled))
text:SetAllPoints()
col.text = text
col:SetFontString(text)
@@ -336,7 +336,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(aux.gui.config.font, ST_ROW_TEXT_SIZE)
text:SetJustifyV('CENTER')
text:SetPoint('TOPLEFT', 1, -1)
text:SetPoint('BOTTOMRIGHT', -1, 1)
@@ -392,9 +392,9 @@ local methods = {
-- update the text size of the head cols
for _, col in ipairs(st.headCols) do
if st.sizes.headFontSize then
col.text:SetFont(Aux.gui.config.font, st.sizes.headFontSize)
col.text:SetFont(aux.gui.config.font, st.sizes.headFontSize)
else
col.text:SetFont(Aux.gui.config.font, Aux.gui.config.medium_font_size)
col.text:SetFont(aux.gui.config.font, aux.gui.config.medium_font_size)
end
end
st:Redraw()
@@ -433,14 +433,14 @@ function public.CreateScrollingTable(parent)
st.scrollBar = scrollBar
local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(unpack(Aux.gui.config.content_color.backdrop))
thumbTex:SetTexture(unpack(aux.gui.config.content_color.backdrop))
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 = aux.gui.horizontal_line(st, 0)
-- add all the methods
for name, func in methods do
+7 -7
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.tab(3, 'auctions_tab')
local m, public, private = aux.tab(3, 'auctions_tab')
private.auction_records = nil
@@ -34,7 +34,7 @@ function public.scan_auctions()
m.auction_records = {}
m.update_listing()
Aux.scan.start{
aux.scan.start{
type = 'owner',
queries = {{ blizzard_query = {} }},
on_page_loaded = function(page, total_pages)
@@ -58,7 +58,7 @@ end
function private.test(record)
return function(index)
local auction_info = Aux.info.auction(index, 'owner')
local auction_info = aux.info.auction(index, 'owner')
return auction_info and auction_info.search_signature == record.search_signature
end
end
@@ -74,9 +74,9 @@ do
return
end
Aux.scan.abort(scan_id)
aux.scan.abort(scan_id)
state = SEARCHING
scan_id = Aux.scan_util.find(
scan_id = aux.scan_util.find(
record,
m.status_bar,
function()
@@ -92,7 +92,7 @@ do
m.cancel_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then
Aux.cancel_auction(index, Aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
aux.cancel_auction(index, aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.cancel_button:Enable()
@@ -116,7 +116,7 @@ do
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
if not aux.cancel_in_progress() then
state = IDLE
end
end
+6 -6
View File
@@ -1,15 +1,15 @@
Aux.auctions_tab.FRAMES(function(m, public, private)
aux.auctions_tab.FRAMES(function(m, public, private)
private.frame = CreateFrame('Frame', nil, AuxFrame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide()
m.frame.listing = Aux.gui.panel(m.frame)
m.frame.listing = aux.gui.panel(m.frame)
m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8)
m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
private.listing = Aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, Aux.auction_listing.auctions_config)
private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.auctions_config)
m.listing:SetSort(1,2,3,4,5,6,7,8)
m.listing:Reset()
m.listing:SetHandler('OnCellClick', function(cell, button)
@@ -23,7 +23,7 @@ Aux.auctions_tab.FRAMES(function(m, public, private)
end)
do
local status_bar = Aux.gui.status_bar(m.frame)
local status_bar = aux.gui.status_bar(m.frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
@@ -32,7 +32,7 @@ Aux.auctions_tab.FRAMES(function(m, public, private)
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(m.frame, 16)
local btn = aux.gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -41,7 +41,7 @@ Aux.auctions_tab.FRAMES(function(m, public, private)
private.cancel_button = btn
end
do
local btn = Aux.gui.button(m.frame, 16)
local btn = aux.gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
+10 -10
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.tab(4, 'bids_tab')
local m, public, private = aux.tab(4, 'bids_tab')
private.auction_records = nil
@@ -34,7 +34,7 @@ function public.scan_bids()
m.auction_records = {}
m.update_listing()
Aux.scan.start{
aux.scan.start{
type = 'bidder',
queries = {{ blizzard_query = {} }},
on_page_loaded = function(page, total_pages)
@@ -58,7 +58,7 @@ end
function private.test(record)
return function(index)
local auction_info = Aux.info.auction(index, 'bidder')
local auction_info = aux.info.auction(index, 'bidder')
return auction_info and auction_info.search_signature == record.search_signature
end
end
@@ -74,9 +74,9 @@ do
return
end
Aux.scan.abort(scan_id)
aux.scan.abort(scan_id)
state = SEARCHING
scan_id = Aux.scan_util.find(
scan_id = aux.scan_util.find(
record,
m.status_bar,
function()
@@ -93,10 +93,10 @@ do
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)
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 Aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
end or aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.bid_button:Enable()
@@ -105,7 +105,7 @@ do
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, Aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
aux.place_bid('bidder', index, record.buyout_price, aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.buyout_button:Enable()
@@ -132,7 +132,7 @@ do
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
if not aux.bid_in_progress() then
state = IDLE
end
end
+7 -7
View File
@@ -1,15 +1,15 @@
Aux.bids_tab.FRAMES(function(m, public, private)
aux.bids_tab.FRAMES(function(m, public, private)
private.frame = CreateFrame('Frame', nil, AuxFrame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide()
m.frame.listing = Aux.gui.panel(m.frame)
m.frame.listing = aux.gui.panel(m.frame)
m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8)
m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
private.listing = Aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, Aux.auction_listing.bids_config)
private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.bids_config)
m.listing:SetSort(1,2,3,4,5,6,7,8)
m.listing:Reset()
m.listing:SetHandler('OnCellClick', function(cell, button)
@@ -27,7 +27,7 @@ Aux.bids_tab.FRAMES(function(m, public, private)
end)
do
local status_bar = Aux.gui.status_bar(m.frame)
local status_bar = aux.gui.status_bar(m.frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
@@ -36,7 +36,7 @@ Aux.bids_tab.FRAMES(function(m, public, private)
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(m.frame, 16)
local btn = aux.gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -45,7 +45,7 @@ Aux.bids_tab.FRAMES(function(m, public, private)
private.bid_button = btn
end
do
local btn = Aux.gui.button(m.frame, 16)
local btn = aux.gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -54,7 +54,7 @@ Aux.bids_tab.FRAMES(function(m, public, private)
private.buyout_button = btn
end
do
local btn = Aux.gui.button(m.frame, 16)
local btn = aux.gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
+51 -51
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.tab(2, 'post_tab')
local m, public, private = aux.tab(2, 'post_tab')
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'}}
@@ -20,7 +20,7 @@ end
function public.OPEN()
m.frame:Show()
m.deposit:SetText('Deposit: '..Aux.money.to_string(0, nil, nil, nil, Aux.gui.inline_color({255, 254, 250, 1})))
m.deposit:SetText('Deposit: '..aux.money.to_string(0, nil, nil, nil, aux.gui.inline_color({255, 254, 250, 1})))
m.set_unit_start_price(0)
m.set_unit_buyout_price(0)
@@ -47,12 +47,12 @@ end
function private.read_settings(item_key)
item_key = item_key or m.selected_item.key
local dataset = Aux.persistence.load_dataset()
local dataset = aux.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 = aux.persistence.read(settings_schema, dataset.post[item_key])
else
settings = m.default_settings()
end
@@ -62,28 +62,28 @@ end
function private.write_settings(settings, item_key)
item_key = item_key or m.selected_item.key
local dataset = Aux.persistence.load_dataset()
local dataset = aux.persistence.load_dataset()
dataset.post = dataset.post or {}
dataset.post[item_key] = Aux.persistence.write(settings_schema, settings)
dataset.post[item_key] = aux.persistence.write(settings_schema, settings)
end
function private.get_unit_start_price()
local money_text = m.unit_start_price:GetText()
return Aux.money.from_string(money_text) or (tonumber(money_text) and tonumber(money_text) * 10000) or 0
return aux.money.from_string(money_text) or (tonumber(money_text) and tonumber(money_text) * 10000) or 0
end
function private.set_unit_start_price(amount)
m.unit_start_price:SetText(Aux.money.to_string(amount, true, nil, 3))
m.unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3))
end
function private.get_unit_buyout_price()
local money_text = m.unit_buyout_price:GetText()
return Aux.money.from_string(money_text) or (tonumber(money_text) and tonumber(money_text) * 10000) or 0
return aux.money.from_string(money_text) or (tonumber(money_text) and tonumber(money_text) * 10000) or 0
end
function private.set_unit_buyout_price(amount)
m.unit_buyout_price:SetText(Aux.money.to_string(amount, true, nil, 3))
m.unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3))
end
function private.update_inventory_listing()
@@ -91,7 +91,7 @@ function private.update_inventory_listing()
return
end
Aux.item_listing.populate(m.item_listing, Aux.util.values(Aux.util.filter(m.inventory_records, function(record)
aux.item_listing.populate(m.item_listing, aux.util.values(aux.util.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)))
@@ -110,15 +110,15 @@ function private.update_auction_listing()
for i, auction_record in ipairs(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 = aux.money.from_string(aux.money.to_string(blizzard_bid_undercut, true, nil, 3))
buyout_price_undercut = aux.money.from_string(aux.money.to_string(buyout_price_undercut, true, nil, 3))
local stack_blizzard_bid_undercut, stack_buyout_price_undercut = 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 = aux.money.from_string(aux.money.to_string(stack_blizzard_bid_undercut, true, nil, 3))
stack_buyout_price_undercut = aux.money.from_string(aux.money.to_string(stack_buyout_price_undercut, true, nil, 3))
local stack_size = m.stack_size_slider:GetValue()
local historical_value = Aux.history.value(m.selected_item.key)
local historical_value = aux.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
@@ -141,27 +141,27 @@ function private.update_auction_listing()
tinsert(auction_rows, {
cols = {
{ value=auction_record.own and GREEN_FONT_COLOR_CODE..auction_record.count..FONT_COLOR_CODE_CLOSE or auction_record.count },
{ value=Aux.auction_listing.time_left(auction_record.duration) },
{ value=aux.auction_listing.time_left(auction_record.duration) },
{ value=auction_record.stack_size == stack_size and GREEN_FONT_COLOR_CODE..auction_record.stack_size..FONT_COLOR_CODE_CLOSE 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(Aux.util.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(Aux.util.round(auction_record.unit_buyout_price / historical_value * 100)) or '---' },
{ value=aux.money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color) },
{ value=historical_value and aux.auction_listing.percentage_historical(aux.util.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(aux.util.round(auction_record.unit_buyout_price / historical_value * 100)) or '---' },
},
record = auction_record,
})
end
sort(auction_rows, function(a, b)
return Aux.sort.multi_lt(
return aux.sort.multi_lt(
{
a.record.unit_buyout_price == 0 and Aux.huge or a.record.unit_buyout_price,
a.record.unit_buyout_price == 0 and aux.huge or a.record.unit_buyout_price,
a.record.unit_blizzard_bid,
a.record.stack_size,
b.record.own and 1 or 0,
a.record.duration,
},
{
b.record.unit_buyout_price == 0 and Aux.huge or b.record.unit_buyout_price,
b.record.unit_buyout_price == 0 and aux.huge or b.record.unit_buyout_price,
b.record.unit_blizzard_bid,
b.record.stack_size,
a.record.own and 1 or 0,
@@ -174,7 +174,7 @@ function private.update_auction_listing()
end
function public.select_item(item_key)
for _, inventory_record in Aux.util.filter(m.inventory_records, function(record) return record.aux_quantity > 0 end) do
for _, inventory_record in aux.util.filter(m.inventory_records, function(record) return record.aux_quantity > 0 end) do
if inventory_record.key == item_key then
m.set_item(inventory_record)
break
@@ -188,13 +188,13 @@ function private.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(Aux.util.round(start_price_input / historical_value * 100)) or '---')
local historical_value = aux.history.value(m.selected_item.key)
m.start_price_percentage:SetText(historical_value and aux.auction_listing.percentage_historical(aux.util.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(Aux.util.round(buyout_price_input / historical_value * 100)) or '---')
local historical_value = aux.history.value(m.selected_item.key)
m.buyout_price_percentage:SetText(historical_value and aux.auction_listing.percentage_historical(aux.util.round(buyout_price_input / historical_value * 100)) or '---')
m.write_settings(settings)
end
@@ -219,7 +219,7 @@ function private.post_auctions()
duration_code = 4
end
Aux.post.start(
aux.post.start(
key,
stack_size,
duration,
@@ -278,7 +278,7 @@ function private.update_item_configuration()
m.item.texture:SetTexture(nil)
m.item.count:SetText()
m.item.name:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
m.item.name:SetTextColor(unpack(aux.gui.config.label_color.enabled))
m.item.name:SetText('No item selected')
m.unit_start_price:Hide()
@@ -313,13 +313,13 @@ function private.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 = aux.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({255, 254, 250, 1})))
m.deposit:SetText('Deposit: '..aux.money.to_string(deposit, nil, nil, nil, aux.gui.inline_color({255, 254, 250, 1})))
end
m.refresh_button:Enable()
@@ -327,8 +327,8 @@ function private.update_item_configuration()
end
function private.undercut(record, stack_size, stack)
local start_price = Aux.util.round(record.unit_blizzard_bid * (stack and record.stack_size or stack_size))
local buyout_price = Aux.util.round(record.unit_buyout_price * (stack and record.stack_size or stack_size))
local start_price = aux.util.round(record.unit_blizzard_bid * (stack and record.stack_size or stack_size))
local buyout_price = aux.util.round(record.unit_buyout_price * (stack and record.stack_size or stack_size))
if not record.own then
start_price = max(0, start_price - 1)
@@ -351,16 +351,16 @@ end
function private.unit_vendor_price(item_key)
for slot in Aux.util.inventory() do
for slot in aux.util.inventory() do
local item_info = Aux.info.container_item(unpack(slot))
local item_info = aux.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 aux.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 = aux.info.auction_sell_item()
ClearCursor()
ClickAuctionSellItemButton()
ClearCursor()
@@ -375,9 +375,9 @@ end
function private.update_historical_value_button()
if m.selected_item then
local historical_value = Aux.history.value(m.selected_item.key)
local historical_value = aux.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 aux.money.to_string(historical_value, true, nil, 3) or '---')
end
end
@@ -392,7 +392,7 @@ function private.set_item(item)
return
end
Aux.scan.abort(m.scan_id)
aux.scan.abort(m.scan_id)
m.selected_item = item
@@ -405,8 +405,8 @@ function private.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(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))
if not m.existing_auctions[m.selected_item.key] then
m.refresh_entries()
@@ -422,13 +422,13 @@ function private.update_inventory_records()
local auction_candidate_map = {}
for slot in Aux.util.inventory() do
for slot in aux.util.inventory() do
local item_info = Aux.info.container_item(unpack(slot))
local item_info = aux.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 aux.info.auctionable(item_info.tooltip, nil, item_info.lootable) then
if not auction_candidate_map[item_info.item_key] then
local availability = {}
@@ -476,12 +476,12 @@ function private.refresh_entries()
m.existing_auctions[item_key] = nil
local query = Aux.scan_util.item_query(item_id)
local query = aux.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 = aux.scan.start{
type = 'list',
ignore_owner = true,
queries = { query },
@@ -521,7 +521,7 @@ function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyou
m.existing_auctions[key] = m.existing_auctions[key] or {}
local entry
for _, existing_entry in ipairs(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 aux.is_player(owner) == existing_entry.own then
entry = existing_entry
end
end
@@ -532,7 +532,7 @@ function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyou
unit_blizzard_bid = unit_blizzard_bid,
unit_buyout_price = unit_buyout_price,
duration = duration,
own = Aux.is_player(owner),
own = aux.is_player(owner),
count = 0,
}
tinsert(m.existing_auctions[key], entry)
+41 -41
View File
@@ -1,4 +1,4 @@
Aux.post_tab.FRAMES(function(m, public, private)
aux.post_tab.FRAMES(function(m, public, private)
private.frame = CreateFrame('Frame', nil, AuxFrame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
@@ -9,17 +9,17 @@ Aux.post_tab.FRAMES(function(m, public, private)
m.frame.content:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
m.frame.content:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
m.frame.inventory = Aux.gui.panel(m.frame.content)
m.frame.inventory = aux.gui.panel(m.frame.content)
m.frame.inventory:SetWidth(212)
m.frame.inventory:SetPoint('TOPLEFT', 0, 0)
m.frame.inventory:SetPoint('BOTTOMLEFT', 0, 0)
m.frame.parameters = Aux.gui.panel(m.frame.content)
m.frame.parameters = aux.gui.panel(m.frame.content)
m.frame.parameters:SetHeight(173)
m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0)
m.frame.parameters:SetPoint('TOPRIGHT', 0, 0)
m.frame.auctions = Aux.gui.panel(m.frame.content)
m.frame.auctions = aux.gui.panel(m.frame.content)
m.frame.auctions:SetHeight(228)
m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0)
@@ -32,27 +32,27 @@ Aux.post_tab.FRAMES(function(m, public, private)
checkbox:SetScript('OnClick', function()
m.refresh = true
end)
local label = Aux.gui.label(checkbox, Aux.gui.config.small_font_size)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
label:SetText('Show hidden items')
private.show_hidden_checkbox = checkbox
end
Aux.gui.horizontal_line(m.frame.inventory, -48)
aux.gui.horizontal_line(m.frame.inventory, -48)
private.item_listing = Aux.item_listing.create(
private.item_listing = aux.item_listing.create(
m.frame.inventory,
function()
if arg1 == 'LeftButton' then
m.set_item(this.item_record)
elseif arg1 == 'RightButton' then
Aux.tab_group: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)
aux.tab_group: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)
end
end,
function()
Aux.info.set_tooltip(this.item_record.itemstring, this, 'ANCHOR_RIGHT')
aux.info.set_tooltip(this.item_record.itemstring, this, 'ANCHOR_RIGHT')
end,
function()
GameTooltip:Hide()
@@ -62,7 +62,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
end
)
private.auction_listing = Aux.listing.CreateScrollingTable(m.frame.auctions)
private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions)
m.auction_listing:SetColInfo({
{ name='Auctions', width=.12, align='CENTER' },
{ name='Left', width=.1, align='CENTER' },
@@ -75,7 +75,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
m.auction_listing:EnableSorting(false)
m.auction_listing:DisableSelection(true)
m.auction_listing:SetHandler('OnClick', function(table, row_data, column, button)
local column_index = Aux.util.key(column, column.row.cols)
local column_index = aux.util.key(column, column.row.cols)
local unit_start_price, unit_buyout_price = m.undercut(row_data.record, m.stack_size_slider:GetValue(), button == 'RightButton')
if column_index == 3 then
m.stack_size_slider:SetValue(row_data.record.stack_size)
@@ -87,7 +87,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
end)
do
local status_bar = Aux.gui.status_bar(m.frame)
local status_bar = aux.gui.status_bar(m.frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
@@ -96,7 +96,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(m.frame.parameters, 16)
local btn = aux.gui.button(m.frame.parameters, 16)
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -105,31 +105,31 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.post_button = btn
end
do
local btn = Aux.gui.button(m.frame.parameters, 16)
local btn = aux.gui.button(m.frame.parameters, 16)
btn:SetPoint('TOPLEFT', m.post_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
Aux.scan.abort(m.scan_id)
aux.scan.abort(m.scan_id)
m.refresh_entries()
m.refresh = true
end)
private.refresh_button = btn
end
do
local item = Aux.gui.item(m.frame.parameters)
local item = aux.gui.item(m.frame.parameters)
item:SetPoint('TOPLEFT', 10, -8)
item:EnableMouse()
item:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item()
local item_info = aux.cursor_item()
if item_info then
m.select_item(item_info.item_key)
end
ClearCursor()
end)
item:SetScript('OnClick', function()
local item_info = Aux.cursor_item()
local item_info = aux.cursor_item()
if item_info then
m.select_item(item_info.item_key)
end
@@ -143,7 +143,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
item:SetScript('OnEnter', function()
highlight:Show()
if m.selected_item then
Aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT')
aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT')
end
end)
item:SetScript('OnLeave', function()
@@ -153,7 +153,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.item = item
end
do
local slider = Aux.gui.slider(m.frame.parameters)
local slider = aux.gui.slider(m.frame.parameters)
slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', 16, -73)
slider:SetWidth(190)
@@ -184,7 +184,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.stack_size_slider = slider
end
do
local slider = Aux.gui.slider(m.frame.parameters)
local slider = aux.gui.slider(m.frame.parameters)
slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -30)
slider:SetWidth(190)
@@ -207,18 +207,18 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.stack_count_slider = slider
end
do
local dropdown = Aux.gui.dropdown(m.frame.parameters)
local dropdown = aux.gui.dropdown(m.frame.parameters)
dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21)
dropdown:SetWidth(90)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Duration')
UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown)
end)
local label = Aux.gui.label(dropdown, Aux.gui.config.medium_font_size)
local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size)
label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0)
private.deposit = label
private.duration_dropdown = dropdown
@@ -234,18 +234,18 @@ Aux.post_tab.FRAMES(function(m, public, private)
m.write_settings(settings)
m.refresh = true
end)
local label = Aux.gui.label(checkbox, Aux.gui.config.small_font_size)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
label:SetText('Hide this item')
private.hide_checkbox = checkbox
end
do
local editbox = Aux.gui.editbox(m.frame.parameters)
local editbox = aux.gui.editbox(m.frame.parameters)
editbox:SetPoint('TOPRIGHT', -65, -66)
editbox:SetJustifyH('RIGHT')
editbox:SetWidth(150)
editbox:SetScript('OnTextChanged', function()
this.pretty:SetText(Aux.money.to_string(m.get_unit_start_price(), true, nil, 3))
this.pretty:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3))
m.refresh = true
end)
editbox:SetScript('OnTabPressed', function()
@@ -265,19 +265,19 @@ Aux.post_tab.FRAMES(function(m, public, private)
this.pretty:Hide()
end)
editbox:SetScript('OnEditFocusLost', function()
this:SetText(Aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true))
this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true))
this.pretty:Show()
end)
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
editbox.pretty = aux.gui.label(editbox, aux.gui.config.medium_font_size)
editbox.pretty:SetAllPoints()
editbox.pretty:SetJustifyH('RIGHT')
do
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Starting Price')
end
do
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
@@ -286,12 +286,12 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.unit_start_price = editbox
end
do
local editbox = Aux.gui.editbox(m.frame.parameters)
local editbox = aux.gui.editbox(m.frame.parameters)
editbox:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -18)
editbox:SetJustifyH('RIGHT')
editbox:SetWidth(150)
editbox:SetScript('OnTextChanged', function()
this.pretty:SetText(Aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3))
this.pretty:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3))
m.refresh = true
end)
editbox:SetScript('OnTabPressed', function()
@@ -309,19 +309,19 @@ Aux.post_tab.FRAMES(function(m, public, private)
this.pretty:Hide()
end)
editbox:SetScript('OnEditFocusLost', function()
this:SetText(Aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true))
this:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true))
this.pretty:Show()
end)
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
editbox.pretty = aux.gui.label(editbox, aux.gui.config.medium_font_size)
editbox.pretty:SetAllPoints()
editbox.pretty:SetJustifyH('RIGHT')
do
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Buyout Price')
end
do
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
@@ -330,7 +330,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.unit_buyout_price = editbox
end
do
local btn = Aux.gui.button(m.frame.parameters, 16)
local btn = aux.gui.button(m.frame.parameters, 16)
btn:SetPoint('TOPRIGHT', -15, -143)
btn:SetWidth(150)
btn:SetHeight(20)
@@ -343,7 +343,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
m.set_unit_buyout_price(this.amount)
end
end)
local label = Aux.gui.label(btn, Aux.gui.config.small_font_size)
local label = aux.gui.label(btn, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText('Historical Value')
private.historical_value_button = btn
+53 -53
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.tab(1, 'search_tab')
local m, public, private = aux.tab(1, 'search_tab')
aux_favorite_searches = {}
aux_recent_searches = {}
@@ -86,7 +86,7 @@ end
function private.update_search_listings()
local favorite_search_rows = {}
for i, favorite_search in ipairs(aux_favorite_searches) do
for i, favorite_search in aux_favorite_searches do
local name = strsub(favorite_search.prettified, 1, 250)
tinsert(favorite_search_rows, {
cols = {{value=name}},
@@ -97,7 +97,7 @@ function private.update_search_listings()
m.favorite_searches_listing:SetData(favorite_search_rows)
local recent_search_rows = {}
for i, recent_search in ipairs(aux_recent_searches) do
for i, recent_search in aux_recent_searches do
local name = strsub(recent_search.prettified, 1, 250)
tinsert(recent_search_rows, {
cols = {{value=name}},
@@ -135,7 +135,7 @@ end
function public.add_filter(filter_string)
local old_filter_string = m.search_box:GetText()
old_filter_string = Aux.util.trim(old_filter_string)
old_filter_string = aux.util.trim(old_filter_string)
if old_filter_string ~= '' then
old_filter_string = old_filter_string..';'
@@ -146,12 +146,12 @@ end
function private.update_auto_buy_filter()
if aux_auto_buy_filter ~= '' then
local queries = Aux.filter.queries(aux_auto_buy_filter)
local queries = aux.filter.queries(aux_auto_buy_filter)
if queries then
if getn(queries) > 1 then
Aux.log('Error: The automatic buyout filter may contain only one query')
elseif Aux.util.size(queries[1].blizzard_query) > 0 then
Aux.log('Error: The automatic buyout filter does not support Blizzard filters')
aux.log('Error: The automatic buyout filter may contain only one query')
elseif aux.util.size(queries[1].blizzard_query) > 0 then
aux.log('Error: The automatic buyout filter does not support Blizzard filters')
else
m.auto_buy_validator = queries[1].validator
m.auto_buy_filter_button.prettified = queries[1].prettified
@@ -188,7 +188,7 @@ function private.clear_form()
end
function private.discard_continuation()
Aux.scan.abort(m.search_scan_id)
aux.scan.abort(m.search_scan_id)
m.current_search().continuation = nil
m.update_continuation()
end
@@ -215,7 +215,7 @@ function private.start_real_time_scan(query, search, continuation)
local next_page
local new_records = {}
m.search_scan_id = Aux.scan.start{
m.search_scan_id = aux.scan.start{
type = 'list',
queries = {query},
auto_buy_validator = search.auto_buy_validator,
@@ -233,8 +233,8 @@ function private.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, Aux.f(ctrl.resume, true))
Aux.control.thread(Aux.control.sleep, 10, Aux.f(ctrl.resume, false))
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux.f(ctrl.resume, true))
aux.control.thread(aux.control.sleep, 10, aux.f(ctrl.resume, false))
else
tinsert(new_records, auction_record)
end
@@ -299,7 +299,7 @@ function private.start_search(queries, continuation)
end
m.search_scan_id = Aux.scan.start{
m.search_scan_id = aux.scan.start{
type = 'list',
queries = queries,
auto_buy_validator = search.auto_buy_validator,
@@ -329,8 +329,8 @@ function private.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, Aux.f(ctrl.resume, true))
Aux.control.thread(Aux.control.sleep, 10, Aux.f(ctrl.resume, false))
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux.f(ctrl.resume, true))
aux.control.thread(aux.control.sleep, 10, aux.f(ctrl.resume, false))
elseif getn(search.records) < 1000 then
tinsert(search.records, auction_record)
if getn(search.records) == 1000 then
@@ -381,15 +381,15 @@ function public.execute(resume, real_time)
end
local filter_string = m.search_box:GetText()
local queries = Aux.filter.queries(filter_string)
local queries = aux.filter.queries(filter_string)
if not queries then
return
elseif real_time then
if getn(queries) > 1 then
Aux.log('Invalid filter: The real time mode does not support multiple queries')
aux.log('Invalid filter: The real time mode does not support multiple queries')
return
elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then
Aux.log('Invalid filter: The real time mode does not support page range filters')
aux.log('Invalid filter: The real time mode does not support page range filters')
return
end
end
@@ -400,7 +400,7 @@ function public.execute(resume, real_time)
m.current_search().table:SetSelectedRecord()
else
if filter_string ~= m.current_search().filter_string then
m.new_search(filter_string, Aux.util.join(Aux.util.map(queries, function(filter) return filter.prettified end), ';'))
m.new_search(filter_string, aux.util.join(aux.util.map(queries, function(filter) return filter.prettified end), ';'))
else
m.current_search().records = {}
m.current_search().table:SetDatabase(m.current_search().records)
@@ -432,19 +432,19 @@ end
function private.blizzard_page_index(str)
if tonumber(str) then
return Aux.util.round(max(0, tonumber(str) - 1))
return aux.util.round(max(0, tonumber(str) - 1))
end
end
function private.blizzard_level(str)
if tonumber(str) then
return Aux.util.round(max(1, min(60, tonumber(str))))
return aux.util.round(max(1, min(60, tonumber(str))))
end
end
function private.test(record)
return function(index)
local auction_info = Aux.info.auction(index)
local auction_info = aux.info.auction(index)
return auction_info and auction_info.search_signature == record.search_signature
end
end
@@ -458,13 +458,13 @@ do
function private.find_auction(record)
local search = m.current_search()
if not search.table:ContainsRecord(record) or Aux.is_player(record.owner) then
if not search.table:ContainsRecord(record) or aux.is_player(record.owner) then
return
end
Aux.scan.abort(scan_id)
aux.scan.abort(scan_id)
state = SEARCHING
scan_id = Aux.scan_util.find(
scan_id = aux.scan_util.find(
record,
m.current_search().status_bar,
function()
@@ -485,10 +485,10 @@ do
if not record.high_bidder then
m.bid_button:SetScript('OnClick', function()
if m.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)
aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
aux.info.bid_update(record)
search.table:SetDatabase()
end or Aux.f(search.table.RemoveAuctionRecord, search.table, record))
end or aux.f(search.table.RemoveAuctionRecord, search.table, record))
end
end)
m.bid_button:Enable()
@@ -497,7 +497,7 @@ do
if record.buyout_price > 0 then
m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and search.table:ContainsRecord(record) then
Aux.place_bid('list', index, record.buyout_price, Aux.f(search.table.RemoveAuctionRecord, search.table, record))
aux.place_bid('list', index, record.buyout_price, aux.f(search.table.RemoveAuctionRecord, search.table, record))
end
end)
m.buyout_button:Enable()
@@ -524,7 +524,7 @@ do
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
if not aux.bid_in_progress() then
state = IDLE
end
end
@@ -731,12 +731,12 @@ function private.initialize_filter_dropdown()
local function on_click()
UIDropDownMenu_SetSelectedValue(m.filter_dropdown, this.value)
m.filter_button:SetText(this.value)
if (not Aux.filter.filters[this.value] or Aux.filter.filters[this.value].input_type == '') and this.value ~= 'and' and this.value ~= 'or' then
if (not aux.filter.filters[this.value] or aux.filter.filters[this.value].input_type == '') and this.value ~= 'and' and this.value ~= 'or' then
m.filter_input:Hide()
else
local _, _, suggestions = Aux.filter.parse_query_string(UIDropDownMenu_GetSelectedValue(m.filter_dropdown)..'/')
m.filter_input:SetNumeric(not Aux.filter.filters[this.value] or Aux.filter.filters[this.value].input_type == 'number')
m.filter_input.complete = Aux.completion.complete(function() return suggestions or {} end)
local _, _, suggestions = aux.filter.parse_query_string(UIDropDownMenu_GetSelectedValue(m.filter_dropdown)..'/')
m.filter_input:SetNumeric(not aux.filter.filters[this.value] or aux.filter.filters[this.value].input_type == 'number')
m.filter_input.complete = aux.completion.complete(function() return suggestions or {} end)
m.filter_input:Show()
m.filter_input:SetFocus()
end
@@ -759,7 +759,7 @@ function private.get_form()
end
local name = m.name_input:GetText()
name = name == '' and name or Aux.filter.quote(name)
name = name == '' and name or aux.filter.quote(name)
add(name)
if m.exact_checkbox:GetChecked() then
@@ -814,7 +814,7 @@ function private.set_form(components)
if name and strsub(name, 1, 1) == '"' and strsub(name, -1, -1) == '"' then
name = strsub(name, 2, -2)
end
m.name_input:SetText(Aux.filter.unquote(filter[2]))
m.name_input:SetText(aux.filter.unquote(filter[2]))
elseif filter[1] == 'exact' then
m.exact_checkbox:SetChecked(true)
elseif filter[1] == 'min_level' then
@@ -824,19 +824,19 @@ function private.set_form(components)
elseif filter[1] == 'usable' then
m.usable_checkbox:SetChecked(true)
elseif filter[1] == 'class' then
class_index = Aux.info.item_class_index(filter[2])
class_index = aux.info.item_class_index(filter[2])
UIDropDownMenu_Initialize(m.class_dropdown, m.initialize_class_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.class_dropdown, class_index)
elseif filter[1] == 'subclass' then
subclass_index = Aux.info.item_subclass_index(class_index, filter[2])
subclass_index = aux.info.item_subclass_index(class_index, filter[2])
UIDropDownMenu_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, subclass_index)
elseif filter[1] == 'slot' then
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, ({GetAuctionInvTypes(class_index, subclass_index)})[Aux.info.item_slot_index(class_index, subclass_index, filter[2])])
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, ({GetAuctionInvTypes(class_index, subclass_index)})[aux.info.item_slot_index(class_index, subclass_index, filter[2])])
elseif filter[1] == 'quality' then
UIDropDownMenu_Initialize(m.quality_dropdown, m.initialize_quality_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, Aux.info.item_quality_index(filter[2]))
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, aux.info.item_quality_index(filter[2]))
end
end
@@ -845,22 +845,22 @@ function private.set_form(components)
end
function private.import_query_string()
local components, error = Aux.filter.parse_query_string(({strfind(m.search_box:GetText(), '^([^;]*)')})[3])
local components, error = aux.filter.parse_query_string(({strfind(m.search_box:GetText(), '^([^;]*)')})[3])
if components then
m.set_form(components)
else
Aux.log(error)
aux.log(error)
end
end
function private.export_query_string()
local components, error = Aux.filter.parse_query_string(m.get_form())
local components, error = aux.filter.parse_query_string(m.get_form())
if components then
m.search_box:SetText(Aux.filter.query_string({blizzard=components.blizzard, post=m.post_components}))
m.search_box:SetText(aux.filter.query_string({blizzard=components.blizzard, post=m.post_components}))
m.filter_input:ClearFocus()
m.update_filter_display()
else
Aux.log(error)
aux.log(error)
end
end
@@ -870,20 +870,20 @@ function private.add_post_component()
local name = UIDropDownMenu_GetSelectedValue(m.filter_dropdown)
if name then
local filter = name
if not Aux.filter.filters[name] and filter == 'and' or filter == 'or' then
if not aux.filter.filters[name] and filter == 'and' or filter == 'or' then
local arity = m.filter_input:GetText()
arity = tonumber(arity) and Aux.util.round(tonumber(arity))
arity = tonumber(arity) and aux.util.round(tonumber(arity))
if arity and arity < 2 then
Aux.log('Invalid operator suffix')
aux.log('Invalid operator suffix')
return
end
filter = filter..(arity or '')
end
if Aux.filter.filters[name] and Aux.filter.filters[name].input_type ~= '' then
if aux.filter.filters[name] and aux.filter.filters[name].input_type ~= '' then
filter = filter..'/'..m.filter_input:GetText()
end
local components, error, suggestions = Aux.filter.parse_query_string(filter)
local components, error, suggestions = aux.filter.parse_query_string(filter)
if components then
tinsert(m.post_components, components.post[1])
@@ -891,7 +891,7 @@ function private.add_post_component()
m.filter_input:SetText('')
m.filter_input:ClearFocus()
else
Aux.log(error)
aux.log(error)
end
end
end
@@ -902,10 +902,10 @@ function private.remove_post_filter()
end
function private.update_filter_display()
local lines = Aux.util.size(Aux.util.filter(m.post_components, function(component) return component[1] == 'operator' and component[2] ~= 'not' end))
local lines = aux.util.size(aux.util.filter(m.post_components, function(component) return component[1] == 'operator' and component[2] ~= 'not' end))
local width_scale = max(200/m.filter_display:GetStringWidth())
local height_scale = min((200 / lines) / 18)
m.filter_display.scale_frame:SetScale(min(1, width_scale, height_scale))
m.filter_display:SetText(Aux.filter.indented_post_query_string(m.post_components))
m.filter_display:SetText(aux.filter.indented_post_query_string(m.post_components))
end
+73 -73
View File
@@ -1,29 +1,29 @@
Aux.search_tab.FRAMES(function(m, public, private)
aux.search_tab.FRAMES(function(m, public, private)
private.frame = CreateFrame('Frame', nil, AuxFrame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide()
m.frame.filter = Aux.gui.panel(m.frame)
m.frame.filter = aux.gui.panel(m.frame)
m.frame.filter:SetAllPoints(AuxFrameContent)
m.frame.results = Aux.gui.panel(m.frame)
m.frame.results = aux.gui.panel(m.frame)
m.frame.results:SetAllPoints(AuxFrameContent)
m.frame.saved = CreateFrame('Frame', nil, m.frame)
m.frame.saved:SetAllPoints(AuxFrameContent)
m.frame.saved.favorite = Aux.gui.panel(m.frame.saved)
m.frame.saved.favorite = aux.gui.panel(m.frame.saved)
m.frame.saved.favorite:SetWidth(378.5)
m.frame.saved.favorite:SetPoint('TOPLEFT', 0, 0)
m.frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0)
m.frame.saved.recent = Aux.gui.panel(m.frame.saved)
m.frame.saved.recent = aux.gui.panel(m.frame.saved)
m.frame.saved.recent:SetWidth(378.5)
m.frame.saved.recent:SetPoint('TOPRIGHT', 0, 0)
m.frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0)
do
local btn = Aux.gui.button(m.frame)
local btn = aux.gui.button(m.frame)
btn:SetPoint('TOPLEFT', 0, 0)
btn:SetWidth(42)
btn:SetHeight(42)
@@ -50,7 +50,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
do
local panel = CreateFrame('Frame', nil, m.frame)
panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]}
panel:SetBackdropColor(unpack(Aux.gui.config.content_color.backdrop))
panel:SetBackdropColor(unpack(aux.gui.config.content_color.backdrop))
panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 0)
panel:SetHeight(42)
@@ -65,7 +65,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.controls = panel
end
do
local editbox = Aux.gui.editbox(m.settings)
local editbox = aux.gui.editbox(m.settings)
editbox:SetPoint('LEFT', 75, 0)
editbox:SetWidth(50)
editbox:SetNumeric(true)
@@ -79,19 +79,19 @@ Aux.search_tab.FRAMES(function(m, public, private)
end)
editbox:SetScript('OnTextChanged', function()
if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then
this:SetBackdropColor(unpack(Aux.gui.config.on_color))
this:SetBackdropColor(unpack(aux.gui.config.on_color))
else
this:SetBackdropColor(unpack(Aux.gui.config.off_color))
this:SetBackdropColor(unpack(aux.gui.config.off_color))
end
end)
local label = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages')
label:SetTextColor(unpack(Aux.gui.config.text_color.enabled))
label:SetTextColor(unpack(aux.gui.config.text_color.enabled))
private.first_page_input = editbox
end
do
local editbox = Aux.gui.editbox(m.settings)
local editbox = aux.gui.editbox(m.settings)
editbox:SetPoint('LEFT', m.first_page_input, 'RIGHT', 10, 0)
editbox:SetWidth(50)
editbox:SetNumeric(true)
@@ -105,19 +105,19 @@ Aux.search_tab.FRAMES(function(m, public, private)
end)
editbox:SetScript('OnTextChanged', function()
if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then
this:SetBackdropColor(unpack(Aux.gui.config.on_color))
this:SetBackdropColor(unpack(aux.gui.config.on_color))
else
this:SetBackdropColor(unpack(Aux.gui.config.off_color))
this:SetBackdropColor(unpack(aux.gui.config.off_color))
end
end)
local label = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
label:SetText('-')
label:SetTextColor(unpack(Aux.gui.config.text_color.enabled))
label:SetTextColor(unpack(aux.gui.config.text_color.enabled))
private.last_page_input = editbox
end
do
local btn = Aux.gui.checkbutton(m.settings)
local btn = aux.gui.checkbutton(m.settings)
btn:SetPoint('LEFT', 230, 0)
btn:SetWidth(140)
btn:SetHeight(25)
@@ -132,7 +132,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
public.real_time_button = btn
end
do
local btn = Aux.gui.checkbutton(m.settings)
local btn = aux.gui.checkbutton(m.settings)
btn:SetPoint('LEFT', m.real_time_button, 'RIGHT', 15, 0)
btn:SetWidth(140)
btn:SetHeight(25)
@@ -147,7 +147,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.auto_buy_button = btn
end
do
local btn = Aux.gui.checkbutton(m.settings)
local btn = aux.gui.checkbutton(m.settings)
btn:SetPoint('LEFT', m.auto_buy_button, 'RIGHT', 15, 0)
btn:SetWidth(140)
btn:SetHeight(25)
@@ -175,7 +175,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.auto_buy_filter_button = btn
end
do
local btn = Aux.gui.button(m.controls, 25)
local btn = aux.gui.button(m.controls, 25)
btn:SetPoint('LEFT', 5, 0)
btn:SetWidth(30)
btn:SetHeight(25)
@@ -184,7 +184,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.previous_button = btn
end
do
local btn = Aux.gui.button(m.controls, 25)
local btn = aux.gui.button(m.controls, 25)
btn:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0)
btn:SetWidth(30)
btn:SetHeight(25)
@@ -193,7 +193,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.next_button = btn
end
do
local btn = Aux.gui.button(m.controls, Aux.gui.config.huge_font_size)
local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size)
btn:SetPoint('RIGHT', -5, 0)
btn:SetWidth(70)
btn:SetHeight(25)
@@ -208,19 +208,19 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.start_button = btn
end
do
local btn = Aux.gui.button(m.controls, Aux.gui.config.huge_font_size)
local btn = aux.gui.button(m.controls, aux.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(m.search_scan_id)
aux.scan.abort(m.search_scan_id)
end)
btn:Hide()
private.stop_button = btn
end
do
local btn = Aux.gui.button(m.controls, Aux.gui.config.huge_font_size)
local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size)
btn:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
btn:SetWidth(70)
btn:SetHeight(25)
@@ -231,10 +231,10 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.resume_button = btn
end
do
local editbox = Aux.gui.editbox(m.controls)
local editbox = aux.gui.editbox(m.controls)
editbox:SetMaxLetters(nil)
editbox:EnableMouse(1)
editbox.complete = Aux.completion.complete_filter
editbox.complete = aux.completion.complete_filter
editbox:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
editbox:SetHeight(25)
editbox:SetScript('OnChar', function()
@@ -245,7 +245,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
end)
editbox:SetScript('OnEnterPressed', m.execute)
editbox:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item() and Aux.info.item(Aux.cursor_item().item_id)
local item_info = aux.cursor_item() and aux.info.item(aux.cursor_item().item_id)
if item_info then
m.set_filter(strlower(item_info.name)..'/exact')
m.execute(nil, false)
@@ -255,10 +255,10 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.search_box = editbox
end
do
Aux.gui.horizontal_line(m.frame, -40)
aux.gui.horizontal_line(m.frame, -40)
end
do
local btn = Aux.gui.button(m.frame, Aux.gui.config.large_font_size)
local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size)
btn:SetPoint('BOTTOMLEFT', AuxFrameContent, 'TOPLEFT', 10, 8)
btn:SetWidth(243)
btn:SetHeight(22)
@@ -267,7 +267,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.search_results_button = btn
end
do
local btn = Aux.gui.button(m.frame, Aux.gui.config.large_font_size)
local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size)
btn:SetPoint('TOPLEFT', m.search_results_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243)
btn:SetHeight(22)
@@ -276,7 +276,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.saved_searches_button = btn
end
do
local btn = Aux.gui.button(m.frame, Aux.gui.config.large_font_size)
local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size)
btn:SetPoint('TOPLEFT', m.saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243)
btn:SetHeight(22)
@@ -292,7 +292,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.status_bar_frame = frame
end
do
local btn = Aux.gui.button(m.frame.results, 16)
local btn = aux.gui.button(m.frame.results, 16)
btn:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -301,7 +301,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.bid_button = btn
end
do
local btn = Aux.gui.button(m.frame.results, 16)
local btn = aux.gui.button(m.frame.results, 16)
btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -310,7 +310,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.buyout_button = btn
end
do
local btn = Aux.gui.button(m.frame.results, 16)
local btn = aux.gui.button(m.frame.results, 16)
btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
@@ -321,24 +321,24 @@ Aux.search_tab.FRAMES(function(m, public, private)
end)
end
do
local btn = Aux.gui.button(m.frame.saved, 16)
local btn = aux.gui.button(m.frame.saved, 16)
btn:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Favorite')
btn:SetScript('OnClick', function()
local filters = Aux.filter.queries(m.search_box:GetText())
local filters = aux.filter.queries(m.search_box:GetText())
if filters then
tinsert(aux_favorite_searches, 1, {
filter_string = m.search_box:GetText(),
prettified = Aux.util.join(Aux.util.map(filters, function(filter) return filter.prettified end), ';'),
prettified = aux.util.join(aux.util.map(filters, function(filter) return filter.prettified end), ';'),
})
end
m.update_search_listings()
end)
end
do
local btn1 = Aux.gui.button(m.frame.filter, 16)
local btn1 = aux.gui.button(m.frame.filter, 16)
btn1:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0)
btn1:SetWidth(80)
btn1:SetHeight(24)
@@ -348,14 +348,14 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.execute()
end)
local btn2 = Aux.gui.button(m.frame.filter, 16)
local btn2 = aux.gui.button(m.frame.filter, 16)
btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0)
btn2:SetWidth(80)
btn2:SetHeight(24)
btn2:SetText('Export')
btn2:SetScript('OnClick', m.export_query_string)
local btn3 = Aux.gui.button(m.frame.filter, 16)
local btn3 = aux.gui.button(m.frame.filter, 16)
btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0)
btn3:SetWidth(80)
btn3:SetHeight(24)
@@ -363,8 +363,8 @@ Aux.search_tab.FRAMES(function(m, public, private)
btn3:SetScript('OnClick', m.import_query_string)
end
do
local editbox = Aux.gui.editbox(m.frame.filter)
editbox.complete_item = Aux.completion.complete(function() return aux_auctionable_items end)
local editbox = aux.gui.editbox(m.frame.filter)
editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -26)
editbox:SetWidth(260)
editbox:SetScript('OnChar', function()
@@ -379,8 +379,8 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.min_level_input:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
editbox:SetScript('OnEnterPressed', aux.f(editbox.ClearFocus, editbox))
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name')
private.name_input = editbox
@@ -390,13 +390,13 @@ Aux.search_tab.FRAMES(function(m, public, private)
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', m.name_input, 'TOPRIGHT', 10, 0)
local label = Aux.gui.label(checkbox, Aux.gui.config.small_font_size)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', 1, -3)
label:SetText('Exact')
private.exact_checkbox = checkbox
end
do
local editbox = Aux.gui.editbox(m.frame.filter)
local editbox = aux.gui.editbox(m.frame.filter)
editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -28)
editbox:SetWidth(125)
editbox:SetNumeric(true)
@@ -408,14 +408,14 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.max_level_input:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
editbox:SetScript('OnEnterPressed', aux.f(editbox.ClearFocus, editbox))
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Level Range')
private.min_level_input = editbox
end
do
local editbox = Aux.gui.editbox(m.frame.filter)
local editbox = aux.gui.editbox(m.frame.filter)
editbox:SetPoint('TOPLEFT', m.min_level_input, 'TOPRIGHT', 10, 0)
editbox:SetWidth(125)
editbox:SetNumeric(true)
@@ -427,8 +427,8 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.name_input:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
local label = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
editbox:SetScript('OnEnterPressed', aux.f(editbox.ClearFocus, editbox))
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText('-')
private.max_level_input = editbox
@@ -438,17 +438,17 @@ Aux.search_tab.FRAMES(function(m, public, private)
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', m.max_level_input, 'TOPRIGHT', 10, 0)
local label = Aux.gui.label(checkbox, Aux.gui.config.small_font_size)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', 1, -3)
label:SetText('Usable')
private.usable_checkbox = checkbox
end
do
local dropdown = Aux.gui.dropdown(m.frame.filter)
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -26)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Class')
UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown)
@@ -458,11 +458,11 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.class_dropdown = dropdown
end
do
local dropdown = Aux.gui.dropdown(m.frame.filter)
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -22)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Subclass')
UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown)
@@ -472,11 +472,11 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.subclass_dropdown = dropdown
end
do
local dropdown = Aux.gui.dropdown(m.frame.filter)
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -22)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Slot')
UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown)
@@ -486,11 +486,11 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.slot_dropdown = dropdown
end
do
local dropdown = Aux.gui.dropdown(m.frame.filter)
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -22)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Min Rarity')
UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown)
@@ -499,9 +499,9 @@ Aux.search_tab.FRAMES(function(m, public, private)
end)
private.quality_dropdown = dropdown
end
Aux.gui.vertical_line(m.frame.filter, 332)
aux.gui.vertical_line(m.frame.filter, 332)
do
local dropdown = Aux.gui.dropdown(m.frame.filter)
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPRIGHT', -177, -10)
dropdown:SetWidth(150)
dropdown:SetHeight(10)
@@ -510,13 +510,13 @@ Aux.search_tab.FRAMES(function(m, public, private)
UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown)
end)
getglobal(dropdown:GetName()..'Text'):Hide()
local label = Aux.gui.label(dropdown, Aux.gui.config.medium_font_size)
local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size)
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
label:SetText('Post Filter')
private.filter_dropdown = dropdown
end
do
local btn = Aux.gui.button(m.frame.filter, 16)
local btn = aux.gui.button(m.frame.filter, 16)
btn:SetWidth(150)
btn:SetHeight(25)
btn:SetPoint('CENTER', m.filter_dropdown, 'CENTER', 0, 0)
@@ -531,7 +531,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.filter_button = btn
end
do
local input = Aux.gui.editbox(m.frame.filter)
local input = aux.gui.editbox(m.frame.filter)
input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0)
input:SetWidth(150)
input:SetHeight(25)
@@ -547,10 +547,10 @@ Aux.search_tab.FRAMES(function(m, public, private)
frame:SetWidth(395)
frame:SetHeight(270)
frame:SetPoint('TOPLEFT', 348, -50)
Aux.gui.set_content_style(frame)
aux.gui.set_content_style(frame)
local scale_frame = CreateFrame('Frame', nil, frame)
scale_frame:SetAllPoints()
local display = Aux.gui.label(scale_frame, Aux.gui.config.large_font_size)
local display = aux.gui.label(scale_frame, aux.gui.config.large_font_size)
display:SetAllPoints()
display:SetJustifyH('LEFT')
display:SetJustifyV('TOP')
@@ -561,12 +561,12 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.status_bars = {}
private.tables = {}
for _=1,5 do
local status_bar = Aux.gui.status_bar(m.frame)
local status_bar = aux.gui.status_bar(m.frame)
status_bar:SetAllPoints(m.status_bar_frame)
status_bar:Hide()
tinsert(m.status_bars, status_bar)
local table = Aux.auction_listing.CreateAuctionResultsTable(m.frame.results, Aux.auction_listing.search_config)
local table = aux.auction_listing.CreateAuctionResultsTable(m.frame.results, aux.auction_listing.search_config)
table:SetHandler('OnCellClick', function(cell, button)
if IsAltKeyDown() and m.current_search().table:GetSelection().record == cell.row.data.record then
if button == 'LeftButton' and m.buyout_button:IsEnabled() then
@@ -629,7 +629,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
end
}
private.recent_searches_listing = Aux.listing.CreateScrollingTable(m.frame.saved.recent)
private.recent_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.recent)
m.recent_searches_listing:SetColInfo({{name='Recent Searches', width=1}})
m.recent_searches_listing:EnableSorting(false)
m.recent_searches_listing:DisableSelection(true)
@@ -637,7 +637,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
private.favorite_searches_listing = Aux.listing.CreateScrollingTable(m.frame.saved.favorite)
private.favorite_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.favorite)
m.favorite_searches_listing:SetColInfo({{name='Favorite Searches', width=1}})
m.favorite_searches_listing:EnableSorting(false)
m.favorite_searches_listing:DisableSelection(true)
+4 -4
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'completion'
local m, public, private = aux.module'completion'
function public:complete_filter()
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
@@ -8,12 +8,12 @@ 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 = aux.filter.query(completed_filter_string or '')
local start_index, _, current_modifier = strfind(filter_string, '([^/;]*)$')
current_modifier = current_modifier or ''
for _, suggestion in ipairs(suggestions) do
for _, suggestion in suggestions do
if strsub(strupper(suggestion), 1, strlen(current_modifier)) == strupper(current_modifier) then
this:SetText(strlower(strsub(filter_string, 1, start_index - 1).. suggestion))
this:HighlightText(strlen(filter_string), -1)
@@ -30,7 +30,7 @@ function public.complete(options)
local text = self:GetText()
for _, item_name in ipairs(options()) do
for _, item_name in options() do
if strsub(strupper(item_name), 1, strlen(text)) == strupper(text) then
self:SetText(strlower(item_name))
self:HighlightText(strlen(text), -1)
+11 -14
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'util'
local m, public, private = aux.module'util'
function public.pass()
end
@@ -141,13 +141,11 @@ do
end
end
function public.join(array, separator)
local str = ''
for i, element in ipairs(array) do
if i > 1 then
str = str..separator
end
str = str..element
function public.join(parts, separator)
local str = parts[1]
for i=2,getn(parts) do
if not parts[i] then break end
str = str..separator..parts[i]
end
return str
end
@@ -226,11 +224,10 @@ function public.bag_type(bag)
return 1
end
local link = GetInventoryItemLink('player', ContainerIDToInventoryID(bag))
if link then
local item_id = Aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag)))
local item_info = Aux.info.item(item_id)
return Aux.info.item_subclass_index(3, item_info.subclass)
if GetInventoryItemLink('player', ContainerIDToInventoryID(bag)) then
local item_id = aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag)))
local item_info = aux.info.item(item_id)
return aux.info.item_subclass_index(3, item_info.subclass)
end
end
@@ -264,7 +261,7 @@ function public.format_money(money, exact, color)
-- Round to nearest silver
money = floor(money / 100 + 0.5) * 100
end
local g, s, c = Aux.money.to_GSC(money)
local g, s, c = aux.money.to_GSC(money)
local gsc = ''
+47 -47
View File
@@ -1,11 +1,11 @@
local m, public, private = Aux.module'filter'
local m, public, private = aux.module'filter'
function private.default_filter(str)
return {
input_type = '',
validator = function()
return function(auction_record)
return Aux.util.any(auction_record.tooltip, function(entry)
return aux.util.any(auction_record.tooltip, function(entry)
return strfind(strupper(entry.left_text or ''), strupper(str or ''), 1, true) or strfind(strupper(entry.right_text or ''), strupper(str or ''), 1, true)
end)
end
@@ -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 aux.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(aux.info.item(auction_record.item_id).name) == name
end
end
},
@@ -43,7 +43,7 @@ public.filters = {
['left'] = {
input_type = {'30m', '2h', '8h', '24h'},
validator = function(duration)
local code = Aux.util.key(duration, {'30m', '2h', '8h', '24h'})
local code = aux.util.key(duration, {'30m', '2h', '8h', '24h'})
return function(auction_record)
return auction_record.duration == code
end
@@ -53,7 +53,7 @@ public.filters = {
['rarity'] = {
input_type = {'poor', 'common', 'uncommon', 'rare', 'epic'},
validator = function(rarity)
local code = Aux.util.key(rarity, {'poor', 'common', 'uncommon', 'rare', 'epic'}) - 1
local code = aux.util.key(rarity, {'poor', 'common', 'uncommon', 'rare', 'epic'}) - 1
return function(auction_record)
return auction_record.quality == code
end
@@ -119,8 +119,8 @@ public.filters = {
validator = function(pct)
return function(auction_record)
return auction_record.unit_buyout_price > 0
and Aux.history.value(auction_record.item_key)
and auction_record.unit_buyout_price / Aux.history.value(auction_record.item_key) * 100 <= pct
and aux.history.value(auction_record.item_key)
and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
end
end
},
@@ -130,8 +130,8 @@ public.filters = {
validator = function(pct)
return function(auction_record)
return auction_record.unit_buyout_price > 0
and Aux.history.value(auction_record.item_key)
and auction_record.unit_buyout_price / Aux.history.value(auction_record.item_key) * 100 <= pct
and aux.history.value(auction_record.item_key)
and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
end
end
},
@@ -140,7 +140,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
return Aux.history.value(auction_record.item_key) and Aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
return aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
end
end
},
@@ -149,7 +149,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
return auction_record.buyout_price > 0 and Aux.history.value(auction_record.item_key) and Aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
return auction_record.buyout_price > 0 and aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
end
end
},
@@ -158,7 +158,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
local disenchant_value = Aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
return disenchant_value and disenchant_value - auction_record.bid_price >= amount
end
end
@@ -168,7 +168,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
local disenchant_value = Aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
end
end
@@ -178,7 +178,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
local vendor_price = Aux.cache.merchant_info(auction_record.item_id)
local vendor_price = aux.cache.merchant_info(auction_record.item_id)
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
end
end
@@ -188,7 +188,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
local vendor_price = Aux.cache.merchant_info(auction_record.item_id)
local vendor_price = aux.cache.merchant_info(auction_record.item_id)
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
end
end
@@ -240,27 +240,27 @@ function private.blizzard_filter_parser()
else
return nil, 'Erroneous level range modifier'
end
elseif Aux.info.item_class_index(str) and not (filters.class and not filters.subclass and str == strlower(({ GetAuctionItemClasses() })[10])) then
class_index = Aux.info.item_class_index(str)
elseif aux.info.item_class_index(str) and not (filters.class and not filters.subclass and str == strlower(({ GetAuctionItemClasses() })[10])) then
class_index = aux.info.item_class_index(str)
if not filters.class then
filter = {'class', str}
else
return nil, 'Erroneous item class modifier'
end
elseif class_index and Aux.info.item_subclass_index(class_index, str) then
subclass_index = Aux.info.item_subclass_index(class_index, str)
elseif class_index and aux.info.item_subclass_index(class_index, str) then
subclass_index = aux.info.item_subclass_index(class_index, str)
if not filters.subclass then
filter = {'subclass', str}
else
return nil, 'Erroneous item subclass modifier'
end
elseif subclass_index and Aux.info.item_slot_index(class_index, subclass_index, str) then
elseif subclass_index and aux.info.item_slot_index(class_index, subclass_index, str) then
if not filters.slot then
filter = {'slot', str}
else
return nil, 'Erroneous item slot modifier'
end
elseif Aux.info.item_quality_index(str) then
elseif aux.info.item_quality_index(str) then
if not filters.quality then
filter = {'quality', str}
else
@@ -310,7 +310,7 @@ end
function private.parse_parameter(input_type, str)
if input_type == 'money' then
local money = Aux.money.from_string(str)
local money = aux.money.from_string(str)
if money and money > 0 then
return money
end
@@ -324,7 +324,7 @@ function private.parse_parameter(input_type, str)
return str
end
elseif type(input_type) == 'table' then
local choice = Aux.util.key(str, input_type)
local choice = aux.util.key(str, input_type)
if choice then
return choice
end
@@ -334,7 +334,7 @@ end
function public.parse_query_string(str)
local components = { blizzard = {}, post = {} }
local blizzard_filter_parser = m.blizzard_filter_parser()
local parts = Aux.util.map(Aux.util.split(str, '/'), function(part) return strlower(Aux.util.trim(part)) end)
local parts = aux.util.map(aux.util.split(str, '/'), function(part) return strlower(aux.util.trim(part)) end)
local i = 1
while parts[i] do
@@ -412,16 +412,16 @@ function public.query(query_string)
end
function public.queries(query_string)
local parts = Aux.util.split(query_string, ';')
local parts = aux.util.split(query_string, ';')
local queries = {}
for _, str in ipairs(parts) do
str = Aux.util.trim(str)
str = aux.util.trim(str)
local query, _, error = m.query(str)
if not query then
Aux.log('Invalid filter:', error)
aux.log('Invalid filter:', error)
return
else
tinsert(queries, query)
@@ -469,7 +469,7 @@ function private.suggestions(components)
end
-- subclasses
local class_index = blizzard_filters.class and Aux.info.item_class_index(blizzard_filters.class)
local class_index = blizzard_filters.class and aux.info.item_class_index(blizzard_filters.class)
if class_index and not blizzard_filters.subclass then
for _, subclass in ipairs({ GetAuctionItemSubClasses(class_index) }) do
tinsert(suggestions, subclass)
@@ -477,9 +477,9 @@ function private.suggestions(components)
end
-- slots
local subclass_index = class_index and blizzard_filters.subclass and Aux.info.item_subclass_index(class_index, blizzard_filters.subclass)
local subclass_index = class_index and blizzard_filters.subclass and aux.info.item_subclass_index(class_index, blizzard_filters.subclass)
if subclass_index and not blizzard_filters.slot then
for _, invtype in ipairs({ GetAuctionInvTypes(class_index, Aux.info.item_subclass_index(class_index, blizzard_filters.subclass)) }) do
for _, invtype in ipairs({ GetAuctionInvTypes(class_index, aux.info.item_subclass_index(class_index, blizzard_filters.subclass)) }) do
tinsert(suggestions, getglobal(invtype))
end
end
@@ -572,9 +572,9 @@ function private.prettified_query_string(components)
for _, filter in components.blizzard do
blizzard_filters[filter[1]] = filter[2] or true
if filter[1] == 'exact' then
prettified.prepend(Aux.info.display_name(Aux.cache.item_id(m.unquote(blizzard_filters.name))) or Aux.gui.inline_color({216, 225, 211, 1})..'['..m.unquote(blizzard_filters.name)..']|r')
prettified.prepend(aux.info.display_name(aux.cache.item_id(m.unquote(blizzard_filters.name))) or aux.gui.inline_color({216, 225, 211, 1})..'['..m.unquote(blizzard_filters.name)..']|r')
elseif filter[1] ~= 'name' then
prettified.append(Aux.gui.inline_color({216, 225, 211, 1})..(filter[2] or filter[1])..'|r')
prettified.append(aux.gui.inline_color({216, 225, 211, 1})..(filter[2] or filter[1])..'|r')
end
end
@@ -582,7 +582,7 @@ function private.prettified_query_string(components)
if m.unquote(blizzard_filters.name) == '' then
prettified.prepend('|cffff0000'..'No Filter'..'|r')
else
prettified.prepend(Aux.gui.inline_color({216, 225, 211, 1})..m.unquote(blizzard_filters.name)..'|r')
prettified.prepend(aux.gui.inline_color({216, 225, 211, 1})..m.unquote(blizzard_filters.name)..'|r')
end
end
@@ -623,11 +623,11 @@ function private.blizzard_query(components)
local item_info, class_index, subclass_index, slot_index
if filters.exact then
local item_id = Aux.cache.item_id(filters.name)
item_info = Aux.info.item(item_id)
class_index = item_info and Aux.info.item_class_index(item_info.class)
subclass_index = class_index and item_info.subclass and Aux.info.item_subclass_index(class_index, item_info.subclass)
slot_index = subclass_index and item_info.slot and Aux.info.item_slot_index(class_index, subclass_index, item_info.slot)
local item_id = aux.cache.item_id(filters.name)
item_info = aux.info.item(item_id)
class_index = item_info and aux.info.item_class_index(item_info.class)
subclass_index = class_index and item_info.subclass and aux.info.item_subclass_index(class_index, item_info.subclass)
slot_index = subclass_index and item_info.slot and aux.info.item_slot_index(class_index, subclass_index, item_info.slot)
end
if item_info then
@@ -641,11 +641,11 @@ function private.blizzard_query(components)
else
query.min_level = tonumber(filters.min_level)
query.max_level = tonumber(filters.max_level)
query.class = filters.class and filters.class and Aux.info.item_class_index(filters.class)
query.subclass = query.class and filters.subclass and Aux.info.item_subclass_index(query.class, filters.subclass)
query.slot = query.subclass and filters.slot and Aux.info.item_slot_index(query.class, query.subclass, filters.slot)
query.class = filters.class and filters.class and aux.info.item_class_index(filters.class)
query.subclass = query.class and filters.subclass and aux.info.item_subclass_index(query.class, filters.subclass)
query.slot = query.subclass and filters.slot and aux.info.item_slot_index(query.class, query.subclass, filters.slot)
query.usable = filters.usable and 1
query.quality = filters.quality and Aux.info.item_quality_index(filters.quality)
query.quality = filters.quality and aux.info.item_quality_index(filters.quality)
end
return query
@@ -662,7 +662,7 @@ function private.validator(components)
return function(record)
for _, filter in components.blizzard do
if filter[1] == 'exact' and strlower(Aux.info.item(record.item_id).name) ~= components.blizzard[1][2] then
if filter[1] == 'exact' and strlower(aux.info.item(record.item_id).name) ~= components.blizzard[1][2] then
return false
end
end
@@ -678,15 +678,15 @@ function private.validator(components)
if name == 'not' then
tinsert(stack, not args[1])
elseif name == 'and' then
tinsert(stack, Aux.util.all(args, Aux.util.id))
tinsert(stack, aux.util.all(args, aux.util.id))
elseif name == 'or' then
tinsert(stack, Aux.util.any(args, Aux.util.id))
tinsert(stack, aux.util.any(args, aux.util.id))
end
elseif type == 'filter' then
tinsert(stack, validators[i](record) and true or false)
end
end
return Aux.util.all(stack, Aux.util.id)
return aux.util.all(stack, aux.util.id)
end
end
+8 -8
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'info'
local m, public, private = aux.module'info'
local TOOLTIP_LENGTH = 30
@@ -133,8 +133,8 @@ function public.auction(index, query_type)
hyperlink = hyperlink,
itemstring = item_info.itemstring,
item_key = item_id..':'..suffix_id,
search_signature = Aux.util.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), aux_ignore_owner and (Aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
sniping_signature = Aux.util.join({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (Aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
search_signature = aux.util.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), aux_ignore_owner and (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
sniping_signature = aux.util.join({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
name = name,
texture = texture,
@@ -172,12 +172,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 = aux.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 = Aux.util.join({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (Aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
auction_record.search_signature = aux.util.join({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
end
function public.set_tooltip(itemstring, owner, anchor)
@@ -222,7 +222,7 @@ function public.set_shopping_tooltip(slot)
end
function public.tooltip_match(entry, tooltip)
return Aux.util.any(tooltip, function(line)
return aux.util.any(tooltip, function(line)
local left_match = line.left_text and strupper(line.left_text) == strupper(entry)
local right_match = line.right_text and strupper(line.right_text) == strupper(entry)
return left_match or right_match
@@ -258,7 +258,7 @@ function public.load_tooltip(frame, tooltip)
end
function public.display_name(item_id, no_brackets, no_color)
local item_info = Aux.info.item(item_id)
local item_info = aux.info.item(item_id)
if item_info then
local name = item_info.name
if not no_brackets then
@@ -389,7 +389,7 @@ function public.item(item_id, suffix_id)
slot = slot,
max_stack = max_stack,
texture = texture,
} or Aux.cache.item_info(item_id)
} or aux.cache.item_info(item_id)
end
function public.item_class_index(item_class)
+2 -2
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'money'
local m, public, private = aux.module'money'
local GOLD_TEXT = '|cffffd70ag|r'
local SILVER_TEXT = '|cffc7c7cfs|r'
@@ -50,7 +50,7 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color)
if copper > 0 or gold == 0 and silver == 0 then
tinsert(parts, m.format_number(copper, pad, decimal_points, color)..copper_text)
end
text = Aux.util.join(parts, ' ')
text = aux.util.join(parts, ' ')
else
if gold > 0 then
text = m.format_number(gold, false, nil, color)..gold_text..' '..m.format_number(silver, pad, nil, color)..silver_text..' '..m.format_number(copper, pad, decimal_points, color)..copper_text
+9 -8
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'persistence'
local m, public, private = aux.module'persistence'
aux_datasets = {}
@@ -6,7 +6,7 @@ do
local realm, faction
function public.LOAD()
Aux.control.as_soon_as(function() faction = UnitFactionGroup('player') return faction end, Aux.util.pass)
aux.control.as_soon_as(function() faction = UnitFactionGroup('player') return faction end, aux.util.pass)
realm = GetCVar('realmName')
end
@@ -60,8 +60,8 @@ function public.read_list(schema, str)
local separator = schema[2]
local element_type = schema[3]
local parts = Aux.util.split(str, separator)
return Aux.util.map(parts, function(part)
local parts = aux.util.split(str, separator)
return aux.util.map(parts, function(part)
return m.read(element_type, part)
end)
end
@@ -69,16 +69,16 @@ end
function public.write_list(schema, list)
local separator = schema[2]
local element_type = schema[3]
local parts = Aux.util.map(list, function(element)
local parts = aux.util.map(list, function(element)
return m.write(element_type, element)
end)
return Aux.util.join(parts, separator)
return aux.util.join(parts, separator)
end
function public.read_record(schema, str)
local separator = schema[2]
local record = {}
local parts = Aux.util.split(str, separator)
local parts = aux.util.split(str, separator)
for i=3,getn(schema) do
local key, type = next(schema[i])
record[key] = m.read(type, parts[i - 2])
@@ -91,9 +91,10 @@ function public.write_record(schema, record)
local parts = {}
for i=3,getn(schema) do
local key, type = next(schema[i])
aux.log(type, record[key], m.write(type, record[key]))
tinsert(parts, m.write(type, record[key]))
end
return Aux.util.join(parts, separator)
return aux.util.join(parts, separator)
end
function public.serialize(data, separator, compactor)
+8 -8
View File
@@ -1,9 +1,9 @@
local m, public, private = Aux.module'scan_util'
local m, public, private = 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 = aux.info.auction(index, auction_record.query_type)
return auction_info and auction_info.search_signature == auction_record.search_signature
end
@@ -12,7 +12,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
if auction_record.blizzard_query then
local blizzard_query1 = Aux.util.copy(auction_record.blizzard_query)
local blizzard_query1 = aux.util.copy(auction_record.blizzard_query)
blizzard_query1.first_page = auction_record.page
blizzard_query1.last_page = auction_record.page
tinsert(queries, {
@@ -20,7 +20,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
})
if auction_record.page > 0 then
local blizzard_query2 = Aux.util.copy(auction_record.blizzard_query)
local blizzard_query2 = aux.util.copy(auction_record.blizzard_query)
blizzard_query2.first_page = auction_record.page - 1
blizzard_query2.last_page = auction_record.page - 1
tinsert(queries, {
@@ -29,14 +29,14 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
end
local item_query = m.item_query(auction_record.item_id, 1, 1)
if not Aux.util.eq(auction_record.blizzard_query, item_query.blizzard_query) then
if not aux.util.eq(auction_record.blizzard_query, item_query.blizzard_query) then
tinsert(queries, item_query)
end
end
local found
return Aux.scan.start{
return aux.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 = aux.info.item(item_id)
if item_info then
local query = Aux.filter.query(item_info.name..'/exact')
local query = aux.filter.query(item_info.name..'/exact')
query.blizzard_query.first_page = first_page
query.blizzard_query.last_page = last_page
return {
+1 -1
View File
@@ -1,4 +1,4 @@
local m, public, private = Aux.module'sort'
local m, public, private = aux.module'sort'
public.LT = {}
public.EQ = {}