From 3cdf42452d321f101c69867091da22c5fc9312d5 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Wed, 1 Sep 2010 03:07:16 -0500 Subject: [PATCH] Added an option to show zero scores (now hidden by default) Version 1.4r6 Also, the rest of the tooltip items only show if at least one weight would normally be shown --- Locales/enUS/base.lua | 2 + Upgrade.lua | 11 +++++ WeightsWatcher.lua | 121 +++++++++++++++++++++++++++++-------------------- WeightsWatcher.toc | 2 +- config.xml | 27 +++++++++-- defaults.lua | 3 +- 6 files changed, 112 insertions(+), 54 deletions(-) diff --git a/Locales/enUS/base.lua b/Locales/enUS/base.lua index 9666eea..ebfe4ba 100644 --- a/Locales/enUS/base.lua +++ b/Locales/enUS/base.lua @@ -58,6 +58,8 @@ L["HIDE_HINTS"] = "Hide tooltip hints" L["SHOW_CLASS"] = "Show class names:" L["SHOW_DIFF"] = "Show differences to current gear" L["SHOW_DIFF_TT"] = "Shows the change in score compared to the currently equipped gear" +L["SHOW_ZEROES"] = "Show zero scores" +L["SHOW_ZEROES_TT"] = "Shows scores for weights that are zero (or negative)" -- weights.xml L["WEIGHTS_TITLE"] = "WeightsWatcher Weight Values" diff --git a/Upgrade.lua b/Upgrade.lua index f9d50cf..d7a2e08 100644 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -55,6 +55,15 @@ local function noop_major_up(vars) return vars end +local function UpgradeAccountToShowZeroScores(vars) + if vars.options.tooltip.showZeroScores == nil then + vars.options.tooltip.showZeroScores = false + end + + vars.dataMinorVersion = 25 + return vars +end + local function upgradeAccountToCataclysmGems(vars) if vars.options.gems.qualityLimit == 7 then vars.options.gems.qualityLimit = 10 @@ -1049,6 +1058,7 @@ local upgradeAccountFunctions = { [21] = upgradeAccountToMastery, [22] = upgradeAccountToMeleeCrit, [23] = upgradeAccountToCataclysmGems, + [24] = UpgradeAccountToShowZeroScores, }, } @@ -1090,6 +1100,7 @@ local downgradeAccountFunctions = { [22] = noop_down, [23] = noop_down, [24] = noop_down, + [25] = noop_down, }, } diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua index a3408ca..1ab5fdc 100644 --- a/WeightsWatcher.lua +++ b/WeightsWatcher.lua @@ -479,16 +479,37 @@ function WeightsWatcher.displayItemStats(tooltip, ttname) _, _, _, _, _, itemType, _, stackSize = GetItemInfo(link) if (IsEquippableItem(link) and itemType ~= L["Container"] and itemType ~= L["Quiver"]) or (itemType == L["Gem"] and stackSize == 1) or (itemType == L["Consumable"]) or (itemType == L["Recipe"]) then - bareLink = splitItemLink(link) - local bareItemInfo = ww_bareItemCache[bareLink] + local weightsShown = false + for _, class in ipairs(ww_charVars.activeWeights) do + if ww_vars.weightsList[class] then + for _, weight in pairs(ww_charVars.activeWeights[class]) do + if ww_vars.weightsList[class][weight] then + if ww_vars.options.tooltip.showZeroScores or ww_weightCache[class][weight][link] > 0 then + weightsShown = true + break + end + end + end + end + if weightsShown then + break + end + end local showDebugInfo = ww_keyDetectors[ww_vars.options.tooltip.showDebugInfo]() + if not weightsShown and not showDebugInfo then + return + end + local showWeights = ww_keyDetectors[ww_vars.options.tooltip.showWeights]() local showIdealWeights = ww_keyDetectors[ww_vars.options.tooltip.showIdealWeights]() local showIdealGems = ww_keyDetectors[ww_vars.options.tooltip.showIdealGems]() local showIdealGemStats = ww_keyDetectors[ww_vars.options.tooltip.showIdealGemStats]() local showAlternateGems = ww_keyDetectors[ww_vars.options.tooltip.showAlternateGems]() + bareLink = splitItemLink(link) + local bareItemInfo = ww_bareItemCache[bareLink] + if ttname ~= "ShoppingTooltip1" and ttname ~= "ShoppingTooltip2" and ww_vars.options.tooltip.showDifferences then local currentSlot, compareSlot, compareSlot2, currentSubslot, compareSubslot, compareSubslot2 currentSlot = bareItemInfo.nonStats["slot"] @@ -638,59 +659,61 @@ function WeightsWatcher.displayItemStats(tooltip, ttname) for _, weight in pairs(ww_charVars.activeWeights[class]) do if ww_vars.weightsList[class][weight] then local currentScore = ww_weightCache[class][weight][link] - local compareScore, compareScore2, compareBareScore, compareBareScore2 - str = weight - if ww_vars.options.tooltip.showClassNames == "Always" or (ww_vars.options.tooltip.showClassNames == "Others" and class ~= WeightsWatcher.playerClass) then - str = string.format(L["WEIGHT_CLASS_FORMAT"], str, ww_classDisplayNames[class]) - end - if compareLink then - compareScore = ww_weightCache[class][weight][compareLink] - if showIdealWeights and #(bareItemInfo.sockets) == 0 then - compareBareScore = ww_weightIdealCache[class][weight][compareBareLink].score - if compareScore < compareBareScore then - compareScore = compareBareScore - end + if ww_vars.options.tooltip.showZeroScores or currentScore > 0 then + local compareScore, compareScore2, compareBareScore, compareBareScore2 + str = weight + if ww_vars.options.tooltip.showClassNames == "Always" or (ww_vars.options.tooltip.showClassNames == "Others" and class ~= WeightsWatcher.playerClass) then + str = string.format(L["WEIGHT_CLASS_FORMAT"], str, ww_classDisplayNames[class]) end - end - if compareLink2 then - compareScore2 = ww_weightCache[class][weight][compareLink2] - if showIdealWeights and #(bareItemInfo.sockets) == 0 then - compareBareScore2 = ww_weightIdealCache[class][weight][compareBareLink2].score - if compareScore2 < compareBareScore2 then - compareScore2 = compareBareScore2 + if compareLink then + compareScore = ww_weightCache[class][weight][compareLink] + if showIdealWeights and #(bareItemInfo.sockets) == 0 then + compareBareScore = ww_weightIdealCache[class][weight][compareBareLink].score + if compareScore < compareBareScore then + compareScore = compareBareScore + end end end - end - compareScore = computeDifference(compareMethod, compareScore, compareScore2, currentScore) - tooltip:AddDoubleLine(str, string.format(colorizeDifferences(compareScore), currentScore, compareScore)) - if #(bareItemInfo.sockets) > 0 and showIdealWeights then - local currentScore = ww_weightIdealCache[class][weight][bareLink].score - local compareScore, compareScore2 - if compareBareLink then - compareScore = ww_weightIdealCache[class][weight][compareBareLink].score - end - if compareBareLink2 then - compareScore2 = ww_weightIdealCache[class][weight][compareBareLink2].score + if compareLink2 then + compareScore2 = ww_weightCache[class][weight][compareLink2] + if showIdealWeights and #(bareItemInfo.sockets) == 0 then + compareBareScore2 = ww_weightIdealCache[class][weight][compareBareLink2].score + if compareScore2 < compareBareScore2 then + compareScore2 = compareBareScore2 + end + end end compareScore = computeDifference(compareMethod, compareScore, compareScore2, currentScore) - tooltip:AddDoubleLine(L[" Ideally-gemmed:"], string.format(colorizeDifferences(compareScore), currentScore, compareScore)) - if showIdealGems then - gemStats = ww_weightIdealCache[class][weight][bareLink].gemStats - for _, gems in ipairs(gemStats) do - for i, gem in ipairs(gems) do - if #(gems) > 1 then - tooltip:AddDoubleLine(string.format(L["MULTIPLE_GEM_FORMAT"], i, #(gems), ww_gemDisplayNames[gem[2]], ww_gemColorDisplayNames[gem[1]]), " ") - alternateGemsExist = true - else - tooltip:AddDoubleLine(string.format(L["SINGLE_GEM_FORMAT"], ww_gemDisplayNames[gem[2]], ww_gemColorDisplayNames[gem[1]]), " ") - end - if showIdealGemStats then - for stat, value in pairs(gem[3]) do - tooltip:AddDoubleLine(string.format(L["TREBLY_INDENTED_STRING_FORMAT"], ww_statDisplayNames[stat]), value) + tooltip:AddDoubleLine(str, string.format(colorizeDifferences(compareScore), currentScore, compareScore)) + if #(bareItemInfo.sockets) > 0 and showIdealWeights then + local currentScore = ww_weightIdealCache[class][weight][bareLink].score + local compareScore, compareScore2 + if compareBareLink then + compareScore = ww_weightIdealCache[class][weight][compareBareLink].score + end + if compareBareLink2 then + compareScore2 = ww_weightIdealCache[class][weight][compareBareLink2].score + end + compareScore = computeDifference(compareMethod, compareScore, compareScore2, currentScore) + tooltip:AddDoubleLine(L[" Ideally-gemmed:"], string.format(colorizeDifferences(compareScore), currentScore, compareScore)) + if showIdealGems then + gemStats = ww_weightIdealCache[class][weight][bareLink].gemStats + for _, gems in ipairs(gemStats) do + for i, gem in ipairs(gems) do + if #(gems) > 1 then + tooltip:AddDoubleLine(string.format(L["MULTIPLE_GEM_FORMAT"], i, #(gems), ww_gemDisplayNames[gem[2]], ww_gemColorDisplayNames[gem[1]]), " ") + alternateGemsExist = true + else + tooltip:AddDoubleLine(string.format(L["SINGLE_GEM_FORMAT"], ww_gemDisplayNames[gem[2]], ww_gemColorDisplayNames[gem[1]]), " ") + end + if showIdealGemStats then + for stat, value in pairs(gem[3]) do + tooltip:AddDoubleLine(string.format(L["TREBLY_INDENTED_STRING_FORMAT"], ww_statDisplayNames[stat]), value) + end + end + if not showAlternateGems then + break end - end - if not showAlternateGems then - break end end end diff --git a/WeightsWatcher.toc b/WeightsWatcher.toc index 7a8794b..ab55aec 100644 --- a/WeightsWatcher.toc +++ b/WeightsWatcher.toc @@ -2,7 +2,7 @@ ## Title: Weights Watcher ## Notes: Ranks gear according to customizable stat weights ## Author: The Flying Squirrels -## Version: 1.4r5 +## Version: 1.4r6 ## OptionalDeps: AtlasLoot ## SavedVariables: ww_vars ## SavedVariablesPerCharacter: ww_charVars diff --git a/config.xml b/config.xml index 7db1080..a2fe9b6 100644 --- a/config.xml +++ b/config.xml @@ -118,10 +118,12 @@ - + - + + + @@ -668,13 +670,32 @@ - + if self:GetChecked() then + ww_vars.options.tooltip.showZeroScores = true + else + ww_vars.options.tooltip.showZeroScores = false + end + + + self.shouldBeChecked = function() return ww_vars.options.tooltip.showZeroScores end + self.ttText = ww_localization["SHOW_ZEROES_TT"] + self:SetText(ww_localization["SHOW_ZEROES"]) + + + + + + + + + + if self:GetChecked() then ww_vars.options.tooltip.showDifferences = true else ww_vars.options.tooltip.showDifferences = false diff --git a/defaults.lua b/defaults.lua index 47a605c..cfc5a33 100644 --- a/defaults.lua +++ b/defaults.lua @@ -192,7 +192,7 @@ ww_classNameOptions = { ww_defaultVars = { dataMajorVersion = 1, - dataMinorVersion = 24, + dataMinorVersion = 25, weightsList = { "DEATHKNIGHT", "DRUID", @@ -741,6 +741,7 @@ ww_defaultVars = { showIdealGemStats = "Always", showIdealWeights = "Shift", showWeights = "Always", + showZeroScores = false, }, useEffects = { uptimeRatio = 0.8, -- 1.7.9.5