editbox changes

This commit is contained in:
Manuel Simon Hirsig
2016-08-19 16:03:29 +02:00
parent 829483900e
commit 37e789184b
18 changed files with 422 additions and 404 deletions
+41 -41
View File
@@ -6,27 +6,27 @@ MAX_ITEM_ID = 30000
items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}} items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} } merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} }
_G.aux_items = {} g.aux_items = {}
_G.aux_item_ids = {} g.aux_item_ids = {}
_G.aux_auctionable_items = {} g.aux_auctionable_items = {}
_G.aux_merchant_buy = {} g.aux_merchant_buy = {}
_G.aux_merchant_sell = {} g.aux_merchant_sell = {}
_G.aux_characters = {} g.aux_characters = {}
function m.LOAD() function LOAD()
m.scan_wdb() scan_wdb()
aux.control.event_listener('MERCHANT_SHOW', m.on_merchant_show) aux.control.event_listener('MERCHANT_SHOW', on_merchant_show)
aux.control.event_listener('MERCHANT_CLOSED', m.on_merchant_closed) aux.control.event_listener('MERCHANT_CLOSED', on_merchant_closed)
aux.control.event_listener('MERCHANT_UPDATE', m.on_merchant_update) aux.control.event_listener('MERCHANT_UPDATE', on_merchant_update)
aux.control.event_listener('BAG_UPDATE', m.on_bag_update) aux.control.event_listener('BAG_UPDATE', on_bag_update)
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update) CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', merchant_on_update)
aux.control.event_listener('NEW_AUCTION_UPDATE', function() aux.control.event_listener('NEW_AUCTION_UPDATE', function()
for _, info in {aux.info.auction_sell_item()} do for _, info in {aux.info.auction_sell_item()} do
for _, item_id in {aux.cache.item_id(info.name)} do for _, item_id in {aux.cache.item_id(info.name)} do
_G.aux_merchant_sell[aux.cache.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count) g.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)
@@ -36,8 +36,8 @@ do
local sell_scan_countdown, incomplete_buy_data local sell_scan_countdown, incomplete_buy_data
function on_merchant_show() function on_merchant_show()
m.merchant_sell_scan() merchant_sell_scan()
incomplete_buy_data = not m.merchant_buy_scan() incomplete_buy_data = not merchant_buy_scan()
end end
function on_merchant_closed() function on_merchant_closed()
@@ -47,7 +47,7 @@ do
function on_merchant_update() function on_merchant_update()
if incomplete_buy_data then if incomplete_buy_data then
incomplete_buy_data = not m.merchant_buy_scan() incomplete_buy_data = not merchant_buy_scan()
end end
end end
@@ -60,7 +60,7 @@ do
function merchant_on_update() function merchant_on_update()
if sell_scan_countdown == 0 then if sell_scan_countdown == 0 then
sell_scan_countdown = nil sell_scan_countdown = nil
m.merchant_sell_scan() merchant_sell_scan()
elseif sell_scan_countdown then elseif sell_scan_countdown then
sell_scan_countdown = sell_scan_countdown - 1 sell_scan_countdown = sell_scan_countdown - 1
end end
@@ -78,17 +78,17 @@ end
function public.merchant_info(item_id) function public.merchant_info(item_id)
local buy_info local buy_info
if _G.aux_merchant_buy[item_id] then if g.aux_merchant_buy[item_id] then
buy_info = aux.persistence.read(m.merchant_buy_schema, _G.aux_merchant_buy[item_id]) buy_info = aux.persistence.read(merchant_buy_schema, g.aux_merchant_buy[item_id])
end end
return _G.aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited return g.aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
end end
function public.item_info(item_id) function public.item_info(item_id)
local data_string = _G.aux_items[item_id] local data_string = g.aux_items[item_id]
if data_string then if data_string then
local cached_data = aux.persistence.read(m.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',
@@ -104,7 +104,7 @@ function public.item_info(item_id)
end end
function public.item_id(item_name) function public.item_id(item_name)
return _G.aux_item_ids[strlower(item_name)] return g.aux_item_ids[strlower(item_name)]
end end
function merchant_buy_scan() function merchant_buy_scan()
@@ -116,8 +116,8 @@ function merchant_buy_scan()
if link then if link then
local item_id = aux.info.parse_link(link) local item_id = aux.info.parse_link(link)
local new_unit_price, new_limited = price / count, stock >= 0 local new_unit_price, new_limited = price / count, stock >= 0
if _G.aux_merchant_buy[item_id] then if g.aux_merchant_buy[item_id] then
local buy_info = aux.persistence.read(m.merchant_buy_schema, _G.aux_merchant_buy[item_id]) local buy_info = aux.persistence.read(merchant_buy_schema, g.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 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
_G.aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, { g.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
_G.aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, { g.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,
}) })
@@ -150,21 +150,21 @@ function 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
_G.aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity g.aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
end end
end end
end end
function scan_wdb(item_id) function scan_wdb(item_id)
item_id = item_id or m.MIN_ITEM_ID item_id = item_id or MIN_ITEM_ID
local processed = 0 local processed = 0
while processed <= 100 and item_id <= m.MAX_ITEM_ID do while processed <= 100 and item_id <= MAX_ITEM_ID do
local itemstring = 'item:'..item_id local itemstring = 'item:'..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 _G.aux_item_ids[strlower(name)] then if name and not g.aux_item_ids[strlower(name)] then
_G.aux_item_ids[strlower(name)] = item_id g.aux_item_ids[strlower(name)] = item_id
_G.aux_items[item_id] = aux.persistence.write(m.items_schema, { g.aux_items[item_id] = aux.persistence.write(items_schema, {
name = name, name = name,
quality = quality, quality = quality,
level = level, level = level,
@@ -176,25 +176,25 @@ function scan_wdb(item_id)
}) })
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(_G.aux_auctionable_items, strlower(name)) tinsert(g.aux_auctionable_items, strlower(name))
end end
processed = processed + 1 processed = processed + 1
end end
item_id = item_id + 1 item_id = item_id + 1
end end
if item_id <= m.MAX_ITEM_ID then if item_id <= MAX_ITEM_ID then
local t0 = GetTime() local t0 = GetTime()
aux.control.thread(aux.control.when, function() return GetTime() - t0 > 0.1 end, m.scan_wdb, item_id) aux.control.thread(aux.control.when, function() return GetTime() - t0 > 0.1 end, scan_wdb, item_id)
else else
sort(_G.aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end) sort(g.aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
end end
end end
function public.populate_wdb(item_id) function public.populate_wdb(item_id)
item_id = item_id or m.MIN_ITEM_ID item_id = item_id or MIN_ITEM_ID
if item_id > m.MAX_ITEM_ID then if item_id > MAX_ITEM_ID then
aux.log('Cache populated.') aux.log('Cache populated.')
return return
end end
@@ -204,5 +204,5 @@ function public.populate_wdb(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(populate_wdb, item_id + 1)
end end
+2 -2
View File
@@ -145,7 +145,7 @@ function scan_page(i)
end end
local auction_info = aux.info.auction(i, state.params.type) local auction_info = aux.info.auction(i, state.params.type)
if auction_info and (auction_info.owner or state.params.ignore_owner or _G.aux_ignore_owner) then if auction_info and (auction_info.owner or state.params.ignore_owner or g.aux_ignore_owner) then
auction_info.index = i auction_info.index = i
auction_info.page = state.page auction_info.page = state.page
auction_info.blizzard_query = query.blizzard_query auction_info.blizzard_query = query.blizzard_query
@@ -216,7 +216,7 @@ function wait_for_list_results(send_signal, signal_received)
last_update = GetTime() last_update = GetTime()
updated = true updated = true
end) end)
local ignore_owner = state.params.ignore_owner or _G.aux_ignore_owner local ignore_owner = state.params.ignore_owner or g.aux_ignore_owner
return aux.control.thread(aux.control.when, function() return aux.control.thread(aux.control.when, 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 owner_data_complete('list')) or last_update and GetTime() - last_update > 5 local ok = updated and (ignore_owner or owner_data_complete('list')) or last_update and GetTime() - last_update > 5
+29 -29
View File
@@ -9,71 +9,71 @@ function SlashCmdList.AUX(command)
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
_G.aux_datasets = {} g.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
_G.aux_merchant_buy = {} g.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
_G.aux_merchant_sell = {} g.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
_G.aux_items = {} g.aux_items = {}
_G.aux_item_ids = {} g.aux_item_ids = {}
_G.aux_auctionable_items = {} g.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
_G.aux_tooltip_value = not _G.aux_tooltip_value g.aux_tooltip_value = not g.aux_tooltip_value
aux.log('Historical value in tooltip '..(_G.aux_tooltip_value and 'enabled' or 'disabled')..'.') aux.log('Historical value in tooltip '..(g.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
_G.aux_tooltip_daily = not _G.aux_tooltip_daily g.aux_tooltip_daily = not g.aux_tooltip_daily
aux.log('Market value in tooltip '..(_G.aux_tooltip_daily and 'enabled' or 'disabled')..'.') aux.log('Market value in tooltip '..(g.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
_G.aux_tooltip_vendor_buy = not _G.aux_tooltip_vendor_buy g.aux_tooltip_vendor_buy = not g.aux_tooltip_vendor_buy
aux.log('Vendor buy price in tooltip '..(_G.aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.') aux.log('Vendor buy price in tooltip '..(g.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
_G.aux_tooltip_vendor_sell = not _G.aux_tooltip_vendor_sell g.aux_tooltip_vendor_sell = not g.aux_tooltip_vendor_sell
aux.log('Vendor sell price in tooltip '..(_G.aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.') aux.log('Vendor sell price in tooltip '..(g.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
_G.aux_tooltip_disenchant_value = not _G.aux_tooltip_disenchant_value g.aux_tooltip_disenchant_value = not g.aux_tooltip_disenchant_value
aux.log('Disenchant value in tooltip '..(_G.aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.') aux.log('Disenchant value in tooltip '..(g.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
_G.aux_tooltip_disenchant_distribution = not _G.aux_tooltip_disenchant_distribution g.aux_tooltip_disenchant_distribution = not g.aux_tooltip_disenchant_distribution
aux.log('Disenchant distribution in tooltip '..(_G.aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.') aux.log('Disenchant distribution in tooltip '..(g.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
_G.aux_tooltip_disenchant_source = not _G.aux_tooltip_disenchant_source g.aux_tooltip_disenchant_source = not g.aux_tooltip_disenchant_source
aux.log('Disenchant source in tooltip '..(_G.aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.') aux.log('Disenchant source in tooltip '..(g.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
_G.aux_ignore_owner = not _G.aux_ignore_owner g.aux_ignore_owner = not g.aux_ignore_owner
aux.log('Ignoring of owner '..(_G.aux_ignore_owner and 'enabled' or 'disabled')..'.') aux.log('Ignoring of owner '..(g.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'
_G.aux_characters[realm] = _G.aux_characters[realm] or {} g.aux_characters[realm] = g.aux_characters[realm] or {}
for i=3,getn(arguments) do for i=3,getn(arguments) do
local name = string.gsub(strlower(arguments[i]), '^%l', strupper) local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
if not _G.aux_characters[realm][name] then if not g.aux_characters[realm][name] then
_G.aux_characters[realm][name] = true g.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
local realm = GetCVar 'realmName' local realm = GetCVar 'realmName'
if not _G.aux_characters[realm] then if not g.aux_characters[realm] then
return return
end end
for i=3,getn(arguments) do for i=3,getn(arguments) do
local name = string.gsub(strlower(arguments[i]), '^%l', strupper) local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
if _G.aux_characters[realm][name] then if g.aux_characters[realm][name] then
_G.aux_characters[realm][name] = nil g.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
local realm = GetCVar 'realmName' local realm = GetCVar 'realmName'
local chars = {} local chars = {}
for name, _ in _G.aux_characters[realm] or {} do for name, _ in g.aux_characters[realm] or {} do
tinsert(chars, name) tinsert(chars, name)
end end
if getn(chars) > 0 then if getn(chars) > 0 then
+8 -8
View File
@@ -1,6 +1,6 @@
aux.module 'tooltip' aux.module 'tooltip'
_G.aux_tooltip_value = true g.aux_tooltip_value = true
game_tooltip_hooks = {} game_tooltip_hooks = {}
hooked_setter = nil hooked_setter = nil
@@ -47,7 +47,7 @@ function extend_tooltip(tooltip, link, quantity)
local item_id, suffix_id = aux.info.parse_link(link) local item_id, suffix_id = aux.info.parse_link(link)
quantity = IsShiftKeyDown() and quantity or 1 quantity = IsShiftKeyDown() and quantity or 1
if _G.aux_tooltip_disenchant_source then if g.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)
@@ -69,7 +69,7 @@ function extend_tooltip(tooltip, link, quantity)
if getn(distribution) > 0 then if getn(distribution) > 0 then
if _G.aux_tooltip_disenchant_distribution then if g.aux_tooltip_disenchant_distribution then
local color = {r=0.8, g=0.8, b=0.2} local color = {r=0.8, g=0.8, b=0.2}
tooltip:AddLine('Disenchants into:', color.r, color.g, color.b) tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
@@ -79,7 +79,7 @@ function extend_tooltip(tooltip, link, quantity)
end end
end end
if _G.aux_tooltip_disenchant_value then if g.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)
@@ -88,7 +88,7 @@ function extend_tooltip(tooltip, link, quantity)
end end
end end
if _G.aux_tooltip_vendor_buy then if g.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)
@@ -96,7 +96,7 @@ function extend_tooltip(tooltip, link, quantity)
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..aux.money.to_string2(price * quantity), color.r, color.g, color.b) tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..aux.money.to_string2(price * quantity), color.r, color.g, color.b)
end end
end end
if _G.aux_tooltip_vendor_sell then if g.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)
@@ -112,10 +112,10 @@ function extend_tooltip(tooltip, link, quantity)
local value = aux.history.value(item_key) local value = aux.history.value(item_key)
if auctionable then if auctionable then
if _G.aux_tooltip_value then if g.aux_tooltip_value then
tooltip:AddLine('Value: '..(value and aux.money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b) tooltip:AddLine('Value: '..(value and aux.money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
end end
if _G.aux_tooltip_daily then if g.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.money.to_string2(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.money.to_string2(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
+3 -3
View File
@@ -1,4 +1,4 @@
aux.module '' aux.module 'core'
public.bids_loaded = false public.bids_loaded = false
public.current_owner_page = nil public.current_owner_page = nil
@@ -258,7 +258,7 @@ function public.hook(name, handler, object)
m.orig[object] = m.orig[object] or {} m.orig[object] = m.orig[object] or {}
orig = m.orig[object] orig = m.orig[object]
else else
object = _G object = g
orig = m.orig orig = m.orig
end end
if orig[name] then if orig[name] then
@@ -407,7 +407,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 m.index(_G.aux_characters, realm, name) or UnitName 'player' == name return not current and m.index(g.aux_characters, realm, name) or UnitName 'player' == name
end end
function public.modified() function public.modified()
+32 -18
View File
@@ -373,11 +373,25 @@ function public.editbox(parent)
editbox:SetHeight(24) editbox:SetHeight(24)
editbox:SetFont(config.font, config.medium_font_size) editbox:SetFont(config.font, config.medium_font_size)
editbox:SetTextColor(0, 0, 0, 0) editbox:SetTextColor(0, 0, 0, 0)
-- editbox:SetShadowColor(0, 0, 0, 0)
set_content_style(editbox) set_content_style(editbox)
editbox:SetScript('OnEditFocusGained', aux.C(editbox.HighlightText, aux._this))
editbox:SetScript('OnEditFocusLost', aux.C(editbox.HighlightText, aux._this, 0, 0))
editbox:SetScript('OnEscapePressed', aux.C(editbox.ClearFocus, aux._this)) editbox:SetScript('OnEscapePressed', aux.C(editbox.ClearFocus, aux._this))
editbox:SetScript('OnEditFocusGained', function()
this.last_change = GetTime()
this:HighlightText()
this:SetScript('OnUpdate', function()
this.cursor:SetAlpha(mod(floor((GetTime()-this.last_change) * 2 + 1), 2))
end)
end)
editbox:SetScript('OnEditFocusLost', function()
this.cursor:SetAlpha(0)
this:HighlightText(0, 0)
this:SetScript('OnUpdate', nil)
end)
editbox:SetScript('OnTextChanged', function()
this.last_change = GetTime()
this.text:SetText(aux.call(this.formatter, this:GetText()) or this:GetText())
this.cursor:SetPoint('LEFT', this.text, 'LEFT', max(0, this.text:GetStringWidth() - 2), 1)
end)
do do
local last_click local last_click
editbox:SetScript('OnMouseDown', function() editbox:SetScript('OnMouseDown', function()
@@ -391,10 +405,6 @@ function public.editbox(parent)
last_click = {t=GetTime(), x=x, y=y} last_click = {t=GetTime(), x=x, y=y}
end) end)
end end
editbox:SetScript('OnTextChanged', function()
this.overlay:SetJustifyH(this:GetJustifyH())
this.overlay:SetText(aux.call(this.formatter, this:GetText()) or this:GetText())
end)
function editbox:Enable() function editbox:Enable()
editbox:EnableMouse(true) editbox:EnableMouse(true)
editbox:SetTextColor(color.text.enabled()) editbox:SetTextColor(color.text.enabled())
@@ -404,14 +414,18 @@ function public.editbox(parent)
editbox:SetTextColor(color.text.disabled()) editbox:SetTextColor(color.text.disabled())
editbox:ClearFocus() editbox:ClearFocus()
end end
local overlay = aux.gui.label(editbox, config.medium_font_size) local text = aux.gui.label(editbox, config.medium_font_size)
overlay:SetPoint('LEFT', 1, 0) text:SetPoint('LEFT', 1, 0)
overlay:SetPoint('RIGHT', -2, 0) text:SetPoint('RIGHT', -2, 0)
overlay:SetTextColor(aux.gui.color.text.enabled()) text:SetJustifyH 'LEFT'
editbox.overlay = overlay text:SetTextColor(color.text.enabled())
local cursor = CreateFrame 'Frame' editbox.text = text
cursor:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]} local cursor = aux.gui.label(editbox, config.large_font_size)
cursor:SetBackdropColor(aux.gui.color.text.enabled()) cursor:SetJustifyH 'LEFT'
cursor:SetText '|'
cursor:SetTextColor(color.text.enabled())
cursor:SetAlpha(0)
editbox.cursor = cursor
return editbox return editbox
end end
@@ -566,7 +580,7 @@ end
function public.slider(parent) function public.slider(parent)
local slider = CreateFrame('Slider', nil, parent) local slider = CreateFrame('Slider', nil, parent)
slider:SetOrientation('HORIZONTAL') slider:SetOrientation 'HORIZONTAL'
slider:SetHeight(6) slider:SetHeight(6)
slider:SetHitRectInsets(0, 0, -12, -12) slider:SetHitRectInsets(0, 0, -12, -12)
slider:SetValue(0) slider:SetValue(0)
@@ -582,7 +596,7 @@ function public.slider(parent)
local label = slider:CreateFontString(nil, 'OVERLAY') local label = slider:CreateFontString(nil, 'OVERLAY')
label:SetPoint('BOTTOMLEFT', slider, 'TOPLEFT', -3, 8) label:SetPoint('BOTTOMLEFT', slider, 'TOPLEFT', -3, 8)
label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 8) label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 8)
label:SetJustifyH('LEFT') label:SetJustifyH 'LEFT'
label:SetHeight(13) label:SetHeight(13)
label:SetFont(config.font, config.small_font_size) label:SetFont(config.font, config.small_font_size)
label:SetTextColor(color.label.enabled()) label:SetTextColor(color.label.enabled())
@@ -591,7 +605,7 @@ function public.slider(parent)
editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0) editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0)
editbox:SetWidth(45) editbox:SetWidth(45)
editbox:SetHeight(18) editbox:SetHeight(18)
editbox:SetJustifyH('CENTER') editbox:SetJustifyH 'CENTER'
editbox:SetFont(config.font, 17) editbox:SetFont(config.font, 17)
slider.label = label slider.label = label
+10 -10
View File
@@ -5,19 +5,19 @@ public.version = '4.0.0'
module_envs = {} module_envs = {}
function public.module(path) function public.module(path)
local env local env
if path == '' then if path == 'core' then
env = getfenv() env = getfenv()
elseif m.module_envs[path] then elseif module_envs[path] then
env = m.module_envs[path] env = module_envs[path]
else else
local prefix local prefix
for name in string.gfind(path, '[%a_][%w_]*') do for name in string.gfind(path, '[%a_][%w_]*') do
local qualified_name = prefix and prefix..'.'..name or name local qualified_name = prefix and prefix..'.'..name or name
env = m.module_envs[qualified_name] env = module_envs[qualified_name]
if not env then if not env then
(prefix and m.module_envs[prefix].public or public)[name], env = (function() return aux_module(), getfenv() end)() (prefix and module_envs[prefix].public or public)[name], env = (function() return aux_module(), getfenv() end)()
env.LOAD = nil env.LOAD = nil
m.module_envs[qualified_name] = env module_envs[qualified_name] = env
end end
prefix = qualified_name prefix = qualified_name
end end
@@ -32,18 +32,18 @@ end
ADDON_LOADED = {} ADDON_LOADED = {}
event_frame:SetScript('OnEvent', function() event_frame:SetScript('OnEvent', function()
if event == 'ADDON_LOADED' then if event == 'ADDON_LOADED' then
if m.ADDON_LOADED[arg1] then if ADDON_LOADED[arg1] then
m.ADDON_LOADED[arg1]() ADDON_LOADED[arg1]()
end end
else else
m[event]() m[event]()
if event == 'VARIABLES_LOADED' then if event == 'VARIABLES_LOADED' then
for _, env in m.module_envs do for _, env in module_envs do
if env.m.LOAD then if env.m.LOAD then
env.m.LOAD() env.m.LOAD()
end end
end end
m.log('v'..m.version..' loaded.') log('v'..version..' loaded.')
end end
end end
end) end)
+13 -8
View File
@@ -1,9 +1,16 @@
local mask, _G = bit.band, getfenv(0) local setfenv, rawget, rawset, setmetatable, mask, g = setfenv, rawget, rawset, setmetatable, bit.band, getfenv(0)
local DECLARED, ACCESSOR, MUTABLE, PUBLIC = 1, 2, 4, 8 local DECLARED, ACCESSOR, MUTABLE, PUBLIC = 1, 2, 4, 8
local ACCESSOR_KEY, MUTABLE_KEY, PUBLIC_KEY = 'accessor', 'mutable', 'public' local ACCESSOR_KEY, MUTABLE_KEY, PUBLIC_KEY = 'accessor', 'mutable', 'public'
local PROPERTY = {[ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=MUTABLE, [PUBLIC_KEY]=PUBLIC} local PROPERTY = {[ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=MUTABLE, [PUBLIC_KEY]=PUBLIC}
local _data, _metadata, _modifier_properties = {}, {}, {} local _data, _metadata, _modifier_properties = {}, {}, {}
local metadata_mt = {__index=function() return 0 end}
local metadata_mt = {
__index=function() return 0 end,
__newindex=function(self, key, value)
if rawget(self, key) then error('Duplicate key "'..key..'".', 2) end
rawset(self, key, value)
end,
}
local env_mt = { local env_mt = {
__metatable = false, __metatable = false,
__index = function(self, key) __index = function(self, key)
@@ -13,7 +20,7 @@ local env_mt = {
elseif mask(ACCESSOR, properties) == ACCESSOR then elseif mask(ACCESSOR, properties) == ACCESSOR then
return value(key) return value(key)
else else
return _G[key] or error('No key "'..key..'".', 2) return g[key] or error('No key "'..key..'".', 2)
end end
end, end,
__newindex = function(self, key, value) __newindex = function(self, key, value)
@@ -42,7 +49,6 @@ local interface_mt = {
} }
local modifier_mt = { local modifier_mt = {
__metatable = false, __metatable = false,
__call = function() end,
__index = function(self, key) __index = function(self, key)
local property = PROPERTY[key] local property = PROPERTY[key]
if not property then error('Unsupported modifier "'..key..'".', 2) end if not property then error('Unsupported modifier "'..key..'".', 2) end
@@ -51,17 +57,16 @@ local modifier_mt = {
return self return self
end, end,
__newindex = function(self, key, value) __newindex = function(self, key, value)
if _metadata[self][key] ~= 0 then error('Duplicate key "'..key..'".', 2) end
_data[self][key] = value _data[self][key] = value
_metadata[self][key] = _modifier_properties[self] _metadata[self][key] = _modifier_properties[self]
end, end,
} }
function _G.aux_module() function g.aux_module()
local data, metadata, modifier, env, interface local data, metadata, modifier, env, interface
modifier = setmetatable({}, modifier_mt) env = setmetatable({}, env_mt) interface = setmetatable({}, interface_mt) modifier = setmetatable({}, modifier_mt) env = setmetatable({}, env_mt) interface = setmetatable({}, interface_mt)
local function modifier_accessor(key) _modifier_properties[modifier] = DECLARED+PROPERTY[key] return modifier end local function modifier_accessor(key) _modifier_properties[modifier] = DECLARED+PROPERTY[key] return modifier end
data = {_G=_G, m=env, [ACCESSOR_KEY]=modifier_accessor, [MUTABLE_KEY]=modifier_accessor, [PUBLIC_KEY]=modifier_accessor} data = {g=g, m=env, [ACCESSOR_KEY]=modifier_accessor, [MUTABLE_KEY]=modifier_accessor, [PUBLIC_KEY]=modifier_accessor}
metadata = setmetatable({_G=DECLARED, m=DECLARED, [ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=ACCESSOR, [PUBLIC_KEY]=ACCESSOR}, metadata_mt) metadata = setmetatable({g=DECLARED, m=DECLARED, [ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=ACCESSOR, [PUBLIC_KEY]=ACCESSOR}, metadata_mt)
_data[modifier], _data[env], _data[interface] = data, data, data _data[modifier], _data[env], _data[interface] = data, data, data
_metadata[modifier], _metadata[env], _metadata[interface] = metadata, metadata, metadata _metadata[modifier], _metadata[env], _metadata[interface] = metadata, metadata, metadata
+31 -31
View File
@@ -1,6 +1,6 @@
aux.module 'auction_listing' aux.module 'auction_listing'
_G.aux_price_per_unit = false g.aux_price_per_unit = false
local RT_COUNT = 1 local RT_COUNT = 1
local HEAD_HEIGHT = 27 local HEAD_HEIGHT = 27
@@ -164,24 +164,24 @@ public.search_config = {
end end
local price local price
if record.high_bidder then if record.high_bidder then
price = _G.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid price = g.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
else else
price = _G.aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price price = g.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
if record_a.high_bidder then if record_a.high_bidder then
price_a = _G.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid price_a = g.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
else else
price_a = _G.aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price price_a = g.aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price
end end
local price_b local price_b
if record_b.high_bidder then if record_b.high_bidder then
price_b = _G.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid price_b = g.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
else else
price_b = _G.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price price_b = g.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
end end
return aux.sorting.compare(price_a, price_b, desc) return aux.sorting.compare(price_a, price_b, desc)
end, end,
@@ -192,12 +192,12 @@ public.search_config = {
align = 'RIGHT', align = 'RIGHT',
isPrice = true, isPrice = true,
set = function(cell, record) set = function(cell, record)
local price = _G.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price local price = g.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
cell:SetText(price > 0 and aux.money.to_string(price, true, false) or '---') cell:SetText(price > 0 and 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 = _G.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price local price_a = g.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
local price_b = _G.aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price local price_b = g.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)
@@ -306,24 +306,24 @@ public.auctions_config = {
set = function(cell, record) set = function(cell, record)
local price local price
if record.high_bidder then if record.high_bidder then
price = _G.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid price = g.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
else else
price = _G.aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price price = g.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
if record_a.high_bidder then if record_a.high_bidder then
price_a = _G.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid price_a = g.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
else else
price_a = _G.aux_price_per_unit and record_a.start_price / record_b.aux_quantity or record_a.start_price price_a = g.aux_price_per_unit and record_a.start_price / record_b.aux_quantity or record_a.start_price
end end
local price_b local price_b
if record_b.high_bidder then if record_b.high_bidder then
price_b = _G.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid price_b = g.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
else else
price_b = _G.aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price price_b = g.aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
end end
return aux.sorting.compare(price_a, price_b, desc) return aux.sorting.compare(price_a, price_b, desc)
end, end,
@@ -334,12 +334,12 @@ public.auctions_config = {
align = 'RIGHT', align = 'RIGHT',
isPrice = true, isPrice = true,
set = function(cell, record) set = function(cell, record)
local price = _G.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price local price = g.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
cell:SetText(price > 0 and aux.money.to_string(price, true, false) or '---') cell:SetText(price > 0 and 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 = _G.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price local price_a = g.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
local price_b = _G.aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price local price_b = g.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)
@@ -459,24 +459,24 @@ public.bids_config = {
set = function(cell, record) set = function(cell, record)
local price local price
if record.high_bidder then if record.high_bidder then
price = _G.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid price = g.aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
else else
price = _G.aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price price = g.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
if record_a.high_bidder then if record_a.high_bidder then
price_a = _G.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid price_a = g.aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
else else
price_a = _G.aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price price_a = g.aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price
end end
local price_b local price_b
if record_b.high_bidder then if record_b.high_bidder then
price_b = _G.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid price_b = g.aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
else else
price_b = _G.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price price_b = g.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
end end
return aux.sorting.compare(price_a, price_b, desc) return aux.sorting.compare(price_a, price_b, desc)
end, end,
@@ -487,12 +487,12 @@ public.bids_config = {
align = 'RIGHT', align = 'RIGHT',
isPrice = true, isPrice = true,
set = function(cell, record) set = function(cell, record)
local price = _G.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price local price = g.aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
cell:SetText(price > 0 and aux.money.to_string(price, true, false) or '---') cell:SetText(price > 0 and 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 = _G.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price local price_a = g.aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
local price_b = _G.aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price local price_b = g.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)
@@ -565,10 +565,10 @@ local methods = {
if rt.disabled then return end if rt.disabled then return end
if button == 'RightButton' and rt.headCells[this.columnIndex].info.isPrice then if button == 'RightButton' and rt.headCells[this.columnIndex].info.isPrice then
_G.aux_price_per_unit = not _G.aux_price_per_unit g.aux_price_per_unit = not g.aux_price_per_unit
for _, cell in rt.headCells do for _, cell in rt.headCells do
if cell.info.isPrice then if cell.info.isPrice then
cell:SetText(cell.info.title[_G.aux_price_per_unit and 1 or 2]) cell:SetText(cell.info.title[g.aux_price_per_unit and 1 or 2])
end end
end end
rt:SetSort() rt:SetSort()
@@ -1007,7 +1007,7 @@ function public.CreateAuctionResultsTable(parent, config)
rt:SetScript('OnShow', function() rt:SetScript('OnShow', function()
for _, cell in this.headCells do for _, cell in this.headCells do
if cell.info.isPrice then if cell.info.isPrice then
cell:SetText(cell.info.title[_G.aux_price_per_unit and 1 or 2]) cell:SetText(cell.info.title[g.aux_price_per_unit and 1 or 2])
end end
end end
end) end)
+1 -1
View File
@@ -37,7 +37,7 @@ function public.render(item_listing)
end end
function public.create(parent, on_click, selected) function public.create(parent, on_click, selected)
local name = '_G.aux_item_list' local name = 'g.aux_item_list'
local id = 1 local id = 1
while getglobal(name..id) do while getglobal(name..id) do
+37 -37
View File
@@ -30,7 +30,7 @@ function create_frames()
local checkbox = aux.gui.checkbox(frame.inventory) local checkbox = aux.gui.checkbox(frame.inventory)
checkbox:SetPoint('TOPLEFT', 49, -16) checkbox:SetPoint('TOPLEFT', 49, -16)
checkbox:SetScript('OnClick', function() checkbox:SetScript('OnClick', function()
m.refresh = true 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', 4, 1) label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
@@ -105,17 +105,17 @@ function create_frames()
btn:SetText('Refresh') btn:SetText('Refresh')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
aux.scan.abort(scan_id) aux.scan.abort(scan_id)
m.refresh_entries() refresh_entries()
m.refresh = true refresh = true
end) end)
refresh_button = btn refresh_button = btn
end end
do do
item = aux.gui.item(m.frame.parameters) item = aux.gui.item(frame.parameters)
item:SetPoint('TOPLEFT', 10, -6) item:SetPoint('TOPLEFT', 10, -6)
item.button:SetScript('OnEnter', function() item.button:SetScript('OnEnter', function()
if m.selected_item then if selected_item then
aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT') aux.info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
end end
end) end)
item.button:SetScript('OnLeave', function() item.button:SetScript('OnLeave', function()
@@ -123,7 +123,7 @@ function create_frames()
end) end)
end end
do do
local slider = aux.gui.slider(m.frame.parameters) local slider = aux.gui.slider(frame.parameters)
slider:SetValueStep(1) slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', 13, -74) slider:SetPoint('TOPLEFT', 13, -74)
slider:SetWidth(190) slider:SetWidth(190)
@@ -134,18 +134,18 @@ function create_frames()
slider:SetValue(this:GetNumber()) slider:SetValue(this:GetNumber())
quantity_update(true) quantity_update(true)
if selected_item then if selected_item then
local settings = m.read_settings() local settings = read_settings()
settings.stack_size = this:GetNumber() settings.stack_size = this:GetNumber()
m.write_settings(settings) write_settings(settings)
end end
end) end)
slider.editbox:SetScript('OnTabPressed', function() slider.editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then if IsShiftKeyDown() then
m.unit_buyout_price:SetFocus() unit_buyout_price:SetFocus()
elseif m.stack_count_slider.editbox:IsVisible() then elseif stack_count_slider.editbox:IsVisible() then
m.stack_count_slider.editbox:SetFocus() stack_count_slider.editbox:SetFocus()
else else
m.unit_start_price:SetFocus() unit_start_price:SetFocus()
end end
end) end)
slider.editbox:SetNumeric(true) slider.editbox:SetNumeric(true)
@@ -154,22 +154,22 @@ function create_frames()
stack_size_slider = slider stack_size_slider = slider
end end
do do
local slider = aux.gui.slider(m.frame.parameters) local slider = aux.gui.slider(frame.parameters)
slider:SetValueStep(1) slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -32) slider:SetPoint('TOPLEFT', stack_size_slider, 'BOTTOMLEFT', 0, -32)
slider:SetWidth(190) slider:SetWidth(190)
slider:SetScript('OnValueChanged', function() slider:SetScript('OnValueChanged', function()
m.quantity_update() quantity_update()
end) end)
slider.editbox:SetScript('OnTextChanged', function() slider.editbox:SetScript('OnTextChanged', function()
slider:SetValue(this:GetNumber()) slider:SetValue(this:GetNumber())
m.quantity_update() quantity_update()
end) end)
slider.editbox:SetScript('OnTabPressed', function() slider.editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then if IsShiftKeyDown() then
m.stack_size_slider.editbox:SetFocus() stack_size_slider.editbox:SetFocus()
else else
m.unit_start_price:SetFocus() unit_start_price:SetFocus()
end end
end) end)
slider.editbox:SetNumeric(true) slider.editbox:SetNumeric(true)
@@ -177,42 +177,42 @@ function create_frames()
stack_count_slider = slider stack_count_slider = slider
end end
do do
local dropdown = aux.gui.dropdown(m.frame.parameters) local dropdown = aux.gui.dropdown(frame.parameters)
dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -19) dropdown:SetPoint('TOPLEFT', stack_count_slider, 'BOTTOMLEFT', 0, -19)
dropdown:SetWidth(90) dropdown:SetWidth(90)
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, -3) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Duration') label:SetText('Duration')
UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown) UIDropDownMenu_Initialize(dropdown, initialize_duration_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown) UIDropDownMenu_Initialize(this, initialize_duration_dropdown)
end) end)
duration_dropdown = dropdown duration_dropdown = dropdown
end end
do do
local label = aux.gui.label(m.frame.parameters, aux.gui.config.medium_font_size) local label = aux.gui.label(frame.parameters, aux.gui.config.medium_font_size)
label:SetPoint('LEFT', m.duration_dropdown, 'RIGHT', 25, 0) label:SetPoint('LEFT', duration_dropdown, 'RIGHT', 25, 0)
deposit = label deposit = label
end end
do do
local checkbox = aux.gui.checkbox(m.frame.parameters) local checkbox = aux.gui.checkbox(frame.parameters)
checkbox:SetPoint('TOPRIGHT', -83, -6) checkbox:SetPoint('TOPRIGHT', -83, -6)
checkbox:SetScript('OnClick', function() checkbox:SetScript('OnClick', function()
local settings = m.read_settings() local settings = read_settings()
settings.hidden = this:GetChecked() settings.hidden = this:GetChecked()
m.write_settings(settings) write_settings(settings)
m.refresh = true 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', 4, 1) label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText('Hide this item') label:SetText 'Hide this item'
hide_checkbox = checkbox hide_checkbox = checkbox
end end
do do
local frame = CreateFrame('Frame', nil, frame.parameters) local frame = CreateFrame('Frame', nil, frame.parameters)
start_price_frame = frame start_price_frame = frame
aux.gui.set_content_style(frame) aux.gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', frame.parameters, 'TOPRIGHT', -71, -60) frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60)
frame:SetWidth(180) frame:SetWidth(180)
frame:SetHeight(22) frame:SetHeight(22)
local editbox = aux.gui.editbox(frame) local editbox = aux.gui.editbox(frame)
@@ -246,18 +246,18 @@ function create_frames()
editbox.pretty = aux.gui.label(frame, 17) editbox.pretty = aux.gui.label(frame, 17)
editbox.pretty:SetPoint('LEFT', 1, 0) editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0) editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH('RIGHT') editbox.pretty:SetJustifyH 'RIGHT'
editbox.pretty:SetTextColor(unpack(aux.gui.color.text.enabled)) editbox.pretty:SetTextColor(unpack(aux.gui.color.text.enabled))
do do
local label = aux.gui.label(frame, aux.gui.config.small_font_size) local label = aux.gui.label(frame, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
label:SetText('Unit Starting Price') label:SetText 'Unit Starting Price'
end end
do do
local label = aux.gui.label(frame, 14) local label = aux.gui.label(frame, 14)
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50) label:SetWidth(50)
label:SetJustifyH('CENTER') label:SetJustifyH 'CENTER'
start_price_percentage = label start_price_percentage = label
end end
unit_start_price = editbox unit_start_price = editbox
@@ -301,8 +301,8 @@ function create_frames()
editbox.pretty = aux.gui.label(frame, 17) editbox.pretty = aux.gui.label(frame, 17)
editbox.pretty:SetPoint('LEFT', 1, 0) editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0) editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH('RIGHT') editbox.pretty:SetJustifyH 'RIGHT'
editbox.pretty:SetTextColor(unpack(aux.gui.color.text.enabled)) editbox.pretty:SetTextColor(aux.gui.color.text.enabled())
do do
local label = aux.gui.label(frame, aux.gui.config.small_font_size) local label = aux.gui.label(frame, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
@@ -321,7 +321,7 @@ function create_frames()
local btn = aux.gui.button(frame.parameters, 14) local btn = aux.gui.button(frame.parameters, 14)
btn:SetPoint('TOPRIGHT', -10, -146) btn:SetPoint('TOPRIGHT', -10, -146)
aux.gui.set_size(btn, 150, 20) aux.gui.set_size(btn, 150, 20)
btn:GetFontString():SetJustifyH('RIGHT') btn:GetFontString():SetJustifyH 'RIGHT'
btn:GetFontString():SetPoint('RIGHT', -2, 0) btn:GetFontString():SetPoint('RIGHT', -2, 0)
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
if this.amount then if this.amount then
+1 -1
View File
@@ -20,7 +20,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
} }
do do
local function action() local function action()
_G.aux_auto_buy_filter = getglobal(this:GetParent():GetName()..'EditBox'):GetText() g.aux_auto_buy_filter = getglobal(this:GetParent():GetName()..'EditBox'):GetText()
m.update_auto_buy_filter() m.update_auto_buy_filter()
end end
+188 -188
View File
@@ -4,40 +4,40 @@ FILTER_SPACING = 28.5
function create_frames() function create_frames()
frame = CreateFrame('Frame', nil, aux.frame) frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints() frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update) frame:SetScript('OnUpdate', on_update)
m.frame:Hide() frame:Hide()
m.frame.filter = aux.gui.panel(m.frame) frame.filter = aux.gui.panel(frame)
m.frame.filter:SetAllPoints(aux.frame.content) frame.filter:SetAllPoints(aux.frame.content)
m.frame.results = aux.gui.panel(m.frame) frame.results = aux.gui.panel(frame)
m.frame.results:SetAllPoints(aux.frame.content) frame.results:SetAllPoints(aux.frame.content)
m.frame.saved = CreateFrame('Frame', nil, m.frame) frame.saved = CreateFrame('Frame', nil, frame)
m.frame.saved:SetAllPoints(aux.frame.content) frame.saved:SetAllPoints(aux.frame.content)
m.frame.saved.favorite = aux.gui.panel(m.frame.saved) frame.saved.favorite = aux.gui.panel(frame.saved)
m.frame.saved.favorite:SetWidth(378.5) frame.saved.favorite:SetWidth(378.5)
m.frame.saved.favorite:SetPoint('TOPLEFT', 0, 0) frame.saved.favorite:SetPoint('TOPLEFT', 0, 0)
m.frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0) frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0)
m.frame.saved.recent = aux.gui.panel(m.frame.saved) frame.saved.recent = aux.gui.panel(frame.saved)
m.frame.saved.recent:SetWidth(378.5) frame.saved.recent:SetWidth(378.5)
m.frame.saved.recent:SetPoint('TOPRIGHT', 0, 0) frame.saved.recent:SetPoint('TOPRIGHT', 0, 0)
m.frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0) frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0)
do do
local btn = aux.gui.button(m.frame) local btn = aux.gui.button(frame)
btn:SetPoint('TOPLEFT', 0, 0) btn:SetPoint('TOPLEFT', 0, 0)
btn:SetWidth(42) btn:SetWidth(42)
btn:SetHeight(42) btn:SetHeight(42)
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
if this.open then if this.open then
m.settings:Hide() settings:Hide()
m.controls:Show() controls:Show()
else else
m.settings:Show() settings:Show()
m.controls:Hide() controls:Hide()
end end
this.open = not this.open this.open = not this.open
end) end)
@@ -52,34 +52,34 @@ function create_frames()
settings_button = btn settings_button = btn
end end
do do
local panel = CreateFrame('Frame', nil, m.frame) local panel = CreateFrame('Frame', nil, frame)
panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]} panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]}
panel:SetBackdropColor(unpack(aux.gui.color.content.background)) panel:SetBackdropColor(unpack(aux.gui.color.content.background))
panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) panel:SetPoint('LEFT', settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 0) panel:SetPoint('RIGHT', 0, 0)
panel:SetHeight(42) panel:SetHeight(42)
panel:Hide() panel:Hide()
settings = panel settings = panel
end end
do do
local panel = CreateFrame('Frame', nil, m.frame) local panel = CreateFrame('Frame', nil, frame)
panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) panel:SetPoint('LEFT', settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 1) panel:SetPoint('RIGHT', 0, 1)
panel:SetHeight(40) panel:SetHeight(40)
controls = panel controls = panel
end end
do do
local editbox = aux.gui.editbox(m.settings) local editbox = aux.gui.editbox(settings)
editbox:SetPoint('LEFT', 75, 0) editbox:SetPoint('LEFT', 75, 0)
editbox:SetWidth(50) editbox:SetWidth(50)
editbox:SetNumeric(true) editbox:SetNumeric(true)
editbox:SetMaxLetters(nil) editbox:SetMaxLetters(nil)
editbox:SetScript('OnTabPressed', function() editbox:SetScript('OnTabPressed', function()
m.last_page_input:SetFocus() last_page_input:SetFocus()
end) end)
editbox:SetScript('OnEnterPressed', function() editbox:SetScript('OnEnterPressed', function()
this:ClearFocus() this:ClearFocus()
m.execute() execute()
end) end)
editbox:SetScript('OnTextChanged', function() editbox:SetScript('OnTextChanged', function()
local page = tonumber(this:GetText()) local page = tonumber(this:GetText())
@@ -87,7 +87,7 @@ function create_frames()
if this:GetText() ~= valid_input then if this:GetText() ~= valid_input then
this:SetText(valid_input) this:SetText(valid_input)
end end
if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then if blizzard_page_index(this:GetText()) and not real_time_button:GetChecked() then
this:SetBackdropColor(unpack(aux.gui.color.state.enabled)) this:SetBackdropColor(unpack(aux.gui.color.state.enabled))
else else
this:SetBackdropColor(unpack(aux.gui.color.state.disabled)) this:SetBackdropColor(unpack(aux.gui.color.state.disabled))
@@ -100,17 +100,17 @@ function create_frames()
first_page_input = editbox first_page_input = editbox
end end
do do
local editbox = aux.gui.editbox(m.settings) local editbox = aux.gui.editbox(settings)
editbox:SetPoint('LEFT', m.first_page_input, 'RIGHT', 10, 0) editbox:SetPoint('LEFT', first_page_input, 'RIGHT', 10, 0)
editbox:SetWidth(50) editbox:SetWidth(50)
editbox:SetNumeric(true) editbox:SetNumeric(true)
editbox:SetMaxLetters(nil) editbox:SetMaxLetters(nil)
editbox:SetScript('OnTabPressed', function() editbox:SetScript('OnTabPressed', function()
m.first_page_input:SetFocus() first_page_input:SetFocus()
end) end)
editbox:SetScript('OnEnterPressed', function() editbox:SetScript('OnEnterPressed', function()
this:ClearFocus() this:ClearFocus()
m.execute() execute()
end) end)
editbox:SetScript('OnTextChanged', function() editbox:SetScript('OnTextChanged', function()
local page = tonumber(this:GetText()) local page = tonumber(this:GetText())
@@ -118,7 +118,7 @@ function create_frames()
if this:GetText() ~= valid_input then if this:GetText() ~= valid_input then
this:SetText(valid_input) this:SetText(valid_input)
end end
if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then if blizzard_page_index(this:GetText()) and not real_time_button:GetChecked() then
this:SetBackdropColor(unpack(aux.gui.color.state.enabled)) this:SetBackdropColor(unpack(aux.gui.color.state.enabled))
else else
this:SetBackdropColor(unpack(aux.gui.color.state.disabled)) this:SetBackdropColor(unpack(aux.gui.color.state.disabled))
@@ -131,23 +131,23 @@ function create_frames()
last_page_input = editbox last_page_input = editbox
end end
do do
local btn = aux.gui.checkbutton(m.settings) local btn = aux.gui.checkbutton(settings)
btn:SetPoint('LEFT', 230, 0) btn:SetPoint('LEFT', 230, 0)
btn:SetWidth(140) btn:SetWidth(140)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('Real Time Mode') btn:SetText('Real Time Mode')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
this:SetChecked(not this:GetChecked()) this:SetChecked(not this:GetChecked())
this = m.first_page_input this = first_page_input
m.first_page_input:GetScript('OnTextChanged')() first_page_input:GetScript('OnTextChanged')()
this = m.last_page_input this = last_page_input
m.last_page_input:GetScript('OnTextChanged')() last_page_input:GetScript('OnTextChanged')()
end) end)
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(settings)
btn:SetPoint('LEFT', m.real_time_button, 'RIGHT', 15, 0) btn:SetPoint('LEFT', real_time_button, 'RIGHT', 15, 0)
btn:SetWidth(140) btn:SetWidth(140)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('Auto Buyout Mode') btn:SetText('Auto Buyout Mode')
@@ -161,17 +161,17 @@ function create_frames()
auto_buy_button = btn auto_buy_button = btn
end end
do do
local btn = aux.gui.checkbutton(m.settings) local btn = aux.gui.checkbutton(settings)
btn:SetPoint('LEFT', m.auto_buy_button, 'RIGHT', 15, 0) btn:SetPoint('LEFT', auto_buy_button, 'RIGHT', 15, 0)
btn:SetWidth(140) btn:SetWidth(140)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('Auto Buyout Filter') btn:SetText('Auto Buyout Filter')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
if this:GetChecked() then if this:GetChecked() then
this:SetChecked(false) this:SetChecked(false)
_G.aux_auto_buy_filter = nil g.aux_auto_buy_filter = nil
this.prettified = nil this.prettified = nil
m.auto_buy_validator = nil auto_buy_validator = nil
else else
StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER') StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER')
end end
@@ -189,25 +189,25 @@ function create_frames()
auto_buy_filter_button = btn auto_buy_filter_button = btn
end end
do do
local btn = aux.gui.button(m.controls, 25) local btn = aux.gui.button(controls, 25)
btn:SetPoint('LEFT', 5, 0) btn:SetPoint('LEFT', 5, 0)
btn:SetWidth(30) btn:SetWidth(30)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('<') btn:SetText('<')
btn:SetScript('OnClick', m.previous_search) btn:SetScript('OnClick', previous_search)
previous_button = btn previous_button = btn
end end
do do
local btn = aux.gui.button(m.controls, 25) local btn = aux.gui.button(controls, 25)
btn:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0) btn:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0)
btn:SetWidth(30) btn:SetWidth(30)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('>') btn:SetText('>')
btn:SetScript('OnClick', m.next_search) btn:SetScript('OnClick', next_search)
next_button = btn 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(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)
@@ -215,40 +215,40 @@ function create_frames()
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp') btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
if arg1 == 'RightButton' then if arg1 == 'RightButton' then
m.set_filter(m.current_search().filter_string) set_filter(current_search().filter_string)
end end
m.execute() execute()
end) end)
start_button = btn 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(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(search_scan_id)
end) end)
stop_button = btn 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(controls, aux.gui.config.huge_font_size)
btn:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0) btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
btn:SetWidth(70) btn:SetWidth(70)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText(aux.gui.color.green 'Resume') btn:SetText(aux.gui.color.green 'Resume')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
m.execute(true) execute(true)
end) end)
resume_button = btn resume_button = btn
end end
do do
local editbox = aux.gui.editbox(m.controls) local editbox = aux.gui.editbox(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', start_button, 'LEFT', -4, 0)
editbox:SetHeight(25) editbox:SetHeight(25)
editbox:SetScript('OnChar', function() editbox:SetScript('OnChar', function()
this:complete() this:complete()
@@ -256,49 +256,49 @@ function create_frames()
editbox:SetScript('OnTabPressed', function() editbox:SetScript('OnTabPressed', function()
this:HighlightText(0, 0) this:HighlightText(0, 0)
end) end)
editbox:SetScript('OnEnterPressed', m.execute) editbox:SetScript('OnEnterPressed', execute)
search_box = editbox search_box = editbox
end end
do do
aux.gui.horizontal_line(m.frame, -40) aux.gui.horizontal_line(frame, -40)
end end
do do
local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8) btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8)
btn:SetWidth(243) btn:SetWidth(243)
btn:SetHeight(22) btn:SetHeight(22)
btn:SetText('Search Results') btn:SetText('Search Results')
btn:SetScript('OnClick', function() m.update_tab(m.RESULTS) end) btn:SetScript('OnClick', function() update_tab(RESULTS) end)
search_results_button = btn search_results_button = btn
end end
do do
local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
btn:SetPoint('TOPLEFT', m.search_results_button, 'TOPRIGHT', 5, 0) btn:SetPoint('TOPLEFT', search_results_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243) btn:SetWidth(243)
btn:SetHeight(22) btn:SetHeight(22)
btn:SetText('Saved Searches') btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() m.update_tab(m.SAVED) end) btn:SetScript('OnClick', function() update_tab(SAVED) end)
saved_searches_button = btn saved_searches_button = btn
end end
do do
local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) local btn = aux.gui.button(frame, aux.gui.config.large_font_size2)
btn:SetPoint('TOPLEFT', m.saved_searches_button, 'TOPRIGHT', 5, 0) btn:SetPoint('TOPLEFT', saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243) btn:SetWidth(243)
btn:SetHeight(22) btn:SetHeight(22)
btn:SetText('Filter Builder') btn:SetText('Filter Builder')
btn:SetScript('OnClick', function() m.update_tab(m.FILTER) end) btn:SetScript('OnClick', function() update_tab(FILTER) end)
new_filter_button = btn new_filter_button = btn
end end
do do
local frame = CreateFrame('Frame', nil, m.frame) local frame = CreateFrame('Frame', nil, frame)
frame:SetWidth(265) frame:SetWidth(265)
frame:SetHeight(25) frame:SetHeight(25)
frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
status_bar_frame = frame status_bar_frame = frame
end end
do do
local btn = aux.gui.button(m.frame.results, 16) local btn = aux.gui.button(frame.results, 16)
btn:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Bid') btn:SetText('Bid')
@@ -306,8 +306,8 @@ function create_frames()
bid_button = btn bid_button = btn
end end
do do
local btn = aux.gui.button(m.frame.results, 16) local btn = aux.gui.button(frame.results, 16)
btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0) btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Buyout') btn:SetText('Buyout')
@@ -315,42 +315,42 @@ function create_frames()
buyout_button = btn buyout_button = btn
end end
do do
local btn = aux.gui.button(m.frame.results, 16) local btn = aux.gui.button(frame.results, 16)
btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0) btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80) btn:SetWidth(80)
btn:SetHeight(24) btn:SetHeight(24)
btn:SetText('Clear') btn:SetText('Clear')
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
while tremove(m.current_search().records) do end while tremove(current_search().records) do end
m.current_search().table:SetDatabase() current_search().table:SetDatabase()
end) end)
end end
do do
local btn = aux.gui.button(m.frame.saved, 16) local btn = aux.gui.button(frame.saved, 16)
btn:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) btn:SetPoint('TOPLEFT', 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(search_box:GetText())
if filters then if filters then
tinsert(_G.aux_favorite_searches, 1, { tinsert(g.aux_favorite_searches, 1, {
filter_string = m.search_box:GetText(), filter_string = search_box:GetText(),
prettified = table.concat(aux.util.map(filters, function(filter) return filter.prettified end), ';'), prettified = table.concat(aux.util.map(filters, function(filter) return filter.prettified end), ';'),
}) })
end end
m.update_search_listings() update_search_listings()
end) end)
end end
do do
local btn1 = aux.gui.button(m.frame.filter, 16) local btn1 = aux.gui.button(frame.filter, 16)
btn1:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) btn1:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
btn1:SetWidth(80) btn1:SetWidth(80)
btn1:SetHeight(24) btn1:SetHeight(24)
btn1:SetText('Search') btn1:SetText('Search')
btn1:SetScript('OnClick', function() btn1:SetScript('OnClick', function()
m.export_query_string() export_query_string()
m.execute() execute()
end) end)
local btn2 = aux.gui.button(frame.filter, 16) local btn2 = aux.gui.button(frame.filter, 16)
@@ -369,7 +369,7 @@ function create_frames()
end end
do do
local editbox = aux.gui.editbox(frame.filter) local editbox = aux.gui.editbox(frame.filter)
editbox.complete_item = aux.completion.complete(function() return _G.aux_auctionable_items end) editbox.complete_item = aux.completion.complete(function() return g.aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING) editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
editbox:SetWidth(260) editbox:SetWidth(260)
editbox:SetScript('OnChar', function() editbox:SetScript('OnChar', function()
@@ -404,24 +404,24 @@ function create_frames()
exact_checkbox = checkbox exact_checkbox = checkbox
end end
do do
local editbox = aux.gui.editbox(m.frame.filter) local editbox = aux.gui.editbox(frame.filter)
editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -m.FILTER_SPACING) editbox:SetPoint('TOPLEFT', name_input, 'BOTTOMLEFT', 0, -FILTER_SPACING)
editbox:SetWidth(125) editbox:SetWidth(125)
editbox:SetNumeric(true) editbox:SetNumeric(true)
editbox:SetScript('OnTabPressed', function() editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then if IsShiftKeyDown() then
m.name_input:SetFocus() name_input:SetFocus()
else else
m.max_level_input:SetFocus() max_level_input:SetFocus()
end end
end) end)
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox)) editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
editbox:SetScript('OnTextChanged', function() editbox:SetScript('OnTextChanged', function()
local valid_level = m.valid_level(this:GetText()) local valid_level = valid_level(this:GetText())
if tostring(valid_level) ~= this:GetText() then if tostring(valid_level) ~= this:GetText() then
this:SetText(valid_level or '') this:SetText(valid_level or '')
end end
m.update_form() update_form()
end) end)
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)
@@ -429,24 +429,24 @@ function create_frames()
min_level_input = editbox min_level_input = editbox
end end
do do
local editbox = aux.gui.editbox(m.frame.filter) local editbox = aux.gui.editbox(frame.filter)
editbox:SetPoint('TOPLEFT', m.min_level_input, 'TOPRIGHT', 10, 0) editbox:SetPoint('TOPLEFT', min_level_input, 'TOPRIGHT', 10, 0)
editbox:SetWidth(125) editbox:SetWidth(125)
editbox:SetNumeric(true) editbox:SetNumeric(true)
editbox:SetScript('OnTabPressed', function() editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then if IsShiftKeyDown() then
m.min_level_input:SetFocus() min_level_input:SetFocus()
else else
m.name_input:SetFocus() name_input:SetFocus()
end end
end) end)
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox)) editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
editbox:SetScript('OnTextChanged', function() editbox:SetScript('OnTextChanged', function()
local valid_level = m.valid_level(this:GetText()) local valid_level = valid_level(this:GetText())
if tostring(valid_level) ~= this:GetText() then if tostring(valid_level) ~= this:GetText() then
this:SetText(valid_level or '') this:SetText(valid_level or '')
end end
m.update_form() update_form()
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, 0) label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
@@ -454,74 +454,74 @@ function create_frames()
max_level_input = editbox max_level_input = editbox
end end
do do
local checkbox = aux.gui.checkbox(m.frame.filter) local checkbox = aux.gui.checkbox(frame.filter)
checkbox:SetPoint('TOPLEFT', m.max_level_input, 'TOPRIGHT', 16, 0) checkbox:SetPoint('TOPLEFT', max_level_input, 'TOPRIGHT', 16, 0)
checkbox:SetScript('OnClick', m.update_form) checkbox:SetScript('OnClick', update_form)
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', -2, 1) label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Usable') label:SetText('Usable')
usable_checkbox = checkbox usable_checkbox = checkbox
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(frame.filter)
class_dropdown = dropdown class_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, 5 - m.FILTER_SPACING) dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING)
dropdown:SetWidth(300) dropdown:SetWidth(300)
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, -3) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Class') label:SetText('Item Class')
UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown) UIDropDownMenu_Initialize(dropdown, initialize_class_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_class_dropdown) UIDropDownMenu_Initialize(this, initialize_class_dropdown)
end) end)
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(frame.filter)
subclass_dropdown = dropdown subclass_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300) dropdown:SetWidth(300)
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, -3) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Subclass') label:SetText('Item Subclass')
UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown) UIDropDownMenu_Initialize(dropdown, initialize_subclass_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_subclass_dropdown) UIDropDownMenu_Initialize(this, initialize_subclass_dropdown)
end) end)
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(frame.filter)
slot_dropdown = dropdown slot_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300) dropdown:SetWidth(300)
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, -3) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Slot') label:SetText('Item Slot')
UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown) UIDropDownMenu_Initialize(dropdown, initialize_slot_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_slot_dropdown) UIDropDownMenu_Initialize(this, initialize_slot_dropdown)
end) end)
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(frame.filter)
quality_dropdown = dropdown quality_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300) dropdown:SetWidth(300)
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, -3) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Min Quality') label:SetText('Min Quality')
UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown) UIDropDownMenu_Initialize(dropdown, initialize_quality_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_quality_dropdown) UIDropDownMenu_Initialize(this, initialize_quality_dropdown)
end) end)
end end
aux.gui.vertical_line(m.frame.filter, 332) aux.gui.vertical_line(frame.filter, 332)
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(frame.filter)
dropdown:SetPoint('TOPRIGHT', -174.5, -10) dropdown:SetPoint('TOPRIGHT', -174.5, -10)
dropdown:SetWidth(150) dropdown:SetWidth(150)
UIDropDownMenu_Initialize(dropdown, m.initialize_filter_dropdown) UIDropDownMenu_Initialize(dropdown, initialize_filter_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown) UIDropDownMenu_Initialize(this, 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)
@@ -530,11 +530,11 @@ function create_frames()
filter_dropdown = dropdown filter_dropdown = dropdown
end end
do do
local input = aux.gui.editbox(m.frame.filter) local input = aux.gui.editbox(frame.filter)
input:SetPoint('CENTER', m.filter_dropdown, 'CENTER', 0, 0) input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0)
input:SetWidth(150) input:SetWidth(150)
input:SetScript('OnTabPressed', function() input:SetScript('OnTabPressed', function()
m.filter_parameter_input:SetFocus() filter_parameter_input:SetFocus()
end) end)
input.complete = aux.completion.complete(function() return {'and', 'or', 'not', unpack(aux.util.keys(aux.filter.filters))} end) input.complete = aux.completion.complete(function() return {'and', 'or', 'not', unpack(aux.util.keys(aux.filter.filters))} end)
input:SetScript('OnChar', function() input:SetScript('OnChar', function()
@@ -544,38 +544,38 @@ function create_frames()
local filter = this:GetText() local filter = this:GetText()
if aux.filter.filters[filter] and aux.filter.filters[filter].input_type ~= '' then if aux.filter.filters[filter] and aux.filter.filters[filter].input_type ~= '' then
local _, _, suggestions = aux.filter.parse_query_string(filter..'/') local _, _, suggestions = aux.filter.parse_query_string(filter..'/')
m.filter_parameter_input:SetNumeric(aux.filter.filters[filter].input_type == 'number') filter_parameter_input:SetNumeric(aux.filter.filters[filter].input_type == 'number')
m.filter_parameter_input.complete = aux.completion.complete(function() return suggestions or {} end) filter_parameter_input.complete = aux.completion.complete(function() return suggestions or {} end)
m.filter_parameter_input:Show() filter_parameter_input:Show()
else else
m.filter_parameter_input:Hide() filter_parameter_input:Hide()
end end
end) end)
input:SetScript('OnEnterPressed', function() input:SetScript('OnEnterPressed', function()
if m.filter_parameter_input:IsVisible() then if filter_parameter_input:IsVisible() then
m.filter_parameter_input:SetFocus() filter_parameter_input:SetFocus()
else else
m.add_post_filter() add_post_filter()
end end
end) end)
filter_input = input filter_input = input
end end
do do
local input = aux.gui.editbox(m.frame.filter) local input = aux.gui.editbox(frame.filter)
input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0) input:SetPoint('LEFT', filter_dropdown, 'RIGHT', 10, 0)
input:SetWidth(150) input:SetWidth(150)
input:SetScript('OnTabPressed', function() input:SetScript('OnTabPressed', function()
m.filter_input:SetFocus() filter_input:SetFocus()
end) end)
input:SetScript('OnChar', function() input:SetScript('OnChar', function()
this:complete() this:complete()
end) end)
input:SetScript('OnEnterPressed', m.add_post_filter) input:SetScript('OnEnterPressed', add_post_filter)
input:Hide() input:Hide()
filter_parameter_input = input filter_parameter_input = input
end end
do do
local scroll_frame = CreateFrame('ScrollFrame', nil, m.frame.filter) local scroll_frame = CreateFrame('ScrollFrame', nil, frame.filter)
scroll_frame:SetWidth(395) scroll_frame:SetWidth(395)
scroll_frame:SetHeight(270) scroll_frame:SetHeight(270)
scroll_frame:SetPoint('TOPLEFT', 348.5, -50) scroll_frame:SetPoint('TOPLEFT', 348.5, -50)
@@ -584,7 +584,7 @@ function create_frames()
scroll_frame:SetScript('OnMouseWheel', function() scroll_frame:SetScript('OnMouseWheel', function()
local child = this:GetScrollChild() local child = this:GetScrollChild()
child:SetFont('p', [[Fonts\ARIALN.TTF]], aux.util.bound(11, 23, aux.util.select(2, child:GetFont()) + arg1*2)) child:SetFont('p', [[Fonts\ARIALN.TTF]], aux.util.bound(11, 23, aux.util.select(2, child:GetFont()) + arg1*2))
m.update_filter_display() update_filter_display()
end) end)
scroll_frame:RegisterForDrag('LeftButton') scroll_frame:RegisterForDrag('LeftButton')
scroll_frame:SetScript('OnDragStart', function() scroll_frame:SetScript('OnDragStart', function()
@@ -596,7 +596,7 @@ function create_frames()
local new_x_offset = this.x_offset + x - this.x local new_x_offset = this.x_offset + x - this.x
local new_y_offset = this.y_offset + y - this.y local new_y_offset = this.y_offset + y - this.y
m.set_filter_display_offset(new_x_offset - this.x_extra, new_y_offset - this.y_extra) set_filter_display_offset(new_x_offset - this.x_extra, new_y_offset - this.y_extra)
this.x_extra = max(this.x_extra, new_x_offset) this.x_extra = max(this.x_extra, new_x_offset)
this.y_extra = min(this.y_extra, new_y_offset) this.y_extra = min(this.y_extra, new_y_offset)
@@ -612,7 +612,7 @@ function create_frames()
scroll_child:SetTextColor('p', aux.gui.color.label.enabled()) scroll_child:SetTextColor('p', aux.gui.color.label.enabled())
scroll_child:SetWidth(1) scroll_child:SetWidth(1)
scroll_child:SetHeight(1) scroll_child:SetHeight(1)
scroll_child:SetScript('OnHyperlinkClick', m.data_link_click) scroll_child:SetScript('OnHyperlinkClick', data_link_click)
-- scroll_child:SetHyperlinkFormat("format") -- scroll_child:SetHyperlinkFormat("format")
scroll_child.measure = scroll_child:CreateFontString() scroll_child.measure = scroll_child:CreateFontString()
filter_display = scroll_child filter_display = scroll_child
@@ -621,60 +621,60 @@ function create_frames()
status_bars = {} status_bars = {}
tables = {} 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(frame)
status_bar:SetAllPoints(m.status_bar_frame) status_bar:SetAllPoints(status_bar_frame)
status_bar:Hide() status_bar:Hide()
tinsert(m.status_bars, status_bar) tinsert(status_bars, status_bar)
local table = aux.auction_listing.CreateAuctionResultsTable(m.frame.results, aux.auction_listing.search_config) local table = aux.auction_listing.CreateAuctionResultsTable(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 current_search().table:GetSelection().record == cell.row.data.record then
if button == 'LeftButton' and m.buyout_button:IsEnabled() then if button == 'LeftButton' and buyout_button:IsEnabled() then
m.buyout_button:Click() buyout_button:Click()
elseif button == 'RightButton' and m.bid_button:IsEnabled() then elseif button == 'RightButton' and bid_button:IsEnabled() then
m.bid_button:Click() bid_button:Click()
end end
end end
end) end)
table:SetHandler('OnSelectionChanged', function(rt, datum) table:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end if not datum then return end
m.find_auction(datum.record) find_auction(datum.record)
end) end)
table:Hide() table:Hide()
tinsert(m.tables, table) tinsert(tables, table)
end end
local handlers = { local handlers = {
OnClick = function(st, data, _, button) OnClick = function(st, data, _, button)
if not data then return end if not data then return end
if button == 'LeftButton' and IsShiftKeyDown() then if button == 'LeftButton' and IsShiftKeyDown() then
m.search_box:SetText(data.search.filter_string) search_box:SetText(data.search.filter_string)
elseif button == 'RightButton' and IsShiftKeyDown() then elseif button == 'RightButton' and IsShiftKeyDown() then
m.add_filter(data.search.filter_string) add_filter(data.search.filter_string)
elseif button == 'LeftButton' and IsControlKeyDown() then elseif button == 'LeftButton' and IsControlKeyDown() then
if st == m.favorite_searches_listing and data.index > 1 then if st == favorite_searches_listing and data.index > 1 then
local temp = _G.aux_favorite_searches[data.index - 1] local temp = g.aux_favorite_searches[data.index - 1]
_G.aux_favorite_searches[data.index - 1] = data.search g.aux_favorite_searches[data.index - 1] = data.search
_G.aux_favorite_searches[data.index] = temp g.aux_favorite_searches[data.index] = temp
m.update_search_listings() update_search_listings()
end end
elseif button == 'RightButton' and IsControlKeyDown() then elseif button == 'RightButton' and IsControlKeyDown() then
if st == m.favorite_searches_listing and data.index < getn(_G.aux_favorite_searches) then if st == favorite_searches_listing and data.index < getn(g.aux_favorite_searches) then
local temp = _G.aux_favorite_searches[data.index + 1] local temp = g.aux_favorite_searches[data.index + 1]
_G.aux_favorite_searches[data.index + 1] = data.search g.aux_favorite_searches[data.index + 1] = data.search
_G.aux_favorite_searches[data.index] = temp g.aux_favorite_searches[data.index] = temp
m.update_search_listings() update_search_listings()
end end
elseif button == 'LeftButton' then elseif button == 'LeftButton' then
m.search_box:SetText(data.search.filter_string) search_box:SetText(data.search.filter_string)
m.execute() execute()
elseif button == 'RightButton' then elseif button == 'RightButton' then
if st == m.recent_searches_listing then if st == recent_searches_listing then
tinsert(_G.aux_favorite_searches, 1, data.search) tinsert(g.aux_favorite_searches, 1, data.search)
elseif st == m.favorite_searches_listing then elseif st == favorite_searches_listing then
tremove(_G.aux_favorite_searches, data.index) tremove(g.aux_favorite_searches, data.index)
end end
m.update_search_listings() update_search_listings()
end end
end, end,
OnEnter = function(st, data, self) OnEnter = function(st, data, self)
@@ -689,19 +689,19 @@ function create_frames()
end end
} }
recent_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.recent) recent_searches_listing = aux.listing.CreateScrollingTable(frame.saved.recent)
m.recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}} recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
m.recent_searches_listing:EnableSorting(false) recent_searches_listing:EnableSorting(false)
m.recent_searches_listing:DisableSelection(true) recent_searches_listing:DisableSelection(true)
m.recent_searches_listing:SetHandler('OnClick', handlers.OnClick) recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
m.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter) recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave) recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
favorite_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.favorite) favorite_searches_listing = aux.listing.CreateScrollingTable(frame.saved.favorite)
m.favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}} favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}}
m.favorite_searches_listing:EnableSorting(false) favorite_searches_listing:EnableSorting(false)
m.favorite_searches_listing:DisableSelection(true) favorite_searches_listing:DisableSelection(true)
m.favorite_searches_listing:SetHandler('OnClick', handlers.OnClick) favorite_searches_listing:SetHandler('OnClick', handlers.OnClick)
m.favorite_searches_listing:SetHandler('OnEnter', handlers.OnEnter) favorite_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
m.favorite_searches_listing:SetHandler('OnLeave', handlers.OnLeave) favorite_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
end end
+4 -4
View File
@@ -1,6 +1,6 @@
aux.module 'search_tab' aux.module 'search_tab'
_G.aux_auto_buy_filter = '' g.aux_auto_buy_filter = ''
search_scan_id = 0 search_scan_id = 0
auto_buy_validator = nil auto_buy_validator = nil
@@ -114,8 +114,8 @@ function update_start_stop()
end end
function update_auto_buy_filter() function update_auto_buy_filter()
if _G.aux_auto_buy_filter ~= '' then if g.aux_auto_buy_filter ~= '' then
local queries = aux.filter.queries(_G.aux_auto_buy_filter) local queries = aux.filter.queries(g.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')
@@ -129,7 +129,7 @@ function update_auto_buy_filter()
end end
end end
end end
_G.aux_auto_buy_filter = '' g.aux_auto_buy_filter = ''
end end
function start_real_time_scan(query, search, continuation) function start_real_time_scan(query, search, continuation)
+7 -7
View File
@@ -1,11 +1,11 @@
aux.module 'search_tab' aux.module 'search_tab'
_G.aux_favorite_searches = {} g.aux_favorite_searches = {}
_G.aux_recent_searches = {} g.aux_recent_searches = {}
function update_search_listings() function update_search_listings()
local favorite_search_rows = {} local favorite_search_rows = {}
for i, favorite_search in _G.aux_favorite_searches do for i, favorite_search in g.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}},
@@ -16,7 +16,7 @@ function 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 _G.aux_recent_searches do for i, recent_search in g.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}},
@@ -28,12 +28,12 @@ function update_search_listings()
end end
function new_recent_search(filter_string, prettified) function new_recent_search(filter_string, prettified)
tinsert(_G.aux_recent_searches, 1, { tinsert(g.aux_recent_searches, 1, {
filter_string = filter_string, filter_string = filter_string,
prettified = prettified, prettified = prettified,
}) })
while getn(_G.aux_recent_searches) > 50 do while getn(g.aux_recent_searches) > 50 do
tremove(_G.aux_recent_searches) tremove(g.aux_recent_searches)
end end
m.update_search_listings() m.update_search_listings()
end end
+2 -2
View File
@@ -292,7 +292,7 @@ function public.parse_query_string(str)
if input_type ~= '' then if input_type ~= '' then
if not parts[i + 1] or not m.parse_parameter(input_type, parts[i + 1]) then if not parts[i + 1] or not m.parse_parameter(input_type, parts[i + 1]) then
if parts[i] == 'item' then if parts[i] == 'item' then
return nil, 'Invalid item name', _G.aux_auctionable_items return nil, 'Invalid item name', g.aux_auctionable_items
elseif type(input_type) == 'table' then elseif type(input_type) == 'table' then
return nil, 'Invalid choice for '..parts[i], input_type return nil, 'Invalid choice for '..parts[i], input_type
else else
@@ -423,7 +423,7 @@ function suggestions(components)
-- item names -- item names
if aux.util.size(components.blizzard) + getn(components.post) == 1 and components.blizzard.name == '' then if aux.util.size(components.blizzard) + getn(components.post) == 1 and components.blizzard.name == '' then
for _, name in _G.aux_auctionable_items do for _, name in g.aux_auctionable_items do
tinsert(suggestions, name..'/exact') tinsert(suggestions, name..'/exact')
end end
end end
+10 -11
View File
@@ -40,13 +40,13 @@ end
function public.container_item(bag, slot) function public.container_item(bag, slot)
for link in aux.util.present(GetContainerItemLink(bag, slot)) do for link in aux.util.present(GetContainerItemLink(bag, slot)) do
local item_id, suffix_id, unique_id, enchant_id = m.parse_link(link) local item_id, suffix_id, unique_id, enchant_id = parse_link(link)
local item_info = m.item(item_id, suffix_id, unique_id, enchant_id) local item_info = m.item(item_id, suffix_id, unique_id, enchant_id)
local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot) -- quality not working? local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot) -- quality not working?
local tooltip, tooltip_money = m.tooltip(function(tt) tt:SetBagItem(bag, slot) end) local tooltip, tooltip_money = m.tooltip(function(tt) tt:SetBagItem(bag, slot) end)
local max_charges = m.max_item_charges(item_id) local max_charges = max_item_charges(item_id)
local charges = max_charges and m.item_charges(tooltip) local charges = max_charges and item_charges(tooltip)
local aux_quantity = charges or count local aux_quantity = charges or count
return { return {
@@ -99,8 +99,7 @@ function public.auction(index, query_type)
query_type = query_type or 'list' query_type = query_type or 'list'
for link in aux.util.present(GetAuctionItemLink(query_type, index)) do for link in aux.util.present(GetAuctionItemLink(query_type, index)) do
local item_id, suffix_id, unique_id, enchant_id = parse_link(link)
local item_id, suffix_id, unique_id, enchant_id = m.parse_link(link)
local item_info = m.item(item_id, suffix_id, unique_id, enchant_id) local item_info = m.item(item_id, suffix_id, unique_id, enchant_id)
local name, texture, count, quality, usable, level, start_price, min_increment, buyout_price, high_bid, high_bidder, owner, sale_status = GetAuctionItemInfo(query_type, index) local name, texture, count, quality, usable, level, start_price, min_increment, buyout_price, high_bid, high_bidder, owner, sale_status = GetAuctionItemInfo(query_type, index)
@@ -122,8 +121,8 @@ function public.auction(index, query_type)
link = link, link = link,
itemstring = item_info.itemstring, itemstring = item_info.itemstring,
item_key = item_id..':'..suffix_id, item_key = item_id..':'..suffix_id,
search_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), _G.aux_ignore_owner and (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'), search_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), g.aux_ignore_owner and (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
sniping_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, _G.aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'), sniping_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, g.aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
name = name, name = name,
texture = texture, texture = texture,
@@ -167,7 +166,7 @@ function public.bid_update(auction_record)
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
auction_record.high_bidder = 1 auction_record.high_bidder = 1
auction_record.search_signature = table.concat({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, _G.aux_ignore_owner and (aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':') auction_record.search_signature = table.concat({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, g.aux_ignore_owner and (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)
@@ -176,7 +175,7 @@ function public.set_tooltip(itemstring, owner, anchor)
end end
function public.set_shopping_tooltip(slot) function public.set_shopping_tooltip(slot)
local index1, index2 = m.inventory_index(slot) local index1, index2 = inventory_index(slot)
local tooltips = {} local tooltips = {}
if index1 then if index1 then
local tooltip = m.tooltip(function(tt) tt:SetInventoryItem('player', index1) end) local tooltip = m.tooltip(function(tt) tt:SetInventoryItem('player', index1) end)
@@ -192,7 +191,7 @@ function public.set_shopping_tooltip(slot)
end end
if tooltips[1] then if tooltips[1] then
tinsert(tooltips[1], 1, { left_text = 'Currently Equipped', left_color = { 0.5, 0.5, 0.5 } }) tinsert(tooltips[1], 1, {left_text='Currently Equipped', left_color={ 0.5, 0.5, 0.5 }})
ShoppingTooltip1:SetOwner(GameTooltip, 'ANCHOR_BOTTOMRIGHT') ShoppingTooltip1:SetOwner(GameTooltip, 'ANCHOR_BOTTOMRIGHT')
m.load_tooltip(ShoppingTooltip1, tooltips[1]) m.load_tooltip(ShoppingTooltip1, tooltips[1])
ShoppingTooltip1:Show() ShoppingTooltip1:Show()
@@ -200,7 +199,7 @@ function public.set_shopping_tooltip(slot)
end end
if tooltips[2] then if tooltips[2] then
tinsert(tooltips[2], 1, { left_text = 'Currently Equipped', left_color = { 0.5, 0.5, 0.5 } }) tinsert(tooltips[2], 1, {left_text='Currently Equipped', left_color={ 0.5, 0.5, 0.5 }})
ShoppingTooltip2:SetOwner(ShoppingTooltip1, 'ANCHOR_BOTTOMRIGHT') ShoppingTooltip2:SetOwner(ShoppingTooltip1, 'ANCHOR_BOTTOMRIGHT')
m.load_tooltip(ShoppingTooltip2, tooltips[2]) m.load_tooltip(ShoppingTooltip2, tooltips[2])
ShoppingTooltip2:Show() ShoppingTooltip2:Show()
+3 -3
View File
@@ -1,6 +1,6 @@
aux.module 'persistence' aux.module 'persistence'
_G.aux_datasets = {} g.aux_datasets = {}
do do
local realm, faction local realm, faction
@@ -17,8 +17,8 @@ end
function public.load_dataset() function public.load_dataset()
local dataset_key = m.get_dataset_key() local dataset_key = m.get_dataset_key()
_G.aux_datasets[dataset_key] = _G.aux_datasets[dataset_key] or {} g.aux_datasets[dataset_key] = g.aux_datasets[dataset_key] or {}
return _G.aux_datasets[dataset_key] return g.aux_datasets[dataset_key]
end end
function public.read(schema, str) function public.read(schema, str)