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.
This commit is contained in:
Brues
2026-10-29 22:40:30 -05:00
parent ba752056ad
commit 2d275c53fa
+8 -9
View File
@@ -29,20 +29,20 @@ pfUI:RegisterModule("afkcam", function ()
overlay:SetFrameStrata("DIALOG") overlay:SetFrameStrata("DIALOG")
overlay:SetAllPoints(WorldFrame) overlay:SetAllPoints(WorldFrame)
overlay:SetScript("OnMouseUp",function() -- /afk toggles, so send it only while AFK is still set: once the client
SendChatMessage("","AFK") -- or the server has cleared it, /afk would set it again
this._parent:stop() local function Wake()
end) if IsChatAFK() then SendChatMessage("", "AFK") end
afkcam:stop()
end
overlay:SetScript("OnMouseUp", Wake)
overlay:SetScript("OnShow", function() overlay:SetScript("OnShow", function()
this:EnableKeyboard(true) this:EnableKeyboard(true)
end) end)
overlay:SetScript("OnHide", function() overlay:SetScript("OnHide", function()
this:EnableKeyboard(false) this:EnableKeyboard(false)
end) end)
overlay:SetScript("OnKeyUp",function() overlay:SetScript("OnKeyUp", Wake)
SendChatMessage("","AFK")
this._parent:stop()
end)
overlay:Hide() overlay:Hide()
local chat = CreateFrame("ScrollingMessageFrame", "pfAFKCamChat", overlay) local chat = CreateFrame("ScrollingMessageFrame", "pfAFKCamChat", overlay)
@@ -82,7 +82,6 @@ pfUI:RegisterModule("afkcam", function ()
end) end)
overlay.chat = chat overlay.chat = chat
overlay._parent = afkcam
afkcam.overlay = overlay afkcam.overlay = overlay
local clock = CreateFrame("Frame", "pfAFKClock", overlay) local clock = CreateFrame("Frame", "pfAFKClock", overlay)