Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local myPostCreateIcon = function(self, button)
- self.showDebuffType = true
- self.disableCooldown = true
- button.cd.noOCC = true
- button.cd.noCooldownCount = true
- button.icon:SetTexCoord(.07, .93, .07, .93)
- button.icon:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0)
- button.icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 0, 0)
- button.overlay:SetTexture(border)
- button.overlay:SetTexCoord(0,1,0,1)
- button.overlay.Hide = function(self) self:SetVertexColor(0.3, 0.3, 0.3) end
- button.time = lib.gen_fontstring(button, cfg.font, 8, "OUTLINEMONOCHROME")
- button.time:SetPoint("CENTER", button, 2, 0)
- button.time:SetJustifyH('CENTER')
- button.time:SetVertexColor(1,1,1)
- button.count = lib.gen_fontstring(button, cfg.font, 8, "OUTLINEMONOCHROME")
- button.count:ClearAllPoints()
- button.count:SetPoint("BOTTOMRIGHT", button, 7, -5)
- button.count:SetVertexColor(1,1,1)
- local h = CreateFrame("Frame", nil, button)
- h:SetFrameLevel(0)
- h:SetPoint("TOPLEFT",-5,5)
- h:SetPoint("BOTTOMRIGHT",5,-5)
- frame1px1(h)
- CreateShadow(h)
- end
- 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 / 1200 then
- return floor(s), (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 < 10 then
- self.time:SetTextColor(1, 0.5, 0.5)
- else
- self.time:SetTextColor(1, 0.8, 0)
- end
- else
- self.time:Hide()
- self:SetScript("OnUpdate", nil)
- end
- self.elapsed = 0
- end
- end
- end
- local postCreateIcon = function(element, button)
- local diffPos = 0
- local self = element:GetParent()
- if self.mystyle == "target" then diffPos = 1 end
- element.disableCooldown = true
- button.cd.noOCC = true
- button.cd.noCooldownCount = true
- local h = CreateFrame("Frame", nil, button)
- h:SetFrameLevel(0)
- h:SetPoint("TOPLEFT",-5,5)
- h:SetPoint("BOTTOMRIGHT",5,-5)
- frame1px1(h)
- CreateShadow(h)
- local time = lib.gen_fontstring(button, cfg.font, 11, "THINOUTLINE")
- time:SetPoint("CENTER", button, "CENTER", 1, -5)
- time:SetJustifyH("CENTER")
- time:SetVertexColor(1,1,1)
- button.time = time
- local count = lib.gen_fontstring(button, cfg.font, 11, "THINOUTLINE")
- count:SetPoint("CENTER", button, "BOTTOMRIGHT", 0, 3)
- count:SetJustifyH("RIGHT")
- button.count = count
- button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
- button.icon:SetDrawLayer("ARTWORK")
- 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
- button:SetScript('OnMouseUp', function(self, mouseButton)
- if mouseButton == 'RightButton' then
- CancelUnitBuff('player', index)
- end end)
- button.first = true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement