from retail

This commit is contained in:
NoM0Re
2025-01-08 00:24:04 +01:00
parent 2f96cddc7d
commit 988145737d
8 changed files with 132 additions and 49 deletions
+24 -2
View File
@@ -3370,8 +3370,30 @@ do
if not castLatencyFrame then
castLatencyFrame = CreateFrame("Frame")
castLatencyFrame:RegisterEvent("CURRENT_SPELL_CAST_CHANGED")
castLatencyFrame:SetScript("OnEvent", function(event)
Private.LAST_CURRENT_SPELL_CAST_CHANGED = GetTime()
castLatencyFrame:RegisterEvent("UNIT_SPELLCAST_START")
castLatencyFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
castLatencyFrame:RegisterEvent("UNIT_SPELLCAST_STOP")
castLatencyFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
castLatencyFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
castLatencyFrame:SetScript("OnEvent", function(self, event, unit)
if unit and unit ~= "player" then return end
if event == "UNIT_SPELLCAST_START" then
Private.LAST_CURRENT_SPELL_CAST_START = select(4, UnitCastingInfo("player")) / 1000
elseif event == "UNIT_SPELLCAST_CHANNEL_START" then
Private.LAST_CURRENT_SPELL_CAST_START = select(4, UnitChannelInfo("player")) / 1000
elseif event == "CURRENT_SPELL_CAST_CHANGED" then
-- We want to store the CURRENT_SPELL_CAST_CHANGED time
-- that was the last before the actual START event
-- This prevents updating the CURRENT_SPELL_CAST_CHANGED time after
-- we got the start time
if not Private.LAST_CURRENT_SPELL_CAST_START then
Private.LAST_CURRENT_SPELL_CAST_CHANGED = GetTime()
end
else -- STOP EVENTS
Private.LAST_CURRENT_SPELL_CAST_START = nil
end
end)
end
end