--TSU --EVERY FRAME function(allstates) for _,v in pairs(allstates) do v.show = false v.changed = true end for i = 1, 40 do unit = "nameplate" .. i if UnitExists(unit) then local name = UnitName(unit) if name == "Fel Explosives" then if UnitCastingInfo(unit) then local _,_,_,_,startTime,endTime = UnitCastingInfo(unit) local remainingTime = math.floor(endTime - (GetTime() * 1000)) local castTime = endTime - startTime --local hps = aura_env.shorten(UnitHealth(unit)) --local maxhps = aura_env.shorten(UnitHealthMax(unit)) local hp = UnitHealth(unit) local maxhp = UnitHealthMax(unit) local hpp = math.floor((hp / maxhp) * 100) allstates[unit] = { changed = true, show = true, resort = true, progressType = "static", value = remainingTime, total = castTime, index = remainingTime, one = "", two = "", hp = hp, maxhp = maxhp, hpp = hpp, } end end end end return true end --ANIMATION function() if aura_env.statee then local c = aura_env.range(aura_env.statee.hp, 0, aura_env.statee.maxhp, 1) print(aura_env.grad(c)) return aura_env.grad(c) end end --INIT aura_env.shorten = function(val) local function round(var, n) if (n) then var = math.floor((var * 10^n) + 0.5) / (10^n) else var = math.floor(var+0.5) end return var end local n = 2 if val < 1e3 then return round(val, n) elseif val > 1e3 and val < 1e6 then return round(val / 1e3, n) .. "k" elseif val > 1e6 and val < 1e9 then return round(val / 1e6, n) .. "M" elseif val > 1e9 then return round(val / 1e9, n) .. "G" end end aura_env.grad = function(c) --c expected as [0, 1] if c > 0.5 then c = 1 - (2 * (c - 0.5)) return c, 1, 0, 1 else c = c * 2 return 1, c, 0, 1 end end aura_env.range = function(val, min, max, max2) val = 1 - (((max - val) / (max - min)) * max2) return val end