mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
add pcall to more nampower functions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user