Quantcast WoWInterface - View Single Post - Need help developing new addon: Classic Achievements
View Single Post
10-12-19, 12:02 PM   #2
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 264
There are all different types of maps in the new mapping system. You can basically iterate through the continents and get all the type of interest.

Here is code that should work in both Classic and Retail:
Code:
local currentMapId, TOP_MOST, ALL_DESCENDANTS = Grail.GetCurrentMapAreaID(), true, true
local cosmicMapInfo = MapUtil.GetMapParentInfo(currentMapId or 946, Enum.UIMapType.Cosmic, TOP_MOST)
if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC then
	cosmicMapInfo = { mapID = 947 }
end
local continents = C_Map.GetMapChildrenInfo(cosmicMapInfo.mapID, Enum.UIMapType.Continent, ALL_DESCENDANTS)
for i, continentInfo in ipairs(continents) do
	-- access things like continentInfo.name, continentInfo.mapID
	local zones = C_Map.GetMapChildrenInfo(continentInfo.mapID, Enum.UIMapType.Zone, ALL_DESCENDANTS)
	for j, zoneInfo in ipairs(zones) do
		-- access things like zoneInfo.name, zoneInfo.mapID
	end
end
You can access the API in game to see the structures available in the map API.
  Reply With Quote