From 4b1ba99b4f0c6019dd815fd0a730295dbe1d6a21 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 25 Jul 2026 00:33:20 -0500 Subject: [PATCH] Move player info overlay onto ClassicAPI (drop Nampower) The haste/spell-power overlay read both values through Nampower and disabled itself entirely without it. Move both to ClassicAPI so it works on any ClassicAPI client: - Spell power: GetSpellPower("net") (nampower) -> GetSpellBonusDamage(i) (ClassicAPI, same per-school field). Merged the build+scan into one loop; the default school seeds the tiebreak so equal schools still favor it. - Haste: GetUnitField("player", "modCastSpeed") -> UnitSpellHaste("player"), which returns the haste percentage directly (the (1/modCastSpeed-1)*100 conversion is now baked in, off the same UNIT_MOD_CAST_SPEED field, signed). - Dropped the "if not GetUnitField then return" gate -- UpdateInfoText no longer touches Nampower, so the overlay runs everywhere. --- modules/player.lua | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/modules/player.lua b/modules/player.lua index d52f5c9c..98db1614 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -47,7 +47,7 @@ pfUI:RegisterModule("player", function () return string.format("%02X%02X%02X", r * 255, g * 255, b * 255) end - -- SP school colors indexed by GetSpellPower("net") return order + -- SP school colors indexed by GetSpellBonusDamage's 1-based school order -- (1=phys, 2=holy, 3=fire, 4=nature, 5=frost, 6=shadow, 7=arcane) local spColors = { "FFFFFF", "FFFF80", "FF8000", "4DFF4D", "80FFFF", "9482C9", "FFFFFF" } @@ -60,16 +60,14 @@ pfUI:RegisterModule("player", function () -- Compute and cache the haste/SP text; called from OnUpdate, throttled to 0.25s local function UpdateInfoText() - if not GetUnitField then return end -- do nothing for older nampower - local cfg = playerFrame.config if not cfg then return end - -- display_haste: "0"=hidden, "1"=show modCastSpeed (gear haste). Talent- - -- side cast-time reductions show up in the actual cast bar via - -- C_Spell.UnitCastingInfo; double-folding them into this overlay was - -- mixing two different concepts into one number. + -- display_haste: "0"=hidden, "1"=show cast-speed haste (UnitSpellHaste, + -- from UNIT_MOD_CAST_SPEED). Talent/spell-specific cast-time reductions + -- show up in the actual cast bar via C_Spell.UnitCastingInfo; folding them + -- in here too was mixing two different concepts into one number. local showHaste = cfg.display_haste == "1" local showSP = cfg.display_spellpower == "1" @@ -79,21 +77,20 @@ pfUI:RegisterModule("player", function () return end - local haste = GetUnitField("player", "modCastSpeed") + local haste = UnitSpellHaste("player") local text = "" if showHaste and isSpellCaster and haste then local hasteHex = cfgColorToHex(cfg.display_haste_color) or "FFFFFF" - text = string.format("|cff%s%.1f%%|r", hasteHex, (1 / haste - 1) * 100) + text = string.format("|cff%s%.1f%%|r", hasteHex, haste) end if showSP and isSpellCaster then - local schools = { GetSpellPower("net") } local defSchool = spDefaultSchool[myclass] or 2 - local maxSP = schools[defSchool] or 0 + local maxSP = GetSpellBonusDamage(defSchool) or 0 local maxColor = spColors[defSchool] - for i = 2, 7 do -- skip physical (1) - local v = schools[i] or 0 + for i = 2, 7 do -- skip physical (1); default school seeds the tiebreak + local v = GetSpellBonusDamage(i) or 0 if v > maxSP then maxSP = v maxColor = spColors[i]