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:
local auraIDList = {
233490,
233496,
233497,
233498,
233499,
};
local function UpdateDebuff(self)
self:ReleaseAll();
local prevButton;
for i, auraID in pairs(auraIDList) do
local spellName = GetSpellInfo(auraID);
local _, _, icon, count, _, duration, expires = UnitDebuff("target", spellName, nil, "PLAYER");
if duration and duration >= 0 then
local button = self:Acquire();
button.spellID = buffID;
button.cd:SetCooldown(expires - duration, duration);
button.icon:SetTexture(icon);
button.count:SetText((count and count > 1) and count or "");
button:Show();
if prevButton then
button:SetPoint("LEFT", prevButton, "RIGHT", gap, 0);
else
button:SetPoint("LEFT");
end
prevButton = button;
end
end
self:SetSize(self.numActiveObjects > 0 and ((size + gap) * self.numActiveObjects) - gap or 0, size);
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.