slash refactoring, usage printout
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ end
|
||||
|
||||
function M.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
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
## Interface: 11200
|
||||
## Title: aux
|
||||
## Notes: Auction House replacement
|
||||
## SavedVariablesPerCharacter: aux_tooltip_value, aux_tooltip_daily, aux_tooltip_vendor_buy, aux_tooltip_vendor_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
|
||||
## SavedVariables: aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters, aux_recent_searches, aux_favorite_searches, aux_ignore_owner, aux_price_per_unit
|
||||
## SavedVariablesPerCharacter: aux_tooltip_value, aux_tooltip_daily, aux_tooltip_merchant_buy, aux_tooltip_merchant_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
|
||||
## SavedVariables: aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters, aux_recent_searches, aux_favorite_searches, aux_ignore_owner
|
||||
|
||||
libs\inspect.lua
|
||||
libs\module.lua
|
||||
|
||||
+20
-6
@@ -7,6 +7,10 @@ local cache = require 'aux.core.cache'
|
||||
|
||||
_G.aux_ignore_owner = true
|
||||
|
||||
function status(enabled)
|
||||
return '[' .. (enabled and color.green'on' or color.red'off') .. ']'
|
||||
end
|
||||
|
||||
_G.SLASH_AUX1 = '/aux'
|
||||
function SlashCmdList.AUX(command)
|
||||
if not command then return end
|
||||
@@ -25,11 +29,11 @@ function SlashCmdList.AUX(command)
|
||||
_G.aux_tooltip_daily = not aux_tooltip_daily
|
||||
print('Market value in tooltip ' .. (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 aux_tooltip_vendor_buy
|
||||
print('Vendor buy price in tooltip ' .. (aux_tooltip_vendor_buy and 'enabled' or 'disabled') .. '.')
|
||||
_G.aux_tooltip_merchant_buy = not aux_tooltip_merchant_buy
|
||||
print('Vendor buy price in tooltip ' .. (aux_tooltip_merchant_buy and 'enabled' or 'disabled') .. '.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'sell' then
|
||||
_G.aux_tooltip_vendor_sell = not aux_tooltip_vendor_sell
|
||||
print('Vendor sell price in tooltip ' .. (aux_tooltip_vendor_sell and 'enabled' or 'disabled') .. '.')
|
||||
_G.aux_tooltip_merchant_sell = not aux_tooltip_merchant_sell
|
||||
print('Vendor sell price in tooltip ' .. (aux_tooltip_merchant_sell and 'enabled' or 'disabled') .. '.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
|
||||
_G.aux_tooltip_disenchant_value = not aux_tooltip_disenchant_value
|
||||
print('Disenchant value in tooltip ' .. (aux_tooltip_disenchant_value and 'enabled' or 'disabled') .. '.')
|
||||
@@ -43,6 +47,16 @@ function SlashCmdList.AUX(command)
|
||||
_G.aux_ignore_owner = not aux_ignore_owner
|
||||
print('Ignoring of owner ' .. (aux_ignore_owner and 'enabled' or 'disabled') .. '.')
|
||||
else
|
||||
print('Unknown command: "' .. command .. '"')
|
||||
end
|
||||
print('Usage:')
|
||||
print(' - ignore owner ' .. status(aux_ignore_owner))
|
||||
print(' - tooltip value ' .. status(aux_tooltip_value))
|
||||
print(' - tooltip daily ' .. status(aux_tooltip_daily))
|
||||
print(' - tooltip vendor buy ' .. status(aux_tooltip_merchant_buy))
|
||||
print(' - tooltip vendor sell ' .. status(aux_tooltip_merchant_sell))
|
||||
print(' - tooltip disenchant value ' .. status(aux_tooltip_disenchant_value))
|
||||
print(' - tooltip disenchant distribution ' .. status(aux_tooltip_disenchant_distribution))
|
||||
print(' - tooltip disenchant source ' .. status(aux_tooltip_disenchant_source))
|
||||
print(' - clear item cache')
|
||||
print(' - populate wdb')
|
||||
end
|
||||
end
|
||||
+2
-2
@@ -84,13 +84,13 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
end
|
||||
end
|
||||
end
|
||||
if aux_tooltip_vendor_buy then
|
||||
if aux_tooltip_merchant_buy then
|
||||
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.tooltip.merchant())
|
||||
end
|
||||
end
|
||||
if aux_tooltip_vendor_sell then
|
||||
if aux_tooltip_merchant_sell then
|
||||
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.tooltip.merchant())
|
||||
|
||||
+31
-31
@@ -10,7 +10,7 @@ local history = require 'aux.core.history'
|
||||
local gui = require 'aux.gui'
|
||||
local search_tab = require 'aux.tabs.search'
|
||||
|
||||
_G.aux_price_per_unit = false
|
||||
local price_per_unit = false
|
||||
|
||||
local HEAD_HEIGHT = 27
|
||||
local HEAD_SPACE = 2
|
||||
@@ -174,24 +174,24 @@ M.search_config = {
|
||||
end
|
||||
local price
|
||||
if record.high_bidder then
|
||||
price = aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||
price = price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||
else
|
||||
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||
price = price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||
end
|
||||
cell.text:SetText(money.to_string(price, true, false, nil, price_color))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a
|
||||
if record_a.high_bidder then
|
||||
price_a = aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||
price_a = price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||
else
|
||||
price_a = aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price
|
||||
price_a = price_per_unit and record_a.unit_bid_price or record_a.bid_price
|
||||
end
|
||||
local price_b
|
||||
if record_b.high_bidder then
|
||||
price_b = aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||
price_b = price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||
else
|
||||
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||
price_b = price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||
end
|
||||
if record_a.high_bidder and not record_b.high_bidder then
|
||||
return sort_util.GT
|
||||
@@ -214,12 +214,12 @@ M.search_config = {
|
||||
align = 'RIGHT',
|
||||
isPrice = true,
|
||||
fill = function(cell, record)
|
||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
local price = price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
cell.text:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||
|
||||
@@ -316,24 +316,24 @@ M.auctions_config = {
|
||||
fill = function(cell, record)
|
||||
local price
|
||||
if record.high_bidder then
|
||||
price = aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||
price = price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||
else
|
||||
price = aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price
|
||||
price = price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price
|
||||
end
|
||||
cell.text:SetText(money.to_string(price, true, false))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a
|
||||
if record_a.high_bidder then
|
||||
price_a = aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||
price_a = price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||
else
|
||||
price_a = aux_price_per_unit and record_a.start_price / record_b.aux_quantity or record_a.start_price
|
||||
price_a = price_per_unit and record_a.start_price / record_b.aux_quantity or record_a.start_price
|
||||
end
|
||||
local price_b
|
||||
if record_b.high_bidder then
|
||||
price_b = aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||
price_b = price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||
else
|
||||
price_b = aux_price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
|
||||
price_b = price_per_unit and record_b.start_price / record_b.aux_quantity or record_b.start_price
|
||||
end
|
||||
return sort_util.compare(price_a, price_b, desc)
|
||||
end,
|
||||
@@ -344,12 +344,12 @@ M.auctions_config = {
|
||||
align = 'RIGHT',
|
||||
isPrice = true,
|
||||
fill = function(cell, record)
|
||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
local price = price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
cell.text:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||
|
||||
@@ -457,24 +457,24 @@ M.bids_config = {
|
||||
fill = function(cell, record)
|
||||
local price
|
||||
if record.high_bidder then
|
||||
price = aux_price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||
price = price_per_unit and ceil(record.high_bid / record.aux_quantity) or record.high_bid
|
||||
else
|
||||
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||
price = price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||
end
|
||||
cell.text:SetText(money.to_string(price))
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a
|
||||
if record_a.high_bidder then
|
||||
price_a = aux_price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||
price_a = price_per_unit and record_a.high_bid / record_a.aux_quantity or record_a.high_bid
|
||||
else
|
||||
price_a = aux_price_per_unit and record_a.unit_bid_price or record_a.bid_price
|
||||
price_a = price_per_unit and record_a.unit_bid_price or record_a.bid_price
|
||||
end
|
||||
local price_b
|
||||
if record_b.high_bidder then
|
||||
price_b = aux_price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||
price_b = price_per_unit and record_b.high_bid / record_b.aux_quantity or record_b.high_bid
|
||||
else
|
||||
price_b = aux_price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||
price_b = price_per_unit and record_b.unit_bid_price or record_b.bid_price
|
||||
end
|
||||
return sort_util.compare(price_a, price_b, desc)
|
||||
end,
|
||||
@@ -485,12 +485,12 @@ M.bids_config = {
|
||||
align = 'RIGHT',
|
||||
isPrice = true,
|
||||
fill = function(cell, record)
|
||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
local price = price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||
cell.text:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||
end,
|
||||
cmp = function(record_a, record_b, desc)
|
||||
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
local price_b = aux_price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||
local price_a = price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||
local price_b = price_per_unit and record_b.unit_buyout_price or record_b.buyout_price
|
||||
price_a = price_a > 0 and price_a or (desc and -huge or huge)
|
||||
price_b = price_b > 0 and price_b or (desc and -huge or huge)
|
||||
|
||||
@@ -563,10 +563,10 @@ local methods = {
|
||||
local rt = this.rt
|
||||
|
||||
if button == 'RightButton' and rt.headCells[this.columnIndex].info.isPrice then
|
||||
_G.aux_price_per_unit = not aux_price_per_unit
|
||||
price_per_unit = not price_per_unit
|
||||
for _, cell in rt.headCells do
|
||||
if cell.info.isPrice then
|
||||
cell:SetText(cell.info.title[aux_price_per_unit and 1 or 2])
|
||||
cell:SetText(cell.info.title[price_per_unit and 1 or 2])
|
||||
end
|
||||
end
|
||||
rt:SetSort()
|
||||
@@ -920,7 +920,7 @@ function M.new(parent, rows, config)
|
||||
rt:SetScript('OnShow', function()
|
||||
for _, cell in this.headCells do
|
||||
if cell.info.isPrice then
|
||||
cell:SetText(cell.info.title[aux_price_per_unit and 1 or 2])
|
||||
cell:SetText(cell.info.title[price_per_unit and 1 or 2])
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user