View Single Post
05-12-17, 12:56 AM   #22
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Sorry for interrupting

I got a further question to MunkDev.

So, I was trying to apply same method to target's debuff and here I got some issue.

Lua Code:
  1. local auraIDList = {
  2.     233490,
  3.     233496,
  4.     233497,
  5.     233498,
  6.     233499,
  7. };
  8.  
  9. local function UpdateDebuff(self)
  10.     self:ReleaseAll();
  11.  
  12.     local prevButton;
  13.     for i, auraID in pairs(auraIDList) do
  14.         local spellName = GetSpellInfo(auraID);
  15.         local _, _, icon, count, _, duration, expires = UnitDebuff("target", spellName, nil, "PLAYER");
  16.  
  17.         if duration and duration >= 0 then
  18.             local button = self:Acquire();
  19.  
  20.             button.spellID = buffID;
  21.             button.cd:SetCooldown(expires - duration, duration);
  22.             button.icon:SetTexture(icon);
  23.             button.count:SetText((count and count > 1) and count or "");
  24.  
  25.             button:Show();
  26.  
  27.             if prevButton then
  28.                 button:SetPoint("LEFT", prevButton, "RIGHT", gap, 0);
  29.             else
  30.                 button:SetPoint("LEFT");
  31.             end
  32.  
  33.             prevButton = button;
  34.         end
  35.     end
  36.  
  37.     self:SetSize(self.numActiveObjects > 0 and ((size + gap) * self.numActiveObjects) - gap or 0, size);
  38. end

Those auraIDs are all "Unstable Affliction (UA)" of Affliction Warlock.

233490 / 233496 / 233497 / 233498 / 233499

The problem is since I am passing a spellName as an argument of UnitDebuff() function, casting UA once will generate five buttons at the same time as they all have same names, but different id

To track a specific UA debuff, I guess I should pass an index of an aura as an argument rather than a name, but looping through all debuffs sounds inefficient to me.
  Reply With Quote