Skip to content

Commit

Permalink
Added better checking for nil returns.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Jan 2, 2024
1 parent 02d5597 commit 0d10f36
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions class_configs/wiz_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,8 @@ return {
active_cond = function(self) return mq.TLO.Me.FindBuff("id " .. tostring(mq.TLO.Me.AltAbility("Etherealist's Unity").Spell.Trigger(1).ID()))() ~= nil end,
cond = function(self)
local selfHPBuff = RGMercModules:execModule("Class", "GetResolvedActionMapItem", "SelfHPBuff")
return not selfHPBuff() or
(mq.TLO.Me.AltAbility("Etherealist's Unity").Spell.Trigger(1).Level() or 0) > selfHPBuff.Level() and RGMercUtils.SelfBuffAACheck("Etherealist's Unity")
local selfHPBuffLevel = selfHPBuff and selfHPBuff() and selfHPBuff.Level() or 0
return (mq.TLO.Me.AltAbility("Etherealist's Unity").Spell.Trigger(1).Level() or 0) > selfHPBuffLevel and RGMercUtils.SelfBuffAACheck("Etherealist's Unity")
end,
},
[2] = {
Expand Down Expand Up @@ -708,7 +708,7 @@ return {
type = "Spell",
cond = function(self, spell)
local fireClaw = RGMercModules:execModule("Class", "GetResolvedActionMapItem", "FireClaw")
return not RGMercUtils.DetGambitCheck() and (not fireClaw or not fireClaw() or not mq.TLO.Me.SpellReady(fireClaw.RankName()))
return not RGMercUtils.DetGambitCheck() and ((not fireClaw or not fireClaw()) or not mq.TLO.Me.SpellReady(fireClaw.RankName()))
end,
},
[20] = {
Expand Down Expand Up @@ -776,8 +776,8 @@ return {
active_cond = function(self) return mq.TLO.Me.FindBuff("id " .. tostring(mq.TLO.Me.AltAbility("Etherealist's Unity").Spell.Trigger(1).ID()))() ~= nil end,
cond = function(self)
local selfHPBuff = RGMercModules:execModule("Class", "GetResolvedActionMapItem", "SelfHPBuff")
return not selfHPBuff() or
(mq.TLO.Me.AltAbility("Etherealist's Unity").Spell.Trigger(1).Level() or 0) > selfHPBuff.Level() and RGMercUtils.SelfBuffAACheck("Etherealist's Unity")
local selfHPBuffLevel = selfHPBuff and selfHPBuff() and selfHPBuff.Level() or 0
return (mq.TLO.Me.AltAbility("Etherealist's Unity").Spell.Trigger(1).Level() or 0) > selfHPBuffLevel and RGMercUtils.SelfBuffAACheck("Etherealist's Unity")
end,
},
[3] = {
Expand All @@ -803,8 +803,8 @@ return {
active_cond = function(self) return mq.TLO.Me.FindBuff("id " .. tostring(mq.TLO.Me.AltAbility("Improved Familiar").Spell.ID()))() ~= nil end,
cond = function(self)
local familiarBuff = RGMercModules:execModule("Class", "GetResolvedActionMapItem", "FamiliarBuff")
return not familiarBuff() or
(mq.TLO.Me.AltAbility("Improved Familiar").Spell.Level() or 0) > familiarBuff.Level() and RGMercUtils.SelfBuffAACheck("Improved Familiar")
local familiarBuffLevel = familiarBuff and familiarBuff() and familiarBuff.Level() or 0
return (mq.TLO.Me.AltAbility("Improved Familiar").Spell.Level() or 0) > familiarBuffLevel and RGMercUtils.SelfBuffAACheck("Improved Familiar")
end,
},
[6] = {
Expand Down
2 changes: 1 addition & 1 deletion modules/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function Module:Init()
end

function Module:GetResolvedActionMapItem(item)
if self.ReloadingLoadouts then return "" end
if self.ReloadingLoadouts then return nil end
return self.ResolvedActionMap[item]
end

Expand Down
2 changes: 1 addition & 1 deletion utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ function Utils.DetGambitCheck()
---@type spell
local gambitSpell = RGMercModules:execModule("Class", "GetResolvedActionMapItem", "GambitSpell")

return type(gambitSpell) == "userdata" and gambitSpell and gambitSpell() and (me.Song(gambitSpell.RankName()).ID() > 0)
return gambitSpell and gambitSpell() and (me.Song(gambitSpell.RankName()).ID() > 0)
end

function Utils.DetAACheck(aaId)
Expand Down
2 changes: 1 addition & 1 deletion version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return { commitId = 'eb9442e 2024-01-01' }
return { commitId = '02d5597 2024-01-01' }

0 comments on commit 0d10f36

Please sign in to comment.