Quantcast Current WorldMap Zone Text - WoWInterface
 
Thread Tools Display Modes
10-15-14, 02:41 PM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Current WorldMap Zone Text

How can i get the current continent/zone text which is currently shown by the map?
  Reply With Quote
10-15-14, 03:15 PM   #2
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Have you looked at WorldMapFrame.xml?

WorldMapZoneInfo might be the FontString you want.
  Reply With Quote
10-15-14, 03:22 PM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,214
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.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 10-15-14 at 03:24 PM.
  Reply With Quote
10-15-14, 03:36 PM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
Lua Code:
  1. local function GetMapName()
  2.     local mapName, _, _, isMicroDungeon, microDungeonMapName = GetMapInfo()
  3.     local name = WORLD_MAP
  4.     if GetCurrentMapZone() > 0 then
  5.         name = GetMapNameByID(GetCurrentMapAreaID())
  6.         local floorNum = DungeonUsesTerrainMap() and GetCurrentMapDungeonLevel() - 1 or GetCurrentMapDungeonLevel()
  7.         if floorNum > 0 then
  8.             name = name .. ': ' .. _G["DUNGEON_FLOOR_" .. strupper(mapName or '') .. floorNum]
  9.         end
  10.     else
  11.         local currentContinent = GetCurrentMapContinent()
  12.         if currentContinent ~= WORLDMAP_WORLD_ID and currentContinent ~= WORLDMAP_COSMIC_ID then
  13.             name = select(currentContinent, GetMapContinents())
  14.         end
  15.     end
  16.     return name or (isMicroDungeon and microDungeonMapName or mapName)
  17. end

Last edited by semlar : 10-15-14 at 03:42 PM.
  Reply With Quote
10-15-14, 03:44 PM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by semlar View Post
Lua Code:
  1. local function GetMapName()
  2.     local mapName, _, _, isMicroDungeon, microDungeonMapName = GetMapInfo()
  3.     local name = WORLD_MAP
  4.     if GetCurrentMapZone() > 0 then
  5.         name = GetMapNameByID(GetCurrentMapAreaID())
  6.         local floorNum = DungeonUsesTerrainMap() and GetCurrentMapDungeonLevel() - 1 or GetCurrentMapDungeonLevel()
  7.         if floorNum > 0 then
  8.             name = name .. ': ' .. _G["DUNGEON_FLOOR_" .. strupper(mapName or '') .. floorNum]
  9.         end
  10.     else
  11.         local currentContinent = GetCurrentMapContinent()
  12.         if currentContinent ~= WORLDMAP_WORLD_ID and currentContinent ~= WORLDMAP_COSMIC_ID then
  13.             name = select(currentContinent, GetMapContinents())
  14.         end
  15.     end
  16.     return name or (isMicroDungeon and microDungeonMapName or mapName)
  17. end
Sexy that what i need, thanks.
Shame Blizzard doesn't have a global function something like this.
  Reply With Quote
10-15-14, 03:51 PM   #6
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
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.
  Reply With Quote
10-15-14, 03:39 PM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Fizzlemizz View Post
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.
That returns the player's zone, i need the zone which is shown on the map, not the minimap.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Current WorldMap Zone Text

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