View Single Post
03-21-11, 06:46 AM   #3
oomp
A Murloc Raider
 
oomp's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 7
Don't use destGUID, use destFlags...

Lua Code:
  1. local function GetIconIndex(flags)
  2.     local number, mask, mark
  3.     if bit.band(flags, COMBATLOG_OBJECT_SPECIAL_MASK) ~= 0 then
  4.         for i=1,8 do
  5.             mask = COMBATLOG_OBJECT_RAIDTARGET1 * (2 ^ (i - 1))
  6.             mark = bit.band(flags, mask) == mask
  7.             if mark then number = i break end
  8.         end
  9.     end
  10.     return number
  11. end

This will return a number from 1 to 8 corresponding to each mark, or nil if the target doesn't have a mark, see here for more information. However, if you are intent on using destGUID, I suppose you could do the following, assuming the unit you are checking is a player with a valid unitId:

Lua Code:
  1. local function GetRaidTargetIndexFromGUID(guid)
  2.     local name = select(6, GetPlayerInfoByGUID(guid)) -- Get the unit's name; works globally
  3.     local icon = GetRaidTargetIndex(name) -- Returns a number from 1 to 8, or nil
  4.     return icon
  5. end

Last edited by oomp : 03-22-11 at 08:15 AM.
  Reply With Quote