refactoring
This commit is contained in:
+10
-10
@@ -66,7 +66,7 @@ aux 'core'
|
||||
public.version = '5.0.0'
|
||||
|
||||
function public.print(...) temp=arg
|
||||
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE..'[aux] '..join(map(arg, tostring), ' '))
|
||||
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE .. '[aux] ' .. join(map(arg, tostring), ' '))
|
||||
end
|
||||
|
||||
local bids_loaded
|
||||
@@ -97,7 +97,7 @@ do
|
||||
for _, f in handlers do f() end
|
||||
elseif event == 'PLAYER_LOGIN' then
|
||||
for _, f in handlers2 do f() end
|
||||
print('v'..version..' loaded.')
|
||||
print('v' .. version .. ' loaded.')
|
||||
else
|
||||
M[event]()
|
||||
end
|
||||
@@ -156,7 +156,7 @@ function public.hook(...) temp=arg
|
||||
end
|
||||
handler = handler or getfenv(2)[name]
|
||||
orig[object] = orig[object] or t
|
||||
assert(not orig[object][name], '"'..name..'" is already hooked into.')
|
||||
assert(not orig[object][name], '"' .. name .. '" is already hooked into.')
|
||||
orig[object][name], object[name] = object[name], handler
|
||||
return hook
|
||||
end
|
||||
@@ -255,9 +255,9 @@ end
|
||||
|
||||
do
|
||||
local function cost_label(cost)
|
||||
local label = LIGHTYELLOW_FONT_COLOR_CODE..'(Total Cost: '..FONT_COLOR_CODE_CLOSE
|
||||
label = label..(cost and aux.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
|
||||
local label = LIGHTYELLOW_FONT_COLOR_CODE .. '(Total Cost: ' .. FONT_COLOR_CODE_CLOSE
|
||||
label = label .. (cost and aux.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
|
||||
function ADDON_LOADED.Blizzard_CraftUI()
|
||||
@@ -275,7 +275,7 @@ do
|
||||
local item_id, suffix_id = aux.info.parse_link(link)
|
||||
local count = select(3, GetCraftReagentInfo(id, i))
|
||||
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or aux.history.value(item_id..':'..suffix_id)
|
||||
local value = price and not limited and price or aux.history.value(item_id .. ':' .. suffix_id)
|
||||
if not value then
|
||||
total_cost = nil
|
||||
break
|
||||
@@ -283,7 +283,7 @@ do
|
||||
total_cost = total_cost + value * count
|
||||
end
|
||||
end
|
||||
CraftReagentLabel:SetText(SPELL_REAGENTS..' '..cost_label(total_cost))
|
||||
CraftReagentLabel:SetText(SPELL_REAGENTS .. ' ' .. cost_label(total_cost))
|
||||
return unpack(ret)
|
||||
end)
|
||||
end
|
||||
@@ -302,7 +302,7 @@ do
|
||||
local item_id, suffix_id = aux.info.parse_link(link)
|
||||
local count = select(3, GetTradeSkillReagentInfo(id, i))
|
||||
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or aux.history.value(item_id..':'..suffix_id)
|
||||
local value = price and not limited and price or aux.history.value(item_id .. ':' .. suffix_id)
|
||||
if not value then
|
||||
total_cost = nil
|
||||
break
|
||||
@@ -310,7 +310,7 @@ do
|
||||
total_cost = total_cost + value * count
|
||||
end
|
||||
end
|
||||
TradeSkillReagentLabel:SetText(SPELL_REAGENTS..' '..cost_label(total_cost))
|
||||
TradeSkillReagentLabel:SetText(SPELL_REAGENTS .. ' ' .. cost_label(total_cost))
|
||||
return unpack(ret)
|
||||
end)
|
||||
end
|
||||
|
||||
+5
-5
@@ -88,7 +88,7 @@ function public.item_info(item_id)
|
||||
local cached_data = persistence.read(items_schema, data_string)
|
||||
return T(
|
||||
'name', cached_data.name,
|
||||
'itemstring', 'item:'..item_id..':0:0:0',
|
||||
'itemstring', 'item:' .. item_id .. ':0:0:0',
|
||||
'quality', cached_data.quality,
|
||||
'level', cached_data.level,
|
||||
'class', cached_data.class,
|
||||
@@ -157,7 +157,7 @@ function scan_wdb(item_id)
|
||||
|
||||
local processed = 0
|
||||
while processed <= 100 and item_id <= MAX_ITEM_ID do
|
||||
local itemstring = 'item:'..item_id
|
||||
local itemstring = 'item:' .. item_id
|
||||
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
|
||||
if name and not _G.aux_item_ids[strlower(name)] then
|
||||
_G.aux_item_ids[strlower(name)] = item_id
|
||||
@@ -193,9 +193,9 @@ function public.populate_wdb(item_id)
|
||||
print 'Cache populated.'
|
||||
return
|
||||
end
|
||||
if not GetItemInfo('item:'..item_id) then
|
||||
print('Fetching item '..item_id..'.')
|
||||
AuxTooltip:SetHyperlink('item:'..item_id)
|
||||
if not GetItemInfo('item:' .. item_id) then
|
||||
print('Fetching item ' .. item_id .. '.')
|
||||
AuxTooltip:SetHyperlink('item:' .. item_id)
|
||||
end
|
||||
thread(populate_wdb, item_id + 1)
|
||||
end
|
||||
+1
-1
@@ -70,7 +70,7 @@ end
|
||||
function public.value(slot, quality, level)
|
||||
local expectation
|
||||
for _, event in distribution(slot, quality, level) do
|
||||
local value = aux.history.value(event.item_id..':'..0)
|
||||
local value = aux.history.value(event.item_id .. ':' .. 0)
|
||||
if not value then
|
||||
return
|
||||
else
|
||||
|
||||
+12
-12
@@ -30,28 +30,28 @@ function _G.SlashCmdList.AUX(command)
|
||||
aux.cache.populate_wdb()
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
|
||||
_G.aux_tooltip_value = not _G.aux_tooltip_value
|
||||
print('Historical value in tooltip '..(_G.aux_tooltip_value and 'enabled' or 'disabled')..'.')
|
||||
print('Historical value in tooltip ' .. (_G.aux_tooltip_value and 'enabled' or 'disabled') .. '.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
|
||||
_G.aux_tooltip_daily = not _G.aux_tooltip_daily
|
||||
print('Market value in tooltip '..(_G.aux_tooltip_daily and 'enabled' or 'disabled')..'.')
|
||||
print('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
|
||||
_G.aux_tooltip_vendor_buy = not _G.aux_tooltip_vendor_buy
|
||||
print('Vendor buy price in tooltip '..(_G.aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.')
|
||||
print('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
|
||||
_G.aux_tooltip_vendor_sell = not _G.aux_tooltip_vendor_sell
|
||||
print('Vendor sell price in tooltip '..(_G.aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.')
|
||||
print('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
|
||||
_G.aux_tooltip_disenchant_value = not _G.aux_tooltip_disenchant_value
|
||||
print('Disenchant value in tooltip '..(_G.aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.')
|
||||
print('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
|
||||
_G.aux_tooltip_disenchant_distribution = not _G.aux_tooltip_disenchant_distribution
|
||||
print('Disenchant distribution in tooltip '..(_G.aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.')
|
||||
print('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
|
||||
_G.aux_tooltip_disenchant_source = not _G.aux_tooltip_disenchant_source
|
||||
print('Disenchant source in tooltip '..(_G.aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.')
|
||||
print('Disenchant source in tooltip ' .. (_G.aux_tooltip_disenchant_source and 'enabled' or 'disabled') .. '.')
|
||||
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
|
||||
_G.aux_ignore_owner = not _G.aux_ignore_owner
|
||||
print('Ignoring of owner '..(_G.aux_ignore_owner and 'enabled' or 'disabled')..'.')
|
||||
print('Ignoring of owner ' .. (_G.aux_ignore_owner and 'enabled' or 'disabled') .. '.')
|
||||
elseif arguments[1] == 'chars' and arguments[2] == 'add' then
|
||||
local realm = GetCVar('realmName')
|
||||
_G.aux_characters[realm] = _G.aux_characters[realm] or t
|
||||
@@ -59,7 +59,7 @@ function _G.SlashCmdList.AUX(command)
|
||||
local name = gsub(strlower(arguments[i]), '^%l', strupper)
|
||||
if not _G.aux_characters[realm][name] then
|
||||
_G.aux_characters[realm][name] = true
|
||||
print('Character "'..name..'" added.')
|
||||
print('Character "' .. name .. '" added.')
|
||||
end
|
||||
end
|
||||
elseif arguments[1] == 'chars' and arguments[2] == 'remove' then
|
||||
@@ -71,7 +71,7 @@ function _G.SlashCmdList.AUX(command)
|
||||
local name = gsub(strlower(arguments[i]), '^%l', strupper)
|
||||
if _G.aux_characters[realm][name] then
|
||||
_G.aux_characters[realm][name] = nil
|
||||
print('Character "'..name..'" removed.')
|
||||
print('Character "' .. name .. '" removed.')
|
||||
end
|
||||
end
|
||||
elseif arguments[1] == 'chars' then
|
||||
@@ -81,11 +81,11 @@ function _G.SlashCmdList.AUX(command)
|
||||
tinsert(chars, name)
|
||||
end
|
||||
if getn(chars) > 0 then
|
||||
print('Your characters: "'..join(chars, ', ')..'".')
|
||||
print('Your characters: "' .. join(chars, ', ') .. '".')
|
||||
else
|
||||
print 'You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".'
|
||||
end
|
||||
else
|
||||
print('Unknown command: "'..command..'"')
|
||||
print('Unknown command: "' .. command .. '"')
|
||||
end
|
||||
end
|
||||
+10
-10
@@ -33,7 +33,7 @@ function LOAD()
|
||||
local name, _, quality = GetItemInfo(arg[1])
|
||||
if not IsShiftKeyDown() and not IsControlKeyDown() and name then
|
||||
local color_code = select(4, GetItemQualityColor(quality))
|
||||
local link = color_code.. '|H'..arg[1]..'|h['..name..']|h'..FONT_COLOR_CODE_CLOSE
|
||||
local link = color_code .. '|H' .. arg[1] .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
||||
extend_tooltip(ItemRefTooltip, link, 1)
|
||||
end
|
||||
return result
|
||||
@@ -66,14 +66,14 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
|
||||
sort(distribution, function(a,b) return a.probability > b.probability end)
|
||||
for _, event in distribution do
|
||||
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, info.display_name(event.item_id, true) or 'item:'..event.item_id, event.min_quantity, event.max_quantity), color.r, color.g, color.b)
|
||||
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, info.display_name(event.item_id, true) or 'item:' .. event.item_id, event.min_quantity, event.max_quantity), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
if _G.aux_tooltip_disenchant_value then
|
||||
local color = {r=.1, g=.6, b=.6}
|
||||
|
||||
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Disenchant Value: ' .. (disenchant_value and money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -81,27 +81,27 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
local color = {r=.8, g=.5, b=.1}
|
||||
local _, price, limited = cache.merchant_info(item_id)
|
||||
if price then
|
||||
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..money.to_string2(price * quantity), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Vendor Buy ' .. (limited and '(limited): ' or ': ') .. money.to_string2(price * quantity), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
if _G.aux_tooltip_vendor_sell then
|
||||
local color = {r=.8, g=.5, b=.1}
|
||||
local price = cache.merchant_info(item_id)
|
||||
if price ~= 0 then
|
||||
tooltip:AddLine('Vendor Sell: '..(price and money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Vendor Sell: ' .. (price and money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
local color = {r=1, g=1, b=.6}
|
||||
local auctionable = not item_info or info.auctionable(info.tooltip(function(tooltip) tooltip:SetHyperlink(item_info.itemstring) end), item_info.quality)
|
||||
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
||||
local item_key = (item_id or 0) .. ':' .. (suffix_id or 0)
|
||||
local value = history.value(item_key)
|
||||
if auctionable then
|
||||
if _G.aux_tooltip_value then
|
||||
tooltip:AddLine('Value: '..(value and money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Value: ' .. (value and 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 = history.market_value(item_key)
|
||||
tooltip:AddLine('Today: '..(market_value and money.to_string2(market_value * quantity)..' ('..aux.auction_listing.percentage_historical(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 money.to_string2(market_value * quantity) .. ' (' .. aux.auction_listing.percentage_historical(round(market_value / value * 100)) .. ')' or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -115,7 +115,7 @@ function game_tooltip_hooks:SetHyperlink(itemstring)
|
||||
local name, _, quality = GetItemInfo(itemstring)
|
||||
if name then
|
||||
local hex = select(4, GetItemQualityColor(quality))
|
||||
local link = hex.. '|H'..itemstring..'|h['..name..']|h'..FONT_COLOR_CODE_CLOSE
|
||||
local link = hex .. '|H' .. itemstring .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
||||
extend_tooltip(GameTooltip, link, 1)
|
||||
end
|
||||
end
|
||||
@@ -155,7 +155,7 @@ function game_tooltip_hooks:SetInboxItem(index)
|
||||
for id in present(name and cache.item_id(name)) do
|
||||
local _, itemstring, quality = GetItemInfo(id)
|
||||
local hex = select(4, GetItemQualityColor(tonumber(quality)))
|
||||
local link = hex.. '|H'..itemstring..'|h['..name..']|h'..FONT_COLOR_CODE_CLOSE
|
||||
local link = hex .. '|H' .. itemstring .. '|h[' .. name .. ']|h' .. FONT_COLOR_CODE_CLOSE
|
||||
extend_tooltip(GameTooltip, link, quantity)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,7 +94,7 @@ public.search_config = {
|
||||
fill = function(cell, record, count, own, expandable)
|
||||
local numAuctionsText = expandable and color.link(count) or count
|
||||
if own > 0 then
|
||||
numAuctionsText = numAuctionsText..(' '..color.yellow('('..own..')'))
|
||||
numAuctionsText = numAuctionsText .. (' ' .. color.yellow('(' .. own .. ')'))
|
||||
end
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
@@ -262,7 +262,7 @@ public.auctions_config = {
|
||||
width = .06,
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record, count, own, expandable)
|
||||
local numAuctionsText = expandable and inline_color.link..count..FONT_COLOR_CODE_CLOSE or count
|
||||
local numAuctionsText = expandable and inline_color.link .. count .. FONT_COLOR_CODE_CLOSE or count
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
@@ -396,7 +396,7 @@ public.bids_config = {
|
||||
width = .06,
|
||||
align = 'CENTER',
|
||||
fill = function(cell, record, count, own, expandable)
|
||||
local numAuctionsText = expandable and inline_color.link..count..FONT_COLOR_CODE_CLOSE or count
|
||||
local numAuctionsText = expandable and inline_color.link .. count .. FONT_COLOR_CODE_CLOSE or count
|
||||
cell:SetText(numAuctionsText)
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
@@ -541,7 +541,7 @@ function percentage_color(pct)
|
||||
end
|
||||
|
||||
function public.percentage_historical(pct, bid)
|
||||
return (bid and inline_color.gray or percentage_color(pct))..(pct > 10000 and '>10000' or pct)..'%'..FONT_COLOR_CODE_CLOSE
|
||||
return (bid and inline_color.gray or percentage_color(pct)) .. (pct > 10000 and '>10000' or pct) .. '%' .. FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
|
||||
function public.time_left(code)
|
||||
@@ -636,7 +636,7 @@ local methods = {
|
||||
ChatFrameEditBox:Insert(this.row.data.record.link)
|
||||
elseif not modified and button == 'RightButton' then -- TODO not when alt (how?)
|
||||
tab = 1
|
||||
search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name)..'/exact')
|
||||
search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name) .. '/exact')
|
||||
search_tab.execute(nil, false)
|
||||
else
|
||||
local selection = this.rt:GetSelection()
|
||||
@@ -1019,7 +1019,7 @@ function public.CreateAuctionResultsTable(parent, config)
|
||||
rt.scrollFrame = scrollFrame
|
||||
FauxScrollFrame_Update(rt.scrollFrame, 0, numRows, rt.ROW_HEIGHT)
|
||||
|
||||
local scrollBar = _G[scrollFrame:GetName()..'ScrollBar']
|
||||
local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar']
|
||||
scrollBar:ClearAllPoints()
|
||||
scrollBar:SetPoint('BOTTOMRIGHT', rt, -4, 4)
|
||||
scrollBar:SetPoint('TOPRIGHT', rt, -4, -HEAD_HEIGHT)
|
||||
@@ -1029,8 +1029,8 @@ function public.CreateAuctionResultsTable(parent, config)
|
||||
thumbTex:SetTexture(color.content.background())
|
||||
thumbTex:SetHeight(150)
|
||||
thumbTex:SetWidth(scrollBar:GetWidth())
|
||||
_G[scrollBar:GetName()..'ScrollUpButton']:Hide()
|
||||
_G[scrollBar:GetName()..'ScrollDownButton']:Hide()
|
||||
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
||||
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
||||
|
||||
-- create the header cells
|
||||
rt.headCells = t
|
||||
|
||||
+14
-14
@@ -33,20 +33,20 @@ function LOAD()
|
||||
DropDownList1:ClearAllPoints()
|
||||
DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2)
|
||||
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
|
||||
local button = _G['DropDownList1Button'..i]
|
||||
local button = _G['DropDownList1Button' .. i]
|
||||
button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
|
||||
button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
|
||||
local text = button:GetFontString()
|
||||
text:SetFont(font, font_size.small2)
|
||||
text:SetPoint('TOPLEFT', 18, 0)
|
||||
text:SetPoint('BOTTOMRIGHT', -8, 0)
|
||||
local highlight = _G['DropDownList1Button'..i..'Highlight']
|
||||
local highlight = _G['DropDownList1Button' .. i..'Highlight']
|
||||
highlight:ClearAllPoints()
|
||||
highlight:SetDrawLayer('OVERLAY')
|
||||
highlight:SetHeight(14)
|
||||
highlight:SetPoint('LEFT', 5, 0)
|
||||
highlight:SetPoint('RIGHT', -3, 0)
|
||||
local check = _G['DropDownList1Button'..i..'Check']
|
||||
local check = _G['DropDownList1Button' .. i..'Check']
|
||||
check:SetWidth(16)
|
||||
check:SetHeight(16)
|
||||
check:SetPoint('LEFT', 3, -1)
|
||||
@@ -58,14 +58,14 @@ function LOAD()
|
||||
aux_border:Hide()
|
||||
aux_background:Hide()
|
||||
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
|
||||
local button = _G['DropDownList1Button'..i]
|
||||
local button = _G['DropDownList1Button' .. i]
|
||||
local text = button:GetFontString()
|
||||
text:SetFont([[Fonts\FRIZQT__.ttf]], 10)
|
||||
text:SetShadowOffset(1, -1)
|
||||
local highlight = _G['DropDownList1Button'..i..'Highlight']
|
||||
local highlight = _G['DropDownList1Button' .. i..'Highlight']
|
||||
highlight:SetAllPoints()
|
||||
highlight:SetDrawLayer('BACKGROUND')
|
||||
local check = _G['DropDownList1Button'..i..'Check']
|
||||
local check = _G['DropDownList1Button' .. i..'Check']
|
||||
check:SetWidth(24)
|
||||
check:SetHeight(24)
|
||||
check:SetPoint('LEFT', 0, 0)
|
||||
@@ -90,7 +90,7 @@ do
|
||||
local id = 1
|
||||
function public.name.get()
|
||||
id = id + 1
|
||||
return 'aux_frame'..id
|
||||
return 'aux_frame' .. id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -454,13 +454,13 @@ function public.item(parent)
|
||||
btn:SetPoint('LEFT', 2, .5)
|
||||
btn:SetHighlightTexture(nil)
|
||||
btn:RegisterForClicks()
|
||||
item.texture = _G[btn:GetName()..'Icon']
|
||||
item.texture = _G[btn:GetName() .. 'Icon']
|
||||
item.texture:SetTexCoord(.06, .94, .06, .94)
|
||||
item.name = label(btn, 15)
|
||||
item.name:SetJustifyH('LEFT')
|
||||
item.name:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
|
||||
item.name:SetPoint('RIGHT', item, 'RIGHT', -10, .5)
|
||||
item.count = _G[btn:GetName()..'Count']
|
||||
item.count = _G[btn:GetName() .. 'Count']
|
||||
item.count:SetTextHeight(17)
|
||||
return item
|
||||
end
|
||||
@@ -502,17 +502,17 @@ function public.dropdown(parent)
|
||||
local dropdown = CreateFrame('Frame', name, parent, 'UIDropDownMenuTemplate')
|
||||
set_content_style(dropdown, 0, 0, 4, 4)
|
||||
|
||||
_G[dropdown:GetName()..'Left']:Hide()
|
||||
_G[dropdown:GetName()..'Middle']:Hide()
|
||||
_G[dropdown:GetName()..'Right']:Hide()
|
||||
_G[dropdown:GetName() .. 'Left']:Hide()
|
||||
_G[dropdown:GetName() .. 'Middle']:Hide()
|
||||
_G[dropdown:GetName() .. 'Right']:Hide()
|
||||
|
||||
local button = _G[dropdown:GetName()..'Button']
|
||||
local button = _G[dropdown:GetName() .. 'Button']
|
||||
button:ClearAllPoints()
|
||||
button:SetScale(.9)
|
||||
button:SetPoint('RIGHT', dropdown, 0, 0)
|
||||
dropdown.button = button
|
||||
|
||||
local text = _G[dropdown:GetName()..'Text']
|
||||
local text = _G[dropdown:GetName() .. 'Text']
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint('RIGHT', button, 'LEFT', -2, 0)
|
||||
text:SetPoint('LEFT', 8, 0)
|
||||
|
||||
@@ -21,7 +21,7 @@ function public.render(item_listing)
|
||||
row.highlight:Hide()
|
||||
end
|
||||
row.item.texture:SetTexture(item_record.texture)
|
||||
row.item.name:SetText('['..item_record.name..']')
|
||||
row.item.name:SetText('[' .. item_record.name .. ']')
|
||||
local color = ITEM_QUALITY_COLORS[item_record.quality]
|
||||
row.item.name:SetTextColor(color.r, color.g, color.b)
|
||||
if item_record.aux_quantity > 1 then
|
||||
@@ -41,22 +41,22 @@ function public.create(parent, on_click, selected)
|
||||
content:SetPoint('TOPLEFT', 0, -51)
|
||||
content:SetPoint('BOTTOMRIGHT', -15, 0)
|
||||
|
||||
local scroll_frame = CreateFrame('ScrollFrame', gui.name..'ScrollFrame', parent, 'FauxScrollFrameTemplate')
|
||||
local scroll_frame = CreateFrame('ScrollFrame', gui.name .. 'ScrollFrame', parent, 'FauxScrollFrameTemplate')
|
||||
scroll_frame:SetScript('OnVerticalScroll', function(self, offset)
|
||||
FauxScrollFrame_OnVerticalScroll(ROW_HEIGHT, function() render(this.item_listing) end)
|
||||
end)
|
||||
scroll_frame:SetPoint('TOPLEFT', content, 'TOPLEFT', 0, 15)
|
||||
scroll_frame:SetPoint('BOTTOMRIGHT', content, 'BOTTOMRIGHT', -4, -15)
|
||||
|
||||
local scrollBar = _G[scroll_frame:GetName()..'ScrollBar']
|
||||
local scrollBar = _G[scroll_frame:GetName() .. 'ScrollBar']
|
||||
scrollBar:SetWidth(12)
|
||||
local thumbTex = scrollBar:GetThumbTexture()
|
||||
thumbTex:SetPoint('CENTER', 0, 0)
|
||||
thumbTex:SetTexture(color.content.background())
|
||||
thumbTex:SetHeight(50)
|
||||
thumbTex:SetWidth(12)
|
||||
_G[scrollBar:GetName()..'ScrollUpButton']:Hide()
|
||||
_G[scrollBar:GetName()..'ScrollDownButton']:Hide()
|
||||
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
||||
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
||||
|
||||
local rows = t
|
||||
local row_index = 1
|
||||
|
||||
+6
-6
@@ -292,7 +292,7 @@ local methods = {
|
||||
|
||||
AddColumn = function(st)
|
||||
local colNum = getn(st.headCols) + 1
|
||||
local col = CreateFrame('Button', st:GetName()..'HeadCol'..colNum, st.contentFrame)
|
||||
local col = CreateFrame('Button', st:GetName() .. 'HeadCol' .. colNum, st.contentFrame)
|
||||
if colNum == 1 then
|
||||
col:SetPoint('TOPLEFT', 0, -1)
|
||||
else
|
||||
@@ -407,7 +407,7 @@ local methods = {
|
||||
function public.CreateScrollingTable(parent)
|
||||
-- create the base frame
|
||||
ST_COUNT = ST_COUNT + 1
|
||||
local st = CreateFrame('Frame', 'TSMScrollingTable'..ST_COUNT, parent)
|
||||
local st = CreateFrame('Frame', 'TSMScrollingTable' .. ST_COUNT, parent)
|
||||
st:SetAllPoints()
|
||||
-- st:SetScript('OnSizeChanged', function() st:Redraw() end)
|
||||
|
||||
@@ -417,14 +417,14 @@ function public.CreateScrollingTable(parent)
|
||||
st.contentFrame = contentFrame
|
||||
|
||||
-- frame to hold the header columns and the rows
|
||||
local scrollFrame = CreateFrame('ScrollFrame', st:GetName()..'ScrollFrame', st, 'FauxScrollFrameTemplate')
|
||||
local scrollFrame = CreateFrame('ScrollFrame', st:GetName() .. 'ScrollFrame', st, 'FauxScrollFrameTemplate')
|
||||
scrollFrame:SetScript('OnVerticalScroll', function(self, offset)
|
||||
FauxScrollFrame_OnVerticalScroll(ST_ROW_HEIGHT, function() st:RefreshRows() end)
|
||||
end)
|
||||
scrollFrame:SetAllPoints(contentFrame)
|
||||
st.scrollFrame = scrollFrame
|
||||
|
||||
local scrollBar = _G[scrollFrame:GetName()..'ScrollBar']
|
||||
local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar']
|
||||
scrollBar:SetWidth(12)
|
||||
st.scrollBar = scrollBar
|
||||
local thumbTex = scrollBar:GetThumbTexture()
|
||||
@@ -432,8 +432,8 @@ function public.CreateScrollingTable(parent)
|
||||
thumbTex:SetTexture(color.content.background())
|
||||
thumbTex:SetHeight(50)
|
||||
thumbTex:SetWidth(12)
|
||||
_G[scrollBar:GetName()..'ScrollUpButton']:Hide()
|
||||
_G[scrollBar:GetName()..'ScrollDownButton']:Hide()
|
||||
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
||||
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
||||
|
||||
-- create head line at default position
|
||||
st.headLine = gui.horizontal_line(st, 0)
|
||||
|
||||
+17
-18
@@ -62,43 +62,42 @@ do local f, mt
|
||||
public.perm {get=function() return setmetatable(acquire_temp(), mt) end, set=function(t) auto_release[t] = nil end}
|
||||
end
|
||||
|
||||
do local mt, key = {}, nil
|
||||
do local mt, key = {}, nil
|
||||
function mt:__unm() local temp = mt.__index; mt.__index = nil; return temp end
|
||||
function mt:__index(k) key = k; return self end
|
||||
function mt:__call(v) self[key] = v; key = nil return self end
|
||||
function public.__(t) mt.__newindex = wipe(t); return setmetatable(acquire_temp(), mt) end
|
||||
end
|
||||
|
||||
do local SET, ARRAY, ARRAY0, TABLE = 1, 2, 3, 4
|
||||
local function constructor(type)
|
||||
do local function constructor(type)
|
||||
local chunk = 'local setn, error = table.setn, error; return function('
|
||||
for i = 1, 99 do chunk = chunk..'a'..i..',' end
|
||||
chunk = chunk..'overflow) local t = t'
|
||||
if type == SET then
|
||||
for i = 1, 99 do chunk = chunk .. 'a' .. i..',' end
|
||||
chunk = chunk .. 'overflow) local t = t'
|
||||
if type == 'set' then
|
||||
for i = 1, 99 do chunk = format('%s; if a%d == nil then return t end; t[a%d] = true', chunk, i, i) end
|
||||
elseif type == ARRAY then
|
||||
chunk = chunk..'; setn(t, 99); if a1 == nil then return t end; t[1] = a1'
|
||||
elseif type == 'array' then
|
||||
chunk = chunk .. '; setn(t, 99); if a1 == nil then return t end; t[1] = a1'
|
||||
for i = 2, 99 do chunk = format('%s; if a%d == nil then setn(t, %d); return t end; t[%d] = a%d', chunk, i, i - 1, i, i) end
|
||||
elseif type == ARRAY0 then
|
||||
chunk = chunk..'; setn(t, 99)'
|
||||
elseif type == 'array0' then
|
||||
chunk = chunk .. '; setn(t, 99)'
|
||||
for i = 1, 99 do chunk = format('%s; t[%d] = a%d', chunk, i, i) end
|
||||
elseif type == TABLE then
|
||||
elseif type == 'table' then
|
||||
for i = 1, 97, 2 do chunk = format('%s; if a%d == nil then return t end; t[a%d] = a%d', chunk, i, i, i + 1) end
|
||||
end
|
||||
chunk = chunk..'; return (overflow == nil or error "Overflow.") and t end'
|
||||
chunk = chunk .. '; return (overflow == nil or error "Overflow.") and t end'
|
||||
local f = loadstring(chunk); setfenv(f, M); return f()
|
||||
end
|
||||
public(); S, A, A0, T = constructor(SET), constructor(ARRAY), constructor(ARRAY0), constructor(TABLE)
|
||||
public(); S, A, A0, T = constructor'set', constructor'array', constructor 'array0', constructor 'table'
|
||||
end
|
||||
|
||||
do local chunk = 'return function(i'
|
||||
for i = 1, 99 do chunk = chunk..',a'..i end
|
||||
chunk = chunk..')'
|
||||
for i = 1, 99 do chunk = chunk .. ',a' .. i end
|
||||
chunk = chunk .. ')'
|
||||
for i = 1, 99 do
|
||||
chunk = format('%s if i == %d then return a%i', chunk, i, i)
|
||||
for j = i + 1, 99 do chunk = chunk..',a'..j end
|
||||
chunk = chunk..' end'
|
||||
for j = i + 1, 99 do chunk = chunk .. ',a' .. j end
|
||||
chunk = chunk .. ' end'
|
||||
end
|
||||
chunk = chunk..' end'
|
||||
chunk = chunk .. ' end'
|
||||
public.select = loadstring(chunk)()
|
||||
end
|
||||
+4
-4
@@ -5,14 +5,14 @@ local PUBLIC, PRIVATE = 1, 2
|
||||
local CALL, INDEX, NEWINDEX = 1, 2, 3
|
||||
|
||||
local inspect
|
||||
do local function print(msg) DEFAULT_CHAT_FRAME:AddMessage(RED_FONT_COLOR_CODE..msg) end
|
||||
do local function print(msg) DEFAULT_CHAT_FRAME:AddMessage(RED_FONT_COLOR_CODE .. msg) end
|
||||
local mt = {__metatable=false, __pow=function(self, v) self(v); return v end}
|
||||
function mt:__call(...)
|
||||
for i = 1, arg.n do
|
||||
print('arg'..i..' = '..(type(arg[i]) == 'string' and '"'..arg[i]..'"' or tostring(arg[i])))
|
||||
print('arg' .. i..' = ' .. (type(arg[i]) == 'string' and '"' .. arg[i] .. '"' or tostring(arg[i])))
|
||||
if type(arg[i]) == 'table' and next(arg[i]) then
|
||||
print('{')
|
||||
for k, v in arg[i] do print(' '..(type(k) == 'string' and k or '['..tostring(k)..']')..' = '..(type(v) == 'string' and '"'..v..'"' or tostring(v))) end
|
||||
for k, v in arg[i] do print(' ' .. (type(k) == 'string' and k or '[' .. tostring(k) .. ']') .. ' = ' .. (type(v) == 'string' and '"' .. v..'"' or tostring(v))) end
|
||||
print('}')
|
||||
end
|
||||
end
|
||||
@@ -21,7 +21,7 @@ do local function print(msg) DEFAULT_CHAT_FRAME:AddMessage(RED_FONT_COLOR_CODE.
|
||||
inspect = setmetatable({}, mt)
|
||||
end
|
||||
|
||||
local function error(msg, ...) return _G.error(format(msg or '', unpack(arg))..'\n'..debugstack(), 0) end
|
||||
local function error(msg, ...) return _G.error(format(msg or '', unpack(arg)) .. '\n' .. debugstack(), 0) end
|
||||
local function import_error() error('Import error.') end
|
||||
local function declaration_error() error('Declaration error.') end
|
||||
local function collision_error(key) error('"%s" already exists.', key) end
|
||||
|
||||
+4
-4
@@ -273,7 +273,7 @@ function update_item_configuration()
|
||||
historical_value_button:Hide()
|
||||
hide_checkbox:Hide()
|
||||
|
||||
-- deposit:SetText('Deposit: '..money.to_string(0, nil, nil, nil, gui.inline_color.text.enabled))
|
||||
-- deposit:SetText('Deposit: ' .. money.to_string(0, nil, nil, nil, gui.inline_color.text.enabled))
|
||||
-- set_unit_start_price(0)
|
||||
-- set_unit_buyout_price(0)
|
||||
else
|
||||
@@ -287,7 +287,7 @@ function update_item_configuration()
|
||||
hide_checkbox:Show()
|
||||
|
||||
item.texture:SetTexture(selected_item.texture)
|
||||
item.name:SetText('['..selected_item.name..']')
|
||||
item.name:SetText('[' .. selected_item.name .. ']')
|
||||
local color = ITEM_QUALITY_COLORS[selected_item.quality]
|
||||
item.name:SetTextColor(color.r, color.g, color.b)
|
||||
if selected_item.aux_quantity > 1 then
|
||||
@@ -303,7 +303,7 @@ function update_item_configuration()
|
||||
local deposit_factor = neutral_faction() and .25 or .05
|
||||
local stack_size, stack_count = stack_size_slider:GetValue(), stack_count_slider:GetValue()
|
||||
local amount = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
|
||||
deposit:SetText('Deposit: '..aux.money.to_string(amount, nil, nil, nil, inline_color.text.enabled))
|
||||
deposit:SetText('Deposit: ' .. aux.money.to_string(amount, nil, nil, nil, inline_color.text.enabled))
|
||||
end
|
||||
|
||||
refresh_button:Enable()
|
||||
@@ -438,7 +438,7 @@ end
|
||||
function refresh_entries()
|
||||
if selected_item then
|
||||
local item_id, suffix_id = selected_item.item_id, selected_item.suffix_id
|
||||
local item_key = item_id..':'..suffix_id
|
||||
local item_key = item_id .. ':' .. suffix_id
|
||||
existing_auctions[item_key] = nil
|
||||
local query = scan_util.item_query(item_id)
|
||||
status_bar:update_status(0,0)
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ function create_frames()
|
||||
set_item(this.item_record)
|
||||
elseif arg1 == 'RightButton' then
|
||||
tab = 1
|
||||
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name)..'/exact')
|
||||
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name) .. '/exact')
|
||||
search_tab.execute(nil, false)
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -19,7 +19,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
}
|
||||
do
|
||||
local function action()
|
||||
_G.aux_auto_buy_filter = _G[this:GetParent():GetName()..'EditBox']:GetText()
|
||||
_G.aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText()
|
||||
update_auto_buy_filter()
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ do
|
||||
button2 = 'Cancel',
|
||||
hasEditBox = 1,
|
||||
OnShow = function()
|
||||
local edit_box = _G[this:GetName()..'EditBox']
|
||||
local edit_box = _G[this:GetName() .. 'EditBox']
|
||||
edit_box:SetMaxLetters(nil)
|
||||
edit_box:SetFocus()
|
||||
edit_box:HighlightText()
|
||||
@@ -69,12 +69,12 @@ function CLOSE()
|
||||
end
|
||||
|
||||
function CLICK_LINK(item_info)
|
||||
set_filter(strlower(item_info.name)..'/exact')
|
||||
set_filter(strlower(item_info.name) .. '/exact')
|
||||
execute(nil, false)
|
||||
end
|
||||
|
||||
function USE_ITEM(item_info)
|
||||
set_filter(strlower(item_info.name)..'/exact')
|
||||
set_filter(strlower(item_info.name) .. '/exact')
|
||||
execute(nil, false)
|
||||
end
|
||||
|
||||
@@ -107,10 +107,10 @@ function public.add_filter(filter_string)
|
||||
old_filter_string = trim(old_filter_string)
|
||||
|
||||
if old_filter_string ~= '' then
|
||||
old_filter_string = old_filter_string..';'
|
||||
old_filter_string = old_filter_string .. ';'
|
||||
end
|
||||
|
||||
search_box:SetText(old_filter_string..filter_string)
|
||||
search_box:SetText(old_filter_string .. filter_string)
|
||||
end
|
||||
|
||||
function blizzard_page_index(str)
|
||||
|
||||
+16
-16
@@ -73,7 +73,7 @@ function update_form()
|
||||
|
||||
if blizzard_query.exact then
|
||||
for key in temp-S('class', 'subclass', 'slot', 'quality') do
|
||||
M[key..'_dropdown'].button:Disable()
|
||||
M[key .. '_dropdown'].button:Disable()
|
||||
end
|
||||
else
|
||||
class_dropdown.button:Enable()
|
||||
@@ -81,9 +81,9 @@ function update_form()
|
||||
end
|
||||
for key in temp-S('min_level', 'max_level') do
|
||||
if blizzard_query.exact then
|
||||
M[key..'_input']:Disable()
|
||||
M[key .. '_input']:Disable()
|
||||
else
|
||||
M[key..'_input']:Enable()
|
||||
M[key .. '_input']:Enable()
|
||||
end
|
||||
end
|
||||
if blizzard_query.exact then
|
||||
@@ -104,7 +104,7 @@ function get_filter_builder_query()
|
||||
|
||||
local function add(part)
|
||||
if part then
|
||||
filter_string = filter_string and filter_string..'/'..part or part
|
||||
filter_string = filter_string and filter_string .. '/' .. part or part
|
||||
end
|
||||
end
|
||||
|
||||
@@ -134,7 +134,7 @@ function get_filter_builder_query()
|
||||
|
||||
local quality = blizzard_query.quality
|
||||
if quality and quality >= 0 then
|
||||
add(strlower(_G['ITEM_QUALITY'..quality..'_DESC']))
|
||||
add(strlower(_G['ITEM_QUALITY' .. quality .. '_DESC']))
|
||||
end
|
||||
|
||||
local post_filter_string = filter_util.filter_string(post_filter)
|
||||
@@ -193,11 +193,11 @@ function public.formatted_post_filter(components)
|
||||
|
||||
for i, component in components do
|
||||
if no_line_break then
|
||||
str = str..' '
|
||||
str = str .. ' '
|
||||
elseif i > 1 then
|
||||
str = str..'</p><p>'
|
||||
str = str .. '</p><p>'
|
||||
for _=1,getn(stack) do
|
||||
str = str..color.content.background('----')
|
||||
str = str .. color.content.background('----')
|
||||
end
|
||||
end
|
||||
no_line_break = component[1] == 'operator' and component[2] == 'not'
|
||||
@@ -205,16 +205,16 @@ function public.formatted_post_filter(components)
|
||||
local filter_color = (filter_builder_state.selected == i and color.orange or color.aux)
|
||||
local component_text = filter_color(component[2])
|
||||
if component[1] == 'operator' and component[2] ~= 'not' then
|
||||
component_text = component_text..filter_color(tonumber(component[3]) or '')
|
||||
component_text = component_text .. filter_color(tonumber(component[3]) or '')
|
||||
tinsert(stack, component[3])
|
||||
elseif component[1] == 'filter' then
|
||||
for parameter in present(component[3]) do
|
||||
if component[2] == 'item' then
|
||||
parameter = aux.info.display_name(aux.cache.item_id(parameter)) or '['..parameter..']'
|
||||
parameter = aux.info.display_name(aux.cache.item_id(parameter)) or '[' .. parameter .. ']'
|
||||
elseif filter_util.filters[component[2]].input_type == 'money' then
|
||||
parameter = aux.money.to_string(aux.money.from_string(parameter), nil, true)
|
||||
end
|
||||
component_text = component_text..filter_color(': ')..parameter
|
||||
component_text = component_text .. filter_color(': ') .. parameter
|
||||
end
|
||||
while getn(stack) > 0 and stack[getn(stack)] do
|
||||
local top = tremove(stack)
|
||||
@@ -224,14 +224,14 @@ function public.formatted_post_filter(components)
|
||||
end
|
||||
end
|
||||
end
|
||||
str = str..data_link(i, component_text)
|
||||
str = str .. data_link(i, component_text)
|
||||
end
|
||||
|
||||
return '<html><body><p>'..str..'</p></body></html>'
|
||||
return '<html><body><p>' .. str .. '</p></body></html>'
|
||||
end
|
||||
|
||||
function data_link(id, str)
|
||||
return '|H'..id..'|h'..str..'|h'
|
||||
return '|H' .. id .. '|h' .. str .. '|h'
|
||||
end
|
||||
|
||||
post_filter = t
|
||||
@@ -266,7 +266,7 @@ function add_post_filter()
|
||||
for str in present(filter_input:GetText()) do
|
||||
for filter in present(filter_util.filters[str]) do
|
||||
if filter.input_type ~= '' then
|
||||
str = str..'/'..filter_parameter_input:GetText()
|
||||
str = str .. '/' .. filter_parameter_input:GetText()
|
||||
end
|
||||
end
|
||||
local components, error, suggestions = filter_util.parse_filter_string(str)
|
||||
@@ -393,6 +393,6 @@ function initialize_quality_dropdown()
|
||||
end
|
||||
UIDropDownMenu_AddButton(T('text', ALL, 'value', -1, 'func', on_click))
|
||||
for i = 0, 4 do
|
||||
UIDropDownMenu_AddButton(T('text', _G['ITEM_QUALITY'..i..'_DESC'], 'value', i, 'func', on_click))
|
||||
UIDropDownMenu_AddButton(T('text', _G['ITEM_QUALITY' .. i..'_DESC'], 'value', i, 'func', on_click))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -499,7 +499,7 @@ function create_frames()
|
||||
dropdown:SetScript('OnShow', function()
|
||||
UIDropDownMenu_Initialize(this, initialize_filter_dropdown)
|
||||
end)
|
||||
_G[dropdown:GetName()..'Text']:Hide()
|
||||
_G[dropdown:GetName() .. 'Text']:Hide()
|
||||
local label = gui.label(dropdown, gui.font_size.medium)
|
||||
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
|
||||
label:SetText('Post Filter')
|
||||
@@ -515,7 +515,7 @@ function create_frames()
|
||||
input.change = function()
|
||||
local text = this:GetText()
|
||||
if filter_util.filters[text] and filter_util.filters[text].input_type ~= '' then
|
||||
local _, _, suggestions = filter_util.parse_filter_string(text..'/')
|
||||
local _, _, suggestions = filter_util.parse_filter_string(text .. '/')
|
||||
filter_parameter_input:SetNumeric(filter_util.filters[text].input_type == 'number')
|
||||
filter_parameter_input.complete = completion.complete(function() return suggestions or empty end)
|
||||
filter_parameter_input:Show()
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ do
|
||||
__call = function(self, text)
|
||||
local r, g, b, a = unpack(self)
|
||||
if text then
|
||||
return format('|c%02X%02X%02X%02X', a, r*255, g*255, b*255)..text..FONT_COLOR_CODE_CLOSE
|
||||
return format('|c%02X%02X%02X%02X', a, r*255, g*255, b*255) .. text .. FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
return r, g, b, a
|
||||
end
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ function public:complete_filter()
|
||||
|
||||
for _, suggestion in suggestions do
|
||||
if strsub(strupper(suggestion), 1, strlen(current_modifier)) == strupper(current_modifier) then
|
||||
this:SetText(strlower(strsub(filter_string, 1, start_index - 1).. suggestion))
|
||||
this:SetText(strlower(strsub(filter_string, 1, start_index - 1) .. suggestion))
|
||||
this:HighlightText(strlen(filter_string), -1)
|
||||
return
|
||||
end
|
||||
|
||||
+4
-4
@@ -24,7 +24,7 @@ end
|
||||
do
|
||||
local formal_parameters = t
|
||||
for i = 1, 9 do
|
||||
local key = '_'..i
|
||||
local key = '_' .. i
|
||||
public[key] = t
|
||||
formal_parameters[M[key]] = i
|
||||
end
|
||||
@@ -44,9 +44,9 @@ do
|
||||
local arg1 = arg
|
||||
return function(...) return helper(body, arg1, arg) end
|
||||
else
|
||||
-- body = gsub(body, '_([ab])', function(char) return '_'.. end)
|
||||
-- local lambda = loadstring('return function(_1,_2,_3,_4,_5,_6,_7,_8,_9)'..body..' end')
|
||||
local lambda = loadstring('return '..body) or loadstring(body)
|
||||
-- body = gsub(body, '_([ab])', function(char) return '_' .. end)
|
||||
-- local lambda = loadstring('return function(_1,_2,_3,_4,_5,_6,_7,_8,_9)' .. body .. ' end')
|
||||
local lambda = loadstring('return ' .. body) or loadstring(body)
|
||||
setfenv(lambda, getfenv(2))
|
||||
return lambda
|
||||
end
|
||||
|
||||
+11
-11
@@ -205,7 +205,7 @@ public.filters = {
|
||||
function operator(str)
|
||||
local operator = str == 'not' and A('operator', 'not', 1)
|
||||
for name in temp-S('and', 'or') do
|
||||
for arity in present(select(3, strfind(str, '^'..name..'(%d*)$'))) do
|
||||
for arity in present(select(3, strfind(str, '^' .. name .. '(%d*)$'))) do
|
||||
arity = tonumber(arity)
|
||||
operator = not (arity and arity < 2) and A('operator', name, arity)
|
||||
end
|
||||
@@ -294,9 +294,9 @@ function public.parse_filter_string(str)
|
||||
if parts[i] == 'item' then
|
||||
return nil, 'Invalid item name', _G.aux_auctionable_items
|
||||
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
|
||||
return nil, 'Invalid input for '..parts[i]..'. Expecting: '..input_type
|
||||
return nil, 'Invalid input for ' .. parts[i] .. '. Expecting: ' .. input_type
|
||||
end
|
||||
end
|
||||
tinsert(post_filter, A('filter', parts[i], parts[i + 1]))
|
||||
@@ -406,13 +406,13 @@ function suggestions(filter)
|
||||
|
||||
-- rarities
|
||||
if not filter.blizzard.quality then
|
||||
for i = 0, 4 do tinsert(suggestions, _G['ITEM_QUALITY'..i..'_DESC']) end
|
||||
for i = 0, 4 do tinsert(suggestions, _G['ITEM_QUALITY' .. i..'_DESC']) end
|
||||
end
|
||||
|
||||
-- item names
|
||||
if getn(filter.components) == 0 then
|
||||
for _, name in _G.aux_auctionable_items do
|
||||
tinsert(suggestions, name..'/exact')
|
||||
tinsert(suggestions, name .. '/exact')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -426,7 +426,7 @@ function public.filter_string(components)
|
||||
if component[1] == 'blizzard' then
|
||||
query_builder.append(filter[4] or filter[3])
|
||||
elseif component[1] == 'operator' then
|
||||
query_builder.append(component[2]..(component[2] ~= 'not' and tonumber(component[3]) or ''))
|
||||
query_builder.append(component[2] .. (component[2] ~= 'not' and tonumber(component[3]) or ''))
|
||||
elseif component[1] == 'filter' then
|
||||
query_builder.append(component[2])
|
||||
for parameter in present(component[3]) do
|
||||
@@ -448,7 +448,7 @@ function prettified_filter_string(filter)
|
||||
if component[1] == 'blizzard' then
|
||||
if component[2] == 'name' then
|
||||
if filter.blizzard.exact then
|
||||
prettified.append(info.display_name(aux.cache.item_id(component[4])) or color.blizzard('['..component[4]..']'))
|
||||
prettified.append(info.display_name(aux.cache.item_id(component[4])) or color.blizzard('[' .. component[4] .. ']'))
|
||||
elseif component[4] ~= '' then
|
||||
prettified.append(color.blizzard(component[4]))
|
||||
end
|
||||
@@ -456,14 +456,14 @@ function prettified_filter_string(filter)
|
||||
prettified.append(color.blizzard(component[3]))
|
||||
end
|
||||
elseif component[1] == 'operator' then
|
||||
prettified.append(color.aux(component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')))
|
||||
prettified.append(color.aux(component[2] .. (component[2] ~= 'not' and tonumber(component[3]) or '')))
|
||||
elseif component[1] == 'filter' then
|
||||
if component[2] ~= 'tooltip' then
|
||||
prettified.append(color.aux(component[2]))
|
||||
end
|
||||
for parameter in present(component[3]) do
|
||||
if component[2] == 'item' then
|
||||
prettified.append(info.display_name(aux.cache.item_id(parameter)) or color.label.enabled('['..parameter..']'))
|
||||
prettified.append(info.display_name(aux.cache.item_id(parameter)) or color.label.enabled('[' .. parameter .. ']'))
|
||||
else
|
||||
if filters[component[2]].input_type == 'money' then
|
||||
prettified.append(aux.money.to_string(aux.money.from_string(parameter), nil, true, nil, inline_color.label.enabled))
|
||||
@@ -482,7 +482,7 @@ function prettified_filter_string(filter)
|
||||
end
|
||||
|
||||
function public.quote(name)
|
||||
return '<'..name..'>'
|
||||
return '<' .. name .. '>'
|
||||
end
|
||||
|
||||
function public.unquote(name)
|
||||
@@ -559,7 +559,7 @@ function public.query_builder()
|
||||
local filter
|
||||
return T(
|
||||
'append', function(part)
|
||||
filter = not filter and part or filter..'/'..part
|
||||
filter = not filter and part or filter .. '/' .. part
|
||||
end,
|
||||
'get', function()
|
||||
return filter or ''
|
||||
|
||||
+16
-16
@@ -56,7 +56,7 @@ function public.container_item(bag, slot)
|
||||
|
||||
'link', link,
|
||||
'itemstring', item_info.itemstring,
|
||||
'item_key', item_id..':'..suffix_id,
|
||||
'item_key', item_id .. ':' .. suffix_id,
|
||||
|
||||
'name', item_info.name,
|
||||
'texture', texture,
|
||||
@@ -119,7 +119,7 @@ function public.auction(index, query_type)
|
||||
|
||||
'link', link,
|
||||
'itemstring', item_info.itemstring,
|
||||
'item_key', item_id..':'..suffix_id,
|
||||
'item_key', item_id .. ':' .. suffix_id,
|
||||
'search_signature', join(temp-{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 (is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
|
||||
'sniping_signature', join(temp-{item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, _G.aux_ignore_owner and (is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
|
||||
|
||||
@@ -237,8 +237,8 @@ function public.load_tooltip(frame, tooltip)
|
||||
end
|
||||
end
|
||||
for i = 1, getn(tooltip) do -- TODO why is this needed?
|
||||
_G[frame:GetName()..'TextLeft'..i]:SetJustifyH('LEFT')
|
||||
_G[frame:GetName()..'TextRight'..i]:SetJustifyH('LEFT')
|
||||
_G[frame:GetName() .. 'TextLeft' .. i]:SetJustifyH('LEFT')
|
||||
_G[frame:GetName() .. 'TextRight' .. i]:SetJustifyH('LEFT')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -246,10 +246,10 @@ function public.display_name(item_id, no_brackets, no_color)
|
||||
for item_info in present(item(item_id)) do
|
||||
local name = item_info.name
|
||||
if not no_brackets then
|
||||
name = '['..name..']'
|
||||
name = '[' .. name .. ']'
|
||||
end
|
||||
if not no_color then
|
||||
name = select(4, GetItemQualityColor(item_info.quality))..name..FONT_COLOR_CODE_CLOSE
|
||||
name = select(4, GetItemQualityColor(item_info.quality)) .. name .. FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
return name
|
||||
end
|
||||
@@ -275,10 +275,10 @@ function public.tooltip(setter)
|
||||
local tooltip = t
|
||||
for i = 1, AuxTooltip:NumLines() do
|
||||
tinsert(tooltip, {
|
||||
left_text = _G['AuxTooltipTextLeft'..i]:GetText(),
|
||||
left_color = {_G['AuxTooltipTextLeft'..i]:GetTextColor()},
|
||||
right_text = _G['AuxTooltipTextRight'..i]:IsVisible() and _G['AuxTooltipTextRight'..i]:GetText(),
|
||||
right_color = {_G['AuxTooltipTextRight'..i]:GetTextColor()},
|
||||
left_text = _G['AuxTooltipTextLeft' .. i]:GetText(),
|
||||
left_color = {_G['AuxTooltipTextLeft' .. i]:GetTextColor()},
|
||||
right_text = _G['AuxTooltipTextRight' .. i]:IsVisible() and _G['AuxTooltipTextRight' .. i]:GetText(),
|
||||
right_color = {_G['AuxTooltipTextRight' .. i]:GetTextColor()},
|
||||
})
|
||||
end
|
||||
|
||||
@@ -287,7 +287,7 @@ end
|
||||
|
||||
function item_charges(tooltip)
|
||||
for _, line in tooltip do
|
||||
local pattern = '^'..gsub(gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)')..'$'
|
||||
local pattern = '^' .. gsub(gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)') .. '$'
|
||||
|
||||
local _, _, left_charges_string = strfind(line.left_text or '', pattern)
|
||||
local _, _, right_charges_string = strfind(line.right_text or '', pattern)
|
||||
@@ -329,7 +329,7 @@ end
|
||||
|
||||
function public.durability(tooltip)
|
||||
for _, line in tooltip do
|
||||
local pattern = '^'..gsub(gsub(DURABILITY_TEMPLATE, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)')..'$'
|
||||
local pattern = '^' .. gsub(gsub(DURABILITY_TEMPLATE, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)') .. '$'
|
||||
local _, _, left_durability_string, left_max_durability_string = strfind(line.left_text or '', pattern)
|
||||
local _, _, right_durability_string, right_max_durability_string = strfind(line.right_text or '', pattern)
|
||||
local durability = tonumber(left_durability_string) or tonumber(right_durability_string)
|
||||
@@ -342,7 +342,7 @@ end
|
||||
|
||||
function public.item_key(link)
|
||||
local item_id, suffix_id = parse_link(link)
|
||||
return item_id..':'..suffix_id
|
||||
return item_id .. ':' .. suffix_id
|
||||
end
|
||||
|
||||
function public.parse_link(link)
|
||||
@@ -351,11 +351,11 @@ function public.parse_link(link)
|
||||
end
|
||||
|
||||
function public.itemstring(item_id, suffix_id, unique_id, enchant_id)
|
||||
return 'item:'..(item_id or 0)..':'..(enchant_id or 0)..':'..(suffix_id or 0)..':'..(unique_id or 0)
|
||||
return 'item:' .. (item_id or 0) .. ':' .. (enchant_id or 0) .. ':' .. (suffix_id or 0) .. ':' .. (unique_id or 0)
|
||||
end
|
||||
|
||||
function public.item(item_id, suffix_id)
|
||||
local itemstring = 'item:'..(item_id or 0)..':0:'..(suffix_id or 0)..':0'
|
||||
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,
|
||||
@@ -397,7 +397,7 @@ end
|
||||
|
||||
function public.item_quality_index(item_quality)
|
||||
for i = 0, 4 do
|
||||
local quality = _G['ITEM_QUALITY'..i..'_DESC']
|
||||
local quality = _G['ITEM_QUALITY' .. i..'_DESC']
|
||||
if strupper(item_quality) == strupper(quality) then
|
||||
return i, quality
|
||||
end
|
||||
|
||||
+17
-17
@@ -28,9 +28,9 @@ function public.to_string2(money, exact, color)
|
||||
local GOLD = 'ffd100'
|
||||
local SILVER = 'e6e6e6'
|
||||
local COPPER = 'c8602c'
|
||||
local START = '|cff%s%d'..FONT_COLOR_CODE_CLOSE
|
||||
local PART = color..'.|cff%s%02d'..FONT_COLOR_CODE_CLOSE
|
||||
local NONE = '|cffa0a0a0'..TEXT_NONE..FONT_COLOR_CODE_CLOSE
|
||||
local START = '|cff%s%d' .. FONT_COLOR_CODE_CLOSE
|
||||
local PART = color .. '.|cff%s%02d' .. FONT_COLOR_CODE_CLOSE
|
||||
local NONE = '|cffa0a0a0' .. TEXT_NONE .. FONT_COLOR_CODE_CLOSE
|
||||
|
||||
if not exact and money >= 10000 then
|
||||
-- Round to nearest silver
|
||||
@@ -42,15 +42,15 @@ function public.to_string2(money, exact, color)
|
||||
|
||||
local fmt = START
|
||||
if g > 0 then
|
||||
str = str..format(fmt, GOLD, g)
|
||||
str = str .. format(fmt, GOLD, g)
|
||||
fmt = PART
|
||||
end
|
||||
if s > 0 or c > 0 then
|
||||
str = str..format(fmt, SILVER, s)
|
||||
str = str .. format(fmt, SILVER, s)
|
||||
fmt = PART
|
||||
end
|
||||
if c > 0 then
|
||||
str = str..format(fmt, COPPER, c)
|
||||
str = str .. format(fmt, COPPER, c)
|
||||
end
|
||||
if str == '' then
|
||||
str = NONE
|
||||
@@ -70,7 +70,7 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color)
|
||||
|
||||
-- rounding
|
||||
if decimal_points then
|
||||
copper = tonumber(format('%.'..decimal_points..'f', copper))
|
||||
copper = tonumber(format('%.' .. decimal_points .. 'f', copper))
|
||||
end
|
||||
|
||||
local gold_text, silver_text, copper_text
|
||||
@@ -84,30 +84,30 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color)
|
||||
if trim then
|
||||
local parts = tt
|
||||
if gold > 0 then
|
||||
tinsert(parts, format_number(gold, false, nil, color)..gold_text)
|
||||
tinsert(parts, format_number(gold, false, nil, color) .. gold_text)
|
||||
end
|
||||
if silver > 0 then
|
||||
tinsert(parts, format_number(silver, pad, nil, color)..silver_text)
|
||||
tinsert(parts, format_number(silver, pad, nil, color) .. silver_text)
|
||||
end
|
||||
if copper > 0 or gold == 0 and silver == 0 then
|
||||
tinsert(parts, format_number(copper, pad, decimal_points, color)..copper_text)
|
||||
tinsert(parts, format_number(copper, pad, decimal_points, color) .. copper_text)
|
||||
end
|
||||
text = join(parts, ' ')
|
||||
else
|
||||
if gold > 0 then
|
||||
text = format_number(gold, false, nil, color)..gold_text..' '..format_number(silver, pad, nil, color)..silver_text..' '..format_number(copper, pad, decimal_points, color)..copper_text
|
||||
text = format_number(gold, false, nil, color) .. gold_text .. ' ' .. format_number(silver, pad, nil, color) .. silver_text .. ' ' .. format_number(copper, pad, decimal_points, color) .. copper_text
|
||||
elseif silver > 0 then
|
||||
text = format_number(silver, false, nil, color)..silver_text..' '..format_number(copper, pad, decimal_points, color)..copper_text
|
||||
text = format_number(silver, false, nil, color) .. silver_text .. ' ' .. format_number(copper, pad, decimal_points, color) .. copper_text
|
||||
else
|
||||
text = format_number(copper, false, decimal_points, color)..copper_text
|
||||
text = format_number(copper, false, decimal_points, color) .. copper_text
|
||||
end
|
||||
end
|
||||
|
||||
if is_negative then
|
||||
if color then
|
||||
text = color..'-'..FONT_COLOR_CODE_CLOSE..text
|
||||
text = color .. '-' .. FONT_COLOR_CODE_CLOSE .. text
|
||||
else
|
||||
text = '-'..text
|
||||
text = '-' .. text
|
||||
end
|
||||
end
|
||||
|
||||
@@ -140,9 +140,9 @@ end
|
||||
|
||||
function public.format_number(num, pad, decimal_padding, color)
|
||||
local padding = pad and 2 + (decimal_padding and decimal_padding + 1 or 0) or 0
|
||||
num = format('%0'..padding..'.0'..(decimal_padding or 0)..'f', num)
|
||||
num = format('%0' .. padding .. '.0' .. (decimal_padding or 0) .. 'f', num)
|
||||
if color then
|
||||
return color..num..FONT_COLOR_CODE_CLOSE
|
||||
return color .. num .. FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
return num
|
||||
end
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ end
|
||||
|
||||
function public.item_query(item_id, first_page, last_page)
|
||||
for item_info in present(info.item(item_id)) do
|
||||
local query = filter_util.query(item_info.name..'/exact')
|
||||
local query = filter_util.query(item_info.name .. '/exact')
|
||||
query.blizzard_query.first_page = first_page
|
||||
query.blizzard_query.last_page = last_page
|
||||
return T('validator', query.validator, 'blizzard_query', query.blizzard_query)
|
||||
|
||||
Reference in New Issue
Block a user