diff --git a/env/locales_deDE.lua b/env/locales_deDE.lua index b003060b..aac674c3 100644 --- a/env/locales_deDE.lua +++ b/env/locales_deDE.lua @@ -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.", } diff --git a/env/locales_enUS.lua b/env/locales_enUS.lua index 59aec467..28e7be5f 100644 --- a/env/locales_enUS.lua +++ b/env/locales_enUS.lua @@ -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", } diff --git a/env/locales_esES.lua b/env/locales_esES.lua index 2bd50411..4ad26a79 100644 --- a/env/locales_esES.lua +++ b/env/locales_esES.lua @@ -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", } diff --git a/env/locales_frFR.lua b/env/locales_frFR.lua index 6b7544c1..74d9f883 100644 --- a/env/locales_frFR.lua +++ b/env/locales_frFR.lua @@ -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", } diff --git a/env/locales_koKR.lua b/env/locales_koKR.lua index ca0d5508..62441b84 100644 --- a/env/locales_koKR.lua +++ b/env/locales_koKR.lua @@ -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 = "초", } diff --git a/env/locales_ruRU.lua b/env/locales_ruRU.lua index 79a5dba6..974de6f8 100644 --- a/env/locales_ruRU.lua +++ b/env/locales_ruRU.lua @@ -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 = "сек", } diff --git a/env/locales_zhCN.lua b/env/locales_zhCN.lua index 3ab45124..0eea5448 100644 --- a/env/locales_zhCN.lua +++ b/env/locales_zhCN.lua @@ -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 = "秒", } diff --git a/modules/lossofcontrol.lua b/modules/lossofcontrol.lua index d369fbe2..e54985b0 100644 --- a/modules/lossofcontrol.lua +++ b/modules/lossofcontrol.lua @@ -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)