Skip to content

Commit f853301

Browse files
Added new text for displaying party numbers.
1 parent 87a00f5 commit f853301

9 files changed

Lines changed: 315 additions & 2 deletions

File tree

Config.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,18 @@ DF.PartyDefaults = {
12771277
nameTextX = 0,
12781278
nameTextY = -10,
12791279

1280+
-- Party Number Text
1281+
partyIndexTextAnchor = "TOPLEFT",
1282+
partyIndexTextColor = {r = 1, g = 1, b = 1, a = 1},
1283+
partyIndexTextEnabled = false,
1284+
partyIndexTextFont = "DF Roboto SemiBold",
1285+
partyIndexTextFontSize = 10,
1286+
partyIndexTextOutline = "SHADOW",
1287+
partyIndexTextPlayerAtBottom = false,
1288+
partyIndexTextUseClassColor = false,
1289+
partyIndexTextX = 2,
1290+
partyIndexTextY = -2,
1291+
12801292
-- Out of Range
12811293
oorAbsorbBarAlpha = 0.20000000298023,
12821294
oorAurasAlpha = 0.20000000298023,
@@ -2458,6 +2470,18 @@ DF.RaidDefaults = {
24582470
nameTextX = 0,
24592471
nameTextY = -10,
24602472

2473+
-- Party Number Text
2474+
partyIndexTextAnchor = "TOPLEFT",
2475+
partyIndexTextColor = {r = 1, g = 1, b = 1, a = 1},
2476+
partyIndexTextEnabled = false,
2477+
partyIndexTextFont = "DF Roboto SemiBold",
2478+
partyIndexTextFontSize = 10,
2479+
partyIndexTextOutline = "SHADOW",
2480+
partyIndexTextPlayerAtBottom = false,
2481+
partyIndexTextUseClassColor = false,
2482+
partyIndexTextX = 2,
2483+
partyIndexTextY = -2,
2484+
24612485
-- Out of Range
24622486
oorAbsorbBarAlpha = 0.20000000298023,
24632487
oorAurasAlpha = 0.20000000298023,

Core.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,12 @@ function DF:LightweightUpdateFontSize(textType)
533533
if fontOutline == "NONE" then fontOutline = "" end
534534
local size = db.statusTextFontSize or 10
535535
DF:SafeSetFont(frame.statusText, fontPath, size, fontOutline)
536+
elseif textType == "partyIndex" and frame.partyIndexText then
537+
local fontPath = db.partyIndexTextFont or "Fonts\\FRIZQT__.TTF"
538+
local fontOutline = db.partyIndexTextOutline or "OUTLINE"
539+
if fontOutline == "NONE" then fontOutline = "" end
540+
local size = db.partyIndexTextFontSize or 10
541+
DF:SafeSetFont(frame.partyIndexText, fontPath, size, fontOutline)
536542
end
537543
end
538544

@@ -560,6 +566,10 @@ function DF:LightweightUpdateTextPosition(textType)
560566
frame.statusText:ClearAllPoints()
561567
local anchor = db.statusTextAnchor or "BOTTOM"
562568
frame.statusText:SetPoint(anchor, frame, anchor, db.statusTextX or 0, db.statusTextY or 0)
569+
elseif textType == "partyIndex" and frame.partyIndexText then
570+
frame.partyIndexText:ClearAllPoints()
571+
local anchor = db.partyIndexTextAnchor or "TOPLEFT"
572+
frame.partyIndexText:SetPoint(anchor, frame, anchor, db.partyIndexTextX or 2, db.partyIndexTextY or -2)
563573
end
564574
end
565575

@@ -1927,6 +1937,10 @@ function DF:LightweightUpdateTextColor(textType)
19271937
elseif textType == "status" then
19281938
colorKey = "statusTextColor"
19291939
textKey = "statusText"
1940+
elseif textType == "partyIndex" then
1941+
if db.partyIndexTextUseClassColor then return end
1942+
colorKey = "partyIndexTextColor"
1943+
textKey = "partyIndexText"
19301944
else
19311945
return
19321946
end
@@ -1958,13 +1972,21 @@ function DF:LightweightUpdateTextColor(textType)
19581972
else
19591973
alpha = db.rangeFadeAlpha or 0.55
19601974
end
1975+
elseif textType == "partyIndex" then
1976+
if db.oorEnabled then
1977+
alpha = db.oorNameTextAlpha or 0.55
1978+
else
1979+
alpha = db.rangeFadeAlpha or 0.55
1980+
end
19611981
end
19621982
-- Dead fade only applies when in range
19631983
elseif testData.status and db.fadeDeadFrames then
19641984
if textType == "name" then
19651985
alpha = db.fadeDeadName or 1.0
19661986
elseif textType == "status" then
19671987
alpha = db.fadeDeadStatusText or 1.0
1988+
elseif textType == "partyIndex" then
1989+
alpha = db.fadeDeadName or 1.0
19681990
end
19691991
end
19701992
end

Features/ElementAppearance.lua

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,54 @@ function DF:UpdateStatusTextAppearance(frame)
538538
frame.statusText:SetAlpha(alpha)
539539
end
540540

541+
-- ============================================================
542+
-- PARTY INDEX TEXT APPEARANCE
543+
-- ============================================================
544+
545+
function DF:UpdatePartyIndexTextAppearance(frame)
546+
if not IsDandersFrame(frame) then return end
547+
if not frame.partyIndexText then return end
548+
549+
local db = GetDB(frame)
550+
if not db then return end
551+
552+
if db.partyIndexTextEnabled == false then
553+
frame.partyIndexText:Hide()
554+
return
555+
end
556+
557+
local deadOrOffline = IsDeadOrOffline(frame)
558+
local inRange = GetInRange(frame)
559+
560+
local r, g, b = 1, 1, 1
561+
local baseAlpha = 1.0
562+
563+
if db.partyIndexTextUseClassColor then
564+
local classColor = GetClassColor(frame)
565+
r, g, b = classColor.r, classColor.g, classColor.b
566+
elseif deadOrOffline then
567+
r, g, b = 0.5, 0.5, 0.5
568+
else
569+
local c = db.partyIndexTextColor or DEFAULT_COLOR_WHITE
570+
r, g, b = c.r, c.g, c.b
571+
baseAlpha = c.a or 1.0
572+
end
573+
574+
local alpha = baseAlpha
575+
if deadOrOffline and db.fadeDeadFrames then
576+
alpha = db.fadeDeadName or 1.0
577+
end
578+
579+
frame.partyIndexText:SetTextColor(r, g, b, 1.0)
580+
581+
if db.oorEnabled then
582+
local oorAlpha = db.oorNameTextAlpha or 1
583+
ApplyOORAlpha(frame.partyIndexText, inRange, alpha, oorAlpha)
584+
else
585+
frame.partyIndexText:SetAlpha(alpha)
586+
end
587+
end
588+
541589
-- ============================================================
542590
-- POWER BAR APPEARANCE
543591
-- ============================================================
@@ -1146,6 +1194,7 @@ function DF:UpdateAllElementAppearances(frame)
11461194
DF:UpdateNameTextAppearance(frame)
11471195
DF:UpdateHealthTextAppearance(frame)
11481196
DF:UpdateStatusTextAppearance(frame)
1197+
DF:UpdatePartyIndexTextAppearance(frame)
11491198
DF:UpdatePowerBarAppearance(frame)
11501199
DF:UpdateBuffIconsAppearance(frame)
11511200
DF:UpdateDebuffIconsAppearance(frame)
@@ -1217,6 +1266,7 @@ DF.UpdateBackgroundAlpha = DF.UpdateBackgroundAppearance
12171266
DF.UpdateNameTextAlpha = DF.UpdateNameTextAppearance
12181267
DF.UpdateHealthTextAlpha = DF.UpdateHealthTextAppearance
12191268
DF.UpdateStatusTextAlpha = DF.UpdateStatusTextAppearance
1269+
DF.UpdatePartyIndexTextAlpha = DF.UpdatePartyIndexTextAppearance
12201270
DF.UpdatePowerBarAlpha = DF.UpdatePowerBarAppearance
12211271
DF.UpdateBuffIconsAlpha = DF.UpdateBuffIconsAppearance
12221272
DF.UpdateDebuffIconsAlpha = DF.UpdateDebuffIconsAppearance

Frames/Core.lua

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,77 @@ function DF:UpdateNameText(frame)
513513
end
514514
end
515515

516+
-- Get the displayed party/raid index for a unit token.
517+
-- Party mode default: player=1, party1=2 ... party4=5
518+
-- Optional remap mode: party1=1 ... party4=4, player=5
519+
-- Raid mode: raid1 ... raid40
520+
function DF:GetUnitPartyIndex(unit, db)
521+
if not unit or unit == "" then return nil end
522+
523+
local raidTokenIndex = unit:match("^raid(%d+)$")
524+
if raidTokenIndex then
525+
return tonumber(raidTokenIndex)
526+
end
527+
528+
local raidIndex = UnitInRaid(unit)
529+
if raidIndex and raidIndex > 0 then
530+
return raidIndex
531+
end
532+
533+
local partyTokenIndex = unit:match("^party(%d+)$")
534+
if partyTokenIndex then
535+
if db and db.partyIndexTextPlayerAtBottom then
536+
return tonumber(partyTokenIndex)
537+
end
538+
return tonumber(partyTokenIndex) + 1
539+
end
540+
541+
if UnitIsUnit(unit, "player") then
542+
if db and db.partyIndexTextPlayerAtBottom then
543+
return 5
544+
end
545+
return 1
546+
end
547+
548+
return nil
549+
end
550+
551+
function DF:UpdatePartyIndexText(frame)
552+
if not frame or not frame.partyIndexText or not frame.unit then return end
553+
554+
local db = frame.isRaidFrame and DF:GetRaidDB() or DF:GetDB()
555+
if not db then return end
556+
557+
if db.partyIndexTextEnabled == false then
558+
frame.partyIndexText:SetText("")
559+
frame.partyIndexText:Hide()
560+
return
561+
end
562+
563+
local index = DF:GetUnitPartyIndex(frame.unit, db)
564+
if not index then
565+
frame.partyIndexText:SetText("")
566+
frame.partyIndexText:Hide()
567+
return
568+
end
569+
570+
frame.partyIndexText:SetText(tostring(index))
571+
frame.partyIndexText:Show()
572+
573+
if DF.UpdatePartyIndexTextAppearance then
574+
DF:UpdatePartyIndexTextAppearance(frame)
575+
elseif db.partyIndexTextUseClassColor then
576+
local _, class = UnitClass(frame.unit)
577+
local classColor = class and DF:GetClassColor(class)
578+
if classColor then
579+
frame.partyIndexText:SetTextColor(classColor.r, classColor.g, classColor.b, 1)
580+
end
581+
else
582+
local c = db.partyIndexTextColor or {r = 1, g = 1, b = 1}
583+
frame.partyIndexText:SetTextColor(c.r, c.g, c.b, c.a or 1)
584+
end
585+
end
586+
516587
-- Iterator for all compact unit frames (player, party, raid)
517588
-- Accepts a callback function OR returns an iterator if no callback provided
518589
-- Usage with callback: DF:IterateCompactFrames(function(frame) ... end)

Frames/Create.lua

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,20 @@ function DF:CreateFrameElements(frame, isRaid)
633633
frame.statusText:SetTextColor(statusColor.r, statusColor.g, statusColor.b, 1)
634634
frame.statusText:SetDrawLayer("OVERLAY", 7)
635635
frame.statusText:Hide()
636+
637+
-- ========================================
638+
-- PARTY INDEX TEXT
639+
-- ========================================
640+
frame.partyIndexText = frame.contentOverlay:CreateFontString(nil, "OVERLAY")
641+
local partyIndexOutline = db.partyIndexTextOutline or "OUTLINE"
642+
if partyIndexOutline == "NONE" then partyIndexOutline = "" end
643+
DF:SafeSetFont(frame.partyIndexText, db.partyIndexTextFont or "Fonts\\FRIZQT__.TTF", db.partyIndexTextFontSize or 10, partyIndexOutline)
644+
local partyIndexAnchor = db.partyIndexTextAnchor or "TOPLEFT"
645+
frame.partyIndexText:SetPoint(partyIndexAnchor, frame, partyIndexAnchor, db.partyIndexTextX or 2, db.partyIndexTextY or -2)
646+
local partyIndexColor = db.partyIndexTextColor or {r = 1, g = 1, b = 1}
647+
frame.partyIndexText:SetTextColor(partyIndexColor.r, partyIndexColor.g, partyIndexColor.b, partyIndexColor.a or 1)
648+
frame.partyIndexText:SetDrawLayer("OVERLAY", 7)
649+
frame.partyIndexText:Hide()
636650

637651
-- Continue with the rest of the elements...
638652
-- (Border, icons, power bar, auras, absorbs, etc.)
@@ -1343,6 +1357,20 @@ function DF:CreateUnitFrame(unit, index, isRaid)
13431357
frame.statusText:SetTextColor(statusColor.r, statusColor.g, statusColor.b, 1)
13441358
frame.statusText:SetDrawLayer("OVERLAY", 7)
13451359
frame.statusText:Hide()
1360+
1361+
-- ========================================
1362+
-- PARTY INDEX TEXT
1363+
-- ========================================
1364+
frame.partyIndexText = frame.contentOverlay:CreateFontString(nil, "OVERLAY")
1365+
local partyIndexOutline = db.partyIndexTextOutline or "OUTLINE"
1366+
if partyIndexOutline == "NONE" then partyIndexOutline = "" end
1367+
DF:SafeSetFont(frame.partyIndexText, db.partyIndexTextFont or "Fonts\\FRIZQT__.TTF", db.partyIndexTextFontSize or 10, partyIndexOutline)
1368+
local partyIndexAnchor = db.partyIndexTextAnchor or "TOPLEFT"
1369+
frame.partyIndexText:SetPoint(partyIndexAnchor, frame, partyIndexAnchor, db.partyIndexTextX or 2, db.partyIndexTextY or -2)
1370+
local partyIndexColor = db.partyIndexTextColor or {r = 1, g = 1, b = 1}
1371+
frame.partyIndexText:SetTextColor(partyIndexColor.r, partyIndexColor.g, partyIndexColor.b, partyIndexColor.a or 1)
1372+
frame.partyIndexText:SetDrawLayer("OVERLAY", 7)
1373+
frame.partyIndexText:Hide()
13461374

13471375
-- ========================================
13481376
-- BORDER

Frames/Update.lua

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,29 @@ function DF:ApplyFrameLayout(frame)
291291
frame.statusText:SetTextColor(statusColor.r, statusColor.g, statusColor.b, statusColor.a or 1)
292292
end
293293
end
294+
295+
-- ========================================
296+
-- PARTY INDEX TEXT
297+
-- ========================================
298+
if frame.partyIndexText then
299+
local partyIndexFont = db.partyIndexTextFont or "Fonts\\FRIZQT__.TTF"
300+
local partyIndexFontSize = db.partyIndexTextFontSize or 10
301+
local partyIndexOutline = db.partyIndexTextOutline or "OUTLINE"
302+
if partyIndexOutline == "NONE" then partyIndexOutline = "" end
303+
304+
DF:SafeSetFont(frame.partyIndexText, partyIndexFont, partyIndexFontSize, partyIndexOutline)
305+
306+
local partyIndexAnchor = db.partyIndexTextAnchor or "TOPLEFT"
307+
frame.partyIndexText:ClearAllPoints()
308+
frame.partyIndexText:SetPoint(partyIndexAnchor, frame, partyIndexAnchor, db.partyIndexTextX or 2, db.partyIndexTextY or -2)
309+
310+
if DF.UpdatePartyIndexTextAppearance then
311+
DF:UpdatePartyIndexTextAppearance(frame)
312+
elseif not db.partyIndexTextUseClassColor then
313+
local partyIndexColor = db.partyIndexTextColor or {r = 1, g = 1, b = 1, a = 1}
314+
frame.partyIndexText:SetTextColor(partyIndexColor.r, partyIndexColor.g, partyIndexColor.b, partyIndexColor.a or 1)
315+
end
316+
end
294317

295318
-- ========================================
296319
-- ROLE ICON
@@ -559,6 +582,7 @@ function DF:UpdateUnitFrame(frame, source)
559582
frame.statusText:Hide()
560583
end
561584
end
585+
DF:UpdatePartyIndexText(frame)
562586
if frame.healthText then
563587
frame.healthText:Hide()
564588
end
@@ -612,6 +636,7 @@ function DF:UpdateUnitFrame(frame, source)
612636
frame.statusText:Hide()
613637
end
614638
end
639+
DF:UpdatePartyIndexText(frame)
615640
if frame.healthText then
616641
frame.healthText:Hide()
617642
end
@@ -774,6 +799,11 @@ function DF:UpdateUnitFrame(frame, source)
774799
-- ========================================
775800
DF:UpdateNameText(frame)
776801

802+
-- ========================================
803+
-- PARTY INDEX
804+
-- ========================================
805+
DF:UpdatePartyIndexText(frame)
806+
777807
-- ========================================
778808
-- HEALTH TEXT
779809
-- ========================================
@@ -1747,6 +1777,15 @@ local function RefreshFrameFonts(frame, db)
17471777
if statusOutline == "NONE" then statusOutline = "" end
17481778
DF:SafeSetFont(frame.statusText, statusFont, statusFontSize, statusOutline)
17491779
end
1780+
1781+
-- Party index text
1782+
if frame.partyIndexText then
1783+
local partyIndexFont = db.partyIndexTextFont or "Fonts\\FRIZQT__.TTF"
1784+
local partyIndexFontSize = db.partyIndexTextFontSize or 10
1785+
local partyIndexOutline = db.partyIndexTextOutline or "OUTLINE"
1786+
if partyIndexOutline == "NONE" then partyIndexOutline = "" end
1787+
DF:SafeSetFont(frame.partyIndexText, partyIndexFont, partyIndexFontSize, partyIndexOutline)
1788+
end
17501789
end
17511790

17521791
function DF:RefreshAllFonts()
@@ -1832,4 +1871,4 @@ function DF:RefreshAllFonts()
18321871
end
18331872
end
18341873
end
1835-
end
1874+
end

Options/AutoProfiles.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ local OVERRIDE_TAB_MAP = {
140140
-- Text
141141
{"statusText", "text_status", "Status Text"},
142142
{"name", "text_name", "Name Text"},
143+
{"partyIndexText", "text_party_index", "Party Number Text"},
143144
-- Auras (specific before generic)
144145
-- myBuffIndicator removed — feature deprecated and hidden from UI
145146
{"bossDebuff", "auras_bossdebuffs", "Boss Debuffs"},

0 commit comments

Comments
 (0)