View Single Post
06-18-15, 01:21 PM   #17
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by Banknorris View Post
Semlar, Choonsters asked for events as well, because even if your function works there is still the problem when to call it. I tested my solution so unless someone points any flaw on it, I would say the problem is solved.
Your solution relies on hard-coded magic numbers to address specific problematic zones which makes it less flexible for future additions. Also, while the topic title specifies "detecting world pvp zones", what he's really interested in is detecting whether the player is in an area that should be considered a pvp zone, which presumably includes world pvp, battlegrounds, arenas, and open-world arenas like Gurubashi and FFA events.

The events to watch are ZONE_CHANGED_NEW_AREA for traveling between major zones, potentially ZONE_CHANGED for subzones, PLAYER_ENTERING_WORLD specifically for catching reloaded UIs (because zone information is not accurate between other loading screens), and if those events don't occur when starting a battle like wintergrasp then include the BATTLEFIELD_MGR events.

You're also missing brackets in your BATTLEFIELD_MGR_STATE_CHANGE condition, so it probably isn't going to behave like you're expecting.

Last edited by semlar : 06-18-15 at 01:46 PM.
  Reply With Quote