From 6f44b1a7394798078c3fe2c98c10de82f191fd30 Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Sat, 10 Jan 2026 11:37:03 +0100 Subject: [PATCH] nampower.lua fix - Added a safety check for nampower.lua to prevent errors if the player has no superwow. "GetSpellNameAndRankForId" only exists with superwow! --- modules/nampower.lua | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/modules/nampower.lua b/modules/nampower.lua index 1f89ebcf..1c884077 100644 --- a/modules/nampower.lua +++ b/modules/nampower.lua @@ -6,6 +6,16 @@ pfUI:RegisterModule("nampower", "vanilla", function () -- Only load if Nampower is available if not GetNampowerVersion then return end + -- Safe wrapper for SuperWoW's GetSpellNameAndRankForId (may not be available) + local function SafeGetSpellNameAndRank(spellId) + if not GetSpellNameAndRankForId then return nil, nil end + local success, name, rank = pcall(GetSpellNameAndRankForId, spellId) + if success then + return name, rank + end + return nil, nil + end + local rawborder, border = GetBorderSize() -- Spell Queue Indicator @@ -111,11 +121,8 @@ pfUI:RegisterModule("nampower", "vanilla", function () if SpellInfo then spellName, spellRank, texture = SpellInfo(spellId) end - if not spellName and GetSpellNameAndRankForId then - local success, name, rank = pcall(GetSpellNameAndRankForId, spellId) - if success then - spellName, spellRank = name, rank - end + if not spellName then + spellName, spellRank = SafeGetSpellNameAndRank(spellId) end if spellName then @@ -229,8 +236,8 @@ pfUI:RegisterModule("nampower", "vanilla", function () if SpellInfo then spellName, spellRank, texture = SpellInfo(spellId) end - if not spellName and GetSpellNameAndRankForId then - spellName, spellRank = GetSpellNameAndRankForId(spellId) + if not spellName then + spellName, spellRank = SafeGetSpellNameAndRank(spellId) end if spellName then @@ -270,8 +277,9 @@ pfUI:RegisterModule("nampower", "vanilla", function () local name, rank, texture if SpellInfo then name, rank, texture = SpellInfo(spellId) - elseif GetSpellNameAndRankForId then - name, rank = GetSpellNameAndRankForId(spellId) + end + if not name then + name, rank = SafeGetSpellNameAndRank(spellId) end result[i] = { @@ -677,8 +685,9 @@ pfUI:RegisterModule("nampower", "vanilla", function () local spellName if SpellInfo then spellName = SpellInfo(spellId) - elseif GetSpellNameAndRankForId then - spellName = GetSpellNameAndRankForId(spellId) + end + if not spellName then + spellName = SafeGetSpellNameAndRank(spellId) end if not spellName then return end