WoWInterface - View Single Post - Detecting World PvP Zones
View Single Post
06-16-15, 03:00 PM   #10
A Pyroguard Emberseer
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
Originally Posted by p3lim View Post
This method is safe:

Lua Code:
  1. local oldAreaID = GetCurrentMapAreaID()
  2. SetMapToCurrentZone()
  4. -- store the current area ID
  5. local areaID = GetCurrentMapAreaID()
  7. SetMapByID(oldAreaID)
  9. -- do things
No it isn't, you don't take into account the previous map level. Also, changing the map resets its zoom (if you use the scroll wheel on the world map).

This would also set the map to the wrong zone if you're currently inside of a microdungeon.

There are other things to consider when changing the map, like how extremely cpu intensive addons like Routes and Gatherer would react.

The only safeish method for actively changing the current map is to unregister WORLD_MAP_UPDATE from every frame that's watching it, do your thing and swap the map back to what it previously was, then re-register the event to those frames.

I don't recommend anyone do that unless they fully comprehend how the map works.
  Reply With Quote