From 2d275c53fab01cc466a2ed4291db9f5ecfcb7a97 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:40:30 -0500 Subject: [PATCH] Clear AFK on wake only while it is still set /afk toggles. The overlay sent it on every click and key press, so when the client or the server had already cleared AFK it set it again. Check ClassicAPI's IsChatAFK first. It follows the client's /afk state at once, where UnitIsAFK waits for the server's flag update. --- modules/afkcam.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/afkcam.lua b/modules/afkcam.lua index 544675f6..7be1e50c 100644 --- a/modules/afkcam.lua +++ b/modules/afkcam.lua @@ -29,20 +29,20 @@ pfUI:RegisterModule("afkcam", function () overlay:SetFrameStrata("DIALOG") overlay:SetAllPoints(WorldFrame) - overlay:SetScript("OnMouseUp",function() - SendChatMessage("","AFK") - this._parent:stop() - end) + -- /afk toggles, so send it only while AFK is still set: once the client + -- or the server has cleared it, /afk would set it again + local function Wake() + if IsChatAFK() then SendChatMessage("", "AFK") end + afkcam:stop() + end + overlay:SetScript("OnMouseUp", Wake) overlay:SetScript("OnShow", function() this:EnableKeyboard(true) end) overlay:SetScript("OnHide", function() this:EnableKeyboard(false) end) - overlay:SetScript("OnKeyUp",function() - SendChatMessage("","AFK") - this._parent:stop() - end) + overlay:SetScript("OnKeyUp", Wake) overlay:Hide() local chat = CreateFrame("ScrollingMessageFrame", "pfAFKCamChat", overlay) @@ -82,7 +82,6 @@ pfUI:RegisterModule("afkcam", function () end) overlay.chat = chat - overlay._parent = afkcam afkcam.overlay = overlay local clock = CreateFrame("Frame", "pfAFKClock", overlay)