Mercurial > wow > cyborg-mmo7
diff 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 |
line wrap: on
line diff
--- a/RatPageController.lua Thu Oct 23 12:17:02 2014 +0100 +++ b/RatPageController.lua Thu Oct 23 13:44:59 2014 +0100 @@ -48,6 +48,36 @@ function RatPageController_methods:GetCursorObject() local type,a,b,c = GetCursorInfo() ClearCursor() + + -- special case for unknown mounts (do it here since we're sure the cursor is free) + if type=='mount' then + local mountID = a + -- if the mount is unknown + if mountID~=0xFFFFFFF and not CyborgMMO_MountMap[mountID] and not CyborgMMO_LocalMountMap[mountID] then + -- build a reverse index of known mount spells + local reverse = {} + for mount,spell in pairs(CyborgMMO_MountMap) do reverse[spell] = mount end + for mount,spell in pairs(CyborgMMO_LocalMountMap) do reverse[spell] = mount end + -- iterate over mount journal + for i=1,C_MountJournal.GetNumMounts() do + local _,spell = C_MountJournal.GetMountInfo(i) + -- if the mount has no known mount ID + if not reverse[spell] then + -- pickup the mount + C_MountJournal.Pickup(i) + -- get the mount id from the cursor + local _,mount = GetCursorInfo() + ClearCursor() + -- save that to avoid spamming the cursor too often + if mount then + CyborgMMO_LocalMountMap[mount] = spell + reverse[spell] = mount + end + end + end + end + end + if type=='item' then local id,link = a,b return CyborgMMO_CreateWowObject('item', id) @@ -65,6 +95,9 @@ elseif type=='battlepet' then local petID = a return CyborgMMO_CreateWowObject('battlepet', petID) + elseif type=='mount' then + local mountID = a + return CyborgMMO_CreateWowObject('mount', mountID) elseif type=='equipmentset' then local name = a return CyborgMMO_CreateWowObject('equipmentset', name)