WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Get current continent name or id? (https://www.wowinterface.com/forums/showthread.php?t=56399)

Zax 07-20-18 03:43 AM

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.

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.

chestercs 12-01-22 06:57 PM

Solution
 
Its pretty late to reply but:
https://gist.github.com/chestercs/6d...8b50b64d29bbf5

:banana::)


All times are GMT -6. The time now is 07:15 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI