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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
@@ -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 (SpellBookSkillLineTab<i>Flash, 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
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
..\UI.xsd">
|
||||
<Script file="Locale.lua"/>
|
||||
<Script file="Core.lua"/>
|
||||
<Script file="Fixes.lua"/>
|
||||
<Script file="Chooser.lua"/>
|
||||
<Script file="GameMenu.lua"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user