big module refactoring
This commit is contained in:
+22
-22
@@ -6,12 +6,12 @@ private.MAX_ITEM_ID = 30000
|
|||||||
private.items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
|
private.items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
|
||||||
private.merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} }
|
private.merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} }
|
||||||
|
|
||||||
aux_items = {}
|
_G.aux_items = {}
|
||||||
aux_item_ids = {}
|
_G.aux_item_ids = {}
|
||||||
aux_auctionable_items = {}
|
_G.aux_auctionable_items = {}
|
||||||
aux_merchant_buy = {}
|
_G.aux_merchant_buy = {}
|
||||||
aux_merchant_sell = {}
|
_G.aux_merchant_sell = {}
|
||||||
aux_characters = {}
|
_G.aux_characters = {}
|
||||||
|
|
||||||
function m.LOAD()
|
function m.LOAD()
|
||||||
m.scan_wdb()
|
m.scan_wdb()
|
||||||
@@ -26,7 +26,7 @@ function m.LOAD()
|
|||||||
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
|
||||||
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)
|
||||||
@@ -78,15 +78,15 @@ end
|
|||||||
|
|
||||||
function public.merchant_info(item_id)
|
function public.merchant_info(item_id)
|
||||||
local buy_info
|
local buy_info
|
||||||
if aux_merchant_buy[item_id] then
|
if _G.aux_merchant_buy[item_id] then
|
||||||
buy_info = aux.persistence.read(m.merchant_buy_schema, aux_merchant_buy[item_id])
|
buy_info = aux.persistence.read(m.merchant_buy_schema, _G.aux_merchant_buy[item_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
return aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
|
return _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 = 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(m.items_schema, data_string)
|
||||||
return {
|
return {
|
||||||
@@ -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 aux_item_ids[strlower(item_name)]
|
return _G.aux_item_ids[strlower(item_name)]
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.merchant_buy_scan()
|
function private.merchant_buy_scan()
|
||||||
@@ -116,8 +116,8 @@ function private.merchant_buy_scan()
|
|||||||
if link then
|
if link then
|
||||||
local item_id = aux.info.parse_hyperlink(link)
|
local item_id = aux.info.parse_hyperlink(link)
|
||||||
local new_unit_price, new_limited = price / count, stock >= 0
|
local new_unit_price, new_limited = price / count, stock >= 0
|
||||||
if aux_merchant_buy[item_id] then
|
if _G.aux_merchant_buy[item_id] then
|
||||||
local buy_info = aux.persistence.read(m.merchant_buy_schema, aux_merchant_buy[item_id])
|
local buy_info = aux.persistence.read(m.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 private.merchant_buy_scan()
|
|||||||
unit_price = min(buy_info.unit_price, new_unit_price)
|
unit_price = min(buy_info.unit_price, new_unit_price)
|
||||||
end
|
end
|
||||||
|
|
||||||
aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, {
|
_G.aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, {
|
||||||
unit_price = unit_price,
|
unit_price = unit_price,
|
||||||
limited = buy_info.limited and new_limited,
|
limited = buy_info.limited and new_limited,
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, {
|
_G.aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, {
|
||||||
unit_price = new_unit_price,
|
unit_price = new_unit_price,
|
||||||
limited = new_limited,
|
limited = new_limited,
|
||||||
})
|
})
|
||||||
@@ -150,7 +150,7 @@ function private.merchant_sell_scan()
|
|||||||
for slot in aux.util.inventory() do
|
for slot in aux.util.inventory() do
|
||||||
local item_info = aux.info.container_item(unpack(slot))
|
local item_info = aux.info.container_item(unpack(slot))
|
||||||
if item_info then
|
if item_info then
|
||||||
aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
|
_G.aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -162,9 +162,9 @@ function private.scan_wdb(item_id)
|
|||||||
while processed <= 100 and item_id <= m.MAX_ITEM_ID do
|
while processed <= 100 and item_id <= m.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 aux_item_ids[strlower(name)] then
|
if name and not _G.aux_item_ids[strlower(name)] then
|
||||||
aux_item_ids[strlower(name)] = item_id
|
_G.aux_item_ids[strlower(name)] = item_id
|
||||||
aux_items[item_id] = aux.persistence.write(m.items_schema, {
|
_G.aux_items[item_id] = aux.persistence.write(m.items_schema, {
|
||||||
name = name,
|
name = name,
|
||||||
quality = quality,
|
quality = quality,
|
||||||
level = level,
|
level = level,
|
||||||
@@ -176,7 +176,7 @@ function private.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(aux_auctionable_items, strlower(name))
|
tinsert(_G.aux_auctionable_items, strlower(name))
|
||||||
end
|
end
|
||||||
processed = processed + 1
|
processed = processed + 1
|
||||||
end
|
end
|
||||||
@@ -187,7 +187,7 @@ function private.scan_wdb(item_id)
|
|||||||
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, m.scan_wdb, item_id)
|
||||||
else
|
else
|
||||||
sort(aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
|
sort(_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
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -145,7 +145,7 @@ function private.scan_page(i)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local auction_info = aux.info.auction(i, m.state.params.type)
|
local auction_info = aux.info.auction(i, m.state.params.type)
|
||||||
if auction_info and (auction_info.owner or m.state.params.ignore_owner or aux_ignore_owner) then
|
if auction_info and (auction_info.owner or m.state.params.ignore_owner or _G.aux_ignore_owner) then
|
||||||
auction_info.index = i
|
auction_info.index = i
|
||||||
auction_info.page = m.state.page
|
auction_info.page = m.state.page
|
||||||
auction_info.blizzard_query = m.query.blizzard_query
|
auction_info.blizzard_query = m.query.blizzard_query
|
||||||
@@ -216,7 +216,7 @@ function private.wait_for_list_results(send_signal, signal_received)
|
|||||||
last_update = GetTime()
|
last_update = GetTime()
|
||||||
updated = true
|
updated = true
|
||||||
end)
|
end)
|
||||||
local ignore_owner = m.state.params.ignore_owner or aux_ignore_owner
|
local ignore_owner = m.state.params.ignore_owner or _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 m.owner_data_complete('list')) or last_update and GetTime() - last_update > 5
|
local ok = updated and (ignore_owner or m.owner_data_complete('list')) or last_update and GetTime() - last_update > 5
|
||||||
|
|||||||
+29
-29
@@ -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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
aux_items = {}
|
_G.aux_items = {}
|
||||||
aux_item_ids = {}
|
_G.aux_item_ids = {}
|
||||||
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
|
||||||
aux_tooltip_value = not aux_tooltip_value
|
_G.aux_tooltip_value = not _G.aux_tooltip_value
|
||||||
aux.log('Historical value in tooltip '..(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
|
||||||
aux_tooltip_daily = not aux_tooltip_daily
|
_G.aux_tooltip_daily = not _G.aux_tooltip_daily
|
||||||
aux.log('Market value in tooltip '..(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
|
||||||
aux_tooltip_vendor_buy = not aux_tooltip_vendor_buy
|
_G.aux_tooltip_vendor_buy = not _G.aux_tooltip_vendor_buy
|
||||||
aux.log('Vendor buy price in tooltip '..(aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.')
|
aux.log('Vendor buy price in tooltip '..(_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
|
||||||
aux_tooltip_vendor_sell = not aux_tooltip_vendor_sell
|
_G.aux_tooltip_vendor_sell = not _G.aux_tooltip_vendor_sell
|
||||||
aux.log('Vendor sell price in tooltip '..(aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.')
|
aux.log('Vendor sell price in tooltip '..(_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
|
||||||
aux_tooltip_disenchant_value = not aux_tooltip_disenchant_value
|
_G.aux_tooltip_disenchant_value = not _G.aux_tooltip_disenchant_value
|
||||||
aux.log('Disenchant value in tooltip '..(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
|
||||||
aux_tooltip_disenchant_distribution = not aux_tooltip_disenchant_distribution
|
_G.aux_tooltip_disenchant_distribution = not _G.aux_tooltip_disenchant_distribution
|
||||||
aux.log('Disenchant distribution in tooltip '..(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
|
||||||
aux_tooltip_disenchant_source = not aux_tooltip_disenchant_source
|
_G.aux_tooltip_disenchant_source = not _G.aux_tooltip_disenchant_source
|
||||||
aux.log('Disenchant source in tooltip '..(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
|
||||||
aux_ignore_owner = not aux_ignore_owner
|
_G.aux_ignore_owner = not _G.aux_ignore_owner
|
||||||
aux.log('Ignoring of owner '..(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'
|
||||||
aux_characters[realm] = 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 aux_characters[realm][name] then
|
if not _G.aux_characters[realm][name] then
|
||||||
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 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 aux_characters[realm][name] then
|
if _G.aux_characters[realm][name] then
|
||||||
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 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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
aux.module 'tooltip'
|
aux.module 'tooltip'
|
||||||
|
|
||||||
aux_tooltip_value = true
|
_G.aux_tooltip_value = true
|
||||||
|
|
||||||
private.game_tooltip_hooks = {}
|
private.game_tooltip_hooks = {}
|
||||||
private.hooked_setter = nil
|
private.hooked_setter = nil
|
||||||
@@ -47,7 +47,7 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
local item_id, suffix_id = aux.info.parse_hyperlink(hyperlink)
|
local item_id, suffix_id = aux.info.parse_hyperlink(hyperlink)
|
||||||
quantity = IsShiftKeyDown() and quantity or 1
|
quantity = IsShiftKeyDown() and quantity or 1
|
||||||
|
|
||||||
if aux_tooltip_disenchant_source then
|
if _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 private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
|
|
||||||
if getn(distribution) > 0 then
|
if getn(distribution) > 0 then
|
||||||
|
|
||||||
if 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 private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if 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 private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if 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 private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..aux.money.format(price * quantity), color.r, color.g, color.b)
|
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..aux.money.format(price * quantity), color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if 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 private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
|
|
||||||
local value = aux.history.value(item_key)
|
local value = aux.history.value(item_key)
|
||||||
if auctionable then
|
if auctionable then
|
||||||
if aux_tooltip_value then
|
if _G.aux_tooltip_value then
|
||||||
tooltip:AddLine('Value: '..(value and aux.money.format(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
tooltip:AddLine('Value: '..(value and aux.money.format(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
if aux_tooltip_daily then
|
if _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.format(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.format(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
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local data = setmetatable({}, {__mode='kv'})
|
local _state = setmetatable({}, {__mode='kv'})
|
||||||
local __index = function(self, key)
|
local __index = function(self, key)
|
||||||
return data[self].handler({public=self, private=data[self].state}, key)
|
return _state[self].handler({public=self, private=_state[self].state}, key)
|
||||||
end
|
end
|
||||||
function public.index_function(state, handler)
|
function public.index_function(state, handler)
|
||||||
local self = {}
|
local state, self = {handler=handler, state=state}, {}
|
||||||
data[self] = {handler=handler, state=state}
|
_state[self] = state
|
||||||
return setmetatable(self, {__metatable=false, __index=__index, state=data})
|
return setmetatable(self, {__metatable=false, __index=__index, state=state})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ end
|
|||||||
function public.VARIABLES_LOADED()
|
function public.VARIABLES_LOADED()
|
||||||
do
|
do
|
||||||
local frame = CreateFrame('Frame', aux.gui.name(), UIParent)
|
local frame = CreateFrame('Frame', aux.gui.name(), UIParent)
|
||||||
tinsert(UISpecialFrames, 'aux_frame1')
|
tinsert(UISpecialFrames, '_G.aux_frame1')
|
||||||
m.gui.set_window_style(frame)
|
m.gui.set_window_style(frame)
|
||||||
frame:SetWidth(768)
|
frame:SetWidth(768)
|
||||||
frame:SetHeight(447)
|
frame:SetHeight(447)
|
||||||
@@ -430,7 +430,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(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()
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ do
|
|||||||
local id = 0
|
local id = 0
|
||||||
function public.name()
|
function public.name()
|
||||||
id = id + 1
|
id = id + 1
|
||||||
return 'aux_frame'..id
|
return '_G.aux_frame'..id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ do
|
|||||||
aux.hook('ToggleDropDownMenu', function(...)
|
aux.hook('ToggleDropDownMenu', function(...)
|
||||||
local ret = {aux.orig.ToggleDropDownMenu(unpack(arg))}
|
local ret = {aux.orig.ToggleDropDownMenu(unpack(arg))}
|
||||||
local dropdown = getglobal(arg[4] or '') or this:GetParent()
|
local dropdown = getglobal(arg[4] or '') or this:GetParent()
|
||||||
if strfind(dropdown:GetName() or '', 'aux_frame') then
|
if strfind(dropdown:GetName() or '', '_G.aux_frame') then
|
||||||
m.set_aux_dropdown_style(dropdown)
|
m.set_aux_dropdown_style(dropdown)
|
||||||
else
|
else
|
||||||
m.set_blizzard_dropdown_style()
|
m.set_blizzard_dropdown_style()
|
||||||
|
|||||||
+9
-9
@@ -1,4 +1,4 @@
|
|||||||
local band, bor, bnot = bit.band, bit.bor, bit.bnot
|
local band, bor, bnot, lshift = bit.band, bit.bor, bit.bnot, bit.lshift
|
||||||
local _G = getfenv(0)
|
local _G = getfenv(0)
|
||||||
|
|
||||||
local FIELD, ACCESSOR, MUTABLE, PUBLIC = 1, 2, 4, 8
|
local FIELD, ACCESSOR, MUTABLE, PUBLIC = 1, 2, 4, 8
|
||||||
@@ -32,8 +32,8 @@ local environment_mt = {
|
|||||||
local properties = _metadata[self][key]
|
local properties = _metadata[self][key]
|
||||||
if properties == 0 then
|
if properties == 0 then
|
||||||
_metadata[self][key] = FIELD
|
_metadata[self][key] = FIELD
|
||||||
elseif band(MUTABLE, properties) == 0 then
|
-- elseif band(MUTABLE, properties) == 0 then
|
||||||
error('"'..key..'" is immutable.', 2)
|
-- error('"'..key..'" is immutable.', 2)
|
||||||
end
|
end
|
||||||
_data[self][key] = value
|
_data[self][key] = value
|
||||||
end,
|
end,
|
||||||
@@ -42,9 +42,9 @@ local interface_mt = {
|
|||||||
__metatable = false,
|
__metatable = false,
|
||||||
__index = function(self, key)
|
__index = function(self, key)
|
||||||
local value, properties = _data[self][key], _metadata[self][key]
|
local value, properties = _data[self][key], _metadata[self][key]
|
||||||
if band(FIELD, properties) ~= 0 then
|
if band(FIELD+PUBLIC, properties) == FIELD+PUBLIC then
|
||||||
return value
|
return value
|
||||||
elseif band(ACCESSOR, properties) ~= 0 then
|
elseif band(ACCESSOR+PUBLIC, properties) == ACCESSOR+PUBLIC then
|
||||||
return value(key)
|
return value(key)
|
||||||
else
|
else
|
||||||
error('No key "'..key..'".', 2)
|
error('No key "'..key..'".', 2)
|
||||||
@@ -67,14 +67,14 @@ local modifier_mt = {
|
|||||||
__newindex = function(self, key, value)
|
__newindex = function(self, key, value)
|
||||||
if _metadata[self][key] ~= 0 then error('Duplicate key "'..key..'".', 2) end
|
if _metadata[self][key] ~= 0 then error('Duplicate key "'..key..'".', 2) end
|
||||||
_data[self][key] = value
|
_data[self][key] = value
|
||||||
_metadata[self][key] = _state[self]
|
_metadata[self][key] = bor(band(FIELD, bnot(lshift(_state[self], 1))), _state[self])
|
||||||
_state[self] = 0
|
_state[self] = 0
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
function aux_module()
|
function _G.aux_module()
|
||||||
local modifier, environment, interface = setmetatable({}, modifier_mt), setmetatable({}, environment_mt), setmetatable({}, interface_mt)
|
local modifier, environment, interface = setmetatable({}, modifier_mt), setmetatable({}, environment_mt), setmetatable({}, interface_mt)
|
||||||
local data = {[ACCESSOR_KEY]=modifier, [MUTABLE_KEY]=modifier, [PUBLIC_KEY]=modifier}
|
local data = {_G=_G, [ACCESSOR_KEY]=modifier, [MUTABLE_KEY]=modifier, [PUBLIC_KEY]=modifier}
|
||||||
local metadata = setmetatable({[ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=ACCESSOR, [PUBLIC_KEY]=ACCESSOR}, metadata_mt)
|
local metadata = setmetatable({_G=FIELD, [ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=ACCESSOR, [PUBLIC_KEY]=ACCESSOR}, metadata_mt)
|
||||||
|
|
||||||
_data[modifier], _data[environment], _data[interface] = data, data, data
|
_data[modifier], _data[environment], _data[interface] = data, data, data
|
||||||
_metadata[modifier], _metadata[environment], _metadata[interface] = metadata, metadata, metadata
|
_metadata[modifier], _metadata[environment], _metadata[interface] = metadata, metadata, metadata
|
||||||
|
|||||||
+32
-30
@@ -1,5 +1,7 @@
|
|||||||
aux.module 'auction_listing'
|
aux.module 'auction_listing'
|
||||||
|
|
||||||
|
_G.aux_price_per_unit = false
|
||||||
|
|
||||||
local RT_COUNT = 1
|
local RT_COUNT = 1
|
||||||
local HEAD_HEIGHT = 27
|
local HEAD_HEIGHT = 27
|
||||||
local HEAD_SPACE = 2
|
local HEAD_SPACE = 2
|
||||||
@@ -162,24 +164,24 @@ public.search_config = {
|
|||||||
end
|
end
|
||||||
local price
|
local price
|
||||||
if record.high_bidder then
|
if record.high_bidder then
|
||||||
price = 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 = 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 = 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 = 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 = 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 = 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.sort.compare(price_a, price_b, desc)
|
return aux.sort.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -190,12 +192,12 @@ public.search_config = {
|
|||||||
align = 'RIGHT',
|
align = 'RIGHT',
|
||||||
isPrice = true,
|
isPrice = true,
|
||||||
set = function(cell, record)
|
set = function(cell, record)
|
||||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = _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 = 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 = 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)
|
||||||
|
|
||||||
@@ -304,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 = 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 = 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 = 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 = 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 = 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 = 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.sort.compare(price_a, price_b, desc)
|
return aux.sort.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -332,12 +334,12 @@ public.auctions_config = {
|
|||||||
align = 'RIGHT',
|
align = 'RIGHT',
|
||||||
isPrice = true,
|
isPrice = true,
|
||||||
set = function(cell, record)
|
set = function(cell, record)
|
||||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = _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 = 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 = 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)
|
||||||
|
|
||||||
@@ -457,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 = 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 = 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 = 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 = 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 = 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 = 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.sort.compare(price_a, price_b, desc)
|
return aux.sort.compare(price_a, price_b, desc)
|
||||||
end,
|
end,
|
||||||
@@ -485,12 +487,12 @@ public.bids_config = {
|
|||||||
align = 'RIGHT',
|
align = 'RIGHT',
|
||||||
isPrice = true,
|
isPrice = true,
|
||||||
set = function(cell, record)
|
set = function(cell, record)
|
||||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = _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 = 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 = 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)
|
||||||
|
|
||||||
@@ -563,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
|
||||||
aux_price_per_unit = not 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[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()
|
||||||
@@ -1005,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[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)
|
||||||
|
|||||||
@@ -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 = '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
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
|||||||
}
|
}
|
||||||
do
|
do
|
||||||
local function action()
|
local function action()
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -169,7 +169,7 @@ function private.create_frames()
|
|||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
if this:GetChecked() then
|
if this:GetChecked() then
|
||||||
this:SetChecked(false)
|
this:SetChecked(false)
|
||||||
aux_auto_buy_filter = nil
|
_G.aux_auto_buy_filter = nil
|
||||||
this.prettified = nil
|
this.prettified = nil
|
||||||
m.auto_buy_validator = nil
|
m.auto_buy_validator = nil
|
||||||
else
|
else
|
||||||
@@ -334,7 +334,7 @@ function private.create_frames()
|
|||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
local filters = aux.filter.queries(m.search_box:GetText())
|
local filters = aux.filter.queries(m.search_box:GetText())
|
||||||
if filters then
|
if filters then
|
||||||
tinsert(aux_favorite_searches, 1, {
|
tinsert(_G.aux_favorite_searches, 1, {
|
||||||
filter_string = m.search_box:GetText(),
|
filter_string = m.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), ';'),
|
||||||
})
|
})
|
||||||
@@ -369,7 +369,7 @@ function private.create_frames()
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = aux.gui.editbox(m.frame.filter)
|
local editbox = aux.gui.editbox(m.frame.filter)
|
||||||
editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end)
|
editbox.complete_item = aux.completion.complete(function() return _G.aux_auctionable_items end)
|
||||||
editbox:SetPoint('TOPLEFT', 14, -m.FILTER_SPACING)
|
editbox:SetPoint('TOPLEFT', 14, -m.FILTER_SPACING)
|
||||||
editbox:SetWidth(260)
|
editbox:SetWidth(260)
|
||||||
editbox:SetScript('OnChar', function()
|
editbox:SetScript('OnChar', function()
|
||||||
@@ -653,16 +653,16 @@ function private.create_frames()
|
|||||||
m.add_filter(data.search.filter_string)
|
m.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 == m.favorite_searches_listing and data.index > 1 then
|
||||||
local temp = aux_favorite_searches[data.index - 1]
|
local temp = _G.aux_favorite_searches[data.index - 1]
|
||||||
aux_favorite_searches[data.index - 1] = data.search
|
_G.aux_favorite_searches[data.index - 1] = data.search
|
||||||
aux_favorite_searches[data.index] = temp
|
_G.aux_favorite_searches[data.index] = temp
|
||||||
m.update_search_listings()
|
m.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(aux_favorite_searches) then
|
if st == m.favorite_searches_listing and data.index < getn(_G.aux_favorite_searches) then
|
||||||
local temp = aux_favorite_searches[data.index + 1]
|
local temp = _G.aux_favorite_searches[data.index + 1]
|
||||||
aux_favorite_searches[data.index + 1] = data.search
|
_G.aux_favorite_searches[data.index + 1] = data.search
|
||||||
aux_favorite_searches[data.index] = temp
|
_G.aux_favorite_searches[data.index] = temp
|
||||||
m.update_search_listings()
|
m.update_search_listings()
|
||||||
end
|
end
|
||||||
elseif button == 'LeftButton' then
|
elseif button == 'LeftButton' then
|
||||||
@@ -670,9 +670,9 @@ function private.create_frames()
|
|||||||
m.execute()
|
m.execute()
|
||||||
elseif button == 'RightButton' then
|
elseif button == 'RightButton' then
|
||||||
if st == m.recent_searches_listing then
|
if st == m.recent_searches_listing then
|
||||||
tinsert(aux_favorite_searches, 1, data.search)
|
tinsert(_G.aux_favorite_searches, 1, data.search)
|
||||||
elseif st == m.favorite_searches_listing then
|
elseif st == m.favorite_searches_listing then
|
||||||
tremove(aux_favorite_searches, data.index)
|
tremove(_G.aux_favorite_searches, data.index)
|
||||||
end
|
end
|
||||||
m.update_search_listings()
|
m.update_search_listings()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
aux.module 'search_tab'
|
aux.module 'search_tab'
|
||||||
|
|
||||||
aux_auto_buy_filter = ''
|
_G.aux_auto_buy_filter = ''
|
||||||
|
|
||||||
private.search_scan_id = 0
|
private.search_scan_id = 0
|
||||||
private.auto_buy_validator = nil
|
private.auto_buy_validator = nil
|
||||||
@@ -114,8 +114,8 @@ function private:update_start_stop()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function private.update_auto_buy_filter()
|
function private.update_auto_buy_filter()
|
||||||
if aux_auto_buy_filter ~= '' then
|
if _G.aux_auto_buy_filter ~= '' then
|
||||||
local queries = aux.filter.queries(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 private.update_auto_buy_filter()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
aux_auto_buy_filter = ''
|
_G.aux_auto_buy_filter = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.start_real_time_scan(query, search, continuation)
|
function private.start_real_time_scan(query, search, continuation)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
aux.module 'search_tab'
|
aux.module 'search_tab'
|
||||||
|
|
||||||
aux_favorite_searches = {}
|
_G.aux_favorite_searches = {}
|
||||||
aux_recent_searches = {}
|
_G.aux_recent_searches = {}
|
||||||
|
|
||||||
function private.update_search_listings()
|
function private.update_search_listings()
|
||||||
local favorite_search_rows = {}
|
local favorite_search_rows = {}
|
||||||
for i, favorite_search in 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 private.update_search_listings()
|
|||||||
m.favorite_searches_listing:SetData(favorite_search_rows)
|
m.favorite_searches_listing:SetData(favorite_search_rows)
|
||||||
|
|
||||||
local recent_search_rows = {}
|
local recent_search_rows = {}
|
||||||
for i, recent_search in 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 private.update_search_listings()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function private.new_recent_search(filter_string, prettified)
|
function private.new_recent_search(filter_string, prettified)
|
||||||
tinsert(aux_recent_searches, 1, {
|
tinsert(_G.aux_recent_searches, 1, {
|
||||||
filter_string = filter_string,
|
filter_string = filter_string,
|
||||||
prettified = prettified,
|
prettified = prettified,
|
||||||
})
|
})
|
||||||
while getn(aux_recent_searches) > 50 do
|
while getn(_G.aux_recent_searches) > 50 do
|
||||||
tremove(aux_recent_searches)
|
tremove(_G.aux_recent_searches)
|
||||||
end
|
end
|
||||||
m.update_search_listings()
|
m.update_search_listings()
|
||||||
end
|
end
|
||||||
+2
-2
@@ -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', 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 private.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 aux_auctionable_items do
|
for _, name in _G.aux_auctionable_items do
|
||||||
tinsert(suggestions, name..'/exact')
|
tinsert(suggestions, name..'/exact')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+3
-3
@@ -124,8 +124,8 @@ function public.auction(index, query_type)
|
|||||||
hyperlink = hyperlink,
|
hyperlink = hyperlink,
|
||||||
itemstring = item_info.itemstring,
|
itemstring = item_info.itemstring,
|
||||||
item_key = item_id..':'..suffix_id,
|
item_key = item_id..':'..suffix_id,
|
||||||
search_signature = 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), 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, 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,
|
||||||
@@ -169,7 +169,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, 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)
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ function public.format(money, exact, color)
|
|||||||
-- Round to nearest silver
|
-- Round to nearest silver
|
||||||
money = floor(money / 100 + 0.5) * 100
|
money = floor(money / 100 + 0.5) * 100
|
||||||
end
|
end
|
||||||
local g, s, c = aux.money.gsc(money)
|
local g, s, c = m.gsc(money)
|
||||||
|
|
||||||
local str = ''
|
local str = ''
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
aux.module 'persistence'
|
aux.module 'persistence'
|
||||||
|
|
||||||
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()
|
||||||
aux_datasets[dataset_key] = aux_datasets[dataset_key] or {}
|
_G.aux_datasets[dataset_key] = _G.aux_datasets[dataset_key] or {}
|
||||||
return aux_datasets[dataset_key]
|
return _G.aux_datasets[dataset_key]
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.read(schema, str)
|
function public.read(schema, str)
|
||||||
|
|||||||
Reference in New Issue
Block a user