Skip to content

Commit

Permalink
Crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Jan 1, 2024
1 parent e9d5d0d commit c3bc887
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions class_configs/shd_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ local _ClassConfig = {
type = "AA",
tooltip = Tooltips.ViciousBiteOfChaos,
cond = function(self)
return mq.TLO.Target() and RGMercUtils.GetTragetPctHPs() > 5 and
return mq.TLO.Target() and RGMercUtils.GetTargetPctHPs() > 5 and
RGMercUtils.GetTargetDistance() < 35
end
},
Expand All @@ -948,7 +948,7 @@ local _ClassConfig = {
type = "Disc",
tooltip = Tooltips.Blade,
cond = function(self)
return mq.TLO.Target() and RGMercUtils.GetTragetPctHPs() > 5 and
return mq.TLO.Target() and RGMercUtils.GetTargetPctHPs() > 5 and
RGMercUtils.GetTargetDistance() < 35 and (mq.TLO.Me.Inventory("mainhand").Type():find("2H"))
end
},
Expand All @@ -957,7 +957,7 @@ local _ClassConfig = {
type = "Disc",
tooltip = Tooltips.Crimson,
cond = function(self)
return mq.TLO.Target() and RGMercUtils.GetTragetPctHPs() > 5 and
return mq.TLO.Target() and RGMercUtils.GetTargetPctHPs() > 5 and
RGMercUtils.GetTargetDistance() < 35 and (mq.TLO.Me.Inventory("mainhand").Type():find("2H"))
end
},
Expand Down
4 changes: 2 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ local function Main()
RGMercUtils.FindTarget()
end

if RGMercUtils.OkToEngage(mq.TLO.Target.ID()) then
RGMercUtils.EngageTarget(mq.TLO.Target.ID())
if RGMercUtils.OkToEngage(RGMercUtils.GetTargetID()) then
RGMercUtils.EngageTarget(RGMercUtils.GetTargetID())
end

if RGMercUtils.GetXTHaterCount() > 0 then
Expand Down
2 changes: 1 addition & 1 deletion modules/movement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function Module:ChaseOn(target)
chaseTarget = mq.TLO.Spawn("pc =" .. target)
end

if chaseTarget.ID() > 0 and chaseTarget.Type() == "PC" then
if chaseTarget() and chaseTarget.ID() > 0 and chaseTarget.Type() == "PC" then
self.settings.ChaseOn = true
self.settings.ChaseTarget = chaseTarget.CleanName()
self:SaveSettings(true)
Expand Down
18 changes: 11 additions & 7 deletions utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
function Utils.SetTarget(targetId)
RGMercsLogger.log_debug("Setting Target: %d", targetId)
if RGMercConfig:GetSettings().DoAutoTarget then
if mq.TLO.Target.ID() ~= targetId then
if Utils.GetTargetID() ~= targetId then
mq.cmdf("/target id %d", targetId)
mq.delay(10)
end
Expand Down Expand Up @@ -198,7 +198,7 @@ function Utils.WaitCastFinish(target)

while mq.TLO.Me.Casting() and (not mq.TLO.Cast.Ready()) do
mq.delay(100)
if target() and Utils.GetTargetPctHPs() <= 0 or (mq.TLO.Target.ID() ~= target.ID()) then
if target() and Utils.GetTargetPctHPs() <= 0 or (Utils.GetTargetID() ~= target.ID()) then
mq.TLO.Me.StopCast()
return
end
Expand Down Expand Up @@ -430,7 +430,7 @@ function Utils.ExecEntry(e, targetId, map, bAllowMem)

Utils.ActionPrep()

if mq.TLO.Target.ID() ~= targetId and target() then
if Utils.GetTargetID() ~= targetId and target() then
if me.Combat() and target.Type():lower() == "pc" then
RGMercsLogger.log_info("\awNOTICE:\ax Turning off autoattack to cast on a PC.")
mq.cmdf("/attack off")
Expand Down Expand Up @@ -589,7 +589,7 @@ end
function Utils.DotSpellCheck(config, spell)
if not spell then return false end
return not mq.TLO.Target.FindBuff("id " .. tostring(spell.ID())).ID() and spell.StacksTarget() and
Utils.GetTragetPctHPs() > config.HPStopDOT
Utils.GetTargetPctHPs() > config.HPStopDOT
end

function Utils.DetSpellCheck(spell)
Expand All @@ -605,10 +605,14 @@ function Utils.GetTargetDistance()
return (mq.TLO.Target.Distance() or 9999)
end

function Utils.GetTragetPctHPs()
function Utils.GetTargetPctHPs()
return (mq.TLO.Target.PctHPs() or 0)
end

function Utils.GetTargetID()
return (mq.TLO.Target.ID() or 0)
end

function Utils.BurnCheck(config)
return ((config.BurnAuto and (Utils.GetXTHaterCount() >= config.BurnMobCount or (mq.TLO.Target.Named() and config.BurnNamed) or (config.BurnAlways and config.BurnAuto))) or (not config.BurnAuto and config.BurnSize))
end
Expand Down Expand Up @@ -1151,7 +1155,7 @@ function Utils.FindTarget()
end
--Target the new target we'll do another spawn check just in case. Given we just did our spawn checks,
-- Assume the target is still valid so we don't do two more spawn checks.
if RGMercConfig.Globals.AutoTargetID > 0 and mq.TLO.Target.ID() ~= RGMercConfig.Globals.AutoTargetID then
if RGMercConfig.Globals.AutoTargetID > 0 and Utils.GetTargetID() ~= RGMercConfig.Globals.AutoTargetID then
Utils.SetTarget(RGMercConfig.Globals.AutoTargetID)
end
end
Expand Down Expand Up @@ -1253,7 +1257,7 @@ function Utils.PetAttack(config, target)
end

function Utils.DetAACheck(aaId)
if not mq.TLO.Target.ID() then return false end
if Utils.GetTargetID() == 0 then return false end
local Target = mq.TLO.Target
local Me = mq.TLO.Me

Expand Down

0 comments on commit c3bc887

Please sign in to comment.