Skip to content

Commit 3d3748b

Browse files
committed
Enhance Friends tooltip and unitframe timers
Refactor Friends tooltip data handling to use explicit game account fields and self.data, improving display accuracy and readability (character/realm/class/faction/zone/level/richPresence/wowProjectID). Add TimerunningUtil icon support, better TBC realm parsing from richPresence, faction client icons, async client texture handling, and unified grey color for inactive lines. Also normalize note and broadcast icon/formatting. UnitFrames: adjust button cooldown behavior for raid frames (hide countdown numbers only for raid), expose cooldown text region and set font/size to match UI font. Add isRaid detection from element.__owner.mystyle. Castbar: update spark position during casts based on elapsed/total and show/hide spark appropriately. These changes fix tooltip inconsistencies, improve cross-project realm handling, and make cast/cooldown visuals more accurate for raid and non-raid frames.
1 parent 5bc9d84 commit 3d3748b

3 files changed

Lines changed: 78 additions & 44 deletions

File tree

KkthnxUI/Modules/DataText/Elements/Friends.lua

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -532,66 +532,85 @@ local function buttonOnEnter(self)
532532
GameTooltip:AddLine(L["BN"], 0.4, 0.6, 1)
533533
GameTooltip:AddLine(" ")
534534

535-
local qIndex, accountName, _, _, _, _, _, _, _, note, bCastText, bCastTime = unpack(data)
536-
local numAcc = C_BattleNet_GetFriendNumGameAccounts(qIndex) or 0
537-
538-
for i = 1, numAcc do
539-
local info = C_BattleNet_GetFriendGameAccountInfo(qIndex, i)
540-
if info then
541-
local charName = info.characterName or ""
542-
local client = info.clientProgram
543-
if client == BNET_CLIENT_WOW then
544-
if charName ~= "" then
545-
if info.timerunningSeasonID and _G.TimerunningUtil and _G.TimerunningUtil.AddSmallIcon then
546-
charName = _G.TimerunningUtil.AddSmallIcon(charName)
547-
end
535+
local index, accountName, _, _, _, _, _, _, _, note, broadcastText, broadcastTime = unpack(self.data)
536+
local numGameAccounts = C_BattleNet_GetFriendNumGameAccounts(index)
537+
for i = 1, numGameAccounts do
538+
local gameAccountInfo = C_BattleNet_GetFriendGameAccountInfo(index, i)
539+
local charName = gameAccountInfo.characterName
540+
local client = gameAccountInfo.clientProgram
541+
local realmName = gameAccountInfo.realmName or ""
542+
local faction = gameAccountInfo.factionName
543+
local class = gameAccountInfo.className or UNKNOWN
544+
local zoneName = gameAccountInfo.areaName or UNKNOWN
545+
local level = gameAccountInfo.characterLevel
546+
local gameText = gameAccountInfo.richPresence or ""
547+
local wowProjectID = gameAccountInfo.wowProjectID
548+
local clientString = ""
549+
local timerunningSeasonID = gameAccountInfo.timerunningSeasonID
550+
if client == BNET_CLIENT_WOW then
551+
if charName ~= "" then -- fix for weird account
552+
if timerunningSeasonID then
553+
charName = TimerunningUtil.AddSmallIcon(charName) -- add timerunning tag on name
554+
end
555+
realmName = (K.Realm == realmName or realmName == "") and "" or "-" .. realmName
548556

549-
local rName = (K.Realm == info.realmName or info.realmName == "") and "" or "-" .. info.realmName
550-
if info.wowProjectID == WOW_PROJECT_CATA then
551-
local r, count = string_gsub(info.richPresence or "", "^.-%-%s", "")
552-
if count and count > 0 then
553-
rName = "-" .. r
554-
end
557+
-- Get TBC realm name from richPresence
558+
if wowProjectID == WOW_PROJECT_CATA then
559+
local realm, count = gsub(gameText, "^.-%-%s", "")
560+
if count > 0 then
561+
realmName = "-" .. realm
555562
end
563+
end
556564

557-
local color = K.ColorClass(K.ClassList[info.className] or info.className)
558-
local classHex = K.RGBToHex(color.r, color.g, color.b)
559-
local factionIconString = (info.factionName == "Horde" or info.factionName == "Alliance") and ("|TInterface\\FriendsFrame\\PlusManz-" .. info.factionName .. ":16:|t") or ""
560-
561-
GameTooltip:AddLine(string_format("%s%s %s%s%s", factionIconString, info.characterLevel or 0, classHex, charName, rName))
562-
local areaLabel = info.areaName or _G.UNKNOWN
563-
if info.wowProjectID ~= WOW_PROJECT_ID then
564-
areaLabel = "*" .. areaLabel
565-
end
566-
GameTooltip:AddLine(string_format("%s%s", inactiveColor, areaLabel))
565+
class = K.ClassList[class]
566+
local classColor = K.RGBToHex(K.ColorClass(class))
567+
if faction == "Horde" then
568+
clientString = "|TInterface\\FriendsFrame\\PlusManz-Horde:16:|t"
569+
elseif faction == "Alliance" then
570+
clientString = "|TInterface\\FriendsFrame\\PlusManz-Alliance:16:|t"
567571
end
568-
else
569-
GameTooltip:AddLine(string_format("|cffffffff%s%s", getClientLogo(client, 16), accountName or _G.UNKNOWN))
570-
if info.richPresence ~= "" then
571-
GameTooltip:AddLine(string_format("%s%s", inactiveColor, info.richPresence or ""))
572+
GameTooltip:AddLine(string_format("%s%s %s%s%s", clientString, level, classColor, charName, realmName))
573+
574+
if wowProjectID ~= WOW_PROJECT_ID then
575+
zoneName = "*" .. zoneName
572576
end
577+
GameTooltip:AddLine(string_format("%s%s", K.GreyColor, zoneName))
578+
end
579+
else
580+
if C_Texture.IsTitleIconTextureReady(client, Enum.TitleIconVersion.Small) then
581+
C_Texture.GetTitleIconTexture(client, Enum.TitleIconVersion.Small, function(success, texture)
582+
if success then
583+
clientString = BNet_GetClientEmbeddedTexture(texture, 32, 32, 0)
584+
end
585+
end)
586+
end
587+
GameTooltip:AddLine(string_format("|cffffffff%s%s", clientString, accountName))
588+
if gameText ~= "" then
589+
GameTooltip:AddLine(string_format("%s%s", K.GreyColor, gameText))
573590
end
574591
end
575592
end
576593

