mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-05 13:10:00 +00:00
nampower.lua fix
- Added a safety check for nampower.lua to prevent errors if the player has no superwow. "GetSpellNameAndRankForId" only exists with superwow!
This commit is contained in:
+20
-11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user