character: durability % per inventory slot

Adds a Fizzle-style durability label to each character pane slot.
Renders at the bottom of the slot icon as "N%" colored by the existing
DURABILITY_THRESHOLD_COLORS table (red < orange < yellow < invasion <
green), or hidden when the item has no durability stat (necks, rings,
trinkets) or the slot is empty.

api/api.lua: new pfUI.api.CreateFontString(f, key, layer, size, flags,
font) helper following the CreateBackdrop pattern — idempotent
get-or-create that attaches the FontString to the parent frame as the
named field. Defaults to pfUI.font_default at C.global.font_size with
OUTLINE on the OVERLAY layer.

skins/blizzard/character.lua: scoreText migrated from the inline
"if not frame.scoreText then ..." block to the new helper as a working
example; new durabilityText created the same way at BOTTOM/size 10.
Durability render added to RefreshCharacterSlot — runs on every
PaperDollItemSlotButton_Update so equip/unequip/repair/damage all
refresh automatically.

api/config.lua + modules/gui.lua: new C.character.inventory.durability
toggle (default "1"). GUI lives under a new top-level "Character" tab
→ "Inventory" sub-tab, leaving room for future "Reputation" / "Skills"
sub-tabs at the same level.
This commit is contained in:
Brues
2026-05-29 18:31:52 -05:00
parent 201a77ccbd
commit ed5ecb1f93
4 changed files with 62 additions and 10 deletions
+20
View File
@@ -1167,6 +1167,26 @@ function pfUI.api.CreateBackdrop(f, inset, legacy, transp, backdropSetting)
end
end
-- [ Create FontString ]
-- Get-or-create a FontString attached to `f` as the named field. Idempotent —
-- subsequent calls return the existing FontString. Defaults to pfUI's typical
-- font style: default font at config size, OUTLINE flag, OVERLAY layer.
-- 'f' [frame] parent frame
-- 'key' [string] field name on `f` to stash the FontString (e.g. "scoreText")
-- 'layer' [string] draw layer. Defaults to "OVERLAY".
-- 'size' [int] font size. Defaults to C.global.font_size.
-- 'flags' [string] font flags. Defaults to "OUTLINE".
-- 'font' [string] font path. Defaults to pfUI.font_default.
function pfUI.api.CreateFontString(f, key, layer, size, flags, font)
if not f or not key then return end
if f[key] then return f[key] end
local fs = f:CreateFontString(nil, layer or "OVERLAY")
fs:SetFont(font or pfUI.font_default, size or C.global.font_size, flags or "OUTLINE")
f[key] = fs
return fs
end
-- [ Create Shadow ]
-- Creates a pfUI compatible frame as shadow element
-- 'f' [frame] the frame which should get a backdrop.