577594
if note and note ~= "" then
578595
GameTooltip:AddLine(" ")
579-
GameTooltip:AddLine(string_format(noteIconString, note), 1, 0.8, 0)
596+
GameTooltip:AddLine(string_format("|T" .. "Interface\\Buttons\\UI-GuildButton-PublicNote-Up" .. ":16|t %s", note), 1, 0.8, 0)
580597
end
581-
if bCastText and bCastText ~= "" then
598+
599+
if broadcastText and broadcastText ~= "" then
582600
GameTooltip:AddLine(" ")
583-
GameTooltip:AddLine(string_format(broadcastIconString, bCastText, FriendsFrame_GetLastOnline(bCastTime)), 0.3, 0.5, 0.7, 1)
601+
GameTooltip:AddLine(string_format("|TInterface\\FriendsFrame\\BroadcastIcon:12|t %s (%s)", broadcastText, FriendsFrame_GetLastOnline(broadcastTime)), 0.3, 0.6, 0.8)
584602
end
585603
else
586604
GameTooltip:AddLine(L["WoW"], 1, 0.8, 0)
587605
GameTooltip:AddLine(" ")
588-
local name, level, class, area, _, note = unpack(data)
589-
local color = K.ColorClass(class)
590-
GameTooltip:AddLine(string_format("%s %s%s", level, K.RGBToHex(color.r, color.g, color.b), name))
591-
GameTooltip:AddLine(string_format("%s%s", inactiveColor, area))
606+
local name, level, class, area, _, note = unpack(self.data)
607+
local classColor = K.RGBToHex(K.ColorClass(class))
608+
GameTooltip:AddLine(string_format("%s %s%s", level, classColor, name))
609+
GameTooltip:AddLine(string_format("%s%s", K.GreyColor, area))
610+
592611
if note and note ~= "" then
593612
GameTooltip:AddLine(" ")
594-
GameTooltip:AddLine(string_format(noteIconString, note), 1, 0.8, 0)
613+
GameTooltip:AddLine(string_format("|T" .. "Interface\\Buttons\\UI-GuildButton-PublicNote-Up" .. ":16|t %s", note), 1, 0.8, 0)
595614
end
596615
end
597616
GameTooltip:Show()

KkthnxUI/Modules/UnitFrames/Core.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,14 @@ function Module.PostCreateButton(element, button)
587587
button.Count = button.Count or K.CreateFontString(parentFrame, fontSize - 1, "", "OUTLINE", false, "BOTTOMRIGHT", 6, -3)
588588

589589
-- COOLDOWN CONFIG (IF PRESENT)
590+
local isRaid = element.__owner.mystyle == "raid"
590591
if button.Cooldown then
591-
button.Cooldown.noOCC = true
592-
button.Cooldown.noCooldownCount = true
593592
button.Cooldown:SetReverse(true)
594-
button.Cooldown:SetHideCountdownNumbers(true)
593+
button.Cooldown:SetHideCountdownNumbers(isRaid)
594+
595+
button.CooldownText = button.Cooldown:GetRegions()
596+
button.CooldownText:SetFontObject(K.UIFontOutline)
597+
button.CooldownText:SetFont(select(1, button.CooldownText:GetFont()), fontSize, select(3, button.CooldownText:GetFont()))
595598
end
596599

597600
-- ICON BASELINE

KkthnxUI/Modules/UnitFrames/Elements/Castbar.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,17 @@ function Module:CustomTimeText(durationObject)
233233
delayText = string_format("|cffff0000%s%.2f|r", self.channeling and "-" or "+", self.delay)
234234
end
235235
self.Time:SetFormattedText("%.1f%s - %.1f", duration, delayText, total)
236+
237+
if total and total > 0 and duration > 0 and duration < total then
238+
local elapsed = total - duration
239+
self.Spark:SetPoint("CENTER", self, "LEFT", (elapsed / total) * self:GetWidth(), 0)
240+
if self.Spark.Hide then
241+
self.Spark:Show()
242+
end
243+
else
244+
if self.Spark.Hide then
245+
self.Spark:Hide()
246+
end
247+
end
236248
end
237249
end

0 commit comments

Comments
 (0)