RynthServers as of 2026-11-10 (internal 5a8f64b): release 2026.11.10.1
This commit is contained in:
parent
3dd7e983c3
commit
8547236e48
27 changed files with 2961 additions and 16 deletions
|
|
@ -32,7 +32,10 @@
|
|||
// SetProfileValue(key, n) a live number in its "RynthServer.Profile" ("values"), for other
|
||||
// plugins that apply a server rule without knowing the server.
|
||||
// ServerCommandVerbs(list) its own "/rserver <verb>" words, handled in ServerChatCommand.
|
||||
// ServerUsageLines(add) the usage lines for those words, after the shared two (help, unknown word).
|
||||
// RunOnTick(action) work for the next tick (a page's button, on the render thread).
|
||||
// ServerCardActions() the server's own buttons at the top of its card, under RynthCore's verdict
|
||||
// (render thread: ImGui calls only; queue work with RunOnTick).
|
||||
// Send(command) a chat command as if typed (pump thread, logged in only);
|
||||
// LogTagged(text) the engine log, "[RynthConquest] ..."; ChatLine(text) the chat window.
|
||||
// Resources\quests.<id>.csv (no code) the server's own quest list: embedded by ServerPlugin.props and
|
||||
|
|
@ -74,6 +77,8 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
private readonly List<ServerPage> _pages;
|
||||
// The server's own windows (ServerWindows), validated the same way.
|
||||
private readonly List<ServerWindow> _windows;
|
||||
// The server window's bar-icon dropdown (ServerBarMenu), for the sections manifest.
|
||||
private readonly List<ServerBarMenuItem> _barMenu = new();
|
||||
private readonly List<string> _pageNotes = new();
|
||||
private readonly ServerPackSettings _settings = new(ServerPackSettings.DefaultPath(RynthPluginInfo.Name));
|
||||
private readonly ServerProfileValues _profileValues = new();
|
||||
|
|
@ -85,6 +90,8 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
private readonly ConcurrentQueue<Action> _tickActions = new();
|
||||
// The server's own "/rserver" verbs (ServerCommandVerbs).
|
||||
private readonly HashSet<string> _serverVerbs = new(StringComparer.OrdinalIgnoreCase);
|
||||
// The server's own "/rserver" usage lines (ServerUsageLines), after the shared two.
|
||||
private readonly List<string> _usageLines = new();
|
||||
private volatile bool _loginComplete;
|
||||
private volatile string? _world;
|
||||
private bool _wasActive;
|
||||
|
|
@ -102,7 +109,9 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
var verbs = new List<string>();
|
||||
ServerCommandVerbs(verbs);
|
||||
foreach (string v in verbs) if (!string.IsNullOrWhiteSpace(v)) _serverVerbs.Add(v.Trim());
|
||||
_ui = new ServerPackUi(_model, RynthPluginInfo.Name + " " + Marshal.PtrToStringAnsi(VersionPointer), () => _world, _pages);
|
||||
ServerUsageLines(_usageLines.Add);
|
||||
_ui = new ServerPackUi(_model, RynthPluginInfo.Name + " " + Marshal.PtrToStringAnsi(VersionPointer), () => _world, _pages, DrawCardActions);
|
||||
ServerBarMenu(_barMenu);
|
||||
}
|
||||
|
||||
internal ServerPackInfo Info => _model.Info;
|
||||
|
|
@ -133,6 +142,11 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
/// instead of being read as another server's id. Called once, from the constructor.
|
||||
/// </summary>
|
||||
partial void ServerCommandVerbs(List<string> verbs);
|
||||
/// <summary>
|
||||
/// Usage lines for the server's own verbs, printed after the shared two by "/rserver help" and an
|
||||
/// unknown word. Called once, from the constructor (no Host yet).
|
||||
/// </summary>
|
||||
partial void ServerUsageLines(Action<string> add);
|
||||
/// <summary>Extra lines for "/rserver info".</summary>
|
||||
partial void ServerInfoLines(Action<string> line);
|
||||
/// <summary>The server's own pages (ServerPackPages.cs). Called once, from the constructor (no Host yet).</summary>
|
||||
|
|
@ -147,6 +161,15 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
/// <summary>Every frame while logged in (render thread, AC's main thread; the engine's ImGui context current).</summary>
|
||||
partial void ServerRender();
|
||||
/// <summary>
|
||||
/// Items for a hover dropdown on the server window's bar icon (RynthCore API 95; an older engine
|
||||
/// ignores it). Called once, from the constructor (no Host yet).
|
||||
/// </summary>
|
||||
partial void ServerBarMenu(List<ServerBarMenuItem> items);
|
||||
/// <summary>
|
||||
/// Drawn at the top of the server card, under RynthCore's verdict; render thread; queue work with RunOnTick.
|
||||
/// </summary>
|
||||
partial void ServerCardActions();
|
||||
/// <summary>
|
||||
/// An incoming chat line (pump thread, logged in only): set <paramref name="eat"/> to keep it out of
|
||||
/// the chat window (it comes in true when an earlier plugin already ate it).
|
||||
/// </summary>
|
||||
|
|
@ -165,6 +188,9 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
/// <summary>The live numbers of the profile ("values"). Any thread.</summary>
|
||||
internal ServerProfileValues ProfileValues => _profileValues;
|
||||
|
||||
// A delegate cannot bind an unimplemented partial method (CS0762), so the card gets this wrapper.
|
||||
private void DrawCardActions() => ServerCardActions();
|
||||
|
||||
/// <summary>The pages this plugin draws.</summary>
|
||||
internal IReadOnlyList<ServerPage> Pages => _pages;
|
||||
|
||||
|
|
@ -250,6 +276,9 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
catch (Exception ex) { LogTagged($"A queued action failed: {ex.GetType().Name}: {ex.Message}"); }
|
||||
}
|
||||
|
||||
// A queued web-panel open is answered from here (ServerPackWeb.cs).
|
||||
PollWeb();
|
||||
|
||||
bool active = Active;
|
||||
if (active && !_wasActive && Info.Botting == BottingPolicy.Forbidden)
|
||||
ChatLine($"[{RynthPluginInfo.Name}] {Info.Name} forbids bots: don't run RynthAi's combat, navigation or looting here.");
|
||||
|
|
@ -280,7 +309,7 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
/// </summary>
|
||||
internal string? BuildSectionsJson()
|
||||
=> _sectionsJson ??= ServerPackModel.BuildSectionsJson(Info, RynthPluginInfo.Name, _pages, _windows,
|
||||
frameless: _windows.Count > 0 && Host.HasFramelessWindows);
|
||||
frameless: _windows.Count > 0 && Host.HasFramelessWindows, barMenu: _barMenu);
|
||||
|
||||
/// <summary>
|
||||
/// RynthPluginRenderEmbed "window:<id>": one of the server's own windows (ServerWindows), into the
|
||||
|
|
@ -466,9 +495,10 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
bool handled = false;
|
||||
ServerChatCommand(parts, ref handled);
|
||||
if (handled) return;
|
||||
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]);
|
||||
string[] usage = ServerPackCommands.Usage(Info.Name, _usageLines);
|
||||
if (verb == ServerVerb.Unknown) Reply.Fail(ServerPackCommands.Unknown(parts[1]) + " " + usage[0]);
|
||||
else ChatLine(usage[0]);
|
||||
for (int i = 1; i < usage.Length; i++) ChatLine(usage[i]);
|
||||
}
|
||||
|
||||
private void PrintInfo()
|
||||
|
|
|
|||
Loading…
Reference in a new issue