Skip to content

Commit

Permalink
Combat Chjecking
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Jan 5, 2024
1 parent e160594 commit 3119f87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion extras/version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return { commitId = 'ae6189a 2024-01-05' }
return { commitId = 'e160594 2024-01-05' }
22 changes: 12 additions & 10 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,7 @@ end
local function renderModulesTabs()
if not RGMercConfig:SettingsLoaded() then return end

local tabNames = {}
for name, _ in pairs(RGMercModules:getModuleList()) do
table.insert(tabNames, name)
end

table.sort(tabNames)

for _, name in ipairs(tabNames) do
ImGui.TableNextColumn()
for _, name in ipairs(RGMercModules:getModuleOrderedNames()) do
if ImGui.BeginTabItem(name) then
RGMercModules:execModule(name, "Render")
ImGui.EndTabItem()
Expand Down Expand Up @@ -172,7 +164,7 @@ local function RGMercsGUI()

RenderTarget()

if ImGui.BeginTabBar("RGMercsTabs") then
if ImGui.BeginTabBar("RGMercsTabs", ImGuiTabBarFlags.None) then
ImGui.SetItemDefaultFocus()
if ImGui.BeginTabItem("RGMercsMain") then
ImGui.Text("Current State: " .. curState)
Expand Down Expand Up @@ -460,6 +452,16 @@ local function Main()
RGMercConfig.Globals.AutoTargetID = 0
end

-- If target is not attackable then turn off attack
local aggroCheck = not mq.TLO.Target.Aggressive()
local pcCheck = mq.TLO.Target.Type():lower() == "pc" or ((mq.TLO.Target.Type() or "none"):lower() == "pet" and (mq.TLO.Target.Master.Type() or "none"):lower() == "pc")
local mercCheck = mq.TLO.Target.Type() == "mercenary"
if mq.TLO.Me.Combat() and (not mq.TLO.Target() or aggroCheck or pcCheck or mercCheck) then
RGMercsLogger.log_debug("\ayTarget type check failed \aw[\atinCombat(%s) taggroCheckFailed(%s) pcCheckFailed(%s) mercCheckFailed(%s)\aw]\ay - turning attack off!",
mq.TLO.Me.Combat() and "True" or "False", aggroCheck and "True" or "False", pcCheck and "True" or "False", mercCheck and "True" or "False")
mq.cmdf("/attack off")
end

-- TODO: Fix Curing

-- Revive our mercenary if they're dead and we're using a mercenary
Expand Down

0 comments on commit 3119f87

Please sign in to comment.