Map API question to help fix old addon
Trying to get an old addon (Equipped Forager) that worked only in Pandaria after the Map API changes in BFA. The offending line of code is
if GetCurrentMapContinent() == 6 then "6" corresponded to Pandaria. AFAIK the new ID is "862," but GetCurrentMapContinent is no more. The new APi seems to be still in development, and I could spend a few trying to plug things in and out, but /dumping all the new Gets returns nil in game so I am asking here first before i dive further in. Does anyone have simple replacement for the line above? I have tried to look through other addons on Curse to see how others may have done this to no avail. The addon works fine if I comment out the line above, and the "end." But it absolutely has to be manually disabled when not in Pandaria. Which is a PITA. Edit: found it local map = C_Map.GetMapInfo(C_Map.GetBestMapForUnit("player")) local parent = C_Map.GetMapInfo(map.parentMapID) if parent.name == "Pandaria" then |
To get the current mapID relevant to the player then use the following:
C_Map.GetBestMapForUnit('player') This will return a mapID which is used for all the map related functions in 8.0 Using the built in /api search tool in game you can view information using slash commands and clicking of links in the chatframe. EG. /api system list will list all apis with clickable names Amongst them will be MapUI which is what you need This will result in an auto '/api mapui list' result in the chat window showing functions, variables and events relating to the map systen. That and some trial and error to see what you need to do to get the info you need at the right time will be all you need to do. |
As posted in that other forum.
To walk up the maps from where you are to the continent you're on: Lua Code:
Code:
0 = "Cosmic" |
It's kinda funny it takes 3 non-intuitive lines of code to do what used to be 1 line of intuitive code :D
Although someone on MMOC helped me find the solution, along the way I found the APIInterface addon on curse helpful in fleshing this out |
All times are GMT -6. The time now is 08:39 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI