Quantcast
Determin which battleground player is in - WoWInterface
Thread Tools Display Modes
05-07-20, 05:58 AM   #1
djjeffery
A Defias Bandit
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 2
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
  Reply With Quote
05-07-20, 08:00 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,124
You need the instanceIDs for the battlegrounds, then check for ZONE_CHANGED. Check out how I did it with RepByZone.
  Reply With Quote
05-09-20, 04:55 AM   #3
djjeffery
A Defias Bandit
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 2
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.
  Reply With Quote
05-09-20, 05:41 PM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,124
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.
  Reply With Quote

WoWInterface » Classic - AddOns, Compliations, Macros » Classic - AddOn Help/Support » Determin which battleground player is in

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