From e8862743e8edd631248a5470881f79412fb6c4d3 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 14 Apr 2019 19:12:38 +0200 Subject: [PATCH] castbar: use more generic way to calculate delays --- modules/castbar.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/castbar.lua b/modules/castbar.lua index b6851027..25b054fd 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -127,9 +127,15 @@ pfUI:RegisterModule("castbar", 20400, function () if not UnitIsUnit(this.unitstr, "player") then return end if event == CASTBAR_EVENT_CAST_DELAY then - this.delay = ( this.delay or 0 ) + arg1/1000 + local name = this.unitstr and UnitName(this.unitstr) or this.unitname + local isCast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(name) + if not isCast then return end + this.delay = this.delay + (endTime - this.endTime) / 1000 elseif event == CASTBAR_EVENT_CHANNEL_DELAY then - this.delay = ( this.delay or 0 ) + this.bar:GetValue() - arg1/1000 + local name = this.unitstr and UnitName(this.unitstr) or this.unitname + local isChannel, _, _, _, startTime, endTime = UnitChannelInfo(name) + if not isChannel then return end + this.delay = ( this.delay or 0 ) + this.bar:GetValue() - (endTime/1000 - GetTime()) end end)