WoWInterface - View Single Post - BFA - Alpha tester
View Single Post
04-27-18, 12:01 AM   #22
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 264
If any of this helps, this works to get all the continents, their zones and dungeons in beta.

--	Attempt to get all the Continents by starting wherever you are and getting the Cosmic
--	map and then asking it for all the Continents that are children of it, hoping the API
--	will bypass the intervening World maps.
local currentMapId, TOP_MOST, ALL_DESCENDANTS = C_Map.GetBestMapForUnit('player'), true, true
--	Early in startup C_Map.GetBestMapForUnit('player') does not seem to work, so currentMapId is
--	nil so we use 946 which seems to be the mapId for Cosmic as a default.
local cosmicMapInfo = MapUtil.GetMapParentInfo(currentMapId or 946, Enum.UIMapType.Cosmic, TOP_MOST)
local continents = C_Map.GetMapChildrenInfo(cosmicMapInfo.mapID, Enum.UIMapType.Continent, ALL_DESCENDANTS)
self.continentMapIds = {}
for i, continentInfo in ipairs(continents) do
	local L = { name = continentInfo.name, zones = {}, mapID = continentInfo.mapID, dungeons = {} }
	local zones = C_Map.GetMapChildrenInfo(continentInfo.mapID, Enum.UIMapType.Zone, ALL_DESCENDANTS)
	for j, zoneInfo in ipairs(zones) do
		self:_AddMapId(L.zones, zoneInfo.name, zoneInfo.mapID, L.mapID)
	local dungeons = C_Map.GetMapChildrenInfo(continentInfo.mapID, Enum.UIMapType.Dungeon, ALL_DESCENDANTS)
	for j, dungeonInfo in ipairs(dungeons) do
		self:_AddMapId(L.dungeons, dungeonInfo.name, dungeonInfo.mapID, L.mapID)
	self.continents[L.mapID] = L
	tinsert(self.continentMapIds, L.mapID)
  Reply With Quote