From c7ff319ccc73c54ea46a8a255e35dda8fd5b791b Mon Sep 17 00:00:00 2001 From: sindoring Date: Sun, 18 Oct 2026 20:36:06 +0400 Subject: [PATCH] Fix the pet stat tooltip and the spellbook tab flash PaperDollStatTooltip upper-cases UnitClass(unit)'s token, and a unit whose class byte has no ChrClasses row answers two nils (UnitClass, 0x518350): the server's demons do, so hovering the pet page's stats raised "bad argument #1 to strupper". Such a unit now gets the stock default line, in both styles. LEARNED_SPELL_IN_TAB's glow flashed where 1.12's hidden skill line tabs stood: it now sits on the book's own tabs, and choosing a tab stops it, as SpellBookSkillLineTab_OnClick does. Verified: harness probe (the pet tooltip shows the default strength line, no error; the tab 2 glow's center matches our tab 2's; choosing tab 2 hides it). Co-Authored-By: Claude Opus 5.5 --- .../Interface/FrameXML/MoonWellUI/Fixes.lua | 18 ++++++++++++++++++ .../FrameXML/MoonWellUI/Forever/SpellBook.lua | 19 +++++++++++++++++-- .../FrameXML/MoonWellUI/MoonWellUI.xml | 1 + 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 vanilla/Interface/FrameXML/MoonWellUI/Fixes.lua diff --git a/vanilla/Interface/FrameXML/MoonWellUI/Fixes.lua b/vanilla/Interface/FrameXML/MoonWellUI/Fixes.lua new file mode 100644 index 0000000..ae30a9e --- /dev/null +++ b/vanilla/Interface/FrameXML/MoonWellUI/Fixes.lua @@ -0,0 +1,18 @@ +-- Fixes to stock 1.12 Lua that MoonWell needs in both styles. + +-- PaperDollStatTooltip (PaperDollFrame.lua) builds the class line's string name from +-- UnitClass(unit)'s token with strupper. A unit whose class byte has no ChrClasses row answers +-- two nils (UnitClass, 0x518350): the server's demons do, so the pet page's stats raised +-- "bad argument #1 to `strupper'". Such a unit gets the default line, the stock fallback. +local stockStatTooltip = PaperDollStatTooltip +function PaperDollStatTooltip(unit, stat) + local _, token = UnitClass(unit or "player") + if token then + return stockStatTooltip(unit, stat) + end + GameTooltip:SetOwner(this, "ANCHOR_RIGHT") + GameTooltip:SetText(this.tooltip) + GameTooltip:AddLine(getglobal("DEFAULT_" .. stat .. "_TOOLTIP"), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, + NORMAL_FONT_COLOR.b, 1) + GameTooltip:Show() +end diff --git a/vanilla/Interface/FrameXML/MoonWellUI/Forever/SpellBook.lua b/vanilla/Interface/FrameXML/MoonWellUI/Forever/SpellBook.lua index a5ae33f..467929f 100644 --- a/vanilla/Interface/FrameXML/MoonWellUI/Forever/SpellBook.lua +++ b/vanilla/Interface/FrameXML/MoonWellUI/Forever/SpellBook.lua @@ -689,6 +689,14 @@ local function layoutTabs(cats, selected) b:ClearAllPoints() b:SetPoint("TOPLEFT", tabs, "TOPLEFT", (i - 1) * (G.tabW + G.tabGap), 0) b:Show() + -- LEARNED_SPELL_IN_TAB's glow (SpellBookSkillLineTabFlash, 64 on a 32 tab) on our tab + local flash = getglobal("SpellBookSkillLineTab" .. i .. "Flash") + if flash and not cat.pet then + flash:ClearAllPoints() + flash:SetPoint("CENTER", b, "CENTER", 0, 0) + flash:SetWidth(G.tabW * 2) + flash:SetHeight(G.tabH * 2) + end if i == selected then b.frame:Hide() b.active:Show() @@ -702,6 +710,7 @@ local function layoutTabs(cats, selected) for i = table.getn(cats) + 1, table.getn(tabs.buttons) do tabs.buttons[i]:Hide() end + SpellBookTabFlashFrame:SetFrameLevel(tabs:GetFrameLevel() + 3) end -- ------------------------------------------------------------ Build @@ -794,13 +803,14 @@ local function build() createSettings(pages) end --- Hides 1.12's regions and frames in SpellBookFrame, except the book and the close button. +-- Hides 1.12's regions and frames in SpellBookFrame, except the book, the close button and +-- the tabs' flash, which UIFrameFlash shows on our tabs. function B.suppressClient() for _, region in ipairs({ SpellBookFrame:GetRegions() }) do suppress(region) end for _, child in ipairs({ SpellBookFrame:GetChildren() }) do - if child ~= B.book and child ~= SpellBookCloseButton then + if child ~= B.book and child ~= SpellBookCloseButton and child ~= SpellBookTabFlashFrame then suppress(child) end end @@ -839,6 +849,11 @@ function B.choose(index) B.state.category, B.state.page = index, 1 -- so P and Shift-P toggle as 1.12's book does SpellBookFrame.bookType = cat.book + -- SpellBookSkillLineTab_OnClick: a chosen tab stops flashing + local flash = not cat.pet and getglobal("SpellBookSkillLineTab" .. index .. "Flash") + if flash then + flash:Hide() + end B.update() end diff --git a/vanilla/Interface/FrameXML/MoonWellUI/MoonWellUI.xml b/vanilla/Interface/FrameXML/MoonWellUI/MoonWellUI.xml index 871a401..acc762d 100644 --- a/vanilla/Interface/FrameXML/MoonWellUI/MoonWellUI.xml +++ b/vanilla/Interface/FrameXML/MoonWellUI/MoonWellUI.xml @@ -2,6 +2,7 @@ ..\UI.xsd">