View Single Post
09-12-15, 01:31 PM   #1
Skudnfroodie
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 3
GetPowerRegen() * (start + duration - GetTime()) rounding problem

Hi,

this code should display the Jab symbol every time the player has enough energy to use Jab and still be able to use Keg Smash when it comes of cooldown.

Code:
local regen = GetPowerRegen()
local power = UnitPower("player")
local start, duration = GetSpellCooldown(121253)
local timeLeft = start + duration - GetTime()

if power + (regen * timeLeft) >= 80 then KSA.icon:SetTexture(GetSpellTexture("Jab")) end
It functions fine in most cases but if the player is right between sufficient and insufficient energy the icon flickers. I'm pretty sure that it's because of some rounding errors but I don't have a solution.
  Reply With Quote