Mercurial > wow > cyborg-mmo7
comparison RatPageController.lua @ 65:8b8b0bade520
Fixed support for mounts using the new MountJournal and mount IDs (no conversion of old profiles at the moment).
author | Jerome Vuarand <jerome.vuarand@gmail.com> |
---|---|
date | Thu, 23 Oct 2014 13:44:59 +0100 |
parents | 3b1f85a1cbb1 |
children | 840c9f09a707 |
comparison
equal
deleted
inserted
replaced
64:49ae7191821f | 65:8b8b0bade520 |
---|---|
46 end | 46 end |
47 | 47 |
48 function RatPageController_methods:GetCursorObject() | 48 function RatPageController_methods:GetCursorObject() |
49 local type,a,b,c = GetCursorInfo() | 49 local type,a,b,c = GetCursorInfo() |
50 ClearCursor() | 50 ClearCursor() |
51 | |
52 -- special case for unknown mounts (do it here since we're sure the cursor is free) | |
53 if type=='mount' then | |
54 local mountID = a | |
55 -- if the mount is unknown | |
56 if mountID~=0xFFFFFFF and not CyborgMMO_MountMap[mountID] and not CyborgMMO_LocalMountMap[mountID] then | |
57 -- build a reverse index of known mount spells | |
58 local reverse = {} | |
59 for mount,spell in pairs(CyborgMMO_MountMap) do reverse[spell] = mount end | |
60 for mount,spell in pairs(CyborgMMO_LocalMountMap) do reverse[spell] = mount end | |
61 -- iterate over mount journal | |
62 for i=1,C_MountJournal.GetNumMounts() do | |
63 local _,spell = C_MountJournal.GetMountInfo(i) | |
64 -- if the mount has no known mount ID | |
65 if not reverse[spell] then | |
66 -- pickup the mount | |
67 C_MountJournal.Pickup(i) | |
68 -- get the mount id from the cursor | |
69 local _,mount = GetCursorInfo() | |
70 ClearCursor() | |
71 -- save that to avoid spamming the cursor too often | |
72 if mount then | |
73 CyborgMMO_LocalMountMap[mount] = spell | |
74 reverse[spell] = mount | |
75 end | |
76 end | |
77 end | |
78 end | |
79 end | |
80 | |
51 if type=='item' then | 81 if type=='item' then |
52 local id,link = a,b | 82 local id,link = a,b |
53 return CyborgMMO_CreateWowObject('item', id) | 83 return CyborgMMO_CreateWowObject('item', id) |
54 elseif type=='spell' then | 84 elseif type=='spell' then |
55 local index,book,id = a,b,c | 85 local index,book,id = a,b,c |
63 local spellID = select(3, GetCompanionInfo(subtype, index)) | 93 local spellID = select(3, GetCompanionInfo(subtype, index)) |
64 return CyborgMMO_CreateWowObject('companion', spellID) | 94 return CyborgMMO_CreateWowObject('companion', spellID) |
65 elseif type=='battlepet' then | 95 elseif type=='battlepet' then |
66 local petID = a | 96 local petID = a |
67 return CyborgMMO_CreateWowObject('battlepet', petID) | 97 return CyborgMMO_CreateWowObject('battlepet', petID) |
98 elseif type=='mount' then | |
99 local mountID = a | |
100 return CyborgMMO_CreateWowObject('mount', mountID) | |
68 elseif type=='equipmentset' then | 101 elseif type=='equipmentset' then |
69 local name = a | 102 local name = a |
70 return CyborgMMO_CreateWowObject('equipmentset', name) | 103 return CyborgMMO_CreateWowObject('equipmentset', name) |
71 elseif type=='petaction' then | 104 elseif type=='petaction' then |
72 return nil | 105 return nil |