Files
pfUI/skins/blizzard/spellbook.lua
T
Brues 907d282a68 Centralize cooldown setup and settings
Every pfUI cooldown is now made by CreateCooldown(parent, kind) in the
new api/cooldown.lua, which replaces the cooldown module. A kind names
what the cooldown times: actionbar, bags, blizzard (spellbook and
character), unitframe, indicator, nameplate, buff, tooltip, totem or
lossofcontrol. The pfCooldownType, pfCooldownStyleText,
pfCooldownStyleAnimation and pfCooldownSize fields are gone. The new
file owns everything the cooldowns share:
- the numbers' font and size
- the formatter
- each kind's numbers, sweep and sweep direction
- the GCD threshold for spell kinds
- the CooldownFrame_SetTimer hook for other addons' Cooldown frames
UpdateCooldowns applies changed settings to every cooldown at once.
GetAuraTimer moves here from the unit frames.

All settings live in one C.cooldown table, on one page: Settings ->
Cooldown. It has the shared font, size, threshold, tenths and colors,
then "Show Numbers On", "Show Sweep On" and "Reverse Sweep On" lists
with a checkbox per kind. The per-module options are removed:
- each unit frame's timer text, animation and reverse, and the
  indicators' "Show Time Left"
- the nameplate debuff timer options
- the Blizzard and foreign font sizes and toggles
- Action Bars' cooldown text size
- the reverse options of bars, bags, buffs and totems
The old appearance.cd settings are not migrated.

The player buff frame and the tooltip aura icons now show the native
countdown too, which replaces their own text and OnUpdate ticking. The
buff frame keeps its inside or below-the-icon placement. Weapon
enchants report only their time left, so they start through
SetCooldownTimeLeft: numbers, no sweep. A slim poll remains for their
charges and renewals, since no event reports those. Buff indicators
now take the aura's real duration, which gives them a correct sweep.
The spellbook and character slots now hide GCD numbers like the other
spell cooldowns.
2026-10-31 19:17:14 -05:00

75 lines
2.8 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] = CreateCooldown(button, "blizzard", cdname)
_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)