Files
sindoring a93b5cc111 Keep the trainer's description above its buttons
Blizzard_TrainerUI.xml gives ClassTrainerDetailScrollFrame 135 from
288 below the frame's top, so it ends at 423 while the money and
buttons strip starts at 409: a description long enough to scroll ran
over the strip. Fixes.lua (both styles) sizes it 118 when the addon
loads, ending 3 above the strip; its scroll bar follows.

Verified in the live client, classic style, frame-relative tops:
detail 288..406, Train button 409, money 413, scroll bar bottom 390.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-19 16:36:18 +04:00

36 lines
1.6 KiB
Lua

-- 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
-- Blizzard_TrainerUI.xml sizes ClassTrainerDetailScrollFrame 135 high from 288 below the frame's
-- top, so it ends at 423 while the bottom strip of money and buttons starts at 409 (the Train
-- button, 22 high, centred at 420): a description long enough to scroll ran over the strip. It
-- ends 3 above the strip; its scroll bar follows its height.
local TRAINER_DETAIL_HEIGHT = 118
local function fitTrainerDetail()
if ClassTrainerDetailScrollFrame then
ClassTrainerDetailScrollFrame:SetHeight(TRAINER_DETAIL_HEIGHT)
end
end
local trainerWatcher = CreateFrame("Frame")
trainerWatcher:RegisterEvent("ADDON_LOADED")
trainerWatcher:SetScript("OnEvent", function()
if arg1 == "Blizzard_TrainerUI" then fitTrainerDetail() end
end)
fitTrainerDetail()