GetPowerRegen will return how much energy a unit get per second, since i want in combat.
local inactiveRegen, activeRegen = GetPowerRegen() - Will only use activeRegen
To get how many seconds i need to wait before my energy is full, i should get total of my energy right?
local maxEnergy = UnitPowerMax("player" ,3)
Example: maxEnergy = 100 , activeRegen = 1, PlayerEnergy = 25
From 25 to 100 that will be 75 seconds:
25-100/1 = 75
maxEnergy = 100, activeRegen = 2, PlayerEnergy = 20
20-100/2 = 40
Is that working?
PlayerEnergy - maxEnergy / activeRegen = TIMETOMAX?
PHP Code:
local _, regenTime = GetPowerRegen()
local EnergyMax = UnitPowerMax("player" [, 3])
local EnergyActual = UnitPower("player" [, 3])
local Compare = ((EnergyActual - EnergyMax) / regenTime)