diff --git a/Upgrade.lua b/Upgrade.lua index f8b01ac..c6360d8 100644 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -135,6 +135,44 @@ function noop_major_up(vars) return vars end +function upgradeAccountToFixedConfigOptions(vars) + if vars.options.breakSocketColors ~= nil then + vars.options.gems.breakSocketColors = vars.options.breakSocketColors + vars.options.breakSocketColors = nil + else + vars.options.gems.breakSocketColors = true + end + if vars.options.neverBreakSocketColors ~= nil then + vars.options.gems.neverBreakSocketColors = vars.options.neverBreakSocketColors + vars.options.neverBreakSocketColors = nil + else + vars.options.gems.neverBreakSocketColors = false + end + if vars.options.normalizeWeights ~= nil then + vars.options.tooltip.normalizeWeights = vars.options.normalizeWeights + vars.options.normalizeWeights = nil + else + vars.options.tooltip.normalizeWeights = true + end + + vars.dataMinorVersion = 5 + return vars +end + +downgradeAccountFromFixedConfigOptions = [[ + return function(vars) + if vars.options.tooltip.normalizeWeights ~= nil then + vars.options.normalizeWeights = vars.options.tooltip.normalizeWeights + vars.options.tooltip.normalizeWeights = nil + else + vars.options.normalizeWeights = true + end + + vars.dataMinorVersion = 4 + return vars + end +]] + function upgradeAccountToPartitionedGems(vars) qualityConversion = { [1] = 1, @@ -596,6 +634,7 @@ upgradeAccountFunctions = { [1] = function(vars) return upgradeAccountToCorrectShowClassNames(vars) end, [2] = function(vars) return upgradeAccountToShowDifferences(vars) end, [3] = function(vars) return upgradeAccountToPartitionedGems(vars) end, + [4] = function(vars) return upgradeAccountToFixedConfigOptions(vars) end, }, } @@ -617,6 +656,7 @@ downgradeAccountFunctions = { [2] = noop_down, [3] = noop_down, [4] = downgradeAccountFromPartitionedGems, + [5] = downgradeAccountFromFixedConfigOptions, }, } diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua index 2b9409e..793f3a5 100644 --- a/WeightsWatcher.lua +++ b/WeightsWatcher.lua @@ -116,6 +116,13 @@ ww_weightIdealCacheWeightMetatable = { end local gemId, gemIdIgnoreSocket, weightVal, weightValIgnoreSockets, bestGems, bestGemsIgnoreSocket local normalStats, sockets, socketBonusStat = unpack(ww_bareItemCache[key]) + local socketBonusWeight = 0 + if socketBonusStat then + for stat, value in pairs(socketBonusStat) do + socketBonusWeight = socketBonusWeight + (tbl.weight[string.lower(stat)] or 0) * value + end + end + local breakSocketColors = ww_vars.options.gems.breakSocketColors or (not ww_vars.options.gems.neverBreakSocketColors and socketBonusWeight <= 0) bestGems = {} bestGemsIgnoreSocket = {} @@ -640,7 +647,7 @@ function WeightsWatcher:calculateWeight(normalStats, socketBonusActive, socketBo weight = weight + WeightsWatcher:getWeight(stat, value, weightsScale) end end - if ww_vars.options.normalizeWeights == true then + if ww_vars.options.tooltip.normalizeWeights == true then local total = 0 for _, value in pairs(weightsScale) do diff --git a/config.xml b/config.xml index ddf8551..546af3c 100644 --- a/config.xml +++ b/config.xml @@ -253,16 +253,16 @@ <Scripts> <OnClick> if self:GetChecked() then - ww_vars.options.breakSocketColors = false + ww_vars.options.gems.breakSocketColors = false self:GetParent().alwaysObeySocketColors:Enable() else - ww_vars.options.breakSocketColors = true + ww_vars.options.gems.breakSocketColors = true self:GetParent().alwaysObeySocketColors:Disable() end ww_weightIdealCache = setmetatable({}, ww_weightIdealCacheMetatable) </OnClick> <OnLoad> - self.shouldBeChecked = function() return not ww_vars.options.breakSocketColors end + self.shouldBeChecked = function() return not ww_vars.options.gems.breakSocketColors end self.ttText = "Chooses ideal gems that obey their socket color (even if that gives a lower overall score)" </OnLoad> </Scripts> @@ -278,15 +278,15 @@ <Scripts> <OnClick> if self:GetChecked() then - ww_vars.options.neverBreakSocketColors = true + ww_vars.options.gems.neverBreakSocketColors = true else - ww_vars.options.neverBreakSocketColors = false + ww_vars.options.gems.neverBreakSocketColors = false end ww_weightIdealCache = setmetatable({}, ww_weightIdealCacheMetatable) </OnClick> <OnLoad> - self.shouldBeChecked = function() return ww_vars.options.neverBreakSocketColors end - self.shouldBeEnabled = function() return not ww_vars.options.breakSocketColors end + self.shouldBeChecked = function() return ww_vars.options.gems.neverBreakSocketColors end + self.shouldBeEnabled = function() return not ww_vars.options.gems.breakSocketColors end self.ttText = "Forces ideal gems to obey their socket color (even if the socket bonus has a 0 or negative score for that weight)" </OnLoad> </Scripts> @@ -298,15 +298,15 @@ <Scripts> <OnClick> if self:GetChecked() then - ww_vars.options.normalizeWeights = true + ww_vars.options.tooltip.normalizeWeights = true else - ww_vars.options.normalizeWeights = false + ww_vars.options.tooltip.normalizeWeights = false end ww_weightCache = setmetatable({}, ww_weightCacheMetatable) ww_weightIdealCache = setmetatable({}, ww_weightIdealCacheMetatable) </OnClick> <OnLoad> - self.shouldBeChecked = function() return ww_vars.options.normalizeWeights end + self.shouldBeChecked = function() return ww_vars.options.tooltip.normalizeWeights end self.ttText = "Divides item scores by the total of all stats' values in that weight" </OnLoad> </Scripts> diff --git a/defaults.lua b/defaults.lua index 852660a..ad6ee58 100644 --- a/defaults.lua +++ b/defaults.lua @@ -133,7 +133,7 @@ classNameOptions = { defaultVars = { dataMajorVersion = 1, - dataMinorVersion = 4, + dataMinorVersion = 5, weightsList = { [1] = "DEATHKNIGHT", [2] = "DRUID", @@ -537,9 +537,9 @@ defaultVars = { ["Procced"] = true, } }, - normalizeWeights = true, tooltip = { hideHints = false, + normalizeWeights = true, showWeights = "Always", showIdealWeights = "Shift", showIdealGems = "Control",