Hello guys, can some one show me how to edit this code, for showing the cast time in seconds/minutes/hours etc. ?
For example 1 | 10.0 to 1s | 10s
Lua Code:
cast.OnCastbarUpdate = function(self, elapsed)
local currentTime = GetTime()
if self.casting or self.channeling then
local parent = self:GetParent()
local duration = self.casting and self.duration + elapsed or self.duration - elapsed
if (self.casting and duration >= self.max) or (self.channeling and duration <= 0) then
self.casting = nil
self.channeling = nil
return
end
if parent.unit == 'player' then
if self.delay ~= 0 then
self.Time:SetFormattedText('%.1f | |cffff0000%.1f|r', duration, self.casting and self.max + self.delay or self.max - self.delay)
else
self.Time:SetFormattedText('%.1f | %.1f', duration, self.max)
if self.SafeZone and self.SafeZone.timeDiff then
self.Lag:SetFormattedText("%d ms", self.SafeZone.timeDiff * 1000)
end
end
else
self.Time:SetFormattedText('%.1f-%.1f', duration, self.casting and self.max + self.delay or self.max - self.delay)
end
self.duration = duration
self:SetValue(duration)
self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
else
self.Spark:Hide()
local alpha = self:GetAlpha() - 0.02
if alpha > 0 then
self:SetAlpha(alpha)
else
self.fadeOut = nil
self:Hide()
end
end
end