diff --git a/Upgrade.lua b/Upgrade.lua
index 38a2255..6474de4 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -120,6 +120,15 @@ noop_down = [[
]]
+function upgradeAccountToGemQuality(vars)
+ if not vars.options.gemQualityLimit then
+ vars.options.gemQualityLimit = 9
+ end
+
+ vars.dataMinorVersion = 3
+ return vars
+end
+
function upgradeAccountToNormalization(vars)
if not vars.options then
vars.options = {}
@@ -160,12 +169,14 @@ upgradeAccountFunctions = {
[0] = {
[0] = function(vars) return copyDefaultAccountVars() end,
[1] = function(vars) return upgradeAccountToNormalization(vars) end,
+ [2] = function(vars) return upgradeAccountToGemQuality(vars) end,
},
}
downgradeAccountFunctions = {
[0] = {
[2] = noop_down,
+ [3] = noop_down,
},
}
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index 405c617..db2ff90 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -133,12 +133,16 @@ function WeightsWatcher:displayItemStats(tooltip, ttname)
bestGemsIgnoreSocket = {}
socketBonusActive = true
for _, stat in pairs(sockets) do
- local gemId, _, gemIdIgnoreSocket = WeightsWatcher:bestGemsForSocket(stat, socketBonusStat, ww_vars.weightsList[class][weight])
- if not WeightsWatcher:matchesSocket(GemIds[gemIdIgnoreSocket][1], stat) then
- socketBonusActive = false
+ local gemId, _, gemIdIgnoreSocket = WeightsWatcher:bestGemsForSocket(stat, socketBonusStat, ww_vars.weightsList[class][weight], ww_vars.options.gemQualityLimit)
+ if gemIdIgnoreSocket ~= 0 then
+ if not WeightsWatcher:matchesSocket(GemIds[gemIdIgnoreSocket][1], stat) then
+ socketBonusActive = false
+ end
+ if gemId ~= 0 then
+ table.insert(bestGems, gemId)
+ end
+ table.insert(bestGemsIgnoreSocket, gemIdIgnoreSocket)
end
- table.insert(bestGems, gemId)
- table.insert(bestGemsIgnoreSocket, gemIdIgnoreSocket)
end
gemStats = WeightsWatcher:getGemStats(bestGems)
gemStatsIgnoreSockets = WeightsWatcher:getGemStats(bestGemsIgnoreSocket)
@@ -168,23 +172,25 @@ function WeightsWatcher:displayItemStats(tooltip, ttname)
end
end
-function WeightsWatcher:bestGemsForSocket(socketColor, socketBonusStat, weightScale)
+function WeightsWatcher:bestGemsForSocket(socketColor, socketBonusStat, weightScale, qualityLimit)
local bestGem, bestWeight, bestGemIgnoreSocket, bestWeightIgnoreSocket, gemId, gemStats, socketBonusActive, weight = 0, 0, 0, 0
for gemId, gemStats in pairs(GemIds) do
- socketBonusActive = WeightsWatcher:matchesSocket(gemStats[1], socketColor)
- -- Meta sockets don't ever hold anything but meta gems
- if socketBonusActive or (gemStats[1] ~= "Meta" and socketColor ~= "Meta") then
- weight = WeightsWatcher:calculateWeight({}, socketBonusActive, nil, {gemStats}, weightScale)
- if socketBonusActive then
- if bestGem == 0 or weight > bestWeight then
- bestGem = gemId
- bestWeight = weight
+ if not qualityLimit or gemStats[3] <= qualityLimit then
+ socketBonusActive = WeightsWatcher:matchesSocket(gemStats[1], socketColor)
+ -- Meta sockets don't ever hold anything but meta gems
+ if socketBonusActive or (gemStats[1] ~= "Meta" and socketColor ~= "Meta") then
+ weight = WeightsWatcher:calculateWeight({}, socketBonusActive, nil, {gemStats}, weightScale)
+ if socketBonusActive then
+ if bestGem == 0 or weight > bestWeight then
+ bestGem = gemId
+ bestWeight = weight
+ end
+ end
+ if bestGemIgnoreSocket == 0 or weight > bestWeightIgnoreSocket then
+ bestGemIgnoreSocket = gemId
+ bestWeightIgnoreSocket = weight
end
- end
- if bestGemIgnoreSocket == 0 or weight > bestWeightIgnoreSocket then
- bestGemIgnoreSocket = gemId
- bestWeightIgnoreSocket = weight
end
end
end
diff --git a/config.lua b/config.lua
index a6fe2f0..5dc788b 100644
--- a/config.lua
+++ b/config.lua
@@ -208,7 +208,7 @@ classNames = {
defaultVars = {
dataMajorVersion = 0,
- dataMinorVersion = 2,
+ dataMinorVersion = 3,
weightsList = {
["DEATHKNIGHT"] = {
["Blood DPS"] = {
@@ -539,6 +539,7 @@ defaultVars = {
},
options = {
normalizeWeights = true,
+ gemQualityLimit = 9,
},
}