WoWInterface SVN MountRandomMount

[/] [trunk/] [MountRandomMount_MountListData.lua] - Rev 34

Compare with Previous | Blame | View Log

function MountRandomMount:MountDataListFill()
        if MountRandomMount_SavedTable == nil or MountRandomMount_SavedTable['ground'] == nil or MountRandomMount_SavedTable['flying'] == nil then
                MountRandomMount_SavedTable['ground'] = {}
                MountRandomMount_SavedTable['flying'] = {}
        end

        MountRandomMount_MountDataList = {}
        MountRandomMount_MountDataList['ground'] = {}
        MountRandomMount_MountDataList['flying'] = {}
        MountRandomMount_MountDataAquatic = {}
        local mounts = C_MountJournal.GetMountIDs()
        for _, v in pairs(mounts) do
                local creatureName, spellID, icon, active, isUsable, sourceType, isFavorite, isFactionSpecific, faction, isFiltered, isCollected, mountID = C_MountJournal.GetMountInfoByID(v)
                if isCollected and isUsable then
                        if MountRandomMount_MountDataList['flying'][sourceType] == nil then
                                MountRandomMount_MountDataList['flying'][sourceType] = {}
                                MountRandomMount_MountDataList['ground'][sourceType] = {}
                        end
                        local creatureDisplayID, descriptionText, sourceText, isSelfMount, mountType = C_MountJournal.GetMountInfoExtraByID(mountID)
                        if mountType == 230 or mountType == 269  or mountType == 284 then
                                MountRandomMount_MountDataList['ground'][sourceType][mountID] = creatureName
                        end
                        if mountType == 248 or mountType == 247  then
                                MountRandomMount_MountDataList['flying'][sourceType][mountID] = creatureName
                        end
                        if mountType == 231 or mountType == 232 or mountType == 254 then
                                MountRandomMount_MountDataAquatic[mountID] = creatureName
                        end
                end
        end

        table.foreach(MountRandomMount_MountDataList, function(k,v)
                table.foreach(MountRandomMount_MountDataList[k], function(l,w)
                        table.sort(MountRandomMount_MountDataList[k][l])
                end)
        end)
end

Compare with Previous | Blame