diff --git a/Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.SwapTest.cs b/Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.SwapTest.cs
index 7ae87d9..0461dc3 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.SwapTest.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.SwapTest.cs
@@ -86,5 +86,6 @@ public partial class BuffManager
_swapTestAt = Now;
LastWandSwapTrail = "";
_host.Log($"[SwapTest] start: '{name}' (mode {CurrentCombatMode})");
+ _host.WriteToChat($"[RynthAi] Swap test: {name}; the result follows.", 1); // /ra swaptest's answer
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/CommandReply.cs b/Plugins/RynthCore.Plugin.RynthAi/CommandReply.cs
new file mode 100644
index 0000000..ae79c22
--- /dev/null
+++ b/Plugins/RynthCore.Plugin.RynthAi/CommandReply.cs
@@ -0,0 +1,175 @@
+using System;
+using System.Collections.Generic;
+
+namespace RynthCore.Plugin.RynthAi;
+
+///
+/// What a chat command (/ra, /ub, /mt, /vt) says back: the one place the rule lives (2026-10-28).
+///
+/// - A command the player typed answers in chat, in one line (more only for lists, status and help):
+///
says what changed and the value now, why it didn't work and the
+/// usage. A typed command that said nothing at all still gets a line ( ).
+/// - A command a meta, a nav route or a script sent is quiet when it works (the log has the line),
+/// so metas don't flood chat. Its errors still show in chat, each distinct one at most once a minute.
+/// is output the command was asked for (a list, a status, help): shown either way.
+///
+/// Who sent the line is per thread: a command is handled start to finish on the thread it came in on.
+///
+internal sealed class CommandReply
+{
+ /// AC chat types: RynthAi's usual lines, and its error lines (AutoVendor, salvage, pack full).
+ public const int OkColor = 1, FailColor = 2;
+
+ /// A meta repeating the same error says it in chat at most this often (the log has every one).
+ public const long FailRepeatMs = 60_000;
+
+ /// The line a typed command that answered nothing gets (the log says which command).
+ public const string RanPrefix = "[RynthAi] Ran: ";
+
+ private readonly Action _chat;
+ private readonly Action _log;
+ private readonly Func _metaActive;
+ private readonly Dictionary _failSaidAt = new(StringComparer.Ordinal);
+
+ /// Milliseconds, for the once-a-minute error repeat (tests set it).
+ internal Func Clock { get; set; } = () => Environment.TickCount64;
+
+ [ThreadStatic] private static int t_scriptDepth; // AsScript on the stack: a script's or a route's line
+ [ThreadStatic] private static int t_queued; // RunQueued: 0 none, 1 sent by a script, 2 typed
+ [ThreadStatic] private static int t_runDepth; // Run on the stack
+ [ThreadStatic] private static bool t_answered; // the command being run has said something
+
+ /// Writes a chat line in a colour.
+ /// Writes a log line.
+ /// True while a meta's action or chat command is being run.
+ public CommandReply(Action chat, Action log, Func metaActive)
+ {
+ _chat = chat;
+ _log = log;
+ _metaActive = metaActive;
+ }
+
+ /// True when a meta, a route or a script sent the line being handled, not the player.
+ public bool FromScript => t_queued switch
+ {
+ 1 => true,
+ 2 => false,
+ _ => t_scriptDepth > 0 || _metaActive(),
+ };
+
+ /// It worked: what changed and the value now. Chat when typed; the log only for a meta or script.
+ public void Ok(string text)
+ {
+ t_answered = true;
+ if (FromScript) _log(text);
+ else _chat(text, OkColor);
+ }
+
+ /// It didn't work: why, and the usage. Always logged; in chat when typed, and for a meta or
+ /// script the first time in a minute that this exact line comes up.
+ public void Fail(string text)
+ {
+ t_answered = true;
+ _log(text);
+ if (FromScript && !FirstInAMinute(text)) return;
+ _chat(text, FailColor);
+ }
+
+ ///
+ /// Accepted and ignored on purpose (a VTank or UtilityBelt verb with no RynthAi equivalent): said
+ /// as a failure when typed, so the player knows nothing happened; only logged for a meta, which
+ /// sends it on every pass and is meant to keep running.
+ ///
+ public void Ignored(string text)
+ {
+ if (FromScript) { t_answered = true; _log(text); }
+ else Fail(text);
+ }
+
+ /// Output the command was asked for (a list, a status, help, a lookup): chat either way.
+ public void Info(string text)
+ {
+ t_answered = true;
+ _chat(text, OkColor);
+ }
+
+ /// The command's answer comes another way: a later line (a queued action that says what
+ /// it did), the server, the engine, or the plugin the command was handed to.
+ public void Answered() => t_answered = true;
+
+ ///
+ /// Handles one command line. A typed command that said nothing gets one line anyway (and the
+ /// log names it, so it can get a proper answer); one that threw says so instead of nothing.
+ /// A meta's or a script's line runs as it is.
+ ///
+ public void Run(string line, Action handle)
+ {
+ bool outer = t_runDepth == 0;
+ bool savedAnswered = t_answered;
+ if (outer) t_answered = false;
+ bool typed = !FromScript;
+ t_runDepth++;
+ try
+ {
+ handle();
+ }
+ catch (Exception ex) when (outer && typed)
+ {
+ _log($"[CmdReply] '{line}' threw: {ex}");
+ Fail($"[RynthAi] {line}: failed ({ex.GetType().Name}: {ex.Message}).");
+ }
+ finally
+ {
+ t_runDepth--;
+ if (outer)
+ {
+ if (typed && !t_answered)
+ {
+ _log($"[CmdReply] '{line}' gave no reply of its own; said \"{RanPrefix}{line}\" for it.");
+ _chat(RanPrefix + line, OkColor);
+ }
+ t_answered = savedAnswered;
+ }
+ }
+ }
+
+ /// Runs as a line a script or a nav route sent (quiet when it works).
+ public T AsScript(Func action)
+ {
+ t_scriptDepth++;
+ try { return action(); }
+ finally { t_scriptDepth--; }
+ }
+
+ ///
+ /// A queued command (run later on the tick) answers as the line that queued it would have:
+ /// is when it was queued.
+ ///
+ public void RunQueued(bool fromScript, Action action)
+ {
+ int saved = t_queued;
+ t_queued = fromScript ? 1 : 2;
+ try { action(); }
+ finally { t_queued = saved; }
+ }
+
+ /// True when this error line wasn't said in the last minute (a meta repeating it says it once).
+ private bool FirstInAMinute(string text)
+ {
+ long now = Clock();
+ lock (_failSaidAt)
+ {
+ if (_failSaidAt.TryGetValue(text, out long at) && now - at < FailRepeatMs) return false;
+ if (_failSaidAt.Count >= 256)
+ {
+ var old = new List();
+ foreach (var kv in _failSaidAt)
+ if (now - kv.Value >= FailRepeatMs) old.Add(kv.Key);
+ foreach (string k in old) _failSaidAt.Remove(k);
+ if (_failSaidAt.Count >= 256) _failSaidAt.Clear();
+ }
+ _failSaidAt[text] = now;
+ return true;
+ }
+ }
+}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/CorpseOpenController.cs b/Plugins/RynthCore.Plugin.RynthAi/CorpseOpenController.cs
index a05f2c8..503368b 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/CorpseOpenController.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/CorpseOpenController.cs
@@ -3849,7 +3849,7 @@ public sealed partial class RynthAiPlugin
var settings = _dashboard?.Settings;
if (settings == null || _objectCache == null || _playerId == 0)
{
- ChatLine("[RynthAi] Corpse info not ready yet.");
+ ReplyFail("[RynthAi] Corpse info not ready yet.");
return;
}
@@ -3874,14 +3874,14 @@ public sealed partial class RynthAiPlugin
var settings = _dashboard?.Settings;
if (settings == null || _objectCache == null || _playerId == 0)
{
- ChatLine("[RynthAi] Corpse ownership diagnostics are not ready yet.");
+ ReplyFail("[RynthAi] Corpse ownership diagnostics are not ready yet.");
return;
}
string selector = parts.Length >= 3 ? parts[2].Trim().ToLowerInvariant() : string.Empty;
if (!TryResolveCorpseForDiagnostics(selector, out WorldObject? corpse, out string source))
{
- ChatLine("[RynthAi] No corpse found for diagnostics. Use /ra corpsecheck [target|open|nearest].");
+ ReplyFail("[RynthAi] No corpse found for diagnostics. Use /ra corpsecheck [target|open|nearest].");
return;
}
@@ -3911,14 +3911,14 @@ public sealed partial class RynthAiPlugin
{
if (_fellowshipTracker == null)
{
- ChatLine("[RynthAi] Fellowship tracker is not ready yet.");
+ ReplyFail("[RynthAi] Fellowship tracker is not ready yet.");
return;
}
string fellowSub = parts.Length >= 3 ? parts[2].Trim().ToLowerInvariant() : "status";
if (!_fellowshipTracker.IsInFellowship && fellowSub != "help")
{
- ChatLine("[RynthAi] Not in a fellowship.");
+ ReplyFail("[RynthAi] Not in a fellowship.");
return;
}
@@ -3972,7 +3972,7 @@ public sealed partial class RynthAiPlugin
}
else
{
- ChatLine("[RynthAi] Usage: /ra fellow ismember ");
+ ReplyFail("[RynthAi] Usage: /ra fellow ismember ");
}
break;
@@ -3981,7 +3981,7 @@ public sealed partial class RynthAiPlugin
break;
default:
- ChatLine($"[RynthAi] Unknown fellow subcommand: {fellowSub}. Try /ra fellow help");
+ ReplyFail($"[RynthAi] Unknown fellow subcommand: {fellowSub}. Try /ra fellow help");
break;
}
}
@@ -4099,27 +4099,27 @@ public sealed partial class RynthAiPlugin
var settings = _dashboard?.Settings;
if (settings == null || _objectCache == null || _playerId == 0)
{
- ChatLine("[RynthAi] Corpse opening is not ready yet.");
+ ReplyFail("[RynthAi] Corpse opening is not ready yet.");
return;
}
if (_openedContainerId != 0)
{
- ChatLine($"[RynthAi] A container is already open: 0x{(uint)_openedContainerId:X8}");
+ ReplyFail($"[RynthAi] A container is already open: 0x{(uint)_openedContainerId:X8}");
return;
}
double maxMeters = GetCorpseApproachRangeMaxMeters(settings);
if (!TryFindNearestCorpse(maxMeters, out WorldObject? corpse, out double distanceMeters))
{
- ChatLine("[RynthAi] No unopened corpse is within corpse max range.");
+ ReplyFail("[RynthAi] No unopened corpse is within corpse max range.");
return;
}
_targetCorpseId = corpse!.Id;
_corpseTargetSince = CorpseNowMs;
_lastCorpseOpenAttemptAt = 0;
- ChatLine($"[RynthAi] Corpse target set to {corpse.Name} at {ConvertMetersToYards(distanceMeters):F1} yd.");
+ ReplyOk($"[RynthAi] Corpse target set to {corpse.Name} at {ConvertMetersToYards(distanceMeters):F1} yd.");
TickCorpseOpening();
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/Dashboard/InstrumentDashboard.cs b/Plugins/RynthCore.Plugin.RynthAi/Dashboard/InstrumentDashboard.cs
index 56ece8e..e75eecf 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Dashboard/InstrumentDashboard.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Dashboard/InstrumentDashboard.cs
@@ -17,16 +17,17 @@
// activity an inset line: what the bot is doing (coloured, with its icon) and
// the meta's state.
// controls RUN / STOP, the five subsystem keys (lit LED = on; right-click:
-// their settings), Force rebuff.
+// their settings), then RynthSort's auto-sort key (when it's loaded;
+// right-click: its window) and Force rebuff.
// launchers a tray of window buttons (lit while open), labels when wide.
// footer FPS (coloured by rate), RynthAi's version, bot and client uptime.
// bars the vitals and the target (15 segments, coloured by health).
// Minimized keeps the header, the activity line, the controls and the bars.
-// Drawers on the edges (docked only): Ranges, Loaded files, Patrol and the Mini
+// Drawers on the edges, docked or popped out: Ranges, Loaded files, Patrol and the Mini
// Remote on the left, My settings on the right; a tab's right-click moves its
// drawer to the other edge. Ranges, Patrol and My settings show the Settings
// panel's rows, which RynthCore draws into them (RenderSettingsDrawer, v90).
-// Popped out the pickers are in the options.
+// Popped out the pickers are in the options as well.
//
// Colours: the player's theme (GetUiColor v90: Background, KeyFace, Hairline,
// Inset, Text, Muted, Faint, Accent, Highlight); health, stamina, mana and the
@@ -68,6 +69,11 @@ internal interface IDashboardHost
void AdjustOpacity(float delta);
void ToggleLock();
void SelectProfile(int kind, int index);
+ /// RynthSort's auto-sort: -1 RynthSort not loaded (or not logged in, or too old to say), 0 off, 1 on.
+ int AutoSort { get; }
+ void SetAutoSort(bool on);
+ /// RynthSort's own window, shown or hidden.
+ void ToggleSortWindow();
void StartPatrol();
void ToggleSpells();
/// The Classic (retail) look: RynthCore's own face comes back for it.
@@ -195,7 +201,10 @@ internal sealed unsafe class InstrumentDashboard
OptionsMenu(prefs);
CharMenu();
- if (!popped) Drawers(prefs, origin, new Vector2(width, height));
+ // Popped out too (Tom 2026-10-24: "many of the settings are built into the drawers"): the
+ // pop-out's picture grows past the panel to hold them, and RynthCore's pop-outs take clicks
+ // on a window drawn there, not only on a menu.
+ Drawers(prefs, origin, new Vector2(width, height));
return new Vector2(width, height);
}
@@ -428,18 +437,31 @@ internal sealed unsafe class InstrumentDashboard
Tracked(dl, bf, bf.FontSize, new Vector2(gx + glyph + Px(6), MathF.Round(rp.Y + (h - bf.FontSize) * 0.5f)), fg, word, track);
}
- // The subsystem keys.
+ // The subsystem keys. With RynthSort loaded its auto-sort key sits at the right beside Force
+ // rebuff, and at the narrowest window every key gives up a pixel for it.
+ int sort = _d.AutoSort;
+ float kw = Px(KeyW);
+ if (sort >= 0)
+ kw = MathF.Min(kw, MathF.Floor((w - Px(RunW) - 2 * Px(Gap) - Subsystems.Length * Px(KeyGap) - Px(FrW)) / (Subsystems.Length + 1)));
float kx = x0 + Px(RunW) + Px(Gap);
bool[] on = { _r.Combat, _r.Buffing, _r.Navigation, _r.Looting, _r.Meta };
for (int i = 0; i < Subsystems.Length; i++)
{
- Key(dl, i, on[i], new Vector2(kx, y), new Vector2(Px(KeyW), h));
- kx += Px(KeyW) + Px(KeyGap);
+ Key(dl, i, on[i], new Vector2(kx, y), new Vector2(kw, h));
+ kx += kw + Px(KeyGap);
}
+ float keysEnd = kx - Px(KeyGap);
- // Force rebuff, set apart at the right.
+ // Auto-sort, then Force rebuff, set apart at the right.
Vector2 fp = new(x0 + w - Px(FrW), y), fs = new(Px(FrW), h);
- dl.AddLine(new Vector2(fp.X - Px(Gap) - 0.5f, y + (h - Px(18)) * 0.5f), new Vector2(fp.X - Px(Gap) - 0.5f, y + (h + Px(18)) * 0.5f), _line);
+ float group = fp.X;
+ if (sort >= 0)
+ {
+ group = fp.X - Px(KeyGap) - kw;
+ SortKey(dl, sort == 1, new Vector2(group, y), new Vector2(kw, h));
+ }
+ float lx = MathF.Round(MathF.Max(group - Px(Gap), keysEnd + (group - keysEnd) * 0.5f)) - 0.5f;
+ dl.AddLine(new Vector2(lx, y + (h - Px(18)) * 0.5f), new Vector2(lx, y + (h + Px(18)) * 0.5f), _line);
ImGui.SetCursorScreenPos(fp);
if (ImGui.InvisibleButton("##fr", fs, ImGuiButtonFlags.MouseButtonLeft | ImGuiButtonFlags.MouseButtonRight)
&& ImGui.IsMouseReleased(ImGuiMouseButton.Left))
@@ -467,6 +489,29 @@ internal sealed unsafe class InstrumentDashboard
bool right = ImGui.IsItemClicked(ImGuiMouseButton.Right);
bool hot = ImGui.IsItemHovered();
SafeImGui.SetItemTooltip((on ? s.Name + " on. Click to turn it off." : s.Name + " off. Click to turn it on.") + "\nRight-click: " + s.Right + ".");
+ KeyFace(dl, s.Icon, on, hot, pos, size);
+ if (clicked) _d.SetSubsystem(i, !on);
+ if (right) SubsystemSettings(i);
+ }
+
+ /// RynthSort's auto-sort, a key like the subsystems'. Click: on/off; right-click: RynthSort's window.
+ private void SortKey(ImDrawListPtr dl, bool on, Vector2 pos, Vector2 size)
+ {
+ ImGui.SetCursorScreenPos(pos);
+ bool clicked = ImGui.InvisibleButton("##key_sort", size, ImGuiButtonFlags.MouseButtonLeft | ImGuiButtonFlags.MouseButtonRight)
+ && ImGui.IsMouseReleased(ImGuiMouseButton.Left);
+ bool right = ImGui.IsItemClicked(ImGuiMouseButton.Right);
+ bool hot = ImGui.IsItemHovered();
+ SafeImGui.SetItemTooltip(on ? "Auto-sort (RynthSort) on. Click to turn it off.\nRight-click: RynthSort's window."
+ : "Auto-sort (RynthSort) off. Click to turn it on.\nRight-click: RynthSort's window.");
+ KeyFace(dl, RynthIcons.SortAscending, on, hot, pos, size);
+ if (clicked) _d.SetAutoSort(!on);
+ if (right) _d.ToggleSortWindow();
+ }
+
+ /// A key's face: raised with its LED lit when on, flat and dim when off.
+ private void KeyFace(ImDrawListPtr dl, string icon, bool on, bool hot, Vector2 pos, Vector2 size)
+ {
float r = Px(3);
if (on)
{
@@ -478,7 +523,7 @@ internal sealed unsafe class InstrumentDashboard
{
dl.AddRect(pos, pos + size, Mix(_bg, _line, 0.55f), r);
}
- DrawIcon(dl, s.Icon, pos, size, Px(15), on || hot ? _text : _faint);
+ DrawIcon(dl, icon, pos, size, Px(15), on || hot ? _text : _faint);
// The LED, top right: lit in the accent with a glow, or dark.
Vector2 led = new(pos.X + size.X - Px(6), pos.Y + Px(6));
if (on)
@@ -491,8 +536,6 @@ internal sealed unsafe class InstrumentDashboard
dl.AddCircleFilled(led, Px(2), _inset, 12);
dl.AddCircle(led, Px(2), _line, 12, 1f);
}
- if (clicked) _d.SetSubsystem(i, !on);
- if (right) SubsystemSettings(i);
}
/// A key's right-click: its settings.
@@ -543,7 +586,7 @@ internal sealed unsafe class InstrumentDashboard
Vector2 p = new(bx, y), s = new(ex - bx, h);
bool lit = l.Label switch
{
- "Patrol" => !_popped && prefs.IsOpen(DashboardPrefs.PatrolDrawer),
+ "Patrol" => prefs.IsOpen(DashboardPrefs.PatrolDrawer),
"Char" => host.SetPanelOpen(OracleKey, RynthPanelOpen.Ask) == 1 || host.SetPanelOpen("Mini Remote", RynthPanelOpen.Ask) == 1,
_ => host.SetPanelOpen(l.Key, RynthPanelOpen.Ask) == 1,
};
@@ -598,7 +641,7 @@ internal sealed unsafe class InstrumentDashboard
{
if (label == "Patrol")
{
- if (!_popped) prefs.ToggleDrawer(DashboardPrefs.PatrolDrawer);
+ prefs.ToggleDrawer(DashboardPrefs.PatrolDrawer);
}
else if (label == "Char")
{
@@ -887,7 +930,8 @@ internal sealed unsafe class InstrumentDashboard
}
if (_popped)
{
- // No drawers popped out: the pickers are here.
+ // Popped out the pickers are here as well (an older RynthCore's pop-out lets clicks
+ // beside the panel through, so its drawers can't be used).
p.Y += Px(4);
dl.AddLine(new Vector2(p.X, p.Y + 0.5f), new Vector2(p.X + w, p.Y + 0.5f), _line);
p.Y += Px(5);
@@ -1059,7 +1103,7 @@ internal sealed unsafe class InstrumentDashboard
if (ImGui.MenuItem(key, command, state == 1)) host.SetPanelOpen(key, RynthPanelOpen.Toggle);
}
- // ── Drawers (docked): tabs on both edges, one panel open per side ───
+ // ── Drawers: tabs on both edges, one panel open per side ────────────
//
// Ranges, Loaded files, Patrol and the Mini Remote start on the left edge, My settings on the
// right; a tab's right-click moves its drawer to the other edge (DashboardPrefs keeps the sides,
@@ -1214,7 +1258,7 @@ internal sealed unsafe class InstrumentDashboard
ImGui.End();
}
- if (si >= 0 && shown >= 1f) DrawerPanel(prefs, DrawerDefs[si], si, panelW, shown, winX, panelX, dashPos.Y, right);
+ if (si >= 0 && shown >= 1f) DrawerPanel(prefs, DrawerDefs[si], si, panelW, shown, winX, panelX, dashPos.Y, dashSize.Y, right);
}
private int TabsOn(DashboardPrefs prefs, bool right)
@@ -1225,6 +1269,7 @@ internal sealed unsafe class InstrumentDashboard
}
private const float SlideSeconds = 0.16f;
+ private const float PopOutReach = 600f;
private readonly float[] _slideT = new float[2]; // left, right: 0 closed .. 1 open
private readonly string[] _slideKey = { string.Empty, string.Empty }; // the drawer whose panel draws
@@ -1272,12 +1317,15 @@ internal sealed unsafe class InstrumentDashboard
/// pixels of , from ), the panel drawn whole at
/// and clipped to it.
///
- private void DrawerPanel(DashboardPrefs prefs, DrawerDef def, int di, float panelW, float shown, float winX, float x, float top, bool right)
+ private void DrawerPanel(DashboardPrefs prefs, DrawerDef def, int di, float panelW, float shown, float winX, float x, float top, float dashH, bool right)
{
Vector2 display = ImGui.GetIO().DisplaySize;
// The frame around the body: padding, the title row, the gap under it.
float chrome = Px(7) + Px(20) + Px(5) + Px(8);
float maxBody = display.Y > 1 ? Math.Max(Px(60), display.Y - top - chrome - Px(8)) : Px(600);
+ // Popped out, the picture reaches at most PopOutReach pixels past the panel (RynthCore's
+ // ImGuiPopOuts.MaxMargin is 640): a longer drawer scrolls.
+ if (_popped) maxBody = Math.Max(Px(60), Math.Min(maxBody, dashH + PopOutReach - chrome));
float body = def.Key switch
{
DashboardPrefs.FilesDrawer => FilesHeight(),
diff --git a/Plugins/RynthCore.Plugin.RynthAi/GroundLootController.cs b/Plugins/RynthCore.Plugin.RynthAi/GroundLootController.cs
index 2017b85..01e5990 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/GroundLootController.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/GroundLootController.cs
@@ -323,7 +323,7 @@ public sealed partial class RynthAiPlugin
private void HandleGroundLootCommand(string[] parts)
{
var settings = _dashboard?.Settings;
- if (settings == null) { ChatLine("[RynthAi] Not logged in."); return; }
+ if (settings == null) { ReplyFail("[RynthAi] Not logged in."); return; }
string verb = parts.Length >= 3 ? parts[2].Trim().ToLowerInvariant() : "status";
switch (verb)
@@ -331,17 +331,17 @@ public sealed partial class RynthAiPlugin
case "on":
settings.EnableGroundLoot = true;
_dashboard?.SaveSettings();
- ChatLine("[RynthAi] Ground loot ON (uses the loot profile and the corpse max range).");
+ ReplyOk("[RynthAi] Ground loot ON (uses the loot profile and the corpse max range).");
break;
case "off":
settings.EnableGroundLoot = false;
ResetGroundLoot(clearCaches: true);
_dashboard?.SaveSettings();
- ChatLine("[RynthAi] Ground loot OFF.");
+ ReplyOk("[RynthAi] Ground loot OFF.");
break;
case "scan":
ResetGroundLoot(clearCaches: true);
- ChatLine("[RynthAi] Ground loot: cleared skip list; rescanning.");
+ ReplyOk("[RynthAi] Ground loot: cleared skip list; rescanning.");
break;
default:
double yards = settings.CorpseApproachRangeMax;
diff --git a/Plugins/RynthCore.Plugin.RynthAi/MagToolsCommands.Extra.cs b/Plugins/RynthCore.Plugin.RynthAi/MagToolsCommands.Extra.cs
index df9b475..8284526 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/MagToolsCommands.Extra.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/MagToolsCommands.Extra.cs
@@ -55,12 +55,10 @@ public sealed partial class RynthAiPlugin
private bool KeystrokesAllowed(string verb)
{
if (_dashboard?.Settings.AllowMetaKeystrokes == true) return true;
- if (_keystrokeRefusalSaid.Add(verb))
- {
- string msg = $"[RynthAi] {verb} ignored: it sends keys or clicks to the game window, and 'Allow metas to send keystrokes (/mt send)' is off (Settings, Advanced). Said once.";
- Log(msg);
- ChatLine(msg);
- }
+ string why = $"[RynthAi] {verb} ignored: it sends keys or clicks to the game window, and 'Allow metas to send keystrokes (/mt send)' is off (Settings, Advanced).";
+ // Typed: said every time (a typed command always answers). A meta: said once per verb.
+ if (!Reply.FromScript) ReplyFail(why);
+ else if (_keystrokeRefusalSaid.Add(verb)) ReplyFail(why + " Said once.");
return false;
}
@@ -72,9 +70,7 @@ public sealed partial class RynthAiPlugin
private bool RequireRunningMeta(string verb)
{
if (MetaCommandActive) return true;
- string msg = $"[RynthAi] {verb} only runs from a meta that is running (macro and Meta on); refused.";
- Log(msg);
- ChatLine(msg);
+ ReplyFail($"[RynthAi] {verb} only runs from a meta that is running (macro and Meta on); refused.");
return false;
}
@@ -95,13 +91,13 @@ public sealed partial class RynthAiPlugin
case "autopack":
// Mag-Tools packs by its own rules; RynthAi's equivalent is a cram + stack pass.
_inventoryManager?.RunManual(cram: true, stack: true);
- ChatLine("[RynthAi] Autopack: cramming items into side packs and stacking them.");
+ ReplyOk("[RynthAi] Autopack: cramming items into side packs and stacking them.");
return true;
case "dumpspells": return HandleMtDumpSpells();
case "click": return HandleMtClick(parts);
case "get":
if (parts.Length >= 3 && parts[2].Equals("xy", StringComparison.OrdinalIgnoreCase)) return HandleMtCursor();
- ChatLine("[RynthAi] Usage: /mt get xy");
+ ReplyFail("[RynthAi] Usage: /mt get xy");
return true;
case "cursor": return HandleMtCursor();
case "movement": return HandleMtMovement(parts);
@@ -124,36 +120,43 @@ public sealed partial class RynthAiPlugin
///
private bool HandleMtSend(string[] parts, string fullCommand)
{
- if (parts.Length < 3) { ChatLine("[RynthAi] Usage: /mt send enter|pause|del|space|f4|f12|cntrl+|msg "); return true; }
+ const string usage = "[RynthAi] Usage: /mt send enter|pause|del|space|f4|f12|cntrl+|msg ";
+ if (parts.Length < 3) { ReplyFail(usage); return true; }
string arg = parts[2].ToLowerInvariant();
if (parts[2].StartsWith('/'))
{
- if (Host.HasInvokeChatParser) Host.InvokeChatParser(string.Join(" ", parts, 2, parts.Length - 2));
+ // The command answers for itself.
+ if (Host.HasInvokeChatParser) { Host.InvokeChatParser(string.Join(" ", parts, 2, parts.Length - 2)); Reply.Answered(); }
+ else ReplyFail("[RynthAi] /mt send: the chat parser isn't available.");
return true;
}
if (!KeystrokesAllowed("/mt send")) return true;
- if (!GameInput.Available) { ChatLine("[RynthAi] /mt send: the game window wasn't found."); return true; }
- Log($"[RynthAi] /mt send {string.Join(" ", parts, 2, Math.Min(parts.Length - 2, 2))}: keys posted to the game window");
+ if (!GameInput.Available) { ReplyFail("[RynthAi] /mt send: the game window wasn't found."); return true; }
+ string what = string.Join(" ", parts, 2, Math.Min(parts.Length - 2, 2));
+ Log($"[RynthAi] /mt send {what}: keys posted to the game window");
+ string sent = $"[RynthAi] /mt send {what}: sent to the game window.";
switch (arg)
{
- case "enter": GameInput.SendEnter(); return true;
- case "pause": GameInput.SendPause(); return true;
- case "del": GameInput.SendDel(); return true;
- case "space": GameInput.SendSpace(); return true;
- case "f4": GameInput.SendF4(); return true;
- case "f12": GameInput.SendF12(); return true;
+ case "enter": GameInput.SendEnter(); ReplyOk(sent); return true;
+ case "pause": GameInput.SendPause(); ReplyOk(sent); return true;
+ case "del": GameInput.SendDel(); ReplyOk(sent); return true;
+ case "space": GameInput.SendSpace(); ReplyOk(sent); return true;
+ case "f4": GameInput.SendF4(); ReplyOk(sent); return true;
+ case "f12": GameInput.SendF12(); ReplyOk(sent); return true;
case "msg":
int at = fullCommand.IndexOf(" msg ", StringComparison.OrdinalIgnoreCase);
- if (at < 0 || at + 5 >= fullCommand.Length) { ChatLine("[RynthAi] Usage: /mt send msg "); return true; }
+ if (at < 0 || at + 5 >= fullCommand.Length) { ReplyFail("[RynthAi] Usage: /mt send msg "); return true; }
GameInput.SendMsg(fullCommand[(at + 5)..]);
+ ReplyOk("[RynthAi] /mt send msg: typed into the game window.");
return true;
}
if (arg.StartsWith("cntrl+", StringComparison.Ordinal) && arg.Length >= 7)
{
GameInput.SendCntrl(arg[6]);
+ ReplyOk(sent);
return true;
}
- ChatLine("[RynthAi] Usage: /mt send enter|pause|del|space|f4|f12|cntrl+|msg ");
+ ReplyFail(usage);
return true;
}
@@ -171,11 +174,12 @@ public sealed partial class RynthAiPlugin
ms = Math.Clamp(ms, 0, 1000);
string letters = (w ? "w" : "") + (x ? "x" : "") + (z ? "z" : "") + (c ? "c" : "") + (shift ? "s" : "");
- if (_jumper != null && _jumper.Start(letters, null, ms)) return true;
+ if (_jumper != null && _jumper.Start(letters, null, ms)) { ReplyOk(JumpLine(letters, null, ms)); return true; }
if (_jumper?.IsBusy == true) return true; // it said so in chat
if (!KeystrokesAllowed("/mt jump (keys)")) return true;
- if (!GameInput.Available) { ChatLine("[RynthAi] /mt jump: no jump hook and no game window."); return true; }
+ if (!GameInput.Available) { ReplyFail("[RynthAi] /mt jump: no jump hook and no game window."); return true; }
GameInput.SendSpace(ms, shift, w, z, x, c);
+ ReplyOk(JumpLine(letters, null, ms) + " (the space key)");
return true;
}
@@ -184,37 +188,44 @@ public sealed partial class RynthAiPlugin
/// /mt trade add|addp <item> | accept | decline | reset | end.
private bool HandleMtTrade(string[] parts)
{
- if (parts.Length < 3) { ChatLine("[RynthAi] Usage: /mt trade add|addp - | accept | decline | reset | end"); return true; }
+ if (parts.Length < 3) { ReplyFail("[RynthAi] Usage: /mt trade add|addp
- | accept | decline | reset | end"); return true; }
string sub = parts[2].ToLowerInvariant();
// Completing a trade is only ever a running meta's doing (checked before anything else).
if (sub == "accept" && !RequireRunningMeta("/mt trade accept")) return true;
- if (!Host.HasTrade) { ChatLine("[RynthAi] Trading needs a newer RynthCore engine."); return true; }
+ if (!Host.HasTrade) { ReplyFail("[RynthAi] Trading needs a newer RynthCore engine."); return true; }
switch (sub)
{
case "add":
case "addp":
{
- if (parts.Length < 4) { ChatLine($"[RynthAi] Usage: /mt trade {sub}
- "); return true; }
+ if (parts.Length < 4) { ReplyFail($"[RynthAi] Usage: /mt trade {sub}
- "); return true; }
string name = string.Join(" ", parts, 3, parts.Length - 3);
var item = FindObject(name, inv: true, land: false, partial: sub == "addp");
- if (item == null) { ChatLine($"[RynthAi] Item not found: '{name}'"); return true; }
- ChatLine(Host.TradeAdd(unchecked((uint)item.Id))
- ? $"[RynthAi] Added {item.Name} to the trade." : "[RynthAi] Could not add it to the trade.");
+ if (item == null) { ReplyFail($"[RynthAi] Item not found: '{name}'"); return true; }
+ if (Host.TradeAdd(unchecked((uint)item.Id))) ReplyOk($"[RynthAi] Added {item.Name} to the trade.");
+ else ReplyFail("[RynthAi] Could not add it to the trade.");
return true;
}
case "accept":
Log("[RynthAi] /mt trade accept (from the running meta)");
- Host.TradeAccept();
+ TradeSaid(Host.TradeAccept(), "Accepting the trade.", "accept");
return true;
- case "decline": Host.TradeDecline(); return true;
- case "reset": Host.TradeReset(); return true;
- case "end": Host.TradeClose(); return true;
+ case "decline": TradeSaid(Host.TradeDecline(), "Declining the trade.", "decline"); return true;
+ case "reset": TradeSaid(Host.TradeReset(), "Clearing the trade window.", "reset"); return true;
+ case "end": TradeSaid(Host.TradeClose(), "Closing the trade.", "close"); return true;
default:
- ChatLine("[RynthAi] Usage: /mt trade add|addp
- | accept | decline | reset | end");
+ ReplyFail("[RynthAi] Usage: /mt trade add|addp
- | accept | decline | reset | end");
return true;
}
}
+ ///
A trade action's answer: what it does, or that it couldn't be sent.
+ private void TradeSaid(bool sent, string ok, string what)
+ {
+ if (sent) ReplyOk("[RynthAi] " + ok);
+ else ReplyFail($"[RynthAi] Could not send the trade {what}.");
+ }
+
// ── vendor ───────────────────────────────────────────────────────────────────
///
@@ -224,15 +235,15 @@ public sealed partial class RynthAiPlugin
private bool HandleMtVendor(string[] parts)
{
const string usage = "[RynthAi] Usage: /mt vendor addbuy|addbuyp - [count] | addsell|addsellp
- | buy | clearbuy | sell | clearsell";
- if (parts.Length < 3) { ChatLine(usage); return true; }
+ if (parts.Length < 3) { ReplyFail(usage); return true; }
// Spending or selling is only ever a running meta's doing (checked before anything else).
string verb = parts[2].ToLowerInvariant();
if (verb == "buy" && !RequireRunningMeta("/mt vendor buy")) return true;
if (verb == "sell" && !RequireRunningMeta("/mt vendor sell")) return true;
- if (!Host.HasVendorTrade) { ChatLine("[RynthAi] Vendor trading needs a newer RynthCore engine."); return true; }
+ if (!Host.HasVendorTrade) { ReplyFail("[RynthAi] Vendor trading needs a newer RynthCore engine."); return true; }
if (!Host.TryGetVendorInfo(out VendorInfo info) || info.VendorId == 0)
{
- ChatLine("[RynthAi] No vendor is open.");
+ ReplyFail("[RynthAi] No vendor is open.");
return true;
}
string sub = parts[2].ToLowerInvariant();
@@ -241,7 +252,7 @@ public sealed partial class RynthAiPlugin
case "addbuy":
case "addbuyp":
{
- if (parts.Length < 4) { ChatLine($"[RynthAi] Usage: /mt vendor {sub}
- [count]"); return true; }
+ if (parts.Length < 4) { ReplyFail($"[RynthAi] Usage: /mt vendor {sub}
- [count]"); return true; }
var words = parts.Skip(3).ToList();
int count = 1;
if (words.Count > 1 && int.TryParse(words[^1], out int n) && n > 0) { count = n; words.RemoveAt(words.Count - 1); }
@@ -250,42 +261,42 @@ public sealed partial class RynthAiPlugin
VendorItem? item = Host.GetVendorItems().FirstOrDefault(v => partial
? v.Name.IndexOf(name, StringComparison.OrdinalIgnoreCase) >= 0
: string.Equals(v.Name, name, StringComparison.OrdinalIgnoreCase));
- if (item == null) { ChatLine($"[RynthAi] {info.Name} doesn't sell '{name}'."); return true; }
+ if (item == null) { ReplyFail($"[RynthAi] {info.Name} doesn't sell '{name}'."); return true; }
_mtBuyList.Add((item.ObjectId, item.Name, count));
- ChatLine($"[RynthAi] Buy list: {count} x {item.Name} ({_mtBuyList.Count} entr{(_mtBuyList.Count == 1 ? "y" : "ies")}).");
+ ReplyOk($"[RynthAi] Buy list: {count} x {item.Name} ({_mtBuyList.Count} entr{(_mtBuyList.Count == 1 ? "y" : "ies")}).");
return true;
}
case "addsell":
case "addsellp":
{
- if (parts.Length < 4) { ChatLine($"[RynthAi] Usage: /mt vendor {sub}
- "); return true; }
+ if (parts.Length < 4) { ReplyFail($"[RynthAi] Usage: /mt vendor {sub}
- "); return true; }
string name = string.Join(" ", parts, 3, parts.Length - 3);
var item = FindObject(name, inv: true, land: false, partial: sub == "addsellp");
- if (item == null) { ChatLine($"[RynthAi] Item not found: '{name}'"); return true; }
+ if (item == null) { ReplyFail($"[RynthAi] Item not found: '{name}'"); return true; }
uint id = unchecked((uint)item.Id);
if (!_mtSellList.Any(s => s.Id == id)) _mtSellList.Add((id, item.Name));
- ChatLine($"[RynthAi] Sell list: {item.Name} ({_mtSellList.Count} item(s)).");
+ ReplyOk($"[RynthAi] Sell list: {item.Name} ({_mtSellList.Count} item(s)).");
return true;
}
case "buy":
{
- if (_mtBuyList.Count == 0) { ChatLine("[RynthAi] The buy list is empty (/mt vendor addbuy
- [count])."); return true; }
+ if (_mtBuyList.Count == 0) { ReplyFail("[RynthAi] The buy list is empty (/mt vendor addbuy
- [count])."); return true; }
var entries = _mtBuyList.Select(b => new VendorTradeEntryNative(b.Id, b.Amount)).ToList();
Log($"[RynthAi] /mt vendor buy (from the running meta): {_mtBuyList.Count} entr{(_mtBuyList.Count == 1 ? "y" : "ies")} from {info.Name} 0x{info.VendorId:X8}: "
+ string.Join(", ", _mtBuyList.Select(b => $"{b.Amount} x {b.Name}")));
uint sent = Host.VendorBuy(info.VendorId, entries);
- ChatLine(sent != 0 ? $"[RynthAi] Buying {_mtBuyList.Count} entr{(_mtBuyList.Count == 1 ? "y" : "ies")} from {info.Name}."
- : "[RynthAi] The buy could not be sent.");
+ if (sent != 0) ReplyOk($"[RynthAi] Buying {_mtBuyList.Count} entr{(_mtBuyList.Count == 1 ? "y" : "ies")} from {info.Name}.");
+ else ReplyFail("[RynthAi] The buy could not be sent.");
if (sent != 0) _mtBuyList.Clear();
return true;
}
case "clearbuy":
_mtBuyList.Clear();
- ChatLine("[RynthAi] Buy list cleared.");
+ ReplyOk("[RynthAi] Buy list cleared.");
return true;
case "sell":
{
- if (_mtSellList.Count == 0) { ChatLine("[RynthAi] The sell list is empty (/mt vendor addsell
- )."); return true; }
+ if (_mtSellList.Count == 0) { ReplyFail("[RynthAi] The sell list is empty (/mt vendor addsell
- )."); return true; }
// Checked again now, not only when the item was listed: it may have been worn since,
// and RynthAi's own gear and consumables are never sold by a meta.
var toSell = new List<(uint Id, string Name)>();
@@ -299,22 +310,23 @@ public sealed partial class RynthAiPlugin
if (toSell.Count == 0)
{
_mtSellList.Clear();
- ChatLine("[RynthAi] Nothing left to sell: every listed item is protected.");
+ ReplyFail("[RynthAi] Nothing left to sell: every listed item is protected.");
return true;
}
Log($"[RynthAi] /mt vendor sell (from the running meta): {toSell.Count} item(s) to {info.Name} 0x{info.VendorId:X8}: "
+ string.Join(", ", toSell.Select(s => s.Name)));
uint sent = Host.VendorSell(info.VendorId, toSell.Select(s => s.Id).ToList());
- ChatLine(sent != 0 ? $"[RynthAi] Selling {toSell.Count} item(s) to {info.Name}." : "[RynthAi] The sell could not be sent.");
+ if (sent != 0) ReplyOk($"[RynthAi] Selling {toSell.Count} item(s) to {info.Name}.");
+ else ReplyFail("[RynthAi] The sell could not be sent.");
if (sent != 0) _mtSellList.Clear();
return true;
}
case "clearsell":
_mtSellList.Clear();
- ChatLine("[RynthAi] Sell list cleared.");
+ ReplyOk("[RynthAi] Sell list cleared.");
return true;
default:
- ChatLine(usage);
+ ReplyFail(usage);
return true;
}
}
@@ -374,9 +386,9 @@ public sealed partial class RynthAiPlugin
w.WriteLine($"{id}\t{name}\t{family}\t{difficulty}");
}
}
- ChatLine($"[RynthAi] {rows.Count} spells written to {path}");
+ ReplyOk($"[RynthAi] {rows.Count} spells written to {path}");
}
- catch (Exception ex) { ChatLine($"[RynthAi] /mt dumpspells failed: {ex.Message}"); }
+ catch (Exception ex) { ReplyFail($"[RynthAi] /mt dumpspells failed: {ex.Message}"); }
return true;
}
@@ -390,9 +402,9 @@ public sealed partial class RynthAiPlugin
///
private void HandleEquipForCommand(string[] parts)
{
- if (parts.Length < 3) { ChatLine("[RynthAi] Usage: /ra equipfor "); return; }
+ if (parts.Length < 3) { ReplyFail("[RynthAi] Usage: /ra equipfor "); return; }
var rules = _dashboard?.Settings?.MonsterRules;
- if (rules == null || rules.Count == 0) { ChatLine("[RynthAi] No monster rules loaded."); return; }
+ if (rules == null || rules.Count == 0) { ReplyFail("[RynthAi] No monster rules loaded."); return; }
string monster = string.Join(" ", parts, 2, parts.Length - 2).Trim();
var rule = rules.FirstOrDefault(r => string.Equals(r.Name, monster, StringComparison.OrdinalIgnoreCase))
@@ -400,28 +412,28 @@ public sealed partial class RynthAiPlugin
&& r.Name.Length > 0 && monster.IndexOf(r.Name, StringComparison.OrdinalIgnoreCase) >= 0)
.OrderByDescending(r => r.Name.Length).FirstOrDefault()
?? rules.FirstOrDefault(r => string.Equals(r.Name, "Default", StringComparison.OrdinalIgnoreCase));
- if (rule == null) { ChatLine($"[RynthAi] No monster rule for '{monster}'."); return; }
+ if (rule == null) { ReplyFail($"[RynthAi] No monster rule for '{monster}'."); return; }
var ids = new List();
if (rule.WeaponId != 0) ids.Add(rule.WeaponId);
if (rule.OffhandId != 0) ids.Add(rule.OffhandId);
if (ids.Count == 0)
{
- ChatLine($"[RynthAi] '{rule.Name}' has no set weapon (combat picks one when it fights '{monster}').");
+ ReplyOk($"[RynthAi] '{rule.Name}' has no set weapon (combat picks one when it fights '{monster}').");
return;
}
- if (!Host.HasUseObject) { ChatLine("[RynthAi] UseObject not available."); return; }
+ if (!Host.HasUseObject) { ReplyFail("[RynthAi] UseObject not available."); return; }
int sent = 0;
foreach (int id in ids)
{
var wo = _objectCache?[id];
- if (wo == null) { ChatLine($"[RynthAi] '{rule.Name}': item 0x{(uint)id:X8} isn't carried."); continue; }
+ if (wo == null) { ReplyFail($"[RynthAi] '{rule.Name}': item 0x{(uint)id:X8} isn't carried."); continue; }
if (wo.Values(LongValueKey.CurrentWieldedLocation, 0) > 0) continue; // already wielded
Host.UseFor(unchecked((uint)id), "Command", "/ra equipfor", UseKind.Asked);
sent++;
}
- ChatLine(sent > 0 ? $"[RynthAi] Equipping for '{monster}' ({rule.Name}): {sent} item(s)."
+ ReplyOk(sent > 0 ? $"[RynthAi] Equipping for '{monster}' ({rule.Name}): {sent} item(s)."
: $"[RynthAi] '{rule.Name}' gear for '{monster}' is already wielded.");
}
@@ -430,21 +442,22 @@ public sealed partial class RynthAiPlugin
/// /mt click ok|yes|no|<x> <y>: a click in the game window (window coordinates).
private bool HandleMtClick(string[] parts)
{
- if (parts.Length < 3) { ChatLine("[RynthAi] Usage: /mt click ok|yes|no| "); return true; }
+ if (parts.Length < 3) { ReplyFail("[RynthAi] Usage: /mt click ok|yes|no| "); return true; }
if (!KeystrokesAllowed("/mt click")) return true;
- if (!GameInput.Available) { ChatLine("[RynthAi] /mt click: the game window wasn't found."); return true; }
+ if (!GameInput.Available) { ReplyFail("[RynthAi] /mt click: the game window wasn't found."); return true; }
switch (parts[2].ToLowerInvariant())
{
- case "ok": GameInput.ClickOK(); return true;
- case "yes": GameInput.ClickYes(); return true;
- case "no": GameInput.ClickNo(); return true;
+ case "ok": GameInput.ClickOK(); ReplyOk("[RynthAi] Clicked OK."); return true;
+ case "yes": GameInput.ClickYes(); ReplyOk("[RynthAi] Clicked Yes."); return true;
+ case "no": GameInput.ClickNo(); ReplyOk("[RynthAi] Clicked No."); return true;
}
if (parts.Length >= 4 && int.TryParse(parts[2], out int x) && int.TryParse(parts[3], out int y))
{
GameInput.SendMouseClick(x, y);
+ ReplyOk($"[RynthAi] Clicked at {x},{y} in the game window.");
return true;
}
- ChatLine("[RynthAi] Usage: /mt click ok|yes|no| ");
+ ReplyFail("[RynthAi] Usage: /mt click ok|yes|no| ");
return true;
}
@@ -462,12 +475,13 @@ public sealed partial class RynthAiPlugin
{
if (parts.Length != 4 || parts[2].Length != 1 || !int.TryParse(parts[3], out int ms) || ms < 0)
{
- ChatLine("[RynthAi] Usage: /mt movement (e.g. /mt movement w 1500)");
+ ReplyFail("[RynthAi] Usage: /mt movement (e.g. /mt movement w 1500)");
return true;
}
if (!KeystrokesAllowed("/mt movement")) return true;
- if (!GameInput.Available) { ChatLine("[RynthAi] /mt movement: the game window wasn't found."); return true; }
+ if (!GameInput.Available) { ReplyFail("[RynthAi] /mt movement: the game window wasn't found."); return true; }
GameInput.SendMovement(parts[2][0], ms);
+ ReplyOk($"[RynthAi] Holding '{parts[2][0]}' for {ms} ms.");
return true;
}
@@ -476,14 +490,15 @@ public sealed partial class RynthAiPlugin
{
if (parts.Length != 4 || !int.TryParse(parts[3], out int ms) || ms < 0)
{
- ChatLine("[RynthAi] Usage: /mt strafe left|l|right|r ");
+ ReplyFail("[RynthAi] Usage: /mt strafe left|l|right|r ");
return true;
}
char key = parts[2].ToLowerInvariant() switch { "left" or "l" => 'z', "right" or "r" => 'c', _ => '\0' };
- if (key == '\0') { ChatLine("[RynthAi] /mt strafe: left, l, right or r."); return true; }
+ if (key == '\0') { ReplyFail("[RynthAi] Usage: /mt strafe left|l|right|r "); return true; }
if (!KeystrokesAllowed("/mt strafe")) return true;
- if (!GameInput.Available) { ChatLine("[RynthAi] /mt strafe: the game window wasn't found."); return true; }
+ if (!GameInput.Available) { ReplyFail("[RynthAi] /mt strafe: the game window wasn't found."); return true; }
GameInput.SendMovement(key, ms);
+ ReplyOk($"[RynthAi] Strafing {(key == 'z' ? "left" : "right")} for {ms} ms.");
return true;
}
@@ -493,13 +508,13 @@ public sealed partial class RynthAiPlugin
string sub = parts.Length >= 3 ? parts[2].ToLowerInvariant() : "";
switch (sub)
{
- case "minimize": if (KeystrokesAllowed("/mt client")) GameInput.Minimize(); return true;
- case "restore": if (KeystrokesAllowed("/mt client")) GameInput.Restore(); return true;
+ case "minimize": if (KeystrokesAllowed("/mt client")) { GameInput.Minimize(); ReplyOk("[RynthAi] Game window minimized."); } return true;
+ case "restore": if (KeystrokesAllowed("/mt client")) { GameInput.Restore(); ReplyOk("[RynthAi] Game window restored."); } return true;
case "frame":
- ChatLine("[RynthAi] The window frame is RynthCore's: Settings > Display (Borderless Windowed, Reset Window Borders) or /rc window reset.");
+ ChatLine("[RynthAi] The window frame is RynthCore's: Settings > Display, Borderless Windowed (there is no chat command for it).");
return true;
default:
- ChatLine("[RynthAi] Usage: /mt client minimize | restore");
+ ReplyFail("[RynthAi] Usage: /mt client minimize | restore");
return true;
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/MagToolsCommands.cs b/Plugins/RynthCore.Plugin.RynthAi/MagToolsCommands.cs
index 719bf26..ff23ac0 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/MagToolsCommands.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/MagToolsCommands.cs
@@ -82,14 +82,16 @@ public sealed partial class RynthAiPlugin
// ── Session ──────────────────────────────────────────────────────
case "logoff":
case "logout":
- if (Host.HasInvokeChatParser) Host.InvokeChatParser("/logout");
+ if (Host.HasInvokeChatParser) { Host.InvokeChatParser("/logout"); Reply.Answered(); } // the client logs out
+ else ReplyFail("[RynthAi] Can't log out: the chat parser isn't available.");
return true;
case "quit":
case "exit":
// Close the client (also /ub quit|exit, which land here). "/quit" is not an AC
// client command and did nothing; the engine's /rc quit closes the client the way
// its close button does, logging the character off.
- if (Host.HasInvokeChatParser) Host.InvokeChatParser("/rc quit");
+ if (Host.HasInvokeChatParser) { Host.InvokeChatParser("/rc quit"); Reply.Answered(); } // the client closes
+ else ReplyFail("[RynthAi] Can't close the client: the chat parser isn't available.");
return true;
// ── Keys in the game window (Mag-Tools /mt send); a "/" line is still sent as a command ──
@@ -119,7 +121,7 @@ public sealed partial class RynthAiPlugin
if (sub == "list")
{
var map = _metaManager?.Expressions?.BuildSettingsMapPublic();
- if (map == null) { ChatLine("[RynthAi] Settings not ready."); return true; }
+ if (map == null) { ReplyFail("[RynthAi] Settings not ready."); return true; }
ChatLine("[RynthAi] === Options ===");
foreach (var kvp in map)
ChatLine($"[RynthAi] {kvp.Key} = {kvp.Value.Get()}");
@@ -130,9 +132,8 @@ public sealed partial class RynthAiPlugin
{
string optName = parts[3];
string? val = GetOptionValue(optName);
- ChatLine(val != null
- ? $"[RynthAi] {optName} = {val}"
- : $"[RynthAi] Unknown option: {optName}");
+ if (val != null && OptionKnown(optName)) ChatLine($"[RynthAi] {optName} = {val}");
+ else ReplyFail($"[RynthAi] Unknown option: {optName} (/mt opt list shows them).");
return true;
}
@@ -140,7 +141,9 @@ public sealed partial class RynthAiPlugin
{
string optName = parts[3];
string optVal = parts[4];
+ if (_metaManager?.Expressions == null) { ReplyFail("[RynthAi] Settings not ready (log in first)."); return true; }
SetOptionValue(optName, optVal);
+ ReplyOptionValue(optName, optVal);
return true;
}
@@ -152,8 +155,10 @@ public sealed partial class RynthAiPlugin
if (val != null)
{
_rememberedOptions[optName.ToLower()] = val;
- Host.Log($"[RynthAi] Remembered {optName} = {val}");
+ ReplyOk($"[RynthAi] Remembered {optName} = {val}"
+ + (OptionKnown(optName) ? "" : " (not an option RynthAi maps or a meta has set)"));
}
+ else ReplyFail($"[RynthAi] Unknown option: {optName} (nothing to remember).");
return true;
}
@@ -163,14 +168,68 @@ public sealed partial class RynthAiPlugin
if (_rememberedOptions.TryGetValue(optName.ToLower(), out string? saved))
{
SetOptionValue(optName, saved);
- Host.Log($"[RynthAi] Restored {optName} = {saved}");
+ ReplyOk($"[RynthAi] Restored {optName} = {saved}");
}
+ else ReplyFail($"[RynthAi] Nothing remembered for {optName} (/mt opt remember {optName} first).");
return true;
}
return false;
}
+ /// A Mag-Tools / VTank option RynthAi maps, or one a meta has stored (an unknown name reads as 0).
+ private bool OptionKnown(string optName)
+ => MtOptionMap.ContainsKey(optName) || _metaManager?.Expressions?.Options.ContainsKey(optName) == true;
+
+ ///
+ /// After /mt opt set (and /ub opt set): the option's value now. Bools read back as 1/0; asked as
+ /// true/false/on/off they show as True/False. An option RynthAi doesn't map is only kept for metas.
+ ///
+ private void ReplyOptionValue(string optName, string asked)
+ {
+ string now = GetOptionValue(optName) ?? "(not set)";
+ bool askedBool = asked.ToLowerInvariant() is "true" or "false" or "on" or "off";
+ if (askedBool && now is "1" or "0") now = now == "1" ? "True" : "False";
+ ReplyOk($"[RynthAi] {optName} = {now}"
+ + (MtOptionMap.ContainsKey(optName) ? "" : " (not an option RynthAi maps: kept only for metas to read)"));
+ }
+
+ /// The /mt verbs RynthAi takes, for the usage line.
+ private const string MtVerbList = "opt, combatstate, face, cast[p], use[i|l][p], select[p], give[p], loot[p], drop[p], "
+ + "equip[p], dequip[p], fellow, logout, quit, send, jump, trade, vendor, autopack, dumpspells, click, get xy, "
+ + "cursor, movement, strafe, client, config, test";
+
+ /// How to use a /mt (or, with "/ub", a translated /ub) verb; null when it isn't one.
+ private static string? MtVerbUsage(string verb, string prefix) => verb switch
+ {
+ "opt" or "config" => $"{prefix} opt list | get | set | remember | restore "
+ + (prefix == "/ub" ? " | toggle " : ""),
+ "combatstate" => $"{prefix} combatstate peace|melee|missile|magic",
+ "face" => $"{prefix} face | {prefix} face , (e.g. 42.1N, 33.6E)",
+ "cast" or "castp" => $"{prefix} {verb} [on ]",
+ "use" or "usep" or "usei" or "useip" or "usepi" or "usel" or "uselp" or "usepl"
+ => $"{prefix} {verb} [on ] | {prefix} use closestnpc|closestvendor|closestportal",
+ "select" or "selectp" => $"{prefix} {verb} ",
+ "give" or "givep" => $"{prefix} {verb} {(prefix == "/ub" ? "[count] " : "")}- to
",
+ "loot" or "lootp" => $"{prefix} {verb} - (from the open corpse or chest)",
+ "drop" or "dropp" => $"{prefix} {verb}
- ",
+ "equip" or "equipp" => $"{prefix} {verb}
- ",
+ "dequip" or "dequipp" => $"{prefix} {verb}
",
+ "fellow" => $"{prefix} fellow create | open | close | disband | quit | recruit ",
+ _ => null,
+ };
+
+ /// The usage line for a /mt line RynthAi didn't take (an unknown verb or the wrong arguments).
+ private static string MtUsageFor(string line)
+ {
+ string[] w = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);
+ string verb = w.Length > 1 ? w[1].ToLowerInvariant() : "";
+ string? usage = MtVerbUsage(verb, "/mt");
+ return usage != null
+ ? "[RynthAi] Usage: " + usage
+ : $"[RynthAi] Unknown /mt command{(verb.Length > 0 ? $" '{verb}'" : "")}. RynthAi takes: {MtVerbList}.";
+ }
+
private readonly Dictionary _rememberedOptions = new(StringComparer.OrdinalIgnoreCase);
// VTank/MagTools option name → RynthAi settings name
@@ -279,7 +338,7 @@ public sealed partial class RynthAiPlugin
{
// /mt combatstate [magic,melee,missile,peace]
if (parts.Length < 3) return false;
- if (!Host.HasChangeCombatMode) { ChatLine("[RynthAi] ChangeCombatMode not available."); return true; }
+ if (!Host.HasChangeCombatMode) { ReplyFail("[RynthAi] ChangeCombatMode not available."); return true; }
string mode = parts[2].ToLower();
int cm = mode switch
@@ -291,9 +350,10 @@ public sealed partial class RynthAiPlugin
_ => 0
};
- if (cm == 0) { ChatLine($"[RynthAi] Unknown combat mode: {mode}"); return true; }
+ if (cm == 0) { ReplyFail($"[RynthAi] Unknown combat mode: {mode}. Usage: /mt combatstate peace|melee|missile|magic"); return true; }
Host.ChangeCombatModeFor(cm, "Command", "/mt combat", force: true);
+ ReplyOk($"[RynthAi] Combat mode: {mode}.");
return true;
}
@@ -316,9 +376,13 @@ public sealed partial class RynthAiPlugin
// The jumper holds navigation while it turns (nav would turn the character back) and turns
// again until it faces the heading, as ub-IT does; without it, one plain turn.
- if (_jumper != null) _jumper.Face(heading);
- else if (Host.HasTurnToHeading) Host.TurnToHeadingBy("Command", (float)(((heading % 360) + 360) % 360));
- else ChatLine("[RynthAi] TurnToHeading not available.");
+ double norm = ((heading % 360) + 360) % 360;
+ if (_jumper != null)
+ {
+ if (_jumper.Face(heading)) ReplyOk($"[RynthAi] Facing {norm:0.#}°."); // a refusal says why itself
+ }
+ else if (Host.HasTurnToHeading) { Host.TurnToHeadingBy("Command", (float)norm); ReplyOk($"[RynthAi] Facing {norm:0.#}°."); }
+ else ReplyFail("[RynthAi] TurnToHeading not available.");
return true;
}
@@ -353,7 +417,7 @@ public sealed partial class RynthAiPlugin
{
// /mt cast[p] <#|name> [on ]
if (parts.Length < 3) return false;
- if (!Host.HasCastSpell) { ChatLine("[RynthAi] CastSpell not available."); return true; }
+ if (!Host.HasCastSpell) { ReplyFail("[RynthAi] CastSpell not available."); return true; }
string argStr = string.Join(" ", parts, 2, parts.Length - 2);
@@ -370,7 +434,7 @@ public sealed partial class RynthAiPlugin
targetId = unchecked((uint)targetObj.Id);
else
{
- ChatLine($"[RynthAi] Target not found: '{targetName}'");
+ ReplyFail($"[RynthAi] Target not found: '{targetName}'");
return true;
}
}
@@ -406,7 +470,7 @@ public sealed partial class RynthAiPlugin
if (spellId == 0)
{
- ChatLine($"[RynthAi] Spell not found: '{spellArg}'");
+ ReplyFail($"[RynthAi] Spell not found: '{spellArg}'");
return true;
}
}
@@ -417,7 +481,11 @@ public sealed partial class RynthAiPlugin
targetId = Host.GetPlayerId();
}
- Host.CastSpellFor(targetId, spellId, "Command", $"spell {spellId} (/mt cast)", asked: true);
+ bool cast = Host.CastSpellFor(targetId, spellId, "Command", $"spell {spellId} (/mt cast)", asked: true);
+ string spellName = SpellDatabase.HasSpell(spellId) ? SpellDatabase.GetSpellName(spellId) : $"spell {spellId}";
+ string on = targetId == Host.GetPlayerId() ? "yourself" : (Host.TryGetObjectName(targetId, out string tn) && tn.Length > 0 ? tn : $"0x{targetId:X8}");
+ if (cast) ReplyOk($"[RynthAi] Casting {spellName} on {on}.");
+ else ReplyFail($"[RynthAi] Couldn't cast {spellName} on {on} (the engine refused it).");
return true;
}
@@ -452,11 +520,11 @@ public sealed partial class RynthAiPlugin
{
if (_objectCache == null || _playerId == 0)
{
- ChatLine("[RynthAi] Not ready.");
+ ReplyFail("[RynthAi] Not ready.");
return true;
}
- if (!Host.HasUseObject) { ChatLine("[RynthAi] UseObject not available."); return true; }
+ if (!Host.HasUseObject) { ReplyFail("[RynthAi] UseObject not available."); return true; }
int playerId = (int)_playerId;
WorldObject? best = null;
@@ -484,12 +552,13 @@ public sealed partial class RynthAiPlugin
if (best == null)
{
- ChatLine($"[RynthAi] No {type.Replace("closest", "")} found nearby.");
+ ReplyFail($"[RynthAi] No {type.Replace("closest", "")} found nearby.");
return true;
}
Host.UseFor(unchecked((uint)best.Id), "Command", $"/mt use {type}", UseKind.Asked);
Host.Log($"[RynthAi] /mt use {type}: {best.Name} (0x{(uint)best.Id:X8}) at {bestDist:F1}m");
+ ReplyOk($"[RynthAi] Using {best.Name} ({bestDist:F1} m).");
return true;
}
@@ -503,7 +572,7 @@ public sealed partial class RynthAiPlugin
string argStr = string.Join(" ", parts, 2, parts.Length - 2);
int toIdx = argStr.IndexOf(" to ", StringComparison.OrdinalIgnoreCase);
- if (toIdx < 0) { ChatLine("[RynthAi] Usage: /mt give[p] - to
"); return true; }
+ if (toIdx < 0) { ReplyFail("[RynthAi] Usage: /mt give[p] - to
"); return true; }
string itemName = argStr[..toIdx].Trim();
string targetName = argStr[(toIdx + 4)..].Trim();
@@ -514,10 +583,10 @@ public sealed partial class RynthAiPlugin
? n.IndexOf(itemName, StringComparison.OrdinalIgnoreCase) >= 0
: string.Equals(n, itemName, StringComparison.OrdinalIgnoreCase));
var item = candidates.Count > 0 ? candidates[0] : null;
- if (item == null) { ChatLine($"[RynthAi] Item not found: '{itemName}'"); return true; }
+ if (item == null) { ReplyFail($"[RynthAi] Item not found: '{itemName}'"); return true; }
var target = FindObject(targetName, inv: false, land: true, partial: true);
- if (target == null) { ChatLine($"[RynthAi] Target not found: '{targetName}'"); return true; }
+ if (target == null) { ReplyFail($"[RynthAi] Target not found: '{targetName}'"); return true; }
// Giving to an NPC requires AC's give GameAction (Event_GiveObjectRequest).
// The old path used MoveItemExternal = move-to-CONTAINER, which does NOT
@@ -528,10 +597,12 @@ public sealed partial class RynthAiPlugin
{
bool ok = Host.GiveObjectTo(unchecked((uint)item.Id), unchecked((uint)target.Id), 0);
Host.Log($"[RynthAi] /mt give: {item.Name} → {target.Name} (give ok={ok})");
+ if (ok) ReplyOk($"[RynthAi] Giving {item.Name} to {target.Name}.");
+ else ReplyFail($"[RynthAi] Couldn't give {item.Name} to {target.Name} (the engine refused it).");
}
else
{
- ChatLine("[RynthAi] Give requires engine API v62+ — update the RynthCore engine.");
+ ReplyFail("[RynthAi] Give requires engine API v62+ — update the RynthCore engine.");
}
return true;
}
@@ -654,7 +725,7 @@ public sealed partial class RynthAiPlugin
{
// Pick a named item from the currently opened corpse/container.
if (parts.Length < 3) return false;
- if (!Host.HasUseObject) { ChatLine("[RynthAi] UseObject not available."); return true; }
+ if (!Host.HasUseObject) { ReplyFail("[RynthAi] UseObject not available."); return true; }
string name = string.Join(" ", parts, 2, parts.Length - 2).Trim();
int container = ResolveOpenLootContainer();
@@ -669,6 +740,7 @@ public sealed partial class RynthAiPlugin
Host.UseFor(found.Value.Id, "Command", "/mt loot", UseKind.Asked);
Host.Log($"[RynthAi] /mt loot: {found.Value.Name} (0x{found.Value.Id:X8}) from container 0x{(uint)container:X8}");
_pendingMtLootName = null;
+ ReplyOk($"[RynthAi] Looting {found.Value.Name}.");
return true;
}
@@ -680,9 +752,9 @@ public sealed partial class RynthAiPlugin
itemNames.Append(item.Name);
}
if (itemNames.Length > 0)
- ChatLine($"[RynthAi] /mt loot: '{name}' not found. Container 0x{(uint)container:X8} contains: {itemNames}");
+ ReplyFail($"[RynthAi] /mt loot: '{name}' not found. Container 0x{(uint)container:X8} contains: {itemNames}");
else
- ChatLine($"[RynthAi] /mt loot: '{name}' not found (container 0x{(uint)container:X8} appears empty or still loading — queuing)");
+ ReplyFail($"[RynthAi] /mt loot: '{name}' not found (container 0x{(uint)container:X8} appears empty or still loading — queuing)");
}
// Container not open yet, or items not in cache — queue for deferred retry.
@@ -690,6 +762,8 @@ public sealed partial class RynthAiPlugin
_pendingMtLootPartial = partial;
_pendingMtLootExpiryMs = CorpseNowMs + PendingMtLootTimeoutMs;
Host.Log($"[RynthAi] /mt loot: '{name}' queued (container=0x{(uint)container:X8})");
+ if (container == 0)
+ ReplyOk($"[RynthAi] /mt loot: no container is open yet; '{name}' is taken when one opens (for {PendingMtLootTimeoutMs / 1000} s).");
return true;
}
@@ -700,15 +774,16 @@ public sealed partial class RynthAiPlugin
private bool HandleMtDrop(string[] parts, bool partial)
{
if (parts.Length < 3) return false;
- if (!Host.HasMoveItemExternal) { ChatLine("[RynthAi] MoveItemExternal not available."); return true; }
+ if (!Host.HasMoveItemExternal) { ReplyFail("[RynthAi] MoveItemExternal not available."); return true; }
string name = string.Join(" ", parts, 2, parts.Length - 2).Trim();
var item = FindObject(name, inv: true, land: false, partial: partial);
- if (item == null) { ChatLine($"[RynthAi] Item not found in inventory: '{name}'"); return true; }
+ if (item == null) { ReplyFail($"[RynthAi] Item not found in inventory: '{name}'"); return true; }
// Drop = move to the ground (container 0)
Host.MoveItemExternal(unchecked((uint)item.Id), 0, 0);
Host.Log($"[RynthAi] /mt drop: {item.Name} (0x{(uint)item.Id:X8})");
+ ReplyOk($"[RynthAi] Dropping {item.Name}.");
return true;
}
@@ -719,26 +794,27 @@ public sealed partial class RynthAiPlugin
private bool HandleMtEquip(string[] parts, bool partial)
{
if (parts.Length < 3) return false;
- if (!Host.HasUseObject) { ChatLine("[RynthAi] UseObject not available."); return true; }
+ if (!Host.HasUseObject) { ReplyFail("[RynthAi] UseObject not available."); return true; }
string name = string.Join(" ", parts, 2, parts.Length - 2).Trim();
var item = FindObject(name, inv: true, land: false, partial: partial);
- if (item == null) { ChatLine($"[RynthAi] Item not found: '{name}'"); return true; }
+ if (item == null) { ReplyFail($"[RynthAi] Item not found: '{name}'"); return true; }
Host.UseFor(unchecked((uint)item.Id), "Command", "/mt use item", UseKind.Asked);
Host.Log($"[RynthAi] /mt equip: {item.Name} (0x{(uint)item.Id:X8})");
+ ReplyOk($"[RynthAi] Equipping {item.Name}.");
return true;
}
private bool HandleMtDequip(string[] parts, bool partial)
{
if (parts.Length < 3) return false;
- if (!Host.HasMoveItemInternal) { ChatLine("[RynthAi] MoveItemInternal not available."); return true; }
+ if (!Host.HasMoveItemInternal) { ReplyFail("[RynthAi] MoveItemInternal not available."); return true; }
string name = string.Join(" ", parts, 2, parts.Length - 2).Trim();
// Find a wielded item matching the name
- if (_objectCache == null) { ChatLine("[RynthAi] Cache not ready."); return true; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Cache not ready."); return true; }
WorldObject? found = null;
foreach (var wo in _objectCache.GetInventory())
@@ -750,7 +826,7 @@ public sealed partial class RynthAiPlugin
if (match) { found = wo; break; }
}
- if (found == null) { ChatLine($"[RynthAi] Wielded item not found: '{name}'"); return true; }
+ if (found == null) { ReplyFail($"[RynthAi] Wielded item not found: '{name}'"); return true; }
// FIX (2026-06-24): MoveItemInternal with amount=0 is a silent no-op — the engine
// guard (ClientHelperHooks.cs:431 `if (amount <= 0) return false;`) rejects it, so
@@ -760,11 +836,12 @@ public sealed partial class RynthAiPlugin
int dest = WorldObjectCache.FindPackFor(Host, _objectCache, includeMainPack: true, requireFree: 1);
if (dest == 0)
{
- ChatLine($"[RynthAi] /mt dequip: no open pack for '{found.Name}' — inventory full.");
+ ReplyFail($"[RynthAi] /mt dequip: no open pack for '{found.Name}' — inventory full.");
return true;
}
Host.MoveItemInternal(unchecked((uint)found.Id), unchecked((uint)dest), 0, 1);
Host.Log($"[RynthAi] /mt dequip: {found.Name} (0x{(uint)found.Id:X8}) → pack 0x{(uint)dest:X8}");
+ ReplyOk($"[RynthAi] Taking off {found.Name} (into a pack).");
return true;
}
@@ -784,8 +861,9 @@ public sealed partial class RynthAiPlugin
// /mt fellow recruit
// Route through chat parser since AC handles these natively
if (parts.Length < 3) return false;
- if (!Host.HasInvokeChatParser) { ChatLine("[RynthAi] ChatParser not available."); return true; }
+ if (!Host.HasInvokeChatParser) { ReplyFail("[RynthAi] ChatParser not available."); return true; }
+ // The server answers each of these in chat ("You have created the fellowship ...").
string sub = parts[2].ToLower();
switch (sub)
{
@@ -794,26 +872,34 @@ public sealed partial class RynthAiPlugin
{
string fellowName = string.Join(" ", parts, 3, parts.Length - 3);
Host.InvokeChatParser($"/fellowship create {fellowName}");
+ Reply.Answered();
}
+ else ReplyFail($"[RynthAi] Usage: {parts[0]} fellow create ");
return true;
case "open":
Host.InvokeChatParser("/fellowship open");
+ Reply.Answered();
return true;
case "close":
Host.InvokeChatParser("/fellowship close");
+ Reply.Answered();
return true;
case "disband":
Host.InvokeChatParser("/fellowship disband");
+ Reply.Answered();
return true;
case "quit":
Host.InvokeChatParser("/fellowship quit");
+ Reply.Answered();
return true;
case "recruit":
if (parts.Length >= 4)
{
string playerName = string.Join(" ", parts, 3, parts.Length - 3);
Host.InvokeChatParser($"/fellowship recruit {playerName}");
+ Reply.Answered();
}
+ else ReplyFail($"[RynthAi] Usage: {parts[0]} fellow recruit ");
return true;
default:
return false;
diff --git a/Plugins/RynthCore.Plugin.RynthAi/Meta/MetaManager.cs b/Plugins/RynthCore.Plugin.RynthAi/Meta/MetaManager.cs
index 85920ad..76fc432 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Meta/MetaManager.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Meta/MetaManager.cs
@@ -152,6 +152,16 @@ internal sealed class MetaManager
public void SetMtCommandHandler(Func handler) => _mtCommandHandler = handler;
public void SetRaCommandHandler(Action handler) => _raCommandHandler = handler;
+ private CommandReply? _reply;
+
+ /// What /vt commands say back (CommandReply.cs). The plugin hands over its own, so a /vt
+ /// line answers like every other command; on its own (tests) a meta's action is the "sent by a meta" test.
+ internal CommandReply Reply
+ {
+ get => _reply ??= new CommandReply((text, color) => _host.WriteToChat(text, color), line => _host.Log(line), () => IsExecutingAction);
+ set => _reply = value;
+ }
+
/// Embedded Nav Route's "Patrol" (any case): the dungeon patrol instead of a route,
/// unless the meta or NavProfiles has a route by that name.
internal const string PatrolRoute = "Patrol";
@@ -1276,7 +1286,9 @@ internal sealed class MetaManager
{
string optName = parts[3].ToLower();
string optVal = parts[4];
- return TrySetVtOption(optName, optVal);
+ bool set = TrySetVtOption(optName, optVal);
+ ReplyVtOption(parts[3], optVal);
+ return set;
}
// /vt opt get — show one option's value.
@@ -1284,7 +1296,7 @@ internal sealed class MetaManager
parts[2].Equals("get", StringComparison.OrdinalIgnoreCase))
{
string optName = parts[3];
- _host.WriteToChat($"[RynthAi] {optName} = {GetVtOption(optName) ?? "(not set)"}", 1);
+ Reply.Info($"[RynthAi] {optName} = {GetVtOption(optName) ?? "(not set)"}");
return true;
}
@@ -1296,11 +1308,11 @@ internal sealed class MetaManager
foreach (string name in System.Linq.Enumerable.OrderBy(VtOptionMap.Keys, k => k, StringComparer.OrdinalIgnoreCase))
{
string item = $"{name}={GetVtOption(name) ?? "?"}";
- if (line.Length + item.Length > 180) { _host.WriteToChat("[RynthAi] " + line, 1); line.Clear(); }
+ if (line.Length + item.Length > 180) { Reply.Info("[RynthAi] " + line); line.Clear(); }
if (line.Length > 0) line.Append(", ");
line.Append(item);
}
- if (line.Length > 0) _host.WriteToChat("[RynthAi] " + line, 1);
+ if (line.Length > 0) Reply.Info("[RynthAi] " + line);
return true;
}
@@ -1332,8 +1344,8 @@ internal sealed class MetaManager
// /vt tapjump — a quick jump with no charge.
if (sub == "tapjump")
{
- if (!(_host.HasTapJump && _host.TapJump()))
- _host.WriteToChat("[RynthAi] /vt tapjump: the engine's jump isn't available.", 1);
+ if (_host.HasTapJump && _host.TapJump()) Reply.Ok("[RynthAi] Tap jump.");
+ else Reply.Fail("[RynthAi] /vt tapjump: the engine's jump isn't available.");
return true;
}
@@ -1364,7 +1376,10 @@ internal sealed class MetaManager
string name = string.Join(" ", parts, 3, parts.Length - 3);
// The macro was started again: the route still running keeps its place.
if (_replaying && parts[2].Equals("load", StringComparison.OrdinalIgnoreCase) && KeepRunningNavFile(name))
+ {
+ Reply.Ok($"[RynthAi] Nav '{name}' is the route already running; it keeps its place.");
return true;
+ }
_raCommandHandler?.Invoke($"/ra nav {parts[2].ToLowerInvariant()} {name}");
return true;
}
@@ -1389,11 +1404,11 @@ internal sealed class MetaManager
}
if (!File.Exists(path))
{
- _host.WriteToChat($"[RynthAi] Loot profile not found: {name}", 1);
+ Reply.Fail($"[RynthAi] Loot profile not found: {name}");
return true;
}
_settings.CurrentLootPath = path;
- _host.WriteToChat($"[RynthAi] Loot profile set: {Path.GetFileName(path)}", 1);
+ Reply.Ok($"[RynthAi] Loot profile set: {Path.GetFileName(path)}");
return true;
}
@@ -1403,7 +1418,7 @@ internal sealed class MetaManager
string state = string.Join(" ", parts, 2, parts.Length - 2);
_settings.CurrentState = state;
_settings.ForceStateReset = true;
- _host.WriteToChat($"[RynthAi] Meta state set: {state}", 1);
+ Reply.Ok($"[RynthAi] Meta state set: {state}");
return true;
}
@@ -1414,13 +1429,19 @@ internal sealed class MetaManager
if (parts.Length >= 4 && (parts[2].Equals("loadchar", StringComparison.OrdinalIgnoreCase)
|| parts[2].Equals("savechar", StringComparison.OrdinalIgnoreCase)))
_raCommandHandler?.Invoke($"/ra settings {parts[2].ToLowerInvariant()} {string.Join(" ", parts, 3, parts.Length - 3)}");
+ else
+ Reply.Ignored("[RynthAi] Usage: /vt settings loadchar|savechar (other /vt settings verbs are VTank's own; ignored).");
return true;
}
// /vt — an option written as a verb (DerethExploration: "/vt navclosestoprange
// 0.005"): the same as /vt opt set, for the VTank options RynthAi maps.
if (parts.Length == 3 && (VtOptionMap.ContainsKey(sub) || IsSpecialVtOption(sub)))
- return TrySetVtOption(sub, parts[2]);
+ {
+ bool set = TrySetVtOption(sub, parts[2]);
+ ReplyVtOption(parts[1], parts[2]);
+ return set;
+ }
// /vt aliases → existing /ra handlers (Phase 1.3 VTank-meta migration).
// Re-dispatch through the /ra path (_raCommandHandler → HandleRaCommand).
@@ -1451,6 +1472,7 @@ internal sealed class MetaManager
_deleteMonsterLogged = true;
RynthLog.Write(LogCat.Meta, "[Meta] /vt deletemonster accepted and ignored (no RynthAi equivalent).");
}
+ Reply.Ignored("[RynthAi] /vt deletemonster has no RynthAi equivalent; accepted and ignored.");
return true;
}
@@ -1464,15 +1486,16 @@ internal sealed class MetaManager
int n = route.Points.Count;
route.Points.Reverse();
_settings.ActiveNavIndex = Math.Clamp(n - 1 - _settings.ActiveNavIndex, 0, n - 1);
- _host.WriteToChat($"[RynthAi] Route reversed ({n} pts).", 1);
+ Reply.Ok($"[RynthAi] Route reversed ({n} pts).");
}
+ else Reply.Fail("[RynthAi] /vt reverseroute: no route is loaded.");
return true;
}
// /vt echo — local chat echo (no server send).
if (sub == "echo" && parts.Length >= 3)
{
- _host.WriteToChat(string.Join(" ", parts, 2, parts.Length - 2), 1);
+ Reply.Info(string.Join(" ", parts, 2, parts.Length - 2));
return true;
}
@@ -1486,6 +1509,49 @@ internal sealed class MetaManager
return false;
}
+ ///
+ /// After a /vt opt set (or "/vt <option> <value>"): the option's value now, and whether RynthAi
+ /// has a setting by that name (otherwise it is only kept for metas to read back).
+ ///
+ private void ReplyVtOption(string vtName, string asked)
+ {
+ bool known = IsSpecialVtOption(vtName) || VtOptionMap.ContainsKey(vtName)
+ || Expressions.BuildSettingsMapPublic().ContainsKey(vtName);
+ string now = GetVtOption(vtName) ?? "(not set)";
+ // A switch asked for as true/false/on/off reads back as 1/0: shown the way it was asked.
+ if (asked.ToLowerInvariant() is "true" or "false" or "on" or "off" && now is "1" or "0" or "true" or "false")
+ now = now is "1" or "true" ? "True" : "False";
+ Reply.Ok($"[RynthAi] {vtName} = {now}"
+ + (known ? "" : " (no RynthAi setting by that name: kept only as an option metas can read)"));
+ }
+
+ /// The /vt verbs RynthAi takes, for the usage line.
+ internal const string VtVerbList = "opt set|get|list, , start, stop, e, jump, tapjump, equipitemsfor, "
+ + "meta load, nav load|save, loot load, setmetastate, settings loadchar|savechar, setattackbar, forcebuff, "
+ + "cancelforcebuff, cancelbuff, addnavpt, mexec, clearbusy, testitem, propertydump, reverseroute, echo";
+
+ /// The usage line for a /vt line RynthAi didn't take (an unknown verb or the wrong arguments).
+ internal static string VtUsageFor(string line)
+ {
+ string[] w = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);
+ string verb = w.Length > 1 ? w[1].ToLowerInvariant() : "";
+ string? usage = verb switch
+ {
+ "opt" => "/vt opt set | /vt opt get | /vt opt list",
+ "meta" => "/vt meta load ",
+ "nav" => "/vt nav load | /vt nav save ",
+ "loot" or "lootprofile" or "looting" => "/vt loot load ",
+ "setmetastate" => "/vt setmetastate ",
+ "equipitemsfor" => "/vt equipitemsfor ",
+ "setattackbar" => "/vt setattackbar <0 to 1>",
+ "echo" => "/vt echo ",
+ _ => null,
+ };
+ return usage != null
+ ? "[RynthAi] Usage: " + usage
+ : $"[RynthAi] Unknown /vt command{(verb.Length > 0 ? $" '{verb}'" : "")}. RynthAi takes: {VtVerbList}.";
+ }
+
/// The RynthAi setting a VTank option name maps to (EnableNav → EnableNavigation).
internal static bool TryMapVtOption(string vtName, out string raName)
{
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiCommands.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiCommands.cs
index b952f6f..8702ce0 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiCommands.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiCommands.cs
@@ -16,19 +16,57 @@ namespace RynthCore.Plugin.RynthAi;
///
public sealed partial class RynthAiPlugin
{
- private void ChatLine(string text)
+ private CommandReply? _reply;
+
+ /// What chat commands say back: typed ones always answer, a meta's are quiet when they work (CommandReply.cs).
+ internal CommandReply Reply => _reply ??= new CommandReply(
+ (text, color) => Host.WriteToChat(text, color),
+ line => Host.Log(line),
+ () => _metaCommandDepth > 0 || _metaManager?.IsExecutingAction == true);
+
+ /// A chat line (lists, status, help, and lines that already answered a command): shown either way.
+ private void ChatLine(string text) => Reply.Info(text);
+
+ /// A command worked: what changed and the value now (quiet, logged, when a meta sent it).
+ private void ReplyOk(string text) => Reply.Ok(text);
+
+ /// A command didn't work: why, and the usage (a meta's repeats once a minute).
+ private void ReplyFail(string text) => Reply.Fail(text);
+
+ /// An action that reports whether it went out: or .
+ private void ReplyIf(bool ok, string okText, string failText)
{
- Host.WriteToChat(text, 1);
+ if (ok) ReplyOk(okText);
+ else ReplyFail(failText);
}
+ ///
+ /// A line from code that returns one string for either outcome (the dashboard's nav, meta and
+ /// settings-profile loads and saves, the Items list fill and clean): a failure by its wording,
+ /// else it worked.
+ ///
+ private void ReplyResult(string text)
+ {
+ if (ResultFailed(text)) ReplyFail(text);
+ else ReplyOk(text);
+ }
+
+ private static readonly Regex ResultFailedRx = new(
+ @"^(\[RynthAi\] )?(Can't|Couldn't|No |Not logged in|Nav NOT saved|Nav save failed|Your inventory|Settings not ready|Save failed|Dashboard not ready)"
+ + @"|' can't be used| not loaded: | already exists\.",
+ RegexOptions.CultureInvariant);
+
+ /// True when a one-string result (see ) says it didn't work.
+ internal static bool ResultFailed(string text) => ResultFailedRx.IsMatch(text);
+
/// /ra items clean and the engine Items panel's Remove Missing button (RynthPluginCleanItems).
internal void CleanMissingItems()
- => ChatLine(_dashboard?.CleanMissingItems(_objectCache, _playerId) ?? "[RynthAi] Settings not ready.");
+ => ReplyResult(_dashboard?.CleanMissingItems(_objectCache, _playerId) ?? "[RynthAi] Settings not ready.");
private void HandleHelpCommand()
{
ChatLine("[RynthAi] === Commands ===");
- ChatLine("[RynthAi] /ra fellow — fellowship diagnostics and queries");
+ ChatLine("[RynthAi] /ra fellow — fellowship diagnostics and queries");
ChatLine("[RynthAi] /ra help — show this list");
ChatLine("[RynthAi] /ra version — RynthAi version and build date, and the engine it runs on");
ChatLine("[RynthAi] /ra server - which server RynthCore says this is, its overrides, and the server plugin's settings");
@@ -120,7 +158,7 @@ public sealed partial class RynthAiPlugin
private void HandleOffhandCommand(string[] parts)
{
var settings = _dashboard?.Settings;
- if (settings == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (settings == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
if (parts.Length < 3)
{
@@ -136,7 +174,7 @@ public sealed partial class RynthAiPlugin
}
int shields = settings.ItemRules.Count(WeaponList.IsShieldRule);
ChatLine($"[RynthAi] {shields} shield(s) in the Items list (Add Selected Weapon adds a shield too).");
- ChatLine("[RynthAi] Usage: /ra offhand auto|shield|weapon|none [rule name] — /ra offhand default — /ra offhand dual on|off");
+ ReplyFail("[RynthAi] Usage: /ra offhand auto|shield|weapon|none [rule name] — /ra offhand default — /ra offhand dual on|off");
return;
}
@@ -146,33 +184,33 @@ public sealed partial class RynthAiPlugin
bool on = parts.Length < 4 || parts[3].Equals("on", StringComparison.OrdinalIgnoreCase) || parts[3] == "1";
settings.PreferDualWield = on;
_dashboard!.SaveSettings();
- ChatLine($"[RynthAi] Auto now prefers {(on ? "dual wield (with the Dual Wield skill and a second listed one-handed weapon)" : "a shield")}.");
+ ReplyOk($"[RynthAi] Auto now prefers {(on ? "dual wield (with the Dual Wield skill and a second listed one-handed weapon)" : "a shield")}.");
return;
}
bool toDefault = arg.Equals("default", StringComparison.OrdinalIgnoreCase);
if (!toDefault && !OffhandRules.TryParse(arg, out _))
{
- ChatLine("[RynthAi] Usage: /ra offhand auto|shield|weapon|none [rule name] — /ra offhand default — /ra offhand dual on|off");
+ ReplyFail("[RynthAi] Usage: /ra offhand auto|shield|weapon|none [rule name] — /ra offhand default — /ra offhand dual on|off");
return;
}
var mode = toDefault ? OffhandMode.Auto : OffhandRules.Parse(arg, OffhandMode.Auto);
if (parts.Length == 3)
{
- if (toDefault) { ChatLine("[RynthAi] Usage: /ra offhand default "); return; }
+ if (toDefault) { ReplyFail("[RynthAi] Usage: /ra offhand default "); return; }
settings.OffhandDefault = OffhandRules.SettingValue(mode);
_dashboard!.SaveSettings();
- ChatLine($"[RynthAi] Offhand set to {OffhandRules.Label(mode)} (for every Monsters rule that doesn't choose its own).");
+ ReplyOk($"[RynthAi] Offhand set to {OffhandRules.Label(mode)} (for every Monsters rule that doesn't choose its own).");
return;
}
string ruleName = string.Join(" ", parts.Skip(3));
var rule = settings.MonsterRules.FirstOrDefault(r => r.Name.Equals(ruleName, StringComparison.OrdinalIgnoreCase));
- if (rule == null) { ChatLine($"[RynthAi] No Monsters rule named '{ruleName}'."); return; }
+ if (rule == null) { ReplyFail($"[RynthAi] No Monsters rule named '{ruleName}'."); return; }
rule.OffhandId = toDefault ? OffhandRules.RuleDefault : OffhandRules.RuleValue(mode);
_dashboard!.SaveMonsterRules();
- ChatLine(toDefault
+ ReplyOk(toDefault
? $"[RynthAi] Rule '{rule.Name}' uses the global Offhand setting again."
: $"[RynthAi] Rule '{rule.Name}': Offhand {OffhandRules.Label(mode)}.");
}
@@ -180,14 +218,14 @@ public sealed partial class RynthAiPlugin
private void HandlePowerCommand(string[] parts)
{
var settings = _dashboard?.Settings;
- if (settings == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (settings == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
if (parts.Length < 3)
{
string current = settings.MeleeAttackPower < 0 ? "auto" : $"{settings.MeleeAttackPower}%";
string currentMissile = settings.MissileAttackPower < 0 ? "auto" : $"{settings.MissileAttackPower}%";
ChatLine($"[RynthAi] Melee power: {current}, Missile power: {currentMissile}");
- ChatLine("[RynthAi] Usage: /ra power <0-100|auto>");
+ ReplyFail("[RynthAi] Usage: /ra power <0-100|auto>");
return;
}
@@ -196,17 +234,17 @@ public sealed partial class RynthAiPlugin
{
settings.MeleeAttackPower = -1;
settings.MissileAttackPower = -1;
- ChatLine("[RynthAi] Attack power set to auto.");
+ ReplyOk("[RynthAi] Attack power set to auto.");
}
else if (int.TryParse(val, out int pct) && pct >= 0 && pct <= 100)
{
settings.MeleeAttackPower = pct;
settings.MissileAttackPower = pct;
- ChatLine($"[RynthAi] Attack power set to {pct}%.");
+ ReplyOk($"[RynthAi] Attack power set to {pct}%.");
}
else
{
- ChatLine("[RynthAi] Usage: /ra power <0-100|auto>");
+ ReplyFail("[RynthAi] Usage: /ra power <0-100|auto>");
}
}
@@ -215,7 +253,7 @@ public sealed partial class RynthAiPlugin
uint targetId = _currentTargetId;
if (targetId == 0)
{
- ChatLine("[RynthAi] No target selected — click something first.");
+ ReplyFail("[RynthAi] No target selected — click something first.");
return;
}
@@ -225,7 +263,7 @@ public sealed partial class RynthAiPlugin
if (!Host.HasObjectIsAttackable)
{
- ChatLine("[RynthAi] API not available — engine too old.");
+ ReplyFail("[RynthAi] API not available — engine too old.");
return;
}
@@ -237,31 +275,32 @@ public sealed partial class RynthAiPlugin
{
if (parts.Length < 3 || !int.TryParse(parts[2], out int spellId))
{
- ChatLine("[RynthAi] Usage: /ra cast ");
+ ReplyFail("[RynthAi] Usage: /ra cast ");
return;
}
if (_currentTargetId == 0)
{
- ChatLine("[RynthAi] No target selected.");
+ ReplyFail("[RynthAi] No target selected.");
return;
}
if (!Host.HasCastSpell)
{
- ChatLine("[RynthAi] CastSpell not available — hook not found.");
+ ReplyFail("[RynthAi] CastSpell not available — hook not found.");
return;
}
bool ok = Host.CastSpellFor(_currentTargetId, spellId, "Command", $"spell {spellId} (/ra cast)", asked: true);
- ChatLine($"[RynthAi] CastSpell(target=0x{_currentTargetId:X8}, spell={spellId}) => {ok}");
+ string line = $"[RynthAi] CastSpell(target=0x{_currentTargetId:X8}, spell={spellId}) => {ok}";
+ if (ok) ReplyOk(line); else ReplyFail(line);
}
private void HandleCacheCommand()
{
if (_objectCache == null)
{
- ChatLine("[RynthAi] Object cache not initialized (not logged in yet).");
+ ReplyFail("[RynthAi] Object cache not initialized (not logged in yet).");
return;
}
@@ -285,7 +324,7 @@ public sealed partial class RynthAiPlugin
private void HandleCache2Command()
{
- if (_objectCache == null) { ChatLine("[RynthAi] Cache not ready."); return; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Cache not ready."); return; }
var (total, creatures, inventory, landscape, pending) = _objectCache.GetStats();
ChatLine($"[RynthAi] Cache stats: {total} total | {creatures} creatures | {inventory} inv | {landscape} landscape | {pending} pending");
ChatLine("[RynthAi] Direct inventory snapshot:");
@@ -303,7 +342,7 @@ public sealed partial class RynthAiPlugin
{
if (_raycast == null)
{
- ChatLine("[RynthAi] Raycast system not initialized.");
+ ReplyFail("[RynthAi] Raycast system not initialized.");
return;
}
@@ -323,13 +362,13 @@ public sealed partial class RynthAiPlugin
{
if (_raycast == null || !_raycast.IsInitialized)
{
- ChatLine("[RynthAi LOS] Raycast system not initialized.");
+ ReplyFail("[RynthAi LOS] Raycast system not initialized.");
return;
}
if (_currentTargetId == 0)
{
- ChatLine("[RynthAi LOS] No target selected — select a monster first.");
+ ReplyFail("[RynthAi LOS] No target selected — select a monster first.");
return;
}
@@ -348,7 +387,7 @@ public sealed partial class RynthAiPlugin
case "atlatl": isArc = true; arcVelocity = settings?.AtlatlArcVelocity ?? 22.0f; modeLabel = $"Atlatl arc (v={arcVelocity:F1})"; break;
case "magic": isArc = true; arcVelocity = settings?.MagicArcVelocity ?? 40.0f; modeLabel = $"Magic arc (horizontal v={arcVelocity:F1}, from head height)"; break;
default:
- ChatLine($"[RynthAi LOS] Unknown mode '{modeArg}'. Use: linear | bow | crossbow | atlatl | magic");
+ ReplyFail($"[RynthAi LOS] Unknown mode '{modeArg}'. Use: linear | bow | crossbow | atlatl | magic");
return;
}
@@ -359,7 +398,7 @@ public sealed partial class RynthAiPlugin
if (!Host.TryGetPlayerPose(out uint pCell, out float px, out float py, out float pz,
out _, out _, out _, out _))
{
- ChatLine("[RynthAi LOS] Player position unavailable.");
+ ReplyFail("[RynthAi LOS] Player position unavailable.");
return;
}
@@ -375,7 +414,7 @@ public sealed partial class RynthAiPlugin
// Target position
if (!Host.TryGetObjectPosition(_currentTargetId, out uint tCell, out float tx, out float ty, out float tz))
{
- ChatLine("[RynthAi LOS] Target position unavailable.");
+ ReplyFail("[RynthAi LOS] Target position unavailable.");
return;
}
@@ -552,14 +591,14 @@ public sealed partial class RynthAiPlugin
{
if (_raycast == null || !_raycast.IsInitialized)
{
- ChatLine("[RynthAi LAND] Raycast system not initialized.");
+ ReplyFail("[RynthAi LAND] Raycast system not initialized.");
return;
}
if (!Host.TryGetPlayerPose(out uint pCell, out float px, out float py, out float pz,
out _, out _, out _, out _))
{
- ChatLine("[RynthAi LAND] Player position unavailable.");
+ ReplyFail("[RynthAi LAND] Player position unavailable.");
return;
}
@@ -576,7 +615,7 @@ public sealed partial class RynthAiPlugin
var lb = _raycast.GeometryLoader.GetLandblockData(landblockKey);
if (lb == null)
{
- ChatLine("[RynthAi LAND] Landblock data unavailable (dungeon, or height table not loaded).");
+ ReplyFail("[RynthAi LAND] Landblock data unavailable (dungeon, or height table not loaded).");
return;
}
@@ -608,13 +647,13 @@ public sealed partial class RynthAiPlugin
{
if (_raycast == null || !_raycast.IsInitialized)
{
- ChatLine("[RynthAi RAYLAND] Raycast system not initialized.");
+ ReplyFail("[RynthAi RAYLAND] Raycast system not initialized.");
return;
}
if (!Host.TryGetPlayerPose(out uint pCell, out float px, out float py, out float pz,
out _, out _, out _, out _))
{
- ChatLine("[RynthAi RAYLAND] Player position unavailable.");
+ ReplyFail("[RynthAi RAYLAND] Player position unavailable.");
return;
}
@@ -679,13 +718,13 @@ public sealed partial class RynthAiPlugin
{
if (_metaManager == null)
{
- ChatLine("[RynthAi] Meta not ready (not logged in yet).");
+ ReplyFail("[RynthAi] Meta not ready (not logged in yet).");
return;
}
if (parts.Length < 3)
{
- ChatLine("[RynthAi] Usage: /ra mexec ");
+ ReplyFail("[RynthAi] Usage: /ra mexec ");
ChatLine("[RynthAi] e.g. /ra mexec setvar[Nav, NTTest5]");
ChatLine("[RynthAi] e.g. /ra mexec getcharintprop[25]");
return;
@@ -722,7 +761,7 @@ public sealed partial class RynthAiPlugin
{
if (_metaManager == null)
{
- ChatLine("[RynthAi] Meta not ready (not logged in yet).");
+ ReplyFail("[RynthAi] Meta not ready (not logged in yet).");
return;
}
@@ -751,7 +790,7 @@ public sealed partial class RynthAiPlugin
private void HandleListPvarsCommand()
{
- if (_metaManager == null) { ChatLine("[RynthAi] Meta not ready."); return; }
+ if (_metaManager == null) { ReplyFail("[RynthAi] Meta not ready."); return; }
var pvars = _metaManager.Expressions.Pvars;
if (pvars.Count == 0) { ChatLine("[RynthAi] No persistent variables set."); return; }
ChatLine($"[RynthAi] Persistent variables ({pvars.Count}):");
@@ -761,7 +800,7 @@ public sealed partial class RynthAiPlugin
private void HandleListGvarsCommand()
{
- if (_metaManager == null) { ChatLine("[RynthAi] Meta not ready."); return; }
+ if (_metaManager == null) { ReplyFail("[RynthAi] Meta not ready."); return; }
var gvars = _metaManager.Expressions.Gvars;
if (gvars.Count == 0) { ChatLine("[RynthAi] No global variables set."); return; }
ChatLine($"[RynthAi] Global variables ({gvars.Count}):");
@@ -771,7 +810,7 @@ public sealed partial class RynthAiPlugin
private void HandleWieldedCommand()
{
- if (_objectCache == null) { ChatLine("[RynthAi] Cache not ready."); return; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Cache not ready."); return; }
// Use CurrentWieldedLocation (stype=10, InqInt fallback) — more robust than
// TryGetObjectWielderInfo which requires the phys-obj offset probe to succeed.
@@ -795,15 +834,15 @@ public sealed partial class RynthAiPlugin
{
if (_raycast == null || !_raycast.IsInitialized)
{
- ChatLine("[RynthAi] Raycast not initialized.");
+ ReplyFail("[RynthAi] Raycast not initialized.");
return;
}
- if (_playerId == 0) { ChatLine("[RynthAi] Not logged in."); return; }
+ if (_playerId == 0) { ReplyFail("[RynthAi] Not logged in."); return; }
if (!Host.TryGetPlayerPose(out uint pCell, out float px, out float py, out float pz,
out _, out _, out _, out _))
{
- ChatLine("[RynthAi] Player position unavailable.");
+ ReplyFail("[RynthAi] Player position unavailable.");
return;
}
@@ -906,7 +945,7 @@ public sealed partial class RynthAiPlugin
var settings = _dashboard?.Settings;
if (settings == null)
{
- ChatLine("[RynthAi] Nav debug unavailable: settings not ready.");
+ ReplyFail("[RynthAi] Nav debug unavailable: settings not ready.");
return;
}
@@ -924,7 +963,7 @@ public sealed partial class RynthAiPlugin
bool poseOk = Host.TryGetPlayerPose(out uint cellId, out float x, out float y, out float z, out _, out _, out _, out _);
if (!poseOk)
{
- ChatLine("[RynthAi] Player pose unavailable.");
+ ReplyFail("[RynthAi] Player pose unavailable.");
return;
}
@@ -977,7 +1016,7 @@ public sealed partial class RynthAiPlugin
{
if (_jumper == null)
{
- ChatLine("[RynthAi] Jumper not ready (not logged in yet).");
+ ReplyFail("[RynthAi] Jumper not ready (not logged in yet).");
return;
}
@@ -987,7 +1026,7 @@ public sealed partial class RynthAiPlugin
{
if (c != 's' && c != 'w' && c != 'x' && c != 'z' && c != 'c')
{
- ChatLine("[RynthAi] Usage: /ra jump[swzxc] [heading] [holdtime]");
+ ReplyFail("[RynthAi] Usage: /ra jump[swzxc] [heading] [holdtime]");
return;
}
}
@@ -1009,7 +1048,7 @@ public sealed partial class RynthAiPlugin
heading = maybeHeading;
if (!int.TryParse(parts[3], out holdMs))
{
- ChatLine("[RynthAi] Usage: /ra jump[swzxc] [heading] [holdtime]");
+ ReplyFail("[RynthAi] Usage: /ra jump[swzxc] [heading] [holdtime]");
return;
}
}
@@ -1027,12 +1066,28 @@ public sealed partial class RynthAiPlugin
}
else
{
- ChatLine("[RynthAi] Usage: /ra jump[swzxc] [heading] [holdtime]");
+ ReplyFail("[RynthAi] Usage: /ra jump[swzxc] [heading] [holdtime]");
return;
}
}
- _jumper.Start(letters, heading, holdMs);
+ if (_jumper.Start(letters, heading, holdMs)) // a refusal (busy, bad values) says why itself
+ ReplyOk(JumpLine(letters, heading, holdMs));
+ }
+
+ /// What a jump command answers: "Jumping forward, run (500 ms charge), facing 90°."
+ internal static string JumpLine(string letters, float? heading, int holdMs)
+ {
+ var ways = new List();
+ if (letters.Contains('w')) ways.Add("forward");
+ if (letters.Contains('x')) ways.Add("backward");
+ if (letters.Contains('z')) ways.Add("left");
+ if (letters.Contains('c')) ways.Add("right");
+ if (letters.Contains('s')) ways.Add("run");
+ string how = ways.Count > 0 ? " " + string.Join(", ", ways) : " in place";
+ string charge = holdMs > 0 ? $" ({holdMs} ms charge)" : "";
+ string face = heading.HasValue ? $", facing {heading.Value:0.#}°" : "";
+ return $"[RynthAi] Jumping{how}{charge}{face}.";
}
// /ra follow [on|off|status] — track the fellowship leader's live position
@@ -1040,7 +1095,7 @@ public sealed partial class RynthAiPlugin
private void HandleFollowCommand(string[] parts)
{
var settings = _dashboard?.Settings;
- if (settings == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (settings == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
string arg = parts.Length >= 3
? parts[2].ToLowerInvariant()
@@ -1053,7 +1108,7 @@ public sealed partial class RynthAiPlugin
settings.FollowNamedTargetId = 0;
settings.FollowMode = true;
settings.EnableNavigation = true; // follow is a nav activity
- ChatLine(settings.IsMacroRunning
+ ReplyOk(settings.IsMacroRunning
? "[RynthAi] Follow ON — tracking the fellowship leader."
: "[RynthAi] Follow ON — start the bot to begin moving.");
break;
@@ -1061,7 +1116,7 @@ public sealed partial class RynthAiPlugin
settings.FollowMode = false;
settings.FollowTargetId = 0;
settings.FollowNamedTargetId = 0;
- ChatLine("[RynthAi] Follow OFF.");
+ ReplyOk("[RynthAi] Follow OFF.");
break;
case "status":
ChatLine($"[RynthAi] Follow: {(settings.FollowMode ? "ON" : "off")} " +
@@ -1083,11 +1138,11 @@ public sealed partial class RynthAiPlugin
if (wo.Id != unchecked((int)_playerId) && wo.ObjectClass != RynthCore.Loot.AcObjectClass.Corpse
&& wo.Name.IndexOf(name, StringComparison.OrdinalIgnoreCase) >= 0) { who = wo; break; }
}
- if (who == null) { ChatLine($"[RynthAi] Follow: no one named '{name}' nearby. Usage: /ra follow [on|off|status|]"); break; }
+ if (who == null) { ReplyFail($"[RynthAi] Follow: no one named '{name}' nearby. Usage: /ra follow [on|off|status|]"); break; }
settings.FollowNamedTargetId = unchecked((uint)who.Id);
settings.FollowMode = true;
settings.EnableNavigation = true;
- ChatLine($"[RynthAi] Follow ON — following {who.Name}.");
+ ReplyOk($"[RynthAi] Follow ON — following {who.Name}.");
break;
}
}
@@ -1098,7 +1153,7 @@ public sealed partial class RynthAiPlugin
var settings = _dashboard?.Settings;
if (settings == null)
{
- ChatLine("[RynthAi] Settings not ready.");
+ ReplyFail("[RynthAi] Settings not ready.");
return;
}
@@ -1108,13 +1163,13 @@ public sealed partial class RynthAiPlugin
if (!Host.HasGetPlayerPose || !Host.TryGetPlayerPose(out _, out _, out _, out float z, out _, out _, out _, out _))
{
- ChatLine("[RynthAi] Player pose unavailable.");
+ ReplyFail("[RynthAi] Player pose unavailable.");
return;
}
if (!NavCoordinateHelper.TryGetNavCoords(Host, out double ns, out double ew))
{
- ChatLine("[RynthAi] Could not resolve current coords.");
+ ReplyFail("[RynthAi] Could not resolve current coords.");
return;
}
@@ -1128,22 +1183,22 @@ public sealed partial class RynthAiPlugin
_dashboard?.AutoSaveRoute();
int idx = settings.CurrentRoute.Points.Count - 1;
- ChatLine($"[RynthAi] Added waypoint [{idx}] NS={ns:F3} EW={ew:F3} Z={z / 240.0:F4} to {navName}.");
+ ReplyOk($"[RynthAi] Added waypoint [{idx}] NS={ns:F3} EW={ew:F3} Z={z / 240.0:F4} to {navName}.");
}
private void HandleNavCommand(string[] parts)
{
- if (_dashboard == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (_dashboard == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
string sub = parts.Length > 2 ? parts[2].ToLowerInvariant() : "";
string rest = parts.Length > 3 ? string.Join(" ", parts, 3, parts.Length - 3) : "";
switch (sub)
{
case "save":
- ChatLine(_dashboard.SaveRoute(rest.Length > 0 ? rest : null));
+ ReplyResult(_dashboard.SaveRoute(rest.Length > 0 ? rest : null));
break;
case "load":
- if (rest.Length == 0) { ChatLine("[RynthAi] Usage: /ra nav load "); break; }
- ChatLine(_dashboard.LoadNavByName(rest));
+ if (rest.Length == 0) { ReplyFail("[RynthAi] Usage: /ra nav load "); break; }
+ ReplyResult(_dashboard.LoadNavByName(rest));
break;
case "list":
var names = _dashboard.NavFileNames();
@@ -1154,7 +1209,7 @@ public sealed partial class RynthAiPlugin
// Stopping and starting the macro keeps the route where it was (a finished Once
// route stays finished); this is the way to run it again from the top on purpose.
var route = _dashboard.Settings.CurrentRoute;
- if (_navigationEngine == null) { ChatLine("[RynthAi] Navigation engine not ready."); break; }
+ if (_navigationEngine == null) { ReplyFail("[RynthAi] Navigation engine not ready."); break; }
if (!_navigationEngine.RestartRoute())
{
ChatLine(route != null && route.RouteType == NavRouteType.Follow && route.FollowTargetName.Length > 0
@@ -1162,41 +1217,45 @@ public sealed partial class RynthAiPlugin
: "[RynthAi] No nav route loaded to restart.");
break;
}
- ChatLine($"[RynthAi] Nav route restarted from its first point ({route!.RouteType}, {route.Points.Count} waypoints).");
+ ReplyOk($"[RynthAi] Nav route restarted from its first point ({route!.RouteType}, {route.Points.Count} waypoints).");
break;
}
default:
- ChatLine("[RynthAi] /ra nav save [name] | /ra nav load | /ra nav list | /ra nav restart");
+ // Bare "/ra nav" asks what it takes; anything else is a wrong form.
+ const string navUsage = "[RynthAi] /ra nav save [name] | /ra nav load | /ra nav list | /ra nav restart";
+ if (sub.Length == 0) ChatLine(navUsage);
+ else ReplyFail($"[RynthAi] Unknown /ra nav verb '{sub}'. Usage: /ra nav save [name] | load | list | restart");
break;
}
}
private void HandleMetaCommand(string[] parts)
{
- if (_dashboard == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (_dashboard == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
string sub = parts.Length > 2 ? parts[2].ToLowerInvariant() : "";
string rest = parts.Length > 3 ? string.Join(" ", parts, 3, parts.Length - 3) : "";
switch (sub)
{
case "load":
case "new":
- if (rest.Length == 0) { ChatLine($"[RynthAi] Usage: /ra meta {sub} "); break; }
- ChatLine(_dashboard.LoadMetaByName(rest, createOnly: sub == "new"));
+ if (rest.Length == 0) { ReplyFail($"[RynthAi] Usage: /ra meta {sub} "); break; }
+ ReplyResult(_dashboard.LoadMetaByName(rest, createOnly: sub == "new"));
break;
case "list":
var names = _dashboard.MetaFileNames();
ChatLine(names.Count == 0 ? "[RynthAi] No metas in MetaFiles." : $"[RynthAi] Metas ({names.Count}): {string.Join(", ", names)}");
break;
default:
- ChatLine("[RynthAi] /ra meta load | /ra meta new | /ra meta list");
+ if (sub.Length == 0) ChatLine("[RynthAi] /ra meta load | /ra meta new | /ra meta list");
+ else ReplyFail($"[RynthAi] Unknown /ra meta verb '{sub}'. Usage: /ra meta load | new | list");
break;
}
}
private void HandleScanCommand()
{
- if (_objectCache == null) { ChatLine("[RynthAi] Cache not ready."); return; }
- if (_playerId == 0) { ChatLine("[RynthAi] Not logged in."); return; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Cache not ready."); return; }
+ if (_playerId == 0) { ReplyFail("[RynthAi] Not logged in."); return; }
double maxDist = _dashboard?.Settings?.MonsterRange ?? 30.0;
int playerId = (int)_playerId;
@@ -1268,7 +1327,7 @@ public sealed partial class RynthAiPlugin
{
if (_objectCache == null)
{
- ChatLine("[RynthAi] Cache not ready.");
+ ReplyFail("[RynthAi] Cache not ready.");
return;
}
@@ -1334,26 +1393,26 @@ public sealed partial class RynthAiPlugin
if (mode is "on" or "1" or "true")
{
_lootInspectMode = true;
- ChatLine("[RynthAi] Loot inspect: ON — classifying each item you select.");
+ ReplyOk("[RynthAi] Loot inspect: ON — classifying each item you select.");
return;
}
if (mode is "off" or "0" or "false")
{
_lootInspectMode = false;
- ChatLine("[RynthAi] Loot inspect: OFF.");
+ ReplyOk("[RynthAi] Loot inspect: OFF.");
return;
}
}
if (!Host.HasGetSelectedItemId)
{
- ChatLine("[RynthAi] Host does not expose selected item id.");
+ ReplyFail("[RynthAi] Host does not expose selected item id.");
return;
}
uint selected = Host.GetSelectedItemId();
if (selected == 0)
{
- ChatLine("[RynthAi] No item selected. Click an item in the world or inventory first.");
+ ReplyFail("[RynthAi] No item selected. Click an item in the world or inventory first.");
return;
}
InspectLootRuleForItem(unchecked((int)selected));
@@ -1361,7 +1420,7 @@ public sealed partial class RynthAiPlugin
internal void InspectLootRuleForItem(int itemId, bool quiet = false)
{
- if (_objectCache == null) return;
+ if (_objectCache == null) { if (!quiet) ReplyFail("[RynthAi] Loot inspect: the object cache isn't ready (log in first)."); return; }
WorldObject? item = _objectCache[itemId];
if (item == null)
{
@@ -1396,13 +1455,13 @@ public sealed partial class RynthAiPlugin
if (string.IsNullOrWhiteSpace(candidatePath))
{
- ChatLine("[RynthAi] No loot profile selected. Pick one in the dashboard or pass a full path.");
+ ReplyFail("[RynthAi] No loot profile selected. Pick one in the dashboard or pass a full path.");
return false;
}
if (!System.IO.File.Exists(candidatePath))
{
- ChatLine($"[RynthAi] Loot profile not found: {candidatePath}");
+ ReplyFail($"[RynthAi] Loot profile not found: {candidatePath}");
return false;
}
@@ -1428,7 +1487,7 @@ public sealed partial class RynthAiPlugin
}
catch (Exception ex)
{
- ChatLine($"[RynthAi] Failed to load loot profile: {ex.Message}");
+ ReplyFail($"[RynthAi] Failed to load loot profile: {ex.Message}");
return false;
}
}
@@ -1670,7 +1729,7 @@ public sealed partial class RynthAiPlugin
req.KeepCount = n;
break;
}
- ChatLine($"[RynthAi] loot add: '{parts[i]}'? Use keep, keep N, salvage, sell, read, name, like, t11 or preview.");
+ ReplyFail($"[RynthAi] loot add: '{parts[i]}'? Use keep, keep N, salvage, sell, read, name, like, t11 or preview.");
return;
}
}
@@ -1735,7 +1794,7 @@ public sealed partial class RynthAiPlugin
/// "it's just standing there" investigation into a single read. (D3)
private void HandleWhyCommand()
{
- if (_combatManager == null) { ChatLine("[RynthAi] Combat manager not ready."); return; }
+ if (_combatManager == null) { ReplyFail("[RynthAi] Combat manager not ready."); return; }
var s = _combatManager.GetStateSnapshot();
int total = _combatManager.LastScanTotalMonsters;
@@ -1810,7 +1869,7 @@ public sealed partial class RynthAiPlugin
///
private void HandleGhostsCommand(string cmd, string[] parts)
{
- if (_combatManager == null) { ChatLine("[RynthAi] Combat manager not ready."); return; }
+ if (_combatManager == null) { ReplyFail("[RynthAi] Combat manager not ready."); return; }
var ghosts = _combatManager.Ghosts;
string sub = parts.Length >= 3 ? parts[2].ToLowerInvariant() : "";
bool canRemove = Host.HasRemoveClientObject;
@@ -1821,12 +1880,12 @@ public sealed partial class RynthAiPlugin
var wo = sel != 0 ? _objectCache?[(int)sel] : null;
if (wo == null || (int)wo.ObjectClass != (int)AcObjectClass.Monster)
{
- ChatLine("[RynthAi] /ra ghost: select the monster that never takes a swing first.");
+ ReplyFail("[RynthAi] /ra ghost: select the monster that never takes a swing first.");
return;
}
double silent = _combatManager.ServerSilentMs((int)sel, RynthClock.Now);
_combatManager.MarkGhost((int)sel, wo.Name, silent, "marked by /ra ghost");
- ChatLine($"[RynthAi] 0x{sel:X8} '{wo.Name}' marked as a ghost" + (canRemove ? " and sent for removal from the client (see the log)." : " (this engine can't remove it from the client; it is skipped)."));
+ ReplyOk($"[RynthAi] 0x{sel:X8} '{wo.Name}' marked as a ghost" + (canRemove ? " and sent for removal from the client (see the log)." : " (this engine can't remove it from the client; it is skipped)."));
return;
}
@@ -1834,21 +1893,21 @@ public sealed partial class RynthAiPlugin
{
case "clear":
{
- if (!canRemove) { ChatLine("[RynthAi] This engine can't remove objects from the client (needs plugin API v83)."); return; }
+ if (!canRemove) { ReplyFail("[RynthAi] This engine can't remove objects from the client (needs plugin API v83)."); return; }
int sent = 0, refused = 0;
foreach (var g in ghosts.All.ToList())
{
int r = Host.RemoveClientObject((uint)g.Id);
if (r == 1 || r == 2) sent++; else refused++;
}
- ChatLine($"[RynthAi] Ghosts: {sent} removed from the client" + (refused > 0 ? $", {refused} refused (the server talked about them recently, or not a creature - they stay skipped)." : "."));
+ ReplyOk($"[RynthAi] Ghosts: {sent} removed from the client" + (refused > 0 ? $", {refused} refused (the server talked about them recently, or not a creature - they stay skipped)." : "."));
return;
}
case "forget":
{
int n = ghosts.Count;
ghosts.Clear();
- ChatLine($"[RynthAi] Ghosts: {n} forgotten; they can be targeted again.");
+ ReplyOk($"[RynthAi] Ghosts: {n} forgotten; they can be targeted again.");
return;
}
}
@@ -1872,7 +1931,7 @@ public sealed partial class RynthAiPlugin
private void HandleCombatStateCommand()
{
- if (_combatManager == null) { ChatLine("[RynthAi] Combat manager not ready."); return; }
+ if (_combatManager == null) { ReplyFail("[RynthAi] Combat manager not ready."); return; }
var s = _combatManager.GetStateSnapshot();
var now = RynthClock.Now;
@@ -1967,7 +2026,7 @@ public sealed partial class RynthAiPlugin
private void HandleMacroRunCommand(string verb, string[] parts)
{
var dash = _dashboard;
- if (dash == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (dash == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
bool running = dash.Settings.IsMacroRunning;
switch (verb)
@@ -1975,21 +2034,21 @@ public sealed partial class RynthAiPlugin
case "start":
case "resume":
_macroResumeAt = 0;
- if (running) { ChatLine("[RynthAi] Macro already RUNNING."); return; }
+ if (running) { ReplyOk("[RynthAi] Macro already RUNNING."); return; }
if (RefuseMacroStartForVTank()) return; // one bot per client (Decal bridge)
dash.TogglePanelMacro();
- ChatLine("[RynthAi] Macro STARTED.");
+ ReplyOk("[RynthAi] Macro STARTED.");
return;
case "stop":
_macroResumeAt = 0;
- if (!running) { ChatLine("[RynthAi] Macro already STOPPED."); return; }
+ if (!running) { ReplyOk("[RynthAi] Macro already STOPPED."); return; }
dash.TogglePanelMacro();
// Kill autorun now rather than waiting out the nav engine's stop
// debounce — a /ra stop is usually issued because the box is
// running somewhere you don't want it to.
_navigationEngine?.Stop();
- ChatLine("[RynthAi] Macro STOPPED.");
+ ReplyOk("[RynthAi] Macro STOPPED.");
return;
case "pause":
@@ -2003,7 +2062,7 @@ public sealed partial class RynthAiPlugin
_navigationEngine?.Stop();
}
_macroResumeAt = CorpseNowMs + sec * 1000L;
- ChatLine($"[RynthAi] Macro PAUSED — auto-resume in {sec}s ('/ra start' to resume now, '/ra stop' to cancel).");
+ ReplyOk($"[RynthAi] Macro PAUSED — auto-resume in {sec}s ('/ra start' to resume now, '/ra stop' to cancel).");
return;
}
}
@@ -2013,7 +2072,7 @@ public sealed partial class RynthAiPlugin
/// the "bot just stands there" class and had no state surface of its own.
private void HandleNavStateCommand()
{
- if (_navigationEngine == null) { ChatLine("[RynthAi] Navigation engine not ready."); return; }
+ if (_navigationEngine == null) { ReplyFail("[RynthAi] Navigation engine not ready."); return; }
var n = _navigationEngine.GetStateSnapshot();
ChatLine("[RynthAi] === Nav State ===");
@@ -2043,7 +2102,7 @@ public sealed partial class RynthAiPlugin
/// where the combine sweep is, and the last thing that failed.
private void HandleSalvageStateCommand()
{
- if (_salvageManager == null) { ChatLine("[RynthAi] Salvage manager not ready."); return; }
+ if (_salvageManager == null) { ReplyFail("[RynthAi] Salvage manager not ready."); return; }
var v = _salvageManager.GetStateSnapshot();
ChatLine("[RynthAi] === Salvage State ===");
@@ -2071,10 +2130,10 @@ public sealed partial class RynthAiPlugin
private void HandleDumpInventoryCommand()
{
Host.Log("[RynthAi dumpinv] ENTRY");
- if (_objectCache == null) { ChatLine("[RynthAi] Cache not ready."); return; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Cache not ready."); return; }
uint playerId = Host.GetPlayerId();
Host.Log($"[RynthAi dumpinv] playerId=0x{playerId:X8}");
- if (playerId == 0) { ChatLine("[RynthAi] Not logged in."); return; }
+ if (playerId == 0) { ReplyFail("[RynthAi] Not logged in."); return; }
// ── Part 1: Cached inventory — NO native ownership calls, just IDs and names ──
Host.Log("[RynthAi dumpinv] Starting Part 1 - cache enum");
@@ -2102,7 +2161,7 @@ public sealed partial class RynthAiPlugin
ChatLine($"[RynthAi] HasGetContainerContents={Host.HasGetContainerContents}");
if (!Host.HasGetContainerContents)
{
- ChatLine("[RynthAi] GetContainerContents API not available.");
+ ReplyFail("[RynthAi] GetContainerContents API not available.");
return;
}
@@ -2168,30 +2227,30 @@ public sealed partial class RynthAiPlugin
{
if (parts.Length < 4)
{
- ChatLine("[RynthAi] Usage: /ra settings loadchar | /ra settings savechar ");
+ ReplyFail("[RynthAi] Usage: /ra settings loadchar | /ra settings savechar ");
return;
}
string sub = parts[2].ToLower();
if (sub != "loadchar" && sub != "savechar")
{
- ChatLine("[RynthAi] Usage: /ra settings loadchar | /ra settings savechar ");
+ ReplyFail("[RynthAi] Usage: /ra settings loadchar | /ra settings savechar ");
return;
}
string name = string.Join(" ", parts, 3, parts.Length - 3).Trim();
if (string.IsNullOrEmpty(name))
{
- ChatLine($"[RynthAi] Usage: /ra settings {sub} ");
+ ReplyFail($"[RynthAi] Usage: /ra settings {sub} ");
return;
}
- if (_dashboard == null) { ChatLine("[RynthAi] Dashboard not ready."); return; }
+ if (_dashboard == null) { ReplyFail("[RynthAi] Dashboard not ready."); return; }
string result = sub == "loadchar"
? _dashboard.LoadProfile(name)
: _dashboard.SaveAsProfile(name);
- ChatLine($"[RynthAi] {result}");
+ ReplyResult($"[RynthAi] {result}");
}
private void HandleClearBusyCommand()
@@ -2210,7 +2269,7 @@ public sealed partial class RynthAiPlugin
if (_combatManager != null) _combatManager.BusyCount = 0;
if (_buffManager != null) _buffManager.BusyCount = 0;
int after = Host.HasGetBusyState ? Host.GetBusyState() : -1;
- ChatLine($"[RynthAi] Busy state cleared (was {before} → {after})");
+ ReplyOk($"[RynthAi] Busy state cleared (was {before} → {after})");
}
// Broader reset for the "AC wedged with item-action notice" failure mode
@@ -2221,7 +2280,7 @@ public sealed partial class RynthAiPlugin
private void HandlePanicCommand()
{
int before = Host.HasGetBusyState ? Host.GetBusyState() : -1;
- ChatLine("[RynthAi] PANIC — full AC state reset");
+ ReplyOk("[RynthAi] PANIC — full AC state reset");
RynthCore.Plugin.Shared.ActionPacer.Forget("/ra panic");
if (Host.HasCancelAttack) Host.CancelAttack();
@@ -2241,13 +2300,14 @@ public sealed partial class RynthAiPlugin
if (_buffManager != null) _buffManager.BusyCount = 0;
int after = Host.HasGetBusyState ? Host.GetBusyState() : -1;
- ChatLine($"[RynthAi] Panic complete (busy {before} → {after}). If items still won't use or equip, /rc actionstate shows why.");
+ ReplyOk($"[RynthAi] Panic complete (busy {before} → {after}). If items still won't use or equip, /rc actionstate shows why.");
}
private void HandleForceBuff()
{
- if (_buffManager == null) { ChatLine("[RynthAi] Buff manager not ready."); return; }
+ if (_buffManager == null) { ReplyFail("[RynthAi] Buff manager not ready."); return; }
_buffManager.RequestForceFullRebuff(); // chat commands run on AC's thread; applied on the pump
+ Reply.Answered(); // the pump says "Starting Force Rebuff..." on its next heartbeat
}
// /ra buff force | cancel | skipped: the same actions as /ra forcebuff, /ra cancelforcebuff
@@ -2261,8 +2321,9 @@ public sealed partial class RynthAiPlugin
case "force": HandleForceBuff(); break;
case "cancel": HandleCancelForceBuff(); break;
case "skipped":
- if (_buffManager == null) { ChatLine("[RynthAi] Buff manager not ready."); break; }
+ if (_buffManager == null) { ReplyFail("[RynthAi] Buff manager not ready."); break; }
_buffManager.RequestSkipReport(); // chat commands run on AC's thread; the pump builds the list and answers
+ Reply.Answered();
break;
default:
ChatLine("[RynthAi] /ra buff force - recast every buff now, whatever time is left");
@@ -2274,8 +2335,9 @@ public sealed partial class RynthAiPlugin
private void HandleCancelForceBuff()
{
- if (_buffManager == null) { ChatLine("[RynthAi] Buff manager not ready."); return; }
+ if (_buffManager == null) { ReplyFail("[RynthAi] Buff manager not ready."); return; }
_buffManager.RequestCancelBuffing();
+ Reply.Answered(); // the pump says "Sequence cancelled." on its next heartbeat
}
private void HandleBusyInfoCommand()
@@ -2311,9 +2373,9 @@ public sealed partial class RynthAiPlugin
private void HandleMapDumpCommand()
{
- if (_objectCache == null) { ChatLine("[RynthAi] Cache not ready."); return; }
- if (!Host.HasGetObjectPosition) { ChatLine("[RynthAi] GetObjectPosition not available."); return; }
- if (!Host.TryGetPlayerPose(out uint playerCell, out _, out _, out _, out _, out _, out _, out _)) { ChatLine("[RynthAi] Can't get player cell."); return; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Cache not ready."); return; }
+ if (!Host.HasGetObjectPosition) { ReplyFail("[RynthAi] GetObjectPosition not available."); return; }
+ if (!Host.TryGetPlayerPose(out uint playerCell, out _, out _, out _, out _, out _, out _, out _)) { ReplyFail("[RynthAi] Can't get player cell."); return; }
uint landblock = playerCell >> 16;
ChatLine($"[RynthAi] === Map Dump (landblock 0x{landblock:X4}) ===");
@@ -2447,7 +2509,7 @@ public sealed partial class RynthAiPlugin
{
if (parts.Length < 3)
{
- ChatLine("[RynthAi] Usage: /ra use[i|l][p] [on ]");
+ ReplyFail("[RynthAi] Usage: /ra use[i|l][p] [on ]");
return;
}
@@ -2461,37 +2523,37 @@ public sealed partial class RynthAiPlugin
string tgtName = argStr.Substring(onIdx + 4).Trim();
var src = FindObject(srcName, inv, land, partial);
var tgt = FindObject(tgtName, inv, land, partial);
- if (src == null) { ChatLine($"[RynthAi] Not found: '{srcName}'"); return; }
- if (tgt == null) { ChatLine($"[RynthAi] Not found: '{tgtName}'"); return; }
+ if (src == null) { ReplyFail($"[RynthAi] Not found: '{srcName}'"); return; }
+ if (tgt == null) { ReplyFail($"[RynthAi] Not found: '{tgtName}'"); return; }
Host.UseOnFor((uint)src.Id, (uint)tgt.Id, "Command", "/ra use X on Y", UseKind.Asked);
- ChatLine($"[RynthAi] UseObjectOn: {src.Name} (0x{src.Id:X}) → {tgt.Name} (0x{tgt.Id:X})");
+ ReplyOk($"[RynthAi] UseObjectOn: {src.Name} (0x{src.Id:X}) → {tgt.Name} (0x{tgt.Id:X})");
return;
}
var obj = FindObject(argStr.Trim(), inv, land, partial);
if (obj == null)
{
- ChatLine($"[RynthAi] Not found: '{argStr.Trim()}'");
+ ReplyFail($"[RynthAi] Not found: '{argStr.Trim()}'");
if (!partial) SuggestPartialMatches(argStr.Trim(), inv, land, parts[1].ToLowerInvariant());
return;
}
Host.UseFor((uint)obj.Id, "Command", "/ra use", UseKind.Asked);
- ChatLine($"[RynthAi] UseObject: {obj.Name} (0x{obj.Id:X})");
+ ReplyOk($"[RynthAi] UseObject: {obj.Name} (0x{obj.Id:X})");
}
private void HandleSelectCommand(string[] parts, bool inv, bool land, bool partial)
{
if (parts.Length < 3)
{
- ChatLine("[RynthAi] Usage: /ra select[i|l][p] ");
+ ReplyFail("[RynthAi] Usage: /ra select[i|l][p] ");
return;
}
string name = string.Join(" ", parts, 2, parts.Length - 2).Trim();
var obj = FindObject(name, inv, land, partial);
- if (obj == null) { ChatLine($"[RynthAi] Not found: '{name}'"); return; }
+ if (obj == null) { ReplyFail($"[RynthAi] Not found: '{name}'"); return; }
Host.SelectItem((uint)obj.Id);
- ChatLine($"[RynthAi] Selected: {obj.Name} (0x{obj.Id:X})");
+ ReplyOk($"[RynthAi] Selected: {obj.Name} (0x{obj.Id:X})");
}
// ── Give commands ─────────────────────────────────────────────────────────
@@ -2553,8 +2615,8 @@ public sealed partial class RynthAiPlugin
private void HandleGiveCommand(string[] parts, GiveItemMatch itemMatch, bool partialPlayer, bool allItems = false)
{
- if (_objectCache == null) { ChatLine("[RynthAi] Object cache not ready."); return; }
- if (!Host.HasMoveItemExternal) { ChatLine("[RynthAi] MoveItemExternal not available."); return; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Object cache not ready."); return; }
+ if (!Host.HasMoveItemExternal) { ReplyFail("[RynthAi] MoveItemExternal not available."); return; }
string argStr = string.Join(" ", parts, 2, parts.Length - 2).Trim();
@@ -2562,7 +2624,7 @@ public sealed partial class RynthAiPlugin
int toIdx = argStr.LastIndexOf(" to ", StringComparison.OrdinalIgnoreCase);
if (toIdx < 0)
{
- ChatLine("[RynthAi] Usage: /ra give[a][p|P|pp|r] [count] - to
");
+ ReplyFail("[RynthAi] Usage: /ra give[a][p|P|pp|r] [count] - to
");
return;
}
@@ -2571,7 +2633,7 @@ public sealed partial class RynthAiPlugin
if (string.IsNullOrEmpty(itemPart) || string.IsNullOrEmpty(playerPart))
{
- ChatLine("[RynthAi] Item name and player name must not be empty.");
+ ReplyFail("[RynthAi] Item name and player name must not be empty.");
return;
}
@@ -2595,14 +2657,14 @@ public sealed partial class RynthAiPlugin
: string.Equals(wo.Name, playerPart, StringComparison.OrdinalIgnoreCase);
if (match) { target = wo; break; }
}
- if (target == null) { ChatLine($"[RynthAi] Target not found: '{playerPart}'"); return; }
+ if (target == null) { ReplyFail($"[RynthAi] Target not found: '{playerPart}'"); return; }
// Compile regex if needed
Regex? rx = null;
if (itemMatch == GiveItemMatch.Regex)
{
try { rx = new Regex(itemPart, RegexOptions.IgnoreCase); }
- catch { ChatLine($"[RynthAi] Invalid regex: {itemPart}"); return; }
+ catch { ReplyFail($"[RynthAi] Invalid regex: {itemPart}"); return; }
}
// Collect matching carried stacks (never worn or wielded gear)
@@ -2615,7 +2677,7 @@ public sealed partial class RynthAiPlugin
});
if (!allItems && matches.Count > maxCount) matches.RemoveRange(maxCount, matches.Count - maxCount);
- if (matches.Count == 0) { ChatLine($"[RynthAi] No items found matching '{itemPart}'"); return; }
+ if (matches.Count == 0) { ReplyFail($"[RynthAi] No items found matching '{itemPart}'"); return; }
if (allItems)
{
@@ -2651,9 +2713,9 @@ public sealed partial class RynthAiPlugin
string skippedNote = protectedCount > 0 ? $", {protectedCount} protected stack(s) skipped" : "";
string capNote = capped ? $", capped at {MaxGiveAllPerCommand}: run it again for the rest" : "";
if (toGive.Count == 0)
- ChatLine($"[RynthAi] Nothing to give: every item matching '{itemPart}' is protected ({protectedCount} skipped).");
+ ReplyFail($"[RynthAi] Nothing to give: every item matching '{itemPart}' is protected ({protectedCount} skipped).");
else
- ChatLine($"[RynthAi] Queued {toGive.Count} stack(s) matching '{itemPart}' → {target.Name}{skippedNote}{capNote}");
+ ReplyOk($"[RynthAi] Queued {toGive.Count} stack(s) matching '{itemPart}' → {target.Name}{skippedNote}{capNote}");
}
else if (countGiven)
{
@@ -2675,13 +2737,13 @@ public sealed partial class RynthAiPlugin
{
// Through the queue: an NPC that takes one item per give needs the repeat-until-met loop.
EnqueueGive((uint)gives[0].Item.Id, (uint)target.Id, gives[0].Amount);
- ChatLine($"[RynthAi] Giving {gives[0].Amount} x '{gives[0].Item.Name}' to {target.Name}");
+ ReplyOk($"[RynthAi] Giving {gives[0].Amount} x '{gives[0].Item.Name}' to {target.Name}");
}
else
{
foreach (var (item, amount) in gives)
EnqueueGive((uint)item.Id, (uint)target.Id, amount);
- ChatLine($"[RynthAi] Queued {maxCount - remaining} item(s) from {gives.Count} stack(s) matching '{itemPart}' → {target.Name}");
+ ReplyOk($"[RynthAi] Queued {maxCount - remaining} item(s) from {gives.Count} stack(s) matching '{itemPart}' → {target.Name}");
}
}
else
@@ -2689,7 +2751,7 @@ public sealed partial class RynthAiPlugin
var item = matches[0];
int stackSize = Math.Max(1, item.Values(LongValueKey.StackCount, 1));
GiveItem((uint)item.Id, (uint)target.Id, stackSize, stackSize);
- ChatLine($"[RynthAi] Giving '{item.Name}' to {target.Name}");
+ ReplyOk($"[RynthAi] Giving '{item.Name}' to {target.Name}");
}
}
@@ -2710,12 +2772,12 @@ public sealed partial class RynthAiPlugin
private void HandleGiveProfileCommand(string[] parts, bool partialPlayer)
{
- if (_objectCache == null) { ChatLine("[RynthAi] Object cache not ready."); return; }
- if (!Host.HasMoveItemExternal) { ChatLine("[RynthAi] MoveItemExternal not available."); return; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Object cache not ready."); return; }
+ if (!Host.HasMoveItemExternal) { ReplyFail("[RynthAi] MoveItemExternal not available."); return; }
string argStr = string.Join(" ", parts, 2, parts.Length - 2).Trim();
int toIdx = argStr.LastIndexOf(" to ", StringComparison.OrdinalIgnoreCase);
- if (toIdx < 0) { ChatLine("[RynthAi] Usage: /ra ig[p] to "); return; }
+ if (toIdx < 0) { ReplyFail("[RynthAi] Usage: /ra ig[p] to "); return; }
string profileArg = argStr.Substring(0, toIdx).Trim();
string playerPart = argStr.Substring(toIdx + 4).Trim();
@@ -2730,7 +2792,7 @@ public sealed partial class RynthAiPlugin
if (!isJson && !profilePath.EndsWith(".utl", StringComparison.OrdinalIgnoreCase))
profilePath += ".utl";
- if (!System.IO.File.Exists(profilePath)) { ChatLine($"[RynthAi] Profile not found: {profilePath}"); return; }
+ if (!System.IO.File.Exists(profilePath)) { ReplyFail($"[RynthAi] Profile not found: {profilePath}"); return; }
// Find target in landscape by name (player, NPC, container, etc.)
WorldObject? target = null;
@@ -2741,7 +2803,7 @@ public sealed partial class RynthAiPlugin
: string.Equals(wo.Name, playerPart, StringComparison.OrdinalIgnoreCase);
if (match) { target = wo; break; }
}
- if (target == null) { ChatLine($"[RynthAi] Target not found: '{playerPart}'"); return; }
+ if (target == null) { ReplyFail($"[RynthAi] Target not found: '{playerPart}'"); return; }
// Load profile and enqueue all matching items through the throttled give queue,
// mirroring the givea* commands so the server isn't flooded with MoveItemExternal calls.
@@ -2788,7 +2850,7 @@ public sealed partial class RynthAiPlugin
private void HandleDungeonNavCommand(string[] parts)
{
var settings = _dashboard?.Settings;
- if (settings == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (settings == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
if (parts.Length < 4 ||
!double.TryParse(parts[2], System.Globalization.NumberStyles.Float,
@@ -2796,35 +2858,35 @@ public sealed partial class RynthAiPlugin
!double.TryParse(parts[3], System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture, out double destEW))
{
- ChatLine("[RynthAi] Usage: /ra dunnav (e.g. /ra dunnav 12.5 -34.2)");
+ ReplyFail("[RynthAi] Usage: /ra dunnav (e.g. /ra dunnav 12.5 -34.2)");
return;
}
if (!Host.TryGetPlayerPose(out uint playerCell, out _, out _, out float playerWZ, out _, out _, out _, out _))
{
- ChatLine("[RynthAi] Cannot get player position."); return;
+ ReplyFail("[RynthAi] Cannot get player position."); return;
}
uint landblockKey = playerCell >> 16;
bool isDungeon = (playerCell & 0xFFFF) >= 0x0100;
if (!isDungeon)
{
- ChatLine("[RynthAi] dunnav requires you to be inside a dungeon (cell >= 0x0100).");
+ ReplyFail("[RynthAi] dunnav requires you to be inside a dungeon (cell >= 0x0100).");
return;
}
var cellDat = _raycast?.GeometryLoader.CellDat;
if (cellDat == null || !cellDat.IsLoaded)
{
- ChatLine("[RynthAi] Cell dat not loaded — raycast system must be initialized first."); return;
+ ReplyFail("[RynthAi] Cell dat not loaded — raycast system must be initialized first."); return;
}
if (!NavCoordinateHelper.TryGetNavCoords(Host, out double playerNS, out double playerEW))
{
- ChatLine("[RynthAi] Cannot get player nav coordinates."); return;
+ ReplyFail("[RynthAi] Cannot get player nav coordinates."); return;
}
- ChatLine($"[RynthAi] DunNav: building graph for landblock 0x{landblockKey:X4}...");
+ ReplyOk($"[RynthAi] DunNav: building graph for landblock 0x{landblockKey:X4}...");
var route = DungeonPathfinder.NavigateTo(
landblockKey, cellDat,
@@ -2835,7 +2897,7 @@ public sealed partial class RynthAiPlugin
if (route == null)
{
- ChatLine($"[RynthAi] DunNav: no walkable path found — destination may only be reachable via a drop (graph={nodeCount} nodes, dest={destNS:F2}N/{destEW:F2}E).");
+ ReplyFail($"[RynthAi] DunNav: no walkable path found — destination may only be reachable via a drop (graph={nodeCount} nodes, dest={destNS:F2}N/{destEW:F2}E).");
return;
}
@@ -2845,7 +2907,7 @@ public sealed partial class RynthAiPlugin
settings.ActiveNavIndex = 0;
settings.EnableNavigation = true;
- ChatLine($"[RynthAi] DunNav: {nodeCount} cells, path={pathLength} steps → navigating to {destNS:F2}N/{destEW:F2}E");
+ ReplyOk($"[RynthAi] DunNav: {nodeCount} cells, path={pathLength} steps → navigating to {destNS:F2}N/{destEW:F2}E");
}
private void HandleDungeonNavPatrolCommand(string[] parts) => HandleDungeonNavPatrol();
@@ -2927,13 +2989,13 @@ public sealed partial class RynthAiPlugin
return;
}
var settings = _dashboard?.Settings;
- if (settings == null) { if (!isRebuild) ChatLine("[RynthAi] Settings not ready."); return; }
+ if (settings == null) { if (!isRebuild) ReplyFail("[RynthAi] Settings not ready."); return; }
var patrolOptions = PatrolOptionsFrom(settings);
if (!Host.TryGetPlayerPose(out uint playerCell, out float playerLocalX, out float playerLocalY,
out float patrolWZ, out _, out _, out _, out _))
{
- if (!isRebuild) ChatLine("[RynthAi] Cannot get player position."); return;
+ if (!isRebuild) ReplyFail("[RynthAi] Cannot get player position."); return;
}
uint landblockKey = playerCell >> 16;
@@ -2942,23 +3004,23 @@ public sealed partial class RynthAiPlugin
{
// Left the dungeon (e.g. portalled out) — stop tracking; nothing to rebuild.
_dunPatrolActive = false;
- if (!isRebuild) ChatLine("[RynthAi] dunnav-patrol requires you to be inside a dungeon (cell >= 0x0100).");
+ if (!isRebuild) ReplyFail("[RynthAi] dunnav-patrol requires you to be inside a dungeon (cell >= 0x0100).");
return;
}
var cellDat = _raycast?.GeometryLoader.CellDat;
if (cellDat == null || !cellDat.IsLoaded)
{
- if (!isRebuild) ChatLine("[RynthAi] Cell dat not loaded — raycast system must be initialized first."); return;
+ if (!isRebuild) ReplyFail("[RynthAi] Cell dat not loaded — raycast system must be initialized first."); return;
}
if (!NavCoordinateHelper.TryGetNavCoords(Host, out double playerNS, out double playerEW))
{
- if (!isRebuild) ChatLine("[RynthAi] Cannot get player nav coordinates."); return;
+ if (!isRebuild) ReplyFail("[RynthAi] Cannot get player nav coordinates."); return;
}
var graph = DungeonPathfinder.GetGraph(landblockKey, cellDat);
- if (graph.Count == 0) { if (!isRebuild) ChatLine("[RynthAi] DunNav-Patrol: dungeon graph is empty."); return; }
+ if (graph.Count == 0) { if (!isRebuild) ReplyFail("[RynthAi] DunNav-Patrol: dungeon graph is empty."); return; }
// Prefer the actual cell the player is standing in. NearestCell-by-distance can
// pick a same-floor cell across an interior wall when the player is hugging a
@@ -2971,7 +3033,7 @@ public sealed partial class RynthAiPlugin
else
{
startCell = DungeonPathfinder.NearestCell(graph, playerNS, playerEW, patrolWZ);
- if (startCell == 0) { if (!isRebuild) ChatLine("[RynthAi] DunNav-Patrol: cannot find starting cell."); return; }
+ if (startCell == 0) { if (!isRebuild) ReplyFail("[RynthAi] DunNav-Patrol: cannot find starting cell."); return; }
}
// Pull in hazards discovered on previous visits to this dungeon so the route avoids
@@ -3085,7 +3147,7 @@ public sealed partial class RynthAiPlugin
{
_dunPatrolActive = false;
if (!isRebuild)
- ChatLine("[RynthAi] DunNav-Patrol: no walkable route from here — you're standing in or surrounded by a hazard. Move to safe ground and retry.");
+ ReplyFail("[RynthAi] DunNav-Patrol: no walkable route from here — you're standing in or surrounded by a hazard. Move to safe ground and retry.");
return;
}
@@ -3140,7 +3202,7 @@ public sealed partial class RynthAiPlugin
string layout = geometry != null && doorwayPts > 0
? $", {doorwayPts} of them lined up on doorways"
: geometry == null ? " (dungeon map not loaded yet: cell-centre route)" : "";
- ChatLine($"[RynthAi] DunNav-Patrol: {graph.Count} cells, {route.Points.Count} waypoints{layout} → circular patrol started{skipNote}{hazardNote}{portalNote}");
+ ReplyOk($"[RynthAi] DunNav-Patrol: {graph.Count} cells, {route.Points.Count} waypoints{layout} → circular patrol started{skipNote}{hazardNote}{portalNote}");
}
}
@@ -3343,7 +3405,7 @@ public sealed partial class RynthAiPlugin
var portalDat = _raycast?.GeometryLoader?.PortalDat;
if (cellDat == null || portalDat == null || !cellDat.IsLoaded)
{
- ChatLine("[RynthAi] Geometry not loaded — raycast must be initialized first."); return;
+ ReplyFail("[RynthAi] Geometry not loaded — raycast must be initialized first."); return;
}
var surfaces = DungeonHazardSurfaces.GetCellSurfaces(cellDat, portalDat, cell);
@@ -3371,18 +3433,18 @@ public sealed partial class RynthAiPlugin
var portalDat = _raycast?.GeometryLoader?.PortalDat;
if (cellDat == null || portalDat == null || !cellDat.IsLoaded)
{
- ChatLine("[RynthAi] Geometry not loaded — raycast must be initialized first."); return;
+ ReplyFail("[RynthAi] Geometry not loaded — raycast must be initialized first."); return;
}
var learned = DungeonHazardSurfaces.LearnFromCell(cell, _raycast?.GeometryLoader?.DungeonLOS, portalDat);
DungeonPathfinder.InvalidateCache();
if (learned.Count == 0)
{
- ChatLine("[RynthAi] No rare floor texture found here to flag. If this IS lava, use /ra hazard surfaces then texture add 0x.");
+ ReplyFail("[RynthAi] No rare floor texture found here to flag. If this IS lava, use /ra hazard surfaces then texture add 0x.");
return;
}
- foreach (uint t in learned) ChatLine($"[RynthAi] Flagged hazard texture 0x{t:X8}.");
- ChatLine("[RynthAi] Re-run /ra dunnav-patrol to rebuild the route avoiding every cell with that floor.");
+ foreach (uint t in learned) ReplyOk($"[RynthAi] Flagged hazard texture 0x{t:X8}.");
+ ReplyOk("[RynthAi] Re-run /ra dunnav-patrol to rebuild the route avoiding every cell with that floor.");
}
private void HandleHazardTextureCommand(string[] parts)
@@ -3394,10 +3456,10 @@ public sealed partial class RynthAiPlugin
case "add":
{
if (parts.Length < 5 || !TryParseHexUint(parts[4], out uint tex))
- { ChatLine("[RynthAi] Usage: /ra hazard texture add 0x"); return; }
+ { ReplyFail("[RynthAi] Usage: /ra hazard texture add 0x"); return; }
bool added = DungeonHazardSurfaces.AddHazardTexture(tex);
DungeonPathfinder.InvalidateCache();
- ChatLine(added
+ ReplyOk(added
? $"[RynthAi] Added hazard texture 0x{tex:X8}. Re-run /ra dunnav-patrol to rebuild around it."
: $"[RynthAi] Texture 0x{tex:X8} was already flagged.");
break;
@@ -3407,10 +3469,10 @@ public sealed partial class RynthAiPlugin
case "remove":
{
if (parts.Length < 5 || !TryParseHexUint(parts[4], out uint tex))
- { ChatLine("[RynthAi] Usage: /ra hazard texture del 0x"); return; }
+ { ReplyFail("[RynthAi] Usage: /ra hazard texture del 0x"); return; }
bool removed = DungeonHazardSurfaces.RemoveHazardTexture(tex);
DungeonPathfinder.InvalidateCache();
- ChatLine(removed ? $"[RynthAi] Removed hazard texture 0x{tex:X8}." : $"[RynthAi] Texture 0x{tex:X8} was not flagged.");
+ ReplyOk(removed ? $"[RynthAi] Removed hazard texture 0x{tex:X8}." : $"[RynthAi] Texture 0x{tex:X8} was not flagged.");
break;
}
default:
@@ -3443,11 +3505,11 @@ public sealed partial class RynthAiPlugin
cell = 0;
if (!Host.TryGetPlayerPose(out uint c, out _, out _, out _, out _, out _, out _, out _))
{
- ChatLine("[RynthAi] Cannot read player position."); return false;
+ ReplyFail("[RynthAi] Cannot read player position."); return false;
}
if ((c & 0xFFFF) < 0x0100)
{
- ChatLine("[RynthAi] You must be inside a dungeon (cell >= 0x0100) to mark hazards."); return false;
+ ReplyFail("[RynthAi] You must be inside a dungeon (cell >= 0x0100) to mark hazards."); return false;
}
cell = c;
return true;
@@ -3463,9 +3525,9 @@ public sealed partial class RynthAiPlugin
if (!TryGetCurrentDungeonCell(out uint cell)) return;
bool added = _objectCache?.AddHazardCell(cell) ?? false;
if (added)
- ChatLine($"[RynthAi] Marked cell 0x{cell:X8} as a hazard — patrol will avoid it (saved). Re-run /ra dunnav-patrol to rebuild now.");
+ ReplyOk($"[RynthAi] Marked cell 0x{cell:X8} as a hazard — patrol will avoid it (saved). Re-run /ra dunnav-patrol to rebuild now.");
else
- ChatLine($"[RynthAi] Cell 0x{cell:X8} was already marked as a hazard.");
+ ReplyOk($"[RynthAi] Cell 0x{cell:X8} was already marked as a hazard.");
}
private void UnmarkCurrentCellHazard()
@@ -3481,7 +3543,7 @@ public sealed partial class RynthAiPlugin
{
if (!Host.TryGetPlayerPose(out uint c, out _, out _, out _, out _, out _, out _, out _))
{
- ChatLine("[RynthAi] Cannot read player position."); return;
+ ReplyFail("[RynthAi] Cannot read player position."); return;
}
uint lb = c >> 16;
var cells = _objectCache?.GetHazardCellsForLandblock(lb) ?? new System.Collections.Generic.List();
@@ -3497,7 +3559,7 @@ public sealed partial class RynthAiPlugin
private void ScanNearbyLandscape()
{
- if (_objectCache == null) { ChatLine("[RynthAi] Object cache not ready."); return; }
+ if (_objectCache == null) { ReplyFail("[RynthAi] Object cache not ready."); return; }
int shown = 0;
ChatLine("[RynthAi] Nearby landscape objects (name → cell):");
foreach (var wo in _objectCache.GetLandscape())
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiItemInfo.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiItemInfo.cs
index cd95cb9..6255d8a 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiItemInfo.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiItemInfo.cs
@@ -69,7 +69,7 @@ public sealed partial class RynthAiPlugin
PrintSelectedItemInfo();
return;
}
- if (s == null) { ChatLine("[RynthAi] Settings not ready (log in first)."); return; }
+ if (s == null) { ReplyFail("[RynthAi] Settings not ready (log in first)."); return; }
switch (sub)
{
@@ -83,40 +83,40 @@ public sealed partial class RynthAiPlugin
case "gui":
case "window":
s.ShowWindow = !s.ShowWindow;
- ChatLine($"[RynthAi] Item info window {(s.ShowWindow ? "opened" : "closed")}.");
+ ReplyOk($"[RynthAi] Item info window {(s.ShowWindow ? "opened" : "closed")}.");
return;
case "value":
if (ParseOnOff(arg3) is bool v) s.ShowValueAndBurden = v;
- ChatLine($"[RynthAi] Item info value/burden: {OnOff(s.ShowValueAndBurden)}");
+ ReplyOk($"[RynthAi] Item info value/burden: {OnOff(s.ShowValueAndBurden)}");
return;
case "verbose":
if (ParseOnOff(arg3) is bool all)
s.SpellMode = all ? MagItemInfoSettings.SpellModeAll : MagItemInfoSettings.SpellModeMag;
- ChatLine($"[RynthAi] Item info all spells: {OnOff(s.SpellMode == MagItemInfoSettings.SpellModeAll)}");
+ ReplyOk($"[RynthAi] Item info all spells: {OnOff(s.SpellMode == MagItemInfoSettings.SpellModeAll)}");
return;
case "field":
if (!MagItemInfoCatalog.TryFindField(arg3, out MagItemInfoField field))
{
- ChatLine($"[RynthAi] Unknown field '{arg3}'. /ra iteminfo fields lists them.");
+ ReplyFail($"[RynthAi] Unknown field '{arg3}'. /ra iteminfo fields lists them.");
return;
}
if (ParseOnOff(arg4) is bool fieldOn) s.SetHidden(field, !fieldOn);
- ChatLine($"[RynthAi] Item info field {field}: {OnOff(!s.IsHidden(field))}");
+ ReplyOk($"[RynthAi] Item info field {field}: {OnOff(!s.IsHidden(field))}");
return;
case "rating":
int r = MagItemInfoCatalog.FindRating(arg3);
if (r < 0)
{
- ChatLine($"[RynthAi] Unknown rating '{arg3}'. /ra iteminfo fields lists them.");
+ ReplyFail($"[RynthAi] Unknown rating '{arg3}'. /ra iteminfo fields lists them.");
return;
}
if (ParseOnOff(arg4) is bool ratingOn) s.SetRatingHidden(r, !ratingOn);
var rating = MagItemInfoCatalog.Ratings[r];
- ChatLine($"[RynthAi] Item info rating {rating.Tag} ({rating.Name}): {OnOff(!s.IsRatingHidden(r))}");
+ ReplyOk($"[RynthAi] Item info rating {rating.Tag} ({rating.Name}): {OnOff(!s.IsRatingHidden(r))}");
return;
case "fields":
@@ -131,10 +131,10 @@ public sealed partial class RynthAiPlugin
case "off": case "none": s.ClickTrigger = MagItemInfoSettings.ClickOff; break;
case "": break;
default:
- ChatLine("[RynthAi] Usage: /ra iteminfo click left|right|off");
+ ReplyFail("[RynthAi] Usage: /ra iteminfo click left|right|off");
return;
}
- ChatLine($"[RynthAi] Item info on click: {MagItemInfoCatalog.ClickTriggers[s.ClickTrigger]}");
+ ReplyOk($"[RynthAi] Item info on click: {MagItemInfoCatalog.ClickTriggers[s.ClickTrigger]}");
return;
case "layout":
@@ -144,22 +144,22 @@ public sealed partial class RynthAiPlugin
case "line": case "mag": case "one": s.Layout = MagItemInfoSettings.LayoutOneLine; break;
case "": break;
default:
- ChatLine("[RynthAi] Usage: /ra iteminfo layout pet|line");
+ ReplyFail("[RynthAi] Usage: /ra iteminfo layout pet|line");
return;
}
- ChatLine($"[RynthAi] Item info layout: {MagItemInfoCatalog.Layouts[s.Layout]}");
+ ReplyOk($"[RynthAi] Item info layout: {MagItemInfoCatalog.Layouts[s.Layout]}");
return;
case "reset":
s.ResetToDefaults();
- ChatLine("[RynthAi] Item info settings reset to defaults.");
+ ReplyOk("[RynthAi] Item info settings reset to defaults.");
return;
}
if (ParseOnOff(sub) is bool onSelect)
{
s.OnSelect = onSelect;
- ChatLine($"[RynthAi] Item info on select: {OnOff(onSelect)}");
+ ReplyOk($"[RynthAi] Item info on select: {OnOff(onSelect)}");
return;
}
if (sub is not ("help" or "?"))
@@ -168,9 +168,9 @@ public sealed partial class RynthAiPlugin
string name = string.Join(" ", parts, 2, parts.Length - 2).Trim();
uint found = FindInventoryItemByName(name);
if (found != 0) { QueueItemInfo(unchecked((int)found), requestId: true); return; }
- ChatLine($"[RynthAi] Item info: no \"{name}\" in your inventory.");
+ ReplyFail($"[RynthAi] Item info: no \"{name}\" in your inventory.");
}
- ChatLine("[RynthAi] Usage: /ra iteminfo [- |me|on|off|settings|fields|field
on|off|rating on|off|value on|off|verbose on|off|click left|right|off|layout pet|line|reset]");
+ ReplyFail("[RynthAi] Usage: /ra iteminfo [- |me|on|off|settings|fields|field
on|off|rating on|off|value on|off|verbose on|off|click left|right|off|layout pet|line|reset]");
}
///
@@ -244,9 +244,9 @@ public sealed partial class RynthAiPlugin
/// /ra iteminfo and the window's "Print to chat" button.
private void PrintSelectedItemInfo()
{
- if (!Host.HasGetSelectedItemId) { ChatLine("[RynthAi] Host does not expose the selected item."); return; }
+ if (!Host.HasGetSelectedItemId) { ReplyFail("[RynthAi] Host does not expose the selected item."); return; }
uint selected = Host.GetSelectedItemId();
- if (selected == 0) { ChatLine("[RynthAi] No item selected. Click an item first."); return; }
+ if (selected == 0) { ReplyFail("[RynthAi] No item selected. Click an item first."); return; }
if (IsSelf(selected)) { QueueSelfRatings(auto: false); return; }
QueueItemInfo(unchecked((int)selected), requestId: true);
}
@@ -276,6 +276,7 @@ public sealed partial class RynthAiPlugin
}
if (requestId && Host.HasRequestId) Host.RequestId(uid);
ItemInfoLog($"0x{uid:X8}: waiting for ID data (requested={requestId && Host.HasRequestId})");
+ Reply.Answered(); // a command's item info follows when the ID data arrives
_itemInfoPendingId = itemId;
_itemInfoPendingSince = Environment.TickCount64;
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Dashboard.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Dashboard.cs
index 31de5f2..3a1cfe7 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Dashboard.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Dashboard.cs
@@ -36,7 +36,8 @@ public sealed partial class RynthAiPlugin
private readonly ConcurrentQueue _dashActions = new();
private readonly DateTime _dashLoadedUtc = DateTime.UtcNow;
private long _dashDrawnMs = long.MinValue / 2; // render thread writes, tick reads
- private long _nextDashVitalsMs, _nextDashClassicMs, _dashSaveAtMs;
+ private long _nextDashVitalsMs, _nextDashClassicMs, _dashSaveAtMs, _nextDashSortMs;
+ private volatile int _dashSort = -1; // RynthSort's auto-sort (tick writes, render reads)
private volatile bool _classicLook; // the engine's look is Classic (its file)
private long _classicAskedMs; // "Classic look" clicked: the window steps aside now
private volatile FightTarget? _dashFight; // tick writes, render reads
@@ -104,6 +105,11 @@ public sealed partial class RynthAiPlugin
_dashboard?.RefreshDashboardVitals();
_dashFight = ReadFightTarget(_dashFight);
}
+ if (shown && now >= _nextDashSortMs)
+ {
+ _nextDashSortMs = now + 500;
+ _dashSort = ReadAutoSort();
+ }
if (now >= _nextDashClassicMs)
{
_nextDashClassicMs = now + 2000;
@@ -167,6 +173,36 @@ public sealed partial class RynthAiPlugin
QueueDashCommand("/rc dashboard classic");
}
+ /// RynthSort's auto-sort for the dashboard's key: -1 not loaded / not logged in / too old, 0 off, 1 on.
+ internal int DashAutoSort => _dashSort;
+
+ ///
+ /// RynthSort's auto-sort state, through the engine's JSON broker (RynthSort's
+ /// RynthPluginGetAutoSortJson, {"auto":-1|0|1}); -1 when RynthSort isn't loaded or predates
+ /// the export. Plugin tick.
+ ///
+ private int ReadAutoSort()
+ {
+ if (!Host.HasGetPluginExportJson) return -1;
+ string? json = Host.GetPluginExportJson("RynthSort", "RynthPluginGetAutoSortJson");
+ if (json == null) return -1;
+ return json.Contains("\"auto\":1", StringComparison.Ordinal) ? 1
+ : json.Contains("\"auto\":0", StringComparison.Ordinal) ? 0 : -1;
+ }
+
+ /// The dashboard's auto-sort key: RynthSort on or off, quietly (the key shows it). Plugin tick.
+ internal void SetDashAutoSort(bool on)
+ {
+ if (!SendSortCommand(on ? "on quiet" : "off quiet")) return;
+ // Lit at once; RynthSort runs the command on its own tick, so the next read waits a little.
+ _dashSort = on ? 1 : 0;
+ _nextDashSortMs = Environment.TickCount64 + 1000;
+ }
+
+ /// An /rsort command (without "/rsort") to RynthSort; false when it isn't loaded. Plugin tick.
+ internal bool SendSortCommand(string arg) =>
+ Host.HasSendPluginCommand && Host.SendPluginCommand("RynthSort", "rsort", arg);
+
internal void QueueDashAction(Action action)
{
if (_dashActions.Count < 64) _dashActions.Enqueue(action);
@@ -215,6 +251,9 @@ internal sealed class DashboardBridge : IDashboardHost
public void AdjustOpacity(float delta) => Queue(() => { _p.DashboardRenderer?.AdjustOpacity(delta); _p.ScheduleDashSave(); });
public void ToggleLock() => Queue(() => { _p.DashboardRenderer?.TogglePanelLock(); _p.ScheduleDashSave(); });
public void SelectProfile(int kind, int index) => Queue(() => _p.DashboardRenderer?.SelectProfileAtIndex(kind, index));
+ public int AutoSort => _p.DashAutoSort;
+ public void SetAutoSort(bool on) => Queue(() => _p.SetDashAutoSort(on));
+ public void ToggleSortWindow() => Queue(() => _p.SendSortCommand(string.Empty));
public void StartPatrol() => Queue(_p.HandleDungeonNavPatrol);
public void ToggleSpells() => _p.EnqueueRemoteCommand("spells", "toggle");
public void UseClassicLook() => _p.UseClassicLook();
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LocalFeatures.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LocalFeatures.cs
index 0cca9cb..058e3fe 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LocalFeatures.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LocalFeatures.cs
@@ -496,22 +496,22 @@ public sealed partial class RynthAiPlugin
/// "/ra huds|itemhud|remote|miniremote [show|hide|toggle]".
private void HandleHudCommand(string which, string mode)
{
- if (_huds == null) { ChatLine("[RynthAi] HUDs not ready (log in first)."); return; }
+ if (_huds == null) { ReplyFail("[RynthAi] HUDs not ready (log in first)."); return; }
ChatLine("[RynthAi] " + _huds.HandleCommand(which, mode));
}
/// "/ra itemhud add <name>" and the inventory panel's "Add to item count HUD". Pump thread.
private void HandleItemHudAdd(string name)
{
- if (_huds == null) { ChatLine("[RynthAi] HUDs not ready (log in first)."); return; }
- if (string.IsNullOrWhiteSpace(name)) { ChatLine("[RynthAi] Usage: /ra itemhud add - "); return; }
+ if (_huds == null) { ReplyFail("[RynthAi] HUDs not ready (log in first)."); return; }
+ if (string.IsNullOrWhiteSpace(name)) { ReplyFail("[RynthAi] Usage: /ra itemhud add
- "); return; }
ChatLine("[RynthAi] " + _huds.AddToItemHudAndShow(name));
}
///
/ra translate ... — forwards to the chat translator.
private void HandleTranslateCommand(string[] parts)
{
- if (_translator == null) { ChatLine("[RynthAi] Chat translator not ready (log in first)."); return; }
+ if (_translator == null) { ReplyFail("[RynthAi] Chat translator not ready (log in first)."); return; }
_translator.HandleCommand(parts.Length > 2 ? parts[2..] : Array.Empty(), ChatLine);
}
@@ -529,8 +529,10 @@ public sealed partial class RynthAiPlugin
string arg = parts.Length > 2 ? parts[2] : "status";
bool? state = arg.Equals("toggle", StringComparison.OrdinalIgnoreCase) ? !RynthLog.DebugToChat : ParseOnOff(arg);
if (state.HasValue) RynthLog.DebugToChat = state.Value;
- ChatLine($"[RynthAi] Debug-to-chat is {(RynthLog.DebugToChat ? "ON" : "off")}."
- + (RynthLog.DebugToChat && RynthLog.TracedCategories().Count == 0 ? " (no categories traced — see /ra trace list)" : ""));
+ string line = $"[RynthAi] Debug-to-chat is {(RynthLog.DebugToChat ? "ON" : "off")}."
+ + (RynthLog.DebugToChat && RynthLog.TracedCategories().Count == 0 ? " (no categories traced — see /ra trace list)" : "");
+ if (state.HasValue) ReplyOk(line); // a change
+ else ChatLine(line); // the status asked for
}
/// "/ra trace <cat|all|ilt|list> [on|off|status]".
@@ -560,13 +562,13 @@ public sealed partial class RynthAiPlugin
{
if (!state.HasValue) { foreach (string l in RynthLog.StatusLines()) ChatLine(l); return; }
int n = RynthLog.SetTracingByPrefix(string.Empty, state.Value);
- ChatLine($"[RynthAi] Tracing {(state.Value ? "enabled" : "disabled")} for {n} categories.");
+ ReplyOk($"[RynthAi] Tracing {(state.Value ? "enabled" : "disabled")} for {n} categories.");
return;
}
if (!RynthLog.TryParseCategory(target, out LogCat cat))
{
- ChatLine($"[RynthAi] Unknown trace category '{target}'. Use /ra trace list.");
+ ReplyFail($"[RynthAi] Unknown trace category '{target}'. Use /ra trace list.");
return;
}
@@ -578,7 +580,7 @@ public sealed partial class RynthAiPlugin
bool enable = state ?? !RynthLog.IsTracing(cat);
RynthLog.SetTracing(cat, enable);
- ChatLine($"[RynthAi] Trace {cat}: {(enable ? "ON" : "off")} → {RynthLog.TraceDirectory}");
+ ReplyOk($"[RynthAi] Trace {cat}: {(enable ? "ON" : "off")} → {RynthLog.TraceDirectory}");
}
/// "/ra logs [open|prune|flush|file on|off]".
@@ -593,20 +595,22 @@ public sealed partial class RynthAiPlugin
RynthLog.Flush();
System.IO.Directory.CreateDirectory(RynthLog.Directory);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo("explorer.exe", $"\"{RynthLog.Directory}\"") { UseShellExecute = true });
+ ReplyOk($"[RynthAi] Opened {RynthLog.Directory}.");
}
- catch (Exception ex) { RynthLog.Exception(LogCat.Commands, ex, "logs open"); ChatLine($"[RynthAi] Could not open {RynthLog.Directory}: {ex.Message}"); }
+ catch (Exception ex) { RynthLog.Exception(LogCat.Commands, ex, "logs open"); ReplyFail($"[RynthAi] Could not open {RynthLog.Directory}: {ex.Message}"); }
break;
case "prune":
- ChatLine($"[RynthAi] Pruned {RynthLog.Prune()} old diagnostics file(s).");
+ ReplyOk($"[RynthAi] Pruned {RynthLog.Prune()} old diagnostics file(s).");
break;
case "flush":
RynthLog.Flush();
- ChatLine("[RynthAi] Diagnostics flushed to disk.");
+ ReplyOk("[RynthAi] Diagnostics flushed to disk.");
break;
case "file":
bool? state = ParseOnOff(parts.Length > 3 ? parts[3] : null);
if (state.HasValue) RynthLog.FileLogAll = state.Value;
- ChatLine($"[RynthAi] Daily RynthAi log file is {(RynthLog.FileLogAll ? "ON" : "off")}.");
+ string fileLine = $"[RynthAi] Daily RynthAi log file is {(RynthLog.FileLogAll ? "ON" : "off")}.";
+ if (state.HasValue) ReplyOk(fileLine); else ChatLine(fileLine);
break;
default:
foreach (string l in RynthLog.StatusLines()) ChatLine(l);
@@ -617,21 +621,21 @@ public sealed partial class RynthAiPlugin
/// /ra navrec [on|off] — toggles route recording.
private void HandleNavRecordCommand(string[] parts)
{
- if (_dashboard == null) return;
+ if (_dashboard == null) { ReplyFail("[RynthAi] Settings not ready (log in first)."); return; }
var s = _dashboard.Settings;
string arg = parts.Length > 2 ? parts[2].ToLowerInvariant() : "";
s.IsRecordingNav = arg switch { "on" => true, "off" => false, _ => !s.IsRecordingNav };
- ChatLine($"[RynthAi] Nav recording {(s.IsRecordingNav ? "ON — walk the route; portals are captured" : "OFF")}.");
+ ReplyOk($"[RynthAi] Nav recording {(s.IsRecordingNav ? "ON — walk the route; portals are captured" : "OFF")}.");
}
/// /ra navhud [on|off] — shows or hides the navigation HUD window.
private void HandleNavHudCommand(string[] parts)
{
- if (_dashboard == null) return;
+ if (_dashboard == null) { ReplyFail("[RynthAi] Settings not ready (log in first)."); return; }
var o = _dashboard.Settings.NavOverlay;
string arg = parts.Length > 2 ? parts[2].ToLowerInvariant() : "";
o.ShowHud = arg switch { "on" => true, "off" => false, _ => !o.ShowHud };
- ChatLine($"[RynthAi] Nav HUD {(o.ShowHud ? "shown" : "hidden")}.");
+ ReplyOk($"[RynthAi] Nav HUD {(o.ShowHud ? "shown" : "hidden")}.");
}
/// /ra navtrail [on|off|toggle|clear] — breadcrumb tracking switch, wipe, or a status report.
@@ -641,16 +645,16 @@ public sealed partial class RynthAiPlugin
if (arg == "clear")
{
_navBreadcrumbs?.RequestClear();
- ChatLine("[RynthAi] Breadcrumb trail cleared.");
+ ReplyOk("[RynthAi] Breadcrumb trail cleared.");
return;
}
if (arg is "on" or "off" or "toggle")
{
- if (_dashboard == null) return;
+ if (_dashboard == null) { ReplyFail("[RynthAi] Settings not ready (log in first)."); return; }
var o = _dashboard.Settings.NavOverlay;
o.TrackBreadcrumbs = arg switch { "on" => true, "off" => false, _ => !o.TrackBreadcrumbs };
_dashboard.SaveSettings();
- ChatLine($"[RynthAi] Breadcrumb tracking {(o.TrackBreadcrumbs ? "on" : "off")}.");
+ ReplyOk($"[RynthAi] Breadcrumb tracking {(o.TrackBreadcrumbs ? "on" : "off")}.");
return;
}
bool tracking = _dashboard?.Settings.NavOverlay.TrackBreadcrumbs ?? false;
@@ -662,11 +666,11 @@ public sealed partial class RynthAiPlugin
/// /ra navoverlay [on|off] — route overlay (rings / lines, waypoint labels, guide line); no argument toggles.
private void HandleNavOverlayCommand(string[] parts)
{
- if (_dashboard == null) return;
+ if (_dashboard == null) { ReplyFail("[RynthAi] Settings not ready (log in first)."); return; }
var o = _dashboard.Settings.NavOverlay;
string arg = parts.Length > 2 ? parts[2].ToLowerInvariant() : "";
o.ShowRouteMarkers = arg switch { "on" => true, "off" => false, _ => !o.ShowRouteMarkers };
_dashboard.SaveSettings();
- ChatLine($"[RynthAi] Route overlay {(o.ShowRouteMarkers ? "on" : "off")}.");
+ ReplyOk($"[RynthAi] Route overlay {(o.ShowRouteMarkers ? "on" : "off")}.");
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LuaForward.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LuaForward.cs
index 0d641e1..8417aa2 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LuaForward.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LuaForward.cs
@@ -11,7 +11,10 @@ public sealed partial class RynthAiPlugin
{
string rest = parts.Length > 2 ? string.Join(" ", parts, 2, parts.Length - 2) : "";
if (Host.HasSendPluginCommand && Host.SendPluginCommand("RynthLua", "lua", rest))
+ {
+ Reply.Answered(); // RynthLua answers its own /lua verbs
return;
- ChatLine("[RynthAi] Lua scripting is now the RynthLua plugin. Add RynthCore.Plugin.RynthLua.dll in the launcher's Plugins tab, then use /lua (or /ra lua).");
+ }
+ ReplyFail("[RynthAi] Lua scripting is now the RynthLua plugin. Add RynthCore.Plugin.RynthLua.dll in the launcher's Plugins tab, then use /lua (or /ra lua).");
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.MetaSchedule.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.MetaSchedule.cs
index 2240d43..4d70b24 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.MetaSchedule.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.MetaSchedule.cs
@@ -23,7 +23,8 @@ public sealed partial class RynthAiPlugin
// Chat-bar events and /ra metamgr may arrive off the pump: flags and a queue, drained on it.
private int _mmTypedQuery; // a "/myquests" passed through the chat bar (maybe our own echo)
private int _mmShownQuery; // RynthAi's quest refresh sent /myquests: show that reply
- private readonly ConcurrentQueue _metaMgrCommands = new();
+ // FromScript: a meta (or script) sent the line, so its answer is quiet when it works (CommandReply.cs).
+ private readonly ConcurrentQueue<(string[] Parts, bool FromScript)> _metaMgrCommands = new();
/// OnLoginComplete: hook the dashboard (panel snapshot and ops) and the quest refresh.
private void WireMetaSchedule()
@@ -104,9 +105,9 @@ public sealed partial class RynthAiPlugin
}
if (folder.Length == 0) return; // no character settings yet: nothing to save to
- while (_metaMgrCommands.TryDequeue(out var parts))
+ while (_metaMgrCommands.TryDequeue(out var queued))
{
- try { HandleMetaMgrCommand(parts); }
+ try { Reply.RunQueued(queued.FromScript, () => HandleMetaMgrCommand(queued.Parts)); }
catch (Exception ex) { Host.Log($"[RynthAi] /ra metamgr failed: {ex.Message}"); }
}
@@ -184,7 +185,7 @@ public sealed partial class RynthAiPlugin
// /ra metamgr (queued to the pump by DispatchRaCommand)
// =====================================================================
- private void QueueMetaMgrCommand(string[] parts) => _metaMgrCommands.Enqueue(parts);
+ private void QueueMetaMgrCommand(string[] parts) => _metaMgrCommands.Enqueue((parts, Reply.FromScript));
private void HandleMetaMgrCommand(string[] parts)
{
@@ -196,7 +197,7 @@ public sealed partial class RynthAiPlugin
case "on":
case "off":
_metaScheduler.SetEnabled(sub == "on");
- ChatLine(sub == "on"
+ ReplyOk(sub == "on"
? $"[RynthAi] Meta Manager ON ({_metaScheduler.Config.Rules.Count} rule(s))."
: "[RynthAi] Meta Manager OFF.");
break;
@@ -206,9 +207,9 @@ public sealed partial class RynthAiPlugin
if (int.TryParse(parts[3], NumberStyles.Integer, CultureInfo.InvariantCulture, out int m))
{
_metaScheduler.SetPollMinutes(m);
- ChatLine($"[RynthAi] Meta Manager: /myquests every {_metaScheduler.Config.PollMinutes} min.");
+ ReplyOk($"[RynthAi] Meta Manager: /myquests every {_metaScheduler.Config.PollMinutes} min.");
}
- else ChatLine("[RynthAi] Usage: /ra metamgr poll [minutes]");
+ else ReplyFail("[RynthAi] Usage: /ra metamgr poll [minutes]");
break;
}
_metaScheduler.RequestPoll();
@@ -220,17 +221,17 @@ public sealed partial class RynthAiPlugin
case "stop":
case "reset":
{
- if (parts.Length < 4) { ChatLine($"[RynthAi] Usage: /ra metamgr {sub} {(sub == "start" ? " [minutes]" : sub == "reset" ? "|all" : "")}"); break; }
+ if (parts.Length < 4) { ReplyFail($"[RynthAi] Usage: /ra metamgr {sub} {(sub == "start" ? " [minutes]" : sub == "reset" ? "|all" : "")}"); break; }
if (sub == "reset" && parts[3].Equals("all", StringComparison.OrdinalIgnoreCase))
{
for (int i = 0; i < _metaScheduler.Config.Rules.Count; i++) _metaScheduler.ResetRule(i);
- ChatLine("[RynthAi] Meta Manager: every rule re-armed.");
+ ReplyOk("[RynthAi] Meta Manager: every rule re-armed.");
break;
}
if (!int.TryParse(parts[3], NumberStyles.Integer, CultureInfo.InvariantCulture, out int n)
|| n < 1 || n > _metaScheduler.Config.Rules.Count)
{
- ChatLine($"[RynthAi] Meta Manager: no rule #{parts[3]} (there are {_metaScheduler.Config.Rules.Count}).");
+ ReplyFail($"[RynthAi] Meta Manager: no rule #{parts[3]} (there are {_metaScheduler.Config.Rules.Count}).");
break;
}
int idx = n - 1;
@@ -238,18 +239,18 @@ public sealed partial class RynthAiPlugin
{
double? mins = null;
if (parts.Length >= 5 && double.TryParse(parts[4], NumberStyles.Float, CultureInfo.InvariantCulture, out double mm) && mm > 0) mins = mm;
- ChatLine(_metaScheduler.StartCountdown(idx, mins, now)
+ ReplyOk(_metaScheduler.StartCountdown(idx, mins, now)
? $"[RynthAi] Meta Manager: rule #{n} countdown started ({(mins ?? _metaScheduler.Config.Rules[idx].Minutes).ToString("0.##", CultureInfo.InvariantCulture)} min)."
: $"[RynthAi] Meta Manager: rule #{n} is not a countdown.");
}
else if (sub == "stop")
- ChatLine(_metaScheduler.StopCountdown(idx)
+ ReplyOk(_metaScheduler.StopCountdown(idx)
? $"[RynthAi] Meta Manager: rule #{n} countdown stopped."
: $"[RynthAi] Meta Manager: rule #{n} has no countdown running.");
else
{
_metaScheduler.ResetRule(idx);
- ChatLine($"[RynthAi] Meta Manager: rule #{n} re-armed.");
+ ReplyOk($"[RynthAi] Meta Manager: rule #{n} re-armed.");
}
break;
}
@@ -257,7 +258,7 @@ public sealed partial class RynthAiPlugin
foreach (string line in _metaScheduler.StatusLines(now, meta)) ChatLine("[RynthAi] " + line);
break;
default:
- ChatLine("[RynthAi] Usage: /ra metamgr on|off|status|poll [minutes]|start <#> [min]|stop <#>|reset <#|all>");
+ ReplyFail("[RynthAi] Usage: /ra metamgr on|off|status|poll [minutes]|start <#> [min]|stop <#>|reset <#|all>");
break;
}
SaveMetaScheduleIfDirty();
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.OwnCorpse.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.OwnCorpse.cs
index 123cd28..753c661 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.OwnCorpse.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.OwnCorpse.cs
@@ -454,13 +454,14 @@ public sealed partial class RynthAiPlugin
string sub = parts.Length >= 3 ? parts[2].Trim().ToLowerInvariant() : string.Empty;
if (sub == "stop")
{
- if (_ownCorpseTravel == OwnCorpseTravelState.None) ChatLine("[RynthAi] Own corpse: not travelling.");
+ if (_ownCorpseTravel == OwnCorpseTravelState.None) ReplyOk("[RynthAi] Own corpse: not travelling.");
else EndOwnCorpseTravel("stopped by /ra owncorpse stop");
return;
}
if (sub == "go")
{
- StartOwnCorpseTravel(manual: true);
+ if (s == null) { ReplyFail("[RynthAi] Own corpse: settings not ready (log in first)."); return; }
+ StartOwnCorpseTravel(manual: true); // says where it goes, or why not
return;
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.PropertyDump.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.PropertyDump.cs
index 052955c..64a9410 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.PropertyDump.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.PropertyDump.cs
@@ -47,7 +47,7 @@ public sealed partial class RynthAiPlugin
uint me = Host.GetPlayerId();
if (me == 0)
{
- ChatLine("[RynthAi] Not logged in.");
+ ReplyFail("[RynthAi] Not logged in.");
return;
}
uint target = me;
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Spells.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Spells.cs
index bce647a..275a76a 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Spells.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Spells.cs
@@ -56,7 +56,7 @@ public sealed partial class RynthAiPlugin
private void HandleSpellsCommand(string mode)
{
var settings = _dashboard?.Settings;
- if (settings == null) { ChatLine("[RynthAi] Settings not ready (log in first)."); return; }
+ if (settings == null) { ReplyFail("[RynthAi] Settings not ready (log in first)."); return; }
EnsureSpellsUi();
settings.ShowSpellsWindow = mode.ToLowerInvariant() switch
@@ -65,7 +65,7 @@ public sealed partial class RynthAiPlugin
"hide" or "close" or "off" => false,
_ => !settings.ShowSpellsWindow,
};
- ChatLine($"[RynthAi] Spells window {(settings.ShowSpellsWindow ? "opened" : "closed")}.");
+ ReplyOk($"[RynthAi] Spells window {(settings.ShowSpellsWindow ? "opened" : "closed")}.");
}
///
@@ -75,7 +75,7 @@ public sealed partial class RynthAiPlugin
private void HandleBuffProfileCommand(string[] parts)
{
var dash = _dashboard;
- if (dash == null) { ChatLine("[RynthAi] Settings not ready (log in first)."); return; }
+ if (dash == null) { ReplyFail("[RynthAi] Settings not ready (log in first)."); return; }
string arg = parts.Length >= 3 ? string.Join(" ", parts, 2, parts.Length - 2).Trim() : string.Empty;
if (arg.Length == 0 || arg.Equals("list", StringComparison.OrdinalIgnoreCase))
@@ -96,6 +96,7 @@ public sealed partial class RynthAiPlugin
|| arg.Equals(LegacyDashboardRenderer.BuiltInBuffProfileLabel, StringComparison.OrdinalIgnoreCase))
{
dash.SetActiveBuffProfile(string.Empty);
+ Reply.Answered();
return; // BuffManager posts the "built-in list" chat line
}
@@ -103,8 +104,9 @@ public sealed partial class RynthAiPlugin
{
if (!Path.GetFileNameWithoutExtension(file).Equals(arg, StringComparison.OrdinalIgnoreCase)) continue;
dash.SetActiveBuffProfile(Path.Combine(BuffProfileStore.Folder, file));
+ Reply.Answered();
return; // BuffManager posts the "profile 'X'" chat line once it loads
}
- ChatLine($"[RynthAi] No buff profile named '{arg}'. /ra buffprofile list shows them.");
+ ReplyFail($"[RynthAi] No buff profile named '{arg}'. /ra buffprofile list shows them.");
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.VTankHotkeys.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.VTankHotkeys.cs
index 42b97aa..6b387a6 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.VTankHotkeys.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.VTankHotkeys.cs
@@ -36,7 +36,9 @@ public sealed partial class RynthAiPlugin
string args = parts.Length > argsFrom ? string.Join(" ", parts, argsFrom, parts.Length - argsFrom) : "";
string command = "/rc videopatch" + (args.Length > 0 ? " " + args : "");
if (!Host.HasInvokeChatParser || !Host.InvokeChatParser(command))
- ChatLine("[RynthAi] The video patch is RynthCore's: type " + command + " (this engine can't run it for RynthAi).");
+ ReplyFail("[RynthAi] The video patch is RynthCore's: type " + command + " (this engine can't run it for RynthAi).");
+ else
+ Reply.Answered(); // the engine's /rc videopatch answers
}
/// The VTank-style /ra commands; false when isn't one of them.
@@ -70,7 +72,7 @@ public sealed partial class RynthAiPlugin
case "lootprio": HandlePriorityCommand(parts, nav: false, loot: true); return true;
case "navlootprio": HandlePriorityCommand(parts, nav: true, loot: true); return true;
case "lootthis":
- case "lootthiscont": RequestLootThisContainer(); return true;
+ case "lootthiscont": RequestLootThisContainer(); Reply.Answered(); return true; // the loot tick says what it took
default: return false;
}
}
@@ -110,12 +112,12 @@ public sealed partial class RynthAiPlugin
private void HandleSetMetaStateCommand(string[] parts)
{
var s = _dashboard?.Settings;
- if (s == null || _metaManager == null) { ChatLine("[RynthAi] Meta not ready (log in first)."); return; }
+ if (s == null || _metaManager == null) { ReplyFail("[RynthAi] Meta not ready (log in first)."); return; }
List states = LoadedMetaStates();
if (parts.Length < 3)
{
ChatLine($"[RynthAi] Meta state: {s.CurrentState}. States: {(states.Count == 0 ? "(no meta loaded)" : string.Join(", ", states))}.");
- ChatLine("[RynthAi] Usage: /ra setmetastate ");
+ ReplyFail("[RynthAi] Usage: /ra setmetastate ");
return;
}
string want = string.Join(" ", parts, 2, parts.Length - 2);
@@ -123,7 +125,7 @@ public sealed partial class RynthAiPlugin
string? known = states.FirstOrDefault(x => x.Equals(want, StringComparison.OrdinalIgnoreCase));
_metaManager.TryHandleVtCommand("/vt setmetastate " + (known ?? want));
if (known == null && states.Count > 0)
- ChatLine($"[RynthAi] Note: the loaded meta has no state '{want}' (states: {string.Join(", ", states)}).");
+ ReplyFail($"[RynthAi] Note: the loaded meta has no state '{want}' (states: {string.Join(", ", states)}).");
}
// ── Target lock ───────────────────────────────────────────────────────────
@@ -131,13 +133,13 @@ public sealed partial class RynthAiPlugin
private void HandleTargetLockCommand(string[] parts)
{
var cm = _combatManager;
- if (cm == null) { ChatLine("[RynthAi] Combat not ready (log in first)."); return; }
+ if (cm == null) { ReplyFail("[RynthAi] Combat not ready (log in first)."); return; }
string arg = parts.Length >= 3 ? parts[2].ToLowerInvariant() : "";
int current = cm.ForcedTargetId;
if (arg is "off" or "clear" or "release" or "0")
{
cm.ClearForcedTarget();
- ChatLine(current == 0 ? "[RynthAi] Target lock: none set." : "[RynthAi] Target lock released.");
+ ReplyOk(current == 0 ? "[RynthAi] Target lock: none set." : "[RynthAi] Target lock released.");
return;
}
@@ -146,13 +148,13 @@ public sealed partial class RynthAiPlugin
if (id != 0 && id == current)
{
cm.ClearForcedTarget();
- ChatLine($"[RynthAi] Target lock on {_objectCache?[id]?.Name ?? $"0x{selected:X8}"} released.");
+ ReplyOk($"[RynthAi] Target lock on {_objectCache?[id]?.Name ?? $"0x{selected:X8}"} released.");
return;
}
string? refusal = cm.ForcedTargetRefusal(id);
if (refusal != null)
{
- ChatLine($"[RynthAi] Target lock: {refusal}.");
+ ReplyFail($"[RynthAi] Target lock: {refusal}.");
return;
}
cm.SetForcedTarget(id);
@@ -160,7 +162,7 @@ public sealed partial class RynthAiPlugin
string name = _objectCache?[id]?.Name ?? $"0x{selected:X8}";
string note = s == null ? "" : !s.IsMacroRunning ? " (the macro is off: it attacks once started)"
: !s.EnableCombat ? " (Combat is off: it attacks once Combat is on)" : "";
- ChatLine($"[RynthAi] Target lock: attacking {name}{note}.");
+ ReplyOk($"[RynthAi] Target lock: attacking {name}{note}.");
}
// ── Melee attack height ──────────────────────────────────────────────────
@@ -168,10 +170,10 @@ public sealed partial class RynthAiPlugin
private void SetMeleeAttackHeight(int height)
{
var dash = _dashboard;
- if (dash?.Settings == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (dash?.Settings == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
dash.Settings.MeleeAttackHeight = Math.Clamp(height, 0, 2);
dash.SaveSettings();
- ChatLine($"[RynthAi] Melee attack height: {MeleeHeightNames[dash.Settings.MeleeAttackHeight]}.");
+ ReplyOk($"[RynthAi] Melee attack height: {MeleeHeightNames[dash.Settings.MeleeAttackHeight]}.");
}
// ── Boost Nav / Loot Priority ─────────────────────────────────────────────
@@ -196,12 +198,12 @@ public sealed partial class RynthAiPlugin
{
var dash = _dashboard;
var s = dash?.Settings;
- if (s == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (s == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
string arg = parts.Length >= 3 ? parts[2].ToLowerInvariant() : "";
(s.BoostNavPriority, s.BoostLootPriority) = NextPriority(s.BoostNavPriority, s.BoostLootPriority, nav, loot, arg);
dash!.SaveSettings();
string On(bool b) => b ? "on" : "off";
- ChatLine(nav && loot ? $"[RynthAi] Boost Nav Priority {On(s.BoostNavPriority)}, Boost Loot Priority {On(s.BoostLootPriority)}."
+ ReplyOk(nav && loot ? $"[RynthAi] Boost Nav Priority {On(s.BoostNavPriority)}, Boost Loot Priority {On(s.BoostLootPriority)}."
: nav ? $"[RynthAi] Boost Nav Priority {On(s.BoostNavPriority)}."
: $"[RynthAi] Boost Loot Priority {On(s.BoostLootPriority)}.");
}
@@ -210,16 +212,18 @@ public sealed partial class RynthAiPlugin
private void HandleRechargeCommand()
{
- if (_buffManager == null) { ChatLine("[RynthAi] Buff manager not ready (log in first)."); return; }
+ if (_buffManager == null) { ReplyFail("[RynthAi] Buff manager not ready (log in first)."); return; }
_buffManager.RequestRecharge(); // runs on the pump's next heartbeat, says what it did
+ Reply.Answered();
}
// ── One-touch heal / stamina / mana ───────────────────────────────────────
private void HandleOneTouchCommand(OneTouchVital vital)
{
- if (_buffManager == null) { ChatLine("[RynthAi] Buff manager not ready (log in first)."); return; }
+ if (_buffManager == null) { ReplyFail("[RynthAi] Buff manager not ready (log in first)."); return; }
_buffManager.RequestOneTouch(vital); // runs on the pump's next heartbeat, says what it did
+ Reply.Answered();
}
// ── LootThisCont ──────────────────────────────────────────────────────────
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.VTankYield.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.VTankYield.cs
index ca09d86..9af6308 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.VTankYield.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.VTankYield.cs
@@ -25,7 +25,7 @@ public sealed partial class RynthAiPlugin
if (dash == null)
return false;
_vtankYield.Poll(Host);
- if (!_vtankYield.RefuseStart(dash.Settings, ChatLine))
+ if (!_vtankYield.RefuseStart(dash.Settings, ReplyFail)) // a refusal: said even to a meta (once a minute)
return false;
Host.Log("[RynthAi] VTank yield: macro start refused (VTank's macro runs).");
return true;
@@ -71,16 +71,18 @@ public sealed partial class RynthAiPlugin
private void HandleVTankYieldCommand(string[] parts)
{
var dash = _dashboard;
- if (dash == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (dash == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
if (parts.Length >= 3)
{
string v = parts[2].ToLowerInvariant();
if (v is "on" or "1" or "true") dash.Settings.YieldToVTank = true;
else if (v is "off" or "0" or "false") dash.Settings.YieldToVTank = false;
- else { ChatLine("[RynthAi] Usage: /ra vtankyield [on|off]"); return; }
+ else { ReplyFail("[RynthAi] Usage: /ra vtankyield [on|off]"); return; }
dash.SaveSettings();
}
_vtankYield.Poll(Host);
- ChatLine(_vtankYield.Describe(dash.Settings.YieldToVTank, Host.HasGetVTankState));
+ string line = _vtankYield.Describe(dash.Settings.YieldToVTank, Host.HasGetVTankState);
+ if (parts.Length >= 3) ReplyOk(line); // set: what it is now
+ else ChatLine(line); // the status asked for
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs
index aca0908..da18798 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs
@@ -566,7 +566,8 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
EnsureSpellsUi();
_navigationEngine = new NavigationEngine(Host, _dashboard.Settings)
{
- ChatSubmit = HandleRynthChatSubmit,
+ // A route's chat waypoint answers as a script's line: quiet when it works (CommandReply.cs).
+ ChatSubmit = line => Reply.AsScript(() => { HandleRynthChatSubmit(line); return true; }),
// Jump waypoints go through the UB-style jumper (turn, charge, jump, then
// it hands navigation back). Forward jump; shift = walking jump.
Jump = (heading, shift, ms) => _jumper?.Start(shift ? "ws" : "w", heading, ms),
@@ -789,6 +790,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
_metaManager.SetPlayerId(_playerId);
_metaManager.SetMtCommandHandler(HandleMetaChatCommand);
_metaManager.SetRaCommandHandler(HandleRaCommand);
+ _metaManager.Reply = Reply; // /vt lines answer by the same rule as every command (CommandReply.cs)
if (_objectCache != null) _metaManager.SetObjectCache(_objectCache);
_metaManager.SetFellowshipTracker(_fellowshipTracker);
_metaManager.SetQuestTracker(_questTracker);
@@ -832,13 +834,15 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
_scrollLearner = CreateScrollLearner(_dashboard.Settings);
- _jumper = new Jumper(Host, _dashboard.Settings, s => Host.WriteToChat(s, 1));
+ // The jumper's own lines are refusals (busy, a bad heading or hold time, no jump hook).
+ _jumper = new Jumper(Host, _dashboard.Settings, ReplyFail);
if (_objectCache != null)
{
var dashForAv = _dashboard;
_autoVendor = new AutoVendorManager(Host, _dashboard.Settings, _objectCache, _playerId,
() => dashForAv?.CharFolder ?? string.Empty);
+ _autoVendor.Reply = Reply; // its /ub vendor answers follow the command rule (CommandReply.cs)
var avForUi = _autoVendor;
_dashboard.SetAutoVendorStatusProvider(() => avForUi.Status);
_dashboard.SetVendorProfilePathProvider(() => avForUi.OpenVendorProfilePath);
@@ -3423,13 +3427,19 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
}
NoteChatBarLineForMetaSchedule(trimmed);
+ // Every command answers (CommandReply.cs): a typed line in one chat line, a meta's quietly
+ // when it works. Unknown verbs and wrong argument counts answer with the usage.
+
// Mag-Tools /mt command compatibility
if (trimmed.StartsWith("/mt ", StringComparison.OrdinalIgnoreCase)
|| trimmed.Equals("/mt", StringComparison.OrdinalIgnoreCase))
{
eat = 1;
- if (!HandleMtCommand(trimmed))
- ChatLine($"[RynthAi] Unrecognized /mt command. Try /mt opt list");
+ Reply.Run(trimmed, () =>
+ {
+ if (!HandleMtCommand(trimmed))
+ ReplyFail(MtUsageFor(trimmed));
+ });
return;
}
@@ -3437,8 +3447,11 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
if (trimmed.StartsWith("/ub ", StringComparison.OrdinalIgnoreCase))
{
eat = 1;
- if (!HandleUbCommand(trimmed))
- ChatLine("[RynthAi] Unrecognized /ub command.");
+ Reply.Run(trimmed, () =>
+ {
+ if (!HandleUbCommand(trimmed))
+ ReplyFail(UbUsageFor(trimmed));
+ });
return;
}
@@ -3450,8 +3463,11 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
|| trimmed.Equals("/vt", StringComparison.OrdinalIgnoreCase))
{
eat = 1;
- if (!(_metaManager?.TryHandleVtCommand(trimmed) ?? false))
- ChatLine("[RynthAi] Unrecognized /vt command.");
+ Reply.Run(trimmed, () =>
+ {
+ if (_metaManager == null) ReplyFail("[RynthAi] /vt commands aren't ready yet (log in first).");
+ else if (!_metaManager.TryHandleVtCommand(trimmed)) ReplyFail(MetaManager.VtUsageFor(trimmed));
+ });
return;
}
@@ -3464,13 +3480,15 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
if (parts.Length < 2 || parts[1].Equals("help", StringComparison.OrdinalIgnoreCase))
{
eat = 1;
- HandleHelpCommand();
+ Reply.Run(trimmed, HandleHelpCommand);
return;
}
string cmd = parts[1].ToLower();
eat = 1;
- DispatchRaCommand(cmd, parts, ref eat);
+ int raEat = 1;
+ Reply.Run(trimmed, () => DispatchRaCommand(cmd, parts, ref raEat));
+ eat = raEat;
}
///
@@ -3513,7 +3531,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
int count = _pendingGives.Count + (redo.HasValue ? 1 : 0);
_pendingGives.Clear();
ResetGiveState();
- ChatLine(count > 0
+ ReplyOk(count > 0
? $"[RynthAi] Give queue cancelled ({count} item(s) remaining)."
: "[RynthAi] Give queue is already empty.");
}
@@ -3902,7 +3920,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
case "cache": HandleCacheCommand(); break;
case "cache2": HandleCache2Command(); break;
case "buffs":
- if (_buffManager == null) { ChatLine("[RynthAi] BuffManager not ready (not logged in yet)."); break; }
+ if (_buffManager == null) { ReplyFail("[RynthAi] BuffManager not ready (not logged in yet)."); break; }
if (parts.Length >= 3 && parts[2].Equals("item", StringComparison.OrdinalIgnoreCase))
_buffManager.PrintItemBuffDebug();
else if (parts.Length >= 3 && parts[2].Equals("tiers", StringComparison.OrdinalIgnoreCase))
@@ -3934,8 +3952,9 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
case "pets":
// The Mini Remote's verbs; "/ra guardian", "/ra bounty" and the like are the server
// plugin's (default below), as is any "/ra hub ..." verb RynthAi doesn't have.
- if (_miniRemote == null) { ChatLine("[RynthAi] The Mini Remote isn't ready (log in first)."); break; }
+ if (_miniRemote == null) { ReplyFail("[RynthAi] The Mini Remote isn't ready (log in first)."); break; }
_miniRemote.HandleCommand(cmd, parts.Length > 2 ? parts[2..] : Array.Empty());
+ Reply.Answered(); // the Mini Remote (or the server plugin it hands the verb to) says what it did
break;
case "itemhud" when parts.Length > 2 && parts[2].Equals("add", StringComparison.OrdinalIgnoreCase):
HandleItemHudAdd(string.Join(" ", parts, 3, parts.Length - 3));
@@ -3959,7 +3978,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
case "lua": ForwardLuaCommand(parts); break;
case "items":
if (parts.Length >= 3 && parts[2].Equals("fill", StringComparison.OrdinalIgnoreCase))
- ChatLine(_dashboard?.FillItemsFromPack(_objectCache, _playerId) ?? "[RynthAi] Settings not ready.");
+ ReplyResult(_dashboard?.FillItemsFromPack(_objectCache, _playerId) ?? "[RynthAi] Settings not ready.");
else if (parts.Length >= 3 && parts[2].Equals("clean", StringComparison.OrdinalIgnoreCase))
CleanMissingItems();
else
@@ -3970,8 +3989,8 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
break;
case "follow": HandleFollowCommand(parts); break;
case "myquests":
- case "refreshquests": _questTracker?.Refresh(); ChatLine("[RynthAi] Quest flag refresh requested."); break;
- case "metamgr": QueueMetaMgrCommand(parts); break; // Meta Manager: applied on the next tick
+ case "refreshquests": _questTracker?.Refresh(); ReplyOk("[RynthAi] Quest flag refresh requested."); break;
+ case "metamgr": QueueMetaMgrCommand(parts); Reply.Answered(); break; // Meta Manager: applied (and answered) on the next tick
case "dunnav": HandleDungeonNavCommand(parts); break;
case "dunnav-patrol": HandleDungeonNavPatrolCommand(parts); break;
case "hazard": HandleHazardCommand(parts); break;
@@ -4007,21 +4026,22 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
case "cancelforcebuff": HandleCancelForceBuff(); break;
case "buff": HandleBuffCommand(parts); break;
case "swaptest":
- if (_buffManager == null) { ChatLine("[RynthAi] BuffManager not ready (not logged in yet)."); break; }
+ if (_buffManager == null) { ReplyFail("[RynthAi] BuffManager not ready (not logged in yet)."); break; }
_buffManager.RequestSwapTest(parts.Length > 2 ? string.Join(" ", parts, 2, parts.Length - 2) : "");
+ Reply.Answered(); // the swap test says what it does on the next heartbeat
break;
case "bufftest":
- if (_buffManager == null) { ChatLine("[RynthAi] BuffManager not ready (not logged in yet)."); break; }
+ if (_buffManager == null) { ReplyFail("[RynthAi] BuffManager not ready (not logged in yet)."); break; }
_buffManager.EnableCastRegistryDiagnostic = !_buffManager.EnableCastRegistryDiagnostic;
if (_buffManager.EnableCastRegistryDiagnostic)
{
- ChatLine("[RynthAi] BuffTest ON — fires on next item-spell cast.");
- ChatLine("[RynthAi] Cast an Impen/Bane (via macro or manually). Diff logs to RynthCore.log with [BuffTest] tag.");
- ChatLine("[RynthAi] Auto-disables after one cast/diff.");
+ ReplyOk("[RynthAi] BuffTest ON — fires on next item-spell cast.");
+ ReplyOk("[RynthAi] Cast an Impen/Bane (via macro or manually). Diff logs to RynthCore.log with [BuffTest] tag.");
+ ReplyOk("[RynthAi] Auto-disables after one cast/diff.");
}
else
{
- ChatLine("[RynthAi] BuffTest OFF.");
+ ReplyOk("[RynthAi] BuffTest OFF.");
}
break;
case "settings": HandleSettingsCommand(parts); break;
@@ -4032,7 +4052,10 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
case "busyinfo": HandleBusyInfoCommand(); break;
// /ra quit | /ra exit: close the client (the engine's /rc quit: as its close button)
case "quit":
- case "exit": if (Host.HasInvokeChatParser) Host.InvokeChatParser("/rc quit"); break;
+ case "exit":
+ if (Host.HasInvokeChatParser) { Host.InvokeChatParser("/rc quit"); Reply.Answered(); } // the client closes
+ else ReplyFail("[RynthAi] Can't close the client: the chat parser isn't available.");
+ break;
// give variants — first-match (with optional count prefix)
case "give": HandleGiveCommand(parts, GiveItemMatch.Exact, partialPlayer: false); break;
case "givep": HandleGiveCommand(parts, GiveItemMatch.Partial, partialPlayer: false); break;
@@ -4086,8 +4109,9 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
}
// A verb RynthAi doesn't have may be the server plugin's ("/ra t11", "/ra guardian", "/ra bounty"
// are RynthILT's on Infinite Leaftide); without one it goes on to the server, as any unknown "/ra".
- if (TryForwardToServerPlugin(parts)) break;
+ if (TryForwardToServerPlugin(parts)) { Reply.Answered(); break; } // the server plugin answers
eat = 0;
+ ReplyFail($"[RynthAi] Unknown command: /ra {cmd}. /ra help lists RynthAi's.");
break;
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiSelfRatings.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiSelfRatings.cs
index 7039806..d322567 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiSelfRatings.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiSelfRatings.cs
@@ -62,6 +62,7 @@ public sealed partial class RynthAiPlugin
return;
}
Host.RequestId(me);
+ Reply.Answered(); // the ratings follow when the ID data arrives
_selfRatingsRequestedAt = now;
ItemInfoLog($"self 0x{me:X8}: identify requested for the ratings");
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/ScriptInterface.cs b/Plugins/RynthCore.Plugin.RynthAi/ScriptInterface.cs
index 83eebcc..d41bfc9 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/ScriptInterface.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/ScriptInterface.cs
@@ -271,5 +271,7 @@ public sealed partial class RynthAiPlugin
return !_raycast.IsTargetBlocked(Host, id, TargetingFSM.AttackType.Linear);
}
- internal void ScriptSubmitCommand(string text) => HandleRynthChatSubmit(text);
+ /// A RynthLua script's ai.Command(text): handled as a typed line, but it answers as a script's
+ /// (quiet when it works, errors in chat; CommandReply.cs).
+ internal void ScriptSubmitCommand(string text) => Reply.AsScript(() => { HandleRynthChatSubmit(text); return true; });
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/Trade/AutoTradeCommands.cs b/Plugins/RynthCore.Plugin.RynthAi/Trade/AutoTradeCommands.cs
index a590ef5..0566129 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Trade/AutoTradeCommands.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Trade/AutoTradeCommands.cs
@@ -36,9 +36,10 @@ public sealed partial class RynthAiPlugin
var at = _autoTrade;
if (at == null)
{
- ChatLine("[RynthAi] AutoTrade isn't ready yet (log in first).");
+ ReplyFail("[RynthAi] AutoTrade isn't ready yet (log in first).");
return;
}
+ Reply.Answered(); // AutoTrade says what it did when it runs the command on the tick
at.Enqueue(() => at.Command(args));
}
@@ -47,7 +48,7 @@ public sealed partial class RynthAiPlugin
{
if (!Host.HasTrade)
{
- ChatLine($"[RynthAi] Player trading needs RynthCore 2026.9.x or newer (plugin API v{AutoTradeManager.RequiredApiVersion}; this engine is v{Host.Version}).");
+ ReplyFail($"[RynthAi] Player trading needs RynthCore 2026.9.x or newer (plugin API v{AutoTradeManager.RequiredApiVersion}; this engine is v{Host.Version}).");
return;
}
@@ -62,27 +63,27 @@ public sealed partial class RynthAiPlugin
case "open":
{
uint target = ResolveTradeTarget(arg);
- if (target == 0) { ChatLine("[RynthAi] Usage: /ra trade open "); break; }
- ChatLine(Host.TradeOpen(target)
- ? $"[RynthAi] Asked {TradeName(target)} to trade."
- : "[RynthAi] Could not send the trade request.");
+ if (target == 0) { ReplyFail("[RynthAi] Usage: /ra trade open "); break; }
+ ReplyIf(Host.TradeOpen(target),
+ $"[RynthAi] Asked {TradeName(target)} to trade.",
+ "[RynthAi] Could not send the trade request.");
break;
}
case "add":
{
uint item = ParseTradeId(arg);
- if (item == 0) { ChatLine("[RynthAi] Usage: /ra trade add - "); break; }
- ChatLine(Host.TradeAdd(item)
- ? $"[RynthAi] Adding {TradeName(item)} to the trade window."
- : "[RynthAi] Could not send the add.");
+ if (item == 0) { ReplyFail("[RynthAi] Usage: /ra trade add
- "); break; }
+ ReplyIf(Host.TradeAdd(item),
+ $"[RynthAi] Adding {TradeName(item)} to the trade window.",
+ "[RynthAi] Could not send the add.");
break;
}
- case "accept": ChatLine(Host.TradeAccept() ? "[RynthAi] Accepting the trade." : "[RynthAi] Could not send the accept."); break;
- case "decline": ChatLine(Host.TradeDecline() ? "[RynthAi] Declining the trade." : "[RynthAi] Could not send the decline."); break;
- case "reset": ChatLine(Host.TradeReset() ? "[RynthAi] Clearing the trade window." : "[RynthAi] Could not send the reset."); break;
- case "close": ChatLine(Host.TradeClose() ? "[RynthAi] Closing the trade." : "[RynthAi] Could not send the close."); break;
+ case "accept": ReplyIf(Host.TradeAccept(), "[RynthAi] Accepting the trade.", "[RynthAi] Could not send the accept."); break;
+ case "decline": ReplyIf(Host.TradeDecline(), "[RynthAi] Declining the trade.", "[RynthAi] Could not send the decline."); break;
+ case "reset": ReplyIf(Host.TradeReset(), "[RynthAi] Clearing the trade window.", "[RynthAi] Could not send the reset."); break;
+ case "close": ReplyIf(Host.TradeClose(), "[RynthAi] Closing the trade.", "[RynthAi] Could not send the close."); break;
default:
- ChatLine("[RynthAi] Usage: /ra trade [state | open
| add | accept | decline | reset | close]");
+ ReplyFail("[RynthAi] Usage: /ra trade [state | open | add | accept | decline | reset | close]");
break;
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltCommands.cs b/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltCommands.cs
index 39d8de6..40c7718 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltCommands.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltCommands.cs
@@ -57,10 +57,10 @@ public sealed partial class RynthAiPlugin
private void UseClosestPortal()
{
- if (_objectCache == null || _playerId == 0) { ChatLine("[RynthAi] Not logged in."); return; }
+ if (_objectCache == null || _playerId == 0) { ReplyFail("[RynthAi] Not logged in."); return; }
var best = FindNearestPositioned(IsPortalObject, out double bestD);
- if (best == null) { ChatLine("[RynthAi] No portal nearby."); LogPortalMiss("closestportal"); return; }
- ChatLine($"[RynthAi] Using {best.Name} ({bestD:F1} m).");
+ if (best == null) { ReplyFail("[RynthAi] No portal nearby."); LogPortalMiss("closestportal"); return; }
+ ReplyOk($"[RynthAi] Using {best.Name} ({bestD:F1} m).");
Host.UseFor(unchecked((uint)best.Id), "Command", "/ub closestportal", UseKind.Asked);
}
@@ -72,8 +72,32 @@ public sealed partial class RynthAiPlugin
{
string rest = fullCommand.Length > 3 ? fullCommand.Substring(3).Trim() : "";
if (Host.HasSendPluginCommand && Host.SendPluginCommand("RynthNet", "ub", rest))
+ {
+ Reply.Answered(); // RynthNet answers its own verbs
return;
- ChatLine("[RynthAi] /ub bc, /ub bct and /ub netclients need the RynthNet plugin (the launcher's Plugins tab).");
+ }
+ ReplyFail("[RynthAi] /ub bc, /ub bct and /ub netclients need the RynthNet plugin (the launcher's Plugins tab).");
+ }
+
+ ///
+ /// The usage line for a /ub line RynthAi didn't take: the verb's usage when it is one RynthAi has
+ /// (the wrong arguments), else "unknown" and where the list is.
+ ///
+ private static string UbUsageFor(string line)
+ {
+ string[] w = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);
+ string verb = w.Length > 1 ? w[1].ToLowerInvariant() : "";
+ string? usage = MtVerbUsage(verb, "/ub") ?? verb switch
+ {
+ "follow" or "followp" => "/ub follow[p] ",
+ "ig" or "igp" => $"/ub {verb} to ",
+ "mexec" => "/ub mexec ",
+ "propertydump" => "/ub propertydump [0xId]",
+ _ => null,
+ };
+ return usage != null
+ ? "[RynthAi] Usage: " + usage
+ : $"[RynthAi] Unknown /ub command{(verb.Length > 0 ? $" '{verb}'" : "")}. /ub help lists the ones RynthAi takes.";
}
///
@@ -88,7 +112,10 @@ public sealed partial class RynthAiPlugin
// ub-Rythai's verbs: that plugin answers; handled here only in the sense of "not unknown".
if (IsUbRythaiCommand(cmd, SplitUbLine(fullCommand).Args))
+ {
+ Reply.Answered();
return true;
+ }
// "/ub vtsetmetastate[State]" and the like: an expression, not a verb.
if (TryHandleUbExpression(fullCommand))
diff --git a/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltCompatCommands.cs b/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltCompatCommands.cs
index 0ec1be9..c7274ff 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltCompatCommands.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltCompatCommands.cs
@@ -148,9 +148,12 @@ public sealed partial class RynthAiPlugin
return true;
// ── RynthCore's window placement ────────────────────────────────────
+ // The engine has no chat command for it ("/rc window save" never existed and went nowhere):
+ // its Settings > Display saves the game window for each character and puts it back at login.
case "window":
- if (sub == "save") InvokeServerCommand("/rc window save");
- else UbNoEquivalent(cmd + " " + sub, "RynthCore restores the saved window at login (/rc window save|reset)");
+ UbNoEquivalent(cmd + (sub.Length > 0 ? " " + sub : ""), null,
+ $"[RynthAi] /ub window{(sub.Length > 0 ? " " + sub : "")}: RynthCore keeps the game window itself - Settings > Display, "
+ + "'Remember Game Window Position' (saved for each character, put back after login), or 'Save Layout Now' there.");
return true;
// ── RynthAi's Mini Remote ───────────────────────────────────────────
@@ -189,7 +192,7 @@ public sealed partial class RynthAiPlugin
private void UbClose(string kind)
{
uint open = Host.HasGetGroundContainerId ? Host.GetGroundContainerId() : 0;
- if (open == 0) { ChatLine("[RynthAi] No container is currently open."); return; }
+ if (open == 0) { ReplyFail("[RynthAi] No container is currently open."); return; }
WorldObject? wo = _objectCache?[unchecked((int)open)];
bool fits = kind switch
{
@@ -197,9 +200,17 @@ public sealed partial class RynthAiPlugin
"chest" => wo == null || wo.ObjectClass == AcObjectClass.Container,
_ => true,
};
- if (!fits) return; // as ub-IT: the open container isn't that kind, nothing to do
+ string name = wo?.Name is { Length: > 0 } n ? n : $"0x{open:X8}";
+ if (!fits)
+ {
+ // As ub-IT: the open container isn't that kind, so there is nothing to do.
+ ReplyOk($"[RynthAi] /ub close {kind}: the open container ({name}) isn't a {kind}; left it open.");
+ return;
+ }
bool closed = Host.HasCloseContainer ? Host.CloseContainer(open) : Host.UseFor(open, "Command", "/ub close", UseKind.Asked);
Log($"[RynthAi] /ub close {kind}: 0x{open:X8} {(closed ? "closed" : "close refused")}.");
+ if (closed) ReplyOk($"[RynthAi] Closed {name}.");
+ else ReplyFail($"[RynthAi] Couldn't close {name} (the engine refused it).");
}
///
@@ -214,39 +225,45 @@ public sealed partial class RynthAiPlugin
int space = rest.IndexOf(' ');
if (bracket <= 0 || (space >= 0 && space < bracket) || !rest.EndsWith("]", StringComparison.Ordinal)) return false;
string result = EvalExpr(rest);
- Log($"[RynthAi] /ub {rest} evaluated as an expression -> '{result}'.");
+ // A meta's (the usual sender): the log line only. Typed: the same line in chat.
+ ReplyOk($"[RynthAi] /ub {rest} evaluated as an expression -> '{result}'.");
return true;
}
- /// Says once per session that a /ub verb is accepted and ignored; every use is logged.
- private void UbNoEquivalent(string what, string? note)
+ ///
+ /// A /ub verb accepted and ignored: said every time it is typed, and once per session when a meta
+ /// sends it (so a meta that repeats it doesn't flood chat); every use is logged.
+ ///
+ private void UbNoEquivalent(string what, string? note, string? text = null)
{
Log($"[RynthAi] /ub {what}: no RynthAi equivalent; ignored.");
- if (_ubNoEquivalentSaid.Add(what))
- ChatLine($"[RynthAi] /ub {what} is a ub-IT feature with no RynthAi equivalent; it is accepted and ignored so metas keep running"
- + (note != null ? $" ({note})." : "."));
+ if (!Reply.FromScript || _ubNoEquivalentSaid.Add(what))
+ ReplyFail(text ?? $"[RynthAi] /ub {what} is a ub-IT feature with no RynthAi equivalent; it is accepted and ignored so metas keep running"
+ + (note != null ? $" ({note})." : "."));
+ else
+ Reply.Answered();
}
- /// Sends a chat line to the chat parser (server commands, /rc).
+ /// Sends a chat line to the chat parser (server commands): the server answers it.
private void InvokeServerCommand(string line)
{
- if (Host.HasInvokeChatParser) Host.InvokeChatParser(line);
- else ChatLine($"[RynthAi] Can't send {line}: the chat parser isn't available.");
+ if (Host.HasInvokeChatParser) { Host.InvokeChatParser(line); Reply.Answered(); }
+ else ReplyFail($"[RynthAi] Can't send {line}: the chat parser isn't available.");
}
- /// A command for another plugin through the engine broker.
+ /// A command for another plugin through the engine broker: that plugin answers it.
private void SendToPlugin(string plugin, string action, string value, string missing)
{
- if (!(Host.HasSendPluginCommand && Host.SendPluginCommand(plugin, action, value)))
- ChatLine("[RynthAi] " + missing);
+ if (Host.HasSendPluginCommand && Host.SendPluginCommand(plugin, action, value)) Reply.Answered();
+ else ReplyFail("[RynthAi] " + missing);
}
/// /ub wear[p] <name>: wield a carried item by name, skipping copies already worn
/// (using a worn item would take it off).
private void UbWear(string name, bool partial)
{
- if (string.IsNullOrWhiteSpace(name)) { ChatLine("[RynthAi] Usage: /ub wear - (wearp: partial name)"); return; }
- if (_objectCache == null || !Host.HasUseObject) { ChatLine("[RynthAi] /ub wear: not ready (log in first)."); return; }
+ if (string.IsNullOrWhiteSpace(name)) { ReplyFail("[RynthAi] Usage: /ub wear
- (wearp: partial name)"); return; }
+ if (_objectCache == null || !Host.HasUseObject) { ReplyFail("[RynthAi] /ub wear: not ready (log in first)."); return; }
bool sawWorn = false;
foreach (var wo in _objectCache.GetInventory())
@@ -258,9 +275,11 @@ public sealed partial class RynthAiPlugin
if (wo.Values(LongValueKey.CurrentWieldedLocation, 0) > 0) { sawWorn = true; continue; }
Host.UseFor(unchecked((uint)wo.Id), "Command", "/ub wear", UseKind.Asked);
Log($"[RynthAi] /ub wear: {wo.Name} (0x{(uint)wo.Id:X8})");
+ ReplyOk($"[RynthAi] Wearing {wo.Name}.");
return;
}
- ChatLine(sawWorn ? $"[RynthAi] Already wearing '{name}'." : $"[RynthAi] Item not found: '{name}'");
+ if (sawWorn) ReplyOk($"[RynthAi] Already wearing '{name}'.");
+ else ReplyFail($"[RynthAi] Item not found: '{name}'");
}
///
/ub globalframelimit|bgframelimit <fps>: RynthAi's frame limit (Settings, Display).
@@ -268,28 +287,28 @@ public sealed partial class RynthAiPlugin
private void UbFrameLimit(bool background, string arg)
{
LegacyUiSettings? s = _dashboard?.Settings;
- if (s == null) { ChatLine("[RynthAi] Settings aren't loaded yet."); return; }
+ if (s == null) { ReplyFail("[RynthAi] Settings aren't loaded yet."); return; }
if (!int.TryParse(arg.Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out int fps) || fps < 0)
{
- ChatLine($"[RynthAi] Usage: /ub {(background ? "bgframelimit" : "globalframelimit")} ");
+ ReplyFail($"[RynthAi] Usage: /ub {(background ? "bgframelimit" : "globalframelimit")} ");
return;
}
if (background)
{
s.TargetFPSBackground = fps == 0 ? 60 : Math.Clamp(fps, 5, 60);
s.EnableFPSLimit = true;
- ChatLine($"[RynthAi] Background frame limit: {s.TargetFPSBackground} fps.");
+ ReplyOk($"[RynthAi] Background frame limit: {s.TargetFPSBackground} fps.");
}
else if (fps == 0)
{
s.EnableFPSLimit = false;
- ChatLine("[RynthAi] Frame limit off.");
+ ReplyOk("[RynthAi] Frame limit off.");
}
else
{
s.TargetFPSFocused = Math.Clamp(fps, 10, 240);
s.EnableFPSLimit = true;
- ChatLine($"[RynthAi] Frame limit: {s.TargetFPSFocused} fps.");
+ ReplyOk($"[RynthAi] Frame limit: {s.TargetFPSFocused} fps.");
}
try { _dashboard?.SaveSettings(); } catch { }
}
@@ -298,7 +317,7 @@ public sealed partial class RynthAiPlugin
private void UbFellow(string sub, string name)
{
if (sub == "status") { HandleFellowshipCommand(new[] { "/ra", "fellow", "status" }); return; }
- if (name.Length == 0) { ChatLine($"[RynthAi] Usage: /ub fellow {sub} "); return; }
+ if (name.Length == 0) { ReplyFail($"[RynthAi] Usage: /ub fellow {sub} "); return; }
bool partial = sub.EndsWith('p');
string resolved = name;
@@ -324,7 +343,7 @@ public sealed partial class RynthAiPlugin
|| !double.TryParse(w[0], NumberStyles.Float, CultureInfo.InvariantCulture, out double ns)
|| !double.TryParse(w[1], NumberStyles.Float, CultureInfo.InvariantCulture, out double ew))
{
- ChatLine("[RynthAi] Usage: /ub navgoto [walk|run] (south and west are negative)");
+ ReplyFail("[RynthAi] Usage: /ub navgoto [walk|run] (south and west are negative)");
return;
}
string coords = FormattableString.Invariant($"{Math.Abs(ns):0.0#}{(ns < 0 ? 'S' : 'N')}, {Math.Abs(ew):0.0#}{(ew < 0 ? 'W' : 'E')}");
@@ -339,7 +358,7 @@ public sealed partial class RynthAiPlugin
private bool UbStormSwitch(string cmd, string sub, string vtOption, string[] w)
{
string rest = w.Length > 1 ? string.Join(" ", w, 1, w.Length - 1) : "";
- if (_metaManager == null) { ChatLine("[RynthAi] Not ready (log in first)."); return true; }
+ if (_metaManager == null) { ReplyFail("[RynthAi] Not ready (log in first)."); return true; }
switch (sub)
{
diff --git a/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltExtraCommands.cs b/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltExtraCommands.cs
index 18df0a6..bb58a5c 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltExtraCommands.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/UtilityBeltExtraCommands.cs
@@ -55,6 +55,7 @@ public sealed partial class RynthAiPlugin
&& Host.TryGetObjectName(_playerId, out string me) && !string.IsNullOrWhiteSpace(me))
{
Host.InvokeChatParser($"/tell {me}, {msg}");
+ Reply.Answered(); // the tell to yourself is the answer (metas watch for it)
return;
}
ChatLine("[RynthAi] " + msg);
@@ -83,9 +84,9 @@ public sealed partial class RynthAiPlugin
case "playsound": UbPlaySound(args); return true;
case "setmotion": UbSetMotion(args); return true;
case "getmotion": UbGetMotion(); return true;
- case "clearmotion": EvalExpr("clearmotion[]"); ChatLine("[RynthAi] Cleared all motions."); return true;
- case "autostack": _inventoryManager?.RunManual(cram: false, stack: true); ChatLine("[RynthAi] AutoStack: stacking your inventory."); return true;
- case "autocram": _inventoryManager?.RunManual(cram: true, stack: false); ChatLine("[RynthAi] AutoCram: moving items into side packs."); return true;
+ case "clearmotion": EvalExpr("clearmotion[]"); ReplyOk("[RynthAi] Cleared all motions."); return true;
+ case "autostack": _inventoryManager?.RunManual(cram: false, stack: true); ReplyOk("[RynthAi] AutoStack: stacking your inventory."); return true;
+ case "autocram": _inventoryManager?.RunManual(cram: true, stack: false); ReplyOk("[RynthAi] AutoCram: moving items into side packs."); return true;
// /ub opt list|get|set stay on the /mt opt handler (it knows the Mag-Tools
// option aliases); only toggle, which that one lacks, is handled here.
case "opt" when args.StartsWith("toggle", StringComparison.OrdinalIgnoreCase):
@@ -111,12 +112,13 @@ public sealed partial class RynthAiPlugin
int sp = args.IndexOf(' ');
if (sp <= 0 || !int.TryParse(args.AsSpan(0, sp), out int ms) || ms < 0)
{
- ChatLine("[RynthAi] Usage: /ub delay ");
+ ReplyFail("[RynthAi] Usage: /ub delay ");
return;
}
string command = args.Substring(sp + 1).Trim();
- if (command.Length == 0) return;
+ if (command.Length == 0) { ReplyFail("[RynthAi] Usage: /ub delay "); return; }
_delayedCommands.Add((Environment.TickCount64 + ms, command, MetaCommandActive));
+ ReplyOk($"[RynthAi] In {ms} ms: {command}");
}
// /ub count {item | profile | player } [debug] [think]
@@ -125,7 +127,7 @@ public sealed partial class RynthAiPlugin
var words = args.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList();
bool think = words.RemoveAll(w => w.Equals("think", StringComparison.OrdinalIgnoreCase)) > 0;
words.RemoveAll(w => w.Equals("debug", StringComparison.OrdinalIgnoreCase));
- if (words.Count < 2) { ChatLine("[RynthAi] Usage: /ub count {item | profile | player } [think]"); return; }
+ if (words.Count < 2) { ReplyFail("[RynthAi] Usage: /ub count {item | profile | player } [think]"); return; }
string kind = words[0].ToLowerInvariant();
string what = string.Join(" ", words.Skip(1));
var inv = _objectCache?.GetDirectInventory(forceRefresh: true) ?? (IReadOnlyList)Array.Empty();
@@ -144,7 +146,7 @@ public sealed partial class RynthAiPlugin
case "profile":
{
string path = ResolveLootProfilePath(what);
- if (path.Length == 0 || !TryLoadLootProfile(path, out VTankLootProfile profile, out _)) { ChatLine($"[RynthAi] count: loot profile not found: {what}"); return; }
+ if (path.Length == 0 || !TryLoadLootProfile(path, out VTankLootProfile profile, out _)) { ReplyFail($"[RynthAi] count: loot profile not found: {what}"); return; }
var ctx = new VTankLootContext(Host, _playerId) { Cache = _objectCache };
int n = 0;
foreach (var wo in inv)
@@ -158,7 +160,7 @@ public sealed partial class RynthAiPlugin
}
case "player":
{
- if (!double.TryParse(what, NumberStyles.Float, CultureInfo.InvariantCulture, out double range)) { ChatLine("[RynthAi] count player "); return; }
+ if (!double.TryParse(what, NumberStyles.Float, CultureInfo.InvariantCulture, out double range)) { ReplyFail("[RynthAi] Usage: /ub count player "); return; }
int n = 0;
int me = unchecked((int)_playerId);
if (_objectCache != null)
@@ -168,7 +170,7 @@ public sealed partial class RynthAiPlugin
break;
}
default:
- ChatLine("[RynthAi] Usage: /ub count {item | profile | player } [think]");
+ ReplyFail("[RynthAi] Usage: /ub count {item | profile | player } [think]");
break;
}
}
@@ -192,14 +194,14 @@ public sealed partial class RynthAiPlugin
DateTime t = utc ? DateTime.UtcNow : RynthClock.Now;
string s;
try { s = format.Length > 0 ? t.ToString(format, CultureInfo.InvariantCulture) : t.ToString(CultureInfo.InvariantCulture); }
- catch (FormatException) { ChatLine($"[RynthAi] Bad date format: {format}"); return; }
+ catch (FormatException) { ReplyFail($"[RynthAi] Bad date format: {format}"); return; }
ChatLine("[RynthAi] " + s);
}
private void UbId()
{
uint sel = Host.GetSelectedItemId();
- if (sel == 0) { ChatLine("[RynthAi] Nothing selected."); return; }
+ if (sel == 0) { ReplyFail("[RynthAi] Nothing selected."); return; }
string name = Host.TryGetObjectName(sel, out string n) ? n : "?";
ChatLine($"[RynthAi] {name}: id 0x{sel:X8} ({sel})");
}
@@ -210,7 +212,7 @@ public sealed partial class RynthAiPlugin
if (sel == 0) sel = _playerId;
if (sel == 0 || !Host.TryGetObjectPosition(sel, out uint cell, out float x, out float y, out float z))
{
- ChatLine("[RynthAi] No position for the selected object.");
+ ReplyFail("[RynthAi] No position for the selected object.");
return;
}
string name = Host.TryGetObjectName(sel, out string n) ? n : "?";
@@ -222,14 +224,14 @@ public sealed partial class RynthAiPlugin
// /ub portal[p] : use the nearest portal (or NPC) by name; portalp = partial.
private void UbPortal(string name, bool partial)
{
- if (name.Length == 0 || _objectCache == null || _playerId == 0) { ChatLine("[RynthAi] Usage: /ub portal[p] "); return; }
+ if (name.Length == 0 || _objectCache == null || _playerId == 0) { ReplyFail("[RynthAi] Usage: /ub portal[p] "); return; }
var best = FindNearestPositioned(wo =>
(partial ? wo.Name.IndexOf(name, StringComparison.OrdinalIgnoreCase) >= 0
: wo.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
&& (IsPortalObject(wo) || wo.ObjectClass == AcObjectClass.Npc), out double bestD);
- if (best == null) { ChatLine($"[RynthAi] No portal named {(partial ? "like " : "")}'{name}' nearby."); LogPortalMiss("portal " + name); return; }
+ if (best == null) { ReplyFail($"[RynthAi] No portal named {(partial ? "like " : "")}'{name}' nearby."); LogPortalMiss("portal " + name); return; }
_navigationEngine?.Stop();
- ChatLine($"[RynthAi] Using {best.Name} ({bestD:F1} m).");
+ ReplyOk($"[RynthAi] Using {best.Name} ({bestD:F1} m).");
Host.UseFor(unchecked((uint)best.Id), "Command", "/ub portal", UseKind.Asked);
}
@@ -244,9 +246,13 @@ public sealed partial class RynthAiPlugin
if (sp > 0 && int.TryParse(args.AsSpan(0, sp), out _)) file = args.Substring(sp + 1).Trim();
file = file.Trim('"');
if (!Path.IsPathRooted(file)) file = Path.Combine(RynthCore.Install.RynthInstallPaths.RynthAiDir, file);
- if (!File.Exists(file)) { ChatLine($"[RynthAi] Sound file not found: {file}"); return; }
- try { PlaySound(file, IntPtr.Zero, 0x00020000 /*SND_FILENAME*/ | 0x0001 /*SND_ASYNC*/); }
- catch (Exception ex) { ChatLine($"[RynthAi] playsound failed: {ex.Message}"); }
+ if (!File.Exists(file)) { ReplyFail($"[RynthAi] Sound file not found: {file}"); return; }
+ try
+ {
+ if (PlaySound(file, IntPtr.Zero, 0x00020000 /*SND_FILENAME*/ | 0x0001 /*SND_ASYNC*/)) ReplyOk($"[RynthAi] Playing {Path.GetFileName(file)}.");
+ else ReplyFail($"[RynthAi] playsound: Windows couldn't play {file}.");
+ }
+ catch (Exception ex) { ReplyFail($"[RynthAi] playsound failed: {ex.Message}"); }
}
private static readonly string[] UbMotions = { "Forward", "Backward", "TurnRight", "TurnLeft", "StrafeRight", "StrafeLeft", "Walk" };
@@ -255,8 +261,9 @@ public sealed partial class RynthAiPlugin
private void UbSetMotion(string args)
{
var w = args.Split(' ', StringSplitOptions.RemoveEmptyEntries);
- if (w.Length != 2 || (w[1] != "0" && w[1] != "1")) { ChatLine("[RynthAi] Usage: /ub setmotion <" + string.Join("|", UbMotions) + "> <0|1>"); return; }
+ if (w.Length != 2 || (w[1] != "0" && w[1] != "1")) { ReplyFail("[RynthAi] Usage: /ub setmotion <" + string.Join("|", UbMotions) + "> <0|1>"); return; }
EvalExpr($"setmotion[`{w[0]}`,{w[1]}]");
+ ReplyOk($"[RynthAi] Motion {w[0]}: {(w[1] == "1" ? "on" : "off")}.");
}
private void UbGetMotion()
@@ -269,7 +276,7 @@ public sealed partial class RynthAiPlugin
private void UbOpt(string args)
{
var map = _metaManager?.Expressions.BuildSettingsMapPublic();
- if (map == null) { ChatLine("[RynthAi] Settings not ready."); return; }
+ if (map == null) { ReplyFail("[RynthAi] Settings not ready."); return; }
var w = args.Split(' ', StringSplitOptions.RemoveEmptyEntries);
string verb = w.Length > 0 ? w[0].ToLowerInvariant() : "list";
switch (verb)
@@ -279,7 +286,8 @@ public sealed partial class RynthAiPlugin
ChatLine("[RynthAi] " + string.Join(", ", chunk));
break;
case "get" when w.Length >= 2:
- ChatLine(map.TryGetValue(w[1], out var g) ? $"[RynthAi] {w[1]} = {g.Get()}" : $"[RynthAi] No option '{w[1]}' (/ub opt list).");
+ if (map.TryGetValue(w[1], out var g)) ChatLine($"[RynthAi] {w[1]} = {g.Get()}");
+ else ReplyFail($"[RynthAi] No option '{w[1]}' (/ub opt list).");
break;
case "set" when w.Length >= 3:
if (map.TryGetValue(w[1], out var st))
@@ -288,21 +296,21 @@ public sealed partial class RynthAiPlugin
v = v.Equals("true", StringComparison.OrdinalIgnoreCase) ? "1" : v.Equals("false", StringComparison.OrdinalIgnoreCase) ? "0" : v;
st.Set(v);
_dashboard?.SaveSettings();
- ChatLine($"[RynthAi] {w[1]} = {st.Get()}");
+ ReplyOk($"[RynthAi] {w[1]} = {st.Get()}");
}
- else ChatLine($"[RynthAi] No option '{w[1]}' (/ub opt list).");
+ else ReplyFail($"[RynthAi] No option '{w[1]}' (/ub opt list).");
break;
case "toggle" when w.Length >= 2:
foreach (string name in w.Skip(1))
{
- if (!map.TryGetValue(name, out var tg)) { ChatLine($"[RynthAi] No option '{name}'."); continue; }
+ if (!map.TryGetValue(name, out var tg)) { ReplyFail($"[RynthAi] No option '{name}'."); continue; }
tg.Set(tg.Get() is "0" or "" or "False" ? "1" : "0");
- ChatLine($"[RynthAi] {name} = {tg.Get()}");
+ ReplyOk($"[RynthAi] {name} = {tg.Get()}");
}
_dashboard?.SaveSettings();
break;
default:
- ChatLine("[RynthAi] Usage: /ub opt {list | get | set | toggle }");
+ ReplyFail("[RynthAi] Usage: /ub opt {list | get | set | toggle }");
break;
}
}
@@ -319,12 +327,13 @@ public sealed partial class RynthAiPlugin
private void UbSimpleJump(string args)
{
int ms = int.TryParse(args, out int v) ? Math.Clamp(v, 0, 1000) : 0;
- _jumper?.Start("", null, ms);
+ if (_jumper == null) { ReplyFail("[RynthAi] Jumper not ready (not logged in yet)."); return; }
+ if (_jumper.Start("", null, ms)) ReplyOk(JumpLine("", null, ms)); // a refusal says why itself
}
private void UbDumpSkills()
{
- if (_charSkills == null) { ChatLine("[RynthAi] Skills not ready."); return; }
+ if (_charSkills == null) { ReplyFail("[RynthAi] Skills not ready."); return; }
var lines = new List();
foreach (AcSkillType sk in Enum.GetValues())
{
@@ -341,7 +350,7 @@ public sealed partial class RynthAiPlugin
private void UbQuests(string args)
{
var w = args.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
- if (w.Length < 2 || !w[0].Equals("check", StringComparison.OrdinalIgnoreCase)) { ChatLine("[RynthAi] Usage: /ub quests check "); return; }
+ if (w.Length < 2 || !w[0].Equals("check", StringComparison.OrdinalIgnoreCase)) { ReplyFail("[RynthAi] Usage: /ub quests check "); return; }
string flag = w[1].Trim();
bool has = EvalExpr($"testquestflag[`{flag}`]") == "1";
string status = EvalExpr($"getqueststatus[`{flag}`]");
@@ -356,15 +365,15 @@ public sealed partial class RynthAiPlugin
if (force) w.RemoveAt(w.Count - 1);
if (w.Count != 4 || !TryParseLandblock(w[0], out uint start) || !TryParseLandblock(w[2], out uint end))
{
- ChatLine("[RynthAi] Usage: /ub translateroute [force]");
+ ReplyFail("[RynthAi] Usage: /ub translateroute [force]");
return;
}
string navFolder = System.IO.Path.Combine(RynthCore.Install.RynthInstallPaths.RynthAiDir, "NavProfiles");
string inPath = Path.IsPathRooted(w[1]) ? w[1] : Path.Combine(navFolder, w[1]);
string outPath = Path.IsPathRooted(w[3]) ? w[3] : Path.Combine(navFolder, w[3]);
if (!outPath.EndsWith(".nav", StringComparison.OrdinalIgnoreCase)) outPath += ".nav";
- if (!File.Exists(inPath)) { ChatLine($"[RynthAi] Route not found: {inPath}"); return; }
- if (File.Exists(outPath) && !force) { ChatLine($"[RynthAi] {Path.GetFileName(outPath)} exists; add force to overwrite."); return; }
+ if (!File.Exists(inPath)) { ReplyFail($"[RynthAi] Route not found: {inPath}"); return; }
+ if (File.Exists(outPath) && !force) { ReplyFail($"[RynthAi] {Path.GetFileName(outPath)} exists; add force to overwrite."); return; }
// A landblock is 192 m = 0.8 nav units. Landblock id: 0xXXYY.
double dEW = (((int)(end >> 8) & 0xFF) - ((int)(start >> 8) & 0xFF)) * 0.8;
@@ -376,7 +385,7 @@ public sealed partial class RynthAiPlugin
if (p.Type is NavPointType.PortalNPC or NavPointType.Npc) { p.PortalExitNS += dNS; p.PortalExitEW += dEW; }
}
route.Save(outPath);
- ChatLine($"[RynthAi] Translated {route.Points.Count} points to {Path.GetFileName(outPath)} (NS {dNS:+0.0;-0.0}, EW {dEW:+0.0;-0.0}).");
+ ReplyOk($"[RynthAi] Translated {route.Points.Count} points to {Path.GetFileName(outPath)} (NS {dNS:+0.0;-0.0}, EW {dEW:+0.0;-0.0}).");
}
private static bool TryParseLandblock(string s, out uint lb)
diff --git a/Plugins/RynthCore.Plugin.RynthAi/Vendor/AutoVendorCommands.cs b/Plugins/RynthCore.Plugin.RynthAi/Vendor/AutoVendorCommands.cs
index 0bbc4c7..ac2dd3e 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Vendor/AutoVendorCommands.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Vendor/AutoVendorCommands.cs
@@ -25,15 +25,24 @@ public sealed partial class RynthAiPlugin
var av = _autoVendor;
if (av == null)
{
- ChatLine("[RynthAi] AutoVendor isn't ready yet (log in first).");
+ ReplyFail("[RynthAi] AutoVendor isn't ready yet (log in first).");
return true;
}
string rest = AfterWords(fullCommand, 2); // everything after "/ub "
+ // Run on the tick, they answer there as this line would have (typed: in chat; a meta's: quiet
+ // when it works). Every queued command says what it did, so the line itself is answered.
+ bool fromScript = Reply.FromScript;
+ void Queue(Action command)
+ {
+ Reply.Answered();
+ av.Enqueue(() => Reply.RunQueued(fromScript, command));
+ }
+
if (cmd == "autovendor")
{
- av.Enqueue(() => av.CommandAutoVendor(rest));
+ Queue(() => av.CommandAutoVendor(rest));
return true;
}
@@ -50,24 +59,24 @@ public sealed partial class RynthAiPlugin
switch (action)
{
case "buy":
- case "buyall": av.Enqueue(av.CommandBuyAll); break;
+ case "buyall": Queue(av.CommandBuyAll); break;
case "sell":
- case "sellall": av.Enqueue(av.CommandSellAll); break;
- case "clearbuy": av.Enqueue(av.CommandClearBuy); break;
- case "clearsell": av.Enqueue(av.CommandClearSell); break;
+ case "sellall": Queue(av.CommandSellAll); break;
+ case "clearbuy": Queue(av.CommandClearBuy); break;
+ case "clearsell": Queue(av.CommandClearSell); break;
// UB: "open" with no name picks the nearest vendor, like openp.
- case "open": av.Enqueue(() => av.CommandOpen(args, partial: args.Length == 0)); break;
- case "openp": av.Enqueue(() => av.CommandOpen(args, partial: true)); break;
- case "opencancel": av.Enqueue(av.CommandOpenCancel); break;
+ case "open": Queue(() => av.CommandOpen(args, partial: args.Length == 0)); break;
+ case "openp": Queue(() => av.CommandOpen(args, partial: true)); break;
+ case "opencancel": Queue(av.CommandOpenCancel); break;
case "addbuy":
case "addbuyp":
if (args.Length == 0) { VendorUsage(); break; }
- av.Enqueue(() => av.CommandAddBuy(args, partial: action == "addbuyp"));
+ Queue(() => av.CommandAddBuy(args, partial: action == "addbuyp"));
break;
case "addsell":
case "addsellp":
if (args.Length == 0) { VendorUsage(); break; }
- av.Enqueue(() => av.CommandAddSell(args, partial: action == "addsellp"));
+ Queue(() => av.CommandAddSell(args, partial: action == "addsellp"));
break;
default:
VendorUsage();
@@ -90,5 +99,5 @@ public sealed partial class RynthAiPlugin
}
private void VendorUsage()
- => ChatLine("[RynthAi] Usage: /ub vendor {open[p] | buyall | sellall | clearbuy | clearsell | opencancel | addbuy[p] [count] - | addsell[p] [count]
- }");
+ => ReplyFail("[RynthAi] Usage: /ub vendor {open[p]
| buyall | sellall | clearbuy | clearsell | opencancel | addbuy[p] [count] - | addsell[p] [count]
- }");
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/Vendor/AutoVendorManager.cs b/Plugins/RynthCore.Plugin.RynthAi/Vendor/AutoVendorManager.cs
index 61a85ed..f2d2300 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Vendor/AutoVendorManager.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Vendor/AutoVendorManager.cs
@@ -257,26 +257,34 @@ internal sealed class AutoVendorManager
}
if (!_host.HasVendorTrade) { SayNeedsUpdate(); return; }
Start(0, a, explicitCommand: true);
+ if (_phase != Phase.Idle)
+ Said($"started at {_vendorName} with {Path.GetFileName(_profilePath)}{(_settings.AutoVendorTestMode ? " (TestMode: nothing is bought or sold)" : "")}.");
}
public void CommandBuyAll()
{
if (!_host.HasVendorTrade) { SayNeedsUpdate(); return; }
if (_cart.BuyList.Count == 0) { Tool("buy list is empty"); return; }
+ int entries = _cart.BuyList.Count;
if (_cart.BuyAll(_host, _openVendorId) == 0)
Error($"buy refused: {TradeMessage()}");
+ else
+ Said($"buying the buy list ({entries} entr{(entries == 1 ? "y" : "ies")}).");
}
public void CommandSellAll()
{
if (!_host.HasVendorTrade) { SayNeedsUpdate(); return; }
if (_cart.SellList.Count == 0) { Tool("sell list is empty"); return; }
+ int items = _cart.SellList.Count;
if (_cart.SellAll(_host, _openVendorId) == 0)
Error($"sell refused: {TradeMessage()}");
+ else
+ Said($"selling the sell list ({items} item(s)).");
}
- public void CommandClearBuy() => _cart.ClearBuy();
- public void CommandClearSell() => _cart.ClearSell();
+ public void CommandClearBuy() { _cart.ClearBuy(); Said("buy list cleared."); }
+ public void CommandClearSell() { _cart.ClearSell(); Said("sell list cleared."); }
///
/ub vendor addbuy[p] [count] name
public void CommandAddBuy(string args, bool partial)
@@ -347,14 +355,17 @@ internal sealed class AutoVendorManager
_opening = true;
if (_host.HasSetAutoRun) _host.SetAutoRunBy("Vendor", false);
_host.Log($"[RynthAi] AutoVendor: attempting to open vendor {vendor.Name}");
+ Said($"opening {vendor.Name}.");
}
/// /ub vendor opencancel
public void CommandOpenCancel()
{
+ bool was = _opening;
if (_opening) CancelUse();
_opening = false;
_openHoldUntil = 0;
+ Said(was ? $"stopped opening {_openTargetName}." : "no vendor was being opened.");
}
// ════════════════════════════════════════════════════════════════════════
@@ -1587,6 +1598,16 @@ internal sealed class AutoVendorManager
private void Tool(string msg) => _host.WriteToChat($"[RynthAi] AutoVendor: {msg}", 1);
private void Error(string msg) => _host.WriteToChat($"[RynthAi] AutoVendor: {msg}", 2);
+ /// The plugin's command replies (CommandReply.cs): a /ub vendor command answers by them.
+ internal CommandReply? Reply { get; set; }
+
+ /// A /ub vendor or /ub autovendor command worked: said when typed, only logged when a meta sent it.
+ private void Said(string msg)
+ {
+ if (Reply is { } r) r.Ok($"[RynthAi] AutoVendor: {msg}");
+ else Tool(msg);
+ }
+
/// UB Util.ThinkOrWrite: a /tell to yourself when Think is on (metas watch for it).
private void ThinkOrWrite(string msg)
{
diff --git a/Plugins/RynthCore.Plugin.RynthDefective/Corpses/CorpseBook.cs b/Plugins/RynthCore.Plugin.RynthDefective/Corpses/CorpseBook.cs
new file mode 100644
index 0000000..18a1733
--- /dev/null
+++ b/Plugins/RynthCore.Plugin.RynthDefective/Corpses/CorpseBook.cs
@@ -0,0 +1,326 @@
+// ============================================================================
+// RynthDefective - Corpses/CorpseBook.cs
+// Where a character's corpses are (Tom 2026-10-23: "a small panel somewhere
+// that tells you where all your corpses are"). Pure: the plugin feeds it what
+// it sees (RynthDefectivePlugin.Corpses.cs), tests feed it directly.
+//
+// What tells it:
+// the death health 0: where the player stands is where the corpse lies
+// (ACE puts it at the player's position).
+// the server "Your corpse is located at (12.3N, 45.6E)." (ACE, outdoor deaths
+// that dropped something) confirms it; "You have retained all your
+// items. You do not need to recover your corpse!" means there is
+// nothing to go back for, so that death is dropped. Either line
+// may come before or after the health reaches 0.
+// the corpse an object named "Corpse of " in view: its id and exact
+// place, matched to a death nearby or added as a corpse found.
+// it's gone it left view (the server deletes it from the client) and
+// VanishMeansGone says so: you had opened it (an emptied corpse
+// rots 15 s later), or it was due to rot, or it went from right
+// beside you. Otherwise it only left view (in a dungeon, around a
+// corner: ACE drops what you can't see after about 25 s) and stays.
+// not there you stand where it should be and it isn't (10 s, not in the
+// first 2 minutes after the death, while the corpse appears).
+//
+// How long one lasts (ACE's Corpse.RecalculateDecayTime): a player's corpse rots
+// after the player's level times 5 minutes, at least an hour; an emptied one 15
+// seconds after. Other servers may differ, so the time is an estimate and a
+// corpse is only dropped 10 minutes after it.
+// ============================================================================
+
+using System;
+using System.Collections.Generic;
+
+namespace RynthCore.Plugin.RynthDefective.Corpses;
+
+///