diff RatPageController.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 b7074b47cfc7
children 3b1f85a1cbb1
line wrap: on
line diff
--- a/RatPageController.lua	Thu Apr 25 01:31:26 2013 +0000
+++ b/RatPageController.lua	Thu Apr 25 01:31:31 2013 +0000
@@ -46,12 +46,37 @@
 end
 
 function RatPageController_methods:GetCursorObject()
-	local cursorObject = nil
-	if GetCursorInfo() then
-		cursorObject = CyborgMMO_CreateWowObject(GetCursorInfo())
-		ClearCursor()
+	local type,a,b,c = GetCursorInfo()
+	ClearCursor()
+	if type=='item' then
+		local id,link = a,b
+		return CyborgMMO_CreateWowObject('item', id)
+	elseif type=='spell' then
+		local index,book,id = a,b,c
+		return CyborgMMO_CreateWowObject('spell', id)
+	elseif type=='macro' then
+		local index = a
+		local name = GetMacroInfo(index)
+		return CyborgMMO_CreateWowObject('macro', name)
+	elseif type=='companion' then
+		local index,subtype = a,b
+		local spellID = select(3, GetCompanionInfo(subtype, index))
+		return CyborgMMO_CreateWowObject('companion', spellID)
+	elseif type=='battlepet' then
+		local petID = a
+		return CyborgMMO_CreateWowObject('battlepet', petID)
+	elseif type=='petaction' then
+		return nil
+	elseif type=='money' then
+		return nil
+	elseif type=='merchant' then
+		return nil
+	elseif type==nil then
+		return nil
+	else
+		CyborgMMO_DPrint("unexpected cursor info:", type, a, b, c)
+		return nil
 	end
-	return cursorObject
 end
 
 function RatPageController_methods:CallbackDropped(callbackObject)