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
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue