Update 'src/Unit/Unit.lua'

added empowered spell stage detection
pull/5/head
CiscOH 2 years ago
parent e3d52b41c4
commit e351a69897
  1. 19
      src/Unit/Unit.lua

@ -428,6 +428,25 @@ function Unit:GetCastingOrChannelingSpell()
return nil return nil
end 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 -- Get the end time of the cast or channel
---@return number ---@return number
function Unit:GetCastingOrChannelingEndTime() function Unit:GetCastingOrChannelingEndTime()

Loading…
Cancel
Save