WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How to detect if mob is boss (https://www.wowinterface.com/forums/showthread.php?t=53547)

lieandswell 06-09-16 08:36 AM

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.

syncrow 06-09-16 08:54 AM

Lua Code:
  1. if UnitClassification(unit) == "worldboss" then

sezz 06-09-16 09:01 AM

Quote:

Originally Posted by syncrow (Post 315512)
Lua Code:
  1. if UnitClassification(unit) == "worldboss" then

afaik it returns elite for faction bosses

lieandswell 06-09-16 09:02 AM

Quote:

Originally Posted by sezz (Post 315513)
afaik it returns elite for faction bosses

Yes, it does. Was hoping there was something else.

Edit: It also returns elite for instance bosses.

syncrow 06-09-16 09:42 AM

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

lieandswell 06-09-16 10:00 AM

Quote:

Originally Posted by syncrow (Post 315515)
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.

sirann 06-09-16 10:05 AM

http://www.wowace.com/addons/libbossids-1-0/

Already been done, although I'm unsure if it'll be updated for Legion

lieandswell 06-09-16 10:08 AM

Quote:

Originally Posted by sirann (Post 315517)
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.


All times are GMT -6. The time now is 03:36 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI