Quantcast Get current continent name or id? - WoWInterface
Thread Tools Display Modes
07-20-18, 03:43 AM   #1
Zax
A Cyclonian
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 42
Get current continent name or id?

Hello,

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.
  Reply With Quote
07-20-18, 04:20 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,669
Use IsFlyableArea()
  Reply With Quote
07-20-18, 05:10 AM   #3
Zax
A Cyclonian
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 42
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?
  Reply With Quote
07-20-18, 06:32 AM   #4
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
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
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
07-20-18, 07:44 AM   #5
Zax
A Cyclonian
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 42
Thank you, I'll try.
BTW, after a few tests, IsFlyableArea() seems more accurate then before patch 8.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Get current continent name or id?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off