comparison 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
comparison
equal deleted inserted replaced
33:1c0af1810e06 34:6ce173840e68
44 CyborgMMO_DPrint("Setting mode "..tostring(mode.Id)) 44 CyborgMMO_DPrint("Setting mode "..tostring(mode.Id))
45 CyborgMMO_RatPageModel:SetMode(mode.Id) 45 CyborgMMO_RatPageModel:SetMode(mode.Id)
46 end 46 end
47 47
48 function RatPageController_methods:GetCursorObject() 48 function RatPageController_methods:GetCursorObject()
49 local cursorObject = nil 49 local type,a,b,c = GetCursorInfo()
50 if GetCursorInfo() then 50 ClearCursor()
51 cursorObject = CyborgMMO_CreateWowObject(GetCursorInfo()) 51 if type=='item' then
52 ClearCursor() 52 local id,link = a,b
53 return CyborgMMO_CreateWowObject('item', id)
54 elseif type=='spell' then
55 local index,book,id = a,b,c
56 return CyborgMMO_CreateWowObject('spell', id)
57 elseif type=='macro' then
58 local index = a
59 local name = GetMacroInfo(index)
60 return CyborgMMO_CreateWowObject('macro', name)
61 elseif type=='companion' then
62 local index,subtype = a,b
63 local spellID = select(3, GetCompanionInfo(subtype, index))
64 return CyborgMMO_CreateWowObject('companion', spellID)
65 elseif type=='battlepet' then
66 local petID = a
67 return CyborgMMO_CreateWowObject('battlepet', petID)
68 elseif type=='petaction' then
69 return nil
70 elseif type=='money' then
71 return nil
72 elseif type=='merchant' then
73 return nil
74 elseif type==nil then
75 return nil
76 else
77 CyborgMMO_DPrint("unexpected cursor info:", type, a, b, c)
78 return nil
53 end 79 end
54 return cursorObject
55 end 80 end
56 81
57 function RatPageController_methods:CallbackDropped(callbackObject) 82 function RatPageController_methods:CallbackDropped(callbackObject)
58 local slot = nil 83 local slot = nil
59 local observers = CyborgMMO_RatPageModel:GetAllObservers() 84 local observers = CyborgMMO_RatPageModel:GetAllObservers()