Skip to content

Commit

Permalink
added new AI commands
Browse files Browse the repository at this point in the history
  • Loading branch information
CarnifexOptimus committed Jun 14, 2024
1 parent 8ac8e91 commit 27b6bb3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions BossMod/AI/AIManagementWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ public override void Draw()
ImGui.TextUnformatted($"Navi={_manager.Controller.NaviTargetPos} / {_manager.Controller.NaviTargetRot}{(_manager.Controller.ForceFacing ? " forced" : "")}");
_manager.Beh?.DrawDebug();
if (ImGui.Button("AI on/update followed slot"))
{
_manager.SwitchToFollow(_config.FollowSlot);
_config.Enabled = true;
_config.Modified.Fire();
}
ImGui.SameLine();
if (ImGui.Button("AI off"))
_manager.SwitchToIdle();
Expand Down
26 changes: 22 additions & 4 deletions BossMod/AI/AIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private void OnCommand(string cmd, string message)
configModified = ToggleFollowModule();
break;
case "FOLLOWTARGET":
configModified = ToggleFollowTarget();
configModified = ToggleFollowTarget(messageData);
break;
case "POSITIONAL":
configModified = HandlePositionalCommand(messageData);
Expand Down Expand Up @@ -316,11 +316,29 @@ private bool ToggleFollowModule()
return true;
}

private bool ToggleFollowTarget()
private bool ToggleFollowTarget(string[] messageData)
{
_config.FollowTarget = !_config.FollowTarget;
if (messageData.Length == 1)
{
_config.FollowTarget = !_config.FollowTarget;
}
else
{
switch (messageData[1].ToUpperInvariant())
{
case "ON":
_config.FollowTarget = true;
break;
case "OFF":
_config.FollowTarget = false;
break;
default:
Service.Log($"[AI] Unknown follow target command: {messageData[1]}");
return _config.FollowTarget;
}
}
Service.Log($"[AI] Following targets is now {(_config.FollowTarget ? "enabled" : "disabled")}");
return true;
return _config.FollowTarget;
}

private bool HandlePositionalCommand(string[] messageData)
Expand Down
5 changes: 5 additions & 0 deletions BossMod/Config/ConfigUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void Draw()
{ "followmodule", "Toggles following during active boss module." },
{ "followoutofcombat", "Toggles following during out of combat." },
{ "followtarget", "Toggles following targets during combat." },
{ "followtarget on/off", "Sets following target during combat to on or off." },
{ "positional X", "Switch to positional when following targets. (any, rear, flank, front)" }
};

Expand Down Expand Up @@ -136,6 +137,10 @@ private void DrawReadMe()
ImGui.Text("Please also make sure to not load VBM and this fork at the same time.");
ImGui.Spacing();
ImGui.Text("The consequences of doing that are unexplored and unsupported.");
ImGui.Separator();
ImGui.Text("The AI is designed for legacy movement, make sure to turn on legacy movement\nwhile using AI.");
ImGui.Spacing();
ImGui.Text("It is advised to pause AutoDuty during boss modules since it can conflict with BMR AI.");
}

static void RenderTextWithLink(string displayText, Uri url)
Expand Down

0 comments on commit 27b6bb3

Please sign in to comment.