View Single Post
07-22-13, 01:55 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by semlar View Post
I'm not sure if you're suggesting this or asking how, but basically what you would do is on that event make a for loop from 1 to MAX_BOSS_FRAMES, check if UnitGUID('boss'..i) exists, and if it does extract the npc ID and compare it to the one in your list.
Code:
local BossesToCheck = {
   [68476] = true, -- Horridon
   [69017] = true, -- Primordius
}

local MyAddon = CreateFrame("Frame")
MyAddon:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
MyAddon:SetScript("OnEvent", function(self, event, ...)
   for i = 1, MAX_BOSS_FRAMES do
      local guid = UnitGUID("boss"..i)
      if guid then
         local mobid = tonumber(strsub(guid, 6, 10), 16)
         if BossesToCheck[mobid] then
            -- You are engaged with one of the bosses on your list.
            return
         end
      end
   end
   -- If you didn't return out by now, you're not engaged with any of the listed bosses.
end)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote