Code:
local formatTime = function(s)
local day, hour, minute = 86400, 3600, 60
if s >= day then
return format("%dd", floor(s/day + 0.5)), s % day
elseif s >= hour then
return format("%dh", floor(s/hour + 0.5)), s % hour
elseif s >= minute then
return format("%dm", floor(s/minute + 0.5)), s % minute
elseif s >= minute / 12 then
return floor(s + 0.5), (s * 100 - floor(s * 100))/100
end
return format("%.1f", s), (s * 100 - floor(s * 100))/100
end
local setTimer = function (self, elapsed)
if self.timeLeft then
self.elapsed = (self.elapsed or 0) + elapsed
if self.elapsed >= 0.1 then
if not self.first then
self.timeLeft = self.timeLeft - self.elapsed
else
self.timeLeft = self.timeLeft - GetTime()
self.first = false
end
if self.timeLeft > 0 then
local time = formatTime(self.timeLeft)
self.time:SetText(time)
if self.timeLeft < 5 then
self.time:SetTextColor(1, 0.5, 0.5)
else
self.time:SetTextColor(.7, .7, .7)
end
else
self.time:Hide()
self:SetScript("OnUpdate", nil)
end
self.elapsed = 0
end
end
end
lib.PostCreateIcon = function(self, button)
button.cd:SetReverse(true)
button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
button.icon:SetDrawLayer("BACKGROUND")
--Count
button.count:ClearAllPoints()
button.count:SetFont(config.font, 8, "OUTLINEMONOCHROME")
button.count:SetJustifyH("RIGHT")
button.count:SetPoint("TOPRIGHT", button, "TOPRIGHT", 0, 0)
button.count:SetTextColor(1,1,1)
--Helper
local h = CreateFrame("Frame", nil, button)
h:SetFrameLevel(0)
h:SetPoint("TOPLEFT", -0, 0)
h:SetPoint("BOTTOMRIGHT", 0, -0)
lib.gen_backdrop(h)
end
local postUpdateIcon = function(element, unit, button, index)
local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, button.filter)
if duration and duration > 0 then
button.time:Show()
button.timeLeft = expirationTime
button:SetScript("OnUpdate", setTimer)
else
button.time:Hide()
button.timeLeft = math.huge
button:SetScript("OnUpdate", nil)
end
-- Desaturate non-Player Debuffs
if(button.debuff) then
if(unit == "target") then
if (unitCaster == "player" or unitCaster == "vehicle") then
button.icon:SetDesaturated(false)
elseif(not UnitPlayerControlled(unit)) then -- If Unit is Player Controlled don"t desaturate debuffs
button:SetBackdropColor(0, 0, 0)
button.overlay:SetVertexColor(0.3, 0.3, 0.3)
button.icon:SetDesaturated(false)
end
end
end
button:SetScript('OnMouseUp', function(self, mouseButton)
if mouseButton == 'RightButton' then
CancelUnitBuff('player', index)
end end)
button.first = true
end
lib.playBuffs = function(f)
b = CreateFrame("Frame", nil, f)
b.size = 30
if f.mystyle == "target" then
b.num = 40
elseif f.mystyle == "player" then
b.num = 10
b.onlyShowPlayer = true
else
b.num = 5
end
b.spacing = 5
b.onlyShowPlayer = false
b:SetHeight((b.size+b.spacing)*4)
b:SetWidth(f.width)
b:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 0, 500)
b.initialAnchor = "TOPRIGHT"
b["growth-x"] = "LEFT"
b["growth-y"] = "DOWN"
b.PostCreateIcon = lib.PostCreateIcon
f.Buffs = b
BuffFrame:UnregisterEvent("UNIT_AURA")
BuffFrame:Hide()
TemporaryEnchantFrame:Hide()
end
But it didn't seem to change anything. Mind if I ask what I'm missing? >.<