Skip to content

Commit feaaf0c

Browse files
mrbudsInfusOnWoW
authored andcommitted
IsPlayerSpell and IsSpellKnown now make error an with 0
fixes #5328
1 parent 0c98d49 commit feaaf0c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

WeakAuras/Prototypes.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,11 +1045,12 @@ function Private.ExecEnv.CheckRaidFlags(flags, flagToCheck)
10451045
end
10461046

10471047
local function IsSpellKnownOrOverridesAndBaseIsKnown(spell, pet)
1048+
if spell == 0 then return false end
10481049
if IsSpellKnown(spell, pet) then
10491050
return true
10501051
end
10511052
local baseSpell = FindBaseSpellByID(spell)
1052-
if baseSpell and baseSpell ~= spell then
1053+
if baseSpell and baseSpell ~= spell and baseSpell ~= 0 then
10531054
if FindSpellOverrideByID(baseSpell) == spell then
10541055
return IsSpellKnown(baseSpell, pet)
10551056
end
@@ -1059,11 +1060,12 @@ end
10591060
---@param spell string|number
10601061
---@return boolean result
10611062
function WeakAuras.IsPlayerSpellOrOverridesAndBaseIsPlayerSpell(spell)
1063+
if spell == 0 then return false end
10621064
if IsPlayerSpell(spell) then
10631065
return true
10641066
end
10651067
local baseSpell = FindBaseSpellByID(spell)
1066-
if baseSpell and baseSpell ~= spell then
1068+
if baseSpell and baseSpell ~= spell and baseSpell ~= 0 then
10671069
if FindSpellOverrideByID(baseSpell) == spell then
10681070
return IsPlayerSpell(baseSpell)
10691071
end
@@ -1073,6 +1075,7 @@ end
10731075

10741076
---@private
10751077
function WeakAuras.IsSpellKnownForLoad(spell, exact)
1078+
if spell == 0 then return false end
10761079
local result = IsPlayerSpell(spell)
10771080
or IsSpellKnownOrOverridesAndBaseIsKnown(spell, false)
10781081
or IsSpellKnownOrOverridesAndBaseIsKnown(spell, true)
@@ -1093,6 +1096,7 @@ end
10931096
---@param pet boolean?
10941097
---@return boolean result
10951098
function WeakAuras.IsSpellKnown(spell, pet)
1099+
if spell == 0 then return false end
10961100
if (pet) then
10971101
return IsSpellKnownOrOverridesAndBaseIsKnown(spell, true)
10981102
end

WeakAurasOptions/Cache.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function spellCache.GetIcon(name)
142142
for spell, icon in icons.spells:gmatch("(%d+)=(%d+)") do
143143
local spellId = tonumber(spell)
144144

145-
if not bestMatch or (spellId and IsSpellKnown(spellId)) then
145+
if not bestMatch or (spellId and spellId ~= 0 and IsSpellKnown(spellId)) then
146146
bestMatch = tonumber(icon)
147147
end
148148
end

0 commit comments

Comments
 (0)