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 ## 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 ## 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 ## 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. 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. 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. 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. 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. 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 ## 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. 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. 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. 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 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'}} 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() function public.LOAD()
m.scan_wdb() m.scan_wdb()
Aux.control.event_listener('MERCHANT_SHOW', m.on_merchant_show) 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_CLOSED', m.on_merchant_closed)
Aux.control.event_listener('MERCHANT_UPDATE', m.on_merchant_update) aux.control.event_listener('MERCHANT_UPDATE', m.on_merchant_update)
Aux.control.event_listener('BAG_UPDATE', m.on_bag_update) aux.control.event_listener('BAG_UPDATE', m.on_bag_update)
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update) CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update)
Aux.control.event_listener('NEW_AUCTION_UPDATE', function() aux.control.event_listener('NEW_AUCTION_UPDATE', function()
local info = Aux.info.auction_sell_item() local info = aux.info.auction_sell_item()
if info then 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 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 end
end) end)
@@ -79,7 +79,7 @@ end
function public.merchant_info(item_id) function public.merchant_info(item_id)
local buy_info local buy_info
if aux_merchant_buy[item_id] then 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 end
return aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited 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) function public.item_info(item_id)
local data_string = aux_items[item_id] local data_string = aux_items[item_id]
if data_string then 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 { return {
name = cached_data.name, name = cached_data.name,
itemstring = 'item:'..item_id..':0:0:0', itemstring = 'item:'..item_id..':0:0:0',
@@ -114,10 +114,10 @@ function private.merchant_buy_scan()
local _, _, price, count, stock = GetMerchantItemInfo(i) local _, _, price, count, stock = GetMerchantItemInfo(i)
local link = GetMerchantItemLink(i) local link = GetMerchantItemLink(i)
if link then 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 local new_unit_price, new_limited = price / count, stock >= 0
if aux_merchant_buy[item_id] then 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 local unit_price
if buy_info.limited and not new_limited then 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) unit_price = min(buy_info.unit_price, new_unit_price)
end 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, unit_price = unit_price,
limited = buy_info.limited and new_limited, limited = buy_info.limited and new_limited,
}) })
else 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, unit_price = new_unit_price,
limited = new_limited, limited = new_limited,
}) })
@@ -147,8 +147,8 @@ function private.merchant_buy_scan()
end end
function private.merchant_sell_scan() function private.merchant_sell_scan()
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 if item_info then
aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
end end
@@ -164,7 +164,7 @@ function private.scan_wdb(item_id)
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring) local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
if name and not aux_item_ids[strlower(name)] then if name and not aux_item_ids[strlower(name)] then
aux_item_ids[strlower(name)] = item_id 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, name = name,
quality = quality, quality = quality,
level = level, level = level,
@@ -174,8 +174,8 @@ function private.scan_wdb(item_id)
max_stack = max_stack, max_stack = max_stack,
texture = texture, texture = texture,
}) })
local tooltip = Aux.info.tooltip(function(tt) tt:SetHyperlink(itemstring) end) local tooltip = aux.info.tooltip(function(tt) tt:SetHyperlink(itemstring) end)
if Aux.info.auctionable(tooltip, quality) then if aux.info.auctionable(tooltip, quality) then
tinsert(aux_auctionable_items, strlower(name)) tinsert(aux_auctionable_items, strlower(name))
end end
processed = processed + 1 processed = processed + 1
@@ -185,7 +185,7 @@ function private.scan_wdb(item_id)
if item_id <= MAX_ITEM_ID then if item_id <= MAX_ITEM_ID then
local t0 = GetTime() 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 else
sort(aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end) sort(aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
end end
@@ -195,14 +195,14 @@ function public.populate_wdb(item_id)
item_id = item_id or MIN_ITEM_ID item_id = item_id or MIN_ITEM_ID
if item_id > MAX_ITEM_ID then if item_id > MAX_ITEM_ID then
Aux.log('Cache populated.') aux.log('Cache populated.')
return return
end end
if not GetItemInfo('item:'..item_id) then if not GetItemInfo('item:'..item_id) then
Aux.log('Fetching item '..item_id..'.') aux.log('Fetching item '..item_id..'.')
AuxTooltip:SetHyperlink('item:'..item_id) AuxTooltip:SetHyperlink('item:'..item_id)
end end
Aux.control.thread(m.populate_wdb, item_id + 1) aux.control.thread(m.populate_wdb, item_id + 1)
end 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.UNCOMMON = 2
private.RARE = 3 private.RARE = 3
@@ -41,7 +41,7 @@ do
end end
function public.LOAD() function public.LOAD()
private.armor = Aux.util.set( private.armor = aux.util.set(
'INVTYPE_HEAD', 'INVTYPE_HEAD',
'INVTYPE_NECK', 'INVTYPE_NECK',
'INVTYPE_SHOULDER', 'INVTYPE_SHOULDER',
@@ -59,7 +59,7 @@ function public.LOAD()
'INVTYPE_HOLDABLE' 'INVTYPE_HOLDABLE'
) )
private.weapon = Aux.util.set( private.weapon = aux.util.set(
'INVTYPE_2HWEAPON' , 'INVTYPE_2HWEAPON' ,
'INVTYPE_WEAPONMAINHAND', 'INVTYPE_WEAPONMAINHAND',
'INVTYPE_WEAPON', 'INVTYPE_WEAPON',
@@ -73,7 +73,7 @@ end
function public.value(slot, quality, level) function public.value(slot, quality, level)
local expectation local expectation
for _, event in m.distribution(slot, quality, level) do 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 if not value then
return return
else 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'}}}}} 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 = {} private.value_cache = {}
@@ -14,7 +14,7 @@ function private.new_record()
end end
function private.load_data() function private.load_data()
local dataset = Aux.persistence.load_dataset() local dataset = aux.persistence.load_dataset()
dataset.history = dataset.history or {} dataset.history = dataset.history or {}
return dataset.history return dataset.history
end end
@@ -24,7 +24,7 @@ function private.read_record(item_key)
local record local record
if data[item_key] then if data[item_key] then
record = Aux.persistence.read(history_schema, data[item_key]) record = aux.persistence.read(history_schema, data[item_key])
else else
record = m.new_record() record = m.new_record()
end end
@@ -40,7 +40,7 @@ end
function private.write_record(item_key, record) function private.write_record(item_key, record)
m.value_cache[item_key] = nil m.value_cache[item_key] = nil
local data = m.load_data() local data = m.load_data()
data[item_key] = Aux.persistence.write(history_schema, record) data[item_key] = aux.persistence.write(history_schema, record)
end end
function public.process_auction(auction_record) function public.process_auction(auction_record)
@@ -72,7 +72,7 @@ function public.value(item_key)
local weighted_values = {} local weighted_values = {}
local total_weight = 0 local total_weight = 0
for _, data_point in item_record.data_points do 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 total_weight = total_weight + weight
tinsert(weighted_values, {value = data_point.market_value, weight = weight}) tinsert(weighted_values, {value = data_point.market_value, weight = weight})
end 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 private.state = nil
@@ -7,7 +7,7 @@ function private.process()
local stacking_complete local stacking_complete
local c = Aux.control.await(function(slot) local c = aux.control.await(function(slot)
if slot then if slot then
return m.post_auction(slot, m.process) return m.post_auction(slot, m.process)
else else
@@ -15,15 +15,15 @@ function private.process()
end end
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 end
return m.stop() return m.stop()
end end
function private.post_auction(slot, k) function private.post_auction(slot, k)
local item_info = Aux.info.container_item(unpack(slot)) 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 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() ClearCursor()
ClickAuctionSellItemButton() ClickAuctionSellItemButton()
@@ -32,15 +32,15 @@ function private.post_auction(slot, k)
ClickAuctionSellItemButton() ClickAuctionSellItemButton()
ClearCursor() 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 m.state.posted = m.state.posted + 1
return k() return k()
end) end)
local posted 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 if arg1 == ERR_AUCTION_STARTED then
c() c()
kill() kill()
@@ -53,7 +53,7 @@ end
function public.stop() function public.stop()
if m.state then 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 callback = m.state.callback
local posted = m.state.posted 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) function public.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, callback)
m.stop() m.stop()
local thread_id = Aux.control.thread(m.process) local thread_id = aux.control.thread(m.process)
m.state = { m.state = {
thread_id = thread_id, 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 private.PAGE_SIZE = 50
@@ -11,7 +11,7 @@ do
for _, old_state in {scan_states[params.type]} do for _, old_state in {scan_states[params.type]} do
m.abort(old_state.id) m.abort(old_state.id)
end 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] = { scan_states[params.type] = {
id = thread_id, id = thread_id,
params = params, params = params,
@@ -23,29 +23,29 @@ do
local aborted = {} local aborted = {}
for type, state in scan_states do for type, state in scan_states do
if not scan_id or state.id == scan_id then if not scan_id or state.id == scan_id then
Aux.control.kill_thread(state.id) aux.control.kill_thread(state.id)
scan_states[type] = nil scan_states[type] = nil
tinsert(aborted, state) tinsert(aborted, state)
end end
end end
for _, state in aborted do for _, state in aborted do
Aux.safe_call(state.params.on_abort) aux.safe_call(state.params.on_abort)
end end
end end
function private.complete() function private.complete()
local on_complete = m.state.params.on_complete local on_complete = m.state.params.on_complete
scan_states[m.state.params.type] = nil scan_states[m.state.params.type] = nil
Aux.safe_call(on_complete) aux.safe_call(on_complete)
end end
private.state = Aux.dynamic_table(function() private.state = aux.dynamic_table(function()
local _, state = next(Aux.util.filter(scan_states, function(state) return state.id == Aux.control.thread_id end)) local _, state = next(aux.util.filter(scan_states, function(state) return state.id == aux.control.thread_id end))
return state return state
end) end)
end end
private.query = Aux.dynamic_table(function() private.query = aux.dynamic_table(function()
return m.state.params.queries[m.state.query_index] return m.state.params.queries[m.state.query_index]
end) end)
@@ -67,7 +67,7 @@ function private.wait_for_callback(...)
if ok then if ok then
return k() return k()
else 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
end end
@@ -104,8 +104,8 @@ function private.process_query()
end end
function private.submit_query() function private.submit_query()
Aux.control.when(function() return m.state.params.type ~= 'list' or CanSendAuctionQuery() end, function() aux.control.when(function() return m.state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
Aux.safe_call(m.state.params.on_submit_query) aux.safe_call(m.state.params.on_submit_query)
m.last_query_time[m.state.params.type] = GetTime() m.last_query_time[m.state.params.type] = GetTime()
if m.state.params.type == 'bidder' then if m.state.params.type == 'bidder' then
GetBidderAuctionItems(m.state.page) GetBidderAuctionItems(m.state.page)
@@ -146,19 +146,19 @@ function private.scan_page(i)
end end
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 if auction_info and (auction_info.owner or m.state.params.ignore_owner or aux_ignore_owner) then
auction_info.index = i auction_info.index = i
auction_info.page = m.state.page auction_info.page = m.state.page
auction_info.blizzard_query = m.query.blizzard_query auction_info.blizzard_query = m.query.blizzard_query
auction_info.query_type = m.state.params.type 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 if aux.safe_call(m.state.params.auto_buy_validator, auction_info) then
local c = Aux.control.await(recurse) local c = aux.control.await(recurse)
Aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, Aux.f(c, true)) 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)) return aux.control.thread(aux.control.sleep, 10, aux.f(c, false))
elseif not m.query.validator or m.query.validator(auction_info) then 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) return m.wait_for_callback(m.state.params.on_auction, auction_info, function(removed)
if removed then if removed then
@@ -178,7 +178,7 @@ function private.timeout(type)
end end
function private.wait_for_results() 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 if m.timeout(m.state.params.type) then
return m.submit_query() return m.submit_query()
else else
@@ -194,10 +194,10 @@ function private.wait_for_results()
end) end)
local type = m.state.params.type 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 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 elseif m.state.params.type == 'owner' then
return m.wait_for_owner_results(c) return m.wait_for_owner_results(c)
elseif m.state.params.type == 'list' then elseif m.state.params.type == 'list' then
@@ -206,22 +206,22 @@ function private.wait_for_results()
end end
function private.wait_for_owner_results(c) 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() return c()
else 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
end end
function private.wait_for_list_results(c) function private.wait_for_list_results(c)
local updated, last_update 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) kill(-c)
last_update = GetTime() last_update = GetTime()
updated = true updated = true
end) end)
local ignore_owner = m.state.params.ignore_owner or aux_ignore_owner 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. -- 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 local ok = updated and (ignore_owner or m.owner_data_complete('list')) or last_update and GetTime() - last_update > 5
updated = false updated = false
@@ -231,7 +231,7 @@ end
function private.owner_data_complete(type) function private.owner_data_complete(type)
for i=1,m.PAGE_SIZE do 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 if auction_info and not auction_info.owner then
return false return false
end end
+24 -24
View File
@@ -1,53 +1,53 @@
SLASH_AUX1 = '/aux' SLASH_AUX1 = '/aux'
function SlashCmdList.AUX(command) function SlashCmdList.aux(command)
if not command then return end if not command then return end
local arguments = Aux.util.tokenize(command) local arguments = aux.util.tokenize(command)
if arguments[1] == 'clear' and arguments[2] == 'history' then if arguments[1] == 'clear' and arguments[2] == 'history' then
Aux.persistence.load_dataset().history = nil aux.persistence.load_dataset().history = nil
Aux.log('History cleared.') aux.log('History cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'post' then elseif arguments[1] == 'clear' and arguments[2] == 'post' then
Aux.persistence.load_dataset().post = nil aux.persistence.load_dataset().post = nil
Aux.log('Post settings cleared.') aux.log('Post settings cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then
aux_datasets = {} aux_datasets = {}
Aux.log('Datasets cleared.') aux.log('Datasets cleared.')
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'buy' then elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
aux_merchant_buy = {} 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 elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
aux_merchant_sell = {} 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 elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
aux_items = {} aux_items = {}
aux_item_ids = {} aux_item_ids = {}
aux_auctionable_items = {} aux_auctionable_items = {}
Aux.log('Item cache cleared.') aux.log('Item cache cleared.')
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then 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 elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
aux_tooltip_value = not aux_tooltip_value 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 elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
aux_tooltip_daily = not aux_tooltip_daily 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 elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'buy' then
aux_tooltip_vendor_buy = not aux_tooltip_vendor_buy 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 elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'sell' then
aux_tooltip_vendor_sell = not aux_tooltip_vendor_sell 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 elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
aux_tooltip_disenchant_value = not aux_tooltip_disenchant_value 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 elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
aux_tooltip_disenchant_distribution = not aux_tooltip_disenchant_distribution 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 elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'source' then
aux_tooltip_disenchant_source = not aux_tooltip_disenchant_source 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 elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
aux_ignore_owner = not aux_ignore_owner 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 elseif arguments[1] == 'chars' and arguments[2] == 'add' then
local realm = GetCVar('realmName') local realm = GetCVar('realmName')
aux_characters[realm] = aux_characters[realm] or {} aux_characters[realm] = aux_characters[realm] or {}
@@ -55,7 +55,7 @@ function SlashCmdList.AUX(command)
local name = string.gsub(strlower(arguments[i]), '^%l', strupper) local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
if not aux_characters[realm][name] then if not aux_characters[realm][name] then
aux_characters[realm][name] = true aux_characters[realm][name] = true
Aux.log('Character "'..name..'" added.') aux.log('Character "'..name..'" added.')
end end
end end
elseif arguments[1] == 'chars' and arguments[2] == 'remove' then 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) local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
if aux_characters[realm][name] then if aux_characters[realm][name] then
aux_characters[realm][name] = nil aux_characters[realm][name] = nil
Aux.log('Character "'..name..'" removed.') aux.log('Character "'..name..'" removed.')
end end
end end
elseif arguments[1] == 'chars' then elseif arguments[1] == 'chars' then
@@ -77,11 +77,11 @@ function SlashCmdList.AUX(command)
tinsert(chars, name) tinsert(chars, name)
end end
if getn(chars) > 0 then if getn(chars) > 0 then
Aux.log('Your characters: "'..Aux.util.join(chars, ', ')..'".') aux.log('Your characters: "'..aux.util.join(chars, ', ')..'".')
else 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 end
else else
Aux.log('Unknown command: "'..command..'"') aux.log('Unknown command: "'..command..'"')
end end
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 private.state = nil
function private.stack_size(slot) 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 return container_item_info and container_item_info.count or 0
end end
function private.charges(slot) 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 return container_item_info and container_item_info.charges
end end
function private.max_stack(slot) 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 return container_item_info and container_item_info.max_stack
end end
function private.locked(slot) 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 return container_item_info and container_item_info.locked
end end
function private.find_item_slot(partial) function private.find_item_slot(partial)
for slot in Aux.util.inventory() do for slot in aux.util.inventory() do
if m.matching_item(slot, partial) and not Aux.util.eq(slot, m.state.target_slot) then if m.matching_item(slot, partial) and not aux.util.eq(slot, m.state.target_slot) then
return slot return slot
end end
end end
end end
function private.matching_item(slot, partial) function private.matching_item(slot, partial)
local item_info = Aux.info.container_item(unpack(slot)) 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) 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 end
function private.find_empty_slot() 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 if type == 1 and not GetContainerItemInfo(unpack(slot)) then
return slot return slot
end end
@@ -44,7 +44,7 @@ function private.find_empty_slot()
end end
function private.find_charge_item_slot() 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 if m.matching_item(slot) and m.charges(slot) == m.state.target_size then
return slot return slot
end end
@@ -53,7 +53,7 @@ end
function private.move_item(from_slot, to_slot, amount, k) function private.move_item(from_slot, to_slot, amount, k)
if m.locked(from_slot) or m.locked(to_slot) then if m.locked(from_slot) or m.locked(to_slot) then
return Aux.control.wait(k) return aux.control.wait(k)
end end
amount = min(m.max_stack(from_slot) - m.stack_size(to_slot), m.stack_size(from_slot), amount) 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) SplitContainerItem(from_slot[1], from_slot[2], amount)
PickupContainerItem(unpack(to_slot)) 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 end
function private.process() function private.process()
@@ -105,20 +105,20 @@ end
function public.stop() function public.stop()
if m.state then 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 local callback, slot = m.state.callback, m.state.target_slot
if slot and not m.matching_item(slot) then if slot and not m.matching_item(slot) then
slot = nil slot = nil
end end
m.state = nil m.state = nil
Aux.safe_call(callback, slot) aux.safe_call(callback, slot)
end end
end end
function public.start(item_key, size, callback) function public.start(item_key, size, callback)
m.stop() m.stop()
local thread_id = Aux.control.thread(m.process) local thread_id = aux.control.thread(m.process)
m.state = { m.state = {
thread_id = thread_id, thread_id = thread_id,
item_key = item_key, 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 aux_tooltip_value = true
@@ -9,12 +9,12 @@ private.game_tooltip_money = nil
function public.LOAD() function public.LOAD()
for func, hook in m.game_tooltip_hooks do for func, hook in m.game_tooltip_hooks do
local func, hook = func, hook local func, hook = func, hook
Aux.hook( aux.hook(
func, func,
function(...) function(...)
m.hooked_setter = true m.hooked_setter = true
m.game_tooltip_money = 0 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 m.hooked_setter = false
hook(unpack(arg)) hook(unpack(arg))
return unpack(results) return unpack(results)
@@ -44,13 +44,13 @@ function public.LOAD()
end end
function private.extend_tooltip(tooltip, hyperlink, quantity) 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 quantity = IsShiftKeyDown() and quantity or 1
if aux_tooltip_disenchant_source then if aux_tooltip_disenchant_source then
local color = {r=0.7, g=0.7, b=0.7} 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 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) 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
end end
local item_info = Aux.info.item(item_id) local item_info = aux.info.item(item_id)
if item_info then 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 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) tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
sort(distribution, function(a,b) return a.probability > b.probability end) sort(distribution, function(a,b) return a.probability > b.probability end)
for _, event in distribution do 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
end end
if aux_tooltip_disenchant_value then if aux_tooltip_disenchant_value then
local color = {r=0.1, g=0.6, b=0.6} 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) 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) 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 end
end end
@@ -91,33 +91,33 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
if aux_tooltip_vendor_buy then if aux_tooltip_vendor_buy then
local color = {r=0.8, g=0.5, b=0.1} 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 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
end end
if aux_tooltip_vendor_sell then if aux_tooltip_vendor_sell then
local color = {r=0.8, g=0.5, b=0.1} 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 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
end end
local color = {r=1, g=1, b=0.6} 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 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 auctionable then
if aux_tooltip_value 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 end
if aux_tooltip_daily then if aux_tooltip_daily then
local market_value = Aux.history.market_value(item_key) 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) 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
end end
@@ -179,7 +179,7 @@ end
function m.game_tooltip_hooks:SetInboxItem(index) function m.game_tooltip_hooks:SetInboxItem(index)
local name, _, quantity = GetInboxItem(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 if id then
local _, itemstring, quality = GetItemInfo(id) local _, itemstring, quality = GetItemInfo(id)
local _, _, _, hex = GetItemQualityColor(tonumber(quality)) local _, _, _, hex = GetItemQualityColor(tonumber(quality))
@@ -241,9 +241,9 @@ end
function m.game_tooltip_hooks:SetAuctionSellItem() function m.game_tooltip_hooks:SetAuctionSellItem()
local name, _, quantity, _, _, _ = GetAuctionSellItemInfo() local name, _, quantity, _, _, _ = GetAuctionSellItemInfo()
if name then if name then
for slot in Aux.util.inventory() do for slot in aux.util.inventory() do
local link = GetContainerItemLink(unpack(slot)) 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) m.extend_tooltip(GameTooltip, link, quantity)
return return
end 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.event_frame = CreateFrame('Frame')
private.listeners = {} private.listeners = {}
@@ -20,13 +20,13 @@ end
function private.on_update() function private.on_update()
for _, listener in m.listeners do 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) m.event_frame:UnregisterEvent(listener.event)
end end
end end
m.listeners = Aux.util.filter(m.listeners, function(l) return not l.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) m.threads = aux.util.filter(m.threads, function(th) return not th.killed end)
for thread_id, thread in m.threads do for thread_id, thread in m.threads do
if not thread.killed then if not thread.killed then
@@ -55,7 +55,7 @@ function public.kill_thread(thread_id)
end end
function public.event_listener(event, cb) 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.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) m.event_frame:RegisterEvent(event)
return listener_id return listener_id
@@ -73,8 +73,8 @@ function public.as_soon_as(p, ...)
end end
function public.thread(k, ...) function public.thread(k, ...)
local thread_id = Aux.unique() local thread_id = aux.unique()
m.threads[thread_id] = { k = Aux.f(k, unpack(arg)) } m.threads[thread_id] = { k = aux.f(k, unpack(arg)) }
return thread_id return thread_id
end end
@@ -100,7 +100,7 @@ function public.wait(k, ...)
if type(k) == 'number' then if type(k) == 'number' then
m.when(function() k = k - 1 return k <= 1 end, unpack(arg)) m.when(function() k = k - 1 return k <= 1 end, unpack(arg))
else 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
end end
@@ -108,6 +108,6 @@ function public.when(p, k, ...)
if p() then if p() then
return k(unpack(arg)) return k(unpack(arg))
else 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
end end
+12 -12
View File
@@ -1,9 +1,9 @@
local addon = Aux_module() local addon = aux_module()
Aux = tremove(addon, 1) aux = tremove(addon, 1)
local m, public, private = unpack(addon) local m, public, private = unpack(addon)
--m.enum TODO --m.enum TODO
--setmetatable({}, { AUX -> aux --setmetatable({}, { aux -> aux
-- __index = function(self, key) -- __index = function(self, key)
-- self[key] = true -- self[key] = true
-- return self -- return self
@@ -24,9 +24,9 @@ local m, public, private = unpack(addon)
-- ipairs TODO -- ipairs TODO
private.modules = { Aux } private.modules = { aux }
function public.module(name) function public.module(name)
local module = Aux_module() local module = aux_module()
local public_interface = tremove(module, 1) local public_interface = tremove(module, 1)
tinsert(m.modules, public_interface) tinsert(m.modules, public_interface)
public[name] = public_interface public[name] = public_interface
@@ -117,12 +117,12 @@ function public.on_load()
public.last_owner_page_requested = nil public.last_owner_page_requested = nil
private.auction_frame_loaded = 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') tinsert(UISpecialFrames, 'AuxFrame')
Aux.control.event_listener('CURSOR_UPDATE', m.CURSOR_UPDATE) aux.control.event_listener('CURSOR_UPDATE', m.CURSOR_UPDATE)
do do
local tab_group = m.gui.tab_group(AuxFrame, 'DOWN') local tab_group = m.gui.tab_group(AuxFrame, 'DOWN')
@@ -296,7 +296,7 @@ do
m.control.event_listener('CHAT_MSG_SYSTEM', function(kill) m.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
if arg1 == ERR_AUCTION_BID_PLACED then if arg1 == ERR_AUCTION_BID_PLACED then
Aux.safe_call(on_success) aux.safe_call(on_success)
locked = false locked = false
kill() kill()
end end
@@ -323,7 +323,7 @@ do
CancelAuction(index) CancelAuction(index)
m.control.event_listener('CHAT_MSG_SYSTEM', function(kill) m.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
if arg1 == ERR_AUCTION_REMOVED then if arg1 == ERR_AUCTION_REMOVED then
Aux.safe_call(on_success) aux.safe_call(on_success)
locked = false locked = false
kill() kill()
end end
@@ -396,7 +396,7 @@ do -- TODO make it work for other ways to pick up things
end end
function private.PickupContainerItem(...) function private.PickupContainerItem(...)
local bag, slot = unpack(arg) local bag, slot = unpack(arg)
Aux.control.thread(function() aux.control.thread(function()
last_picked_up = {bag, slot} last_picked_up = {bag, slot}
end) end)
return m.orig.PickupContainerItem(unpack(arg)) return m.orig.PickupContainerItem(unpack(arg))
@@ -450,7 +450,7 @@ end
function public.is_player(name, current) function public.is_player(name, current)
local realm = GetCVar('realmName') local realm = GetCVar('realmName')
return not current and 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 end
function public.unmodified() function public.unmodified()
+1 -1
View File
@@ -13,7 +13,7 @@
this:RegisterEvent('AUCTION_OWNED_LIST_UPDATE') this:RegisterEvent('AUCTION_OWNED_LIST_UPDATE')
</OnLoad> </OnLoad>
<OnEvent> <OnEvent>
Aux:on_event() aux:on_event()
</OnEvent> </OnEvent>
</Scripts> </Scripts>
</Frame> </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 = { public.config = {
link_color = { 153, 255, 255, 1 }, -- TODO inline color needs 255, others need /255 link_color = { 153, 255, 255, 1 }, -- TODO inline color needs 255, others need /255
@@ -121,7 +121,7 @@ do
id = id, id = id,
frame = parent, frame = parent,
tabs = {}, tabs = {},
on_select = Aux.util.pass, on_select = aux.util.pass,
} }
function self:create_tab(text) function self:create_tab(text)
@@ -226,14 +226,14 @@ function public.editbox(parent)
editbox:SetShadowColor(0, 0, 0, 0) editbox:SetShadowColor(0, 0, 0, 0)
m.set_content_style(editbox) 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 do
local last_time, last_x, last_y 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() editbox:SetScript('OnMouseUp', function()
local x, y = GetCursorPosition() local x, y = GetCursorPosition()
@@ -325,14 +325,14 @@ function public.item(parent)
local item = CreateFrame('Button', nil, parent) local item = CreateFrame('Button', nil, parent)
item:SetWidth(193) item:SetWidth(193)
item:SetHeight(40) 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:SetPoint('LEFT', 2, 0.5)
icon:SetHighlightTexture(nil) icon:SetHighlightTexture(nil)
icon:RegisterForClicks() icon:RegisterForClicks()
icon:EnableMouse(nil) icon:EnableMouse(nil)
item.texture = getglobal(icon:GetName()..'Icon') item.texture = getglobal(icon:GetName()..'Icon')
item.texture:SetTexCoord(0.06,0.94,0.06,0.94) 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:SetJustifyH('LEFT')
item.name:SetPoint('LEFT', icon, 'RIGHT', 10, 0) item.name:SetPoint('LEFT', icon, 'RIGHT', 10, 0)
item.name:SetPoint('RIGHT', item, 'RIGHT', -10, 0.5) item.name:SetPoint('RIGHT', item, 'RIGHT', -10, 0.5)
@@ -377,7 +377,7 @@ end
function public.dropdown(parent) 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: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)) 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 = {}, {}, {}, {}, {}, {}, {} local data, is_public, is_declared, public_interface, private_interface, public, private = {}, {}, {}, {}, {}, {}, {}
setmetatable(public_interface, { setmetatable(public_interface, {
__newindex = function() __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 RT_COUNT = 1
local HEAD_HEIGHT = 27 local HEAD_HEIGHT = 27
@@ -8,7 +8,7 @@ local AUCTION_PCT_COLORS = {
{color='|cff16ff16', value=80}, -- green {color='|cff16ff16', value=80}, -- green
{color='|cffffff00', value=110}, -- yellow {color='|cffffff00', value=110}, -- yellow
{color='|cffff9218', value=135}, -- orange {color='|cffff9218', value=135}, -- orange
{color='|cffff0000', value=Aux.huge}, -- red {color='|cffff0000', value=aux.huge}, -- red
} }
local TIME_LEFT_STRINGS = { local TIME_LEFT_STRINGS = {
'|cffff000030m|r', -- Short '|cffff000030m|r', -- Short
@@ -65,7 +65,7 @@ public.search_config = {
cell:SetText(gsub(record.hyperlink, '[%[%]]', '')) cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -78,7 +78,7 @@ public.search_config = {
cell:SetText(display_level) cell:SetText(display_level)
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -86,14 +86,14 @@ public.search_config = {
width = 0.06, width = 0.06,
align = 'CENTER', align = 'CENTER',
set = function(cell, record, count, own, expandable) 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 if own > 0 then
numAuctionsText = numAuctionsText..(' |cffffff00('..own..')|r') numAuctionsText = numAuctionsText..(' |cffffff00('..own..')|r')
end end
cell:SetText(numAuctionsText) cell:SetText(numAuctionsText)
end, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
return Aux.sort.EQ return aux.sort.EQ
-- if sortKey == 'numAuctions' then -- if sortKey == 'numAuctions' then
-- if a.children then -- if a.children then
-- aVal = a.totalAuctions -- aVal = a.totalAuctions
@@ -113,7 +113,7 @@ public.search_config = {
cell:SetText(record.aux_quantity) cell:SetText(record.aux_quantity)
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -124,7 +124,7 @@ public.search_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---') cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -132,17 +132,17 @@ public.search_config = {
width = 0.13, width = 0.13,
align = 'CENTER', align = 'CENTER',
set = function(cell, record) 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, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
if not record_a.owner and not record_b.owner then if not record_a.owner and not record_b.owner then
return Aux.sort.EQ return aux.sort.EQ
elseif not record_a.owner then elseif not record_a.owner then
return Aux.sort.GT return aux.sort.GT
elseif not record_b.owner then elseif not record_b.owner then
return Aux.sort.LT return aux.sort.LT
else 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
end, end,
}, },
@@ -164,7 +164,7 @@ public.search_config = {
else else
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
end end
cell:SetText(Aux.money.to_string(price, true, false, nil, color)) cell:SetText(aux.money.to_string(price, true, false, nil, color))
end, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
local price_a local price_a
@@ -179,7 +179,7 @@ public.search_config = {
else else
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
end end
return Aux.sort.compare(price_a, price_b, desc) return aux.sort.compare(price_a, price_b, desc)
end, end,
}, },
{ {
@@ -189,15 +189,15 @@ public.search_config = {
isPrice = true, isPrice = true,
set = function(cell, record) set = function(cell, record)
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price 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, end,
cmp = function(record_a, record_b, desc) 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_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 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_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_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, end,
}, },
{ {
@@ -209,9 +209,9 @@ public.search_config = {
cell:SetText((pct or bidPct) and m.percentage_historical(pct or bidPct, not pct) or '---') cell:SetText((pct or bidPct) and m.percentage_historical(pct or bidPct, not pct) or '---')
end, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
local pct_a = m.record_percentage(record_a) or (desc and -Aux.huge or Aux.huge) 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) 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) return aux.sort.compare(pct_a, pct_b, desc)
end, end,
}, },
} }
@@ -235,7 +235,7 @@ public.auctions_config = {
cell:SetText(gsub(record.hyperlink, '[%[%]]', '')) cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -248,7 +248,7 @@ public.auctions_config = {
cell:SetText(display_level) cell:SetText(display_level)
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -256,11 +256,11 @@ public.auctions_config = {
width = 0.06, width = 0.06,
align = 'CENTER', align = 'CENTER',
set = function(cell, record, count, own, expandable) 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) cell:SetText(numAuctionsText)
end, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
return Aux.sort.EQ return aux.sort.EQ
-- if sortKey == 'numAuctions' then -- if sortKey == 'numAuctions' then
-- if a.children then -- if a.children then
-- aVal = a.totalAuctions -- aVal = a.totalAuctions
@@ -280,7 +280,7 @@ public.auctions_config = {
cell:SetText(record.aux_quantity) cell:SetText(record.aux_quantity)
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -291,7 +291,7 @@ public.auctions_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---') cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -306,7 +306,7 @@ public.auctions_config = {
else else
price = aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price price = aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price
end end
cell:SetText(Aux.money.to_string(price, true, false)) cell:SetText(aux.money.to_string(price, true, false))
end, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
local price_a local price_a
@@ -321,7 +321,7 @@ public.auctions_config = {
else else
price_b = aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price price_b = aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
end end
return Aux.sort.compare(price_a, price_b, desc) return aux.sort.compare(price_a, price_b, desc)
end, end,
}, },
{ {
@@ -331,15 +331,15 @@ public.auctions_config = {
isPrice = true, isPrice = true,
set = function(cell, record) set = function(cell, record)
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price 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, end,
cmp = function(record_a, record_b, desc) 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_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 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_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_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, end,
}, },
{ {
@@ -351,13 +351,13 @@ public.auctions_config = {
end, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
if not record_a.high_bidder and not record_b.high_bidder then if not record_a.high_bidder and not record_b.high_bidder then
return Aux.sort.EQ return aux.sort.EQ
elseif not record_a.high_bidder then elseif not record_a.high_bidder then
return Aux.sort.GT return aux.sort.GT
elseif not record_b.high_bidder then elseif not record_b.high_bidder then
return Aux.sort.LT return aux.sort.LT
else 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
end, end,
}, },
@@ -382,7 +382,7 @@ public.bids_config = {
cell:SetText(gsub(record.hyperlink, '[%[%]]', '')) cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -390,11 +390,11 @@ public.bids_config = {
width = 0.06, width = 0.06,
align = 'CENTER', align = 'CENTER',
set = function(cell, record, count, own, expandable) 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) cell:SetText(numAuctionsText)
end, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
return Aux.sort.EQ return aux.sort.EQ
-- if sortKey == 'numAuctions' then -- if sortKey == 'numAuctions' then
-- if a.children then -- if a.children then
-- aVal = a.totalAuctions -- aVal = a.totalAuctions
@@ -414,7 +414,7 @@ public.bids_config = {
cell:SetText(record.aux_quantity) cell:SetText(record.aux_quantity)
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -425,7 +425,7 @@ public.bids_config = {
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---') cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
{ {
@@ -433,17 +433,17 @@ public.bids_config = {
width = 0.13, width = 0.13,
align = 'CENTER', align = 'CENTER',
set = function(cell, record) 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, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
if not record_a.owner and not record_b.owner then if not record_a.owner and not record_b.owner then
return Aux.sort.EQ return aux.sort.EQ
elseif not record_a.owner then elseif not record_a.owner then
return Aux.sort.GT return aux.sort.GT
elseif not record_b.owner then elseif not record_b.owner then
return Aux.sort.LT return aux.sort.LT
else 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
end, end,
}, },
@@ -459,7 +459,7 @@ public.bids_config = {
else else
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
end end
cell:SetText(Aux.money.to_string(price)) cell:SetText(aux.money.to_string(price))
end, end,
cmp = function(record_a, record_b, desc) cmp = function(record_a, record_b, desc)
local price_a local price_a
@@ -474,7 +474,7 @@ public.bids_config = {
else else
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
end end
return Aux.sort.compare(price_a, price_b, desc) return aux.sort.compare(price_a, price_b, desc)
end, end,
}, },
{ {
@@ -484,15 +484,15 @@ public.bids_config = {
isPrice = true, isPrice = true,
set = function(cell, record) set = function(cell, record)
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price 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, end,
cmp = function(record_a, record_b, desc) 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_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 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_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_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, end,
}, },
{ {
@@ -509,7 +509,7 @@ public.bids_config = {
cell:SetText(status) cell:SetText(status)
end, end,
cmp = function(record_a, record_b, desc) 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, end,
}, },
} }
@@ -517,12 +517,12 @@ public.bids_config = {
function private.record_percentage(record) function private.record_percentage(record)
if not record then return end 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 historical_value > 0 then
if record.unit_buyout_price > 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 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
end end
@@ -594,8 +594,8 @@ local methods = {
local rt = this:GetParent().row.rt local rt = this:GetParent().row.rt
local rowData = this:GetParent().row.data local rowData = this:GetParent().row.data
if rowData and rowData.record then if rowData and rowData.record then
Aux.info.set_tooltip(rowData.record.itemstring, this, 'ANCHOR_RIGHT') aux.info.set_tooltip(rowData.record.itemstring, this, 'ANCHOR_RIGHT')
Aux.info.set_shopping_tooltip(rowData.record.slot) aux.info.set_shopping_tooltip(rowData.record.slot)
rt.isShowingItemTooltip = true rt.isShowingItemTooltip = true
end end
end, end,
@@ -652,10 +652,10 @@ local methods = {
DressUpItemLink(this.row.data.record.hyperlink) DressUpItemLink(this.row.data.record.hyperlink)
elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then
ChatFrameEditBox:Insert(this.row.data.record.hyperlink) ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
elseif Aux.unmodified() and button == 'RightButton' then -- TODO not when alt (how?) elseif aux.unmodified() and button == 'RightButton' then -- TODO not when alt (how?)
Aux.tab_group:set_tab(1) 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.set_filter(strlower(aux.info.item(this.row.data.record.item_id).name)..'/exact')
Aux.search_tab.execute(nil, false) aux.search_tab.execute(nil, false)
else else
local selection = this.rt:GetSelection() local selection = this.rt:GetSelection()
if not selection or selection.record ~= this.row.data.record then if not selection or selection.record ~= this.row.data.record then
@@ -687,12 +687,12 @@ local methods = {
-- ============================================================================ -- ============================================================================
UpdateRowInfo = function(self) UpdateRowInfo = function(self)
Aux.util.wipe(self.rowInfo) aux.util.wipe(self.rowInfo)
self.rowInfo.numDisplayRows = 0 self.rowInfo.numDisplayRows = 0
self.isSorted = nil self.isSorted = nil
self:SetSelectedRecord(nil, true) 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 local records = self.records
if getn(records) == 0 then return end if getn(records) == 0 then return end
@@ -722,7 +722,7 @@ local methods = {
local totalAuctions, totalPlayerAuctions = 0, 0 local totalAuctions, totalPlayerAuctions = 0, 0
for _, childInfo in ipairs(info.children) do for _, childInfo in ipairs(info.children) do
totalAuctions = totalAuctions + childInfo.numAuctions totalAuctions = totalAuctions + childInfo.numAuctions
if Aux.is_player(childInfo.record.owner) then if aux.is_player(childInfo.record.owner) then
totalPlayerAuctions = totalPlayerAuctions + childInfo.numAuctions totalPlayerAuctions = totalPlayerAuctions + childInfo.numAuctions
end end
end end
@@ -738,7 +738,7 @@ local methods = {
-- update sorting highlights -- update sorting highlights
for _, cell in ipairs(self.headCells) do for _, cell in ipairs(self.headCells) do
local tex = cell:GetNormalTexture() 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:SetTexCoord(0.017, 1, 0.083, 0.909)
tex:SetAlpha(0.5) tex:SetAlpha(0.5)
end end
@@ -773,11 +773,11 @@ local methods = {
end end
for _, sort in self.sorts do 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 return true
elseif ordering == Aux.sort.GT then elseif ordering == aux.sort.GT then
return false return false
end end
end end
@@ -855,7 +855,7 @@ local methods = {
-- ============================================================================ -- ============================================================================
Reset = function(rt) Reset = function(rt)
Aux.util.wipe(rt.expanded) aux.util.wipe(rt.expanded)
rt:UpdateRowInfo() rt:UpdateRowInfo()
rt:UpdateRows() rt:UpdateRows()
rt:SetSelectedRecord() rt:SetSelectedRecord()
@@ -900,7 +900,7 @@ local methods = {
end, end,
RemoveAuctionRecord = function(self, record) RemoveAuctionRecord = function(self, record)
local index = Aux.util.key(record, self.records) local index = aux.util.key(record, self.records)
if index then if index then
tremove(self.records, index) tremove(self.records, index)
end end
@@ -910,7 +910,7 @@ local methods = {
RemoveSelectedRecord = function(self, count) RemoveSelectedRecord = function(self, count)
count = count or 1 count = count or 1
for i=1, count do 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 if index then
tremove(self.records, index) tremove(self.records, index)
end end
@@ -927,7 +927,7 @@ local methods = {
end, end,
ContainsRecord = function(rt, record) ContainsRecord = function(rt, record)
if Aux.util.key(record, rt.records) then if aux.util.key(record, rt.records) then
return true return true
end end
end, end,
@@ -996,7 +996,7 @@ local methods = {
function public.CreateAuctionResultsTable(parent, config) function public.CreateAuctionResultsTable(parent, config)
local rtName = 'AuxAuctionResultsTable'..RT_COUNT local rtName = 'aux_frame'..aux.unique()
RT_COUNT = RT_COUNT + 1 RT_COUNT = RT_COUNT + 1
local rt = CreateFrame('Frame', rtName, parent) local rt = CreateFrame('Frame', rtName, parent)
rt.config = config rt.config = config
@@ -1047,7 +1047,7 @@ function public.CreateAuctionResultsTable(parent, config)
scrollBar:SetWidth(10) scrollBar:SetWidth(10)
local thumbTex = scrollBar:GetThumbTexture() local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0) thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(unpack(Aux.gui.config.content_color.backdrop)) thumbTex:SetTexture(unpack(aux.gui.config.content_color.backdrop))
thumbTex:SetHeight(150) thumbTex:SetHeight(150)
thumbTex:SetWidth(scrollBar:GetWidth()) thumbTex:SetWidth(scrollBar:GetWidth())
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide() getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
@@ -1073,15 +1073,15 @@ function public.CreateAuctionResultsTable(parent, config)
local text = cell:CreateFontString() local text = cell:CreateFontString()
text:SetJustifyH('CENTER') text:SetJustifyH('CENTER')
text:SetJustifyV('CENTER') text:SetJustifyV('CENTER')
text:SetFont(Aux.gui.config.font, Aux.gui.config.tiny_font_size) text:SetFont(aux.gui.config.font, aux.gui.config.tiny_font_size)
text:SetTextColor(unpack(Aux.gui.config.label_color.enabled)) text:SetTextColor(unpack(aux.gui.config.label_color.enabled))
cell:SetFontString(text) cell:SetFontString(text)
if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO
text:SetAllPoints() text:SetAllPoints()
local tex = cell:CreateTexture() local tex = cell:CreateTexture()
tex:SetAllPoints() 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:SetTexCoord(0.017, 1, 0.083, 0.909)
tex:SetAlpha(0.5) tex:SetAlpha(0.5)
cell:SetNormalTexture(tex) cell:SetNormalTexture(tex)
@@ -1119,7 +1119,7 @@ function public.CreateAuctionResultsTable(parent, config)
for j=1, getn(rt.config) do for j=1, getn(rt.config) do
local cell = CreateFrame('Button', nil, row) local cell = CreateFrame('Button', nil, row)
local text = cell:CreateFontString() 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:SetJustifyH(rt.config[j].align or 'LEFT')
text:SetJustifyV('CENTER') text:SetJustifyV('CENTER')
text:SetPoint('TOPLEFT', 1, -1) 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 local ROW_HEIGHT = 39
@@ -60,7 +60,7 @@ function public.create(parent, on_click, on_enter, on_leave, selected)
scrollBar:SetWidth(12) scrollBar:SetWidth(12)
local thumbTex = scrollBar:GetThumbTexture() local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0) 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:SetHeight(50)
thumbTex:SetWidth(12) thumbTex:SetWidth(12)
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide() getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
@@ -87,7 +87,7 @@ function public.create(parent, on_click, on_enter, on_leave, selected)
on_leave() on_leave()
end) end)
row.item = Aux.gui.item(row) row.item = aux.gui.item(row)
row.item:EnableMouse(nil) row.item:EnableMouse(nil)
row.item:SetScale(0.9) row.item:SetScale(0.9)
row.item:SetPoint('LEFT', 2.5, 0) 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 local ST_COUNT = 0
@@ -308,8 +308,8 @@ local methods = {
local text = col:CreateFontString() local text = col:CreateFontString()
text:SetJustifyV('CENTER') text:SetJustifyV('CENTER')
text:SetFont(Aux.gui.config.font, Aux.gui.config.medium_font_size) text:SetFont(aux.gui.config.font, aux.gui.config.medium_font_size)
text:SetTextColor(unpack(Aux.gui.config.text_color.enabled)) text:SetTextColor(unpack(aux.gui.config.text_color.enabled))
text:SetAllPoints() text:SetAllPoints()
col.text = text col.text = text
col:SetFontString(text) col:SetFontString(text)
@@ -336,7 +336,7 @@ local methods = {
local colNum = getn(row.cols) + 1 local colNum = getn(row.cols) + 1
local col = CreateFrame('Button', nil, row) local col = CreateFrame('Button', nil, row)
local text = col:CreateFontString() 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:SetJustifyV('CENTER')
text:SetPoint('TOPLEFT', 1, -1) text:SetPoint('TOPLEFT', 1, -1)
text:SetPoint('BOTTOMRIGHT', -1, 1) text:SetPoint('BOTTOMRIGHT', -1, 1)
@@ -392,9 +392,9 @@ local methods = {
-- update the text size of the head cols -- update the text size of the head cols
for _, col in ipairs(st.headCols) do for _, col in ipairs(st.headCols) do
if st.sizes.headFontSize then 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 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
end end
st:Redraw() st:Redraw()
@@ -433,14 +433,14 @@ function public.CreateScrollingTable(parent)
st.scrollBar = scrollBar st.scrollBar = scrollBar
local thumbTex = scrollBar:GetThumbTexture() local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0) 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:SetHeight(50)
thumbTex:SetWidth(12) thumbTex:SetWidth(12)
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide() getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
getglobal(scrollBar:GetName()..'ScrollDownButton'):Hide() getglobal(scrollBar:GetName()..'ScrollDownButton'):Hide()
-- create head line at default position -- 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 -- add all the methods
for name, func in methods do 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 private.auction_records = nil
@@ -34,7 +34,7 @@ function public.scan_auctions()
m.auction_records = {} m.auction_records = {}
m.update_listing() m.update_listing()
Aux.scan.start{ aux.scan.start{
type = 'owner', type = 'owner',
queries = {{ blizzard_query = {} }}, queries = {{ blizzard_query = {} }},
on_page_loaded = function(page, total_pages) on_page_loaded = function(page, total_pages)
@@ -58,7 +58,7 @@ end
function private.test(record) function private.test(record)
return function(index) 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 return auction_info and auction_info.search_signature == record.search_signature
end end
end end
@@ -74,9 +74,9 @@ do
return return
end end
Aux.scan.abort(scan_id) aux.scan.abort(scan_id)
state = SEARCHING state = SEARCHING
scan_id = Aux.scan_util.find( scan_id = aux.scan_util.find(
record, record,
m.status_bar, m.status_bar,
function() function()
@@ -92,7 +92,7 @@ do
m.cancel_button:SetScript('OnClick', function() m.cancel_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then 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
end) end)
m.cancel_button:Enable() m.cancel_button:Enable()
@@ -116,7 +116,7 @@ do
m.find_auction(selection.record) m.find_auction(selection.record)
elseif state == FOUND and not m.test(selection.record)(found_index) then elseif state == FOUND and not m.test(selection.record)(found_index) then
m.cancel_button:Disable() m.cancel_button:Disable()
if not Aux.cancel_in_progress() then if not aux.cancel_in_progress() then
state = IDLE state = IDLE
end end
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) private.frame = CreateFrame('Frame', nil, AuxFrame)
m.frame:SetAllPoints() m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide() 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('TOP', AuxFrame, 'TOP', 0, -8)
m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0) m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 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:SetSort(1,2,3,4,5,6,7,8)
m.listing:Reset() m.listing:Reset()
m.listing:SetHandler('OnCellClick', function(cell, button) m.listing:SetHandler('OnCellClick', function(cell, button)
@@ -23,7 +23,7 @@ Aux.auctions_tab.FRAMES(function(m, public, private)
end) end)
do 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:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6) 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 private.status_bar = status_bar
end end
do 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:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
@@ -41,7 +41,7 @@ Aux.auctions_tab.FRAMES(function(m, public, private)
private.cancel_button = btn private.cancel_button = btn
end end
do 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:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) 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 private.auction_records = nil
@@ -34,7 +34,7 @@ function public.scan_bids()
m.auction_records = {} m.auction_records = {}
m.update_listing() m.update_listing()
Aux.scan.start{ aux.scan.start{
type = 'bidder', type = 'bidder',
queries = {{ blizzard_query = {} }}, queries = {{ blizzard_query = {} }},
on_page_loaded = function(page, total_pages) on_page_loaded = function(page, total_pages)
@@ -58,7 +58,7 @@ end
function private.test(record) function private.test(record)
return function(index) 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 return auction_info and auction_info.search_signature == record.search_signature
end end
end end
@@ -74,9 +74,9 @@ do
return return
end end
Aux.scan.abort(scan_id) aux.scan.abort(scan_id)
state = SEARCHING state = SEARCHING
scan_id = Aux.scan_util.find( scan_id = aux.scan_util.find(
record, record,
m.status_bar, m.status_bar,
function() function()
@@ -93,10 +93,10 @@ do
if not record.high_bidder then if not record.high_bidder then
m.bid_button:SetScript('OnClick', function() m.bid_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then 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.place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
Aux.info.bid_update(record) aux.info.bid_update(record)
m.listing:SetDatabase() 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
end) end)
m.bid_button:Enable() m.bid_button:Enable()
@@ -105,7 +105,7 @@ do
if record.buyout_price > 0 then if record.buyout_price > 0 then
m.buyout_button:SetScript('OnClick', function() m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then 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
end) end)
m.buyout_button:Enable() m.buyout_button:Enable()
@@ -132,7 +132,7 @@ do
elseif state == FOUND and not m.test(selection.record)(found_index) then elseif state == FOUND and not m.test(selection.record)(found_index) then
m.buyout_button:Disable() m.buyout_button:Disable()
m.bid_button:Disable() m.bid_button:Disable()
if not Aux.bid_in_progress() then if not aux.bid_in_progress() then
state = IDLE state = IDLE
end end
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) private.frame = CreateFrame('Frame', nil, AuxFrame)
m.frame:SetAllPoints() m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide() 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('TOP', AuxFrame, 'TOP', 0, -8)
m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0) m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 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:SetSort(1,2,3,4,5,6,7,8)
m.listing:Reset() m.listing:Reset()
m.listing:SetHandler('OnCellClick', function(cell, button) m.listing:SetHandler('OnCellClick', function(cell, button)
@@ -27,7 +27,7 @@ Aux.bids_tab.FRAMES(function(m, public, private)
end) end)
do 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:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6) 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 private.status_bar = status_bar
end end
do 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:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
@@ -45,7 +45,7 @@ Aux.bids_tab.FRAMES(function(m, public, private)
private.bid_button = btn private.bid_button = btn
end end
do 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:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
@@ -54,7 +54,7 @@ Aux.bids_tab.FRAMES(function(m, public, private)
private.buyout_button = btn private.buyout_button = btn
end end
do 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:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) 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 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'}} 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() function public.OPEN()
m.frame:Show() 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_start_price(0)
m.set_unit_buyout_price(0) m.set_unit_buyout_price(0)
@@ -47,12 +47,12 @@ end
function private.read_settings(item_key) function private.read_settings(item_key)
item_key = item_key or m.selected_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 = dataset.post or {}
local settings local settings
if dataset.post[item_key] then 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 else
settings = m.default_settings() settings = m.default_settings()
end end
@@ -62,28 +62,28 @@ end
function private.write_settings(settings, item_key) function private.write_settings(settings, item_key)
item_key = item_key or m.selected_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 = dataset.post or {}
dataset.post[item_key] = Aux.persistence.write(settings_schema, settings) dataset.post[item_key] = aux.persistence.write(settings_schema, settings)
end end
function private.get_unit_start_price() function private.get_unit_start_price()
local money_text = m.unit_start_price:GetText() 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 end
function private.set_unit_start_price(amount) 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 end
function private.get_unit_buyout_price() function private.get_unit_buyout_price()
local money_text = m.unit_buyout_price:GetText() 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 end
function private.set_unit_buyout_price(amount) 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 end
function private.update_inventory_listing() function private.update_inventory_listing()
@@ -91,7 +91,7 @@ function private.update_inventory_listing()
return return
end 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) local settings = m.read_settings(record.key)
return record.aux_quantity > 0 and (not settings.hidden or m.show_hidden_checkbox:GetChecked()) return record.aux_quantity > 0 and (not settings.hidden or m.show_hidden_checkbox:GetChecked())
end))) 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 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()) 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)) 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)) 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) 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_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_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 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 local bid_color
if blizzard_bid_undercut < unit_start_price and stack_blizzard_bid_undercut < unit_start_price then 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, { tinsert(auction_rows, {
cols = { cols = {
{ value=auction_record.own and GREEN_FONT_COLOR_CODE..auction_record.count..FONT_COLOR_CODE_CLOSE or auction_record.count }, { 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=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=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=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 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=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, record = auction_record,
}) })
end end
sort(auction_rows, function(a, b) 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.unit_blizzard_bid,
a.record.stack_size, a.record.stack_size,
b.record.own and 1 or 0, b.record.own and 1 or 0,
a.record.duration, 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.unit_blizzard_bid,
b.record.stack_size, b.record.stack_size,
a.record.own and 1 or 0, a.record.own and 1 or 0,
@@ -174,7 +174,7 @@ function private.update_auction_listing()
end end
function public.select_item(item_key) 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 if inventory_record.key == item_key then
m.set_item(inventory_record) m.set_item(inventory_record)
break break
@@ -188,13 +188,13 @@ function private.price_update()
local start_price_input = m.get_unit_start_price() local start_price_input = m.get_unit_start_price()
settings.start_price = start_price_input settings.start_price = start_price_input
local historical_value = Aux.history.value(m.selected_item.key) 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 '---') 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() local buyout_price_input = m.get_unit_buyout_price()
settings.buyout_price = buyout_price_input settings.buyout_price = buyout_price_input
local historical_value = Aux.history.value(m.selected_item.key) 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.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) m.write_settings(settings)
end end
@@ -219,7 +219,7 @@ function private.post_auctions()
duration_code = 4 duration_code = 4
end end
Aux.post.start( aux.post.start(
key, key,
stack_size, stack_size,
duration, duration,
@@ -278,7 +278,7 @@ function private.update_item_configuration()
m.item.texture:SetTexture(nil) m.item.texture:SetTexture(nil)
m.item.count:SetText() 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.item.name:SetText('No item selected')
m.unit_start_price:Hide() 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()) m.stack_count_slider.editbox:SetNumber(m.stack_count_slider:GetValue())
do 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_size = m.stack_size_slider:GetValue()
local stack_count local stack_count
stack_count = m.stack_count_slider:GetValue() 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 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 end
m.refresh_button:Enable() m.refresh_button:Enable()
@@ -327,8 +327,8 @@ function private.update_item_configuration()
end end
function private.undercut(record, stack_size, stack) 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 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 buyout_price = aux.util.round(record.unit_buyout_price * (stack and record.stack_size or stack_size))
if not record.own then if not record.own then
start_price = max(0, start_price - 1) start_price = max(0, start_price - 1)
@@ -351,16 +351,16 @@ end
function private.unit_vendor_price(item_key) 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 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() ClearCursor()
PickupContainerItem(unpack(slot)) PickupContainerItem(unpack(slot))
ClickAuctionSellItemButton() ClickAuctionSellItemButton()
local auction_sell_item = Aux.info.auction_sell_item() local auction_sell_item = aux.info.auction_sell_item()
ClearCursor() ClearCursor()
ClickAuctionSellItemButton() ClickAuctionSellItemButton()
ClearCursor() ClearCursor()
@@ -375,9 +375,9 @@ end
function private.update_historical_value_button() function private.update_historical_value_button()
if m.selected_item then 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.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
end end
@@ -392,7 +392,7 @@ function private.set_item(item)
return return
end end
Aux.scan.abort(m.scan_id) aux.scan.abort(m.scan_id)
m.selected_item = item m.selected_item = item
@@ -405,8 +405,8 @@ function private.set_item(item)
m.stack_size_slider:SetValue(settings.stack_size) m.stack_size_slider:SetValue(settings.stack_size)
m.quantity_update(true) m.quantity_update(true)
m.unit_start_price:SetText(Aux.money.to_string(settings.start_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)) 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 if not m.existing_auctions[m.selected_item.key] then
m.refresh_entries() m.refresh_entries()
@@ -422,13 +422,13 @@ function private.update_inventory_records()
local auction_candidate_map = {} 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 if item_info then
local charge_class = item_info.charges or 0 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 if not auction_candidate_map[item_info.item_key] then
local availability = {} local availability = {}
@@ -476,12 +476,12 @@ function private.refresh_entries()
m.existing_auctions[item_key] = nil 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:update_status(0,0)
m.status_bar:set_text('Scanning auctions...') m.status_bar:set_text('Scanning auctions...')
m.scan_id = Aux.scan.start{ m.scan_id = aux.scan.start{
type = 'list', type = 'list',
ignore_owner = true, ignore_owner = true,
queries = { query }, 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 {} m.existing_auctions[key] = m.existing_auctions[key] or {}
local entry local entry
for _, existing_entry in ipairs(m.existing_auctions[key]) do 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 entry = existing_entry
end end
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_blizzard_bid = unit_blizzard_bid,
unit_buyout_price = unit_buyout_price, unit_buyout_price = unit_buyout_price,
duration = duration, duration = duration,
own = Aux.is_player(owner), own = aux.is_player(owner),
count = 0, count = 0,
} }
tinsert(m.existing_auctions[key], entry) 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) private.frame = CreateFrame('Frame', nil, AuxFrame)
m.frame:SetAllPoints() m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) 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('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
m.frame.content:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 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:SetWidth(212)
m.frame.inventory:SetPoint('TOPLEFT', 0, 0) m.frame.inventory:SetPoint('TOPLEFT', 0, 0)
m.frame.inventory:SetPoint('BOTTOMLEFT', 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:SetHeight(173)
m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0) m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0)
m.frame.parameters:SetPoint('TOPRIGHT', 0, 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:SetHeight(228)
m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0) m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0) m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0)
@@ -32,27 +32,27 @@ Aux.post_tab.FRAMES(function(m, public, private)
checkbox:SetScript('OnClick', function() checkbox:SetScript('OnClick', function()
m.refresh = true m.refresh = true
end) 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:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
label:SetText('Show hidden items') label:SetText('Show hidden items')
private.show_hidden_checkbox = checkbox private.show_hidden_checkbox = checkbox
end 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, m.frame.inventory,
function() function()
if arg1 == 'LeftButton' then if arg1 == 'LeftButton' then
m.set_item(this.item_record) m.set_item(this.item_record)
elseif arg1 == 'RightButton' then elseif arg1 == 'RightButton' then
Aux.tab_group:set_tab(1) 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.set_filter(strlower(aux.info.item(this.item_record.item_id).name)..'/exact')
Aux.search_tab.execute(nil, false) aux.search_tab.execute(nil, false)
end end
end, end,
function() function()
Aux.info.set_tooltip(this.item_record.itemstring, this, 'ANCHOR_RIGHT') aux.info.set_tooltip(this.item_record.itemstring, this, 'ANCHOR_RIGHT')
end, end,
function() function()
GameTooltip:Hide() GameTooltip:Hide()
@@ -62,7 +62,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
end end
) )
private.auction_listing = Aux.listing.CreateScrollingTable(m.frame.auctions) private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions)
m.auction_listing:SetColInfo({ m.auction_listing:SetColInfo({
{ name='Auctions', width=.12, align='CENTER' }, { name='Auctions', width=.12, align='CENTER' },
{ name='Left', width=.1, 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:EnableSorting(false)
m.auction_listing:DisableSelection(true) m.auction_listing:DisableSelection(true)
m.auction_listing:SetHandler('OnClick', function(table, row_data, column, button) 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') local unit_start_price, unit_buyout_price = m.undercut(row_data.record, m.stack_size_slider:GetValue(), button == 'RightButton')
if column_index == 3 then if column_index == 3 then
m.stack_size_slider:SetValue(row_data.record.stack_size) m.stack_size_slider:SetValue(row_data.record.stack_size)
@@ -87,7 +87,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
end) end)
do 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:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6) 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 private.status_bar = status_bar
end end
do 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:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
@@ -105,31 +105,31 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.post_button = btn private.post_button = btn
end end
do 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:SetPoint('TOPLEFT', m.post_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Refresh') btn:SetText('Refresh')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
Aux.scan.abort(m.scan_id) aux.scan.abort(m.scan_id)
m.refresh_entries() m.refresh_entries()
m.refresh = true m.refresh = true
end) end)
private.refresh_button = btn private.refresh_button = btn
end end
do do
local item = Aux.gui.item(m.frame.parameters) local item = aux.gui.item(m.frame.parameters)
item:SetPoint('TOPLEFT', 10, -8) item:SetPoint('TOPLEFT', 10, -8)
item:EnableMouse() item:EnableMouse()
item:SetScript('OnReceiveDrag', function() item:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item() local item_info = aux.cursor_item()
if item_info then if item_info then
m.select_item(item_info.item_key) m.select_item(item_info.item_key)
end end
ClearCursor() ClearCursor()
end) end)
item:SetScript('OnClick', function() item:SetScript('OnClick', function()
local item_info = Aux.cursor_item() local item_info = aux.cursor_item()
if item_info then if item_info then
m.select_item(item_info.item_key) m.select_item(item_info.item_key)
end end
@@ -143,7 +143,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
item:SetScript('OnEnter', function() item:SetScript('OnEnter', function()
highlight:Show() highlight:Show()
if m.selected_item then 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
end) end)
item:SetScript('OnLeave', function() item:SetScript('OnLeave', function()
@@ -153,7 +153,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.item = item private.item = item
end end
do do
local slider = Aux.gui.slider(m.frame.parameters) local slider = aux.gui.slider(m.frame.parameters)
slider:SetValueStep(1) slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', 16, -73) slider:SetPoint('TOPLEFT', 16, -73)
slider:SetWidth(190) slider:SetWidth(190)
@@ -184,7 +184,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.stack_size_slider = slider private.stack_size_slider = slider
end end
do do
local slider = Aux.gui.slider(m.frame.parameters) local slider = aux.gui.slider(m.frame.parameters)
slider:SetValueStep(1) slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -30) slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -30)
slider:SetWidth(190) slider:SetWidth(190)
@@ -207,18 +207,18 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.stack_count_slider = slider private.stack_count_slider = slider
end end
do 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:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21)
dropdown:SetWidth(90) dropdown:SetWidth(90)
dropdown:SetHeight(10) 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:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Duration') label:SetText('Duration')
UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown) UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown)
end) 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) label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0)
private.deposit = label private.deposit = label
private.duration_dropdown = dropdown private.duration_dropdown = dropdown
@@ -234,18 +234,18 @@ Aux.post_tab.FRAMES(function(m, public, private)
m.write_settings(settings) m.write_settings(settings)
m.refresh = true m.refresh = true
end) 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:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
label:SetText('Hide this item') label:SetText('Hide this item')
private.hide_checkbox = checkbox private.hide_checkbox = checkbox
end end
do do
local editbox = Aux.gui.editbox(m.frame.parameters) local editbox = aux.gui.editbox(m.frame.parameters)
editbox:SetPoint('TOPRIGHT', -65, -66) editbox:SetPoint('TOPRIGHT', -65, -66)
editbox:SetJustifyH('RIGHT') editbox:SetJustifyH('RIGHT')
editbox:SetWidth(150) editbox:SetWidth(150)
editbox:SetScript('OnTextChanged', function() 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 m.refresh = true
end) end)
editbox:SetScript('OnTabPressed', function() editbox:SetScript('OnTabPressed', function()
@@ -265,19 +265,19 @@ Aux.post_tab.FRAMES(function(m, public, private)
this.pretty:Hide() this.pretty:Hide()
end) end)
editbox:SetScript('OnEditFocusLost', function() 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() this.pretty:Show()
end) 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:SetAllPoints()
editbox.pretty:SetJustifyH('RIGHT') editbox.pretty:SetJustifyH('RIGHT')
do 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:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Starting Price') label:SetText('Unit Starting Price')
end end
do 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:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
label:SetWidth(50) label:SetWidth(50)
label:SetJustifyH('CENTER') label:SetJustifyH('CENTER')
@@ -286,12 +286,12 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.unit_start_price = editbox private.unit_start_price = editbox
end end
do 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:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -18)
editbox:SetJustifyH('RIGHT') editbox:SetJustifyH('RIGHT')
editbox:SetWidth(150) editbox:SetWidth(150)
editbox:SetScript('OnTextChanged', function() 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 m.refresh = true
end) end)
editbox:SetScript('OnTabPressed', function() editbox:SetScript('OnTabPressed', function()
@@ -309,19 +309,19 @@ Aux.post_tab.FRAMES(function(m, public, private)
this.pretty:Hide() this.pretty:Hide()
end) end)
editbox:SetScript('OnEditFocusLost', function() 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() this.pretty:Show()
end) 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:SetAllPoints()
editbox.pretty:SetJustifyH('RIGHT') editbox.pretty:SetJustifyH('RIGHT')
do 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:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Buyout Price') label:SetText('Unit Buyout Price')
end end
do 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:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
label:SetWidth(50) label:SetWidth(50)
label:SetJustifyH('CENTER') label:SetJustifyH('CENTER')
@@ -330,7 +330,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
private.unit_buyout_price = editbox private.unit_buyout_price = editbox
end end
do 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:SetPoint('TOPRIGHT', -15, -143)
btn:SetWidth(150) btn:SetWidth(150)
btn:SetHeight(20) btn:SetHeight(20)
@@ -343,7 +343,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
m.set_unit_buyout_price(this.amount) m.set_unit_buyout_price(this.amount)
end end
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:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText('Historical Value') label:SetText('Historical Value')
private.historical_value_button = btn 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_favorite_searches = {}
aux_recent_searches = {} aux_recent_searches = {}
@@ -86,7 +86,7 @@ end
function private.update_search_listings() function private.update_search_listings()
local favorite_search_rows = {} 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) local name = strsub(favorite_search.prettified, 1, 250)
tinsert(favorite_search_rows, { tinsert(favorite_search_rows, {
cols = {{value=name}}, cols = {{value=name}},
@@ -97,7 +97,7 @@ function private.update_search_listings()
m.favorite_searches_listing:SetData(favorite_search_rows) m.favorite_searches_listing:SetData(favorite_search_rows)
local recent_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) local name = strsub(recent_search.prettified, 1, 250)
tinsert(recent_search_rows, { tinsert(recent_search_rows, {
cols = {{value=name}}, cols = {{value=name}},
@@ -135,7 +135,7 @@ end
function public.add_filter(filter_string) function public.add_filter(filter_string)
local old_filter_string = m.search_box:GetText() 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 if old_filter_string ~= '' then
old_filter_string = old_filter_string..';' old_filter_string = old_filter_string..';'
@@ -146,12 +146,12 @@ end
function private.update_auto_buy_filter() function private.update_auto_buy_filter()
if aux_auto_buy_filter ~= '' then 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 queries then
if getn(queries) > 1 then if getn(queries) > 1 then
Aux.log('Error: The automatic buyout filter may contain only one query') aux.log('Error: The automatic buyout filter may contain only one query')
elseif Aux.util.size(queries[1].blizzard_query) > 0 then 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 does not support Blizzard filters')
else else
m.auto_buy_validator = queries[1].validator m.auto_buy_validator = queries[1].validator
m.auto_buy_filter_button.prettified = queries[1].prettified m.auto_buy_filter_button.prettified = queries[1].prettified
@@ -188,7 +188,7 @@ function private.clear_form()
end end
function private.discard_continuation() function private.discard_continuation()
Aux.scan.abort(m.search_scan_id) aux.scan.abort(m.search_scan_id)
m.current_search().continuation = nil m.current_search().continuation = nil
m.update_continuation() m.update_continuation()
end end
@@ -215,7 +215,7 @@ function private.start_real_time_scan(query, search, continuation)
local next_page local next_page
local new_records = {} local new_records = {}
m.search_scan_id = Aux.scan.start{ m.search_scan_id = aux.scan.start{
type = 'list', type = 'list',
queries = {query}, queries = {query},
auto_buy_validator = search.auto_buy_validator, 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 not ignore_page then
if search.auto_buy then if search.auto_buy then
ctrl.suspend() ctrl.suspend()
Aux.place_bid('list', auction_record.index, auction_record.buyout_price, Aux.f(ctrl.resume, true)) 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.control.thread(aux.control.sleep, 10, aux.f(ctrl.resume, false))
else else
tinsert(new_records, auction_record) tinsert(new_records, auction_record)
end end
@@ -299,7 +299,7 @@ function private.start_search(queries, continuation)
end end
m.search_scan_id = Aux.scan.start{ m.search_scan_id = aux.scan.start{
type = 'list', type = 'list',
queries = queries, queries = queries,
auto_buy_validator = search.auto_buy_validator, auto_buy_validator = search.auto_buy_validator,
@@ -329,8 +329,8 @@ function private.start_search(queries, continuation)
on_auction = function(auction_record, ctrl) on_auction = function(auction_record, ctrl)
if search.auto_buy then if search.auto_buy then
ctrl.suspend() ctrl.suspend()
Aux.place_bid('list', auction_record.index, auction_record.buyout_price, Aux.f(ctrl.resume, true)) 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.control.thread(aux.control.sleep, 10, aux.f(ctrl.resume, false))
elseif getn(search.records) < 1000 then elseif getn(search.records) < 1000 then
tinsert(search.records, auction_record) tinsert(search.records, auction_record)
if getn(search.records) == 1000 then if getn(search.records) == 1000 then
@@ -381,15 +381,15 @@ function public.execute(resume, real_time)
end end
local filter_string = m.search_box:GetText() 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 if not queries then
return return
elseif real_time then elseif real_time then
if getn(queries) > 1 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 return
elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then
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 return
end end
end end
@@ -400,7 +400,7 @@ function public.execute(resume, real_time)
m.current_search().table:SetSelectedRecord() m.current_search().table:SetSelectedRecord()
else else
if filter_string ~= m.current_search().filter_string then 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 else
m.current_search().records = {} m.current_search().records = {}
m.current_search().table:SetDatabase(m.current_search().records) m.current_search().table:SetDatabase(m.current_search().records)
@@ -432,19 +432,19 @@ end
function private.blizzard_page_index(str) function private.blizzard_page_index(str)
if tonumber(str) then if tonumber(str) then
return Aux.util.round(max(0, tonumber(str) - 1)) return aux.util.round(max(0, tonumber(str) - 1))
end end
end end
function private.blizzard_level(str) function private.blizzard_level(str)
if tonumber(str) then 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
end end
function private.test(record) function private.test(record)
return function(index) 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 return auction_info and auction_info.search_signature == record.search_signature
end end
end end
@@ -458,13 +458,13 @@ do
function private.find_auction(record) function private.find_auction(record)
local search = m.current_search() 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 return
end end
Aux.scan.abort(scan_id) aux.scan.abort(scan_id)
state = SEARCHING state = SEARCHING
scan_id = Aux.scan_util.find( scan_id = aux.scan_util.find(
record, record,
m.current_search().status_bar, m.current_search().status_bar,
function() function()
@@ -485,10 +485,10 @@ do
if not record.high_bidder then if not record.high_bidder then
m.bid_button:SetScript('OnClick', function() m.bid_button:SetScript('OnClick', function()
if m.test(record)(index) and search.table:ContainsRecord(record) then 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.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
Aux.info.bid_update(record) aux.info.bid_update(record)
search.table:SetDatabase() 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
end) end)
m.bid_button:Enable() m.bid_button:Enable()
@@ -497,7 +497,7 @@ do
if record.buyout_price > 0 then if record.buyout_price > 0 then
m.buyout_button:SetScript('OnClick', function() m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and search.table:ContainsRecord(record) then 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
end) end)
m.buyout_button:Enable() m.buyout_button:Enable()
@@ -524,7 +524,7 @@ do
elseif state == FOUND and not m.test(selection.record)(found_index) then elseif state == FOUND and not m.test(selection.record)(found_index) then
m.buyout_button:Disable() m.buyout_button:Disable()
m.bid_button:Disable() m.bid_button:Disable()
if not Aux.bid_in_progress() then if not aux.bid_in_progress() then
state = IDLE state = IDLE
end end
end end
@@ -731,12 +731,12 @@ function private.initialize_filter_dropdown()
local function on_click() local function on_click()
UIDropDownMenu_SetSelectedValue(m.filter_dropdown, this.value) UIDropDownMenu_SetSelectedValue(m.filter_dropdown, this.value)
m.filter_button:SetText(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() m.filter_input:Hide()
else else
local _, _, suggestions = Aux.filter.parse_query_string(UIDropDownMenu_GetSelectedValue(m.filter_dropdown)..'/') 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: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.complete = aux.completion.complete(function() return suggestions or {} end)
m.filter_input:Show() m.filter_input:Show()
m.filter_input:SetFocus() m.filter_input:SetFocus()
end end
@@ -759,7 +759,7 @@ function private.get_form()
end end
local name = m.name_input:GetText() 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) add(name)
if m.exact_checkbox:GetChecked() then 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 if name and strsub(name, 1, 1) == '"' and strsub(name, -1, -1) == '"' then
name = strsub(name, 2, -2) name = strsub(name, 2, -2)
end end
m.name_input:SetText(Aux.filter.unquote(filter[2])) m.name_input:SetText(aux.filter.unquote(filter[2]))
elseif filter[1] == 'exact' then elseif filter[1] == 'exact' then
m.exact_checkbox:SetChecked(true) m.exact_checkbox:SetChecked(true)
elseif filter[1] == 'min_level' then elseif filter[1] == 'min_level' then
@@ -824,19 +824,19 @@ function private.set_form(components)
elseif filter[1] == 'usable' then elseif filter[1] == 'usable' then
m.usable_checkbox:SetChecked(true) m.usable_checkbox:SetChecked(true)
elseif filter[1] == 'class' then 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_Initialize(m.class_dropdown, m.initialize_class_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.class_dropdown, class_index) UIDropDownMenu_SetSelectedValue(m.class_dropdown, class_index)
elseif filter[1] == 'subclass' then 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_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, subclass_index) UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, subclass_index)
elseif filter[1] == 'slot' then elseif filter[1] == 'slot' then
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown) -- TODO, wtf, why is this needed 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 elseif filter[1] == 'quality' then
UIDropDownMenu_Initialize(m.quality_dropdown, m.initialize_quality_dropdown) -- TODO, wtf, why is this needed 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
end end
@@ -845,22 +845,22 @@ function private.set_form(components)
end end
function private.import_query_string() 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 if components then
m.set_form(components) m.set_form(components)
else else
Aux.log(error) aux.log(error)
end end
end end
function private.export_query_string() 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 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.filter_input:ClearFocus()
m.update_filter_display() m.update_filter_display()
else else
Aux.log(error) aux.log(error)
end end
end end
@@ -870,20 +870,20 @@ function private.add_post_component()
local name = UIDropDownMenu_GetSelectedValue(m.filter_dropdown) local name = UIDropDownMenu_GetSelectedValue(m.filter_dropdown)
if name then if name then
local filter = name 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() 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 if arity and arity < 2 then
Aux.log('Invalid operator suffix') aux.log('Invalid operator suffix')
return return
end end
filter = filter..(arity or '') filter = filter..(arity or '')
end 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() filter = filter..'/'..m.filter_input:GetText()
end end
local components, error, suggestions = Aux.filter.parse_query_string(filter) local components, error, suggestions = aux.filter.parse_query_string(filter)
if components then if components then
tinsert(m.post_components, components.post[1]) tinsert(m.post_components, components.post[1])
@@ -891,7 +891,7 @@ function private.add_post_component()
m.filter_input:SetText('') m.filter_input:SetText('')
m.filter_input:ClearFocus() m.filter_input:ClearFocus()
else else
Aux.log(error) aux.log(error)
end end
end end
end end
@@ -902,10 +902,10 @@ function private.remove_post_filter()
end end
function private.update_filter_display() 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 width_scale = max(200/m.filter_display:GetStringWidth())
local height_scale = min((200 / lines) / 18) local height_scale = min((200 / lines) / 18)
m.filter_display.scale_frame:SetScale(min(1, width_scale, height_scale)) 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 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) private.frame = CreateFrame('Frame', nil, AuxFrame)
m.frame:SetAllPoints() m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide() 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.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.results:SetAllPoints(AuxFrameContent)
m.frame.saved = CreateFrame('Frame', nil, m.frame) m.frame.saved = CreateFrame('Frame', nil, m.frame)
m.frame.saved:SetAllPoints(AuxFrameContent) 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:SetWidth(378.5)
m.frame.saved.favorite:SetPoint('TOPLEFT', 0, 0) m.frame.saved.favorite:SetPoint('TOPLEFT', 0, 0)
m.frame.saved.favorite:SetPoint('BOTTOMLEFT', 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:SetWidth(378.5)
m.frame.saved.recent:SetPoint('TOPRIGHT', 0, 0) m.frame.saved.recent:SetPoint('TOPRIGHT', 0, 0)
m.frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0) m.frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0)
do do
local btn = Aux.gui.button(m.frame) local btn = aux.gui.button(m.frame)
btn:SetPoint('TOPLEFT', 0, 0) btn:SetPoint('TOPLEFT', 0, 0)
btn:SetWidth(42) btn:SetWidth(42)
btn:SetHeight(42) btn:SetHeight(42)
@@ -50,7 +50,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
do do
local panel = CreateFrame('Frame', nil, m.frame) local panel = CreateFrame('Frame', nil, m.frame)
panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]} 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('LEFT', m.settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 0) panel:SetPoint('RIGHT', 0, 0)
panel:SetHeight(42) panel:SetHeight(42)
@@ -65,7 +65,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.controls = panel private.controls = panel
end end
do do
local editbox = Aux.gui.editbox(m.settings) local editbox = aux.gui.editbox(m.settings)
editbox:SetPoint('LEFT', 75, 0) editbox:SetPoint('LEFT', 75, 0)
editbox:SetWidth(50) editbox:SetWidth(50)
editbox:SetNumeric(true) editbox:SetNumeric(true)
@@ -79,19 +79,19 @@ Aux.search_tab.FRAMES(function(m, public, private)
end) end)
editbox:SetScript('OnTextChanged', function() editbox:SetScript('OnTextChanged', function()
if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then 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 else
this:SetBackdropColor(unpack(Aux.gui.config.off_color)) this:SetBackdropColor(unpack(aux.gui.config.off_color))
end end
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:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages') 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 private.first_page_input = editbox
end end
do 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:SetPoint('LEFT', m.first_page_input, 'RIGHT', 10, 0)
editbox:SetWidth(50) editbox:SetWidth(50)
editbox:SetNumeric(true) editbox:SetNumeric(true)
@@ -105,19 +105,19 @@ Aux.search_tab.FRAMES(function(m, public, private)
end) end)
editbox:SetScript('OnTextChanged', function() editbox:SetScript('OnTextChanged', function()
if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then 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 else
this:SetBackdropColor(unpack(Aux.gui.config.off_color)) this:SetBackdropColor(unpack(aux.gui.config.off_color))
end end
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:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
label:SetText('-') 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 private.last_page_input = editbox
end end
do do
local btn = Aux.gui.checkbutton(m.settings) local btn = aux.gui.checkbutton(m.settings)
btn:SetPoint('LEFT', 230, 0) btn:SetPoint('LEFT', 230, 0)
btn:SetWidth(140) btn:SetWidth(140)
btn:SetHeight(25) btn:SetHeight(25)
@@ -132,7 +132,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
public.real_time_button = btn public.real_time_button = btn
end end
do 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:SetPoint('LEFT', m.real_time_button, 'RIGHT', 15, 0)
btn:SetWidth(140) btn:SetWidth(140)
btn:SetHeight(25) btn:SetHeight(25)
@@ -147,7 +147,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.auto_buy_button = btn private.auto_buy_button = btn
end end
do 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:SetPoint('LEFT', m.auto_buy_button, 'RIGHT', 15, 0)
btn:SetWidth(140) btn:SetWidth(140)
btn:SetHeight(25) btn:SetHeight(25)
@@ -175,7 +175,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.auto_buy_filter_button = btn private.auto_buy_filter_button = btn
end end
do do
local btn = Aux.gui.button(m.controls, 25) local btn = aux.gui.button(m.controls, 25)
btn:SetPoint('LEFT', 5, 0) btn:SetPoint('LEFT', 5, 0)
btn:SetWidth(30) btn:SetWidth(30)
btn:SetHeight(25) btn:SetHeight(25)
@@ -184,7 +184,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.previous_button = btn private.previous_button = btn
end end
do 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:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0)
btn:SetWidth(30) btn:SetWidth(30)
btn:SetHeight(25) btn:SetHeight(25)
@@ -193,7 +193,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.next_button = btn private.next_button = btn
end end
do 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:SetPoint('RIGHT', -5, 0)
btn:SetWidth(70) btn:SetWidth(70)
btn:SetHeight(25) btn:SetHeight(25)
@@ -208,19 +208,19 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.start_button = btn private.start_button = btn
end end
do 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:SetPoint('RIGHT', -5, 0)
btn:SetWidth(70) btn:SetWidth(70)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('Stop') btn:SetText('Stop')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
Aux.scan.abort(m.search_scan_id) aux.scan.abort(m.search_scan_id)
end) end)
btn:Hide() btn:Hide()
private.stop_button = btn private.stop_button = btn
end end
do 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:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
btn:SetWidth(70) btn:SetWidth(70)
btn:SetHeight(25) btn:SetHeight(25)
@@ -231,10 +231,10 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.resume_button = btn private.resume_button = btn
end end
do do
local editbox = Aux.gui.editbox(m.controls) local editbox = aux.gui.editbox(m.controls)
editbox:SetMaxLetters(nil) editbox:SetMaxLetters(nil)
editbox:EnableMouse(1) 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:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
editbox:SetHeight(25) editbox:SetHeight(25)
editbox:SetScript('OnChar', function() editbox:SetScript('OnChar', function()
@@ -245,7 +245,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
end) end)
editbox:SetScript('OnEnterPressed', m.execute) editbox:SetScript('OnEnterPressed', m.execute)
editbox:SetScript('OnReceiveDrag', function() 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 if item_info then
m.set_filter(strlower(item_info.name)..'/exact') m.set_filter(strlower(item_info.name)..'/exact')
m.execute(nil, false) m.execute(nil, false)
@@ -255,10 +255,10 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.search_box = editbox private.search_box = editbox
end end
do do
Aux.gui.horizontal_line(m.frame, -40) aux.gui.horizontal_line(m.frame, -40)
end end
do 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:SetPoint('BOTTOMLEFT', AuxFrameContent, 'TOPLEFT', 10, 8)
btn:SetWidth(243) btn:SetWidth(243)
btn:SetHeight(22) btn:SetHeight(22)
@@ -267,7 +267,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.search_results_button = btn private.search_results_button = btn
end end
do 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:SetPoint('TOPLEFT', m.search_results_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243) btn:SetWidth(243)
btn:SetHeight(22) btn:SetHeight(22)
@@ -276,7 +276,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.saved_searches_button = btn private.saved_searches_button = btn
end end
do 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:SetPoint('TOPLEFT', m.saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243) btn:SetWidth(243)
btn:SetHeight(22) btn:SetHeight(22)
@@ -292,7 +292,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.status_bar_frame = frame private.status_bar_frame = frame
end end
do 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:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
@@ -301,7 +301,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.bid_button = btn private.bid_button = btn
end end
do 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:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
@@ -310,7 +310,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.buyout_button = btn private.buyout_button = btn
end end
do 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:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
@@ -321,24 +321,24 @@ Aux.search_tab.FRAMES(function(m, public, private)
end) end)
end end
do 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:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Favorite') btn:SetText('Favorite')
btn:SetScript('OnClick', function() 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 if filters then
tinsert(aux_favorite_searches, 1, { tinsert(aux_favorite_searches, 1, {
filter_string = m.search_box:GetText(), 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 end
m.update_search_listings() m.update_search_listings()
end) end)
end end
do 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:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0)
btn1:SetWidth(80) btn1:SetWidth(80)
btn1:SetHeight(24) btn1:SetHeight(24)
@@ -348,14 +348,14 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.execute() m.execute()
end) 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:SetPoint('LEFT', btn1, 'RIGHT', 5, 0)
btn2:SetWidth(80) btn2:SetWidth(80)
btn2:SetHeight(24) btn2:SetHeight(24)
btn2:SetText('Export') btn2:SetText('Export')
btn2:SetScript('OnClick', m.export_query_string) 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:SetPoint('LEFT', btn2, 'RIGHT', 5, 0)
btn3:SetWidth(80) btn3:SetWidth(80)
btn3:SetHeight(24) btn3:SetHeight(24)
@@ -363,8 +363,8 @@ Aux.search_tab.FRAMES(function(m, public, private)
btn3:SetScript('OnClick', m.import_query_string) btn3:SetScript('OnClick', m.import_query_string)
end end
do do
local editbox = Aux.gui.editbox(m.frame.filter) local editbox = aux.gui.editbox(m.frame.filter)
editbox.complete_item = Aux.completion.complete(function() return aux_auctionable_items end) editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -26) editbox:SetPoint('TOPLEFT', 14, -26)
editbox:SetWidth(260) editbox:SetWidth(260)
editbox:SetScript('OnChar', function() editbox:SetScript('OnChar', function()
@@ -379,8 +379,8 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.min_level_input:SetFocus() m.min_level_input:SetFocus()
end end
end) end)
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox)) editbox:SetScript('OnEnterPressed', aux.f(editbox.ClearFocus, editbox))
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:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name') label:SetText('Name')
private.name_input = editbox private.name_input = editbox
@@ -390,13 +390,13 @@ Aux.search_tab.FRAMES(function(m, public, private)
checkbox:SetWidth(22) checkbox:SetWidth(22)
checkbox:SetHeight(22) checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', m.name_input, 'TOPRIGHT', 10, 0) 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:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', 1, -3)
label:SetText('Exact') label:SetText('Exact')
private.exact_checkbox = checkbox private.exact_checkbox = checkbox
end end
do 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:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -28)
editbox:SetWidth(125) editbox:SetWidth(125)
editbox:SetNumeric(true) editbox:SetNumeric(true)
@@ -408,14 +408,14 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.max_level_input:SetFocus() m.max_level_input:SetFocus()
end end
end) end)
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox)) editbox:SetScript('OnEnterPressed', aux.f(editbox.ClearFocus, editbox))
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:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Level Range') label:SetText('Level Range')
private.min_level_input = editbox private.min_level_input = editbox
end end
do 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:SetPoint('TOPLEFT', m.min_level_input, 'TOPRIGHT', 10, 0)
editbox:SetWidth(125) editbox:SetWidth(125)
editbox:SetNumeric(true) editbox:SetNumeric(true)
@@ -427,8 +427,8 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.name_input:SetFocus() m.name_input:SetFocus()
end end
end) end)
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox)) editbox:SetScript('OnEnterPressed', aux.f(editbox.ClearFocus, editbox))
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, 0) label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText('-') label:SetText('-')
private.max_level_input = editbox private.max_level_input = editbox
@@ -438,17 +438,17 @@ Aux.search_tab.FRAMES(function(m, public, private)
checkbox:SetWidth(22) checkbox:SetWidth(22)
checkbox:SetHeight(22) checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', m.max_level_input, 'TOPRIGHT', 10, 0) 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:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', 1, -3)
label:SetText('Usable') label:SetText('Usable')
private.usable_checkbox = checkbox private.usable_checkbox = checkbox
end end
do 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:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -26)
dropdown:SetWidth(300) dropdown:SetWidth(300)
dropdown:SetHeight(10) 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:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Class') label:SetText('Item Class')
UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown)
@@ -458,11 +458,11 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.class_dropdown = dropdown private.class_dropdown = dropdown
end end
do 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:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -22)
dropdown:SetWidth(300) dropdown:SetWidth(300)
dropdown:SetHeight(10) 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:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Subclass') label:SetText('Item Subclass')
UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown)
@@ -472,11 +472,11 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.subclass_dropdown = dropdown private.subclass_dropdown = dropdown
end end
do 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:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -22)
dropdown:SetWidth(300) dropdown:SetWidth(300)
dropdown:SetHeight(10) 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:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Slot') label:SetText('Item Slot')
UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown)
@@ -486,11 +486,11 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.slot_dropdown = dropdown private.slot_dropdown = dropdown
end end
do 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:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -22)
dropdown:SetWidth(300) dropdown:SetWidth(300)
dropdown:SetHeight(10) 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:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Min Rarity') label:SetText('Min Rarity')
UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown)
@@ -499,9 +499,9 @@ Aux.search_tab.FRAMES(function(m, public, private)
end) end)
private.quality_dropdown = dropdown private.quality_dropdown = dropdown
end end
Aux.gui.vertical_line(m.frame.filter, 332) aux.gui.vertical_line(m.frame.filter, 332)
do do
local dropdown = Aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPRIGHT', -177, -10) dropdown:SetPoint('TOPRIGHT', -177, -10)
dropdown:SetWidth(150) dropdown:SetWidth(150)
dropdown:SetHeight(10) dropdown:SetHeight(10)
@@ -510,13 +510,13 @@ Aux.search_tab.FRAMES(function(m, public, private)
UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown) UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown)
end) end)
getglobal(dropdown:GetName()..'Text'):Hide() 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:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
label:SetText('Post Filter') label:SetText('Post Filter')
private.filter_dropdown = dropdown private.filter_dropdown = dropdown
end end
do do
local btn = Aux.gui.button(m.frame.filter, 16) local btn = aux.gui.button(m.frame.filter, 16)
btn:SetWidth(150) btn:SetWidth(150)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetPoint('CENTER', m.filter_dropdown, 'CENTER', 0, 0) 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 private.filter_button = btn
end end
do 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:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0)
input:SetWidth(150) input:SetWidth(150)
input:SetHeight(25) input:SetHeight(25)
@@ -547,10 +547,10 @@ Aux.search_tab.FRAMES(function(m, public, private)
frame:SetWidth(395) frame:SetWidth(395)
frame:SetHeight(270) frame:SetHeight(270)
frame:SetPoint('TOPLEFT', 348, -50) frame:SetPoint('TOPLEFT', 348, -50)
Aux.gui.set_content_style(frame) aux.gui.set_content_style(frame)
local scale_frame = CreateFrame('Frame', nil, frame) local scale_frame = CreateFrame('Frame', nil, frame)
scale_frame:SetAllPoints() 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:SetAllPoints()
display:SetJustifyH('LEFT') display:SetJustifyH('LEFT')
display:SetJustifyV('TOP') display:SetJustifyV('TOP')
@@ -561,12 +561,12 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.status_bars = {} private.status_bars = {}
private.tables = {} private.tables = {}
for _=1,5 do 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:SetAllPoints(m.status_bar_frame)
status_bar:Hide() status_bar:Hide()
tinsert(m.status_bars, status_bar) 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) table:SetHandler('OnCellClick', function(cell, button)
if IsAltKeyDown() and m.current_search().table:GetSelection().record == cell.row.data.record then if IsAltKeyDown() and m.current_search().table:GetSelection().record == cell.row.data.record then
if button == 'LeftButton' and m.buyout_button:IsEnabled() then if button == 'LeftButton' and m.buyout_button:IsEnabled() then
@@ -629,7 +629,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
end 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:SetColInfo({{name='Recent Searches', width=1}})
m.recent_searches_listing:EnableSorting(false) m.recent_searches_listing:EnableSorting(false)
m.recent_searches_listing:DisableSelection(true) 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('OnEnter', handlers.OnEnter)
m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave) 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:SetColInfo({{name='Favorite Searches', width=1}})
m.favorite_searches_listing:EnableSorting(false) m.favorite_searches_listing:EnableSorting(false)
m.favorite_searches_listing:DisableSelection(true) 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() function public:complete_filter()
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
@@ -8,12 +8,12 @@ function public:complete_filter()
local filter_string = this:GetText() local filter_string = this:GetText()
local completed_filter_string = ({strfind(filter_string, '([^;]*)/[^/;]*$')})[3] 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, '([^/;]*)$') local start_index, _, current_modifier = strfind(filter_string, '([^/;]*)$')
current_modifier = current_modifier or '' 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 if strsub(strupper(suggestion), 1, strlen(current_modifier)) == strupper(current_modifier) then
this:SetText(strlower(strsub(filter_string, 1, start_index - 1).. suggestion)) this:SetText(strlower(strsub(filter_string, 1, start_index - 1).. suggestion))
this:HighlightText(strlen(filter_string), -1) this:HighlightText(strlen(filter_string), -1)
@@ -30,7 +30,7 @@ function public.complete(options)
local text = self:GetText() 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 if strsub(strupper(item_name), 1, strlen(text)) == strupper(text) then
self:SetText(strlower(item_name)) self:SetText(strlower(item_name))
self:HighlightText(strlen(text), -1) 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() function public.pass()
end end
@@ -141,13 +141,11 @@ do
end end
end end
function public.join(array, separator) function public.join(parts, separator)
local str = '' local str = parts[1]
for i, element in ipairs(array) do for i=2,getn(parts) do
if i > 1 then if not parts[i] then break end
str = str..separator str = str..separator..parts[i]
end
str = str..element
end end
return str return str
end end
@@ -226,11 +224,10 @@ function public.bag_type(bag)
return 1 return 1
end end
local link = GetInventoryItemLink('player', ContainerIDToInventoryID(bag)) if GetInventoryItemLink('player', ContainerIDToInventoryID(bag)) then
if link then local item_id = aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag)))
local item_id = Aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag))) local item_info = aux.info.item(item_id)
local item_info = Aux.info.item(item_id) return aux.info.item_subclass_index(3, item_info.subclass)
return Aux.info.item_subclass_index(3, item_info.subclass)
end end
end end
@@ -264,7 +261,7 @@ function public.format_money(money, exact, color)
-- Round to nearest silver -- Round to nearest silver
money = floor(money / 100 + 0.5) * 100 money = floor(money / 100 + 0.5) * 100
end end
local g, s, c = Aux.money.to_GSC(money) local g, s, c = aux.money.to_GSC(money)
local gsc = '' 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) function private.default_filter(str)
return { return {
input_type = '', input_type = '',
validator = function() validator = function()
return function(auction_record) 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) 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)
end end
@@ -19,7 +19,7 @@ public.filters = {
input_type = '', input_type = '',
validator = function() validator = function()
return function(auction_record) 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
end, end,
}, },
@@ -35,7 +35,7 @@ public.filters = {
input_type = 'string', input_type = 'string',
validator = function(name) validator = function(name)
return function(auction_record) 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
end end
}, },
@@ -43,7 +43,7 @@ public.filters = {
['left'] = { ['left'] = {
input_type = {'30m', '2h', '8h', '24h'}, input_type = {'30m', '2h', '8h', '24h'},
validator = function(duration) 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 function(auction_record)
return auction_record.duration == code return auction_record.duration == code
end end
@@ -53,7 +53,7 @@ public.filters = {
['rarity'] = { ['rarity'] = {
input_type = {'poor', 'common', 'uncommon', 'rare', 'epic'}, input_type = {'poor', 'common', 'uncommon', 'rare', 'epic'},
validator = function(rarity) 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 function(auction_record)
return auction_record.quality == code return auction_record.quality == code
end end
@@ -119,8 +119,8 @@ public.filters = {
validator = function(pct) validator = function(pct)
return function(auction_record) return function(auction_record)
return auction_record.unit_buyout_price > 0 return auction_record.unit_buyout_price > 0
and Aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key)
and auction_record.unit_buyout_price / Aux.history.value(auction_record.item_key) * 100 <= pct and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
end end
end end
}, },
@@ -130,8 +130,8 @@ public.filters = {
validator = function(pct) validator = function(pct)
return function(auction_record) return function(auction_record)
return auction_record.unit_buyout_price > 0 return auction_record.unit_buyout_price > 0
and Aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key)
and auction_record.unit_buyout_price / Aux.history.value(auction_record.item_key) * 100 <= pct and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
end end
end end
}, },
@@ -140,7 +140,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
return Aux.history.value(auction_record.item_key) and Aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount return 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
end end
}, },
@@ -149,7 +149,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
return auction_record.buyout_price > 0 and Aux.history.value(auction_record.item_key) and Aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount return auction_record.buyout_price > 0 and 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
end end
}, },
@@ -158,7 +158,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local disenchant_value = Aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level) local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
return disenchant_value and disenchant_value - auction_record.bid_price >= amount return disenchant_value and disenchant_value - auction_record.bid_price >= amount
end end
end end
@@ -168,7 +168,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local disenchant_value = Aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level) local disenchant_value = 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 return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
end end
end end
@@ -178,7 +178,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local vendor_price = Aux.cache.merchant_info(auction_record.item_id) local vendor_price = aux.cache.merchant_info(auction_record.item_id)
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
end end
end end
@@ -188,7 +188,7 @@ public.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local vendor_price = Aux.cache.merchant_info(auction_record.item_id) local vendor_price = 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 return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
end end
end end
@@ -240,27 +240,27 @@ function private.blizzard_filter_parser()
else else
return nil, 'Erroneous level range modifier' return nil, 'Erroneous level range modifier'
end end
elseif Aux.info.item_class_index(str) and not (filters.class and not filters.subclass and str == strlower(({ GetAuctionItemClasses() })[10])) then 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) class_index = aux.info.item_class_index(str)
if not filters.class then if not filters.class then
filter = {'class', str} filter = {'class', str}
else else
return nil, 'Erroneous item class modifier' return nil, 'Erroneous item class modifier'
end end
elseif class_index and Aux.info.item_subclass_index(class_index, str) then elseif class_index and aux.info.item_subclass_index(class_index, str) then
subclass_index = Aux.info.item_subclass_index(class_index, str) subclass_index = aux.info.item_subclass_index(class_index, str)
if not filters.subclass then if not filters.subclass then
filter = {'subclass', str} filter = {'subclass', str}
else else
return nil, 'Erroneous item subclass modifier' return nil, 'Erroneous item subclass modifier'
end 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 if not filters.slot then
filter = {'slot', str} filter = {'slot', str}
else else
return nil, 'Erroneous item slot modifier' return nil, 'Erroneous item slot modifier'
end end
elseif Aux.info.item_quality_index(str) then elseif aux.info.item_quality_index(str) then
if not filters.quality then if not filters.quality then
filter = {'quality', str} filter = {'quality', str}
else else
@@ -310,7 +310,7 @@ end
function private.parse_parameter(input_type, str) function private.parse_parameter(input_type, str)
if input_type == 'money' then if input_type == 'money' then
local money = Aux.money.from_string(str) local money = aux.money.from_string(str)
if money and money > 0 then if money and money > 0 then
return money return money
end end
@@ -324,7 +324,7 @@ function private.parse_parameter(input_type, str)
return str return str
end end
elseif type(input_type) == 'table' then 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 if choice then
return choice return choice
end end
@@ -334,7 +334,7 @@ end
function public.parse_query_string(str) function public.parse_query_string(str)
local components = { blizzard = {}, post = {} } local components = { blizzard = {}, post = {} }
local blizzard_filter_parser = m.blizzard_filter_parser() 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 local i = 1
while parts[i] do while parts[i] do
@@ -412,16 +412,16 @@ function public.query(query_string)
end end
function public.queries(query_string) function public.queries(query_string)
local parts = Aux.util.split(query_string, ';') local parts = aux.util.split(query_string, ';')
local queries = {} local queries = {}
for _, str in ipairs(parts) do for _, str in ipairs(parts) do
str = Aux.util.trim(str) str = aux.util.trim(str)
local query, _, error = m.query(str) local query, _, error = m.query(str)
if not query then if not query then
Aux.log('Invalid filter:', error) aux.log('Invalid filter:', error)
return return
else else
tinsert(queries, query) tinsert(queries, query)
@@ -469,7 +469,7 @@ function private.suggestions(components)
end end
-- subclasses -- 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 if class_index and not blizzard_filters.subclass then
for _, subclass in ipairs({ GetAuctionItemSubClasses(class_index) }) do for _, subclass in ipairs({ GetAuctionItemSubClasses(class_index) }) do
tinsert(suggestions, subclass) tinsert(suggestions, subclass)
@@ -477,9 +477,9 @@ function private.suggestions(components)
end end
-- slots -- 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 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)) tinsert(suggestions, getglobal(invtype))
end end
end end
@@ -572,9 +572,9 @@ function private.prettified_query_string(components)
for _, filter in components.blizzard do for _, filter in components.blizzard do
blizzard_filters[filter[1]] = filter[2] or true blizzard_filters[filter[1]] = filter[2] or true
if filter[1] == 'exact' then 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 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
end end
@@ -582,7 +582,7 @@ function private.prettified_query_string(components)
if m.unquote(blizzard_filters.name) == '' then if m.unquote(blizzard_filters.name) == '' then
prettified.prepend('|cffff0000'..'No Filter'..'|r') prettified.prepend('|cffff0000'..'No Filter'..'|r')
else 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
end end
@@ -623,11 +623,11 @@ function private.blizzard_query(components)
local item_info, class_index, subclass_index, slot_index local item_info, class_index, subclass_index, slot_index
if filters.exact then if filters.exact then
local item_id = Aux.cache.item_id(filters.name) local item_id = aux.cache.item_id(filters.name)
item_info = Aux.info.item(item_id) item_info = aux.info.item(item_id)
class_index = item_info and Aux.info.item_class_index(item_info.class) 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) 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) slot_index = subclass_index and item_info.slot and aux.info.item_slot_index(class_index, subclass_index, item_info.slot)
end end
if item_info then if item_info then
@@ -641,11 +641,11 @@ function private.blizzard_query(components)
else else
query.min_level = tonumber(filters.min_level) query.min_level = tonumber(filters.min_level)
query.max_level = tonumber(filters.max_level) query.max_level = tonumber(filters.max_level)
query.class = filters.class and filters.class and Aux.info.item_class_index(filters.class) 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.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.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.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 end
return query return query
@@ -662,7 +662,7 @@ function private.validator(components)
return function(record) return function(record)
for _, filter in components.blizzard do 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 return false
end end
end end
@@ -678,15 +678,15 @@ function private.validator(components)
if name == 'not' then if name == 'not' then
tinsert(stack, not args[1]) tinsert(stack, not args[1])
elseif name == 'and' then elseif name == 'and' then
tinsert(stack, Aux.util.all(args, Aux.util.id)) tinsert(stack, aux.util.all(args, aux.util.id))
elseif name == 'or' then elseif name == 'or' then
tinsert(stack, Aux.util.any(args, Aux.util.id)) tinsert(stack, aux.util.any(args, aux.util.id))
end end
elseif type == 'filter' then elseif type == 'filter' then
tinsert(stack, validators[i](record) and true or false) tinsert(stack, validators[i](record) and true or false)
end end
end end
return Aux.util.all(stack, Aux.util.id) return aux.util.all(stack, aux.util.id)
end end
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 local TOOLTIP_LENGTH = 30
@@ -133,8 +133,8 @@ function public.auction(index, query_type)
hyperlink = hyperlink, hyperlink = hyperlink,
itemstring = item_info.itemstring, itemstring = item_info.itemstring,
item_key = item_id..':'..suffix_id, 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 '?')}, ':'), 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 '?')}, ':'), 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, name = name,
texture = texture, texture = texture,
@@ -172,12 +172,12 @@ end
function public.bid_update(auction_record) function public.bid_update(auction_record)
auction_record.high_bid = auction_record.bid_price auction_record.high_bid = auction_record.bid_price
auction_record.blizzard_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.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_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
auction_record.high_bidder = 1 auction_record.high_bidder = 1
auction_record.search_signature = 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 end
function public.set_tooltip(itemstring, owner, anchor) function public.set_tooltip(itemstring, owner, anchor)
@@ -222,7 +222,7 @@ function public.set_shopping_tooltip(slot)
end end
function public.tooltip_match(entry, tooltip) 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 left_match = line.left_text and strupper(line.left_text) == strupper(entry)
local right_match = line.right_text and strupper(line.right_text) == strupper(entry) local right_match = line.right_text and strupper(line.right_text) == strupper(entry)
return left_match or right_match return left_match or right_match
@@ -258,7 +258,7 @@ function public.load_tooltip(frame, tooltip)
end end
function public.display_name(item_id, no_brackets, no_color) 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 if item_info then
local name = item_info.name local name = item_info.name
if not no_brackets then if not no_brackets then
@@ -389,7 +389,7 @@ function public.item(item_id, suffix_id)
slot = slot, slot = slot,
max_stack = max_stack, max_stack = max_stack,
texture = texture, texture = texture,
} or Aux.cache.item_info(item_id) } or aux.cache.item_info(item_id)
end end
function public.item_class_index(item_class) 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 GOLD_TEXT = '|cffffd70ag|r'
local SILVER_TEXT = '|cffc7c7cfs|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 if copper > 0 or gold == 0 and silver == 0 then
tinsert(parts, m.format_number(copper, pad, decimal_points, color)..copper_text) tinsert(parts, m.format_number(copper, pad, decimal_points, color)..copper_text)
end end
text = Aux.util.join(parts, ' ') text = aux.util.join(parts, ' ')
else else
if gold > 0 then 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 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 = {} aux_datasets = {}
@@ -6,7 +6,7 @@ do
local realm, faction local realm, faction
function public.LOAD() 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') realm = GetCVar('realmName')
end end
@@ -60,8 +60,8 @@ function public.read_list(schema, str)
local separator = schema[2] local separator = schema[2]
local element_type = schema[3] local element_type = schema[3]
local parts = Aux.util.split(str, separator) local parts = aux.util.split(str, separator)
return Aux.util.map(parts, function(part) return aux.util.map(parts, function(part)
return m.read(element_type, part) return m.read(element_type, part)
end) end)
end end
@@ -69,16 +69,16 @@ end
function public.write_list(schema, list) function public.write_list(schema, list)
local separator = schema[2] local separator = schema[2]
local element_type = schema[3] 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) return m.write(element_type, element)
end) end)
return Aux.util.join(parts, separator) return aux.util.join(parts, separator)
end end
function public.read_record(schema, str) function public.read_record(schema, str)
local separator = schema[2] local separator = schema[2]
local record = {} local record = {}
local parts = Aux.util.split(str, separator) local parts = aux.util.split(str, separator)
for i=3,getn(schema) do for i=3,getn(schema) do
local key, type = next(schema[i]) local key, type = next(schema[i])
record[key] = m.read(type, parts[i - 2]) record[key] = m.read(type, parts[i - 2])
@@ -91,9 +91,10 @@ function public.write_record(schema, record)
local parts = {} local parts = {}
for i=3,getn(schema) do for i=3,getn(schema) do
local key, type = next(schema[i]) local key, type = next(schema[i])
aux.log(type, record[key], m.write(type, record[key]))
tinsert(parts, m.write(type, record[key])) tinsert(parts, m.write(type, record[key]))
end end
return Aux.util.join(parts, separator) return aux.util.join(parts, separator)
end end
function public.serialize(data, separator, compactor) 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) function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
local function test(index) 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 return auction_info and auction_info.search_signature == auction_record.search_signature
end end
@@ -12,7 +12,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
if auction_record.blizzard_query then 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.first_page = auction_record.page
blizzard_query1.last_page = auction_record.page blizzard_query1.last_page = auction_record.page
tinsert(queries, { 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 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.first_page = auction_record.page - 1
blizzard_query2.last_page = auction_record.page - 1 blizzard_query2.last_page = auction_record.page - 1
tinsert(queries, { tinsert(queries, {
@@ -29,14 +29,14 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
end end
local item_query = m.item_query(auction_record.item_id, 1, 1) 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) tinsert(queries, item_query)
end end
end end
local found local found
return Aux.scan.start{ return aux.scan.start{
type = auction_record.query_type, type = auction_record.query_type,
queries = queries, queries = queries,
on_scan_start = function() on_scan_start = function()
@@ -72,10 +72,10 @@ end
function public.item_query(item_id, first_page, last_page) 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 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.first_page = first_page
query.blizzard_query.last_page = last_page query.blizzard_query.last_page = last_page
return { 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.LT = {}
public.EQ = {} public.EQ = {}