From 1f465848d5fefb79dc1257073cd35a31a7813899 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Sun, 12 Jun 2016 21:55:19 +0200 Subject: [PATCH] can now toggle tooltip historical value with /aux tooltip value --- Aux-AddOn.toc | 2 +- core.lua | 2 +- slash.lua | 3 +++ tooltip.lua | 6 +++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Aux-AddOn.toc b/Aux-AddOn.toc index 952765b..bd5a253 100644 --- a/Aux-AddOn.toc +++ b/Aux-AddOn.toc @@ -1,6 +1,6 @@ ## Interface: 11200 ## Title: Aux -## SavedVariablesPerCharacter: aux_ignore_owner, aux_recent_searches, aux_favorite_searches, aux_price_per_unit, aux_tooltip_daily, aux_tooltip_vendor_buy, aux_tooltip_vendor_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source +## SavedVariablesPerCharacter: aux_ignore_owner, aux_recent_searches, aux_favorite_searches, aux_price_per_unit, 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 slash.lua diff --git a/core.lua b/core.lua index cc2dacd..d2bb291 100644 --- a/core.lua +++ b/core.lua @@ -1,5 +1,5 @@ Aux = { - version = '2.14.0', + version = '2.14.1', blizzard_ui_shown = false, orig = {}, } diff --git a/slash.lua b/slash.lua index c08638e..fbe65ce 100644 --- a/slash.lua +++ b/slash.lua @@ -24,6 +24,9 @@ function SlashCmdList.AUX(command) Aux.log('Item cache cleared.') elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then Aux.cache.populate_wdb() + elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then + aux_tooltip_value = not aux_tooltip_value + Aux.log('Historical value in tooltip '..(aux_tooltip_value and 'enabled' or 'disabled')..'.') elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then aux_tooltip_daily = not aux_tooltip_daily Aux.log('Market value in tooltip '..(aux_tooltip_daily and 'enabled' or 'disabled')..'.') diff --git a/tooltip.lua b/tooltip.lua index 38bca2d..0e02c2b 100644 --- a/tooltip.lua +++ b/tooltip.lua @@ -1,6 +1,8 @@ local private, public = {}, {} Aux.tooltip = public +aux_tooltip_value = true + local game_tooltip_hooks = {} local hooked_setter local game_tooltip_money @@ -111,7 +113,9 @@ function private.extend_tooltip(tooltip, hyperlink, quantity) local value = Aux.history.value(item_key) if auctionable then - tooltip:AddLine('Value: '..(value and Aux.util.format_money(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b) + if aux_tooltip_value then + tooltip:AddLine('Value: '..(value and Aux.util.format_money(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b) + end if aux_tooltip_daily then local market_value = Aux.history.market_value(item_key) tooltip:AddLine('Today: '..(market_value and Aux.util.format_money(market_value * quantity)..' ('..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)