From 27a46ffddaa0b0f52f197c7ff2d02b47240cf22a Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 8 Aug 2026 00:10:01 -0500 Subject: [PATCH] Count online friends with C_FriendList.GetNumOnlineFriends Replace the manual loop over GetFriendInfo with a single C_FriendList.GetNumOnlineFriends call in the friends panel widget. --- modules/panel.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/modules/panel.lua b/modules/panel.lua index 11a078b9..d7d38c3a 100644 --- a/modules/panel.lua +++ b/modules/panel.lua @@ -304,7 +304,7 @@ pfUI:RegisterModule("panel", function() GameTooltip:AddLine("|cff555555" .. T["Friends Online"]) init = true end - local ccolor = PFUI_CLASS_COLORS[L["class"][friend_class]] or { 1, 1, 1 } + local ccolor = PFUI_CLASS_COLORS[L["class"][friend_class]] local lcolor = GetDifficultyColor(tonumber(friend_level)) or { 1, 1, 1 } local zcolor = friend_area == playerzone and "|cff33ffcc" or "|cffcccccc" GameTooltip:AddDoubleLine(rgbhex(ccolor) .. friend_name .. rgbhex(lcolor) .. " [" .. friend_level .. "]", zcolor .. friend_area) @@ -315,15 +315,7 @@ pfUI:RegisterModule("panel", function() end widget.Click = function() ToggleFriendsFrame(1) end widget:SetScript("OnEvent", function() - local online = 0 - local all = GetNumFriends() - for friendIndex=1, all do - local friend_name, friend_level, friend_class, friend_area, friend_connected = GetFriendInfo(friendIndex) - if ( friend_connected ) then - online = online + 1 - end - end - + local online = C_FriendList.GetNumOnlineFriends() pfUI.panel:OutputPanel("friends", FRIENDS .. ": " .. online, widget.Tooltip, widget.Click) end) end