From 78da30b629cb907ed742b7d6564edbfc4b4a67e4 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Fri, 20 Nov 2009 16:46:36 -0600 Subject: [PATCH] Added backend option to show/not show class names in the tooltip --- Upgrade.lua | 11 +++++++++++ WeightsWatcher.lua | 15 ++++++++++++--- defaults.lua | 3 ++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Upgrade.lua b/Upgrade.lua index d916485..135ab18 100644 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -124,6 +124,15 @@ noop_down = [[ end ]] +function upgradeAccountShowClassNames(vars) + if not vars.options.tooltip.showClassNames then + vars.options.tooltip.showClassNames = "Others" + end + + vars.dataMinorVersion = 7 + return vars +end + function upgradeAccountToHandleModifierKeys(vars) if not vars.options.tooltip then vars.options.tooltip = deepTableCopy(defaultVars.options.tooltip) @@ -275,6 +284,7 @@ upgradeAccountFunctions = { [3] = function(vars) return upgradeAccountToOrderedLists(vars) end, [4] = function(vars) return upgradeAccountToHandleModifierKeys(vars) end, [5] = function(vars) return noop_up(vars) end, + [6] = function(vars) return upgradeAccountShowClassNames(vars) end, }, } @@ -285,6 +295,7 @@ downgradeAccountFunctions = { [4] = downgradeAccountFromOrderedLists, [5] = noop_down, [6] = noop_down, + [7] = noop_down, }, } diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua index ef9e280..5579890 100644 --- a/WeightsWatcher.lua +++ b/WeightsWatcher.lua @@ -192,7 +192,8 @@ end function WeightsWatcher:displayItemStats(tooltip, ttname) local link, bareLink, itemType, stackSize, sockets, gemStats - local stat, value + local stat, value, string + local _, playerClass = UnitClass("player") _, link = tooltip:GetItem() if link == nil then @@ -209,7 +210,11 @@ function WeightsWatcher:displayItemStats(tooltip, ttname) if ww_vars.weightsList[class] then for _, weight in pairs(ww_charVars.activeWeights[class]) do if ww_vars.weightsList[class][weight] then - tooltip:AddDoubleLine(" " .. weight .. " - " .. classNames[class], string.format("%.3f", ww_weightCache[class][weight][link])) + string = " " .. weight + if ww_vars.options.tooltip.showClassNames == "Always" or (ww_vars.options.tooltip.showClassNames == "Others" and class ~= playerClass) then + string = string .. " - " .. classNames[class] + end + tooltip:AddDoubleLine(string, string.format("%.3f", ww_weightCache[class][weight][link])) end end end @@ -224,7 +229,11 @@ function WeightsWatcher:displayItemStats(tooltip, ttname) if ww_vars.weightsList[class] then for _, weight in pairs(ww_charVars.activeWeights[class]) do if ww_vars.weightsList[class][weight] then - tooltip:AddDoubleLine(" " .. weight .. " - " .. classNames[class], string.format("%.3f", ww_weightIdealCache[class][weight][bareLink].score)) + string = " " .. weight + if ww_vars.options.tooltip.showClassNames == "Always" or (ww_vars.options.tooltip.showClassNames == "Others" and class ~= playerClass) then + string = string .. " - " .. classNames[class] + end + tooltip:AddDoubleLine(string, string.format("%.3f", ww_weightIdealCache[class][weight][bareLink].score)) if keyDetectors[ww_vars.options.tooltip.showIdealGems]() then gemStats = ww_weightIdealCache[class][weight][bareLink].gemStats for _, gem in ipairs(gemStats) do diff --git a/defaults.lua b/defaults.lua index f47cda5..dd8906e 100644 --- a/defaults.lua +++ b/defaults.lua @@ -102,7 +102,7 @@ keyDetectors = { defaultVars = { dataMajorVersion = 0, - dataMinorVersion = 6, + dataMinorVersion = 7, weightsList = { [1] = "DEATHKNIGHT", [2] = "DRUID", @@ -497,6 +497,7 @@ defaultVars = { options = { normalizeWeights = true, gemQualityLimit = 9, + showClassNames = "Others", tooltip = { showWeights = true, showIdealWeights = "SHIFT", -- 1.7.9.5