diff --git a/tooltip.lua b/tooltip.lua index b8e855b..08055cf 100644 --- a/tooltip.lua +++ b/tooltip.lua @@ -103,25 +103,26 @@ function private.extend_tooltip(tooltip, hyperlink, quantity) end end + local color = {r=1, g=1, b=0.6 } + + local auctionable = item_info and Aux.info.auctionable(Aux.info.tooltip(function(tt) tt:SetHyperlink(item_info.itemstring) end), item_info.quality) local item_key = (item_id or 0)..':'..(suffix_id or 0) + local value + if auctionable then + value = Aux.history.value(item_key) + else + value = 0 + end + tooltip:AddLine('Value: '..(value and Aux.util.format_money(value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), 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) + if aux_tooltip_daily and value ~= 0 then + local market_value + if auctionable then + market_value = Aux.history.market_value(item_key) + else + market_value = 0 + end + tooltip:AddLine('Today: '..(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), color.r, color.g, color.b) end if tooltip == GameTooltip and game_tooltip_money > 0 then