diff CyborgMMO7.lua @ 34:6ce173840e68

Reworked the whole "wow object" system: - Only save what is strictly necessary. - Save appropriate persistent information for all objects (like spellIDs instead of spellBook+spellIndex). - Fixed Battle Pets objects (non-combat pets in pre-MoP). - Fixed item objects. - Cleaned and simplified most objects implementation. - Moved the settings and button profile to the root of the saved data, rather than in a per-character sub-table (that data is already tagged as saved per character). This should fix most issues with objects changing without user interaction on diverse occasions. Old profiles are not converted to the new system. This will come soon. Some issues persist due to the asynchronous loading of some informations: - Pet icons are never properly loaded from saved data. - Items are not properly loaded the first time the UI is started (a "/reload ui" or disconnect/connect cycle fixes this problem).
author madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09
date Thu, 25 Apr 2013 01:31:31 +0000
parents fc5f52d60d16
children 16b2ff47b6db
line wrap: on
line diff
--- a/CyborgMMO7.lua	Thu Apr 25 01:31:26 2013 +0000
+++ b/CyborgMMO7.lua	Thu Apr 25 01:31:31 2013 +0000
@@ -84,14 +84,22 @@
 	assert(VarsLoaded)
 	if not CyborgMMO7SaveData then
 		CyborgMMO7SaveData = {}
-		CyborgMMO7SaveData[SaveName] = {}
 	end
-	return CyborgMMO7SaveData[SaveName]
+	return CyborgMMO7SaveData
 end
 
-function CyborgMMO_SetSaveData(data, index)
+function CyborgMMO_SetRatSaveData(data)
 	assert(VarsLoaded)
-	CyborgMMO_GetSaveData()[index] = data
+	local saveData = {}
+	for mode=1,#data do
+		saveData[mode] = {}
+		for button=1,#data[mode] do
+			if data[mode][button] then
+				saveData[mode][button] = data[mode][button]:SaveData()
+			end
+		end
+	end
+	CyborgMMO_GetSaveData().Rat = saveData
 end
 
 function CyborgMMO_Event(self, event, ...)