Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,18 @@ DF.PartyDefaults = {
nameTextX = 0,
nameTextY = -10,

-- Party Number Text
partyIndexTextAnchor = "TOPLEFT",
partyIndexTextColor = {r = 1, g = 1, b = 1, a = 1},
partyIndexTextEnabled = false,
partyIndexTextFont = "DF Roboto SemiBold",
partyIndexTextFontSize = 10,
partyIndexTextOutline = "SHADOW",
partyIndexTextPlayerAtBottom = false,
partyIndexTextUseClassColor = false,
partyIndexTextX = 2,
partyIndexTextY = -2,

-- Out of Range
oorAbsorbBarAlpha = 0.20000000298023,
oorAurasAlpha = 0.20000000298023,
Expand Down Expand Up @@ -2539,6 +2551,18 @@ DF.RaidDefaults = {
nameTextX = 0,
nameTextY = -10,

-- Party Number Text
partyIndexTextAnchor = "TOPLEFT",
partyIndexTextColor = {r = 1, g = 1, b = 1, a = 1},
partyIndexTextEnabled = false,
partyIndexTextFont = "DF Roboto SemiBold",
partyIndexTextFontSize = 10,
partyIndexTextOutline = "SHADOW",
partyIndexTextPlayerAtBottom = false,
partyIndexTextUseClassColor = false,
partyIndexTextX = 2,
partyIndexTextY = -2,

-- Out of Range
oorAbsorbBarAlpha = 0.20000000298023,
oorAurasAlpha = 0.20000000298023,
Expand Down
22 changes: 22 additions & 0 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,12 @@ function DF:LightweightUpdateFontSize(textType)
if fontOutline == "NONE" then fontOutline = "" end
local size = db.statusTextFontSize or 10
DF:SafeSetFont(frame.statusText, fontPath, size, fontOutline)
elseif textType == "partyIndex" and frame.partyIndexText then
local fontPath = db.partyIndexTextFont or "Fonts\\FRIZQT__.TTF"
local fontOutline = db.partyIndexTextOutline or "OUTLINE"
if fontOutline == "NONE" then fontOutline = "" end
local size = db.partyIndexTextFontSize or 10
DF:SafeSetFont(frame.partyIndexText, fontPath, size, fontOutline)
end
end

Expand Down Expand Up @@ -560,6 +566,10 @@ function DF:LightweightUpdateTextPosition(textType)
frame.statusText:ClearAllPoints()
local anchor = db.statusTextAnchor or "BOTTOM"
frame.statusText:SetPoint(anchor, frame, anchor, db.statusTextX or 0, db.statusTextY or 0)
elseif textType == "partyIndex" and frame.partyIndexText then
frame.partyIndexText:ClearAllPoints()
local anchor = db.partyIndexTextAnchor or "TOPLEFT"
frame.partyIndexText:SetPoint(anchor, frame, anchor, db.partyIndexTextX or 2, db.partyIndexTextY or -2)
end
end

Expand Down Expand Up @@ -1927,6 +1937,10 @@ function DF:LightweightUpdateTextColor(textType)
elseif textType == "status" then
colorKey = "statusTextColor"
textKey = "statusText"
elseif textType == "partyIndex" then
if db.partyIndexTextUseClassColor then return end
colorKey = "partyIndexTextColor"
textKey = "partyIndexText"
else
return
end
Expand Down Expand Up @@ -1958,13 +1972,21 @@ function DF:LightweightUpdateTextColor(textType)
else
alpha = db.rangeFadeAlpha or 0.55
end
elseif textType == "partyIndex" then
if db.oorEnabled then
alpha = db.oorNameTextAlpha or 0.55
else
alpha = db.rangeFadeAlpha or 0.55
end
end
-- Dead fade only applies when in range
elseif testData.status and db.fadeDeadFrames then
if textType == "name" then
alpha = db.fadeDeadName or 1.0
elseif textType == "status" then
alpha = db.fadeDeadStatusText or 1.0
elseif textType == "partyIndex" then
alpha = db.fadeDeadName or 1.0
end
end
end
Expand Down
50 changes: 50 additions & 0 deletions Features/ElementAppearance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,54 @@ function DF:UpdateStatusTextAppearance(frame)
frame.statusText:SetAlpha(alpha)
end

-- ============================================================
-- PARTY INDEX TEXT APPEARANCE
-- ============================================================

function DF:UpdatePartyIndexTextAppearance(frame)
if not IsDandersFrame(frame) then return end
if not frame.partyIndexText then return end

local db = GetDB(frame)
if not db then return end

if db.partyIndexTextEnabled == false then
frame.partyIndexText:Hide()
return
end

local deadOrOffline = IsDeadOrOffline(frame)
local inRange = GetInRange(frame)

local r, g, b = 1, 1, 1
local baseAlpha = 1.0

if db.partyIndexTextUseClassColor then
local classColor = GetClassColor(frame)
r, g, b = classColor.r, classColor.g, classColor.b
elseif deadOrOffline then
r, g, b = 0.5, 0.5, 0.5
else
local c = db.partyIndexTextColor or DEFAULT_COLOR_WHITE
r, g, b = c.r, c.g, c.b
baseAlpha = c.a or 1.0
end

local alpha = baseAlpha
if deadOrOffline and db.fadeDeadFrames then
alpha = db.fadeDeadName or 1.0
end

frame.partyIndexText:SetTextColor(r, g, b, 1.0)

if db.oorEnabled then
local oorAlpha = db.oorNameTextAlpha or 1
ApplyOORAlpha(frame.partyIndexText, inRange, alpha, oorAlpha)
else
frame.partyIndexText:SetAlpha(alpha)
end
end

-- ============================================================
-- POWER BAR APPEARANCE
-- ============================================================
Expand Down Expand Up @@ -1146,6 +1194,7 @@ function DF:UpdateAllElementAppearances(frame)
DF:UpdateNameTextAppearance(frame)
DF:UpdateHealthTextAppearance(frame)
DF:UpdateStatusTextAppearance(frame)
DF:UpdatePartyIndexTextAppearance(frame)
DF:UpdatePowerBarAppearance(frame)
DF:UpdateBuffIconsAppearance(frame)
DF:UpdateDebuffIconsAppearance(frame)
Expand Down Expand Up @@ -1217,6 +1266,7 @@ DF.UpdateBackgroundAlpha = DF.UpdateBackgroundAppearance
DF.UpdateNameTextAlpha = DF.UpdateNameTextAppearance
DF.UpdateHealthTextAlpha = DF.UpdateHealthTextAppearance
DF.UpdateStatusTextAlpha = DF.UpdateStatusTextAppearance
DF.UpdatePartyIndexTextAlpha = DF.UpdatePartyIndexTextAppearance
DF.UpdatePowerBarAlpha = DF.UpdatePowerBarAppearance
DF.UpdateBuffIconsAlpha = DF.UpdateBuffIconsAppearance
DF.UpdateDebuffIconsAlpha = DF.UpdateDebuffIconsAppearance
Expand Down
111 changes: 111 additions & 0 deletions Frames/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,117 @@ function DF:GetUnitName(unit)
return UnitName(unit) or unit
end

-- Update name text on a frame - uses GetUnitName which can be overridden
function DF:UpdateNameText(frame)
if not frame or not frame.nameText or not frame.unit then return end

local unit = frame.unit
local db = frame.isRaidFrame and DF:GetRaidDB() or DF:GetDB()

-- Get name using the overridable method
local name = DF:GetUnitName(unit) or unit

-- Apply truncation if configured (UTF-8 aware)
local nameLength = db.nameTextLength or 0
if nameLength > 0 and name and DF:UTF8Len(name) > nameLength then
if db.nameTextTruncateMode == "ELLIPSIS" then
name = DF:UTF8Sub(name, 1, nameLength) .. "..."
else
name = DF:UTF8Sub(name, 1, nameLength)
end
end

frame.nameText:SetText(name)

-- Get class for class-colored elements
local _, class = UnitClass(unit)
local classColor = class and DF:GetClassColor(class)

-- Apply name color
if db.nameTextUseClassColor and classColor then
frame.nameText:SetTextColor(classColor.r, classColor.g, classColor.b, 1)
else
local nameColor = db.nameTextColor or {r = 1, g = 1, b = 1}
frame.nameText:SetTextColor(nameColor.r, nameColor.g, nameColor.b, 1)
end

-- Apply health text class color if enabled
if db.healthTextUseClassColor and classColor and frame.healthText then
frame.healthText:SetTextColor(classColor.r, classColor.g, classColor.b, 1)
end
end

-- Get the displayed party/raid index for a unit token.
-- Party mode default: player=1, party1=2 ... party4=5
-- Optional remap mode: party1=1 ... party4=4, player=party size
-- Raid mode: raid1 ... raid40
function DF:GetUnitPartyIndex(unit, db)
if not unit or unit == "" then return nil end

local raidTokenIndex = unit:match("^raid(%d+)$")
if raidTokenIndex then
return tonumber(raidTokenIndex)
end

local raidIndex = UnitInRaid(unit)
if raidIndex and raidIndex > 0 then
return raidIndex
end

local partyTokenIndex = unit:match("^party(%d+)$")
if partyTokenIndex then
if db and db.partyIndexTextPlayerAtBottom then
return tonumber(partyTokenIndex)
end
return tonumber(partyTokenIndex) + 1
end

if UnitIsUnit(unit, "player") then
if db and db.partyIndexTextPlayerAtBottom then
return (GetNumSubgroupMembers() or 0) + 1
end
return 1
end

return nil
end

function DF:UpdatePartyIndexText(frame)
if not frame or not frame.partyIndexText or not frame.unit then return end

local db = frame.isRaidFrame and DF:GetRaidDB() or DF:GetDB()
if not db then return end

if db.partyIndexTextEnabled == false then
frame.partyIndexText:SetText("")
frame.partyIndexText:Hide()
return
end

local index = DF:GetUnitPartyIndex(frame.unit, db)
if not index then
frame.partyIndexText:SetText("")
frame.partyIndexText:Hide()
return
end

frame.partyIndexText:SetText(tostring(index))
frame.partyIndexText:Show()

if DF.UpdatePartyIndexTextAppearance then
DF:UpdatePartyIndexTextAppearance(frame)
elseif db.partyIndexTextUseClassColor then
local _, class = UnitClass(frame.unit)
local classColor = class and DF:GetClassColor(class)
if classColor then
frame.partyIndexText:SetTextColor(classColor.r, classColor.g, classColor.b, 1)
end
else
local c = db.partyIndexTextColor or {r = 1, g = 1, b = 1}
frame.partyIndexText:SetTextColor(c.r, c.g, c.b, c.a or 1)
end
end

-- Iterator for all compact unit frames (player, party, raid)
-- Accepts a callback function OR returns an iterator if no callback provided
-- Usage with callback: DF:IterateCompactFrames(function(frame) ... end)
Expand Down
28 changes: 28 additions & 0 deletions Frames/Create.lua
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,20 @@ function DF:CreateFrameElements(frame, isRaid)
frame.statusText:SetTextColor(statusColor.r, statusColor.g, statusColor.b, 1)
frame.statusText:SetDrawLayer("OVERLAY", 7)
frame.statusText:Hide()

-- ========================================
-- PARTY INDEX TEXT
-- ========================================
frame.partyIndexText = frame.contentOverlay:CreateFontString(nil, "OVERLAY")
local partyIndexOutline = db.partyIndexTextOutline or "OUTLINE"
if partyIndexOutline == "NONE" then partyIndexOutline = "" end
DF:SafeSetFont(frame.partyIndexText, db.partyIndexTextFont or "Fonts\\FRIZQT__.TTF", db.partyIndexTextFontSize or 10, partyIndexOutline)
local partyIndexAnchor = db.partyIndexTextAnchor or "TOPLEFT"
frame.partyIndexText:SetPoint(partyIndexAnchor, frame, partyIndexAnchor, db.partyIndexTextX or 2, db.partyIndexTextY or -2)
local partyIndexColor = db.partyIndexTextColor or {r = 1, g = 1, b = 1}
frame.partyIndexText:SetTextColor(partyIndexColor.r, partyIndexColor.g, partyIndexColor.b, partyIndexColor.a or 1)
frame.partyIndexText:SetDrawLayer("OVERLAY", 7)
frame.partyIndexText:Hide()

-- Continue with the rest of the elements...
-- (Border, icons, power bar, auras, absorbs, etc.)
Expand Down Expand Up @@ -1344,6 +1358,20 @@ function DF:CreateUnitFrame(unit, index, isRaid)
frame.statusText:SetTextColor(statusColor.r, statusColor.g, statusColor.b, 1)
frame.statusText:SetDrawLayer("OVERLAY", 7)
frame.statusText:Hide()

-- ========================================
-- PARTY INDEX TEXT
-- ========================================
frame.partyIndexText = frame.contentOverlay:CreateFontString(nil, "OVERLAY")
local partyIndexOutline = db.partyIndexTextOutline or "OUTLINE"
if partyIndexOutline == "NONE" then partyIndexOutline = "" end
DF:SafeSetFont(frame.partyIndexText, db.partyIndexTextFont or "Fonts\\FRIZQT__.TTF", db.partyIndexTextFontSize or 10, partyIndexOutline)
local partyIndexAnchor = db.partyIndexTextAnchor or "TOPLEFT"
frame.partyIndexText:SetPoint(partyIndexAnchor, frame, partyIndexAnchor, db.partyIndexTextX or 2, db.partyIndexTextY or -2)
local partyIndexColor = db.partyIndexTextColor or {r = 1, g = 1, b = 1}
frame.partyIndexText:SetTextColor(partyIndexColor.r, partyIndexColor.g, partyIndexColor.b, partyIndexColor.a or 1)
frame.partyIndexText:SetDrawLayer("OVERLAY", 7)
frame.partyIndexText:Hide()

-- ========================================
-- BORDER
Expand Down
Loading