diff --git a/Aux-AddOn.toc b/Aux-AddOn.toc index 5c0a189..9a32b79 100644 --- a/Aux-AddOn.toc +++ b/Aux-AddOn.toc @@ -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 diff --git a/auction_listing.lua b/auction_listing.lua index 34ff5fe..fe7b448 100644 --- a/auction_listing.lua +++ b/auction_listing.lua @@ -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 diff --git a/core.lua b/core.lua index 8d74a5d..5b2c450 100644 --- a/core.lua +++ b/core.lua @@ -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 diff --git a/history.lua b/history.lua index bbd4194..03b517c 100644 --- a/history.lua +++ b/history.lua @@ -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 diff --git a/slash.lua b/slash.lua index a06e669..a8653eb 100644 --- a/slash.lua +++ b/slash.lua @@ -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 \ No newline at end of file