mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-03 04:00:02 +00:00
panel: show online friends on mouse over
This commit is contained in:
+21
-1
@@ -306,6 +306,26 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
local widget = CreateFrame("Frame", "pfPanelWidgetFriends", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("FRIENDLIST_UPDATE")
|
||||
widget.Tooltip = function()
|
||||
GameTooltip_SetDefaultAnchor(GameTooltip, this)
|
||||
GameTooltip:ClearLines()
|
||||
GameTooltip:AddLine("|cff555555" .. T["Friends Online"])
|
||||
|
||||
local all = GetNumFriends()
|
||||
local playerzone = GetRealZoneText()
|
||||
|
||||
for friendIndex=1, all do
|
||||
local friend_name, friend_level, friend_class, friend_area, friend_connected = GetFriendInfo(friendIndex)
|
||||
if friend_connected and friend_class and friend_level then
|
||||
local ccolor = RAID_CLASS_COLORS[L["class"][friend_class]] or { 1, 1, 1 }
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
GameTooltip:Show()
|
||||
end
|
||||
widget.Click = function() ToggleFriendsFrame(1) end
|
||||
widget:SetScript("OnEvent", function()
|
||||
local online = 0
|
||||
@@ -317,7 +337,7 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
end
|
||||
end
|
||||
|
||||
pfUI.panel:OutputPanel("friends", FRIENDS .. ": " .. online, nil, widget.Click)
|
||||
pfUI.panel:OutputPanel("friends", FRIENDS .. ": " .. online, widget.Tooltip, widget.Click)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user