I'v been writing a large overhaul addon for a while now mainly as a project for fun and myself but i'm putting it on wow interface as well and I am struggling with an OmniCC style text display on my action bars. I'm using GetActionCooldown and it is working fine for the bottom left action bar but on the main action bar it doesn't seem to be showing the duration properly and I can't work out why. I have checked the outputs from the function and it seems that the problem is the values that are being returned from GetActionCooldown(). If someone would mind having a look and giving me some advice I would be very grateful. (I have included the section of code here and also linked my addon so people can have a look at the whole thing).
Code:
local function formatTime(duration)
local outputValue = ""
if duration > 3600 then
return math.floor(duration / 3600) .."H"
elseif duration > 60 then
return math.floor(duration / 60) .."M"
else
return math.floor(duration)
end
end
local function OnUpdate(self, elapsed)
waiting = waiting + elapsed
if waiting > updateInterval then
for i = 1, 24 do
local totalI = 0
if i < 13 then totalI = i
else totalI = i + 48 end
local start, duration, enable = GetActionCooldown(totalI)
local timeLeft = ((start + duration) - GetTime())
if duration > 1 then
cooldownTimer[i]:SetText(formatTime(timeLeft))
else
cooldownTimer[i]:SetText("")
end
end
end
end
local update = CreateFrame("Frame")
update:SetScript("OnUpdate", OnUpdate)