some refactoring and added disenchant information
This commit is contained in:
+2
-1
@@ -1,13 +1,14 @@
|
||||
## Interface: 11200
|
||||
## Title: Aux
|
||||
## SavedVariablesPerCharacter: aux_recent_searches, aux_favorite_searches
|
||||
## SavedVariables: aux_datasets, aux_auctionable_items, aux_auctionable_item_ids, aux_post_mode, aux_price_per_unit, aux_tooltip_daily
|
||||
## SavedVariables: aux_datasets, aux_auctionable_items, aux_auctionable_item_ids, aux_post_mode, aux_price_per_unit, aux_tooltip_daily, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
|
||||
|
||||
slash.lua
|
||||
core.xml
|
||||
gui.lua
|
||||
control.xml
|
||||
persistence.lua
|
||||
disenchant.lua
|
||||
tooltip.lua
|
||||
util.lua
|
||||
sort.lua
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ function private.update_listing()
|
||||
local historical_value = Aux.history.value(auction_record.item_key)
|
||||
tinsert(auction_rows, {
|
||||
cols = {
|
||||
{ value='|c'..Aux.quality_color(auction_record.quality)..'['..auction_record.name..']'..'|r' },
|
||||
{ value=({GetItemQualityColor(auction_record.quality)})[4]..'['..auction_record.name..']'..'|r' },
|
||||
{ value=auction_record.aux_quantity },
|
||||
{ value=Aux.auction_listing.time_left(auction_record.duration) },
|
||||
{ value=auction_record.high_bid > 0 and Aux.money.to_string(auction_record.high_bid, true, false) or RED_FONT_COLOR_CODE..'No Bids'..FONT_COLOR_CODE_CLOSE },
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ function private.update_listing()
|
||||
local historical_value = Aux.history.value(auction_record.item_key)
|
||||
tinsert(auction_rows, {
|
||||
cols = {
|
||||
{ value='|c'..Aux.quality_color(auction_record.quality)..'['..auction_record.name..']'..'|r' },
|
||||
{ value=({GetItemQualityColor(auction_record.quality)})[4]..'['..auction_record.name..']'..'|r' },
|
||||
{ value=auction_record.aux_quantity },
|
||||
{ value=status },
|
||||
{ value=Aux.auction_listing.time_left(auction_record.duration) },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Aux = {
|
||||
version = '2.7.8',
|
||||
version = '2.8.0',
|
||||
blizzard_ui_shown = false,
|
||||
orig = {},
|
||||
}
|
||||
@@ -328,24 +328,6 @@ function Aux.UseContainerItem(...)
|
||||
return Aux.orig.UseContainerItem(unpack(arg))
|
||||
end
|
||||
|
||||
function Aux.quality_color(code)
|
||||
if code == 0 then
|
||||
return 'ff9d9d9d' -- poor, gray
|
||||
elseif code == 1 then
|
||||
return 'ffffffff' -- common, white
|
||||
elseif code == 2 then
|
||||
return 'ff1eff00' -- uncommon, green
|
||||
elseif code == 3 then -- rare, blue
|
||||
return 'ff0070dd'
|
||||
elseif code == 4 then
|
||||
return 'ffa335ee' -- epic, purple
|
||||
elseif code == 5 then
|
||||
return 'ffff8000' -- legendary, orange
|
||||
elseif code == 6 then
|
||||
return 'ffe6cc80' -- artifact, pale gold
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.item_class_index(item_class)
|
||||
for i, class in ipairs({ GetAuctionItemClasses() }) do
|
||||
if strupper(class) == strupper(item_class) then
|
||||
|
||||
+29
-1
@@ -246,6 +246,34 @@ m.filters = {
|
||||
end
|
||||
},
|
||||
|
||||
['bid-disenchant-profit'] = {
|
||||
arity = 1,
|
||||
test = function(amount)
|
||||
amount = Aux.money.from_string(amount or '') or 0
|
||||
if amount > 0 then
|
||||
return function(auction_record)
|
||||
return Aux.disenchant.value(auction_record.item_key) and Aux.disenchant.value(auction_record.item_key) - auction_record.bid_price >= amount
|
||||
end
|
||||
else
|
||||
return false, {}, 'Erroneous Bid Disenchant Profit Modifier'
|
||||
end
|
||||
end
|
||||
},
|
||||
|
||||
['buyout-disenchant-profit'] = {
|
||||
arity = 1,
|
||||
test = function(amount)
|
||||
amount = Aux.money.from_string(amount or '') or 0
|
||||
if amount > 0 then
|
||||
return function(auction_record)
|
||||
return Aux.disenchant.value(auction_record.item_key) and Aux.disenchant.value(auction_record.item_key) - auction_record.buyout_price >= amount
|
||||
end
|
||||
else
|
||||
return false, {}, 'Erroneous Buyout Disenchant Profit Modifier'
|
||||
end
|
||||
end
|
||||
},
|
||||
|
||||
['discard'] = {
|
||||
arity = 0,
|
||||
test = function()
|
||||
@@ -311,7 +339,7 @@ end
|
||||
|
||||
function m.display_name(item_id)
|
||||
local item_info = Aux.static.item_info(item_id)
|
||||
return '|c'..Aux.quality_color(item_info.quality)..'['..item_info.name..']'..'|r'
|
||||
return ({GetItemQualityColor(item_info.quality)})[4]..'['..item_info.name..']'..'|r'
|
||||
end
|
||||
|
||||
function m.filter_builder()
|
||||
|
||||
@@ -18,5 +18,14 @@ function SlashCmdList.AUX(parameter)
|
||||
elseif parameter == 'tooltip daily' then
|
||||
aux_tooltip_daily = not aux_tooltip_daily
|
||||
Aux.log('Market value in tooltip '..(aux_tooltip_daily and 'enabled' or 'disabled')..'.')
|
||||
elseif parameter == 'tooltip disenchant value' then
|
||||
aux_tooltip_disenchant_value = not aux_tooltip_disenchant_value
|
||||
Aux.log('Disenchant value in tooltip '..(aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.')
|
||||
elseif parameter == 'tooltip disenchant distribution' then
|
||||
aux_tooltip_disenchant_distribution = not aux_tooltip_disenchant_distribution
|
||||
Aux.log('Disenchant distribution in tooltip '..(aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.')
|
||||
elseif parameter == 'tooltip disenchant source' then
|
||||
aux_tooltip_disenchant_source = not aux_tooltip_disenchant_source
|
||||
Aux.log('Disenchant source in tooltip '..(aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.')
|
||||
end
|
||||
end
|
||||
+54
-13
@@ -32,29 +32,70 @@ end
|
||||
function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
local item_id, suffix_id = Aux.info.parse_hyperlink(hyperlink)
|
||||
|
||||
if not Aux.static.item_info(item_id) then
|
||||
return
|
||||
if aux_tooltip_disenchant_source then
|
||||
local color = {r=0.7, g=0.7, b=0.7 }
|
||||
|
||||
local type, range = Aux.disenchant.source(item_id)
|
||||
|
||||
if type == 'CRYSTAL' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cffa335eeEpic|r and |cff0070ddRare|r items.', range), color.r, color.g, color.b, true)
|
||||
elseif type == 'SHARD' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff0070ddRare|r and |cff1eff00Uncommon|r items.', range), color.r, color.g, color.b, true)
|
||||
elseif type == 'ESSENCE' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff1eff00Uncommon|r items.', range), color.r, color.g, color.b, true)
|
||||
elseif type == 'DUST' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff1eff00Uncommon|r items.', range), color.r, color.g, color.b, true)
|
||||
end
|
||||
end
|
||||
|
||||
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
||||
local item_info = Aux.info.item(item_id)
|
||||
|
||||
local value = Aux.history.value(item_key)
|
||||
if item_info then
|
||||
local distribution = Aux.disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
|
||||
|
||||
local value_line = 'Value: '
|
||||
if getn(distribution) > 0 then
|
||||
|
||||
value_line = value_line..(value and Aux.util.format_money(value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||
if aux_tooltip_disenchant_distribution then
|
||||
local color = {r=0.8, g=0.8, b=0.2 }
|
||||
|
||||
local color = {r=1.0, g=1.0, b=0.6}
|
||||
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
|
||||
local reagent_info = Aux.static.item_info(event.item_id)
|
||||
tooltip:AddLine(format(' %s%% %s x%s', event.probability * 100, ({GetItemQualityColor(reagent_info.quality)})[4]..reagent_info.name..'|r', event.quantity), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
tooltip:AddLine(value_line, color.r, color.g, color.b)
|
||||
if aux_tooltip_disenchant_value then
|
||||
local color = {r=0.1, g=0.6, b=0.6 }
|
||||
|
||||
if aux_tooltip_daily then
|
||||
local market_value = Aux.history.market_value(item_key)
|
||||
local disenchant_value = Aux.disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and Aux.util.format_money(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local market_value_line = 'Today: '
|
||||
market_value_line = market_value_line..(market_value and Aux.util.format_money(market_value)..' ('..Aux.auction_listing.percentage_historical(Aux.round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||
if Aux.static.item_info(item_id) then
|
||||
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
||||
|
||||
tooltip:AddLine(market_value_line, color.r, color.g, color.b)
|
||||
local value = Aux.history.value(item_key)
|
||||
|
||||
local value_line = 'Value: '
|
||||
|
||||
value_line = value_line..(value and Aux.util.format_money(value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||
|
||||
local color = {r=1, g=1, b=0.6}
|
||||
|
||||
tooltip:AddLine(value_line, color.r, color.g, color.b)
|
||||
|
||||
if aux_tooltip_daily then
|
||||
local market_value = Aux.history.market_value(item_key)
|
||||
|
||||
local market_value_line = 'Today: '
|
||||
market_value_line = market_value_line..(market_value and Aux.util.format_money(market_value)..' ('..Aux.auction_listing.percentage_historical(Aux.round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||
|
||||
tooltip:AddLine(market_value_line, color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
tooltip:Show()
|
||||
|
||||
Reference in New Issue
Block a user