From 156d858a2ec38da269d822e1d06504805fe6a4cc Mon Sep 17 00:00:00 2001 From: shagu Date: Sat, 10 Nov 2018 13:41:58 +0100 Subject: [PATCH] castbar: add pushback counter to channel bar --- compat/tbc.lua | 3 ++- compat/vanilla.lua | 3 ++- modules/castbar.lua | 10 ++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/compat/tbc.lua b/compat/tbc.lua index 07109dae..e4a74ef9 100644 --- a/compat/tbc.lua +++ b/compat/tbc.lua @@ -9,7 +9,8 @@ pfUI.module.autoshift = true pfUI.module.itemclick = true -- [[ Constants ]]-- -CASTBAR_DELAY_EVENT = "UNIT_SPELLCAST_DELAYED" -- UNIT_SPELLCAST_CHANNEL_UPDATE ? +CASTBAR_EVENT_CAST_DELAY = "UNIT_SPELLCAST_DELAYED" +CASTBAR_EVENT_CHANNEL_DELAY = "UNIT_SPELLCAST_CHANNEL_UPDATE" NAMEPLATE_OBJECTORDER = { "border", "glow", "_", "_", "name", "level", "levelicon", "raidicon" } diff --git a/compat/vanilla.lua b/compat/vanilla.lua index 6c2748a6..54774c53 100644 --- a/compat/vanilla.lua +++ b/compat/vanilla.lua @@ -4,7 +4,8 @@ setfenv(1, pfUI:GetEnvironment()) if pfUI.client > 11200 then return end -- [[ Constants ]]-- -CASTBAR_DELAY_EVENT = "SPELLCAST_DELAYED" -- SPELLCAST_CHANNEL_UPDATE ? +CASTBAR_EVENT_CAST_DELAY = "SPELLCAST_DELAYED" +CASTBAR_EVENT_CHANNEL_DELAY = "SPELLCAST_CHANNEL_UPDATE" NAMEPLATE_OBJECTORDER = { "border", "glow", "name", "level", "levelicon", "raidicon" } diff --git a/modules/castbar.lua b/modules/castbar.lua index 2f76629a..756b1f65 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -121,10 +121,16 @@ pfUI:RegisterModule("castbar", function () end) -- register for spell delay - cb:RegisterEvent(CASTBAR_DELAY_EVENT) + cb:RegisterEvent(CASTBAR_EVENT_CAST_DELAY) + cb:RegisterEvent(CASTBAR_EVENT_CHANNEL_DELAY) cb:SetScript("OnEvent", function() if not UnitIsUnit(this.unitstr, "player") then return end - this.delay = ( this.delay or 0 ) + arg1/1000 + + if event == CASTBAR_EVENT_CAST_DELAY then + this.delay = ( this.delay or 0 ) + arg1/1000 + elseif event == CASTBAR_EVENT_CHANNEL_DELAY then + this.delay = ( this.delay or 0 ) + this.bar:GetValue() - arg1/1000 + end end) cb:SetAlpha(0)