Thread Tools Display Modes
12-14-12, 07:09 AM   #1
jaliborc
A Chromatic Dragonspawn
 
jaliborc's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 196
Instance Map IDs?

I've step recently into a problem: how can an addon obtain the map ID of a given instance by its localized name?

Zone map IDs can be retrieved by making the map show a given zone (by continent index), and then requesting the current map ID. But that is not possible for instances, as they cannot be accessed by name (that I am aware of).

Is this even feasible, or the addon will have always to depend on some id dictionary? In the last case, are there any libraries out there for the purpose?
  Reply With Quote
12-14-12, 08:25 AM   #2
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
I have not been able to find a way to do it other than using a dictionary. Therefore, Grail uses a dictionary and attempts to use Blizzard strings where possible, otherwise provides its own localized versions of the names. This has a flaw in that some locales (if I remember correctly, Russian) can have more than one location with the same name. In other words, we may have two map areas with different names in English, but another locale may have the same name for both. Being able to figure out from the localized name which map area to use is not going to work properly.
  Reply With Quote
12-14-12, 09:40 AM   #3
Voyager
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 22
You could run the SetMapByID() for 1-1000 to retrieve the names with GetMapNameByID() and store it in a table.

http://www.wowpedia.org/API_GetMapNameByID
  Reply With Quote
12-14-12, 05:35 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Where are you getting the localized names?

If you're in the instance, just use GetInstanceInfo; the last return value is the mapID. If you're getting them from the world map while the user is viewing the map for an instance they're not in, use GetCurrentMapAreaID.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-14-12, 06:37 PM   #5
jaliborc
A Chromatic Dragonspawn
 
jaliborc's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 196
Originally Posted by Voyager View Post
You could run the SetMapByID() for 1-1000 to retrieve the names with GetMapNameByID() and store it in a table.

http://www.wowpedia.org/API_GetMapNameByID
Originally Posted by Phanx View Post
Where are you getting the localized names?

If you're in the instance, just use GetInstanceInfo; the last return value is the mapID. If you're getting them from the world map while the user is viewing the map for an instance they're not in, use GetCurrentMapAreaID.
Didn't noticed SetMapByID existed, that should work! I can just "brute-force" through all the ids and GetCurrentMapAreaID for each one to get all the names. Dumb me...

Thank you all three! Now I have a possible solution.
  Reply With Quote
12-14-12, 06:52 PM   #6
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
I was just playing with this, and it seems one does not need to use SetMapByID() to get results from GetMapNameByID() which turns out to make things much faster. However, the names returned are definitely not unique, so one encounters in English, for example, two map IDs with names "Dalaran".
  Reply With Quote
12-15-12, 12:01 AM   #7
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
This could be accomplished using the encounter journal's search function, if what you're looking for is in it.

(EJ_SetSearch I think, take a look at the framexml for it)

If you want I could write an example when I get the opportunity.

As has already been mentioned map names are not unique and you will have to deal with the possibility of multiple results, although if you're only interested in instances it may not be an issue.

Last edited by semlar : 12-15-12 at 12:10 AM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Instance Map IDs?


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