Quantcast

Actually remove Unholy DW from the defaults

Kevin Lyles [01-26-14 - 17:49]
Actually remove Unholy DW from the defaults

Added an upgrade function to remove Unholy DW (and any others) if the weight no longer exists
Filename
Locales/enUS/classes-specs.lua
Upgrade.lua
defaults.lua
diff --git a/Locales/enUS/classes-specs.lua b/Locales/enUS/classes-specs.lua
index 66ce9cf..37a1809 100644
--- a/Locales/enUS/classes-specs.lua
+++ b/Locales/enUS/classes-specs.lua
@@ -50,7 +50,6 @@ ww_specNames = {
 	["Subtlety"] = "Subtlety",
 	["Survival"] = "Survival",
 	["Unholy"] = "Unholy",
-	["Unholy DW"] = "Unholy DW",
 	["Windwalker"] = "Windwalker",
 	["Windwalker DW"] = "Windwalker DW",
 }
diff --git a/Upgrade.lua b/Upgrade.lua
index c5b1634..3369b1d 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -68,6 +68,27 @@ local function replaceStats(vars, conversions)
 end
 ]]

+local function removedDeletedWeights(vars)
+	for _, class in ipairs(vars.weightsList) do
+		local indexesToRemove = {}
+
+		for index, weight in ipairs(vars.weightsList[class]) do
+			if not vars.weightsList[class][weight] then
+				table.insert(indexesToRemove, index)
+			end
+		end
+
+		table.sort(indexesToRemove)
+		for i = #(indexesToRemove), 1, -1 do
+			table.remove(vars.weightsList[class], indexesToRemove[i])
+		end
+	end
+
+	vars.dataMinorVersion = vars.dataMinorVersion + 1
+
+	return vars
+end
+
 local function upgradeAccountToNewMetaEffects(vars)
 	local conversions = {
 		["chance on being hit to gain 20% reduction to physical damage taken"] = "chance on being hit to gain 20% reduction to damage taken",
@@ -1263,6 +1284,7 @@ local upgradeAccountFunctions = {
 		[4] = upgradeAccountToMonks,
 		[5] = upgradeAccountToReplaceEmptyOptions,
 		[6] = upgradeAccountToNewMetaEffects,
+		[7] = removedDeletedWeights,
 	},
 }

@@ -1315,6 +1337,7 @@ local downgradeAccountFunctions = {
 		[5] = noop_down,
 		[6] = noop_down,
 		[7] = downgradeAccountFromNewMetaEffects,
+		[8] = noop_down,
 	},
 }

diff --git a/defaults.lua b/defaults.lua
index e02678f..9063081 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -265,7 +265,7 @@ ww_classNameOptions = {

 ww_defaultVars = {
 	dataMajorVersion = 2,
-	dataMinorVersion = 7,
+	dataMinorVersion = 8,
 	weightsList = {
 		"DEATHKNIGHT",
 		"DRUID",
@@ -283,7 +283,6 @@ ww_defaultVars = {
 			ww_specNames["Frost"],
 			ww_specNames["Frost DW"],
 			ww_specNames["Unholy"],
-			ww_specNames["Unholy DW"],
 			[ww_specNames["Blood"]] = {
 				["mastery"] = 1.3,
 				["strength"] = 1.2,