big module refactoring
This commit is contained in:
@@ -114,7 +114,7 @@ function private.merchant_buy_scan()
|
||||
local _, _, price, count, stock = GetMerchantItemInfo(i)
|
||||
local link = GetMerchantItemLink(i)
|
||||
if link then
|
||||
local item_id = aux.info.parse_hyperlink(link)
|
||||
local item_id = aux.info.parse_link(link)
|
||||
local new_unit_price, new_limited = price / count, stock >= 0
|
||||
if _G.aux_merchant_buy[item_id] then
|
||||
local buy_info = aux.persistence.read(m.merchant_buy_schema, _G.aux_merchant_buy[item_id])
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ do
|
||||
for _, old_state in {scan_states[params.type]} do
|
||||
m.abort(old_state.id)
|
||||
end
|
||||
local thread_id = aux.control.thread(aux._(m.wait_for_callback, params.on_scan_start, m.scan))
|
||||
local thread_id = aux.control.thread(aux.C(m.wait_for_callback, params.on_scan_start, m.scan))
|
||||
scan_states[params.type] = {
|
||||
id = thread_id,
|
||||
params = params,
|
||||
@@ -156,8 +156,8 @@ function private.scan_page(i)
|
||||
if aux.call(m.state.params.auto_buy_validator, auction_info) then
|
||||
local send_signal, signal_received = aux.util.signal()
|
||||
aux.control.when(signal_received, recurse)
|
||||
aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, aux._(send_signal, true))
|
||||
return aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux._(send_signal, false))
|
||||
aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, aux.C(send_signal, true))
|
||||
return aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux.C(send_signal, false))
|
||||
elseif not m.query.validator or m.query.validator(auction_info) then
|
||||
return m.wait_for_callback(m.state.params.on_auction, auction_info, function(removed)
|
||||
if removed then
|
||||
|
||||
@@ -43,8 +43,8 @@ function m.LOAD()
|
||||
end)
|
||||
end
|
||||
|
||||
function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
local item_id, suffix_id = aux.info.parse_hyperlink(hyperlink)
|
||||
function private.extend_tooltip(tooltip, link, quantity)
|
||||
local item_id, suffix_id = aux.info.parse_link(link)
|
||||
quantity = IsShiftKeyDown() and quantity or 1
|
||||
|
||||
if _G.aux_tooltip_disenchant_source then
|
||||
@@ -83,7 +83,7 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
local color = {r=0.1, g=0.6, b=0.6}
|
||||
|
||||
local disenchant_value = aux.disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and aux.money.format(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and aux.money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -93,7 +93,7 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
|
||||
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||
if price then
|
||||
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.to_string2(price * quantity), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
if _G.aux_tooltip_vendor_sell then
|
||||
@@ -101,7 +101,7 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
|
||||
local price = aux.cache.merchant_info(item_id)
|
||||
if price ~= 0 then
|
||||
tooltip:AddLine('Vendor Sell: '..(price and aux.money.format(price * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Vendor Sell: '..(price and aux.money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -113,11 +113,11 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
local value = aux.history.value(item_key)
|
||||
if auctionable 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.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
if _G.aux_tooltip_daily then
|
||||
local market_value = aux.history.market_value(item_key)
|
||||
tooltip:AddLine('Today: '..(market_value and aux.money.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.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
|
||||
|
||||
@@ -243,7 +243,7 @@ function m.game_tooltip_hooks:SetAuctionSellItem()
|
||||
if name then
|
||||
for slot in aux.util.inventory() do
|
||||
local link = GetContainerItemLink(unpack(slot))
|
||||
if link and ({aux.info.parse_hyperlink(link)})[5] == name then
|
||||
if link and ({aux.info.parse_link(link)})[5] == name then
|
||||
m.extend_tooltip(GameTooltip, link, quantity)
|
||||
return
|
||||
end
|
||||
|
||||
+3
-3
@@ -78,7 +78,7 @@ end
|
||||
|
||||
function public.thread(k, ...)
|
||||
local thread_id = m.id()
|
||||
m.threads[thread_id] = {k = aux._(k, unpack(arg))}
|
||||
m.threads[thread_id] = {k = aux.C(k, unpack(arg))}
|
||||
return thread_id
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ function public.wait(k, ...)
|
||||
if type(k) == 'number' then
|
||||
m.when(function() k = k - 1 return k <= 1 end, unpack(arg))
|
||||
else
|
||||
m.threads[m.thread_id].k = aux._(k, unpack(arg))
|
||||
m.threads[m.thread_id].k = aux.C(k, unpack(arg))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,6 +94,6 @@ function public.when(p, k, ...)
|
||||
if p() then
|
||||
return k(unpack(arg))
|
||||
else
|
||||
return m.wait(m.when, p, aux._(k, unpack(arg)))
|
||||
return m.wait(m.when, p, aux.C(k, unpack(arg)))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,29 +36,11 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local temp
|
||||
local mt = {
|
||||
__call = function(self, object)
|
||||
self._temp = object
|
||||
return object
|
||||
end,
|
||||
__index = function(self)
|
||||
return self._temp
|
||||
end,
|
||||
}
|
||||
function public.temp(object)
|
||||
getfenv(2).__ = object
|
||||
return object
|
||||
end
|
||||
function public.temp(object)
|
||||
getfenv(2).__ = object
|
||||
return object
|
||||
end
|
||||
|
||||
-- function public.temp(object)
|
||||
-- local env = getfenv(2)
|
||||
-- env.__ = object
|
||||
-- return object
|
||||
-- end
|
||||
|
||||
function public.L(body_string)
|
||||
return loadstring 'function()'
|
||||
end
|
||||
@@ -139,7 +121,7 @@ function public.VARIABLES_LOADED()
|
||||
btn:SetWidth(65)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText 'Close'
|
||||
btn:SetScript('OnClick', m._(m.frame.Hide, m.frame))
|
||||
btn:SetScript('OnClick', m.C(m.frame.Hide, m.frame))
|
||||
public.close_button = btn
|
||||
end
|
||||
do
|
||||
@@ -202,7 +184,7 @@ end
|
||||
do
|
||||
local function cost_label(cost)
|
||||
local label = LIGHTYELLOW_FONT_COLOR_CODE..'(Total Cost: '..FONT_COLOR_CODE_CLOSE
|
||||
label = label..(cost and m.money.format(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||
label = label..(cost and m.money.to_string2(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||
label = label..LIGHTYELLOW_FONT_COLOR_CODE..')'..FONT_COLOR_CODE_CLOSE
|
||||
return label
|
||||
end
|
||||
@@ -221,7 +203,7 @@ do
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = m.info.parse_hyperlink(link)
|
||||
local item_id, suffix_id = m.info.parse_link(link)
|
||||
local count = aux.util.select(3, GetCraftReagentInfo(id, i))
|
||||
local _, price, limited = m.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or m.history.value(item_id..':'..suffix_id)
|
||||
@@ -253,7 +235,7 @@ do
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = m.info.parse_hyperlink(link)
|
||||
local item_id, suffix_id = m.info.parse_link(link)
|
||||
local count = aux.util.select(3, GetTradeSkillReagentInfo(id, i))
|
||||
local _, price, limited = m.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or m.history.value(item_id..':'..suffix_id)
|
||||
@@ -279,14 +261,12 @@ function public.hook(name, handler, object)
|
||||
m.orig[object] = m.orig[object] or {}
|
||||
orig = m.orig[object]
|
||||
else
|
||||
object = object or getfenv(0)
|
||||
object = _G
|
||||
orig = m.orig
|
||||
end
|
||||
|
||||
if orig[name] then
|
||||
error('"'..name..'" is already hooked.')
|
||||
end
|
||||
|
||||
orig[name] = object[name]
|
||||
object[name] = handler
|
||||
end
|
||||
@@ -316,7 +296,7 @@ function private.UseContainerItem(...)
|
||||
if m.modified() or not m.index(m.active_tab(), 'env', 'USE_ITEM') then
|
||||
return m.orig.UseContainerItem(unpack(arg))
|
||||
end
|
||||
for _, item_info in {m.info.container_item(arg[1], arg[2])} do
|
||||
for item_info in aux.util.present(m.info.container_item(arg[1], arg[2])) do
|
||||
return m.active_tab.env.m.USE_ITEM(item_info)
|
||||
end
|
||||
end
|
||||
@@ -380,7 +360,7 @@ public._this = {}
|
||||
do
|
||||
local formal_parameters = {}
|
||||
for i=1,9 do
|
||||
local key = 'arg'..i
|
||||
local key = '_'..i
|
||||
public[key] = {}
|
||||
formal_parameters[m[key]] = i
|
||||
end
|
||||
@@ -397,7 +377,7 @@ do
|
||||
end
|
||||
return f(unpack(params))
|
||||
end
|
||||
function public._(f, ...)
|
||||
function public.C(f, ...)
|
||||
local arg1 = arg
|
||||
return function(...)
|
||||
return call(f, arg1, arg)
|
||||
|
||||
@@ -335,7 +335,7 @@ do
|
||||
end
|
||||
function mt.__index:update()
|
||||
for _, tab in self._tabs do
|
||||
if tab.group.selected == tab.id then
|
||||
if tab.group._selected == tab.id then
|
||||
tab.text:SetTextColor(m.color.label.enabled())
|
||||
tab:Disable()
|
||||
tab:SetBackdropColor(m.color.panel.background())
|
||||
@@ -369,9 +369,9 @@ function public.editbox(parent)
|
||||
editbox:SetFont(m.config.font, m.config.medium_font_size)
|
||||
editbox:SetShadowColor(0, 0, 0, 0)
|
||||
m.set_content_style(editbox)
|
||||
editbox:SetScript('OnEditFocusGained', aux._(editbox.HighlightText, aux._this))
|
||||
editbox:SetScript('OnEditFocusLost', aux._(editbox.HighlightText, aux._this, 0, 0))
|
||||
editbox:SetScript('OnEscapePressed', aux._(editbox.ClearFocus, aux._this))
|
||||
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))
|
||||
do
|
||||
local last_click
|
||||
editbox:SetScript('OnMouseDown', function()
|
||||
@@ -394,6 +394,11 @@ function public.editbox(parent)
|
||||
editbox:SetTextColor(unpack(m.color.text.disabled))
|
||||
editbox:ClearFocus()
|
||||
end
|
||||
local overlay = aux.gui.label(editbox, m.config.medium_font_size)
|
||||
overlay:SetPoint('LEFT', 1, 0)
|
||||
overlay:SetPoint('RIGHT', -2, 0)
|
||||
overlay:SetJustifyH('RIGHT')
|
||||
overlay:SetTextColor(unpack(aux.gui.color.text.enabled))
|
||||
return editbox
|
||||
end
|
||||
|
||||
|
||||
+30
-44
@@ -1,28 +1,16 @@
|
||||
local band, bor, bnot, lshift = bit.band, bit.bor, bit.bnot, bit.lshift
|
||||
local _G = getfenv(0)
|
||||
|
||||
local FIELD, ACCESSOR, MUTABLE, PUBLIC = 1, 2, 4, 8
|
||||
local mask, _G = bit.band, getfenv(0)
|
||||
local DECLARED, ACCESSOR, MUTABLE, PUBLIC = 1, 2, 4, 8
|
||||
local ACCESSOR_KEY, MUTABLE_KEY, PUBLIC_KEY = 'accessor', 'mutable', 'public'
|
||||
local MODIFIER = {[ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=MUTABLE, [PUBLIC_KEY]=PUBLIC}
|
||||
|
||||
local _state, _data, _metadata = {}, {}, {}
|
||||
|
||||
--local function_mt = {
|
||||
-- __call = function(self, ...)
|
||||
-- local f = state[self]
|
||||
-- getfenv(f).__ = {}
|
||||
-- f(unpack(arg))
|
||||
-- getfenv(f).__ = temp
|
||||
-- end,
|
||||
--}
|
||||
local PROPERTY = {[ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=MUTABLE, [PUBLIC_KEY]=PUBLIC}
|
||||
local _data, _metadata, _modifier_properties = {}, {}, {}
|
||||
local metadata_mt = {__index=function() return 0 end}
|
||||
local environment_mt = {
|
||||
local env_mt = {
|
||||
__metatable = false,
|
||||
__index = function(self, key)
|
||||
local value, properties = _data[self][key], _metadata[self][key]
|
||||
if band(FIELD, properties) ~= 0 then
|
||||
if mask(DECLARED+ACCESSOR, properties) == DECLARED then
|
||||
return value
|
||||
elseif band(ACCESSOR, properties) ~= 0 then
|
||||
elseif mask(ACCESSOR, properties) == ACCESSOR then
|
||||
return value(key)
|
||||
else
|
||||
return _G[key] or error('No key "'..key..'".', 2)
|
||||
@@ -31,8 +19,8 @@ local environment_mt = {
|
||||
__newindex = function(self, key, value)
|
||||
local properties = _metadata[self][key]
|
||||
if properties == 0 then
|
||||
_metadata[self][key] = FIELD
|
||||
-- elseif band(MUTABLE, properties) == 0 then
|
||||
_metadata[self][key] = DECLARED
|
||||
-- elseif mask(MUTABLE, properties) == 0 then
|
||||
-- error('"'..key..'" is immutable.', 2)
|
||||
end
|
||||
_data[self][key] = value
|
||||
@@ -42,48 +30,46 @@ local interface_mt = {
|
||||
__metatable = false,
|
||||
__index = function(self, key)
|
||||
local value, properties = _data[self][key], _metadata[self][key]
|
||||
if band(FIELD+PUBLIC, properties) == FIELD+PUBLIC then
|
||||
if mask(ACCESSOR+PUBLIC, properties) == PUBLIC then
|
||||
return value
|
||||
elseif band(ACCESSOR+PUBLIC, properties) == ACCESSOR+PUBLIC then
|
||||
return value(key)
|
||||
elseif mask(PUBLIC, properties) == PUBLIC then
|
||||
return value()
|
||||
else
|
||||
error('No key "'..key..'".', 2)
|
||||
end
|
||||
end,
|
||||
__newindex = function() error('Unsupported operation.', 2) end,
|
||||
__newindex = function(self, key, value) self[key](value) end,
|
||||
}
|
||||
local modifier_mt = {
|
||||
__metatable = false,
|
||||
__call = function(self, key)
|
||||
_state[self] = bor(_state[self], MODIFIER[key])
|
||||
return self
|
||||
end,
|
||||
__call = function() end,
|
||||
__index = function(self, key)
|
||||
local value = MODIFIER[key]
|
||||
if not value then error('Unsupported operation.', 2) end
|
||||
_state[self] = bor(_state[self], value)
|
||||
local property = PROPERTY[key]
|
||||
if not property then error('Unsupported modifier "'..key..'".', 2) end
|
||||
if mask(property, _modifier_properties[self]) ~= 0 then error('Duplicate modifier "'..key..'".', 2) end
|
||||
_modifier_properties[self] = _modifier_properties[self] + property
|
||||
return self
|
||||
end,
|
||||
__newindex = function(self, key, value)
|
||||
if _metadata[self][key] ~= 0 then error('Duplicate key "'..key..'".', 2) end
|
||||
_data[self][key] = value
|
||||
_metadata[self][key] = bor(band(FIELD, bnot(lshift(_state[self], 1))), _state[self])
|
||||
_state[self] = 0
|
||||
_metadata[self][key] = _modifier_properties[self]
|
||||
end,
|
||||
}
|
||||
function _G.aux_module()
|
||||
local modifier, environment, interface = setmetatable({}, modifier_mt), setmetatable({}, environment_mt), setmetatable({}, interface_mt)
|
||||
local data = {_G=_G, [ACCESSOR_KEY]=modifier, [MUTABLE_KEY]=modifier, [PUBLIC_KEY]=modifier}
|
||||
local metadata = setmetatable({_G=FIELD, [ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=ACCESSOR, [PUBLIC_KEY]=ACCESSOR}, metadata_mt)
|
||||
local data, metadata, modifier, env, interface
|
||||
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
|
||||
data = {_G=_G, [ACCESSOR_KEY]=modifier_accessor, [MUTABLE_KEY]=modifier_accessor, [PUBLIC_KEY]=modifier_accessor}
|
||||
metadata = setmetatable({_G=DECLARED, [ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=ACCESSOR, [PUBLIC_KEY]=ACCESSOR}, metadata_mt)
|
||||
|
||||
_data[modifier], _data[environment], _data[interface] = data, data, data
|
||||
_metadata[modifier], _metadata[environment], _metadata[interface] = metadata, metadata, metadata
|
||||
_state[modifier] = 0
|
||||
_data[modifier], _data[env], _data[interface] = data, data, data
|
||||
_metadata[modifier], _metadata[env], _metadata[interface] = metadata, metadata, metadata
|
||||
|
||||
environment.mutable.__ = nil
|
||||
environment.m = environment -- TODO for compatibility, remove later
|
||||
environment.private = environment -- TODO for compatibility, remove later
|
||||
env.mutable.__ = nil
|
||||
env.m = env -- TODO for compatibility, remove later
|
||||
env.private = env -- TODO for compatibility, remove later
|
||||
|
||||
setfenv(2, environment)
|
||||
setfenv(2, env)
|
||||
return interface
|
||||
end
|
||||
+43
-43
@@ -66,10 +66,10 @@ public.search_config = {
|
||||
cell.icon:SetAlpha(1)
|
||||
cell:GetFontString():SetAlpha(1)
|
||||
end
|
||||
cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
|
||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.name, record_b.name, desc)
|
||||
return aux.sorting.compare(record_a.name, record_b.name, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -82,7 +82,7 @@ public.search_config = {
|
||||
cell:SetText(display_level)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.level, record_b.level, desc)
|
||||
return aux.sorting.compare(record_a.level, record_b.level, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -97,7 +97,7 @@ public.search_config = {
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.EQ
|
||||
return aux.sorting.EQ
|
||||
-- if sortKey == 'numAuctions' then
|
||||
-- if a.children then
|
||||
-- aVal = a.totalAuctions
|
||||
@@ -117,7 +117,7 @@ public.search_config = {
|
||||
cell:SetText(record.aux_quantity)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
return aux.sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public.search_config = {
|
||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.duration, record_b.duration, desc)
|
||||
return aux.sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -140,13 +140,13 @@ public.search_config = {
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
if not record_a.owner and not record_b.owner then
|
||||
return aux.sort.EQ
|
||||
return aux.sorting.EQ
|
||||
elseif not record_a.owner then
|
||||
return aux.sort.GT
|
||||
return aux.sorting.GT
|
||||
elseif not record_b.owner then
|
||||
return aux.sort.LT
|
||||
return aux.sorting.LT
|
||||
else
|
||||
return aux.sort.compare(record_a.owner, record_b.owner, desc)
|
||||
return aux.sorting.compare(record_a.owner, record_b.owner, desc)
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -183,7 +183,7 @@ public.search_config = {
|
||||
else
|
||||
price_b = _G.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||
end
|
||||
return aux.sort.compare(price_a, price_b, desc)
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -201,7 +201,7 @@ public.search_config = {
|
||||
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
|
||||
|
||||
return aux.sort.compare(price_a, price_b, desc)
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -215,7 +215,7 @@ public.search_config = {
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local pct_a = m.record_percentage(record_a) or (desc and -aux.huge or aux.huge)
|
||||
local pct_b = m.record_percentage(record_b) or (desc and -aux.huge or aux.huge)
|
||||
return aux.sort.compare(pct_a, pct_b, desc)
|
||||
return aux.sorting.compare(pct_a, pct_b, desc)
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -236,10 +236,10 @@ public.auctions_config = {
|
||||
cell.icon:SetAlpha(1)
|
||||
cell:GetFontString():SetAlpha(1)
|
||||
end
|
||||
cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
|
||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.name, record_b.name, desc)
|
||||
return aux.sorting.compare(record_a.name, record_b.name, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -252,7 +252,7 @@ public.auctions_config = {
|
||||
cell:SetText(display_level)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.level, record_b.level, desc)
|
||||
return aux.sorting.compare(record_a.level, record_b.level, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -264,7 +264,7 @@ public.auctions_config = {
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.EQ
|
||||
return aux.sorting.EQ
|
||||
-- if sortKey == 'numAuctions' then
|
||||
-- if a.children then
|
||||
-- aVal = a.totalAuctions
|
||||
@@ -284,7 +284,7 @@ public.auctions_config = {
|
||||
cell:SetText(record.aux_quantity)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
return aux.sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -295,7 +295,7 @@ public.auctions_config = {
|
||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.duration, record_b.duration, desc)
|
||||
return aux.sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -325,7 +325,7 @@ public.auctions_config = {
|
||||
else
|
||||
price_b = _G.aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
|
||||
end
|
||||
return aux.sort.compare(price_a, price_b, desc)
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -343,7 +343,7 @@ public.auctions_config = {
|
||||
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
|
||||
|
||||
return aux.sort.compare(price_a, price_b, desc)
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -355,13 +355,13 @@ public.auctions_config = {
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
if not record_a.high_bidder and not record_b.high_bidder then
|
||||
return aux.sort.EQ
|
||||
return aux.sorting.EQ
|
||||
elseif not record_a.high_bidder then
|
||||
return aux.sort.GT
|
||||
return aux.sorting.GT
|
||||
elseif not record_b.high_bidder then
|
||||
return aux.sort.LT
|
||||
return aux.sorting.LT
|
||||
else
|
||||
return aux.sort.compare(record_a.high_bidder, record_b.high_bidder, desc)
|
||||
return aux.sorting.compare(record_a.high_bidder, record_b.high_bidder, desc)
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -383,10 +383,10 @@ public.bids_config = {
|
||||
cell.icon:SetAlpha(1)
|
||||
cell:GetFontString():SetAlpha(1)
|
||||
end
|
||||
cell:SetText(gsub(record.hyperlink, '[%[%]]', ''))
|
||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.name, record_b.name, desc)
|
||||
return aux.sorting.compare(record_a.name, record_b.name, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -398,7 +398,7 @@ public.bids_config = {
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.EQ
|
||||
return aux.sorting.EQ
|
||||
-- if sortKey == 'numAuctions' then
|
||||
-- if a.children then
|
||||
-- aVal = a.totalAuctions
|
||||
@@ -418,7 +418,7 @@ public.bids_config = {
|
||||
cell:SetText(record.aux_quantity)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
return aux.sorting.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -429,7 +429,7 @@ public.bids_config = {
|
||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.duration, record_b.duration, desc)
|
||||
return aux.sorting.compare(record_a.duration, record_b.duration, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -441,13 +441,13 @@ public.bids_config = {
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
if not record_a.owner and not record_b.owner then
|
||||
return aux.sort.EQ
|
||||
return aux.sorting.EQ
|
||||
elseif not record_a.owner then
|
||||
return aux.sort.GT
|
||||
return aux.sorting.GT
|
||||
elseif not record_b.owner then
|
||||
return aux.sort.LT
|
||||
return aux.sorting.LT
|
||||
else
|
||||
return aux.sort.compare(record_a.owner, record_b.owner, desc)
|
||||
return aux.sorting.compare(record_a.owner, record_b.owner, desc)
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -478,7 +478,7 @@ public.bids_config = {
|
||||
else
|
||||
price_b = _G.aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||
end
|
||||
return aux.sort.compare(price_a, price_b, desc)
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -496,7 +496,7 @@ public.bids_config = {
|
||||
price_a = price_a > 0 and price_a or (desc and -aux.huge or aux.huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -aux.huge or aux.huge)
|
||||
|
||||
return aux.sort.compare(price_a, price_b, desc)
|
||||
return aux.sorting.compare(price_a, price_b, desc)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -513,7 +513,7 @@ public.bids_config = {
|
||||
cell:SetText(status)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
return aux.sort.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
|
||||
return aux.sorting.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -641,9 +641,9 @@ local methods = {
|
||||
local button = arg1
|
||||
if this.rt.disabled then return end
|
||||
if IsControlKeyDown() then
|
||||
DressUpItemLink(this.row.data.record.hyperlink)
|
||||
DressUpItemLink(this.row.data.record.link)
|
||||
elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
|
||||
ChatFrameEditBox:Insert(this.row.data.record.link)
|
||||
elseif not aux.modified() and button == 'RightButton' then -- TODO not when alt (how?)
|
||||
aux.set_tab(1)
|
||||
aux.search_tab.set_filter(strlower(aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
||||
@@ -684,7 +684,7 @@ local methods = {
|
||||
self.isSorted = nil
|
||||
self:SetSelectedRecord(nil, true)
|
||||
|
||||
sort(self.records, function(a, b) return aux.sort.multi_lt({a.search_signature, tostring(a)}, {b.search_signature, tostring(b)}) end)
|
||||
sort(self.records, function(a, b) return aux.sorting.multi_lt({a.search_signature, tostring(a)}, {b.search_signature, tostring(b)}) end)
|
||||
|
||||
local records = self.records
|
||||
if getn(records) == 0 then return end
|
||||
@@ -765,11 +765,11 @@ local methods = {
|
||||
end
|
||||
|
||||
for _, sort in self.sorts do
|
||||
local ordering = self.config[sort.index].cmp and self.config[sort.index].cmp(record_a, record_b, sort.descending) or aux.sort.EQ
|
||||
local ordering = self.config[sort.index].cmp and self.config[sort.index].cmp(record_a, record_b, sort.descending) or aux.sorting.EQ
|
||||
|
||||
if ordering == aux.sort.LT then
|
||||
if ordering == aux.sorting.LT then
|
||||
return true
|
||||
elseif ordering == aux.sort.GT then
|
||||
elseif ordering == aux.sorting.GT then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ do
|
||||
|
||||
m.cancel_button:SetScript('OnClick', function()
|
||||
if m.test(record)(index) and m.listing:ContainsRecord(record) then
|
||||
aux.cancel_auction(index, aux._(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
aux.cancel_auction(index, aux.C(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
end
|
||||
end)
|
||||
m.cancel_button:Enable()
|
||||
|
||||
+2
-2
@@ -93,7 +93,7 @@ do
|
||||
aux.place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||
aux.info.bid_update(record)
|
||||
m.listing:SetDatabase()
|
||||
end or aux._(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
end or aux.C(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
end
|
||||
end)
|
||||
m.bid_button:Enable()
|
||||
@@ -102,7 +102,7 @@ do
|
||||
if record.buyout_price > 0 then
|
||||
m.buyout_button:SetScript('OnClick', function()
|
||||
if m.test(record)(index) and m.listing:ContainsRecord(record) then
|
||||
aux.place_bid('bidder', index, record.buyout_price, aux._(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
aux.place_bid('bidder', index, record.buyout_price, aux.C(m.listing.RemoveAuctionRecord, m.listing, record))
|
||||
end
|
||||
end)
|
||||
m.buyout_button:Enable()
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ function private.update_auction_listing()
|
||||
})
|
||||
end
|
||||
sort(auction_rows, function(a, b)
|
||||
return aux.sort.multi_lt(
|
||||
return aux.sorting.multi_lt(
|
||||
{
|
||||
a.record.unit_buyout_price == 0 and aux.huge or a.record.unit_buyout_price,
|
||||
a.record.unit_blizzard_bid,
|
||||
|
||||
@@ -49,8 +49,8 @@ private.blizzard_query = setmetatable({}, {
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
|
||||
return (subclass_index or 0) > 0 and subclass_index or nil
|
||||
elseif key == 'slot' then
|
||||
local slot_index = UIDropDownMenu_GetSelectedValue(m.slot_dropdown)
|
||||
return (slot_index or 0) > 0 and slot_index or nil
|
||||
local slot_token = UIDropDownMenu_GetSelectedValue(m.slot_dropdown)
|
||||
return slot_token ~= '' and slot_token or nil
|
||||
elseif key == 'quality' then
|
||||
local quality_code = UIDropDownMenu_GetSelectedValue(m.quality_dropdown)
|
||||
return (quality_code or -1) >= 0 and quality_code or nil
|
||||
@@ -406,14 +406,13 @@ function private.initialize_slot_dropdown()
|
||||
if subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
|
||||
UIDropDownMenu_AddButton{
|
||||
text = ALL,
|
||||
value = 0,
|
||||
value = '',
|
||||
func = on_click,
|
||||
}
|
||||
|
||||
for _, slot in {GetAuctionInvTypes(class_index, subclass_index)} do
|
||||
local slot_name = getglobal(slot)
|
||||
UIDropDownMenu_AddButton{
|
||||
text = slot_name,
|
||||
text = getglobal(slot),
|
||||
value = slot,
|
||||
func = on_click,
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ function private.create_frames()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnTextChanged', m.update_form)
|
||||
editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox))
|
||||
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
|
||||
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Name')
|
||||
@@ -415,7 +415,7 @@ function private.create_frames()
|
||||
m.max_level_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox))
|
||||
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
local valid_level = m.valid_level(this:GetText())
|
||||
if tostring(valid_level) ~= this:GetText() then
|
||||
@@ -440,7 +440,7 @@ function private.create_frames()
|
||||
m.name_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox))
|
||||
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
local valid_level = m.valid_level(this:GetText())
|
||||
if tostring(valid_level) ~= this:GetText() then
|
||||
|
||||
@@ -162,8 +162,8 @@ function private.start_real_time_scan(query, search, continuation)
|
||||
if not ignore_page then
|
||||
if search.auto_buy then
|
||||
ctrl.suspend()
|
||||
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux._(ctrl.resume, true))
|
||||
aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux._(ctrl.resume, false))
|
||||
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux.C(ctrl.resume, true))
|
||||
aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux.C(ctrl.resume, false))
|
||||
else
|
||||
tinsert(new_records, auction_record)
|
||||
end
|
||||
@@ -258,8 +258,8 @@ function private.start_search(queries, continuation)
|
||||
on_auction = function(auction_record, ctrl)
|
||||
if search.auto_buy then
|
||||
ctrl.suspend()
|
||||
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux._(ctrl.resume, true))
|
||||
aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux._(ctrl.resume, false))
|
||||
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux.C(ctrl.resume, true))
|
||||
aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux.C(ctrl.resume, false))
|
||||
elseif getn(search.records) < 1000 then
|
||||
tinsert(search.records, auction_record)
|
||||
if getn(search.records) == 1000 then
|
||||
@@ -411,7 +411,7 @@ do
|
||||
aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||
aux.info.bid_update(record)
|
||||
search.table:SetDatabase()
|
||||
end or aux._(search.table.RemoveAuctionRecord, search.table, record))
|
||||
end or aux.C(search.table.RemoveAuctionRecord, search.table, record))
|
||||
end
|
||||
end)
|
||||
m.bid_button:Enable()
|
||||
@@ -420,7 +420,7 @@ do
|
||||
if record.buyout_price > 0 then
|
||||
m.buyout_button:SetScript('OnClick', function()
|
||||
if m.test(record)(index) and search.table:ContainsRecord(record) then
|
||||
aux.place_bid('list', index, record.buyout_price, aux._(search.table.RemoveAuctionRecord, search.table, record))
|
||||
aux.place_bid('list', index, record.buyout_price, aux.C(search.table.RemoveAuctionRecord, search.table, record))
|
||||
end
|
||||
end)
|
||||
m.buyout_button:Enable()
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ function public.present(...)
|
||||
end
|
||||
end
|
||||
|
||||
function public.unpack(array, ...)
|
||||
function public.expand(array, ...)
|
||||
local table = {}
|
||||
for i=1,arg.n do
|
||||
table[arg[i]] = array[i]
|
||||
@@ -221,7 +221,7 @@ function public.bag_type(bag)
|
||||
return 1
|
||||
end
|
||||
for link in aux.util.present(GetInventoryItemLink('player', ContainerIDToInventoryID(bag))) do
|
||||
local item_id = aux.info.parse_hyperlink(link)
|
||||
local item_id = aux.info.parse_link(link)
|
||||
local item_info = aux.info.item(item_id)
|
||||
return aux.info.item_subclass_index(3, item_info.subclass)
|
||||
end
|
||||
|
||||
+2
-2
@@ -235,8 +235,8 @@ do
|
||||
end
|
||||
for _, parser in {
|
||||
{'class', aux.info.item_class_index},
|
||||
{'subclass', aux._(aux.info.item_subclass_index, aux.index(self.class, 2) or 0, aux.arg1)},
|
||||
{'slot', aux._(aux.info.item_slot_index, aux.index(self.class, 2) or 0, aux.index(self.subclass, 2) or 0, aux.arg1)},
|
||||
{'subclass', aux.C(aux.info.item_subclass_index, aux.index(self.class, 2) or 0, aux._1)},
|
||||
{'slot', aux.C(aux.info.item_slot_index, aux.index(self.class, 2) or 0, aux.index(self.subclass, 2) or 0, aux._1)},
|
||||
{'quality', aux.info.item_quality_index},
|
||||
} do
|
||||
if not self[parser[1]] then
|
||||
|
||||
+26
-30
@@ -38,9 +38,9 @@ do
|
||||
end
|
||||
|
||||
function public.container_item(bag, slot)
|
||||
for _, hyperlink in {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_hyperlink(hyperlink)
|
||||
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 texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot) -- quality not working?
|
||||
@@ -55,7 +55,7 @@ function public.container_item(bag, slot)
|
||||
unique_id = unique_id,
|
||||
enchant_id = enchant_id,
|
||||
|
||||
hyperlink = hyperlink,
|
||||
link = link,
|
||||
itemstring = item_info.itemstring,
|
||||
item_key = item_id..':'..suffix_id,
|
||||
|
||||
@@ -83,9 +83,7 @@ function public.container_item(bag, slot)
|
||||
end
|
||||
|
||||
function public.auction_sell_item()
|
||||
local name, texture, count, quality, usable, vendor_price = GetAuctionSellItemInfo()
|
||||
|
||||
if name then
|
||||
for name, texture, count, quality, usable, vendor_price in GetAuctionSellItemInfo do
|
||||
return {
|
||||
name = name,
|
||||
texture = texture,
|
||||
@@ -100,9 +98,9 @@ end
|
||||
function public.auction(index, query_type)
|
||||
query_type = query_type or 'list'
|
||||
|
||||
for _, hyperlink in {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 = m.parse_hyperlink(hyperlink)
|
||||
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 name, texture, count, quality, usable, level, start_price, min_increment, buyout_price, high_bid, high_bidder, owner, sale_status = GetAuctionItemInfo(query_type, index)
|
||||
@@ -121,7 +119,7 @@ function public.auction(index, query_type)
|
||||
unique_id = unique_id,
|
||||
enchant_id = enchant_id,
|
||||
|
||||
hyperlink = hyperlink,
|
||||
link = link,
|
||||
itemstring = item_info.itemstring,
|
||||
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 '?')}, ':'),
|
||||
@@ -179,7 +177,6 @@ end
|
||||
|
||||
function public.set_shopping_tooltip(slot)
|
||||
local index1, index2 = m.inventory_index(slot)
|
||||
|
||||
local tooltips = {}
|
||||
if index1 then
|
||||
local tooltip = m.tooltip(function(tt) tt:SetInventoryItem('player', index1) end)
|
||||
@@ -196,7 +193,6 @@ function public.set_shopping_tooltip(slot)
|
||||
|
||||
if tooltips[1] then
|
||||
tinsert(tooltips[1], 1, { left_text = 'Currently Equipped', left_color = { 0.5, 0.5, 0.5 } })
|
||||
|
||||
ShoppingTooltip1:SetOwner(GameTooltip, 'ANCHOR_BOTTOMRIGHT')
|
||||
m.load_tooltip(ShoppingTooltip1, tooltips[1])
|
||||
ShoppingTooltip1:Show()
|
||||
@@ -205,7 +201,6 @@ function public.set_shopping_tooltip(slot)
|
||||
|
||||
if tooltips[2] then
|
||||
tinsert(tooltips[2], 1, { left_text = 'Currently Equipped', left_color = { 0.5, 0.5, 0.5 } })
|
||||
|
||||
ShoppingTooltip2:SetOwner(ShoppingTooltip1, 'ANCHOR_BOTTOMRIGHT')
|
||||
m.load_tooltip(ShoppingTooltip2, tooltips[2])
|
||||
ShoppingTooltip2:Show()
|
||||
@@ -231,7 +226,6 @@ function public.tooltip_find(pattern, tooltip)
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
|
||||
return count
|
||||
end
|
||||
|
||||
@@ -251,7 +245,7 @@ function public.load_tooltip(frame, tooltip)
|
||||
end
|
||||
|
||||
function public.display_name(item_id, no_brackets, no_color)
|
||||
for _, item_info in {aux.info.item(item_id)} do
|
||||
for item_info in aux.util.present(aux.info.item(item_id)) do
|
||||
local name = item_info.name
|
||||
if not no_brackets then
|
||||
name = '['..name..']'
|
||||
@@ -346,13 +340,13 @@ function public.durability(tooltip)
|
||||
end
|
||||
end
|
||||
|
||||
function public.item_key(hyperlink)
|
||||
local item_id, suffix_id = m.parse_hyperlink(hyperlink)
|
||||
function public.item_key(link)
|
||||
local item_id, suffix_id = m.parse_link(link)
|
||||
return item_id..':'..suffix_id
|
||||
end
|
||||
|
||||
function public.parse_hyperlink(hyperlink)
|
||||
local _, _, item_id, enchant_id, suffix_id, unique_id, name = strfind(hyperlink, '|c%x%x%x%x%x%x%x%x|Hitem:(%d*):(%d*):(%d*):(%d*)[:0-9]*|h%[(.-)%]|h|r')
|
||||
function public.parse_link(link)
|
||||
local _, _, item_id, enchant_id, suffix_id, unique_id, name = strfind(link, '|c%x%x%x%x%x%x%x%x|Hitem:(%d*):(%d*):(%d*):(%d*)[:0-9]*|h%[(.-)%]|h|r')
|
||||
return tonumber(item_id) or 0, tonumber(suffix_id) or 0, tonumber(unique_id) or 0, tonumber(enchant_id) or 0, name
|
||||
end
|
||||
|
||||
@@ -362,18 +356,20 @@ end
|
||||
|
||||
function public.item(item_id, suffix_id)
|
||||
local itemstring = 'item:'..(item_id or 0)..':0:'..(suffix_id or 0)..':0'
|
||||
local name, itemstring, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
|
||||
return name and {
|
||||
name = name,
|
||||
itemstring = itemstring,
|
||||
quality = quality,
|
||||
level = level,
|
||||
class = class,
|
||||
subclass = subclass,
|
||||
slot = slot,
|
||||
max_stack = max_stack,
|
||||
texture = texture,
|
||||
} or aux.cache.item_info(item_id)
|
||||
for name, itemstring, quality, level, class, subclass, max_stack, slot, texture in aux.util.present(GetItemInfo(itemstring)) do
|
||||
return {
|
||||
name = name,
|
||||
itemstring = itemstring,
|
||||
quality = quality,
|
||||
level = level,
|
||||
class = class,
|
||||
subclass = subclass,
|
||||
slot = slot,
|
||||
max_stack = max_stack,
|
||||
texture = texture,
|
||||
}
|
||||
end
|
||||
return aux.cache.item_info(item_id)
|
||||
end
|
||||
|
||||
function public.item_class_index(item_class)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ function public.copper(gold, silver, copper)
|
||||
return gold * m.COPPER_PER_GOLD + silver * m.COPPER_PER_SILVER + copper
|
||||
end
|
||||
|
||||
function public.format(money, exact, color)
|
||||
function public.to_string2(money, exact, color)
|
||||
color = color or FONT_COLOR_CODE_CLOSE
|
||||
|
||||
local TEXT_NONE = '0'
|
||||
|
||||
+1
-2
@@ -1,4 +1,4 @@
|
||||
aux.module 'sort'
|
||||
aux.module 'sorting'
|
||||
|
||||
public.LT = {}
|
||||
public.EQ = {}
|
||||
@@ -24,7 +24,6 @@ function public.multi_lt(xs, ys)
|
||||
elseif not ys[i] then
|
||||
return false
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user