WoWInterface (
-   Classic - AddOn Help/Support (
-   -   Determin which battleground player is in (

djjeffery 05-07-20 05:58 AM

Determin which battleground player is in
I have created an addon to help in WSG.

I now wish to add features for AB. I can't seem to figure out how to know which battleground the player is in. My WSG only addon uses "PLAYER_ENTERING_BATTLEGROUND" To decide if it should show the frame or not.

I would like to find out which battleground the player is in to have the addon show a different frame for each battleground.

Any help and advice would be appreciated

myrroddin 05-07-20 08:00 AM

You need the instanceIDs for the battlegrounds, then check for ZONE_CHANGED. Check out how I did it with RepByZone.

djjeffery 05-09-20 04:55 AM

found what i need
Thank you, after looking at your code I saw something that somehow leads me to find:

local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceID, instanceGroupSize, LfgDungeonID = GetInstanceInfo()

using this I am able to get the name of the battleground the player is in.

myrroddin 05-09-20 05:41 PM

Correct, but you will want to use the instanceID return (eighth value) because the numbers won't change, but there could be conflicts with the name across locales. The name is useful only to show to users while instanceID is what to use when checking the instance.

In other words, instanceID is unique but you cannot guarantee name is unique. Think of it this way: whenever Blizzard decides to provide a legacy version of a battleground, it will share the same name as the current version of the battleground (name == name) but they will have different instanceIDs to tell them apart.

All times are GMT -6. The time now is 08:33 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI