castbar: reset delays on new spell casts

This commit is contained in:
shagu
2020-12-08 21:56:39 +01:00
parent 246b9b224f
commit 8c7579ad26
3 changed files with 10 additions and 0 deletions
+3
View File
@@ -5,6 +5,9 @@ if pfUI.expansion ~= "tbc" then return end
-- [[ Constants ]]--
CASTBAR_EVENT_CAST_DELAY = "UNIT_SPELLCAST_DELAYED"
CASTBAR_EVENT_CHANNEL_DELAY = "UNIT_SPELLCAST_CHANNEL_UPDATE"
CASTBAR_EVENT_CAST_START = "UNIT_SPELLCAST_START"
CASTBAR_EVENT_CHANNEL_START = "UNIT_SPELLCAST_CHANNEL_START"
EVENTS_MINIMAP_ZONE_UPDATE = {"PLAYER_ENTERING_WORLD", "ZONE_CHANGED_NEW_AREA", "ZONE_CHANGED"}
MICRO_BUTTONS = {
+3
View File
@@ -5,6 +5,9 @@ if pfUI.expansion ~= "vanilla" then return end
-- [[ Constants ]]--
CASTBAR_EVENT_CAST_DELAY = "SPELLCAST_DELAYED"
CASTBAR_EVENT_CHANNEL_DELAY = "SPELLCAST_CHANNEL_UPDATE"
CASTBAR_EVENT_CAST_START = "SPELLCAST_START"
CASTBAR_EVENT_CHANNEL_START = "SPELLCAST_CHANNEL_START"
EVENTS_MINIMAP_ZONE_UPDATE = {"PLAYER_ENTERING_WORLD", "MINIMAP_ZONE_CHANGED"}
MICRO_BUTTONS = {
+4
View File
@@ -159,6 +159,8 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
local playerarg = nil
cb:RegisterEvent(CASTBAR_EVENT_CAST_DELAY)
cb:RegisterEvent(CASTBAR_EVENT_CHANNEL_DELAY)
cb:RegisterEvent(CASTBAR_EVENT_CAST_START)
cb:RegisterEvent(CASTBAR_EVENT_CHANNEL_START)
cb:SetScript("OnEvent", function()
if this.unitstr and not UnitIsUnit(this.unitstr, "player") then return end
playerarg = pfUI.client <= 11200 or arg1 == "player" and true or nil
@@ -172,6 +174,8 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
local isChannel, _, _, _, startTime, endTime = UnitChannelInfo(this.unitstr or this.unitname)
if not isChannel then return end
this.delay = ( this.delay or 0 ) + this.bar:GetValue() - (endTime/1000 - GetTime())
elseif playerarg then
this.delay = 0
end
end)