Snapshot for release 2026.10.28.3 (internal 7496938)
This commit is contained in:
parent
c68e251cd6
commit
f9db7bad87
24 changed files with 583 additions and 98 deletions
|
|
@ -119,7 +119,7 @@ public sealed partial class ServerPackPlugin
|
|||
if (parts.Length < 2 || !parts[1].Equals("vault", StringComparison.OrdinalIgnoreCase)) return;
|
||||
handled = true;
|
||||
string tag = $"[{RynthPluginInfo.Name}] ";
|
||||
if (!Active) { ChatLine(tag + "The account vault is Aelrynth's; RynthCore doesn't see this world as Aelrynth."); return; }
|
||||
if (!Active) { ChatFail(tag + "The account vault is Aelrynth's; RynthCore doesn't see this world as Aelrynth."); return; }
|
||||
bool asked;
|
||||
string state;
|
||||
lock (_aelrynth.Gate)
|
||||
|
|
|
|||
|
|
@ -108,6 +108,9 @@ internal sealed class IltAttributeRaiser
|
|||
|
||||
public bool Running => _phase != Phase.Idle;
|
||||
|
||||
/// <summary>What the raiser is doing or why it can't (the Progression tab's status line; "/ra hub attr" says it).</summary>
|
||||
public string Status => _status;
|
||||
|
||||
// ── Order / selection helpers (also used by IltHubStore.Normalize) ─────────
|
||||
|
||||
public static Stat? Find(string keyOrName)
|
||||
|
|
|
|||
|
|
@ -144,13 +144,17 @@ internal sealed class IltBanking : IIltFeature
|
|||
|
||||
// ── Commands ────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Queues a /bank balance refresh (eaten when <paramref name="quiet"/>).</summary>
|
||||
public void RequestRefresh(bool quiet)
|
||||
/// <summary>
|
||||
/// Queues a /bank balance refresh (eaten when <paramref name="quiet"/>). Null when it went out, else
|
||||
/// why not (for "/ra hub bank" to say; the buttons ignore it).
|
||||
/// </summary>
|
||||
public string? RequestRefresh(bool quiet)
|
||||
{
|
||||
RynthLog.Trace(LogCat.IltBanking, $"RequestRefresh(quiet={quiet})");
|
||||
if (_ctx.Capture.IsPending("/bank")) return;
|
||||
if (_ctx.Capture.IsPending("/bank")) return "a /bank read is already waiting for the server's reply.";
|
||||
long now = IltHubContext.NowMs;
|
||||
if (now - _lastBalanceAt < BalanceSpacingMs) return;
|
||||
if (now - _lastBalanceAt < BalanceSpacingMs)
|
||||
return $"the balance was read moments ago; try again in {Math.Max(1, (BalanceSpacingMs - (now - _lastBalanceAt) + 999) / 1000)}s.";
|
||||
_lastBalanceAt = now;
|
||||
_quietBalanceUntil = quiet ? now + QuietBalanceWindowMs : 0;
|
||||
_ctx.Capture.Enqueue(new IltChatRequest
|
||||
|
|
@ -166,6 +170,7 @@ internal sealed class IltBanking : IIltFeature
|
|||
else if (r.Lines.Count > 0) _ctx.Options.Set(IltFeature.Bank, IltTri.On);
|
||||
},
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -472,13 +472,16 @@ internal sealed class IltChunkClap : IIltFeature
|
|||
.Select(wo => ClapPartOf(inv.Wcid(wo), wo.Name, inv.Int(wo, IltInventory.IntItemMaxLevel))));
|
||||
}
|
||||
|
||||
/// <summary>Sends "/clap all" through the capture queue (reply stays visible).</summary>
|
||||
public void ClapNow(bool manual)
|
||||
/// <summary>
|
||||
/// Sends "/clap all" through the capture queue (reply stays visible). Null when it went out, else
|
||||
/// why not (for "/ra hub clap" to say; the button and the auto clap ignore it).
|
||||
/// </summary>
|
||||
public string? ClapNow(bool manual)
|
||||
{
|
||||
RynthLog.Trace(LogCat.IltGear, $"ClapNow(manual={manual})");
|
||||
if (_ctx.Options.IsOff(IltFeature.Clap)) { _clapStatus = "/clap is not available (server or AutoCraftingEnabled stamp)"; return; }
|
||||
if (_ctx.Capture.IsPending("/clap all")) return;
|
||||
if (!manual && !HasClapMaterials()) { _clapStatus = "no aetheria and trinket pair carried (red + Empyrean, blue + Falatacot)"; return; }
|
||||
if (_ctx.Options.IsOff(IltFeature.Clap)) { _clapStatus = "/clap is not available (server or AutoCraftingEnabled stamp)"; return _clapStatus + "."; }
|
||||
if (_ctx.Capture.IsPending("/clap all")) return "one is already waiting for the server's reply.";
|
||||
if (!manual && !HasClapMaterials()) { _clapStatus = "no aetheria and trinket pair carried (red + Empyrean, blue + Falatacot)"; return _clapStatus + "."; }
|
||||
_clapStatus = "sending /clap all...";
|
||||
_ctx.Capture.Enqueue(new IltChatRequest
|
||||
{
|
||||
|
|
@ -497,6 +500,7 @@ internal sealed class IltChunkClap : IIltFeature
|
|||
if (r.Lines.Any(l => l.StartsWith("Deposited ", StringComparison.Ordinal))) _ctx.Options.Set(IltFeature.Clap, IltTri.On);
|
||||
},
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
private void TickClap(long now)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// player first (the confirmed action is then posted).
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
namespace RynthCore.Plugin.RynthILT.Hub;
|
||||
|
|
@ -29,9 +30,13 @@ internal sealed class IltHubContext
|
|||
private readonly ConcurrentQueue<IltConfirmRequest> _confirms = new();
|
||||
|
||||
public IltHubContext(RynthCoreHost host, IltHubState state, IltHubStore store, IltChatCapture capture,
|
||||
IltServerOptions options, IltInventory inventory, IltSettings settings, RynthAiClient ai)
|
||||
IltServerOptions options, IltInventory inventory, IltSettings settings, RynthAiClient ai,
|
||||
CommandReply? reply = null)
|
||||
{
|
||||
Host = host;
|
||||
// The plugin's queue (it writes the waiting lines on its tick); a Hub on its own (the tests) keeps one.
|
||||
OwnsReply = reply == null;
|
||||
Reply = reply ?? NewReply(host);
|
||||
State = state;
|
||||
Store = store;
|
||||
Capture = capture;
|
||||
|
|
@ -69,11 +74,26 @@ internal sealed class IltHubContext
|
|||
/// </summary>
|
||||
public Action<IltSection>? ShowTab;
|
||||
|
||||
/// <summary>
|
||||
/// Where the Hub's chat lines go: RynthSuite's shared reply queue (Plugins/Shared/CommandReply.cs).
|
||||
/// The host drops a line within 100 ms of another plugin's, so the second and later lines of an
|
||||
/// answer (the help, /ra hub status) used to go missing; a refused line waits and is offered again.
|
||||
/// No tag of its own: every Hub line brings its own ("[Mini Remote]", "[ILT Guardian]", ...).
|
||||
/// </summary>
|
||||
public CommandReply Reply { get; }
|
||||
|
||||
/// <summary>True when this Hub made <see cref="Reply"/> itself (no plugin around it): its tick flushes it.</summary>
|
||||
public bool OwnsReply { get; }
|
||||
|
||||
/// <summary>A reply queue writing to <paramref name="host"/>'s chat (the plugin's, and a Hub's own).</summary>
|
||||
public static CommandReply NewReply(RynthCoreHost host) =>
|
||||
new(string.Empty, (t, c) => host.HasWriteToChat && host.WriteToChat(t, c), t => host.Log(t));
|
||||
|
||||
/// <summary>Writes a local chat line (never sent to the server).</summary>
|
||||
public void Chat(string text)
|
||||
{
|
||||
if (Host.HasWriteToChat) Host.WriteToChat(text, 1);
|
||||
}
|
||||
public void Chat(string text) => Reply.Ok(text);
|
||||
|
||||
/// <summary>A local chat line saying a command didn't work: why, and the usage (the failure colour).</summary>
|
||||
public void ChatFail(string text) => Reply.Fail(text);
|
||||
|
||||
/// <summary>Queues work for the next pump tick (safe from the render thread).</summary>
|
||||
public void Post(Action action) => _posted.Enqueue(action);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ internal sealed class IltHubController
|
|||
/// <param name="writesBlocked">True while this character's copy from RynthAi is unfinished (IltHubStore.WritesBlocked).</param>
|
||||
/// <param name="legacyFolder">The character's RynthAi folder while that copy is unfinished (read-only fallback).</param>
|
||||
public IltHubController(RynthCoreHost host, string charFolder, IltSettings settings, RynthAiClient ai,
|
||||
Func<bool>? writesBlocked = null, string? legacyFolder = null)
|
||||
Func<bool>? writesBlocked = null, string? legacyFolder = null,
|
||||
RynthCore.Plugin.Shared.CommandReply? reply = null)
|
||||
{
|
||||
var store = new IltHubStore(host, charFolder);
|
||||
if (writesBlocked != null) store.WritesBlocked = writesBlocked;
|
||||
|
|
@ -98,7 +99,7 @@ internal sealed class IltHubController
|
|||
var inventory = new IltInventory(host, new IltObjects(host));
|
||||
IltHubContext? ctxRef = null;
|
||||
var options = new IltServerOptions(host, capture, state, text => ctxRef?.Chat(text), () => settings);
|
||||
_ctx = new IltHubContext(host, state, store, capture, options, inventory, settings, ai);
|
||||
_ctx = new IltHubContext(host, state, store, capture, options, inventory, settings, ai, reply);
|
||||
ctxRef = _ctx;
|
||||
|
||||
Banking = new IltBanking(_ctx);
|
||||
|
|
@ -373,6 +374,7 @@ internal sealed class IltHubController
|
|||
_forceRequest = -1;
|
||||
_ctx.State.ForceLeaftideFeatures = force == 1;
|
||||
}
|
||||
if (_ctx.OwnsReply) _ctx.Reply.Flush();
|
||||
_ctx.DrainPosted();
|
||||
_ctx.Capture.Tick();
|
||||
_ctx.Options.Tick();
|
||||
|
|
@ -594,6 +596,7 @@ internal sealed class IltHubController
|
|||
{
|
||||
// "rates reset": the coin / pyreal session starts over with RynthAi's session stats.
|
||||
Rates.Reset();
|
||||
_ctx.Chat("[Mini Remote] ILT session rates reset: coins and pyreals count from now.");
|
||||
return true;
|
||||
}
|
||||
if (IsBountyVerb(verb))
|
||||
|
|
@ -634,7 +637,7 @@ internal sealed class IltHubController
|
|||
{
|
||||
// Quests and Pets are RynthAi's tabs: not ours to open.
|
||||
if (args.Length >= 2 && IltSections.IsUniversalTabName(args[1])) return false;
|
||||
_ctx.Chat("[Mini Remote] Usage: /ra hub open pets|banking|gear|charms|games|vaulted|guardian|bounties [show|hide|toggle] (character: /ro character, quests: /ro)");
|
||||
_ctx.ChatFail("[Mini Remote] Usage: /ra hub open pets|banking|gear|charms|games|vaulted|guardian|bounties [show|hide|toggle] (character: /ro character, quests: /ro)");
|
||||
break;
|
||||
}
|
||||
OpenSection(section, args.Length > 2 ? args[2] : "toggle");
|
||||
|
|
@ -649,7 +652,13 @@ internal sealed class IltHubController
|
|||
return false; // the Remote tab or a RynthAi tab: RynthAi's
|
||||
break;
|
||||
case "refresh": _ctx.Options.Refresh(manual: true); break;
|
||||
case "bank": Banking.RequestRefresh(quiet: false); break;
|
||||
case "bank":
|
||||
{
|
||||
string? why = Banking.RequestRefresh(quiet: false);
|
||||
if (why == null) _ctx.Chat("[Mini Remote] Reading the bank balance (/bank); the server's [BANK] lines follow.");
|
||||
else _ctx.ChatFail("[Mini Remote] " + why);
|
||||
break;
|
||||
}
|
||||
// "/ilt qb": reads the /qb list again (the Quests tab's quest bonus section).
|
||||
case "qb": _ctx.Chat("[RynthILT] " + QuestBonus.RefreshQb()); break;
|
||||
case "status": PrintStatus(); break;
|
||||
|
|
@ -663,7 +672,13 @@ internal sealed class IltHubController
|
|||
case "servers": HandleServers(rest); break;
|
||||
case "profile": HandleProfile(args.Skip(1).ToArray()); break;
|
||||
case "suit": HandleSuit(args.Skip(1).ToArray()); break;
|
||||
case "clap": Gear.ChunkClap.ClapNow(manual: true); break;
|
||||
case "clap":
|
||||
{
|
||||
string? why = Gear.ChunkClap.ClapNow(manual: true);
|
||||
if (why == null) _ctx.Chat("[Mini Remote] Sending /clap all; the server's reply follows.");
|
||||
else _ctx.ChatFail("[Mini Remote] /clap all: " + why);
|
||||
break;
|
||||
}
|
||||
case "attr": HandleAttr(args.Skip(1).ToArray()); break;
|
||||
case "confirm": RunPending(); break;
|
||||
case "cancel":
|
||||
|
|
@ -705,7 +720,7 @@ internal sealed class IltHubController
|
|||
var list = arg.Equals("default", StringComparison.OrdinalIgnoreCase)
|
||||
? new List<string>(ServerFeatureGate.DefaultServerNames)
|
||||
: ServerFeatureGate.ParseList(arg);
|
||||
if (list.Count == 0) { _ctx.Chat("[Mini Remote] Usage: /ra hub servers <name, *pattern*, ...> | default | list"); return; }
|
||||
if (list.Count == 0) { _ctx.ChatFail("[Mini Remote] Usage: /ra hub servers <name, *pattern*, ...> | default | list"); return; }
|
||||
_ctx.Settings.ServerNames = list;
|
||||
_ctx.SaveSettings();
|
||||
}
|
||||
|
|
@ -718,15 +733,57 @@ internal sealed class IltHubController
|
|||
{
|
||||
var raiser = Progression.Attributes;
|
||||
string sub = a.Length > 0 ? a[0].ToLowerInvariant() : "status";
|
||||
const string usage = "[Mini Remote] Usage: /ra hub attr run|stop|costs|status|auto on|off|every <min>|raise <stat> <n>";
|
||||
switch (sub)
|
||||
{
|
||||
case "run": raiser.HandleRemote("attrrun", new[] { "attrrun" }); break;
|
||||
case "stop": raiser.HandleRemote("attrstop", new[] { "attrstop" }); break;
|
||||
case "costs": raiser.HandleRemote("attrcosts", new[] { "attrcosts" }); break;
|
||||
case "auto": raiser.HandleRemote("attrauto", new[] { "attrauto", a.Length > 1 ? a[1] : "off" }); break;
|
||||
case "every": raiser.HandleRemote("attrevery", new[] { "attrevery", a.Length > 1 ? a[1] : "5" }); break;
|
||||
case "raise" when a.Length > 2: raiser.HandleRemote("attrraise", new[] { "attrraise", a[1], a[2] }); break;
|
||||
case "run":
|
||||
raiser.HandleRemote("attrrun", new[] { "attrrun" });
|
||||
_ctx.Chat("[Mini Remote] Attribute raiser: " + raiser.Status);
|
||||
break;
|
||||
case "stop":
|
||||
{
|
||||
bool was = raiser.Running;
|
||||
raiser.HandleRemote("attrstop", new[] { "attrstop" });
|
||||
_ctx.Chat(was ? "[Mini Remote] Attribute raiser: " + raiser.Status : "[Mini Remote] Attribute raiser: nothing was running.");
|
||||
break;
|
||||
}
|
||||
case "costs":
|
||||
raiser.HandleRemote("attrcosts", new[] { "attrcosts" });
|
||||
_ctx.Chat(raiser.Running ? "[Mini Remote] Attribute raiser: a run is reading them already; " + raiser.Status
|
||||
: "[Mini Remote] Attribute raiser: " + (raiser.Blocker() ?? "reading the XP costs (/xp all)..."));
|
||||
break;
|
||||
case "auto":
|
||||
{
|
||||
// As before: any word but "on" (or none) turns it off; a word that isn't on/off says so.
|
||||
string word = a.Length > 1 ? a[1] : "off";
|
||||
raiser.HandleRemote("attrauto", new[] { "attrauto", word });
|
||||
var ch = _ctx.State.Character;
|
||||
string now = $"[Mini Remote] Attribute auto-raise {(ch.AttrAutoRaise ? $"on, every {ch.AttrAutoRaiseMinutes} min" : "off")}";
|
||||
if (word.ToLowerInvariant() is "on" or "off") _ctx.Chat(now + ".");
|
||||
else _ctx.ChatFail($"{now} ('{word}' isn't on). {usage}");
|
||||
break;
|
||||
}
|
||||
case "every":
|
||||
{
|
||||
// As before: no number means 5 minutes; a word that isn't a number changes nothing.
|
||||
string word = a.Length > 1 ? a[1] : "5";
|
||||
raiser.HandleRemote("attrevery", new[] { "attrevery", word });
|
||||
var ch = _ctx.State.Character;
|
||||
string now = $"[Mini Remote] Attribute auto-raise every {ch.AttrAutoRaiseMinutes} min ({(ch.AttrAutoRaise ? "on" : "off; /ra hub attr auto on")})";
|
||||
if (int.TryParse(word, out _)) _ctx.Chat(now + ".");
|
||||
else _ctx.ChatFail($"{now}: '{word}' isn't a number of minutes. {usage}");
|
||||
break;
|
||||
}
|
||||
case "raise" when a.Length > 2:
|
||||
if (IltAttributeRaiser.Find(a[1]) == null || !int.TryParse(a[2], out int levels) || levels <= 0) { _ctx.ChatFail(usage); break; }
|
||||
raiser.HandleRemote("attrraise", new[] { "attrraise", a[1], a[2] });
|
||||
_ctx.Chat("[Mini Remote] Attribute raiser: " + raiser.Status);
|
||||
break;
|
||||
case "raise":
|
||||
_ctx.ChatFail(usage);
|
||||
break;
|
||||
default:
|
||||
if (sub != "status") { _ctx.ChatFail(usage); return; }
|
||||
var c = _ctx.State.Character;
|
||||
string blocked = raiser.Blocker() ?? "ready";
|
||||
_ctx.Chat($"[Mini Remote] Attribute raiser: {blocked}; auto={(c.AttrAutoRaise ? $"on every {c.AttrAutoRaiseMinutes}m" : "off")} "
|
||||
|
|
@ -752,6 +809,7 @@ internal sealed class IltHubController
|
|||
{
|
||||
// Character left the Mini Remote: open its new home instead.
|
||||
if (!mode.Equals("hide", StringComparison.OrdinalIgnoreCase)) OpenMoved(section, moved);
|
||||
else _ctx.Chat($"[Mini Remote] {IltSections.Label(section)} isn't a Mini Remote tab any more: it is RynthOracle's ({moved}), nothing to hide here.");
|
||||
return;
|
||||
}
|
||||
if (!IltSections.IsTab(section))
|
||||
|
|
@ -798,8 +856,12 @@ internal sealed class IltHubController
|
|||
_ => "toggle",
|
||||
};
|
||||
if (_ctx.Host.HasInvokeChatParser && _ctx.Host.InvokeChatParser($"/rc {rcVerb} {m}"))
|
||||
{
|
||||
// RynthCore opens or closes it, and says why when it can't (not ILT, no ImGui).
|
||||
_ctx.Chat($"[Mini Remote] {label} panel: asked RynthCore to {m} it (/rc {rcVerb} {m}).");
|
||||
return;
|
||||
_ctx.Chat($"[Mini Remote] {label} is a RynthCore ILT panel: the bar's ILT button, or /rc {rcVerb}.");
|
||||
}
|
||||
_ctx.ChatFail($"[Mini Remote] {label} is a RynthCore ILT panel: the bar's ILT button, or /rc {rcVerb}.");
|
||||
}
|
||||
|
||||
/// <summary>"show"/"on" → true, "hide"/"off" → false, anything else flips <paramref name="current"/>.</summary>
|
||||
|
|
@ -831,7 +893,7 @@ internal sealed class IltHubController
|
|||
_ctx.Chat("[Mini Remote] Profiles: " + (names.Count > 0 ? string.Join(", ", names) : "(none)"));
|
||||
return;
|
||||
}
|
||||
if (a.Length < 2) { _ctx.Chat("[Mini Remote] Usage: /ra hub profile save <name> [shared] | load <name>"); return; }
|
||||
if (a.Length < 2 || sub is not ("save" or "load")) { _ctx.ChatFail("[Mini Remote] Usage: /ra hub profile list | save <name> [shared] | load <name>"); return; }
|
||||
if (sub == "save")
|
||||
{
|
||||
bool shared = a.Length > 2 && a[2].Equals("shared", StringComparison.OrdinalIgnoreCase);
|
||||
|
|
@ -874,7 +936,7 @@ internal sealed class IltHubController
|
|||
string? label = _pendingLabel;
|
||||
bool fresh = action != null && IltHubContext.NowMs - _pendingAt <= ConfirmWindowMs;
|
||||
ClearPending();
|
||||
if (!fresh || action == null) { _ctx.Chat("[Mini Remote] Nothing to confirm."); return; }
|
||||
if (!fresh || action == null) { _ctx.ChatFail("[Mini Remote] Nothing to confirm."); return; }
|
||||
|
||||
RynthLog.Event(LogEvents.IltConfirmation, $"confirmed: {label}");
|
||||
try { action(); }
|
||||
|
|
@ -906,7 +968,7 @@ internal sealed class IltHubController
|
|||
RequestConfirm($"equip suit '{name ?? "(auto)"}'", () => _ctx.Chat("[Mini Remote] " + Gear.Suits.Load(name)));
|
||||
break;
|
||||
default:
|
||||
_ctx.Chat("[Mini Remote] Usage: /ra hub suit list|test [name]|load [name]");
|
||||
_ctx.ChatFail("[Mini Remote] Usage: /ra hub suit list|test [name]|load [name]");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -535,7 +535,8 @@ internal sealed class IltVaultedDungeons : IIltFeature
|
|||
{
|
||||
case "on":
|
||||
case "start":
|
||||
SetActive(true);
|
||||
if (_cfg.Active) _ctx.Chat("[Vaulted Dungeons] Already on.");
|
||||
else SetActive(true);
|
||||
return true;
|
||||
case "off":
|
||||
case "stop":
|
||||
|
|
|
|||
|
|
@ -123,7 +123,8 @@ internal sealed unsafe class RynthAiClient
|
|||
using var m = new Utf8(mode);
|
||||
int ok = t->MiniRemoteTab(id.P, m.P, reply, 256);
|
||||
string text = Marshal.PtrToStringUTF8((IntPtr)reply) ?? string.Empty;
|
||||
return ok != 0 ? text : (text.Length > 0 ? text : "The Mini Remote is not available yet.");
|
||||
// An empty reply from RynthAi still says what was done (every command answers, 2026-10-28).
|
||||
return ok != 0 ? (text.Length > 0 ? text : $"Mini Remote: {mode} {tabId}.") : (text.Length > 0 ? text : "The Mini Remote is not available yet.");
|
||||
}
|
||||
|
||||
/// <summary>True while the Mini Remote is on screen (any thread).</summary>
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@
|
|||
<!-- Save failures (its own files and the copies migrated from RynthAi) said in chat with the
|
||||
reason and the fix, as RynthAi's are. -->
|
||||
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\DataWriteGuard.cs" Link="Shared\DataWriteGuard.cs" />
|
||||
<!-- How a chat command answers (2026-10-28): the shared reply queue and colours. -->
|
||||
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
<!-- T11 (ACECustom tier 11+ gear): the "/aug" reader, the counters and the item text parser (Hub/IltT11.cs,
|
||||
"/ilt t11"). RynthAi keeps the loot keys and evaluator; RynthILT reports the counters to it. -->
|
||||
<Compile Include="$(RynthSuiteRoot)Shared\RynthCore.LootSdk\T11\T11Catalog.cs" Link="Shared\T11\T11Catalog.cs" />
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
public override void OnTick()
|
||||
{
|
||||
try { RynthLog.Pump(); } catch { }
|
||||
Reply.Flush();
|
||||
if (!_loginComplete) return;
|
||||
_ai?.Tick();
|
||||
PollServerState(force: false);
|
||||
|
|
@ -751,7 +752,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
if (!fromRa && (verb == "bounty" || verb == "bounties" || verb == "bountys"))
|
||||
{
|
||||
// "/ilt bounty [list|refresh]": the tracker's own chat commands ("/ra bounty" opens the window).
|
||||
if (_bounties == null) ChatLine("[RynthILT] Bounties not ready (not logged in yet).");
|
||||
if (_bounties == null) ChatFail("[RynthILT] Bounties not ready (not logged in yet).");
|
||||
else _bounties.HandleChatCommand(parts);
|
||||
return;
|
||||
}
|
||||
|
|
@ -778,15 +779,16 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
// ub-IT's "/ub qblist" and "/ub augs" (RynthAi passes them on): ACECustom's own commands.
|
||||
string sub = args.Length > 0 ? args[0].ToLowerInvariant() : string.Empty;
|
||||
string? server = sub == "qblist" ? "/qb list" : sub == "augs" ? "/aug" : null;
|
||||
if (server == null) { ChatLine("[RynthILT] /ub qblist or /ub augs"); return; }
|
||||
if (_hub?.Options.IsIltLikeWorld != true) { ChatLine($"[RynthILT] /ub {sub}: not an Infinite Leaftide world."); return; }
|
||||
if (!Host.HasInvokeChatParser || !Host.InvokeChatParser(server)) ChatLine("[RynthILT] RynthCore didn't take: " + server);
|
||||
if (server == null) { ChatFail("[RynthILT] /ub qblist or /ub augs"); return; }
|
||||
if (_hub?.Options.IsIltLikeWorld != true) { ChatFail($"[RynthILT] /ub {sub}: not an Infinite Leaftide world."); return; }
|
||||
if (!Host.HasInvokeChatParser || !Host.InvokeChatParser(server)) ChatFail("[RynthILT] RynthCore didn't take: " + server);
|
||||
else ChatLine($"[RynthILT] /ub {sub}: sent {server}; the server's reply follows.");
|
||||
return;
|
||||
}
|
||||
case "t11":
|
||||
{
|
||||
// "/ilt t11 ..." and RynthAi's "/ra t11 ..." (T11 loot counters; IltT11).
|
||||
if (_hub == null) { ChatLine("[RynthILT] ILT features not ready (log in first)."); return; }
|
||||
if (_hub == null) { ChatFail("[RynthILT] ILT features not ready (log in first)."); return; }
|
||||
_hub.T11.HandleCommand(args);
|
||||
return;
|
||||
}
|
||||
|
|
@ -795,7 +797,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
{
|
||||
// "/ilt vaulted [on|off|toggle|status]": the Vaulted Dungeons keeper (ILT only; the
|
||||
// module answers "not available" elsewhere, and while the master switch is off).
|
||||
if (_hub == null) { ChatLine("[RynthILT] ILT features not ready (log in first)."); return; }
|
||||
if (_hub == null) { ChatFail("[RynthILT] ILT features not ready (log in first)."); return; }
|
||||
_hub.VaultedDungeons.HandleCommand(args);
|
||||
return;
|
||||
}
|
||||
|
|
@ -805,6 +807,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
// "/ilt settings [show|hide|toggle]": the ILT settings window.
|
||||
string mode = args.Length >= 1 ? args[0].ToLowerInvariant() : "toggle";
|
||||
_settingsUi.WindowOpen = mode switch { "show" or "on" => true, "hide" or "off" => false, _ => !_settingsUi.WindowOpen };
|
||||
ChatLine(WindowReply("ILT settings", _settingsUi.WindowOpen));
|
||||
return;
|
||||
}
|
||||
case "stamps":
|
||||
|
|
@ -816,6 +819,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
// "/ilt stamps [show|hide|toggle]": the Dynamic Stamps window (RynthOracle's "/ro dynamic" until 2026-10-21).
|
||||
string mode = args.Length >= 1 ? args[0].ToLowerInvariant() : "toggle";
|
||||
_stampsWindowOpen = IltSections.Resolve(mode, _stampsWindowOpen);
|
||||
ChatLine(WindowReply("Dynamic Stamps", _stampsWindowOpen));
|
||||
if (_stampsWindowOpen && _hub?.Options.IsIltLikeWorld == false)
|
||||
ChatLine("[RynthILT] Dynamic Stamps are an Infinite Leaftide quest line; this world isn't treated as ILT.");
|
||||
return;
|
||||
|
|
@ -827,6 +831,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
// RynthAi's Mini Remote shows the same tracker as Pets > Breeding).
|
||||
string mode = args.Length >= 1 ? args[0].ToLowerInvariant() : "toggle";
|
||||
_breedingWindowOpen = IltSections.Resolve(mode, _breedingWindowOpen);
|
||||
ChatLine(WindowReply("Pet Breeding", _breedingWindowOpen));
|
||||
return;
|
||||
}
|
||||
case "fellow":
|
||||
|
|
@ -836,6 +841,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
// "/ilt fellow [show|hide|toggle]": the ILT fellowship commands window.
|
||||
string mode = args.Length >= 1 ? args[0].ToLowerInvariant() : "toggle";
|
||||
_fellowshipUi.WindowOpen = mode switch { "show" or "on" => true, "hide" or "off" => false, _ => !_fellowshipUi.WindowOpen };
|
||||
ChatLine(WindowReply("ILT fellowship", _fellowshipUi.WindowOpen));
|
||||
return;
|
||||
}
|
||||
case "help":
|
||||
|
|
@ -856,17 +862,24 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
}
|
||||
if (_hub == null)
|
||||
{
|
||||
ChatLine("[RynthILT] ILT features not ready (log in first).");
|
||||
ChatFail("[RynthILT] ILT features not ready (log in first).");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (!_hub.HandleCommand(verb, args))
|
||||
ChatLine($"[RynthILT] Unknown command: {string.Join(" ", parts)}. /ilt help");
|
||||
ChatFail($"[RynthILT] Unknown command: {string.Join(" ", parts)}. /ilt help");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
RynthLog.Exception(LogCat.IltHub, ex, "command");
|
||||
ChatFail($"[RynthILT] {string.Join(" ", parts)} failed: {ex.Message}");
|
||||
}
|
||||
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "command"); }
|
||||
}
|
||||
|
||||
/// <summary>"/ilt settings|stamps|breeding|fellow [show|hide|toggle]": the window after it (every command answers, 2026-10-28).</summary>
|
||||
internal static string WindowReply(string window, bool open) => $"[RynthILT] {window} window {(open ? "shown" : "hidden")}.";
|
||||
|
||||
private static string[] Prepend(string first, string[] rest)
|
||||
{
|
||||
var a = new string[rest.Length + 1];
|
||||
|
|
@ -893,7 +906,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
}
|
||||
if (!RynthLog.TryParseCategory(target, out LogCat cat))
|
||||
{
|
||||
ChatLine($"[RynthILT] Unknown trace category '{target}'. /ilt trace list");
|
||||
ChatFail($"[RynthILT] Unknown trace category '{target}'. /ilt trace list");
|
||||
return;
|
||||
}
|
||||
RynthLog.SetTracing(cat, on);
|
||||
|
|
@ -907,7 +920,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
if (words.Length == 0) return;
|
||||
if (words[0].Equals("prog", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (_hub == null) { ChatLine("[RynthILT] ILT features not ready (log in first)."); return; }
|
||||
if (_hub == null) { ChatFail("[RynthILT] ILT features not ready (log in first)."); return; }
|
||||
try { _hub.Progression.HandleRemote(words[1..]); }
|
||||
catch (Exception ex) { RynthLog.Exception(LogCat.IltProgression, ex, "prog command"); }
|
||||
return;
|
||||
|
|
@ -921,10 +934,16 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
if (_engineCommands.Count < 64) _engineCommands.Enqueue((action + " " + value).Trim());
|
||||
}
|
||||
|
||||
private void ChatLine(string text)
|
||||
{
|
||||
if (Host.HasWriteToChat) Host.WriteToChat(text, 1);
|
||||
}
|
||||
// RynthILT's chat lines (the Hub's too) go through RynthSuite's shared reply queue
|
||||
// (Plugins/Shared/CommandReply.cs): the host drops a line within 100 ms of another plugin's, so the
|
||||
// help's later lines used to go missing. Every line brings its own tag ("[RynthILT]", "[Mini Remote]").
|
||||
private RynthCore.Plugin.Shared.CommandReply? _reply;
|
||||
private RynthCore.Plugin.Shared.CommandReply Reply => _reply ??= IltHubContext.NewReply(Host);
|
||||
|
||||
private void ChatLine(string text) => Reply.Ok(text);
|
||||
|
||||
/// <summary>A command that didn't work: why, and the usage (the failure colour).</summary>
|
||||
private void ChatFail(string text) => Reply.Fail(text);
|
||||
|
||||
// ── The ILT Hub ──────────────────────────────────────────────────────────
|
||||
|
||||
|
|
@ -970,7 +989,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
try
|
||||
{
|
||||
_hub = new IltHubController(Host, folder, _settings, _ai, () => _hubWritesBlocked,
|
||||
pending ? IltMigration.FindLegacyCharFolder(world, charName) : null);
|
||||
pending ? IltMigration.FindLegacyCharFolder(world, charName) : null, Reply);
|
||||
// Once per character: the RynthAi settings that moved here on 2026-10-20.
|
||||
var imported = IltMigration.ImportRynthAiSettings(_hub.State, world, charName);
|
||||
if (imported.Count > 0)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@
|
|||
<RynthPluginDescription>DreamWeave only: records Fragment Press results and shows the odds of each modifier per component.</RynthPluginDescription>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- How a chat command answers (2026-10-28): RynthSuite's shared reply queue and colours. -->
|
||||
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\RynthCore\src\RynthCore.PluginCore\RynthCore.PluginCore.csproj" />
|
||||
<ProjectReference Include="..\..\..\RynthCore\src\RynthCore.PluginSdk\RynthCore.PluginSdk.csproj" />
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ using System.Text;
|
|||
using RynthCore.Plugin.RynthThreads.Threads;
|
||||
using RynthCore.Plugin.RynthThreads.Ui;
|
||||
using RynthCore.Plugin.RynthThreads.Views;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginCore;
|
||||
|
||||
namespace RynthCore.Plugin.RynthThreads;
|
||||
|
|
@ -50,10 +51,10 @@ public sealed class RynthThreadsPlugin : RynthPluginBase
|
|||
private long _nextPollMs;
|
||||
private string _world = string.Empty;
|
||||
private string _character = string.Empty;
|
||||
private bool _noUiLogged;
|
||||
|
||||
public override int Initialize()
|
||||
{
|
||||
_ = Reply;
|
||||
_ui.Log = msg => Host.Log(msg);
|
||||
_panel = new ThreadsPanel
|
||||
{
|
||||
|
|
@ -127,6 +128,7 @@ public sealed class RynthThreadsPlugin : RynthPluginBase
|
|||
{
|
||||
long now = Environment.TickCount64;
|
||||
while (_commands.TryDequeue(out string? cmd)) RunCommand(cmd);
|
||||
Reply.Flush();
|
||||
if (_inWorld && !_checked && now >= _nextIdentityTryMs) TryIdentify(now);
|
||||
if (!_active || _store == null) return;
|
||||
|
||||
|
|
@ -224,7 +226,7 @@ public sealed class RynthThreadsPlugin : RynthPluginBase
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Print($"Export failed: {ex.Message}");
|
||||
PrintFail($"Export failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,39 +234,37 @@ public sealed class RynthThreadsPlugin : RynthPluginBase
|
|||
|
||||
private void RunCommand(string arg)
|
||||
{
|
||||
string word = arg.Split(' ', StringSplitOptions.RemoveEmptyEntries) is { Length: > 0 } w ? w[0].ToLowerInvariant() : string.Empty;
|
||||
if (word is "help" or "?")
|
||||
// Every /rthreads answers in chat (2026-10-28, ThreadsCommands.cs).
|
||||
ThreadsVerb verb = ThreadsCommands.Parse(arg, out string word);
|
||||
if (verb == ThreadsVerb.Help)
|
||||
{
|
||||
Print($"DreamWeave only: records Fragment Press results and shows the odds of each modifier per component. {Command} shows or hides the window; {Command} stats; {Command} export.");
|
||||
Print(ThreadsCommands.Help);
|
||||
return;
|
||||
}
|
||||
if (!_inWorld) { Print("Log in first."); return; }
|
||||
if (!_checked) { Print("Still finding out which server this is; try again in a moment."); return; }
|
||||
if (!_inWorld) { PrintFail("Log in first."); return; }
|
||||
if (!_checked) { PrintFail("Still finding out which server this is; try again in a moment."); return; }
|
||||
if (!_active)
|
||||
{
|
||||
Print($"RynthThreads is for DreamWeave only (this is {_world}).");
|
||||
PrintFail($"RynthThreads is for DreamWeave only (this is {_world}).");
|
||||
return;
|
||||
}
|
||||
switch (word)
|
||||
switch (verb)
|
||||
{
|
||||
case "":
|
||||
if (_window == null) return;
|
||||
case ThreadsVerb.Window:
|
||||
if (_window == null) { PrintFail("The Threads window isn't ready yet; try again in a moment."); return; }
|
||||
_window.Visible = !_window.Visible;
|
||||
_window.NeedsPass = true;
|
||||
if (_window.Visible && !Host.HasUi && !_noUiLogged)
|
||||
{
|
||||
_noUiLogged = true;
|
||||
Print($"This RynthCore engine can't show plugin windows (it needs script windows, API v71, with ImGui on). Presses are still recorded: {Command} stats.");
|
||||
}
|
||||
if (Host.HasUi) Print(ThreadsCommands.Window(_window.Visible));
|
||||
else PrintFail(ThreadsCommands.NoWindows);
|
||||
break;
|
||||
case "stats":
|
||||
case ThreadsVerb.Stats:
|
||||
foreach (string line in StatsLines(CurrentReport(), _store!.FilePath)) Print(line);
|
||||
break;
|
||||
case "export":
|
||||
case ThreadsVerb.Export:
|
||||
Export();
|
||||
break;
|
||||
default:
|
||||
Print($"{Command} [stats | export | help]");
|
||||
PrintFail(ThreadsCommands.Unknown(word));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -306,11 +306,15 @@ public sealed class RynthThreadsPlugin : RynthPluginBase
|
|||
return lines;
|
||||
}
|
||||
|
||||
private void Print(string text)
|
||||
{
|
||||
if (!Host.HasWriteToChat || !Host.WriteToChat("[RynthThreads] " + text, 1))
|
||||
Host.Log("[RynthThreads] " + text);
|
||||
}
|
||||
// Chat lines wait in the shared reply queue (RynthSuite's Plugins/Shared/CommandReply.cs): the host
|
||||
// drops a line within 100 ms of another plugin's, so /rthreads stats lost all but its first line.
|
||||
private CommandReply? _reply;
|
||||
private CommandReply Reply => _reply ??= new CommandReply("[RynthThreads]",
|
||||
(t, c) => Host.HasWriteToChat && Host.WriteToChat(t, c), t => Host.Log(t));
|
||||
|
||||
private void Print(string text) => Reply.Ok(text);
|
||||
|
||||
private void PrintFail(string text) => Reply.Fail(text);
|
||||
|
||||
/// <summary>A pass when one is wanted, or now and then while visible.</summary>
|
||||
private void Record(UiWindow w, long now)
|
||||
|
|
|
|||
39
Plugins/RynthCore.Plugin.RynthThreads/ThreadsCommands.cs
Normal file
39
Plugins/RynthCore.Plugin.RynthThreads/ThreadsCommands.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// ThreadsCommands.cs - "/rthreads ..." words and what each answers (2026-10-28: every command answers in
|
||||
// chat, RynthSuite's Plugins/Shared/CommandReply.cs). RynthThreads can't tell a typed /rthreads from a
|
||||
// meta's, so each one answers. Pure: RynthThreads.Tests covers it.
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
||||
namespace RynthCore.Plugin.RynthThreads;
|
||||
|
||||
internal enum ThreadsVerb { Window, Stats, Export, Help, Unknown }
|
||||
|
||||
internal static class ThreadsCommands
|
||||
{
|
||||
public const string Command = "/rthreads";
|
||||
|
||||
public const string Usage = Command + " [stats | export | help]";
|
||||
|
||||
public static ThreadsVerb Parse(string? arg, out string word)
|
||||
{
|
||||
string[] words = (arg ?? string.Empty).Split(' ', System.StringSplitOptions.RemoveEmptyEntries);
|
||||
word = words.Length > 0 ? words[0].ToLowerInvariant() : string.Empty;
|
||||
return word switch
|
||||
{
|
||||
"" => ThreadsVerb.Window,
|
||||
"stats" => ThreadsVerb.Stats,
|
||||
"export" => ThreadsVerb.Export,
|
||||
"help" or "?" => ThreadsVerb.Help,
|
||||
_ => ThreadsVerb.Unknown,
|
||||
};
|
||||
}
|
||||
|
||||
public static string Help =>
|
||||
$"DreamWeave only: records Fragment Press results and shows the odds of each modifier per component. {Command} shows or hides the window; {Command} stats; {Command} export.";
|
||||
|
||||
public static string Window(bool shown) => CommandReply.Shown("The Threads window", shown);
|
||||
|
||||
public static string NoWindows =>
|
||||
$"This RynthCore engine can't show plugin windows (it needs script windows, API v71, with ImGui on). Presses are still recorded: {Command} stats.";
|
||||
|
||||
public static string Unknown(string word) => $"Unknown '{Command} {word}'. Usage: {Usage}";
|
||||
}
|
||||
57
Plugins/Shared/ServerPack/ServerPackCommands.cs
Normal file
57
Plugins/Shared/ServerPack/ServerPackCommands.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// ServerPackCommands.cs - "/rserver ..." for every server plugin: which words are its verbs and what each
|
||||
// answers (2026-10-28: every command answers in chat, RynthSuite's Plugins/Shared/CommandReply.cs).
|
||||
// The plugin can't tell a typed /rserver from a meta's, so each one answers. The window verbs say the
|
||||
// window's state; auto/on/off are answered by RynthCore's "/rc server" (the override it saved); info
|
||||
// lists what is known; help and an unknown word give the usage (the unknown word named first).
|
||||
// Pure: RynthServerPack.Tests covers it.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
||||
namespace RynthCore.Plugin.ServerPack;
|
||||
|
||||
internal enum ServerVerb { Show, Hide, Toggle, Info, Help, Auto, On, Off, Server, Unknown }
|
||||
|
||||
internal static class ServerPackCommands
|
||||
{
|
||||
/// <summary>The verbs every server plugin answers (the server's own come from ServerCommandVerbs).</summary>
|
||||
public static readonly string[] SharedVerbs = { "show", "hide", "toggle", "info", "help", "on", "off", "auto" };
|
||||
|
||||
/// <summary>Whether <paramref name="word"/> is a verb here (else it may be a server id: "/rserver coldeve info").</summary>
|
||||
public static bool IsVerb(string word, ICollection<string> serverVerbs)
|
||||
{
|
||||
string w = (word ?? string.Empty).ToLowerInvariant();
|
||||
return Array.IndexOf(SharedVerbs, w) >= 0 || serverVerbs.Contains(w);
|
||||
}
|
||||
|
||||
/// <summary>The verb of "/rserver [verb ...]" (parts[0] is "/rserver"; none = toggle).</summary>
|
||||
public static ServerVerb Verb(string[] parts, ICollection<string> serverVerbs)
|
||||
{
|
||||
if (parts.Length < 2) return ServerVerb.Toggle;
|
||||
string w = parts[1].ToLowerInvariant();
|
||||
return w switch
|
||||
{
|
||||
"show" => ServerVerb.Show,
|
||||
"hide" => ServerVerb.Hide,
|
||||
"toggle" => ServerVerb.Toggle,
|
||||
"info" => ServerVerb.Info,
|
||||
"help" => ServerVerb.Help,
|
||||
"auto" => ServerVerb.Auto,
|
||||
"on" => ServerVerb.On,
|
||||
"off" => ServerVerb.Off,
|
||||
_ => serverVerbs.Contains(w) ? ServerVerb.Server : ServerVerb.Unknown,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>"/rserver [show|hide|toggle]": the window after it.</summary>
|
||||
public static string Window(string serverName, bool shown) => CommandReply.Shown($"The {serverName} window", shown);
|
||||
|
||||
/// <summary>The usage, two lines.</summary>
|
||||
public static string[] Usage(string serverName) => new[]
|
||||
{
|
||||
$"/rserver [show|hide|toggle] - the {serverName} server card (also in the Mini Remote's Char section).",
|
||||
$"/rserver info - what is known about {serverName}; /rserver auto|on|off - this character's override.",
|
||||
};
|
||||
|
||||
public static string Unknown(string word) => $"Unknown '/rserver {word}'.";
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@ using System.Collections.Concurrent;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using ImGuiNET;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginCore;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
|
|
@ -169,6 +170,7 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
|
||||
public override int Initialize()
|
||||
{
|
||||
_ = Reply;
|
||||
Host.Log($"[{RynthPluginInfo.Name}] Plugin initialized for {Info.Name} ({Info.Id}).");
|
||||
// The server card draws through the engine's cimgui (and so in its current context, a popped-out
|
||||
// Mini Remote's included), never a second copy of ImGui (ImGuiNativeBinding.cs). Found and fixed
|
||||
|
|
@ -206,13 +208,14 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
|
||||
public override void OnTick()
|
||||
{
|
||||
Reply.Flush();
|
||||
if (!_loginComplete) return;
|
||||
if (_world == null) RefreshWorld();
|
||||
while (_commands.TryDequeue(out string[]? parts)) RunCommand(parts);
|
||||
while (_engineCommands.TryDequeue(out string? command))
|
||||
{
|
||||
if (!Host.HasInvokeChatParser || !Host.InvokeChatParser(command))
|
||||
ChatLine($"[{RynthPluginInfo.Name}] RynthCore didn't take: " + command);
|
||||
ChatFail($"[{RynthPluginInfo.Name}] RynthCore didn't take: " + command);
|
||||
}
|
||||
while (_tickActions.TryDequeue(out Action? action))
|
||||
{
|
||||
|
|
@ -280,16 +283,17 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
/// /rserver show|hide|toggle: the server's window on RynthCore's bar when the engine hosts it (plugin
|
||||
/// windows, v89), else the standalone window this plugin draws itself (older engines).
|
||||
/// </summary>
|
||||
private void SetWindow(RynthPanelOpen mode)
|
||||
/// <returns>Whether the window shows now.</returns>
|
||||
private bool SetWindow(RynthPanelOpen mode)
|
||||
{
|
||||
string title = ServerPackModel.WindowTitle(Info);
|
||||
if (Host.HasSetPanelOpen && Host.SetPanelOpen(title, RynthPanelOpen.Ask) >= 0)
|
||||
{
|
||||
_ui.WindowOpen = false;
|
||||
Host.SetPanelOpen(title, mode);
|
||||
return;
|
||||
return Host.SetPanelOpen(title, mode) == 1;
|
||||
}
|
||||
_ui.WindowOpen = mode switch { RynthPanelOpen.Open => true, RynthPanelOpen.Close => false, _ => !_ui.WindowOpen };
|
||||
return _ui.WindowOpen;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -358,9 +362,7 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
_commands.Enqueue(parts);
|
||||
}
|
||||
|
||||
private bool IsVerb(string word) =>
|
||||
word.ToLowerInvariant() is "show" or "hide" or "toggle" or "info" or "help" or "on" or "off" or "auto"
|
||||
|| _serverVerbs.Contains(word);
|
||||
private bool IsVerb(string word) => ServerPackCommands.IsVerb(word, _serverVerbs);
|
||||
|
||||
/// <summary>Drops the server id: "/rserver coldeve info" -> "/rserver info".</summary>
|
||||
private static string[] Shift(string[] parts)
|
||||
|
|
@ -373,24 +375,26 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
|
||||
private void RunCommand(string[] parts)
|
||||
{
|
||||
string verb = parts.Length >= 2 ? parts[1].ToLowerInvariant() : "toggle";
|
||||
// Every /rserver answers in chat (2026-10-28, ServerPackCommands.cs). The window verbs say its
|
||||
// state; auto/on/off are answered by RynthCore's "/rc server" (or "RynthCore didn't take").
|
||||
ServerVerb verb = ServerPackCommands.Verb(parts, _serverVerbs);
|
||||
switch (verb)
|
||||
{
|
||||
case "show":
|
||||
SetWindow(RynthPanelOpen.Open);
|
||||
case ServerVerb.Show:
|
||||
Reply.Ok(ServerPackCommands.Window(Info.Name, SetWindow(RynthPanelOpen.Open)));
|
||||
return;
|
||||
case "hide":
|
||||
SetWindow(RynthPanelOpen.Close);
|
||||
case ServerVerb.Hide:
|
||||
Reply.Ok(ServerPackCommands.Window(Info.Name, SetWindow(RynthPanelOpen.Close)));
|
||||
return;
|
||||
case "toggle":
|
||||
SetWindow(RynthPanelOpen.Toggle);
|
||||
case ServerVerb.Toggle:
|
||||
Reply.Ok(ServerPackCommands.Window(Info.Name, SetWindow(RynthPanelOpen.Toggle)));
|
||||
return;
|
||||
case "auto":
|
||||
case "on":
|
||||
case "off":
|
||||
_engineCommands.Enqueue(ServerPackModel.ForceCommand(Info.Id, verb));
|
||||
case ServerVerb.Auto:
|
||||
case ServerVerb.On:
|
||||
case ServerVerb.Off:
|
||||
_engineCommands.Enqueue(ServerPackModel.ForceCommand(Info.Id, parts[1].ToLowerInvariant()));
|
||||
return;
|
||||
case "info":
|
||||
case ServerVerb.Info:
|
||||
PrintInfo();
|
||||
return;
|
||||
}
|
||||
|
|
@ -398,8 +402,9 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
bool handled = false;
|
||||
ServerChatCommand(parts, ref handled);
|
||||
if (handled) return;
|
||||
ChatLine($"[{RynthPluginInfo.Name}] {ChatCommand} [show|hide|toggle] - the {Info.Name} server card (also in the Mini Remote's Char section).");
|
||||
ChatLine($"[{RynthPluginInfo.Name}] {ChatCommand} info - what is known about {Info.Name}; {ChatCommand} auto|on|off - this character's override.");
|
||||
if (verb == ServerVerb.Unknown) Reply.Fail(ServerPackCommands.Unknown(parts[1]) + " " + ServerPackCommands.Usage(Info.Name)[0]);
|
||||
else ChatLine(ServerPackCommands.Usage(Info.Name)[0]);
|
||||
ChatLine(ServerPackCommands.Usage(Info.Name)[1]);
|
||||
}
|
||||
|
||||
private void PrintInfo()
|
||||
|
|
@ -416,8 +421,15 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
ServerInfoLines(line => ChatLine(tag + line));
|
||||
}
|
||||
|
||||
internal void ChatLine(string text)
|
||||
{
|
||||
if (Host.HasWriteToChat) Host.WriteToChat(text, 1);
|
||||
}
|
||||
// Chat lines wait in the shared reply queue (RynthSuite's Plugins/Shared/CommandReply.cs): the host drops
|
||||
// a line within 100 ms of another plugin's, so /rserver info's later lines used to go missing. A line
|
||||
// with its own "[...]" tag keeps it; one without gets "[<plugin name>]".
|
||||
private CommandReply? _reply;
|
||||
internal CommandReply Reply => _reply ??= new CommandReply($"[{RynthPluginInfo.Name}]",
|
||||
(t, c) => Host.HasWriteToChat && Host.WriteToChat(t, c), t => Host.Log(t));
|
||||
|
||||
internal void ChatLine(string text) => Reply.Ok(text);
|
||||
|
||||
/// <summary>A command that didn't work: why, and the usage (the failure colour).</summary>
|
||||
internal void ChatFail(string text) => Reply.Fail(text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)ServerPackUi.cs" Link="ServerPack\ServerPackUi.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ServerPackPlugin.cs" Link="ServerPack\ServerPackPlugin.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ServerPackExports.cs" Link="ServerPack\ServerPackExports.cs" />
|
||||
<!-- "/rserver ..." words and answers, and the shared reply queue they go through (2026-10-28). -->
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ServerPackCommands.cs" Link="ServerPack\ServerPackCommands.cs" />
|
||||
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
<!-- "RynthServer.Profile": the server's settings for other plugins (RynthPluginQueryInterface). -->
|
||||
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\RynthServerProfileApi.cs" Link="Shared\RynthServerProfileApi.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ServerPackProfile.cs" Link="ServerPack\ServerPackProfile.cs" />
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ internal static class Program
|
|||
RingEvadeTests.Register(runner);
|
||||
VaultedSwitchTests.Register(runner);
|
||||
T11Tests.Register(runner);
|
||||
ReplyTests.Register(runner);
|
||||
RemoteTabTests.Register(runner);
|
||||
StampTests.Register(runner);
|
||||
BankRosterTests.Register(runner);
|
||||
|
|
|
|||
130
Tools/RynthILT.Tests/ReplyTests.cs
Normal file
130
Tools/RynthILT.Tests/ReplyTests.cs
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using RynthCore.Plugin.RynthILT;
|
||||
using RynthCore.Plugin.RynthILT.Hub;
|
||||
using RynthCore.RynthAiHostTests.Fakes;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthILT.Tests;
|
||||
|
||||
// Every ILT command answers in chat (2026-10-28). The Hub's verbs ("/ilt hub ...", "/ra hub|guardian|
|
||||
// bounty|rates ...") run here on the fake engine host, each typed right and typed wrong, and must each
|
||||
// write a line of their own. The plugin-level window verbs (settings, stamps, breeding, fellow) need the
|
||||
// plugin's %APPDATA% folder, so their line (WindowReply) is checked on its own.
|
||||
internal static class ReplyTests
|
||||
{
|
||||
private const uint Player = 0x50000001;
|
||||
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("replies: every Hub verb answers in chat, typed right and wrong", HubVerbs);
|
||||
r.Add("replies: the plugin's window verbs say the window's state", WindowVerbs);
|
||||
}
|
||||
|
||||
private static IltHubController NewHub(string folder)
|
||||
{
|
||||
FakeHost.Reset();
|
||||
FakeAiHub.Reset();
|
||||
FakeHost.WorldName = "InfiniteLeaftide";
|
||||
var host = FakeHost.Create(Player);
|
||||
var ai = new RynthAiClient(host);
|
||||
ai.UseTableForTests(FakeAiHub.Table);
|
||||
string dir = Path.Combine(Program.TempRoot, "replies-" + folder);
|
||||
if (Directory.Exists(dir)) Directory.Delete(dir, recursive: true);
|
||||
Directory.CreateDirectory(dir);
|
||||
var hub = new IltHubController(host, dir, new IltSettings(), ai);
|
||||
hub.OnLoginComplete("Replier", forceFromMigration: false);
|
||||
return hub;
|
||||
}
|
||||
|
||||
/// <summary>Runs one Hub command; the lines it wrote (it must write one).</summary>
|
||||
private static string[] Answer(IltHubController hub, string verb, params string[] args)
|
||||
{
|
||||
FakeHost.Chat.Clear();
|
||||
bool handled = hub.HandleCommand(verb, args);
|
||||
string typed = ("/ra " + verb + " " + string.Join(" ", args)).Trim();
|
||||
Check.True(handled, typed + ": handled");
|
||||
Check.True(FakeHost.Chat.Count > 0, typed + ": answers in chat");
|
||||
return FakeHost.Chat.ToArray();
|
||||
}
|
||||
|
||||
private static void Says(IltHubController hub, string needle, string verb, params string[] args)
|
||||
{
|
||||
string[] lines = Answer(hub, verb, args);
|
||||
Check.True(lines.Any(l => l.Contains(needle, StringComparison.OrdinalIgnoreCase)),
|
||||
$"/ra {verb} {string.Join(" ", args)}: says '{needle}' (got: {string.Join(" / ", lines)})");
|
||||
}
|
||||
|
||||
private static void HubVerbs()
|
||||
{
|
||||
var hub = NewHub("hub");
|
||||
|
||||
// right forms
|
||||
Says(hub, "rates reset", "rates", "reset");
|
||||
Says(hub, "asked RynthCore to toggle", "bounty");
|
||||
Says(hub, "asked RynthCore to show", "guardian", "window", "show");
|
||||
Says(hub, "Mini Remote", "hub", "show");
|
||||
Says(hub, "Mini Remote", "hub", "open", "gear");
|
||||
Says(hub, "nothing to hide", "hub", "open", "character", "hide");
|
||||
Says(hub, "World 'InfiniteLeaftide'", "hub", "status");
|
||||
Says(hub, "Leaftide features", "hub", "features");
|
||||
Says(hub, "Force ILT world: on", "hub", "force", "on");
|
||||
Says(hub, "ILT world names", "hub", "servers");
|
||||
Says(hub, "Profiles:", "hub", "profile", "list");
|
||||
Says(hub, "Suits:", "hub", "suit", "list");
|
||||
Says(hub, "Reading the bank balance", "hub", "bank");
|
||||
Says(hub, "Sending /clap all", "hub", "clap");
|
||||
Says(hub, "Attribute raiser", "hub", "attr");
|
||||
Says(hub, "Attribute raiser", "hub", "attr", "run");
|
||||
Says(hub, "Attribute raiser", "hub", "attr", "stop");
|
||||
Says(hub, "Attribute raiser", "hub", "attr", "costs");
|
||||
Says(hub, "auto-raise on", "hub", "attr", "auto", "on");
|
||||
Says(hub, "every 10 min", "hub", "attr", "every", "10");
|
||||
Says(hub, "Attribute raiser", "hub", "attr", "raise", "str", "1");
|
||||
Says(hub, "Nothing to cancel", "hub", "cancel");
|
||||
Says(hub, "/ra hub [show|hide|toggle]", "hub", "help");
|
||||
|
||||
// "/ra hub open character" opens RynthOracle's tab: RynthOracle answers ("/ro character").
|
||||
FakeHost.ChatCommands.Clear();
|
||||
Check.True(hub.HandleCommand("hub", new[] { "open", "character" }) && FakeHost.ChatCommands.Contains("/ro character"),
|
||||
"/ra hub open character: runs /ro character (RynthOracle answers it)");
|
||||
|
||||
// wrong forms: why, and how it's typed
|
||||
Says(hub, "already waiting", "hub", "bank"); // the one sent above is still out
|
||||
Says(hub, "already waiting", "hub", "clap");
|
||||
Says(hub, "Usage: /ra hub open", "hub", "open", "wobble");
|
||||
Says(hub, "Usage: /ra hub profile", "hub", "profile", "wobble", "x");
|
||||
Says(hub, "Usage: /ra hub profile", "hub", "profile", "save");
|
||||
Says(hub, "Usage: /ra hub suit", "hub", "suit", "wobble");
|
||||
Says(hub, "Usage: /ra hub attr", "hub", "attr", "auto", "maybe");
|
||||
Says(hub, "Usage: /ra hub attr", "hub", "attr", "every", "soon");
|
||||
Says(hub, "Usage: /ra hub attr", "hub", "attr", "raise", "luck", "1");
|
||||
Says(hub, "Usage: /ra hub attr", "hub", "attr", "raise");
|
||||
Says(hub, "Usage: /ra hub attr", "hub", "attr", "wobble");
|
||||
Says(hub, "Usage: /ra hub servers", "hub", "servers", ",");
|
||||
Says(hub, "Nothing to confirm", "hub", "confirm");
|
||||
Says(hub, "/ra hub [show|hide|toggle]", "hub", "wobble");
|
||||
Says(hub, "/ra guardian", "guardian", "wobble");
|
||||
|
||||
// Vaulted Dungeons answers every word (off here: its master switch is off by default).
|
||||
foreach (string w in new[] { "on", "off", "toggle", "status", "wobble" })
|
||||
{
|
||||
FakeHost.Chat.Clear();
|
||||
hub.VaultedDungeons.HandleCommand(new[] { w });
|
||||
Check.True(FakeHost.Chat.Count > 0, $"/ilt vaulted {w}: answers");
|
||||
}
|
||||
|
||||
// The Hub's verbs as RynthILT takes them from RynthAi's /ra.
|
||||
foreach (string line in new[] { "hub bank", "hub attr run", "guardian status", "bounty", "rates reset", "t11", "ub qblist" })
|
||||
Check.True(RynthILTPlugin.IsIltVerb(line.Split(' ')), $"/ra {line} is RynthILT's");
|
||||
}
|
||||
|
||||
private static void WindowVerbs()
|
||||
{
|
||||
Check.Eq(RynthILTPlugin.WindowReply("ILT settings", true), "[RynthILT] ILT settings window shown.", "/ilt settings: shown");
|
||||
Check.Eq(RynthILTPlugin.WindowReply("Dynamic Stamps", false), "[RynthILT] Dynamic Stamps window hidden.", "/ilt stamps: hidden");
|
||||
foreach (string w in new[] { "ILT settings", "Dynamic Stamps", "Pet Breeding", "ILT fellowship" })
|
||||
Check.True(RynthILTPlugin.WindowReply(w, true).StartsWith("[RynthILT] " + w, StringComparison.Ordinal), $"{w}: its own line");
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ internal static class Program
|
|||
VaultTests.Register(runner);
|
||||
QuestPackTests.Register(runner);
|
||||
LevistrasTests.Register(runner);
|
||||
ServerPackCommandsTests.Register(runner);
|
||||
return runner.Run("RynthServerPack tests", args.Length > 0 ? args[0] : null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@
|
|||
<Compile Include="..\..\Plugins\Shared\ServerPack\ServerPackPages.cs" Link="Plugin\ServerPackPages.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\ServerPack\ServerPackSettings.cs" Link="Plugin\ServerPackSettings.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\ServerPack\ServerChatRequest.cs" Link="Plugin\ServerChatRequest.cs" />
|
||||
<!-- "/rserver" words and answers (2026-10-28) and the shared reply queue. -->
|
||||
<Compile Include="..\..\Plugins\Shared\ServerPack\ServerPackCommands.cs" Link="Plugin\ServerPackCommands.cs" />
|
||||
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
<!-- RynthConquest's own features (pure parts) and the RynthOracle sources it links. -->
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthConquest\Conquest\ConquestData.cs" Link="Conquest\ConquestData.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthConquest\Conquest\ConquestFeature.cs" Link="Conquest\ConquestFeature.cs" />
|
||||
|
|
|
|||
67
Tools/RynthServerPack.Tests/ServerPackCommandsTests.cs
Normal file
67
Tools/RynthServerPack.Tests/ServerPackCommandsTests.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.ServerPack;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthServerPack.Tests;
|
||||
|
||||
// Every "/rserver" command answers in chat (2026-10-28). RunCommand needs the plugin's host, so the words
|
||||
// (shared and a server's own, as RynthAelrynth's "vault"), the verb each one is, and the lines are checked
|
||||
// here, plus the shared reply queue the server plugins write through.
|
||||
internal static class ServerPackCommandsTests
|
||||
{
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("rserver: every word is a verb or a server id, typed right and wrong", Words);
|
||||
r.Add("rserver: the window, usage and unknown-word lines", Lines);
|
||||
r.Add("rserver: replies go through the shared queue, tagged with the plugin's name", Queue);
|
||||
}
|
||||
|
||||
private static readonly HashSet<string> Vault = new(StringComparer.OrdinalIgnoreCase) { "vault" };
|
||||
|
||||
private static void Words()
|
||||
{
|
||||
var table = new (string Line, ServerVerb Verb)[]
|
||||
{
|
||||
("/rserver", ServerVerb.Toggle), ("/rserver show", ServerVerb.Show), ("/rserver HIDE", ServerVerb.Hide),
|
||||
("/rserver toggle", ServerVerb.Toggle), ("/rserver info", ServerVerb.Info), ("/rserver help", ServerVerb.Help),
|
||||
("/rserver auto", ServerVerb.Auto), ("/rserver on", ServerVerb.On), ("/rserver off", ServerVerb.Off),
|
||||
("/rserver vault", ServerVerb.Server), ("/rserver wobble", ServerVerb.Unknown),
|
||||
};
|
||||
var seen = new HashSet<ServerVerb>();
|
||||
foreach (var (line, verb) in table)
|
||||
{
|
||||
ServerVerb got = ServerPackCommands.Verb(line.Split(' ', StringSplitOptions.RemoveEmptyEntries), Vault);
|
||||
Check.Eq(got, verb, $"'{line}'");
|
||||
seen.Add(got);
|
||||
}
|
||||
foreach (ServerVerb v in Enum.GetValues<ServerVerb>()) Check.True(seen.Contains(v), $"the table covers /rserver's {v}");
|
||||
Check.True(ServerPackCommands.IsVerb("Info", Vault) && ServerPackCommands.IsVerb("vault", Vault), "shared and own verbs");
|
||||
Check.False(ServerPackCommands.IsVerb("coldeve", Vault), "a server id isn't a verb (\"/rserver coldeve info\")");
|
||||
Check.Eq(ServerPackCommands.Verb(new[] { "/rserver", "vault" }, new HashSet<string>()), ServerVerb.Unknown, "another server's own verb is unknown here");
|
||||
}
|
||||
|
||||
private static void Lines()
|
||||
{
|
||||
Check.Eq(ServerPackCommands.Window("Coldeve", true), "The Coldeve window shown.", "show");
|
||||
Check.Eq(ServerPackCommands.Window("Coldeve", false), "The Coldeve window hidden.", "hide");
|
||||
string[] usage = ServerPackCommands.Usage("Coldeve");
|
||||
Check.Eq(usage.Length, 2, "two usage lines");
|
||||
Check.True(usage[0].Contains("/rserver [show|hide|toggle]") && usage[1].Contains("/rserver auto|on|off"), "the usage names every verb");
|
||||
Check.Eq(ServerPackCommands.Unknown("wobble"), "Unknown '/rserver wobble'.", "an unknown word");
|
||||
}
|
||||
|
||||
private static void Queue()
|
||||
{
|
||||
var chat = new List<(string, int)>();
|
||||
var r = new CommandReply("[RynthColdeve]", (t, c) => { chat.Add((t, c)); return true; });
|
||||
r.Ok(ServerPackCommands.Window("Coldeve", true));
|
||||
r.Fail("[RynthAelrynth] The account vault is Aelrynth's; RynthCore doesn't see this world as Aelrynth.");
|
||||
while (r.Flush()) { }
|
||||
Check.Eq(chat.Count, 2, "both lines written");
|
||||
Check.Eq(chat[0], ("[RynthColdeve] The Coldeve window shown.", CommandReply.OkChatType), "untagged: the plugin's tag, the ok colour");
|
||||
Check.Eq(chat[1].Item2, CommandReply.FailChatType, "a refusal: the failure colour");
|
||||
Check.True(chat[1].Item1.StartsWith("[RynthAelrynth] ", StringComparison.Ordinal), "a line with its own tag keeps it");
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@ namespace RynthThreads.Tests
|
|||
InferenceTests.Register(runner);
|
||||
StoreTests.Register(runner);
|
||||
WindowTests.Register(runner);
|
||||
ReplyTests.Register(runner);
|
||||
int rc = runner.Run("RynthThreads tests", args.Length > 0 ? args[0] : null);
|
||||
try { Directory.Delete(TempRoot, recursive: true); } catch { }
|
||||
return rc;
|
||||
|
|
|
|||
44
Tools/RynthThreads.Tests/ReplyTests.cs
Normal file
44
Tools/RynthThreads.Tests/ReplyTests.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthThreads;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthThreads.Tests;
|
||||
|
||||
// Every /rthreads command answers in chat (2026-10-28). RunCommand needs the plugin's host, so the words,
|
||||
// the verb each one is, and the lines are checked here.
|
||||
internal static class ReplyTests
|
||||
{
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("replies: every /rthreads word, typed right and wrong", Words);
|
||||
r.Add("replies: the window, help and unknown-word lines", Lines);
|
||||
}
|
||||
|
||||
private static void Words()
|
||||
{
|
||||
var table = new (string Typed, ThreadsVerb Verb)[]
|
||||
{
|
||||
("", ThreadsVerb.Window), ("stats", ThreadsVerb.Stats), ("STATS now", ThreadsVerb.Stats), ("export", ThreadsVerb.Export),
|
||||
("help", ThreadsVerb.Help), ("?", ThreadsVerb.Help), ("odds", ThreadsVerb.Unknown),
|
||||
};
|
||||
var seen = new HashSet<ThreadsVerb>();
|
||||
foreach (var (typed, verb) in table)
|
||||
{
|
||||
Check.Eq(ThreadsCommands.Parse(typed, out _), verb, $"'/rthreads {typed}'");
|
||||
seen.Add(verb);
|
||||
}
|
||||
foreach (ThreadsVerb v in Enum.GetValues<ThreadsVerb>()) Check.True(seen.Contains(v), $"the table covers /rthreads' {v}");
|
||||
ThreadsCommands.Parse("Odds please", out string word);
|
||||
Check.Eq(word, "odds", "the unknown word, for its line");
|
||||
}
|
||||
|
||||
private static void Lines()
|
||||
{
|
||||
Check.Eq(ThreadsCommands.Window(true), "The Threads window shown.", "toggle: shown");
|
||||
Check.Eq(ThreadsCommands.Window(false), "The Threads window hidden.", "toggle: hidden");
|
||||
Check.True(ThreadsCommands.Help.Contains("/rthreads stats") && ThreadsCommands.Help.Contains("/rthreads export"), "help names the verbs");
|
||||
Check.Eq(ThreadsCommands.Unknown("odds"), "Unknown '/rthreads odds'. Usage: /rthreads [stats | export | help]", "an unknown word");
|
||||
Check.True(ThreadsCommands.NoWindows.Contains("can't show plugin windows"), "no plugin windows: why");
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthThreads\**\*.cs" Exclude="..\..\Plugins\RynthCore.Plugin.RynthThreads\obj\**;..\..\Plugins\RynthCore.Plugin.RynthThreads\bin\**" Link="RynthThreads\%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
<Compile Include="..\..\..\RynthCore\src\RynthCore.Engine\UI\ScriptWindows\DisplayListParser.cs" Link="Engine\DisplayListParser.cs" />
|
||||
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
<!-- The RynthAi test tools' check/runner harness (no plugin code in it). -->
|
||||
<Compile Include="$(RynthSuiteRoot)Tools\RynthCore.RynthAiTests\Harness\Check.cs" Link="Harness\Check.cs" />
|
||||
<Compile Include="$(RynthSuiteRoot)Tools\RynthCore.RynthAiTests\Harness\Runner.cs" Link="Harness\Runner.cs" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue