Snapshot for release 2026.10.28.3 (internal db7f094)
This commit is contained in:
parent
636adfcef2
commit
e6642d0e10
102 changed files with 4821 additions and 782 deletions
77
Plugins/RynthCore.Plugin.RynthOracle/OracleCommand.cs
Normal file
77
Plugins/RynthCore.Plugin.RynthOracle/OracleCommand.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
using RynthCore.Plugin.RynthOracle.Views;
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle;
|
||||
|
||||
internal enum OracleVerb { Window, Void, Timers, Quests, Tab, Trackers, Status, About, Help, Unknown }
|
||||
|
||||
/// <summary>A parsed "/ro ..." (the words after /ro, lower case): its verb, and the tab or the trackers it shows.</summary>
|
||||
internal readonly record struct OracleCommand(OracleVerb Verb, string Tab = "", QuestKind? Trackers = null, string Word = "")
|
||||
{
|
||||
/// <summary>The verbs that show a window (they need the engine's plugin windows).</summary>
|
||||
public bool ShowsWindow => Verb is OracleVerb.Window or OracleVerb.Void or OracleVerb.Timers or OracleVerb.Tab
|
||||
or OracleVerb.Trackers or OracleVerb.About;
|
||||
|
||||
public static OracleCommand Parse(string? arg)
|
||||
{
|
||||
string a = (arg ?? string.Empty).Trim().ToLowerInvariant();
|
||||
return a switch
|
||||
{
|
||||
"" => new(OracleVerb.Window),
|
||||
"void" => new(OracleVerb.Void),
|
||||
"timers" or "timer" => new(OracleVerb.Timers),
|
||||
"quests" or "refresh" => new(OracleVerb.Quests),
|
||||
// The main window on its Fellowship tab (RynthCore's Char menu and RynthAi's Mini Remote use this).
|
||||
"fellowship" or "fellow" or "fship" => new(OracleVerb.Tab, OracleView.TabFellowship),
|
||||
// The Character tab: the character overview and RynthAi's session. Shows, never toggles off.
|
||||
"character" or "char" => new(OracleVerb.Tab, OracleView.TabCharacter),
|
||||
// John's 30 Legendary Key quests: the Quests tab's Legendary rows.
|
||||
"legendary" or "legend" or "john" => new(OracleVerb.Trackers, OracleView.TabQuests, QuestKind.Legendary),
|
||||
// The 100 exploration markers: the Quests tab's marker rows (the old Markers tab).
|
||||
"markers" or "marker" => new(OracleVerb.Trackers, OracleView.TabQuests, QuestKind.Marker),
|
||||
// Every tracker: the Legendary Key quests and the exploration markers.
|
||||
"trackers" => new(OracleVerb.Trackers, OracleView.TabQuests),
|
||||
// The Skills tab: RynthCore's skills panel (raise and train) inside this window.
|
||||
"skills" or "skill" => new(OracleVerb.Tab, OracleView.TabSkills),
|
||||
"attributes" or "attrs" or "attribute" or "vitals" => new(OracleVerb.Tab, OracleView.TabAttributes),
|
||||
"progress" or "progression" => new(OracleVerb.Tab, OracleView.TabProgress),
|
||||
"status" => new(OracleVerb.Status),
|
||||
"about" => new(OracleVerb.About, OracleView.TabAbout),
|
||||
"help" or "?" => new(OracleVerb.Help),
|
||||
_ => new(OracleVerb.Unknown, Word: a),
|
||||
};
|
||||
}
|
||||
|
||||
public const string Usage =
|
||||
"Commands: /ro (window), /ro character (Character tab: status, session), "
|
||||
+ "/ro skills|attributes|progress (those tabs), /ro void (Void window), "
|
||||
+ "/ro timers (Quest Timers window), /ro fellowship (Fellowship tab), "
|
||||
+ "/ro trackers (Quests tab, trackers only), /ro legendary (John's 30 key quests), /ro markers, "
|
||||
+ "/ro quests (read quest flags), /ro status, "
|
||||
+ "/ro about (About tab: settings, server, quest list). A server's own pages are its server plugin's (/rserver).";
|
||||
|
||||
public const string NoWindows =
|
||||
"This RynthCore engine can't show plugin windows (it needs script windows, API v71, with ImGui on). /ro status still works.";
|
||||
|
||||
// ── What /ro answers (2026-10-28: every command answers, Plugins/Shared/CommandReply.cs) ──
|
||||
|
||||
public static string Shown(string window, bool shown) => CommandReply.Shown(window, shown);
|
||||
|
||||
public static string OnTab(string tab) => $"Oracle window shown on its {tab} tab.";
|
||||
|
||||
public static string OnTrackers(QuestKind? kind) => kind switch
|
||||
{
|
||||
QuestKind.Legendary => "Oracle window shown on the Quests tab: the Legendary Key quests.",
|
||||
QuestKind.Marker => "Oracle window shown on the Quests tab: the exploration markers.",
|
||||
_ => "Oracle window shown on the Quests tab: every tracker.",
|
||||
};
|
||||
|
||||
/// <summary>"/ro quests": a /myquests sent, or why not (out of the world, the server's one-a-minute limit, one already out).</summary>
|
||||
public static (bool Ok, string Text) Quests(bool inWorld, bool sent, int waitSeconds) =>
|
||||
!inWorld ? (false, "Log in first: the quest flags come from the server's /myquests.")
|
||||
: sent ? (true, "Reading your quest flags (/myquests)...")
|
||||
: waitSeconds > 0 ? (false, $"The server answers one /myquests a minute; try again in {waitSeconds}s (the flags shown are kept).")
|
||||
: (false, "/myquests was sent moments ago; waiting for that reply.");
|
||||
|
||||
public static string Unknown(string word) => $"Unknown '/ro {word}'. {Usage}";
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle;
|
||||
|
|
@ -81,11 +82,24 @@ internal sealed class OracleContext
|
|||
|
||||
public Func<uint, int> Props => id => Character.Int(Host, id);
|
||||
|
||||
/// <summary>
|
||||
/// The plugin's chat lines, queued and written by the tick (Plugins/Shared/CommandReply.cs: the host
|
||||
/// drops a line within 100 ms of another plugin's, so a quest's several lines used to go missing).
|
||||
/// Null before Initialize (and in the offline tests, which use <see cref="PrintSink"/>).
|
||||
/// </summary>
|
||||
public CommandReply? Reply;
|
||||
|
||||
/// <summary>A line in the player's chat window only (nothing is sent to the server).</summary>
|
||||
public void Print(string text)
|
||||
public void Print(string text) => Print(text, ok: true);
|
||||
|
||||
/// <summary>A line saying a command didn't work (the failure colour).</summary>
|
||||
public void PrintFail(string text) => Print(text, ok: false);
|
||||
|
||||
private void Print(string text, bool ok)
|
||||
{
|
||||
if (PrintSink != null) { PrintSink(text); return; }
|
||||
if (!Host.WriteToChat("[RynthOracle] " + text, 1))
|
||||
if (Reply != null) { Reply.Say(ok, text); return; }
|
||||
if (!Host.WriteToChat("[RynthOracle] " + text, ok ? CommandReply.OkChatType : CommandReply.FailChatType))
|
||||
Host.Log("[RynthOracle] " + text);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@
|
|||
<!-- "RynthServer.QuestPack": the active server plugin's quest pack, merged into the Quests list. -->
|
||||
<Compile Include="..\Shared\RynthServerQuestPackApi.cs" Link="Shared\RynthServerQuestPackApi.cs" />
|
||||
<Compile Include="..\Shared\ServerQuestPackClient.cs" Link="Shared\ServerQuestPackClient.cs" />
|
||||
<!-- How a chat command answers (2026-10-28): the shared reply queue and colours. -->
|
||||
<Compile Include="..\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Concurrent;
|
|||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
using RynthCore.Plugin.RynthOracle.Views;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginCore;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle;
|
||||
|
|
@ -46,7 +47,6 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
private int _seenFlagRevision = -1, _seenCatalogRevision = -1, _seenVoidRevision = -1;
|
||||
// RynthCore's server list (ServerStateClient.Revision) last applied to the server identity.
|
||||
private int _seenServerStateRevision = -1;
|
||||
private bool _noUiLogged;
|
||||
private string? _catalogKey; // what the catalog was loaded for (QuestPackSource.Key; "" = retail only)
|
||||
private int _seenPackRevision = -1; // the active server plugin's quest pack (ServerQuestPackClient.Revision)
|
||||
private int _titleCount = -2;
|
||||
|
|
@ -55,6 +55,7 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
public override int Initialize()
|
||||
{
|
||||
_c.Host = Host;
|
||||
_c.Reply = new CommandReply("[RynthOracle]", (t, c) => Host.WriteToChat(t, c), t => Host.Log(t));
|
||||
_c.Settings.Load();
|
||||
_c.RequestQuests = RequestQuests;
|
||||
_c.RereadCharacter = RereadCharacter;
|
||||
|
|
@ -306,91 +307,62 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
|
||||
private void RunCommand(string arg)
|
||||
{
|
||||
switch (arg)
|
||||
// Every /ro answers in chat (2026-10-28, OracleCommand.cs; Plugins/Shared/CommandReply.cs). RynthOracle
|
||||
// can't tell a typed /ro from a meta's or another plugin's menu (they all come through chat), so
|
||||
// each one does.
|
||||
OracleCommand c = OracleCommand.Parse(arg);
|
||||
// A window shown: says so, or (an engine without plugin windows) why nothing shows.
|
||||
void Shown(string text)
|
||||
{
|
||||
case "":
|
||||
if (_main != null) { _main.Visible = !_main.Visible; _main.NeedsPass = true; }
|
||||
if (Host.HasUi) _c.Print(text);
|
||||
else _c.PrintFail(OracleCommand.NoWindows);
|
||||
}
|
||||
switch (c.Verb)
|
||||
{
|
||||
case OracleVerb.Window:
|
||||
if (_main != null) { _main.Visible = !_main.Visible; _main.NeedsPass = true; Shown(OracleCommand.Shown("Oracle window", _main.Visible)); }
|
||||
break;
|
||||
case "void":
|
||||
if (_void != null) { _void.Visible = !_void.Visible; _void.NeedsPass = true; }
|
||||
case OracleVerb.Void:
|
||||
if (_void != null) { _void.Visible = !_void.Visible; _void.NeedsPass = true; Shown(OracleCommand.Shown("Void window", _void.Visible)); }
|
||||
break;
|
||||
case "timers":
|
||||
case "timer":
|
||||
if (_timers != null) SetQuestTimers(!_timers.Visible);
|
||||
case OracleVerb.Timers:
|
||||
if (_timers != null) { SetQuestTimers(!_timers.Visible); Shown(OracleCommand.Shown("Quest Timers window", _timers.Visible)); }
|
||||
break;
|
||||
case "quests":
|
||||
case "refresh":
|
||||
RequestQuests();
|
||||
case OracleVerb.Quests:
|
||||
{
|
||||
bool sent = RequestQuests();
|
||||
var (ok, text) = OracleCommand.Quests(_c.InWorld, sent, _c.Flags.ThrottleSecondsLeft(Environment.TickCount64));
|
||||
if (ok) _c.Print(text); else _c.PrintFail(text);
|
||||
break;
|
||||
case "fellowship":
|
||||
case "fellow":
|
||||
case "fship":
|
||||
// The main window on its Fellowship tab (RynthCore's Char menu and RynthAi's Mini Remote use this).
|
||||
ShowTab(OracleView.TabFellowship);
|
||||
}
|
||||
case OracleVerb.Tab:
|
||||
// RynthAi, the server plugins and RynthCore's menus link to these; they show, never toggle off.
|
||||
ShowTab(c.Tab);
|
||||
Shown(OracleCommand.OnTab(c.Tab));
|
||||
break;
|
||||
case "character":
|
||||
case "char":
|
||||
// The Character tab: the character overview and RynthAi's session.
|
||||
// RynthAi, the server plugins and RynthCore's menus link here; it shows, never toggles off.
|
||||
ShowTab(OracleView.TabCharacter);
|
||||
case OracleVerb.Trackers:
|
||||
// A server's own trackers and tabs are its server plugin's pages (since 2026-10-21).
|
||||
ShowTrackers(c.Trackers);
|
||||
Shown(OracleCommand.OnTrackers(c.Trackers));
|
||||
break;
|
||||
case "legendary":
|
||||
case "legend":
|
||||
case "john":
|
||||
// John's 30 Legendary Key quests: the Quests tab's Legendary rows.
|
||||
ShowTrackers(QuestKind.Legendary);
|
||||
break;
|
||||
case "markers":
|
||||
case "marker":
|
||||
// The 100 exploration markers: the Quests tab's marker rows (the old Markers tab).
|
||||
ShowTrackers(QuestKind.Marker);
|
||||
break;
|
||||
case "trackers":
|
||||
// Every tracker: the Legendary Key quests and the exploration markers. A server's own
|
||||
// trackers and tabs are its server plugin's pages (since 2026-10-21).
|
||||
ShowTrackers(null);
|
||||
break;
|
||||
case "skills":
|
||||
case "skill":
|
||||
// The Skills tab: RynthCore's skills panel (raise and train) inside this window.
|
||||
ShowTab(OracleView.TabSkills);
|
||||
break;
|
||||
case "attributes":
|
||||
case "attrs":
|
||||
case "attribute":
|
||||
case "vitals":
|
||||
ShowTab(OracleView.TabAttributes);
|
||||
break;
|
||||
case "progress":
|
||||
case "progression":
|
||||
ShowTab(OracleView.TabProgress);
|
||||
break;
|
||||
case "status":
|
||||
case OracleVerb.Status:
|
||||
string titles = _c.TitlesKnown ? $", {_c.EarnedTitles.Count} titles held" : "";
|
||||
_c.Print($"Server: {_c.Server.DisplayName} ({_c.Server.Source}). "
|
||||
+ $"{_c.Flags.Flags.Count} quest flags read, {_c.Catalog.RetailCount} retail quests{PackText()}, {_c.Void.Dots.Count} Void spells tracked{titles}.");
|
||||
break;
|
||||
case "about":
|
||||
case OracleVerb.About:
|
||||
// The About tab (settings, the server RynthCore says this is, the quest list).
|
||||
_c.Print("Based on Oracle of Dereth by Advis Eveldan - thank you! github.com/advis61/OracleOfDereth (MIT)");
|
||||
ShowTab(OracleView.TabAbout);
|
||||
ShowTab(c.Tab);
|
||||
if (!Host.HasUi) _c.PrintFail(OracleCommand.NoWindows);
|
||||
break;
|
||||
case OracleVerb.Help:
|
||||
_c.Print(OracleCommand.Usage);
|
||||
break;
|
||||
default:
|
||||
_c.Print("Commands: /ro (window), /ro character (Character tab: status, session), "
|
||||
+ "/ro skills|attributes|progress (those tabs), /ro void (Void window), "
|
||||
+ "/ro timers (Quest Timers window), /ro fellowship (Fellowship tab), "
|
||||
+ "/ro trackers (Quests tab, trackers only), /ro legendary (John's 30 key quests), /ro markers, "
|
||||
+ "/ro quests (read quest flags), /ro status, "
|
||||
+ "/ro about (About tab: settings, server, quest list). A server's own pages are its server plugin's (/rserver).");
|
||||
_c.PrintFail(OracleCommand.Unknown(c.Word));
|
||||
break;
|
||||
}
|
||||
if (arg is "" or "void" or "timers" or "timer" or "fellowship" or "fellow" or "fship" or "character" or "char"
|
||||
or "skills" or "skill" or "attributes" or "attrs" or "attribute" or "vitals" or "progress" or "progression"
|
||||
or "legendary" or "legend" or "john" or "markers" or "marker" or "trackers" or "about" && !Host.HasUi && !_noUiLogged)
|
||||
{
|
||||
_noUiLogged = true;
|
||||
_c.Print("This RynthCore engine can't show plugin windows (it needs script windows, API v71, with ImGui on). /ro status still works.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sends /myquests; false when nothing went out (not in the world, or one was sent moments ago).</summary>
|
||||
|
|
@ -462,6 +434,7 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_c.UtcNow = DateTime.UtcNow;
|
||||
|
||||
while (_commands.TryDequeue(out string? cmd)) RunCommand(cmd);
|
||||
_c.Reply?.Flush();
|
||||
|
||||
_ui.Poll(Host);
|
||||
TickData(now);
|
||||
|
|
|
|||
Loading…
Reference in a new issue