mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-31 07:56:57 +00:00
Drive the loss of control alert by events alone
The 0.1s rescan only caught timers that change without a loss of control event: a refreshed debuff fires UNIT_AURA, and a second kick on a locked school fires SPELL_UPDATE_COOLDOWN, after ClassicAPI has read the lockout from the packet. The alert listens to both while it shows. pfUI's cooldown text prints the time left on the icon, so the alert's own countdown and LOSS_OF_CONTROL_SECONDS go.
This commit is contained in:
Vendored
-1
@@ -45,5 +45,4 @@ pfUI_locale["deDE"]["lossofcontrol"] = {
|
||||
LOSS_OF_CONTROL_DISPLAY_SCHOOL_INTERRUPT = "Unterbrochen",
|
||||
LOSS_OF_CONTROL_DISPLAY_SILENCE = "Stille",
|
||||
LOSS_OF_CONTROL_DISPLAY_STUN = "Betäubt",
|
||||
LOSS_OF_CONTROL_SECONDS = "Sek.",
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -45,5 +45,4 @@ pfUI_locale["enUS"]["lossofcontrol"] = {
|
||||
LOSS_OF_CONTROL_DISPLAY_SCHOOL_INTERRUPT = "Interrupted",
|
||||
LOSS_OF_CONTROL_DISPLAY_SILENCE = "Silenced",
|
||||
LOSS_OF_CONTROL_DISPLAY_STUN = "Stunned",
|
||||
LOSS_OF_CONTROL_SECONDS = "seconds",
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -45,5 +45,4 @@ pfUI_locale["esES"]["lossofcontrol"] = {
|
||||
LOSS_OF_CONTROL_DISPLAY_SCHOOL_INTERRUPT = "Interrumpido",
|
||||
LOSS_OF_CONTROL_DISPLAY_SILENCE = "Silenciado",
|
||||
LOSS_OF_CONTROL_DISPLAY_STUN = "Aturdido",
|
||||
LOSS_OF_CONTROL_SECONDS = "segundos",
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -45,5 +45,4 @@ pfUI_locale["frFR"]["lossofcontrol"] = {
|
||||
LOSS_OF_CONTROL_DISPLAY_SCHOOL_INTERRUPT = "Interruption",
|
||||
LOSS_OF_CONTROL_DISPLAY_SILENCE = "Silence",
|
||||
LOSS_OF_CONTROL_DISPLAY_STUN = "Étourdissement",
|
||||
LOSS_OF_CONTROL_SECONDS = "secondes",
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -45,5 +45,4 @@ pfUI_locale["koKR"]["lossofcontrol"] = {
|
||||
LOSS_OF_CONTROL_DISPLAY_SCHOOL_INTERRUPT = "차단",
|
||||
LOSS_OF_CONTROL_DISPLAY_SILENCE = "침묵",
|
||||
LOSS_OF_CONTROL_DISPLAY_STUN = "기절",
|
||||
LOSS_OF_CONTROL_SECONDS = "초",
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -45,5 +45,4 @@ pfUI_locale["ruRU"]["lossofcontrol"] = {
|
||||
LOSS_OF_CONTROL_DISPLAY_SCHOOL_INTERRUPT = "Прерывание",
|
||||
LOSS_OF_CONTROL_DISPLAY_SILENCE = "Немота.",
|
||||
LOSS_OF_CONTROL_DISPLAY_STUN = "Оглушение",
|
||||
LOSS_OF_CONTROL_SECONDS = "сек",
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -45,5 +45,4 @@ pfUI_locale["zhCN"]["lossofcontrol"] = {
|
||||
LOSS_OF_CONTROL_DISPLAY_SCHOOL_INTERRUPT = "打断",
|
||||
LOSS_OF_CONTROL_DISPLAY_SILENCE = "沉默",
|
||||
LOSS_OF_CONTROL_DISPLAY_STUN = "昏迷",
|
||||
LOSS_OF_CONTROL_SECONDS = "秒",
|
||||
}
|
||||
|
||||
+13
-17
@@ -37,17 +37,12 @@ pfUI:RegisterModule("lossofcontrol", function ()
|
||||
frame.cd = CreateFrame("Cooldown", nil, frame.icon, "CooldownFrameTemplate")
|
||||
frame.cd:SetAllPoints(frame.icon.tex)
|
||||
frame.cd.pfCooldownStyleAnimation = 1
|
||||
-- the alert prints the time itself
|
||||
frame.cd.noCooldownCount = true
|
||||
frame.cd.pfCooldownType = "ALL"
|
||||
|
||||
frame.label = frame:CreateFontString(nil, "OVERLAY")
|
||||
frame.label:SetFont(pfUI.font_default, 20, "OUTLINE")
|
||||
frame.label:SetTextColor(NORMAL_FONT_COLOR:GetRGB())
|
||||
frame.label:SetPoint("TOPLEFT", frame.icon, "TOPRIGHT", 8, -4)
|
||||
|
||||
frame.time = frame:CreateFontString(nil, "OVERLAY")
|
||||
frame.time:SetFont(pfUI.font_default, 14, "OUTLINE")
|
||||
frame.time:SetPoint("BOTTOMLEFT", frame.icon, "BOTTOMRIGHT", 8, 4)
|
||||
frame.label:SetPoint("LEFT", frame.icon, "RIGHT", 8, 0)
|
||||
|
||||
frame.Refresh = function(self)
|
||||
local best
|
||||
@@ -70,19 +65,20 @@ pfUI:RegisterModule("lossofcontrol", function ()
|
||||
self.icon.tex:SetTexture(best.iconTexture)
|
||||
end
|
||||
|
||||
-- a refreshed effect or a second kick on the same school changes the
|
||||
-- timer without an event, so this runs again while the alert shows
|
||||
if self.start ~= best.startTime or self.duration ~= best.duration then
|
||||
self.start, self.duration = best.startTime, best.duration
|
||||
CooldownFrame_SetTimer(self.cd, best.startTime or 0, best.duration or 0, best.startTime and 1 or 0)
|
||||
end
|
||||
|
||||
self.time:SetText(best.timeRemaining and format("%.1f %s", best.timeRemaining, strings.LOSS_OF_CONTROL_SECONDS) or "")
|
||||
CooldownFrame_SetTimer(self.cd, best.startTime or 0, best.duration or 0, best.startTime and 1 or 0)
|
||||
self:Show()
|
||||
end
|
||||
|
||||
frame:SetScript("OnUpdate", function()
|
||||
if ( this.tick or 0) > GetTime() then return else this.tick = GetTime() + .1 end
|
||||
-- a refreshed debuff (UNIT_AURA) or a second kick on the same school
|
||||
-- (SPELL_UPDATE_COOLDOWN) changes the timer without a loss of control event
|
||||
frame:SetScript("OnShow", function()
|
||||
this:RegisterUnitEvent("UNIT_AURA", "player")
|
||||
this:RegisterEvent("SPELL_UPDATE_COOLDOWN")
|
||||
end)
|
||||
frame:SetScript("OnHide", function()
|
||||
this:UnregisterAllEvents()
|
||||
end)
|
||||
frame:SetScript("OnEvent", function()
|
||||
this:Refresh()
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user