add pcall to more nampower functions

This commit is contained in:
Jrc13245
2025-12-28 11:41:45 -05:00
parent 83cdecdb29
commit 5b6d8268e0
3 changed files with 13 additions and 9 deletions
+6 -6
View File
@@ -3579,8 +3579,8 @@ function IsCurrentAction(slot)
if spellId then
-- Prefer GetCastInfo (Nampower 2.18+) for cleaner API
if GetCastInfo then
local info = GetCastInfo()
if info and info.spellId == spellId then
local ok, info = pcall(GetCastInfo)
if ok and info and info.spellId == spellId then
-- Spell is actively being cast/channeled
return true
end
@@ -4206,8 +4206,8 @@ function CleveRoids.Frame:SPELLCAST_CHANNEL_START()
-- Try to get spell info - prefer GetCastInfo (Nampower 2.18+) for better data
local spellId = nil
if GetCastInfo then
local info = GetCastInfo()
if info and info.spellId and info.spellId > 0 then
local ok, info = pcall(GetCastInfo)
if ok and info and info.spellId and info.spellId > 0 then
spellId = info.spellId
-- Also capture timing data
CleveRoids.CurrentSpell.castRemainingMs = info.castRemainingMs
@@ -4272,8 +4272,8 @@ function CleveRoids.Frame:SPELLCAST_START()
-- Try to get spell info - prefer GetCastInfo (Nampower 2.18+) for better data
local spellId = nil
if GetCastInfo then
local info = GetCastInfo()
if info and info.spellId and info.spellId > 0 then
local ok, info = pcall(GetCastInfo)
if ok and info and info.spellId and info.spellId > 0 then
spellId = info.spellId
-- Also capture timing data
CleveRoids.CurrentSpell.castRemainingMs = info.castRemainingMs
+2 -2
View File
@@ -87,8 +87,8 @@ CleveRoids.UpdateCastingState = function()
-- Enhanced timing data from GetCastInfo (Nampower 2.18+)
if GetCastInfo then
local info = GetCastInfo()
if info then
local ok, info = pcall(GetCastInfo)
if ok and info then
CleveRoids.CurrentSpell.castRemainingMs = info.castRemainingMs
CleveRoids.CurrentSpell.castEndTime = info.castEndS
CleveRoids.CurrentSpell.gcdRemainingMs = info.gcdRemainingMs
+5 -1
View File
@@ -1177,7 +1177,11 @@ end
function API.GetCastInfo()
-- Use native function if available (v2.18+)
if GetCastInfo then
return GetCastInfo()
local ok, result = pcall(GetCastInfo)
if ok then
return result
end
-- If pcall failed, fall through to fallback
end
-- Fallback: use GetCurrentCastingInfo (less detailed)