X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/ad67f41cf4019dca1e2ea587019fe825f92fdcf0..08783ecf65f49a14ffc0c47265e488ca4efedb24:/OmaUF/Auras.lua diff --git a/OmaUF/Auras.lua b/OmaUF/Auras.lua index db3a7df..172e3d4 100644 --- a/OmaUF/Auras.lua +++ b/OmaUF/Auras.lua @@ -29,10 +29,6 @@ local function hideTooltip(frame) frame:SetScript("OnUpdate", nil); end -function M.UpdateAuraTooltips() - GameTooltip = _G["GameTooltip"]; -end - local function createAura(parent, prev, anchor, name, unit) local aura = CreateFrame("Frame", name, parent); aura:SetPoint("TOPLEFT", prev, anchor); @@ -40,11 +36,13 @@ local function createAura(parent, prev, anchor, name, unit) aura:SetHeight(20); aura.icon = aura:CreateTexture(nil, "ARTWORK"); aura.icon:SetAllPoints(); + aura.stack = aura:CreateFontString(nil, "OVERLAY", "NumberFontNormalSmall"); + aura.stack:SetPoint("BOTTOMRIGHT"); aura.cd = CreateFrame("Cooldown", name.."CD", aura, "CooldownFrameTemplate"); aura.cd:SetReverse(true); aura.cd:SetHideCountdownNumbers(true); aura.cd:SetAllPoints(); - aura.unit = unit; -- TODO add aura.stack text + aura.unit = unit; aura:SetScript("OnEnter", showTooltip); aura:SetScript("OnLeave", hideTooltip); aura:Hide(); @@ -69,7 +67,7 @@ function M.CreateAuraFrame(parent, unit) i = i + 1; end -- max rows - for y=0,1 do + for y=0,0 do for x=1,10 do local auraName = name..i; parent.auras[i] = createAura(parent.auras, parent.auras[y*10+x], "BOTTOMLEFT", auraName, unit); @@ -80,10 +78,6 @@ end function M.UpdateAuras(frame, unit) local auras = frame.auras; - for _, aura in ipairs(auras) do - if not aura:IsShown() then break end - aura:Hide(); - end local icon, count, duration, expires, caster, id; local pos = 1; for _, filter in ipairs(auraFilters) do @@ -96,6 +90,12 @@ function M.UpdateAuras(frame, unit) aura.icon:SetTexture(icon); aura.index = i; aura.filter = filter; + if count > 1 then + aura.stack:SetText(count); + aura.stack:Show(); + else + aura.stack:Hide(); + end if expires > 0 then aura.cd:SetCooldown(expires - duration, duration); else @@ -106,4 +106,10 @@ function M.UpdateAuras(frame, unit) i = i + 1; end end + + while auras[pos] do + if not auras[pos]:IsShown() then return end + auras[pos]:Hide(); + pos = pos + 1; + end end