Current WorldMap Zone Text
How can i get the current continent/zone text which is currently shown by the map?
|
|
GetMinimapZoneText() will get the current zone text.
If you want to update it while moving, use events: PLAYER_ENTERING_WORLD ZONE_CHANGED ZONE_CHANGED_INDOORS ZONE_CHANGED_NEW_AREA Edit: You can also use GetZonePVPInfo() to get the zone type, sanctuary, contested, friendly, hostile, arena. |
Lua Code:
|
Quote:
|
Quote:
Shame Blizzard doesn't have a global function something like this. |
I pulled that out of my map function that just sort of returns everything about the current map, "name" can't not exist at the end of the function unless you remove "= WORLD_MAP" from the top of it, so the last part isn't really necessary.
It depends on what you want it to default to if the current map has no name from the other methods. It also concats the floor name from multi-level maps to the parent map name, so if you want to change that behavior you'll have to edit the floorNum > 0 part. |
Quote:
|
I have some issues specially with the new Zone Names.
Since "Nagrand" and "Shadowmoon Valley" are also exists on Outland, the function save values from both zone into the same table. Any way to properly differentiate these zones? Or i'm gonna need to slap the zone id into the string? |
Names are a really bad way to identify zones. You should be storing map IDs, not names. If you need to display something to the user, you can use GetMapNameByID to get the correct name when needed.
|
Quote:
|
Quote:
Code:
/run MySavedVar=nil |
Quote:
Code:
local function FindMapID(name) |
Quote:
My question is that is that 1200 max value for the loop is gonna be enough? |
|
Yes, I specifically picked 1200 by looking at the list of mapIDs and determining that none are above 1200. Since this is a one-time process, and not something that needs to be future-proof, the fact that future content patches and expansions might add maps with IDs higher than 1200 isn't relevant.
|
You could also just use GetAreaMaps() for a list of map ids, if you're into that sort of thing.
|
Quote:
|
Quote:
|
Quote:
|
All times are GMT -6. The time now is 09:26 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI