PHP код:
local function createAuraIcon(icons, index) local button = CreateFrame("Button", nil, icons) button:SetWidth(icons.size or 16) button:SetHeight(icons.size or 16) local cd = CreateFrame("frame", nil, button) local count = 0; local icon = button:CreateTexture(nil, "BORDER") icon:SetAllPoints(button) icon:SetTexCoord(0.07, 0.93, 0.07, 0.93) addon.CreateShadow(button) tinsert(icons, button) button.parent = icons button.overlay = overlay button.icon = icon button.icon.shadow = button.shadow icon.visible = 0 button.cd = cd button.cd.count = count return buttonend
local function updateIcon(unit, icons, index, offset, filter, isDebuff, visible) if not unit then return; end local name, rank, texture, count1, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID = UnitAura(unit, index, filter) local player = UnitName('player') if(name and caster==player) then local n = visible + offset + 1 local icon = icons[n] if(not icon) then icon = module:createAuraIcon(icons, n) end local show = true if(show) then local cd = icon.cd local count = icon.cd.count cd:SetScript('OnUpdate', function(self, elps, visible) count = count + elps --print(count) if(duration and duration > 0 and count < duration and duration~=0) then self:GetParent():Show() elseif(count > duration and duration~=0) then self:GetParent():Hide() self:SetScript('OnUpdate', nil) else self:GetParent():Show() self:SetScript('OnUpdate', nil) end end) local color = DebuffTypeColor[dtype] or DebuffTypeColor.none icon.shadow:SetBackdropColor(0, 0, 0, 0) icon.shadow:SetBackdropBorderColor(color.r, color.g, color.b, 1) icon.icon:SetTexture(texture) icon.filter = filter icon.isDebuff = isDebuff icon:SetID(index) icon:Show() return visible end endend
local function filterIcons(unit, icons, filter, limit, isDebuff, offset, dontHide) if(not offset) then offset = 0 end local index = 1 local visible = 0 while(visible < limit) do local result = module:updateIcon(unit, icons, index, offset, filter, isDebuff, visible) if(not result) then break elseif(result == visible) then visible = visible + 1 end index = index + 1 end if(not dontHide) then for i = visible + offset + 1, #icons do icons[i]:Hide() end end
return visibleend
local function SetPosition(icons, x) if(icons and x > 0) then local col = 0 local row = 0 local gap = icons.gap local sizex = (icons.size or 16) + (icons['spacing-x'] or icons.spacing or 0) local sizey = (icons.size or 16) + (icons['spacing-y'] or icons.spacing or 0) local anchor = icons.initialAnchor or "BOTTOMLEFT" local growthx = (icons["growth-x"] == "LEFT" and -1) or 1 local growthy = (icons["growth-y"] == "DOWN" and -1) or 1 local cols = floor(icons:GetWidth() / sizex + .5) local rows = floor(icons:GetHeight() / sizey + .5) for i = 1, #icons do local button = icons[i] if(button and button:IsShown()) then if(gap and button.debuff) then if(col > 0) then col = col + 1 end gap = false end if(col >= cols) then col = 0 row = row + 1 end button:ClearAllPoints() button:SetPoint(anchor, icons, anchor, col * sizex * growthx, row * sizey * growthy) col = col + 1 elseif(not button) then break end end endend
Ну а дальше выводишь их на фрейму и готово.