WoWInterface (
-   Lua/XML Help (
-   -   Get current continent name or id? (

Zax 07-20-18 03:43 AM

Get current continent name or id?

I used to use API GetCurrentMapContinent() to get continent where player is, but it throws an error in patch 8. So what is now teh correct way to retrieve this info?

Main goal is to know is cuurent zone is flyable *by the player*, depending its special abilities like "Fly in Draenor", etc.

Thank you.

p3lim 07-20-18 04:20 AM

Use IsFlyableArea()

Zax 07-20-18 05:10 AM

IsFlyableArea() is an old API that wasn't accurate at all, even before WoD. Do you think it has been updated et fixed in patch 8?

Rilgamon 07-20-18 06:32 AM

For one of my addons I use this function. It does not return the "old" values. So you need to find the right values for your addon.
Lua Code:
  1. local function getContinent()
  2.     local mapID = C_Map.GetBestMapForUnit("player")
  3.     if(mapID) then
  4.         local info = C_Map.GetMapInfo(mapID)
  5.         if(info) then
  6.             while(info['mapType'] and info['mapType'] > 2) do
  7.                 info = C_Map.GetMapInfo(info['parentMapID'])
  8.             end
  9.             if(info['mapType'] == 2) then
  10.                 return info['mapID']
  11.             end
  12.         end
  13.     end
  14. end

Zax 07-20-18 07:44 AM

Thank you, I'll try.
BTW, after a few tests, IsFlyableArea() seems more accurate then before patch 8.

All times are GMT -6. The time now is 12:20 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI