Thread Tools Display Modes
06-09-16, 08:36 AM   #1
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
How to detect if mob is boss

What's the best way to tell if a unit is a boss? If you mouseover a friendly faction boss, for example, the tooltip will read "Level ?? (Boss)". I'm having trouble tracking down where that text is coming from. Presumably the "??" is coming from UnitLevel(), but that returns -1 for normal mobs if they're >10 levels higher than you.
__________________
1/5 15:55:46.001 UNIT_DIED, 0x0000000000000000, nil, 0x80000000, 0xF130001942161FB7, "Gamon", 0xa28
  Reply With Quote
06-09-16, 08:54 AM   #2
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
Lua Code:
  1. if UnitClassification(unit) == "worldboss" then
__________________
  Reply With Quote
06-09-16, 09:01 AM   #3
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by syncrow View Post
Lua Code:
  1. if UnitClassification(unit) == "worldboss" then
afaik it returns elite for faction bosses
  Reply With Quote
06-09-16, 09:02 AM   #4
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
Originally Posted by sezz View Post
afaik it returns elite for faction bosses
Yes, it does. Was hoping there was something else.

Edit: It also returns elite for instance bosses.
__________________
1/5 15:55:46.001 UNIT_DIED, 0x0000000000000000, nil, 0x80000000, 0xF130001942161FB7, "Gamon", 0xa28

Last edited by lieandswell : 06-09-16 at 09:07 AM.
  Reply With Quote
06-09-16, 09:42 AM   #5
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
comparision for friendly bosses and instance / raid bosses

Lua Code:
  1. local isFriendlyBoss = UnitIsFriend("player", unit) and UnitLevel(unit) == -1
  2. local isInstanceBoss;
  3.  
  4. for i = 1, 5 do
  5.     local bossGUID = UnitGUID("boss"..i)
  6.  
  7.     if UnitGUID(unit) == bossGUID then
  8.         isInstanceBoss = bossGUID
  9.         break
  10.     end
  11. end
__________________
  Reply With Quote
06-09-16, 10:00 AM   #6
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
Originally Posted by syncrow View Post
comparision for friendly bosses and instance / raid bosses
That works for bosses once the encounter has started, but not before.

I'm trying to make unit frames that show bosses differently than elites or higher-level mobs. Maybe I could make a big table out of EJ_GetCreatureInfo() and then check unit names against that. Seems a bit expensive, though.
__________________
1/5 15:55:46.001 UNIT_DIED, 0x0000000000000000, nil, 0x80000000, 0xF130001942161FB7, "Gamon", 0xa28
  Reply With Quote
06-09-16, 10:05 AM   #7
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
http://www.wowace.com/addons/libbossids-1-0/

Already been done, although I'm unsure if it'll be updated for Legion
  Reply With Quote
06-09-16, 10:08 AM   #8
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
Originally Posted by sirann View Post
http://www.wowace.com/addons/libbossids-1-0/

Already been done, although I'm unsure if it'll be updated for Legion
Oh nice, thanks.
__________________
1/5 15:55:46.001 UNIT_DIED, 0x0000000000000000, nil, 0x80000000, 0xF130001942161FB7, "Gamon", 0xa28
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to detect if mob is boss

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