From ce1c49fcbb13db9db03f5c6470750d7e8b2d9aa3 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Fri, 24 Jul 2026 18:20:06 -0500 Subject: [PATCH] Make focus/focustarget event-driven via ClassicAPI unit events ClassicAPI now fires UNIT_* (health/mana/aura/...) with arg1 == "focus" and arg1 == "focustarget", observed per-unit like target/party/raid. Both frames already registered those events (focus/focustarget are in pfValidUnits) and their OnEvent already matches arg1 == label, so the 0.2s polling ticks were pure workarounds for the missing events. Drop both ticks; the frames now refresh on-event like target, with range/glow still on the shared 0.5s state pass and PLAYER_FOCUS_CHANGED still driving assign/clear. --- modules/focus.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/focus.lua b/modules/focus.lua index ee6e395a..207e7f8b 100644 --- a/modules/focus.lua +++ b/modules/focus.lua @@ -2,20 +2,22 @@ pfUI:RegisterModule("focus", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end - pfUI.uf.focus = pfUI.uf:CreateUnitFrame("Focus", nil, C.unitframes.focus, .2) + pfUI.uf.focus = pfUI.uf:CreateUnitFrame("Focus", nil, C.unitframes.focus) pfUI.uf.focus:UpdateFrameSize() pfUI.uf.focus:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", 220, 220) UpdateMovable(pfUI.uf.focus) pfUI.uf.focus:Hide() - pfUI.uf.focustarget = pfUI.uf:CreateUnitFrame("FocusTarget", nil, C.unitframes.focustarget, .2) + pfUI.uf.focustarget = pfUI.uf:CreateUnitFrame("FocusTarget", nil, C.unitframes.focustarget) pfUI.uf.focustarget:UpdateFrameSize() pfUI.uf.focustarget:SetPoint("BOTTOMLEFT", pfUI.uf.focus, "TOP", 0, 10) UpdateMovable(pfUI.uf.focustarget) pfUI.uf.focustarget:Hide() -- PLAYER_FOCUS_CHANGED drives immediate refresh on focus assign / clear. - -- The frame's 0.2s tick keeps health/power/aura data fresh between events. + -- Between events, ClassicAPI fires UNIT_* (health/mana/aura/...) with + -- arg1 == "focus" and arg1 == "focustarget", so both frames update + -- event-driven like target and need no polling tick. local refresher = CreateFrame("Frame") refresher:RegisterEvent("PLAYER_FOCUS_CHANGED") refresher:SetScript("OnEvent", function()