Quantcast

* Added a saved-variable conveersion script due to changes in Dongle.

James Whitehead II [04-11-07 - 21:57]
* Added a saved-variable conveersion script due to changes in Dongle.
Filename
PerfectRaid.lua
diff --git a/PerfectRaid.lua b/PerfectRaid.lua
index d3d59ff..2bebc85 100644
--- a/PerfectRaid.lua
+++ b/PerfectRaid.lua
@@ -55,6 +55,43 @@ function PerfectRaid:Initialize()
 	end

 	utils = self.utils
+
+	-- This is a small procedure to update the saved variables
+	local sv = PerfectRaidDB
+
+	if sv and not sv.global.sv_converted then
+		if sv.char then
+			local converted = {}
+			for key,entry in pairs(sv.char) do
+				local char,server = key:match("^(.+) of (.+)$")
+				if char then
+					local new_key = ("%s - %s"):format(char, server)
+					converted[new_key] = entry
+				else
+					converted[key] = entry
+				end
+			end
+			sv.char = converted
+		end
+
+		if sv.profileKeys then
+			local converted = {}
+			for ukey,pkey in pairs(sv.profileKeys) do
+				-- Update each user key
+				local char,server = ukey:match("^(.+) of (.+)$")
+				if char then
+					local new_key = ("%s - %s"):format(char, server)
+					converted[new_key] = pkey
+				else
+					converted[key] = entry
+				end
+			end
+			sv.profileKeys = converted
+		end
+
+		if not sv.global then sv.global = {} end
+		sv.global.sv_converted = true
+	end
 end

 function PerfectRaid:Enable()