added market value tooltip option

This commit is contained in:
Manuel Simon Hirsig
2016-02-27 09:34:06 +01:00
parent ddd4baa002
commit 354c2a6c67
5 changed files with 33 additions and 16 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
## Interface: 11200
## Title: Aux
## SavedVariablesPerCharacter: aux_recent_searches, aux_favorite_searches, aux_price_per_unit, aux_scale
## SavedVariablesPerCharacter: aux_recent_searches, aux_favorite_searches, aux_price_per_unit, aux_scale, aux_tooltip_market
## SavedVariables: aux_database, aux_auctionable_items
slash.lua
+1 -1
View File
@@ -630,7 +630,7 @@ function public.CreateAuctionResultsTable(parent)
{name='Seller', width=0.13, align='CENTER'},
{name={'Auction Bid\n(per item)', 'Auction Bid\n(per stack)'}, width=0.125, align='RIGHT', isPrice=true},
{name={'Auction Buyout\n(per item)', 'Auction Buyout\n(per stack)'}, width=0.125, align='RIGHT', isPrice=true},
{name='% Market Value', width=0.08, align='CENTER'},
{name='% Hist. Value', width=0.08, align='CENTER'},
}
local rtName = 'AuxAuctionResultsTable'..RT_COUNT
+23 -14
View File
@@ -13,27 +13,36 @@ function Aux.on_load()
if EnhTooltip.LinkType(link) ~= 'item' then return end
local item_id, suffix_id = EnhTooltip.BreakLink(link)
if not Aux.static.item_info(item_id) then
return
end
local item_key = (item_id or 0)..':'..(suffix_id or 0)
if aux_tooltip_market then
local market_value = Aux.history.market_value(item_key)
local market_value_line = 'Mkt. Value: '
market_value_line = market_value_line..(market_value and EnhTooltip.GetTextGSC(market_value) or '---')
EnhTooltip.AddLine(market_value_line, nil, true)
EnhTooltip.LineColor(0.1, 0.8, 0.5)
end
local value = Aux.history.value(item_key)
if value then
local value_line = 'Value: '
local value_line = aux_tooltip_market and 'Hist. Value: ' or 'Value: '
if count == 1 then
value_line = value_line..EnhTooltip.GetTextGSC(value)
else
value_line = value_line..EnhTooltip.GetTextGSC(value * count)..' / '..EnhTooltip.GetTextGSC(value)
end
value_line = value_line..(value and EnhTooltip.GetTextGSC(value) or '---')
local _, _, _, market_values = Aux.history.price_data(item_key)
if getn(market_values) < 5 then
value_line = value_line..' (?)'
end
EnhTooltip.AddLine(value_line, nil, true)
EnhTooltip.LineColor(0.1,0.8,0.5)
local _, _, _, market_values = Aux.history.price_data(item_key)
if value and getn(market_values) < 5 then
value_line = value_line..' (?)'
end
EnhTooltip.AddLine(value_line, nil, true)
EnhTooltip.LineColor(0.1, 0.8, 0.5)
end)
end
+5
View File
@@ -91,6 +91,11 @@ function public.value(item_key)
end
end
function public.market_value(item_key)
local item_record = private.read_record(item_key)
return private.market_value(item_record)
end
function private.market_value(item_record)
local estimate
+3
View File
@@ -11,5 +11,8 @@ function SlashCmdList.AUX(parameter)
elseif parameter == 'delete item cache' then
aux_auctionable_items = nil
Aux.log('Item cache deleted; falling back to the default.')
elseif parameter == 'tooltip market' then
aux_tooltip_market = not aux_tooltip_market
Aux.log('Market value in tooltip '..(aux_tooltip_market and 'enabled' or 'disabled')..'.')
end
end