From e351a69897cded61a1456cebadd2e0b88ded69b6 Mon Sep 17 00:00:00 2001 From: CiscOH Date: Tue, 18 Jul 2023 03:11:52 +0000 Subject: [PATCH] Update 'src/Unit/Unit.lua' added empowered spell stage detection --- src/Unit/Unit.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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()