Quantcast

Added support for separate display and stat/element names

Kevin Lyles [12-21-09 - 14:30]
Added support for separate display and stat/element names
Moved resistances to this model
Filename
Upgrade.lua
defaults.lua
weights.lua
diff --git a/Upgrade.lua b/Upgrade.lua
index dc67b11..5d90fda 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -135,6 +135,29 @@ function noop_major_up(vars)
 	return vars
 end

+function upgradeAccountToWorkingResistances(vars)
+	local resistances = {
+		"arcane",
+		"fire",
+		"frost",
+		"holy",
+		"nature",
+		"shadow",
+	}
+
+	for _, class in ipairs(vars.weightsList) do
+		for _, weight in ipairs(vars.weightsList[class]) do
+			for _, resistance in ipairs(resistances) do
+				vars.weightsList[class][weight][resistance .. " resistance"] = vars.weightsList[class][weight][resistance]
+				vars.weightsList[class][weight][resistance] = nil
+			end
+		end
+	end
+
+	vars.dataMinorVersion = 9
+	return vars
+end
+
 function upgradeAccountToShowAlternateGemsTypoFix(vars)
 	if vars.options.tooltip.showAlternateGems == nil then
 		vars.options.tooltip.showAlternateGems = "Alt"
@@ -755,6 +778,7 @@ upgradeAccountFunctions = {
 		[5] = upgradeAccountToGemSources,
 		[6] = upgradeAccountToShowAlternateGems,
 		[7] = upgradeAccountToShowAlternateGemsTypoFix,
+		[8] = upgradeAccountToWorkingResistances,
 	},
 }

@@ -780,6 +804,7 @@ downgradeAccountFunctions = {
 		[6] = downgradeAccountFromGemSources,
 		[7] = noop_down,
 		[8] = noop_down,
+		[9] = noop_down,
 	},
 }

diff --git a/defaults.lua b/defaults.lua
index e145431..6f01190 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -71,6 +71,12 @@ trackedStats = {
 		"Holy",
 		"Nature",
 		"Shadow",
+		["Arcane"] = "arcane resistance",
+		["Fire"] = "fire resistance",
+		["Frost"] = "frost resistance",
+		["Holy"] = "holy resistance",
+		["Nature"] = "nature resistance",
+		["Shadow"] = "shadow resistance",
 	},
 }

@@ -133,7 +139,7 @@ classNameOptions = {

 defaultVars = {
 	dataMajorVersion = 1,
-	dataMinorVersion = 8,
+	dataMinorVersion = 9,
 	weightsList = {
 		[1] = "DEATHKNIGHT",
 		[2] = "DRUID",
diff --git a/weights.lua b/weights.lua
index 025554a..1737172 100644
--- a/weights.lua
+++ b/weights.lua
@@ -483,7 +483,7 @@ function createScrollableTieredList(template, scrollFrame, scrolledFrame, elemen
 			elementFrame.position = j
 			elementFrame.category = categoryFrame
 			elementFrame.text:SetText(element)
-			elementFrame.name = element
+			elementFrame.name = template[category][element] or element
 			elementFrame:SetPoint("TOPLEFT", 0, -elementHeight * j)
 			table.insert(scrollFrame.shown, elementFrame)
 			categoryFrame.length = categoryFrame.length + 1