fix spellbook and actionslot errors

This commit is contained in:
Jrc13245
2025-12-20 08:20:17 -05:00
parent f3791c4562
commit c3721036bd
3 changed files with 58 additions and 13 deletions
+10 -3
View File
@@ -1485,6 +1485,7 @@ function API.IsSpellInRange(spellIdentifier, unit)
end
-- Check if a spell is usable (wrapper around IsSpellUsable)
-- Returns usable, oom on success; nil on error (spell not in spellbook)
function API.IsSpellUsable(spellIdentifier)
if not _G.IsSpellUsable then
return nil
@@ -1492,18 +1493,24 @@ function API.IsSpellUsable(spellIdentifier)
-- If enhanced functions available, pass directly
if API.features.hasEnhancedSpellFunctions then
return _G.IsSpellUsable(spellIdentifier)
local ok, usable, oom = pcall(_G.IsSpellUsable, spellIdentifier)
if ok then return usable, oom end
return nil
end
-- Convert to ID if name
if type(spellIdentifier) == "string" then
local spellId = API.GetSpellIdFromName(spellIdentifier)
if spellId then
return _G.IsSpellUsable(spellId)
local ok, usable, oom = pcall(_G.IsSpellUsable, spellId)
if ok then return usable, oom end
return nil
end
end
return _G.IsSpellUsable(spellIdentifier)
local ok, usable, oom = pcall(_G.IsSpellUsable, spellIdentifier)
if ok then return usable, oom end
return nil
end
--------------------------------------------------------------------------------