Files
pfUI/skins/blizzard/spellbook.lua
T
Brues 93ab07a662 Show cooldown text through ClassicAPI's native countdown
The cooldown module no longer builds its own text frame with a 10 Hz
OnUpdate per cooldown. The CooldownFrame_SetTimer hook now configures
each Cooldown frame's own countdown instead: SetHideCountdownNumbers
for the per-frame text toggles and omnicc's noCooldownCount,
SetMinimumCountdownDuration for the GCD threshold, and
GetCountdownFontString for the pfUI font and size. The engine ticks
the numbers, gated by the countdownForCooldowns cvar. The cvar gets a
checkbox in the Cooldown settings, and pfUI.SetupCVars turns it on.

The text comes from one shared C_StringUtil numeric rule formatter,
given to each frame with SetCountdownFormatter. Its breakpoints keep
pfUI's format: the number in its unit's cooldown color, a unit (m/h/d)
once the unit below passes 99, and tenths in the low color when
milliseconds are on. Values now round up. GetColoredTimeString formats
through the same formatter, so the buff, buffwatch and tooltip timers
match. A config:changed callback rebuilds the breakpoints, and every
frame picks them up on its next update.

The paper-doll slots swap their indicator Models for Cooldown frames,
as the spellbook and bags already do. They and the spellbook take the
BLIZZARD tag when they are created, replacing the per-update hooks in
the skin module. Models get no numbers. Hide Foreign Cooldown
Animations clears the draw flags instead of setting alpha to 0, so the
numbers stay visible. The buff module's sweep hides its numbers
because buff.timer carries the text.
2026-10-31 18:45:17 -05:00

76 lines
2.9 KiB
Lua

pfUI:RegisterSkin("Spellbook", function ()
local rawborder, border = GetBorderSize()
local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel()
StripTextures(SpellBookFrame)
CreateBackdrop(SpellBookFrame, nil, nil, .75)
CreateBackdropShadow(SpellBookFrame)
SpellBookFrame.backdrop:SetPoint("TOPLEFT", 10, -10)
SpellBookFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 72)
SpellBookFrame:SetHitRectInsets(10,30,10,72)
EnableMovable(SpellBookFrame)
SpellBookTitleText:ClearAllPoints()
SpellBookTitleText:SetPoint("TOP", SpellBookFrame.backdrop, "TOP", 0, -10)
SpellBookFrameTabButton1:ClearAllPoints()
SpellBookFrameTabButton1:SetPoint("TOPLEFT", SpellBookFrame.backdrop, "BOTTOMLEFT", bpad, -(border + (border == 1 and 1 or 2)))
for i=1, 3 do
local tab = _G["SpellBookFrameTabButton"..i]
local lastTab = _G["SpellBookFrameTabButton"..(i-1)]
if lastTab then
tab:ClearAllPoints()
tab:SetPoint("LEFT", lastTab, "RIGHT", border*2 + 1, 0)
end
SkinTab(tab)
end
for i=1,SPELLS_PER_PAGE do
local button = _G["SpellButton"..i]
local texture = _G["SpellButton"..i.."IconTexture"]
StripTextures(button)
SkinButton(button, nil, nil, nil, texture)
-- native cooldown frame in place of the template's indicator Model.
-- SpellButton_UpdateButton reads the "<button>Cooldown" global on every
-- update. 1.12 binds a frame's name only while that global is unset, so
-- the global is rebound by hand; the Model starts hidden and nothing
-- reaches it after that
local cdname = "SpellButton"..i.."Cooldown"
_G[cdname] = CreateFrame("Cooldown", cdname, button, "CooldownFrameTemplate")
_G[cdname].pfCooldownType = C.appearance.cd.blizzard == "1" and "BLIZZARD" or nil
_G["SpellButton"..i.."SubSpellName"]:SetTextColor(1, 1, 1)
_G["SpellButton"..i.."AutoCastable"]:SetTexture("Interface\\Buttons\\UI-AutoCastableOverlay")
_G["SpellButton"..i.."Highlight"]:SetTexture("")
_G["SpellButton"..i.."Highlight"].SetTexture = function(self, tex) return end
end
SpellBookSkillLineTab1:ClearAllPoints()
SpellBookSkillLineTab1:SetPoint("TOPLEFT", SpellBookFrame.backdrop, "TOPRIGHT", border + (border == 1 and 1 or 2), -30)
for i = 1, MAX_SKILLLINE_TABS do
local button = _G["SpellBookSkillLineTab"..i]
local lastbutton = _G["SpellBookSkillLineTab"..(i-1)]
local texture = _G["SpellBookSkillLineTab"..i]:GetNormalTexture()
StripTextures(button)
SkinButton(button, nil, nil, nil, texture)
button:SetScale(1.1)
texture:SetTexCoord(.07,.93,.07,.93)
if lastbutton then
button:ClearAllPoints()
button:SetPoint("TOP", lastbutton, "BOTTOM", 0, - (border + (border == 1 and 1 or 2) + bpad))
end
end
SkinArrowButton(SpellBookPrevPageButton, "left", 18)
SkinArrowButton(SpellBookNextPageButton, "right", 18)
SkinCloseButton(SpellBookCloseButton, SpellBookFrame.backdrop, -6, -6)
SpellBookPageText:SetTextColor(1, 1, 1)
end)