diff --git a/src/Unit/Unit.lua b/src/Unit/Unit.lua index 07182b0..da7cb9a 100644 --- a/src/Unit/Unit.lua +++ b/src/Unit/Unit.lua @@ -428,6 +428,25 @@ function Unit:GetCastingOrChannelingSpell() return nil end +function Unit:GetEmpowerStage() + local stage = 0 + local _, _, _, startTime, _, _, _, spellID, _, totalStages = UnitChannelInfo(self:GetOMToken()) + + if totalStages and totalStages > 0 then + startTime = startTime / 1000 + local currentTime = GetTime() + local stageDuration = 0 + for i = 1, totalStages do + stageDuration = stageDuration + GetUnitEmpowerStageDuration((self:GetOMToken()), i - 1) / 1000 + if startTime + stageDuration > currentTime then + break -- Break early so we don't keep checking, we haven't hit this stage yet + end + stage = i + end + end + return stage +end + -- Get the end time of the cast or channel ---@return number function Unit:GetCastingOrChannelingEndTime()