View Single Post
05-12-17, 03:48 AM   #25
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Drycoded, haven't tested anything...

Lua Code:
  1. local IDs = {
  2.     [233490] = true,
  3.     [233496] = true,
  4.     [233497] = true,
  5.     [233498] = true,
  6.     [233499] = true,
  7. }
  8.  
  9. local UAs = {}
  10.  
  11. local function UpdateDebuff(self)
  12.     self:ReleaseAll()
  13.  
  14.     for i = 1, 40 do
  15.         local _, _, icon, count, _, duration, expires, _, _, _, spellID = UnitDebuff("target", i, "PLAYER")
  16.  
  17.         -- if there's no spellID it means there's less than 40 auras
  18.         if not spellID then
  19.             break
  20.         end
  21.  
  22.         -- search for UAs
  23.         if IDs[spellID] and duration and duration >= 0 then
  24.             UAs[#UAs + 1] = {
  25.                 id = spellID,
  26.                 icon = icon,
  27.                 count = count or 1,
  28.                 start = expires - duration,
  29.                 duration = duration,
  30.             }
  31.         end
  32.     end
  33.  
  34.     -- do something w/ present auras
  35.     local prevButton
  36.  
  37.     for i = 1, #UAs do
  38.         local info = UAs[i]
  39.         local button = self:Acquire()
  40.  
  41.         button.spellID = info.id
  42.         button.cd:SetCooldown(info.start, info.duration)
  43.         button.icon:SetTexture(info.icon)
  44.         button.count:SetText(info.count > 1 and info.count or "")
  45.  
  46.         if prevButton then
  47.             button:SetPoint("LEFT", prevButton, "RIGHT", gap, 0)
  48.         else
  49.             button:SetPoint("LEFT")
  50.         end
  51.  
  52.         button:Show()
  53.  
  54.         prevButton = button
  55.  
  56.         UAs[i] = nil
  57.     end
  58.  
  59.     self:SetSize(self.numActiveObjects > 0 and ((size + gap) * self.numActiveObjects) - gap or 0, size)
  60. end

Originally Posted by Layback_ View Post
(1) What if my spell doesn't get included within those 40 debuffs?
Highly unlikely O_o

Originally Posted by Layback_ View Post
(2) Would there be a variable that stores number of unit's (not only target's, but for others' as well) buff/debuff?

I mean something like BUFF_ACTUAL_DISPLAY/DEBUFF_ACTUAL_DISPLAY for player.
IIRC, nope...
__________________

Last edited by lightspark : 05-12-17 at 04:03 AM.
  Reply With Quote