Hiya,
I'm trying to get an addon working properly again called
MountManager, With the legion C_MountJournal changes I made some edits to get the addon working again from a functionality point of view.
The scanning function of the addon to check the journal I believe is this portion of the LUA
Lua Code:
function MountManager:ScanForNewMounts()
local newMounts = 0
for index = 1,C_MountJournal.GetNumMounts() do
local _, spellID, _, _, _, _, _, isFactionSpecific, faction, _, isCollected = C_MountJournal.GetMountInfoByID(index)
--make sure its valid and not already found
local correctFaction = not isFactionSpecific or (self.db.char.faction == "Horde" and faction == 0) or (self.db.char.faction == "Alliance" and faction == 1)
if correctFaction == true and isCollected == true and not self:MountExists(spellID) then
newMounts = newMounts + 1
local _, _, _, _, mountType = C_MountJournal.GetMountInfoExtraByID(index)
-- 269 for 2 Water Striders (Azure and Crimson)
-- 254 for 1 Subdued Seahorse (Vashj'ir and water)
-- 248 for 163 "typical" flying mounts, including those that change based on level
-- 247 for 1 Red Flying Cloud (flying mount)
-- 242 for 1 Swift Spectral Gryphon (the one we fly while dead)
-- 241 for 4 Qiraji Battle Tanks (AQ only)
-- 232 for 1 Abyssal Seahorse (Vashj'ir only)
-- 231 for 2 Turtles (Riding and Sea)
-- 230 for 298 land mounts
if mountType == 241 then
self.db.char.mounts["aq"] = self.db.char.mounts["aq"] or {}
self.db.char.mounts["aq"][spellID] = true
end
if mountType == 232 or mountType == 254 then
self.db.char.mounts["vashj"] = self.db.char.mounts["vashj"] or {}
self.db.char.mounts["vashj"][spellID] = true
end
if mountType == 247 or mountType == 248 then
self.db.char.mounts["flying"] = self.db.char.mounts["flying"] or {}
self.db.char.mounts["flying"][spellID] = true
end
if mountType == 231 or mountType == 254 or mountType == 269 then
self.db.char.mounts["water"] = self.db.char.mounts["water"] or {}
self.db.char.mounts["water"][spellID] = true
end
if mountType == 230 or mountType == 231 or mountType == 269 then
self.db.char.mounts["ground"] = self.db.char.mounts["ground"] or {}
self.db.char.mounts["ground"][spellID] = true
end
end
end
if newMounts > 0 then
self:Print(string.format("|cff20ff20%s|r %s", newMounts, L["new mount(s) found!"]))
self:UpdateMountChecks()
end
end
function MountManager:ScanForRaceClass()
if self.db.char.race == "Worgen" and self.db.char.mount_skill > 0 then
self.db.char.mounts["ground"][worgenRacial] = true;
end
if self.db.char.class == "Druid" then
self:UPDATE_SHAPESHIFT_FORMS()
end
if self.db.char.class == "Monk" then
self.db.char.mounts["flying"][zenFlight] = IsSpellKnown(zenFlight);
end
if self.db.char.class == "Shaman" and self.db.char.level > 14 then
self.db.char.mounts["skill"][ghostWolf] = true;
end
end
function MountManager:MountExists(spellID)
for mountType, typeTable in pairs(self.db.char.mounts) do
if typeTable[spellID] ~= nil then
return true
end
end
return false
end
function MountManager:SummonMount(mount)
for index = 1,C_MountJournal.GetNumMounts() do
local spellID = select(2, C_MountJournal.GetMountInfoByID(index))
if spellID == mount then
C_MountJournal.SummonByID(index)
end
end
end
While it no longer throws up any errors in this format it no longer adds new mounts that seem to have been created since its last update. I've got no idea why exactly maybe I missing something somewhere else. But I'd love to get this working again.