diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..a562d9f
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,24 @@
+# Contributing to RynthCore
+
+RynthCore is the hook layer: it injects into the client, reads the game, runs plugins and hosts their windows. Features belong to plugins (RynthSuite), and features for one game server belong to that server's plugin.
+
+## What goes here
+
+- Hooks into the client and readers of game state (objects, inventory, vitals, positions, chat, spells).
+- The plugin API (`src/RynthCore.PluginSdk`) and its versions: a new capability is a generic function every plugin can use.
+- The window host: the ImGui shell, panels and pop-outs, themes, fonts, the sections rail.
+- Services every plugin can use: settings files, status export, logging, hotkeys, the launcher and updater.
+
+## What doesn't
+
+- A feature of one plugin, including its screens: plugins draw their own windows with the engine's ImGui.
+- Anything for one game server: that server's plugin in RynthSuite.
+
+When a plugin needs something the engine can't do yet, add the generic hook here and build the feature in the plugin.
+
+## Pull requests
+
+- One purpose per pull request; a change that spans RynthCore and RynthSuite comes as a pull request to each, the hook first.
+- Plugin API numbers and versions are assigned when a change is merged.
+- Add or update the offline checks under `tools/` where they exist.
+- Say in the description what you tested in game and on which server.
diff --git a/installer/Publish-Update.ps1 b/installer/Publish-Update.ps1
index 0b2118f..ef1a611 100644
--- a/installer/Publish-Update.ps1
+++ b/installer/Publish-Update.ps1
@@ -38,6 +38,9 @@ param(
[string]$BaseUrl = "https://aelrynth.com/downloads/rynth",
[string]$KeyDir = (Join-Path $env:USERPROFILE ".rynthcore-update-signing"),
[string]$RynthSuiteRoot = "",
+ # The server plugins' repository (2026-10-21), beside RynthSuite (it compiles RynthSuite's shared
+ # contracts and the same RynthCore SDK, so their shared DLLs match). Defaults to ..\RynthServers.
+ [string]$RynthServersRoot = "",
[string]$TrustFile = "", # defaults to the launcher's UpdateTrust.cs; override for tests
# RynthNav's data shipped to launchers as the signed "navdata" archive: tiles (nav_XXXX.tile),
# portals.tsv and locations.json from this folder. Only re-uploaded when the set changes
@@ -56,6 +59,11 @@ $ErrorActionPreference = "Stop"
$ScriptDir = $PSScriptRoot
$RepoRoot = Split-Path $ScriptDir -Parent
if (-not $RynthSuiteRoot) { $RynthSuiteRoot = Join-Path (Split-Path $RepoRoot -Parent) "RynthSuite" }
+if (-not $RynthServersRoot) { $RynthServersRoot = Join-Path (Split-Path $RynthSuiteRoot -Parent) "RynthServers" }
+if (-not (Test-Path (Join-Path $RynthServersRoot "Plugins"))) { throw "No RynthServers checkout at $RynthServersRoot (pass -RynthServersRoot)." }
+if ((Resolve-Path (Split-Path $RynthServersRoot -Parent)).Path -ne (Resolve-Path (Split-Path $RynthSuiteRoot -Parent)).Path) {
+ throw "RynthServers ($RynthServersRoot) must sit beside RynthSuite ($RynthSuiteRoot): it builds against that RynthSuite and RynthCore."
+}
if (-not $TrustFile) { $TrustFile = Join-Path $RepoRoot "src\RynthCore.App.Avalonia\UpdateTrust.cs" }
function Step($m) { Write-Host ""; Write-Host "== $m" -ForegroundColor Cyan }
@@ -105,11 +113,11 @@ try {
Write-Host " signing key is trusted by the launcher ($($trusted.Count) keys)"
if (-not $AllowDirty) {
- foreach ($repo in $RepoRoot, $RynthSuiteRoot) {
+ foreach ($repo in $RepoRoot, $RynthSuiteRoot, $RynthServersRoot) {
$dirty = git -C $repo status --porcelain --untracked-files=no
if ($dirty) { throw "$repo has uncommitted changes — release from committed code (or pass -AllowDirty):`n$dirty" }
}
- Write-Host " RynthCore $(git -C $RepoRoot rev-parse --short HEAD), RynthSuite $(git -C $RynthSuiteRoot rev-parse --short HEAD)"
+ Write-Host " RynthCore $(git -C $RepoRoot rev-parse --short HEAD), RynthSuite $(git -C $RynthSuiteRoot rev-parse --short HEAD), RynthServers $(git -C $RynthServersRoot rev-parse --short HEAD)"
}
$liveManifest = $null
@@ -134,25 +142,30 @@ New-Item -ItemType Directory -Force "$rel\plugins", "$rel\build" | Out-Null
# (RynthCore.PluginSdk, PluginCore, ImGui.NET, MoonSharp, ...) go into the installer's
# Runtime\PluginShared, where the engine (API 88) finds them. The plugins declare minEngineApi 88,
# so an older engine refuses them instead of failing to load them. -NativeAotPlugins: the old builds.
-$suitePlugins = "RynthChat", "RynthTracker", "RynthNav", "RynthVision", "RynthLua", "RynthOracle", "RynthInventory", "RynthSort", "RynthILT", "RynthThreads", "RynthNet"
-# Server plugins (Plugins\Shared\ServerPack; SilentKelpie's): one per game server, each loaded by the
-# engine only for its own server. They go in the feed only, so the launcher offers each one under
-# Available plugins for the player to install; not in RynthSuite-Plugins.zip or the installer.
+$suitePlugins = "RynthChat", "RynthTracker", "RynthNav", "RynthVision", "RynthLua", "RynthOracle", "RynthInventory", "RynthSort", "RynthNet"
+# Server plugins (the RynthServers repository since 2026-10-21; ServerPack is SilentKelpie's): one per
+# game server, each loaded by the engine only for its own server. They go in the feed only, so the
+# launcher offers each one on its Server plugins tab for the player to install; not in
+# RynthSuite-Plugins.zip or the installer. RynthILT and RynthThreads were in the zip until 2026-10-21.
$serverPlugins = "RynthAChard", "RynthAelrynth", "RynthColdeve", "RynthConquest", "RynthDerptide", "RynthDreamWeave", "RynthEversong",
- "RynthFrostACE", "RynthFrostcull", "RynthLeafDawn", "RynthLeafdawning", "RynthPortalStorm", "RynthReefcull", "RynthSundering", "RynthThistlecrown"
+ "RynthFrostACE", "RynthFrostcull", "RynthILT", "RynthLeafDawn", "RynthLeafdawning", "RynthLevistras", "RynthPortalStorm",
+ "RynthReefcull", "RynthSundering", "RynthThistlecrown", "RynthThreads"
$managedArgs = if ($NativeAotPlugins) { @() } else {
@("-p:PublishAot=false", "-p:NativeLib=", "-p:SelfContained=false", "-p:RuntimeIdentifier=win-x86",
"-p:GenerateRuntimeConfigurationFiles=false", "-p:RynthPluginMinEngineApi=88")
}
-function Build-Plugin([string]$name, [string]$label) {
+function Build-Plugin([string]$name, [string]$label, [string]$root = $RynthSuiteRoot, [string[]]$extra = @()) {
Step "Building $name$label"
- $proj = Join-Path $RynthSuiteRoot "Plugins\RynthCore.Plugin.$name\RynthCore.Plugin.$name.csproj"
+ $proj = Join-Path $root "Plugins\RynthCore.Plugin.$name\RynthCore.Plugin.$name.csproj"
+ if (-not (Test-Path $proj)) { throw "No project for $name at $proj" }
# PublishDir overrides the projects' own (RynthNav/RynthVision publish into the live C:\Games folders).
- dotnet publish $proj -c Release "-p:Version=$Version" "-p:PublishDir=$rel\build\$name\" @managedArgs -v q -nologo
+ dotnet publish $proj -c Release "-p:Version=$Version" "-p:PublishDir=$rel\build\$name\" @managedArgs @extra -v q -nologo
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed for $name" }
}
foreach ($name in @("RynthAi") + $suitePlugins) { Build-Plugin $name "" }
-foreach ($name in $serverPlugins) { Build-Plugin $name " (server plugin, feed only)" }
+# Against this release's RynthSuite, whatever RynthServers' own Directory.Build.props would pick.
+$suiteRootArg = "-p:RynthSuiteRoot=$((Resolve-Path $RynthSuiteRoot).Path.TrimEnd('\'))\"
+foreach ($name in $serverPlugins) { Build-Plugin $name " (server plugin, feed only)" $RynthServersRoot @($suiteRootArg) }
$sharedDir = ""
if (-not $NativeAotPlugins) {
@@ -233,11 +246,13 @@ Extract this zip into C:\Games - it creates:
C:\Games\RynthSuite\RynthOracle\ RynthOracle plugin (quests, character, titles; based on Oracle of Dereth by Advis Eveldan)
C:\Games\RynthSuite\RynthInventory\ RynthInventory plugin (search every character's items)
C:\Games\RynthSuite\RynthSort\ RynthSort plugin (keeps your packs sorted; replaces the RynthSort Lua script)
- C:\Games\RynthSuite\RynthILT\ RynthILT plugin (Infinite Leaftide only: the ILT Hub, Guardian, bounties, progression)
- C:\Games\RynthSuite\RynthThreads\ RynthThreads plugin (DreamWeave only: Fragment Press results, what each component brings)
C:\Games\RynthSuite\RynthNet\ RynthNet plugin (links your clients on this PC: /ub bc, shared vitals, the Characters panel)
C:\Games\RynthCore\NavData\ RynthNav's portals and Atlas
+Plugins for one game server (RynthILT for Infinite Leaftide, RynthThreads for
+DreamWeave, and one per server) are not in this zip: install yours from the
+launcher's Server plugins tab.
+
Then, in the RynthCore launcher's Plugins tab, add the full path of each
plugin DLL you want. Install RynthCore first (RynthCore-Setup.exe), which
also installs RynthAi and the Loot Editor. After that the launcher keeps
diff --git a/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs b/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs
index 265cccf..1afac02 100644
--- a/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs
+++ b/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs
@@ -97,6 +97,8 @@ namespace RynthCore.Engine.Compatibility;
internal static class RynthCoreChatCommands
{
private const string Prefix = "/rc ";
+ /// RynthNet's Characters window (a plugin window: its title is its panel key).
+ private const string CharactersWindowTitle = "Characters";
/// The Settings tab with the server picker (UI/Data/SettingsData.cs "Diagnostics").
private const string DiagnosticsTabName = "Diagnostics";
@@ -533,11 +535,11 @@ internal static class RynthCoreChatCommands
case "characters":
case "chars":
- // The ImGui Characters panel (your other RynthCore clients, through RynthNet).
- if (!ImGuiBackend.ImGuiPanelHost.HasFace(ImGuiBackend.Panels.CharactersFace.Title))
- Reply("The Characters panel needs the RynthNet plugin (add it in the launcher's Plugins tab).");
+ // The Characters window: RynthNet's own since 2026-10-21 (a plugin window, keyed by its title).
+ if (!ImGuiBackend.ImGuiPanelHost.HasFace(CharactersWindowTitle))
+ Reply("The Characters window comes with the RynthNet plugin (add it in the launcher's Plugins tab).");
else
- UI.PanelRouter.Toggle(ImGuiBackend.Panels.CharactersFace.Title);
+ UI.PanelRouter.Toggle(CharactersWindowTitle);
return true;
case "itemcount":
diff --git a/src/RynthCore.Engine/EntryPoint.cs b/src/RynthCore.Engine/EntryPoint.cs
index 6ba2339..8535cc1 100644
--- a/src/RynthCore.Engine/EntryPoint.cs
+++ b/src/RynthCore.Engine/EntryPoint.cs
@@ -1193,9 +1193,8 @@ public static class EntryPoint
ImGuiBackend.Panels.RynthNavFace.Register();
if (HasPluginDll("RynthCore.Plugin.RynthNav.dll"))
ImGuiBackend.Panels.WorldMapFace.Register();
- // Characters (your other RynthCore clients, through RynthNet): only with RynthNet installed.
- if (HasPluginDll("RynthCore.Plugin.RynthNet.dll"))
- ImGuiBackend.Panels.CharactersFace.Register();
+ // Characters is RynthNet's own window since 2026-10-21: its manifest declares it and the
+ // engine hosts it (UI/Sections/PluginWindows.cs, docs/PLUGIN_WINDOWS.md).
// The ILT section (Infinite Leaftide): its faces exist only with RynthILT installed
// (Bounties, Guardian), and the bar's ILT button shows them only on ILT with RynthILT
// loaded (IltInfo; IltStatusSource asks RynthILT once a second).
diff --git a/src/RynthCore.Engine/ImGui/ImGuiBar.cs b/src/RynthCore.Engine/ImGui/ImGuiBar.cs
index 73beb50..ba3f815 100644
--- a/src/RynthCore.Engine/ImGui/ImGuiBar.cs
+++ b/src/RynthCore.Engine/ImGui/ImGuiBar.cs
@@ -7,7 +7,9 @@
// registered panel except the ones the RynthAi launcher opens (PanelIcons;
// an unknown panel shows its first letter), one per plugin script window that
// asked for a button (WindowFlags.BarButton: RynthSort, Oracle, ...; tooltip =
-// its title; the set is rebuilt as plugins come and go), reload (RL) and pop out.
+// its title; the set is rebuilt as plugins come and go), one per window a plugin
+// draws that asked for one (its manifest's "windows" with "bar", UI/Sections/
+// PluginWindows.cs), reload (RL) and pop out.
// Dragging the grip moves the bar; the position is the shared bar= row in
// panel_state.txt. Right-click the grip for the bar's menu: its size, its rows
// and "Report a problem" (panel buttons have no menu). Pop out moves the ImGui
@@ -71,8 +73,7 @@ internal static class ImGuiBar
// Skills moves under RynthOracle (Skills / Attributes / Progress tabs): its icon shows only while Oracle's
// tabs can't be reached (SkillsRouting.ShowSkillsBarIcon), so nobody loses the way in. Mini Remote stays.
private static readonly string[] ImGuiOnlyBarPanels =
- { Panels.InventoryFace.Title, Panels.SkillsFace.Title, Panels.SenseFace.Title, Panels.MiniRemoteFace.Title,
- Panels.CharactersFace.Title };
+ { Panels.InventoryFace.Title, Panels.SkillsFace.Title, Panels.SenseFace.Title, Panels.MiniRemoteFace.Title };
/// An ImGui-only panel's bar button is wanted: it has a face, and Skills only while Oracle can't host it.
private static bool ImGuiOnlyWanted(string title) =>
@@ -145,6 +146,7 @@ internal static class ImGuiBar
// and which ImGui-only panels had a face. Either changing rebuilds the buttons.
private static ScriptBarItem[]? _builtScriptButtons;
private static int _builtImGuiOnlyMask;
+ private static int _builtPluginWindows = -1;
private static string _tooltip = "";
private static bool _placed;
private static Vector2 _pos, _persistedPos;
@@ -752,9 +754,12 @@ internal static class ImGuiBar
{
ScriptBarItem[] scriptButtons = ScriptWindowRegistry.BarButtons;
int mask = ImGuiOnlyMask();
- if (_buttons != null && ReferenceEquals(scriptButtons, _builtScriptButtons) && mask == _builtImGuiOnlyMask) return;
+ int pluginWindows = UI.Sections.PluginWindows.Version;
+ if (_buttons != null && ReferenceEquals(scriptButtons, _builtScriptButtons) && mask == _builtImGuiOnlyMask
+ && pluginWindows == _builtPluginWindows) return;
_builtScriptButtons = scriptButtons;
_builtImGuiOnlyMask = mask;
+ _builtPluginWindows = pluginWindows;
var list = new List();
foreach (var (title, _) in OverlayHost.GetPanels())
if (!LauncherOnly.Contains(title))
@@ -768,6 +773,14 @@ internal static class ImGuiBar
string icon = IconFor(title, out bool letter);
list.Add(new ButtonInfo(title, "##bar_" + title, icon, letter, title));
}
+ // Windows plugins draw (their manifests' "windows" with "bar", docs/PLUGIN_WINDOWS.md): the
+ // icon they name (a Phosphor glyph), else the title's letter; the button toggles the panel.
+ foreach (UI.Sections.SectionWindowDecl w in UI.Sections.PluginWindows.BarWindows)
+ {
+ bool letter = false;
+ string icon = w.Icon.Length > 0 ? w.Icon : IconFor(w.Title, out letter);
+ list.Add(new ButtonInfo(w.Title, "##bar_pw_" + w.Plugin + "_" + w.Id, icon, letter, w.Title));
+ }
// Plugin script windows that asked for a button (RynthSort, Oracle, ...): after the
// engine's own. Only while the plugin is loaded and has submitted the window.
foreach (ScriptBarItem item in scriptButtons)
diff --git a/src/RynthCore.Engine/ImGui/Panels/CharactersFace.cs b/src/RynthCore.Engine/ImGui/Panels/CharactersFace.cs
deleted file mode 100644
index c62d64d..0000000
--- a/src/RynthCore.Engine/ImGui/Panels/CharactersFace.cs
+++ /dev/null
@@ -1,397 +0,0 @@
-// ============================================================================
-// RynthCore.Engine - ImGui/Panels/CharactersFace.cs
-// The Characters panel: your other characters (the other RynthCore clients on
-// this PC, through the RynthNet plugin), like UtilityBelt's networked
-// character window. Engine only, ImGui only.
-//
-// top how many, or why none (RynthNet missing / offline); "all
-// follow me"; the help mark
-// rows this client first (dimmed), then the others alphabetically (a
-// stable order: characters standing together would reshuffle
-// several times a second if sorted by distance). Each row:
-// line 1 direction arrow (relative to where you face), name
-// (+ server when it isn't yours), state (botting / idle /
-// dead / portal space / combat stance), a stale marker,
-// distance and compass point
-// line 2 health / stamina / mana bars with current/max, and
-// where they are (map coordinates or dungeon name)
-// click selects the character in game when this client can see it;
-// right follow me / stop following / start or stop the macro on that
-// client (sent as /rn tell; its RynthNet command policy decides)
-//
-// Data: UiSources.Characters (UI/Data/CharactersData.cs, 2 Hz while open).
-// Follows the panel text size (PanelTextScale): layout scales with the font.
-// AC's render thread; no AC calls, no per-frame allocation except a hovered
-// row's tooltip and the popup's labels.
-// ============================================================================
-
-using System;
-using System.Numerics;
-using ImGuiNET;
-using RynthCore.Engine.Compatibility;
-using RynthCore.Engine.UI;
-using RynthCore.Engine.UI.Data;
-using static RynthCore.Engine.ImGuiBackend.Panels.FaceKit;
-
-namespace RynthCore.Engine.ImGuiBackend.Panels;
-
-internal sealed class CharactersFace : IImGuiPanel
-{
- public const string Title = "Characters";
-
- public static void Register()
- {
- ImGuiPanelHost.Register(Title,
- new PanelSpec(new Vector2(420, 260), new Vector2(280, 140), EdgeToEdge: true, GripInBody: true),
- () => new CharactersFace());
- }
-
- // ── Palette (the RynthAi dashboard's vitals colours) ─────────────────
- private static uint C(uint argb) => RynthTheme.Argb(argb);
- private static readonly uint HpCol = C(0xFFD93333), StCol = C(0xFF40D973), MpCol = C(0xFF268CF2),
- BarBg = C(0xFF0D161F), Purple = C(0xFFBF4DFF), White = C(0xFFFFFFFF);
-
- private const string HelpText =
- "Your other characters: every RynthCore client on this PC running the RynthNet plugin.\n\n" +
- "Each row shows health, stamina and mana, what the character is doing, and where it is. " +
- "The distance and direction show when you are both outdoors (or in surface buildings), or in the same dungeon; " +
- "otherwise the row says elsewhere and names the dungeon or gives map coordinates. Characters on another server " +
- "only show their server.\n\n" +
- "Rows stay in alphabetical order. A row that stops updating says so (its client may be frozen).\n\n" +
- "Click a row to select that character in game (when this client can see it). Right-click for commands: " +
- "follow me, stop following, start or stop the macro. They go through RynthNet, so the other client's " +
- "remote command setting (/rn remote) decides whether they run.\n\n" +
- "/rc characters opens and closes this panel.";
-
- private float _k = 1f;
- private float Px(float v) => v * _k;
-
- // The right-clicked row (copied: the snapshot can change while the popup is open).
- private string _menuName = "";
- private uint _menuId;
- private bool _menuInView, _menuOtherWorld, _menuSelf, _menuLoggedOut;
- private bool _openMenu;
-
- public int PopOutIdleHz => 10; // the arrows turn with you
-
- public void OnShown()
- {
- UiSources.Characters.Subscribe();
- UiSources.Characters.RequestRefresh();
- }
-
- public void OnHidden() => UiSources.Characters.Unsubscribe();
-
- public void Draw()
- {
- _k = PanelTextScale.Factor(ImGuiFonts.CurrentStep);
- float w = Begin(out Vector2 origin, out Vector2 size);
- CharactersView view = UiSources.Characters.Current?.Value ?? CharactersView.Empty;
- DrawTop(view, w);
-
- float bodyH = Math.Max(Px(30), Remaining(origin, size) - GripOverlap());
- ImGuiNET.ImGui.PushStyleColor(ImGuiCol.ChildBg, PanelBg);
- ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
- ImGuiNET.ImGui.BeginChild("##chars_rows", new Vector2(w, bodyH));
- DrawRows(view);
- ImGuiNET.ImGui.EndChild();
- ImGuiNET.ImGui.PopStyleVar();
- ImGuiNET.ImGui.PopStyleColor();
- End(origin, size);
-
- DrawMenu(view);
- }
-
- // ── Top line ────────────────────────────────────────────────────────
-
- private void DrawTop(CharactersView view, float w)
- {
- Vector2 start = ImGuiNET.ImGui.GetCursorScreenPos();
- float h = Px(20), iconW = Px(22);
- float fontH = ImGuiNET.ImGui.GetFontSize();
- var dl = ImGuiNET.ImGui.GetWindowDrawList();
- float textW = Math.Max(10, w - 2 * iconW - Px(8));
- dl.PushClipRect(start, start + new Vector2(textW, h), true);
- dl.AddText(new Vector2(start.X, start.Y + (h - fontH) * 0.5f), view.NetLoaded ? Mute : Amber,
- view.Status.Length > 0 ? view.Status : "Waiting for RynthNet...");
- dl.PopClipRect();
-
- float bx = start.X + w - 2 * iconW - Px(4);
- bool canFollow = view.NetLoaded && view.MyName.Length > 0;
- if (IconButton("##chars_followall", PhosphorIcons.Footprints, new Vector2(bx, start.Y), new Vector2(iconW, h), Text, BtnFill,
- enabled: canFollow, font: UiFont.Ui11))
- CharactersCommands.FollowMeAll();
- ImGuiNET.ImGui.SetItemTooltip("Everyone follow me (/rn followme): every other client runs /ra follow .");
- IconButton("##chars_help", PhosphorIcons.Info, new Vector2(bx + iconW + Px(4), start.Y), new Vector2(iconW, h), Mute, BtnFill,
- font: UiFont.Ui11);
- if (ImGuiNET.ImGui.IsItemHovered())
- {
- ImGuiNET.ImGui.BeginTooltip();
- ImGuiNET.ImGui.PushTextWrapPos(ImGuiNET.ImGui.GetFontSize() * 30);
- ImGuiNET.ImGui.TextUnformatted(HelpText);
- ImGuiNET.ImGui.PopTextWrapPos();
- ImGuiNET.ImGui.EndTooltip();
- }
- NextLine(start, h + Px(4));
- }
-
- // ── Rows ────────────────────────────────────────────────────────────
-
- private float RowH => Px(38);
-
- private void DrawRows(CharactersView view)
- {
- CharacterRow[] rows = view.Rows;
- float bw = ImGuiNET.ImGui.GetContentRegionAvail().X;
- var dl = ImGuiNET.ImGui.GetWindowDrawList();
- if (rows.Length == 0)
- {
- Vector2 at = ImGuiNET.ImGui.GetCursorScreenPos() + new Vector2(Px(6), Px(6));
- dl.AddText(at, Faded(Mute), view.NetLoaded ? "Not in the world." : "");
- return;
- }
-
- uint selected = ClientHelperHooks.GetSelectedItemId();
- float heading = PlayerHeading(out bool haveHeading);
- float rowH = RowH;
- Vector2 start = ImGuiNET.ImGui.GetCursorScreenPos();
- int hovered = -1;
-
- for (int i = 0; i < rows.Length; i++)
- {
- CharacterRow r = rows[i];
- var p = new Vector2(start.X, start.Y + i * rowH);
- ImGuiNET.ImGui.SetCursorScreenPos(p);
- ImGuiNET.ImGui.PushID(i);
- bool clicked = ImGuiNET.ImGui.InvisibleButton("##row", new Vector2(bw, rowH),
- ImGuiButtonFlags.MouseButtonLeft | ImGuiButtonFlags.MouseButtonRight);
- bool hot = ImGuiNET.ImGui.IsItemHovered();
- bool right = clicked && ImGuiNET.ImGui.IsMouseReleased(ImGuiMouseButton.Right);
- ImGuiNET.ImGui.PopID();
- if (hot) hovered = i;
- if (clicked && !right && r.InView && r.Id != 0 && !r.IsSelf)
- AcMainThreadQueue.EnqueueOverlaySelect(r.Id);
- if (right) OpenMenu(r);
-
- DrawRow(dl, r, p, bw, rowH, i, hot, r.Id != 0 && r.Id == selected, heading, haveHeading);
- }
-
- ImGuiNET.ImGui.SetCursorScreenPos(start);
- ImGuiNET.ImGui.Dummy(new Vector2(bw, rows.Length * rowH));
-
- if (hovered >= 0 && rows[hovered].Tooltip.Length > 0 && !ImGuiNET.ImGui.IsPopupOpen("##chars_menu"))
- {
- ImGuiNET.ImGui.BeginTooltip();
- ImGuiNET.ImGui.TextUnformatted(rows[hovered].Tooltip);
- ImGuiNET.ImGui.EndTooltip();
- }
- }
-
- private void DrawRow(ImDrawListPtr dl, CharacterRow r, Vector2 p, float bw, float rowH, int index, bool hot, bool isSel,
- float heading, bool haveHeading)
- {
- uint bg = isSel ? Selected : hot ? Lighten(PanelBg) : (index & 1) == 1 ? RowAlt : 0;
- if (bg != 0) dl.AddRectFilled(p, p + new Vector2(bw, rowH), bg);
- if (isSel) dl.AddRect(p, p + new Vector2(bw, rowH), Teal);
- // This client's row is dimmed: it's here for comparison.
- float dim = r.IsSelf || r.LoggedOut ? 0.55f : 1f;
-
- ImFontPtr bold = ImGuiFonts.Get(UiFont.UiBold11), f10 = ImGuiFonts.Get(UiFont.Ui10);
- float arrowW = Px(20), pad = Px(4);
- float line1 = p.Y + Px(3);
- float x = p.X + arrowW;
- float right = p.X + bw - pad;
-
- // Arrow / dot / ring.
- var mid = new Vector2(p.X + arrowW * 0.5f, line1 + bold.FontSize * 0.5f + Px(1));
- uint arrowCol = Fade(StateColor(r), dim);
- if (!r.IsSelf && r.Measured && haveHeading && !float.IsNaN(r.Bearing))
- DrawArrow(dl, mid, r.Bearing - heading, arrowCol, _k);
- else if (r.IsSelf || r.Measured)
- dl.AddCircleFilled(mid, Px(2.5f), arrowCol);
- else
- dl.AddCircle(mid, Px(3.5f), Faded(Mute), 12, Px(1.2f));
-
- // Right side of line 1: distance + compass (or "elsewhere").
- string dist = r.IsSelf ? "" : r.Measured ? r.DistanceText + (r.Compass.Length > 0 ? " " + r.Compass : "") : r.DistanceText;
- float distW = dist.Length > 0 ? ImGuiNET.ImGui.CalcTextSize(dist).X : 0;
- if (dist.Length > 0)
- dl.AddText(new Vector2(right - distW, line1 + (bold.FontSize - ImGuiNET.ImGui.GetFontSize()) * 0.5f),
- Fade(r.Measured ? Text : Faded(Mute), dim), dist);
- float limit = right - distW - (distW > 0 ? Px(8) : 0);
-
- // Name (+ server), then state and the stale marker.
- float nameW = Math.Min(CalcW(bold, r.Name), Math.Max(Px(40), (limit - x) * 0.55f));
- Clip(dl, bold, r.Name, x, line1, nameW, Fade(r.IsSelf ? Mute : Text, dim));
- float sx = x + nameW + Px(6);
- if (r.OtherWorld.Length > 0)
- {
- string wtext = "[" + r.OtherWorld + "]";
- float ww = Math.Min(CalcW(f10, wtext), Math.Max(0, limit - sx));
- Clip(dl, f10, wtext, sx, line1 + Px(1), ww, Fade(Amber, dim));
- sx += ww + Px(6);
- }
- if (r.StateText.Length > 0 && sx < limit)
- {
- float tw = Math.Min(CalcW(f10, r.StateText), limit - sx);
- Clip(dl, f10, r.StateText, sx, line1 + Px(1), tw, Fade(StateColor(r), dim));
- sx += tw + Px(6);
- }
- if (r.Stale && sx < limit)
- {
- string st = PhosphorIcons.Warning + " " + r.StaleText;
- Clip(dl, f10, st, sx, line1 + Px(1), limit - sx, Amber);
- }
-
- // Line 2: bars, then the location.
- float line2 = line1 + bold.FontSize + Px(4);
- float barH = Px(13);
- float locW = r.Location.Length > 0 ? Math.Min(CalcW(f10, r.Location), Math.Max(Px(70), bw * 0.32f)) : 0;
- float barsW = right - x - (locW > 0 ? locW + Px(8) : 0);
- if (barsW < Px(150)) { barsW = right - x; locW = 0; } // narrow: bars first, the tooltip has the place
- if (r.HasVitals)
- {
- float gap = Px(3);
- float one = (barsW - 2 * gap) / 3f;
- Bar(dl, x, line2, one, barH, r.Hp, HpCol, f10, dim);
- Bar(dl, x + one + gap, line2, one, barH, r.St, StCol, f10, dim);
- Bar(dl, x + 2 * (one + gap), line2, one, barH, r.Mp, MpCol, f10, dim);
- }
- else if (!r.LoggedOut)
- {
- Clip(dl, f10, "no vitals yet", x, line2, barsW, Faded(Mute));
- }
- if (locW > 0)
- Clip(dl, f10, r.Location, right - locW, line2 + (barH - f10.FontSize) * 0.5f, locW, Fade(Mute, dim));
- }
-
- private void Bar(ImDrawListPtr dl, float x, float y, float w, float h, CharVital v, uint color, ImFontPtr font, float dim)
- {
- if (w <= 2) return;
- var a = new Vector2(x, y);
- var b = new Vector2(x + w, y + h);
- float round = Px(3);
- dl.AddRectFilled(a, b, BarBg, round);
- if (v.Fraction > 0) dl.AddRectFilled(a, new Vector2(x + w * v.Fraction, b.Y), Fade(color, dim), round);
- float tw = CalcW(font, v.Text);
- float tx = x + Math.Max(Px(3), (w - tw) * 0.5f);
- dl.PushClipRect(a, b, true);
- dl.AddText(font, font.FontSize, new Vector2(tx, y + (h - font.FontSize) * 0.5f), Fade(White, dim), v.Text);
- dl.PopClipRect();
- }
-
- private static uint StateColor(CharacterRow r) => r.StateKind switch
- {
- _ when r.IsSelf => Mute,
- CharStateKind.Dead => Red,
- CharStateKind.Fighting => Amber,
- CharStateKind.Botting => Green,
- CharStateKind.Portal => Purple,
- CharStateKind.CombatMode => Teal,
- CharStateKind.NoStatus or CharStateKind.LoggedOut => Faded(Mute),
- _ => Mute,
- };
-
- private static float CalcW(ImFontPtr font, string text) =>
- text.Length == 0 ? 0 : font.CalcTextSizeA(font.FontSize, float.MaxValue, 0f, text).X;
-
- private static void Clip(ImDrawListPtr dl, ImFontPtr font, string text, float x, float y, float width, uint color)
- {
- if (text.Length == 0 || width <= 0) return;
- dl.PushClipRect(new Vector2(x, y - 2), new Vector2(x + width, y + font.FontSize + 4), true);
- dl.AddText(font, font.FontSize, new Vector2(x, y), color, text);
- dl.PopClipRect();
- }
-
- private static uint Fade(uint abgr, float k)
- {
- if (k >= 1f) return abgr;
- uint a = (uint)Math.Clamp((int)(((abgr >> 24) & 0xFF) * k), 0, 255);
- return (abgr & 0x00FFFFFF) | (a << 24);
- }
-
- /// An arrow pointing clockwise from straight up (up = the way you face).
- private static void DrawArrow(ImDrawListPtr dl, Vector2 c, float degrees, uint color, float k)
- {
- float rad = degrees * (MathF.PI / 180f);
- float s = MathF.Sin(rad), co = MathF.Cos(rad);
- Vector2 tip = Rot(c, 0, -6.5f * k, s, co), left = Rot(c, -4.5f * k, 5f * k, s, co),
- notch = Rot(c, 0, 2.5f * k, s, co), rgt = Rot(c, 4.5f * k, 5f * k, s, co);
- dl.AddTriangleFilled(tip, left, notch, color);
- dl.AddTriangleFilled(tip, notch, rgt, color);
- }
-
- private static Vector2 Rot(Vector2 c, float x, float y, float s, float co) =>
- new(c.X + x * co - y * s, c.Y + x * s + y * co);
-
- /// Your compass heading this frame from the pose snapshot's quaternion; no AC call (SenseFace's way).
- private static float PlayerHeading(out bool ok)
- {
- ok = PlayerPhysicsHooks.TryGetPlayerCompassSnapshot(out float heading);
- return heading;
- }
-
- // ── Right-click menu ────────────────────────────────────────────────
-
- private void OpenMenu(CharacterRow r)
- {
- _menuName = r.Name;
- _menuId = r.Id;
- _menuInView = r.InView;
- _menuOtherWorld = r.OtherWorld.Length > 0;
- _menuSelf = r.IsSelf;
- _menuLoggedOut = r.LoggedOut;
- _openMenu = true;
- }
-
- private void DrawMenu(CharactersView view)
- {
- if (_openMenu)
- {
- _openMenu = false;
- ImGuiNET.ImGui.OpenPopup("##chars_menu");
- }
- ImGuiNET.ImGui.PushStyleColor(ImGuiCol.PopupBg, ShellBg);
- ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Border, Teal);
- ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Text, Text);
- ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(Px(8), Px(6)));
- bool open = ImGuiNET.ImGui.BeginPopup("##chars_menu");
- ImGuiNET.ImGui.PopStyleVar();
- ImGuiNET.ImGui.PopStyleColor(3);
- if (!open) return;
- try
- {
- string me = view.MyName;
- bool canFollow = me.Length > 0;
- if (!_menuSelf && !_menuLoggedOut)
- {
- SafeImGui.TextDisabled(_menuName);
- if (ImGuiNET.ImGui.MenuItem("Select", "", false, _menuInView && _menuId != 0))
- AcMainThreadQueue.EnqueueOverlaySelect(_menuId);
- ImGuiNET.ImGui.Separator();
- if (ImGuiNET.ImGui.MenuItem("Follow me", "", false, canFollow && !_menuOtherWorld))
- CharactersCommands.Tell(_menuName, "/ra follow " + me);
- SafeImGui.SetItemTooltip($"/rn tell {_menuName}, /ra follow {me}");
- if (ImGuiNET.ImGui.MenuItem("Stop following"))
- CharactersCommands.Tell(_menuName, "/ra follow off");
- SafeImGui.SetItemTooltip($"/rn tell {_menuName}, /ra follow off");
- ImGuiNET.ImGui.Separator();
- if (ImGuiNET.ImGui.MenuItem("Start macro"))
- CharactersCommands.Tell(_menuName, "/ra start");
- SafeImGui.SetItemTooltip($"/rn tell {_menuName}, /ra start");
- if (ImGuiNET.ImGui.MenuItem("Stop macro"))
- CharactersCommands.Tell(_menuName, "/ra stop");
- SafeImGui.SetItemTooltip($"/rn tell {_menuName}, /ra stop");
- ImGuiNET.ImGui.Separator();
- }
- if (ImGuiNET.ImGui.MenuItem("Everyone: follow me", "", false, canFollow))
- CharactersCommands.FollowMeAll();
- ImGuiNET.ImGui.SetItemTooltip("/rn followme");
- ImGuiNET.ImGui.TextDisabled("The other client's /rn remote setting decides.");
- }
- finally
- {
- ImGuiNET.ImGui.EndPopup();
- }
- }
-}
diff --git a/src/RynthCore.Engine/ImGui/Panels/DamageDetailFace.cs b/src/RynthCore.Engine/ImGui/Panels/DamageDetailFace.cs
index 24b1643..1e74086 100644
--- a/src/RynthCore.Engine/ImGui/Panels/DamageDetailFace.cs
+++ b/src/RynthCore.Engine/ImGui/Panels/DamageDetailFace.cs
@@ -134,12 +134,12 @@ internal sealed class DamageDetailFace : IImGuiPanel
{
ImGuiNET.ImGui.SameLine();
SafeImGui.TextColored(Vec(Dim), "wcid " + wcid.ToString(CultureInfo.InvariantCulture));
- // Aelrynth only: which difficulty tier these numbers are (the Damage panel's chip picks it).
+ // Where the server plugin reports tiers: which difficulty tier these numbers are (the Damage panel's chip picks it).
if (UiSources.Damage.Current?.Value.Tier is { Show: true } tier)
{
ImGuiNET.ImGui.SameLine();
SafeImGui.TextColored(Vec(tier.View == tier.Current ? Teal : Gold),
- tier.View <= 0 ? "· Tier 0 (real Dereth)" : "· Tier " + tier.View.ToString(CultureInfo.InvariantCulture));
+ tier.View <= 0 ? "· Tier 0 (unscaled)" : "· Tier " + tier.View.ToString(CultureInfo.InvariantCulture));
ImGuiNET.ImGui.SetItemTooltip("HP, casts to kill, seconds per kill, hits and damage taken are this difficulty tier's.\n" +
"Damage per cast and weaknesses are the same at every tier. Change it on the Damage panel.");
}
diff --git a/src/RynthCore.Engine/ImGui/Panels/DamageFace.cs b/src/RynthCore.Engine/ImGui/Panels/DamageFace.cs
index 86e2f68..3049125 100644
--- a/src/RynthCore.Engine/ImGui/Panels/DamageFace.cs
+++ b/src/RynthCore.Engine/ImGui/Panels/DamageFace.cs
@@ -16,9 +16,9 @@
// Monster Detail panel (weaknesses, accuracy, damage, summons, damage taken,
// its rule). x removes the monster (confirmed). Gold = set by you, dim =
// automatic.
-// Aelrynth only: a tier chip after Reset stats (DamageView.Tier) - which of the
-// awakened worlds' / scaled dungeons' difficulty tiers the numbers are for, and
-// a picker; "~" marks an HP estimated from real Dereth's. Hidden elsewhere.
+// Where the server plugin reports difficulty tiers: a tier chip after Reset stats
+// (DamageView.Tier) - which tier the numbers are for, and a picker; "~" marks an
+// HP estimated from tier 0's. Hidden elsewhere.
//
// Data: UiSources.Damage and UiSources.MonsterRules (hub); every change goes
// through DamageCommands on the pump thread. Rows are drawn only while on
@@ -474,19 +474,19 @@ internal sealed class DamageFace : IImGuiPanel
return x + w + 6;
}
- // ── Aelrynth difficulty tier (2026-10-03) ────────────────────────────
- // Awakened worlds and scaled dungeons hold the same monsters, +5% health, skills and damage a
- // tier, and RynthAi keeps each tier's numbers apart. The chip says which tier the table shows
- // and opens a picker; it is drawn only when the data source says so (Aelrynth, tier seen).
+ // ── Difficulty tier (2026-10-03; any server whose plugin reports tiers, 2026-10-21) ──
+ // Some servers scale the same monsters by a percent a tier, and RynthAi keeps each tier's
+ // numbers apart. The chip says which tier the table shows and opens a picker; it is drawn only
+ // when the data source says so (the server plugin reports a tier).
private const uint FollowTier = uint.MaxValue; // the picker's "where I am" entry
- private static string TierName(int tier) => tier <= 0 ? "Tier 0 (real Dereth)" : "Tier " + tier.ToString(CultureInfo.InvariantCulture);
+ private static string TierName(int tier) => tier <= 0 ? "Tier 0 (unscaled)" : "Tier " + tier.ToString(CultureInfo.InvariantCulture);
/// The tier chip at ; returns the x after it (unchanged when hidden).
private float TierChip(float x, float y)
{
- AwakenedTierView? t = _view?.Tier;
+ DifficultyTierView? t = _view?.Tier;
if (t == null || !t.Show) return x;
string label = TierName(t.View) + (t.View == t.Current ? " " + PhosphorIcons.MapPin : "") + " " + PhosphorIcons.CaretDown;
float w = ImGuiNET.ImGui.CalcTextSize(label).X + 16;
@@ -502,8 +502,8 @@ internal sealed class DamageFace : IImGuiPanel
DamageCommands.SetViewTier(id == FollowTier ? -1 : (int)id));
}
SafeImGui.SetItemTooltip(
- "Aelrynth's awakened worlds and scaled dungeons have the same monsters, with " +
- $"{t.Percent.ToString("0.#", CultureInfo.InvariantCulture)}% more health, skills and damage per tier.\n" +
+ "This server scales its monsters by difficulty tier: the same monsters, with " +
+ $"{t.Percent.ToString("0.#", CultureInfo.InvariantCulture)}% more health per tier.\n" +
"HP, kills, casts to kill, seconds per kill and hit rate here are this tier's; damage per cast,\n" +
"weaknesses and your settings are the same at every tier.\n" +
(here ? "Showing the tier where you are (pin)." : $"You are in {TierName(t.Current)}; pick \"Where I am\" to follow it."));
@@ -1276,7 +1276,7 @@ internal sealed class DamageFace : IImGuiPanel
}
ImGuiNET.ImGui.SetItemTooltip("Manual max-HP for this monster (off = auto)");
- // An Aelrynth tier not appraised yet shows real Dereth's HP scaled by the tier, marked "~".
+ // A tier not appraised yet shows tier 0's HP scaled by the tier, marked "~".
bool estimate = r.HpEst && !manual;
int shownKey = estimate ? -r.Hp - 1 : r.Hp; // re-written when the estimate becomes a real value
if (!e.Active && e.Shown != shownKey)
@@ -1295,7 +1295,7 @@ internal sealed class DamageFace : IImGuiPanel
bool enter = ImGuiNET.ImGui.InputText("##hp", e.Buffer, (uint)e.Buffer.Length, flags);
e.Active = ImGuiNET.ImGui.IsItemActive();
if (estimate)
- ImGuiNET.ImGui.SetItemTooltip("Estimated: real Dereth's HP plus this tier's scaling. The first fight at this tier\n" +
+ ImGuiNET.ImGui.SetItemTooltip("Estimated: tier 0's HP plus this tier's scaling. The first fight at this tier\n" +
"reads the real number from the game and replaces it.");
bool commit = manual && (enter || ImGuiNET.ImGui.IsItemDeactivatedAfterEdit());
ImGuiNET.ImGui.PopStyleVar();
diff --git a/src/RynthCore.Engine/ImGui/Panels/PluginWindowFace.cs b/src/RynthCore.Engine/ImGui/Panels/PluginWindowFace.cs
new file mode 100644
index 0000000..d098eea
--- /dev/null
+++ b/src/RynthCore.Engine/ImGui/Panels/PluginWindowFace.cs
@@ -0,0 +1,69 @@
+// ============================================================================
+// RynthCore.Engine - ImGui/Panels/PluginWindowFace.cs
+// A plugin's own window (its manifest's "windows", UI/Sections/PluginWindows.cs):
+// the panel host draws the window, this face hands the body to the plugin's
+// RynthPluginRenderEmbed(surface, width, height) in the default UI font, under
+// an ID scope of its own. Popped out, PluginManager.RenderEmbed adds ":popout"
+// to the surface name. An export that throws is switched off (PluginManager
+// logs it); the body then says so and asks again every 5 s, so a reloaded
+// plugin draws again without the window being reopened.
+// docs/PLUGIN_WINDOWS.md. AC's render thread.
+// ============================================================================
+
+using System;
+using System.Numerics;
+using System.Text;
+using RynthCore.Engine.Plugins;
+using static RynthCore.Engine.ImGuiBackend.Panels.FaceKit;
+
+namespace RynthCore.Engine.ImGuiBackend.Panels;
+
+internal sealed class PluginWindowFace : IImGuiPanel
+{
+ private readonly string _plugin, _title;
+ private readonly byte[] _surface; // NUL-terminated UTF-8, built once
+ private readonly string _idScope;
+ // The export threw: PluginManager switched the plugin's surfaces off. Asked again every
+ // RetryMs, so a reloaded plugin (a fresh export) draws again without reopening the window.
+ private long _failedAtMs = -1;
+ private const long RetryMs = 5000;
+
+ public PluginWindowFace(string plugin, string surface, string title)
+ {
+ _plugin = plugin;
+ _title = title;
+ _surface = Encoding.UTF8.GetBytes(surface + "\0");
+ _idScope = "##pw_" + surface;
+ }
+
+ public void Draw()
+ {
+ Vector2 start = ImGuiNET.ImGui.GetCursorScreenPos();
+ Vector2 avail = ImGuiNET.ImGui.GetContentRegionAvail();
+ long now = Environment.TickCount64;
+ int result = PluginManager.EmbedFailed;
+ if (_failedAtMs < 0 || now - _failedAtMs >= RetryMs)
+ {
+ ImGuiNET.ImGui.PushID(_idScope);
+ ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Ui11));
+ try { result = PluginManager.RenderEmbed(_plugin, _surface, avail, out _); }
+ finally
+ {
+ ImGuiNET.ImGui.PopFont();
+ ImGuiNET.ImGui.PopID();
+ }
+ if (result == PluginManager.EmbedFailed) _failedAtMs = now;
+ else if (result == PluginManager.EmbedDrawn) _failedAtMs = -1;
+ else if (_failedAtMs >= 0) { _failedAtMs = now; result = PluginManager.EmbedFailed; } // still off since the throw
+ }
+ if (result == PluginManager.EmbedDrawn) return;
+
+ ImGuiNET.ImGui.SetCursorScreenPos(start + new Vector2(6, 6));
+ Label(result switch
+ {
+ PluginManager.EmbedNoPlugin => $"{_title} comes with {_plugin}; it isn't loaded.",
+ PluginManager.EmbedFailed => $"{_plugin} couldn't draw {_title} (see the log). It comes back when the plugin reloads.",
+ _ => $"Waiting for {_plugin}…",
+ }, Mute);
+ }
+}
diff --git a/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs b/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs
index 31bab36..88abd44 100644
--- a/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs
+++ b/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs
@@ -1156,7 +1156,7 @@ internal sealed partial class RynthAiFace : IImGuiPanel
SafeImGui.SetItemTooltip(hasGinv
? "Every character's saved packs and storage (RynthInventory)."
: "Global Inventory (RynthInventory isn't loaded).");
- PanelMenuItem(CharactersFace.Title, "/rc characters");
+ PanelMenuItem("Characters", "/rc characters"); // RynthNet's window (a plugin window since 2026-10-21)
UI.ServerMenus.DrawImGuiMenu(separatorFirst: true);
}
diff --git a/src/RynthCore.Engine/Plugins/PluginContract.cs b/src/RynthCore.Engine/Plugins/PluginContract.cs
index e26e15e..32d6ee4 100644
--- a/src/RynthCore.Engine/Plugins/PluginContract.cs
+++ b/src/RynthCore.Engine/Plugins/PluginContract.cs
@@ -950,6 +950,38 @@ internal struct RynthCoreAPI
/// (Compatibility/EquipmentTracker.cs). Returns the count written (at most max), or -1 while
/// there is no player or nothing to start from. Any thread. Requires API v87+.
public IntPtr GetWieldedItemsFn;
+
+ // ── v89: plugin windows (docs/PLUGIN_WINDOWS.md): the engine provides ImGui, plugins draw ──
+
+ /// v89: uint GetUiColor(int token): the player's colour theme as ImGui's packed
+ /// colour (ABGR) for a , so a plugin's own windows look like the
+ /// engine's; 0 for an unknown token. Any thread (read every frame: it follows a theme change at
+ /// once). Requires API v89+.
+ public IntPtr GetUiColorFn;
+ /// v89: void* GetUiFont(int font): an ImFont* in the shared atlas for a
+ /// , at the current panel's text size; null for an unknown font or off
+ /// AC's render thread. Push it around the plugin's own text. Requires API v89+.
+ public IntPtr GetUiFontFn;
+ /// v89: int SetPanelOpen(const char* key, int mode): a panel by its key (a plugin
+ /// window's title, or an engine panel's): mode 1 open, 0 close, 2 toggle, -1 just ask. Returns
+ /// 1 open / 0 closed (after the change, which lands on the next frame), -1 no such panel. Any
+ /// thread. Requires API v89+.
+ public IntPtr SetPanelOpenFn;
+}
+
+/// v89 GetUiColor tokens. Append only: plugins compiled against these numbers keep them.
+internal enum UiColorToken
+{
+ Text = 0, TextMuted = 1, Accent = 2, Highlight = 3, Button = 4, Border = 5, Field = 6, Selected = 7,
+ RowAlt = 8, Background = 9, PanelGlass = 10, AccentFill = 11, BoxBg = 12, FrameBg = 13, FrameHover = 14,
+ FrameActive = 15, Green = 16, Red = 17, TitleBar = 18, WindowBorder = 19,
+}
+
+/// v89 GetUiFont fonts. Append only.
+internal enum UiFontToken
+{
+ Ui9 = 0, Ui10 = 1, Ui11 = 2, Ui14 = 3, Ui18 = 4, UiBold11 = 5, UiBold14 = 6,
+ Mono9 = 7, Mono10 = 8, Mono12 = 9, Chat10 = 10, Chat12 = 11, Chat14 = 12,
}
/// v79 bits.
@@ -1732,6 +1764,15 @@ internal unsafe delegate int GetVendorInfoCallbackDelegate(VendorInfoNative* inf
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate int GetVendorItemsCallbackDelegate(VendorItemNative* items, int maxCount);
+[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+internal delegate uint GetUiColorCallbackDelegate(int token);
+
+[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+internal delegate IntPtr GetUiFontCallbackDelegate(int font);
+
+[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+internal unsafe delegate int SetPanelOpenCallbackDelegate(byte* key, int mode);
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate uint VendorBuyCallbackDelegate(uint vendorId, VendorTradeEntryNative* entries, int count);
diff --git a/src/RynthCore.Engine/Plugins/PluginContractVersion.cs b/src/RynthCore.Engine/Plugins/PluginContractVersion.cs
index 32a2ccc..51f1348 100644
--- a/src/RynthCore.Engine/Plugins/PluginContractVersion.cs
+++ b/src/RynthCore.Engine/Plugins/PluginContractVersion.cs
@@ -28,5 +28,7 @@ internal static class PluginContractVersion
// v88: managed plugins find their common dependencies in Runtime\PluginShared (installed with
// RynthCore), so the update feed ships each managed plugin as one DLL; releases build the
// plugins managed (collectible: a reload frees them) and they declare minEngineApi 88.
- public const uint Current = 88;
+ // v89: plugin windows: GetUiColor, GetUiFont and SetPanelOpen (the engine hosts the windows
+ // a plugin's sections manifest declares; the plugin draws them; docs/PLUGIN_WINDOWS.md).
+ public const uint Current = 89;
}
diff --git a/src/RynthCore.Engine/Plugins/PluginManager.cs b/src/RynthCore.Engine/Plugins/PluginManager.cs
index e28494e..2324d33 100644
--- a/src/RynthCore.Engine/Plugins/PluginManager.cs
+++ b/src/RynthCore.Engine/Plugins/PluginManager.cs
@@ -285,6 +285,9 @@ internal static partial class PluginManager
private static GetLastConfirmationCallbackDelegate? _getLastConfirmationCallback; // v85
private static GetServerStateJsonCallbackDelegate? _getServerStateJsonCallback; // v86
private static GetWieldedItemsCallbackDelegate? _getWieldedItemsCallback; // v87
+ private static GetUiColorCallbackDelegate? _getUiColorCallback; // v89
+ private static GetUiFontCallbackDelegate? _getUiFontCallback; // v89
+ private static SetPanelOpenCallbackDelegate? _setPanelOpenCallback; // v89
private static ForceResetBusyCountCallbackDelegate? _forceResetBusyCountCallback;
private static GetObjectSpellIdsCallbackDelegate? _getObjectSpellIdsCallback;
private static GetObjectSkillLevelCallbackDelegate? _getObjectSkillBuffedCallback;
@@ -3168,6 +3171,9 @@ internal static partial class PluginManager
unsafe { _getLastConfirmationCallback ??= GetLastConfirmationAction; }
unsafe { _getServerStateJsonCallback ??= GetServerStateJsonAction; }
unsafe { _getWieldedItemsCallback ??= GetWieldedItemsAction; }
+ _getUiColorCallback ??= UiKit.GetUiColor;
+ _getUiFontCallback ??= UiKit.GetUiFont;
+ unsafe { _setPanelOpenCallback ??= UiKit.SetPanelOpen; }
_api.Version = PluginContractVersion.Current;
_api.LogFn = Marshal.GetFunctionPointerForDelegate(_logCallback);
@@ -3322,6 +3328,9 @@ internal static partial class PluginManager
_api.GetLastConfirmationFn = Marshal.GetFunctionPointerForDelegate(_getLastConfirmationCallback);
_api.GetServerStateJsonFn = Marshal.GetFunctionPointerForDelegate(_getServerStateJsonCallback);
_api.GetWieldedItemsFn = Marshal.GetFunctionPointerForDelegate(_getWieldedItemsCallback);
+ _api.GetUiColorFn = Marshal.GetFunctionPointerForDelegate(_getUiColorCallback);
+ _api.GetUiFontFn = Marshal.GetFunctionPointerForDelegate(_getUiFontCallback);
+ _api.SetPanelOpenFn = Marshal.GetFunctionPointerForDelegate(_setPanelOpenCallback);
RouteApiThroughLoader();
}
diff --git a/src/RynthCore.Engine/Plugins/UiKit.cs b/src/RynthCore.Engine/Plugins/UiKit.cs
new file mode 100644
index 0000000..d984812
--- /dev/null
+++ b/src/RynthCore.Engine/Plugins/UiKit.cs
@@ -0,0 +1,115 @@
+// ============================================================================
+// RynthCore.Engine - Plugins/UiKit.cs
+// Plugin API v89, for the windows plugins draw (docs/PLUGIN_WINDOWS.md): the
+// player's colour theme (GetUiColor), the engine's UI fonts at the current
+// panel's text size (GetUiFont), and opening or closing a panel by its key
+// (SetPanelOpen). Nothing here throws across the boundary.
+// ============================================================================
+
+using System;
+using System.Runtime.InteropServices;
+using RynthCore.Engine.Compatibility;
+using RynthCore.Engine.ImGuiBackend;
+using RynthCore.Engine.ImGuiBackend.Panels;
+using RynthCore.Engine.UI;
+
+namespace RynthCore.Engine.Plugins;
+
+internal static unsafe class UiKit
+{
+ /// Longest panel key SetPanelOpen reads.
+ public const int MaxKeyLength = 64;
+
+ /// v89 GetUiColor: ImGui's packed colour (ABGR) for a token, 0 for an unknown one. Any thread.
+ public static uint GetUiColor(int token)
+ {
+ try { return Color((UiColorToken)token); }
+ catch { return 0; }
+ }
+
+ /// The theme colour behind a token (the values the engine's own faces draw with).
+ internal static uint Color(UiColorToken token) => token switch
+ {
+ UiColorToken.Text => RynthTheme.Text,
+ UiColorToken.TextMuted => RynthTheme.MuteAlt,
+ UiColorToken.Accent => RynthTheme.Accent,
+ UiColorToken.Highlight => RynthTheme.Highlight,
+ UiColorToken.Button => RynthTheme.Button,
+ UiColorToken.Border => RynthTheme.Border,
+ UiColorToken.Field => RynthTheme.Field,
+ UiColorToken.Selected => RynthTheme.Selected,
+ UiColorToken.RowAlt => RynthTheme.RowAlt,
+ UiColorToken.Background => RynthTheme.Background,
+ UiColorToken.PanelGlass => RynthTheme.PanelGlass,
+ UiColorToken.AccentFill => RynthTheme.AccentFill,
+ UiColorToken.BoxBg => RynthTheme.BoxBg,
+ UiColorToken.FrameBg => RynthTheme.FrameBg,
+ UiColorToken.FrameHover => RynthTheme.FrameHover,
+ UiColorToken.FrameActive => RynthTheme.FrameActive,
+ UiColorToken.Green => FaceKit.Green,
+ UiColorToken.Red => FaceKit.Red,
+ UiColorToken.TitleBar => RynthTheme.TitleBar,
+ UiColorToken.WindowBorder => RynthTheme.WindowBorder,
+ _ => 0,
+ };
+
+ /// The engine font behind a v89 font token, or null for an unknown one.
+ internal static UiFont? Font(UiFontToken token) => token switch
+ {
+ UiFontToken.Ui9 => UiFont.Ui9,
+ UiFontToken.Ui10 => UiFont.Ui10,
+ UiFontToken.Ui11 => UiFont.Ui11,
+ UiFontToken.Ui14 => UiFont.Ui14,
+ UiFontToken.Ui18 => UiFont.Ui18,
+ UiFontToken.UiBold11 => UiFont.UiBold11,
+ UiFontToken.UiBold14 => UiFont.UiBold14,
+ UiFontToken.Mono9 => UiFont.Mono9,
+ UiFontToken.Mono10 => UiFont.Mono10,
+ UiFontToken.Mono12 => UiFont.Mono12,
+ UiFontToken.Chat10 => UiFont.Chat10,
+ UiFontToken.Chat12 => UiFont.Chat12,
+ UiFontToken.Chat14 => UiFont.Chat14,
+ _ => null,
+ };
+
+ ///
+ /// v89 GetUiFont: the ImFont* for a token at the text size of the panel being drawn
+ /// (the host sets it around each face), null for an unknown token or off AC's thread.
+ ///
+ public static IntPtr GetUiFont(int font)
+ {
+ try
+ {
+ if (!MainThreadGuard.IsOnMainThread()) return IntPtr.Zero;
+ if (Font((UiFontToken)font) is not UiFont f) return IntPtr.Zero;
+ return (IntPtr)ImGuiFonts.Get(f).NativePtr;
+ }
+ catch { return IntPtr.Zero; }
+ }
+
+ ///
+ /// v89 SetPanelOpen: mode 1 open, 0 close, 2 toggle, -1 ask. 1 open / 0 closed afterwards (the
+ /// request lands on the next frame), -1 for no such panel or a bad call. Any thread.
+ ///
+ public static int SetPanelOpen(byte* key, int mode)
+ {
+ try
+ {
+ if (key == null) return -1;
+ string? title = Marshal.PtrToStringUTF8((IntPtr)key);
+ if (string.IsNullOrWhiteSpace(title) || title.Length > MaxKeyLength) return -1;
+ title = PanelRouter.Canonical(title.Trim());
+ if (!ImGuiPanelHost.HasFace(title)) return -1;
+ bool open = ImGuiPanelHost.IsOpen(title);
+ switch (mode)
+ {
+ case -1: return open ? 1 : 0;
+ case 0: if (open) ImGuiPanelHost.Close(title); return 0;
+ case 1: if (!open) ImGuiPanelHost.Open(title); return 1;
+ case 2: PanelRouter.Toggle(title); return open ? 0 : 1;
+ default: return -1;
+ }
+ }
+ catch { return -1; }
+ }
+}
diff --git a/src/RynthCore.Engine/UI/Data/CharactersData.cs b/src/RynthCore.Engine/UI/Data/CharactersData.cs
index 9b2819a..f7dd0ec 100644
--- a/src/RynthCore.Engine/UI/Data/CharactersData.cs
+++ b/src/RynthCore.Engine/UI/Data/CharactersData.cs
@@ -1,20 +1,17 @@
// ============================================================================
// RynthCore.Engine - UI/Data/CharactersData.cs
// Your other characters (the other RynthCore clients on this PC, through the
-// RynthNet plugin) for the Characters face: vitals, where they are from you,
-// what they are doing. UtilityBelt's NetworkUI, engine side.
+// RynthNet plugin) for the World Map's and Mini Map's other-characters layer.
+// The Characters window itself is RynthNet's own since 2026-10-21 (it draws it,
+// with its own copy of this logic); this goes when the world map moves to its
+// plugin (docs/PLUGIN_WINDOWS.md).
//
// CharactersSource polls RynthNet's RynthPluginGetSnapshotJson twice a second
-// while the face is open (RynthNet rebuilds it twice a second; per-thread
+// while a map shows the layer (RynthNet rebuilds it twice a second; per-thread
// buffer, so the hub thread may call it). It adds this client's own pose and
// vitals (snapshots, no AC calls) and, for a character this client can see,
// its object position (fresher than the status, which comes every second).
// The logic (parse, distance, state, order) is CharactersModel.
-//
-// CharactersCommands: the right-click menu's actions, as /rn commands queued
-// into RynthNet (RynthPluginApplyRemoteCommand("rn", ...), run on its tick):
-// "/rn tell , " (the receiving client's command policy decides,
-// and a refusal comes back as a chat line) and "/rn followme".
// ============================================================================
using System;
@@ -322,39 +319,3 @@ internal sealed unsafe class CharactersSource : UiSource
ClearSnapshot();
}
}
-
-/// The Characters face's right-click actions, sent through RynthNet's /rn.
-internal static unsafe class CharactersCommands
-{
- private static delegate* unmanaged[Cdecl] _apply;
-
- static CharactersCommands()
- {
- PluginManager.PluginsUnloaded += () => _apply = null;
- }
-
- /// Runs on 's client ("/rn tell name, command").
- public static void Tell(string name, string command)
- {
- if (name.Length == 0 || command.Length == 0) return;
- Rn("tell " + name + ", " + command);
- }
-
- /// "/rn followme": every other client follows this character.
- public static void FollowMeAll() => Rn("followme");
-
- private static void Rn(string value) => UiDataHub.Post("Characters /rn " + value, () =>
- {
- if (_apply == null)
- _apply = (delegate* unmanaged[Cdecl])PluginExportBinder.Resolve(CharactersSource.PluginName, "RynthPluginApplyRemoteCommand");
- if (_apply == null) return;
- IntPtr a = Marshal.StringToHGlobalAnsi("rn");
- IntPtr v = Marshal.StringToHGlobalAnsi(value);
- try { _apply(a, v); }
- finally
- {
- Marshal.FreeHGlobal(a);
- Marshal.FreeHGlobal(v);
- }
- });
-}
diff --git a/src/RynthCore.Engine/UI/Data/DamageData.cs b/src/RynthCore.Engine/UI/Data/DamageData.cs
index dbb4f28..5f3e014 100644
--- a/src/RynthCore.Engine/UI/Data/DamageData.cs
+++ b/src/RynthCore.Engine/UI/Data/DamageData.cs
@@ -10,13 +10,14 @@
// UI thread. Setters run on the pump too (DamageCommands), so they no longer
// race the plugin tick.
//
-// Aelrynth difficulty tiers (2026-10-03): RynthAi keeps a monster's HP, kills,
-// casts to kill, seconds per kill and hit rate per tier of Aelrynth's awakened
-// worlds and scaled copies (same monsters, +5% a tier). The rows describe the
-// tier RynthAi is showing; RynthPluginGetAwakenedTierJson says which, and the
-// panel's picker sets it (RynthPluginSetDamageViewTier). Shown only on
-// Aelrynth (ServerInfo.IsAelrynth) and once RynthAi has seen the server's tier;
-// an older RynthAi without the export shows nothing of it.
+// Difficulty tiers (2026-10-03; generic since 2026-10-21): on a server whose
+// plugin reports tiers (the same monsters scaled by a percent a tier), RynthAi
+// keeps a monster's HP, kills, casts to kill, seconds per kill and hit rate per
+// tier. The rows describe the tier RynthAi is showing;
+// RynthPluginGetAwakenedTierJson (the export's old name) says which and whether
+// to show tiers at all, and the panel's picker sets it
+// (RynthPluginSetDamageViewTier). An older RynthAi without the export shows
+// nothing of it.
// ============================================================================
using System;
@@ -36,7 +37,7 @@ internal sealed class DamageRow
{
public uint Wcid; public string Name = ""; public uint Wid; public string Weapon = "";
public string Elem = ""; public int Tier; public int Hp; public bool HpManual;
- /// Hp is an estimate: real Dereth's +5% per Aelrynth difficulty tier (that tier not appraised yet).
+ /// Hp is an estimate: tier 0's plus the tier's scaling (that tier not appraised yet).
public bool HpEst;
public double Crit; public int CritN; public double NonCrit; public int NonCritN;
public double Casts; public int Kills; public string Key = "";
@@ -79,14 +80,14 @@ internal sealed class DamageView
/// ("" = Auto, "E:<element>", "I:<essence id>", label).
public List<(string Key, string Name)> PetChoices = new();
public bool Bound;
- /// The Aelrynth difficulty tier the rows describe; Show false = say nothing of tiers.
- public AwakenedTierView Tier = AwakenedTierView.Hidden;
+ /// The difficulty tier the rows describe; Show false = say nothing of tiers.
+ public DifficultyTierView Tier = DifficultyTierView.Hidden;
}
-/// RynthPluginGetAwakenedTierJson, gated on ServerInfo.IsAelrynth.
-internal sealed class AwakenedTierView
+/// RynthPluginGetAwakenedTierJson: RynthAi shows tiers only when the server plugin reports them.
+internal sealed class DifficultyTierView
{
- public static readonly AwakenedTierView Hidden = new();
+ public static readonly DifficultyTierView Hidden = new();
public bool Show;
/// The tier where the player stands; the tier the rows describe; whether that follows Current.
@@ -96,7 +97,7 @@ internal sealed class AwakenedTierView
/// Tiers with something learned, plus 0 and the current one, ascending.
public List Tiers = new();
- public static AwakenedTierView Parse(string? json)
+ public static DifficultyTierView Parse(string? json)
{
if (string.IsNullOrEmpty(json)) return Hidden;
try
@@ -104,7 +105,7 @@ internal sealed class AwakenedTierView
using var doc = JsonDocument.Parse(json);
JsonElement r = doc.RootElement;
if (!r.TryGetProperty("show", out var sh) || sh.ValueKind != JsonValueKind.True) return Hidden;
- var t = new AwakenedTierView { Show = true };
+ var t = new DifficultyTierView { Show = true };
if (r.TryGetProperty("current", out var c)) t.Current = c.GetInt32();
if (r.TryGetProperty("view", out var v)) t.View = v.GetInt32();
if (r.TryGetProperty("following", out var f)) t.Following = f.ValueKind == JsonValueKind.True;
@@ -162,8 +163,7 @@ internal sealed unsafe class DamageSource : UiSource
{
private delegate* unmanaged[Cdecl] _getRows, _getWeapons, _getPets, _getTier;
private string? _rowsJson, _weaponsJson, _petsJson, _tierJson;
- private AwakenedTierView _tier = AwakenedTierView.Hidden;
- private bool _tierAelrynth;
+ private DifficultyTierView _tier = DifficultyTierView.Hidden;
private List _rows = new();
private List<(uint Id, string Name)> _items = new();
private List<(string Key, string Name)> _pets = new();
@@ -197,14 +197,12 @@ internal sealed unsafe class DamageSource : UiSource
changed = true;
}
- // The difficulty tier, only on Aelrynth: anywhere else the panel says nothing of tiers.
- bool aelrynth = ServerInfo.IsAelrynth;
- string? tierJson = aelrynth && _getTier != null ? Read(_getTier) : null;
- if (aelrynth != _tierAelrynth || tierJson != _tierJson)
+ // The difficulty tier: RynthAi's {"show":false} where the server plugin reports none.
+ string? tierJson = _getTier != null ? Read(_getTier) : null;
+ if (tierJson != _tierJson)
{
- _tierAelrynth = aelrynth;
_tierJson = tierJson;
- _tier = aelrynth ? AwakenedTierView.Parse(tierJson) : AwakenedTierView.Hidden;
+ _tier = DifficultyTierView.Parse(tierJson);
changed = true;
}
@@ -230,8 +228,7 @@ internal sealed unsafe class DamageSource : UiSource
{
_getRows = _getWeapons = _getPets = _getTier = null;
_rowsJson = _weaponsJson = _petsJson = _tierJson = null;
- _tier = AwakenedTierView.Hidden;
- _tierAelrynth = false;
+ _tier = DifficultyTierView.Hidden;
ClearSnapshot();
}
@@ -577,7 +574,7 @@ internal static unsafe class DamageCommands
UiSources.Damage.RefreshPetsSoon();
});
- /// The Aelrynth difficulty tier the panel shows: -1 follows the one where the player stands.
+ /// The difficulty tier the panel shows: -1 follows the one where the player stands.
public static void SetViewTier(int tier) => Run("view tier", () =>
{
if (_setViewTier == null) _setViewTier = (delegate* unmanaged[Cdecl])Export("RynthPluginSetDamageViewTier");
diff --git a/src/RynthCore.Engine/UI/Sections/PluginWindows.cs b/src/RynthCore.Engine/UI/Sections/PluginWindows.cs
new file mode 100644
index 0000000..d5ba64d
--- /dev/null
+++ b/src/RynthCore.Engine/UI/Sections/PluginWindows.cs
@@ -0,0 +1,98 @@
+// ============================================================================
+// RynthCore.Engine - UI/Sections/PluginWindows.cs
+// The windows plugins draw (their manifests' "windows", plugin API v89;
+// docs/PLUGIN_WINDOWS.md), hosted as ImGui panels: the engine owns the window
+// (header, pop-out, close, resize, remembered place, bar button), the plugin
+// draws the body through RynthPluginRenderEmbed (PluginWindowFace).
+//
+// Sync runs after every SectionRegistry rebuild (AC's render thread): it
+// registers a dynamic panel for each window the manifests ask for (a window
+// with "server" only while that server is active) and unregisters the rest.
+// The panel key is the window's title, so its saved place, hotkeys and /rc
+// commands use the name players see; a title an engine panel has is refused.
+// A window seen for the first time this session opens if it was open when the
+// game last closed (Remember Open Windows); one that went with a plugin reload
+// opens again when the plugin comes back.
+//
+// WindowPlan.cs is the pure part (which windows, which are refused and why).
+// ============================================================================
+
+using System;
+using System.Collections.Generic;
+using System.Numerics;
+using RynthCore.Engine.ImGuiBackend;
+using RynthCore.Engine.ImGuiBackend.Panels;
+
+namespace RynthCore.Engine.UI.Sections;
+
+internal static class PluginWindows
+{
+ private sealed record Hosted(SectionWindowDecl Decl, string Signature);
+
+ private static readonly Dictionary Live = new(StringComparer.OrdinalIgnoreCase); // render thread
+ private static readonly HashSet SeenThisSession = new(StringComparer.OrdinalIgnoreCase); // render thread
+ private static readonly HashSet ReopenWhenBack = new(StringComparer.OrdinalIgnoreCase); // render thread
+ private static readonly HashSet RefusalsLogged = new(StringComparer.Ordinal); // render thread
+ private static volatile SectionWindowDecl[] _barWindows = Array.Empty();
+ private static int _version;
+
+ /// Hosted windows that asked for a bar button, in manifest order. Any thread.
+ public static SectionWindowDecl[] BarWindows => _barWindows;
+
+ /// Bumped whenever the hosted set changes (the bar rebuilds its buttons). Any thread.
+ public static int Version => System.Threading.Volatile.Read(ref _version);
+
+ /// True when is a plugin window hosted now. Render thread.
+ public static bool IsHosted(string title) => Live.ContainsKey(title);
+
+ /// After a SectionRegistry rebuild: register, update and drop the windows' panels. Render thread.
+ public static void Sync(IReadOnlyList manifests, IReadOnlyList servers)
+ {
+ var refused = new List();
+ Dictionary want = WindowPlan.Build(manifests, servers,
+ title => ImGuiPanelHost.HasFace(title) && !Live.ContainsKey(title), refused);
+ foreach (string r in refused)
+ if (RefusalsLogged.Add(r)) RynthLog.UI("PluginWindows: " + r + " - not shown.");
+
+ bool changed = false;
+ var gone = new List();
+ foreach (string title in Live.Keys)
+ if (!want.ContainsKey(title)) gone.Add(title);
+ foreach (string title in gone)
+ {
+ if (ImGuiPanelHost.IsOpen(title)) ReopenWhenBack.Add(title);
+ ImGuiPanelHost.Unregister(title);
+ Live.Remove(title);
+ changed = true;
+ }
+
+ foreach ((string title, SectionWindowDecl w) in want)
+ {
+ string sig = WindowPlan.Signature(w);
+ if (Live.TryGetValue(title, out Hosted? h) && h.Signature == sig) continue;
+ SectionWindowDecl decl = w;
+ ImGuiPanelHost.RegisterDynamic(title, title, Spec(decl), () => new PluginWindowFace(decl.Plugin, decl.Surface, decl.Title));
+ bool first = h == null;
+ Live[title] = new Hosted(decl, sig);
+ changed = true;
+ if (!first) continue;
+ bool reopen = ReopenWhenBack.Remove(title);
+ if (!reopen && SeenThisSession.Add(title) && Plugins.EngineSettings.RememberWindowLayout
+ && PanelStateStore.TryGetPanel(title, out PanelStateStore.PanelEntry saved) && saved.Open)
+ reopen = true;
+ SeenThisSession.Add(title);
+ if (reopen) ImGuiPanelHost.Open(title);
+ }
+
+ if (!changed) return;
+ var bar = new List();
+ foreach (Hosted h in Live.Values)
+ if (h.Decl.Bar) bar.Add(h.Decl);
+ _barWindows = bar.ToArray();
+ System.Threading.Interlocked.Increment(ref _version);
+ }
+
+ private static PanelSpec Spec(SectionWindowDecl w) => new(
+ new Vector2(w.Width, w.Height), new Vector2(w.MinWidth, w.MinHeight),
+ EdgeToEdge: w.EdgeToEdge, GripInBody: w.EdgeToEdge);
+}
diff --git a/src/RynthCore.Engine/UI/Sections/SectionManifest.cs b/src/RynthCore.Engine/UI/Sections/SectionManifest.cs
index b6f9379..2e55a0f 100644
--- a/src/RynthCore.Engine/UI/Sections/SectionManifest.cs
+++ b/src/RynthCore.Engine/UI/Sections/SectionManifest.cs
@@ -16,7 +16,11 @@
// { "section": "pets", "server": "", "label": "Pets", "surface": "section:pets",
// "primary": true, "width": 560, "height": 580 },
// { "section": "skills", "server": "ilt", "label": "Progression",
-// "command": "/rc progression", "tooltip": "...", "enabled": true, "note": "" } ]
+// "command": "/rc progression", "tooltip": "...", "enabled": true, "note": "" } ],
+// "windows": [
+// { "id": "characters", "title": "Characters", "surface": "window:characters",
+// "icon": "\uE68E", "width": 420, "height": 260, "minWidth": 280, "minHeight": 140,
+// "bar": true, "edgeToEdge": true, "server": "" } ]
// }
// servers servers the plugin knows. A built-in id (ilt, aelrynth) keeps the
// engine's own detection; a new id is detected from its lists.
@@ -26,6 +30,12 @@
// = drawn inline through RynthPluginRenderEmbed; "command" = a button
// that runs it. "primary" = the section's main view when the engine
// has no core panel for it (Pets, Crafting, Spells, ...).
+// windows (plugin API v89, 2026-10-21) windows the plugin draws and the engine
+// hosts as panels: header, pop-out, resize, remembered place, a bar
+// button when "bar" (the icon: a Phosphor glyph, else the title's
+// letter); the body is "surface" through RynthPluginRenderEmbed.
+// "title" is the panel key (unique; an engine panel's is refused).
+// "server" set: only while that server is active. docs/PLUGIN_WINDOWS.md.
//
// Everything from a plugin is checked here: ids are short lower-case words,
// text is capped, a command must be a single "/..." chat command, and the lists
@@ -67,6 +77,28 @@ internal sealed record SectionContribution(
public bool IsUniversal => Server.Length == 0;
}
+///
+/// A window a plugin draws, hosted by the engine (docs/PLUGIN_WINDOWS.md): its panel key and header
+/// are , its body the plugin's through RynthPluginRenderEmbed.
+///
+internal sealed record SectionWindowDecl(
+ string Plugin,
+ string Id,
+ string Title,
+ string Surface,
+ string Icon,
+ float Width,
+ float Height,
+ float MinWidth,
+ float MinHeight,
+ bool Bar,
+ bool EdgeToEdge,
+ string Server)
+{
+ /// For every world, not one server.
+ public bool IsUniversal => Server.Length == 0;
+}
+
/// One plugin's parsed manifest.
internal sealed record SectionManifest(
string Plugin,
@@ -76,6 +108,9 @@ internal sealed record SectionManifest(
{
public static readonly SectionManifest Empty =
new("", Array.Empty(), Array.Empty(), Array.Empty());
+
+ /// The windows the plugin draws (plugin API v89 engines host them; older ones ignore the key).
+ public SectionWindowDecl[] Windows { get; init; } = Array.Empty();
}
internal static class SectionManifestParser
@@ -93,6 +128,9 @@ internal static class SectionManifestParser
public const float MaxSurfaceSize = 4096f;
/// Largest manifest read at all (a manifest is a few KB).
public const int MaxJsonLength = 256 * 1024;
+ public const int MaxWindows = 8;
+ public const int MaxWindowTitleLength = 32;
+ public const float DefaultWindowWidth = 420f, DefaultWindowHeight = 300f, MinWindowSize = 120f, MaxWindowSize = 2000f;
///
/// Parses from plugin . Never throws:
@@ -155,7 +193,30 @@ internal static class SectionManifestParser
Int(e, "order", 1000)));
}
- return new SectionManifest(plugin, servers.ToArray(), sections.ToArray(), contributions.ToArray());
+ var windows = new List();
+ foreach (JsonElement e in Array(root, "windows"))
+ {
+ if (windows.Count >= MaxWindows) break;
+ string id = Id(Str(e, "id"));
+ string title = Text(Str(e, "title"), MaxWindowTitleLength);
+ string surface = Surface(Str(e, "surface"));
+ if (id.Length == 0 || title.Length == 0 || surface.Length == 0) continue;
+ if (windows.Exists(w => w.Id == id || w.Title.Equals(title, StringComparison.OrdinalIgnoreCase))) continue;
+ string rawServer = Str(e, "server");
+ string server = rawServer.Length == 0 ? string.Empty : Id(rawServer);
+ if (rawServer.Length > 0 && server.Length == 0) continue;
+ float width = WindowSize(Size(e, "width"), DefaultWindowWidth);
+ float height = WindowSize(Size(e, "height"), DefaultWindowHeight);
+ float minWidth = Math.Min(WindowSize(Size(e, "minWidth"), MinWindowSize), width);
+ float minHeight = Math.Min(WindowSize(Size(e, "minHeight"), MinWindowSize), height);
+ windows.Add(new SectionWindowDecl(plugin, id, title, surface, Icon(Str(e, "icon")),
+ width, height, minWidth, minHeight, Bool(e, "bar", false), Bool(e, "edgeToEdge", false), server));
+ }
+
+ return new SectionManifest(plugin, servers.ToArray(), sections.ToArray(), contributions.ToArray())
+ {
+ Windows = windows.ToArray(),
+ };
}
catch (JsonException ex)
{
@@ -200,6 +261,23 @@ internal static class SectionManifestParser
return t;
}
+ ///
+ /// A window's bar icon: one or two characters of the icon font's private use area
+ /// (U+E000-U+F8FF, where the Phosphor glyphs sit), else "" (the bar shows the title's letter).
+ ///
+ public static string Icon(string? text)
+ {
+ string t = (text ?? string.Empty).Trim();
+ if (t.Length is 0 or > 2) return string.Empty;
+ foreach (char c in t)
+ if (c is < '\uE000' or > '\uF8FF') return string.Empty;
+ return t;
+ }
+
+ /// A window dimension: the given size within MinWindowSize..MaxWindowSize, or .
+ private static float WindowSize(float given, float fallback) =>
+ given <= 0 ? fallback : Math.Clamp(given, MinWindowSize, MaxWindowSize);
+
/// One chat command ("/rc progression"): starts with '/', one line, capped; else "".
public static string Command(string? text)
{
diff --git a/src/RynthCore.Engine/UI/Sections/SectionRegistry.cs b/src/RynthCore.Engine/UI/Sections/SectionRegistry.cs
index a90e860..a677357 100644
--- a/src/RynthCore.Engine/UI/Sections/SectionRegistry.cs
+++ b/src/RynthCore.Engine/UI/Sections/SectionRegistry.cs
@@ -214,6 +214,9 @@ internal static class SectionRegistry
_revision++;
}
_snapshot = new Snapshot(servers, sections, manifests, _revision);
+ // The windows plugins draw (their manifests' "windows"): hosted as panels while wanted.
+ try { PluginWindows.Sync(manifests, servers); }
+ catch (Exception ex) { RynthLog.UI($"PluginWindows: sync failed - {ex.GetType().Name}: {ex.Message}"); }
}
/// The built-in servers, then every server a manifest declares with a new id.
diff --git a/src/RynthCore.Engine/UI/Sections/WindowPlan.cs b/src/RynthCore.Engine/UI/Sections/WindowPlan.cs
new file mode 100644
index 0000000..c9e5f72
--- /dev/null
+++ b/src/RynthCore.Engine/UI/Sections/WindowPlan.cs
@@ -0,0 +1,49 @@
+// ============================================================================
+// RynthCore.Engine - UI/Sections/WindowPlan.cs
+// Which plugin windows to host (PluginWindows.cs), from the manifests and the
+// servers: pure, so tools/SectionsTests compiles it as is.
+// ============================================================================
+
+using System;
+using System.Collections.Generic;
+
+namespace RynthCore.Engine.UI.Sections;
+
+/// Which plugin windows to host, from the manifests and the servers. Pure.
+internal static class WindowPlan
+{
+ ///
+ /// The windows to host, keyed by title, and the ones left out with the reason. A server
+ /// window counts only while its server is active; the first plugin to claim a title keeps it;
+ /// titles are refused.
+ ///
+ public static Dictionary Build(IReadOnlyList manifests,
+ IReadOnlyList servers, Func isEnginePanel, List refused)
+ {
+ var want = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ foreach (SectionManifest m in manifests)
+ foreach (SectionWindowDecl w in m.Windows)
+ {
+ if (!w.IsUniversal && !ServerActive(servers, w.Server)) continue;
+ if (isEnginePanel(w.Title)) { refused.Add($"{w.Plugin}'s window '{w.Title}': an engine panel has that title"); continue; }
+ if (want.TryGetValue(w.Title, out SectionWindowDecl? first))
+ {
+ refused.Add($"{w.Plugin}'s window '{w.Title}': {first.Plugin} has a window with that title");
+ continue;
+ }
+ want[w.Title] = w;
+ }
+ return want;
+ }
+
+ private static bool ServerActive(IReadOnlyList servers, string id)
+ {
+ foreach (ServerState s in servers)
+ if (s.Active && s.Id.Equals(id, StringComparison.OrdinalIgnoreCase)) return true;
+ return false;
+ }
+
+ /// What a hosted window's panel depends on: a change re-registers it.
+ public static string Signature(SectionWindowDecl w) =>
+ string.Join("|", w.Plugin, w.Surface, w.Icon, w.Width, w.Height, w.MinWidth, w.MinHeight, w.Bar, w.EdgeToEdge);
+}
diff --git a/src/RynthCore.PluginSdk/RynthCoreApiNative.cs b/src/RynthCore.PluginSdk/RynthCoreApiNative.cs
index f01f9b2..49240ae 100644
--- a/src/RynthCore.PluginSdk/RynthCoreApiNative.cs
+++ b/src/RynthCore.PluginSdk/RynthCoreApiNative.cs
@@ -181,6 +181,10 @@ public struct RynthCoreApiNative
public IntPtr GetServerStateJsonFn; // int GetServerStateJson(byte* buffer, int capacity) -> UTF-8 byte length (>= capacity: too small)
// v87: what the player wields, from the server's messages (the client's own fields go stale)
public IntPtr GetWieldedItemsFn; // int GetWieldedItems(uint* ids, uint* locations, int max) -> count, -1 not ready
+ // v89: plugin windows (RynthCore docs/PLUGIN_WINDOWS.md): the engine's look, and panels by key
+ public IntPtr GetUiColorFn; // uint GetUiColor(int token) -> ABGR, 0 unknown
+ public IntPtr GetUiFontFn; // void* GetUiFont(int font) -> ImFont*, null unknown / off AC's thread
+ public IntPtr SetPanelOpenFn; // int SetPanelOpen(const char* key, int mode) -> 1 open, 0 closed, -1 no such panel
}
///
diff --git a/src/RynthCore.PluginSdk/RynthCoreHost.cs b/src/RynthCore.PluginSdk/RynthCoreHost.cs
index 7dff495..8461189 100644
--- a/src/RynthCore.PluginSdk/RynthCoreHost.cs
+++ b/src/RynthCore.PluginSdk/RynthCoreHost.cs
@@ -146,6 +146,10 @@ public readonly unsafe struct RynthCoreHost
public bool HasGetServerStateJson => _api.Version >= 86 && _api.GetServerStateJsonFn != IntPtr.Zero;
/// v87: (what the player wields, from the server's messages).
public bool HasGetWieldedItems => _api.Version >= 87 && _api.GetWieldedItemsFn != IntPtr.Zero;
+ /// v89: and (the engine's look, for a plugin's own windows).
+ public bool HasUiTheme => _api.Version >= 89 && _api.GetUiColorFn != IntPtr.Zero && _api.GetUiFontFn != IntPtr.Zero;
+ /// v89: (open, close or toggle a panel by its key, a plugin window's title included).
+ public bool HasSetPanelOpen => _api.Version >= 89 && _api.SetPanelOpenFn != IntPtr.Zero;
/// v76: (close a corpse or chest like the client's window close).
public bool HasCloseContainer => _api.Version >= 76 && _api.CloseContainerFn != IntPtr.Zero;
/// v77: , and the UI callbacks
@@ -1504,6 +1508,41 @@ public readonly unsafe struct RynthCoreHost
// ─── Chat parser ────────────────────────────────────────────────────────
+ ///
+ /// v89: a colour of the player's theme as ImGui's packed colour (ABGR, for draw lists and
+ /// PushStyleColor), or on an older engine. Any thread; cheap, so
+ /// read it each frame and a theme change shows at once.
+ ///
+ public uint GetUiColor(RynthUiColor token, uint fallback)
+ {
+ if (!HasUiTheme) return fallback;
+ uint c = ((delegate* unmanaged[Cdecl])_api.GetUiColorFn)((int)token);
+ return c != 0 ? c : fallback;
+ }
+
+ ///
+ /// v89: the engine's ImFont* for at the text size of the panel being
+ /// drawn (wrap it in ImGuiNET's ImFontPtr and PushFont it). Zero on an older engine, for an
+ /// unknown font, or off AC's render thread (call it from RynthPluginRenderEmbed).
+ ///
+ public IntPtr GetUiFont(RynthUiFont font)
+ => HasUiTheme ? ((delegate* unmanaged[Cdecl])_api.GetUiFontFn)((int)font) : IntPtr.Zero;
+
+ ///
+ /// v89: opens, closes or toggles the panel (a plugin window's title, or an
+ /// engine panel's), or asks. Returns 1 open / 0 closed afterwards (the change lands on the next
+ /// frame), -1 for no such panel or an older engine. Any thread.
+ ///
+ public int SetPanelOpen(string key, RynthPanelOpen mode)
+ {
+ if (!HasSetPanelOpen || string.IsNullOrEmpty(key) || key.Length > 64) return -1;
+ Span utf8 = stackalloc byte[260];
+ int n = System.Text.Encoding.UTF8.GetBytes(key, utf8[..^1]);
+ utf8[n] = 0;
+ fixed (byte* p = utf8)
+ return ((delegate* unmanaged[Cdecl])_api.SetPanelOpenFn)(p, (int)mode);
+ }
+
public bool InvokeChatParser(string text)
{
if (_api.InvokeChatParserFn == IntPtr.Zero || string.IsNullOrEmpty(text))
diff --git a/src/RynthCore.PluginSdk/UiKitTypes.cs b/src/RynthCore.PluginSdk/UiKitTypes.cs
new file mode 100644
index 0000000..5195d9d
--- /dev/null
+++ b/src/RynthCore.PluginSdk/UiKitTypes.cs
@@ -0,0 +1,39 @@
+namespace RynthCore.PluginSdk;
+
+// ─── Plugin windows: the engine's look (engine API v89) ─────────────────────
+// RynthCoreHost.GetUiColor / GetUiFont / SetPanelOpen, for the windows a plugin
+// declares in its sections manifest ("windows") and draws itself through
+// RynthPluginRenderEmbed (RynthCore docs/PLUGIN_WINDOWS.md). Check
+// RynthCoreHost.HasUiTheme / HasSetPanelOpen first: older engines have neither.
+// The numbers match the engine's UiColorToken / UiFontToken and only grow.
+
+/// A colour of the player's theme (RynthCoreHost.GetUiColor).
+public enum RynthUiColor
+{
+ Text = 0, TextMuted = 1,
+ /// The theme's accent (teal by default): titles, links, the current item.
+ Accent = 2,
+ /// The highlight (amber by default): warnings, things to notice.
+ Highlight = 3,
+ Button = 4, Border = 5, Field = 6, Selected = 7, RowAlt = 8, Background = 9, PanelGlass = 10,
+ AccentFill = 11, BoxBg = 12, FrameBg = 13, FrameHover = 14, FrameActive = 15,
+ /// Fixed, whatever the theme: good / bad.
+ Green = 16, Red = 17,
+ TitleBar = 18, WindowBorder = 19,
+}
+
+/// A font the engine bakes (RynthCoreHost.GetUiFont): sizes in pixels at 100% text size.
+public enum RynthUiFont
+{
+ Ui9 = 0, Ui10 = 1,
+ /// The default for plugin windows.
+ Ui11 = 2,
+ Ui14 = 3, Ui18 = 4, UiBold11 = 5, UiBold14 = 6,
+ Mono9 = 7, Mono10 = 8, Mono12 = 9, Chat10 = 10, Chat12 = 11, Chat14 = 12,
+}
+
+/// What RynthCoreHost.SetPanelOpen does.
+public enum RynthPanelOpen
+{
+ Ask = -1, Close = 0, Open = 1, Toggle = 2,
+}
diff --git a/src/RynthCore.PluginSdk/build/RynthCore.PluginSdk.targets b/src/RynthCore.PluginSdk/build/RynthCore.PluginSdk.targets
index 4808aa9..807f9d7 100644
--- a/src/RynthCore.PluginSdk/build/RynthCore.PluginSdk.targets
+++ b/src/RynthCore.PluginSdk/build/RynthCore.PluginSdk.targets
@@ -36,7 +36,7 @@
- 88
+ 89
<_RynthPluginManifestOn Condition="'$(RynthPluginMinEngineApi)' != '' and '$(RynthPluginManifest)' != 'false'">true
diff --git a/tools/PluginManifestTests/Program.cs b/tools/PluginManifestTests/Program.cs
index 7e743b2..84f9186 100644
--- a/tools/PluginManifestTests/Program.cs
+++ b/tools/PluginManifestTests/Program.cs
@@ -591,11 +591,11 @@ internal static class Program
Eq((int)Marshal.OffsetOf(f.Name), (int)Marshal.OffsetOf(f.Name), "TrainingEntryNative." + f.Name + " offset");
Eq(RynthCore.PluginSdk.TrainingInfoFlags.Busy, RynthCore.Engine.Plugins.TrainingInfoFlags.Busy, "info flag bits");
Eq(RynthCore.PluginSdk.TrainingEntryFlags.Trainable, RynthCore.Engine.Plugins.TrainingEntryFlags.Trainable, "entry flag bits");
- // The three v79 slots follow v78's, then v80's two and v81's GetMergeStackResultFn (v82-v85 follow).
- var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(8).TakeLast(6).ToArray();
+ // The three v79 slots follow v78's, then v80's two and v81's GetMergeStackResultFn (v82-v89 follow).
+ var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(11).TakeLast(6).ToArray();
Check(names.SequenceEqual(new[] { "GetTrainingInfoFn", "RaiseFn", "TrainSkillFn", "GetContainerOrderFn", "PutItemInContainerFn", "GetMergeStackResultFn" }),
"v79, v80 then v81 slots last: " + string.Join(",", names));
- var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(8).TakeLast(6).ToArray();
+ var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(11).TakeLast(6).ToArray();
Check(sdkNames.SequenceEqual(names), "SDK v79, v80 and v81 slots in the same order");
}
@@ -607,19 +607,21 @@ internal static class Program
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).ToArray();
var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).ToArray();
// v81's GetMergeStackResultFn follows v80's two slots.
- Check(names.SkipLast(9).TakeLast(2).SequenceEqual(new[] { "GetContainerOrderFn", "PutItemInContainerFn" }), "v80 slots before v81's to v85's: " + string.Join(",", names.SkipLast(9).TakeLast(2)));
- Check(sdkNames.SkipLast(9).TakeLast(2).SequenceEqual(names.SkipLast(9).TakeLast(2)), "SDK v80 slots in the same order");
- Check(names.SkipLast(7).Last() == "SalvageDirectFn", "v82 slot before v83's");
+ Check(names.SkipLast(12).TakeLast(2).SequenceEqual(new[] { "GetContainerOrderFn", "PutItemInContainerFn" }), "v80 slots before v81's to v85's: " + string.Join(",", names.SkipLast(12).TakeLast(2)));
+ Check(sdkNames.SkipLast(12).TakeLast(2).SequenceEqual(names.SkipLast(12).TakeLast(2)), "SDK v80 slots in the same order");
+ Check(names.SkipLast(10).Last() == "SalvageDirectFn", "v82 slot before v83's");
// v83: GetObjectServerAge and RemoveClientObject (ghost creatures), then v84's slot.
- Check(names.SkipLast(5).TakeLast(2).SequenceEqual(new[] { "GetObjectServerAgeFn", "RemoveClientObjectFn" }), "v83 slots before v84's: " + string.Join(",", names.SkipLast(5).TakeLast(2)));
+ Check(names.SkipLast(8).TakeLast(2).SequenceEqual(new[] { "GetObjectServerAgeFn", "RemoveClientObjectFn" }), "v83 slots before v84's: " + string.Join(",", names.SkipLast(8).TakeLast(2)));
// v84: GetObjectProperties (every property of an object, /ub propertydump), then v85's two.
- Check(names.SkipLast(4).Last() == "GetObjectPropertiesFn", "v84 slot before v85's: " + names.SkipLast(4).Last());
+ Check(names.SkipLast(7).Last() == "GetObjectPropertiesFn", "v84 slot before v85's: " + names.SkipLast(7).Last());
// v85: ArmConfirmation and GetLastConfirmation (the server's yes/no prompts), then v86's slot.
- Check(names.SkipLast(2).TakeLast(2).SequenceEqual(new[] { "ArmConfirmationFn", "GetLastConfirmationFn" }), "v85 slots before v86's: " + string.Join(",", names.SkipLast(2).TakeLast(2)));
+ Check(names.SkipLast(5).TakeLast(2).SequenceEqual(new[] { "ArmConfirmationFn", "GetLastConfirmationFn" }), "v85 slots before v86's: " + string.Join(",", names.SkipLast(5).TakeLast(2)));
// v86: GetServerStateJson (which server this is, for every plugin), then v87's slot.
- Check(names.SkipLast(1).Last() == "GetServerStateJsonFn", "v86 slot before v87's: " + names.SkipLast(1).Last());
- // v87: GetWieldedItems ends the table (what the player wields, from the server's messages).
- Check(names.Last() == "GetWieldedItemsFn", "v87 slot last: " + names.Last());
+ Check(names.SkipLast(4).Last() == "GetServerStateJsonFn", "v86 slot before v87's: " + names.SkipLast(4).Last());
+ // v87: GetWieldedItems (what the player wields, from the server's messages), then v89's three.
+ Check(names.SkipLast(3).Last() == "GetWieldedItemsFn", "v87 slot before v89's: " + names.SkipLast(3).Last());
+ // v89: plugin windows (the engine's look, panels by key) end the table.
+ Check(names.TakeLast(3).SequenceEqual(new[] { "GetUiColorFn", "GetUiFontFn", "SetPanelOpenFn" }), "v89 slots last: " + string.Join(",", names.TakeLast(3)));
Check(typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SequenceEqual(typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name)), "SDK table has the engine's slots in the same order");
Eq(Marshal.SizeOf(), Marshal.SizeOf(), "SDK table size = engine table size");
Eq((int)Marshal.OffsetOf("PutItemInContainerFn"),
@@ -644,6 +646,11 @@ internal static class Program
(int)Marshal.OffsetOf("GetServerStateJsonFn"), "GetServerStateJsonFn offset");
Eq((int)Marshal.OffsetOf("GetWieldedItemsFn"),
(int)Marshal.OffsetOf("GetWieldedItemsFn"), "GetWieldedItemsFn offset");
+ foreach (string slot in new[] { "GetUiColorFn", "GetUiFontFn", "SetPanelOpenFn" })
+ Eq((int)Marshal.OffsetOf(slot),
+ (int)Marshal.OffsetOf(slot), slot + " offset");
+ Eq((int)Marshal.OffsetOf("GetUiColorFn"),
+ (int)Marshal.OffsetOf("GetWieldedItemsFn") + IntPtr.Size, "GetUiColorFn right after GetWieldedItemsFn");
}
private sealed class ProbePlugin : RynthCore.PluginCore.RynthPluginBase { }
diff --git a/tools/SectionsTests/Program.cs b/tools/SectionsTests/Program.cs
index 890ff9f..4091fd8 100644
--- a/tools/SectionsTests/Program.cs
+++ b/tools/SectionsTests/Program.cs
@@ -28,6 +28,8 @@ internal static class Program
SelectionCurrentPick();
SelectionActiveAndOwner();
StateJson();
+ ManifestWindows();
+ WindowPlanChoices();
Console.WriteLine();
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
@@ -434,6 +436,69 @@ internal static class Program
Check(System.Text.Encoding.UTF8.GetString(big, 0, length) == json && big[length] == 0, "fits: text and NUL");
}
+ // ── Plugin windows (v89, docs/PLUGIN_WINDOWS.md) ───────────────────
+
+ private const string WindowsManifest = """
+ { "version": 1,
+ "windows": [
+ { "id": "characters", "title": "Characters", "surface": "window:characters", "icon": "\uE68E",
+ "width": 420, "height": 260, "minWidth": 280, "minHeight": 140, "bar": true, "edgeToEdge": true },
+ { "id": "bank", "title": "Bank", "surface": "window:bank", "server": "ilt" },
+ { "id": "tiny", "title": "Tiny", "surface": "window:tiny", "width": 10, "height": 99999, "minWidth": 5000 },
+ { "id": "badicon", "title": "Bad Icon", "surface": "window:x", "icon": "AB" },
+ { "id": "characters", "title": "Again", "surface": "window:again" },
+ { "id": "dupe", "title": "characters", "surface": "window:dupe" },
+ { "id": "Bad Id", "title": "No", "surface": "window:no" },
+ { "id": "nosurface", "title": "No surface" },
+ { "id": "popout", "title": "Popout", "surface": "window:x:popout" },
+ { "id": "srv", "title": "Bad server", "surface": "window:s", "server": "Not An Id" }
+ ] }
+ """;
+
+ private static void ManifestWindows()
+ {
+ Case("manifest: windows a plugin draws");
+ SectionManifest m = SectionManifestParser.Parse("RynthNet", WindowsManifest, out string err);
+ Check(err.Length == 0, "parses: " + err);
+ Check(m.Windows.Length == 4, $"four kept (got {m.Windows.Length}: {string.Join(", ", m.Windows.Select(w => w.Title))})");
+ SectionWindowDecl c = m.Windows[0];
+ Check(c.Plugin == "RynthNet" && c.Id == "characters" && c.Title == "Characters" && c.Surface == "window:characters", "identity");
+ Check(c.Icon == "\uE68E" && c.Bar && c.EdgeToEdge && c.IsUniversal, "icon, bar, edge to edge, every world");
+ Check(c.Width == 420 && c.Height == 260 && c.MinWidth == 280 && c.MinHeight == 140, "sizes as given");
+ SectionWindowDecl bank = m.Windows[1];
+ Check(bank.Server == "ilt" && !bank.IsUniversal && !bank.Bar && bank.Icon == "", "a server's window, no bar, no icon");
+ Check(bank.Width == SectionManifestParser.DefaultWindowWidth && bank.Height == SectionManifestParser.DefaultWindowHeight, "default size");
+ SectionWindowDecl tiny = m.Windows[2];
+ Check(tiny.Width == SectionManifestParser.MinWindowSize && tiny.Height == SectionManifestParser.MaxWindowSize, "sizes clamped");
+ Check(tiny.MinWidth <= tiny.Width && tiny.MinHeight <= tiny.Height, "the minimum never exceeds the size");
+ Check(m.Windows[3].Title == "Bad Icon" && m.Windows[3].Icon == "", "an icon outside the icon font is dropped, the window kept");
+ Check(SectionManifestParser.Icon("\uE68E\uE4D6") == "\uE68E\uE4D6" && SectionManifestParser.Icon("\uE68E\uE4D6\uE000") == "", "one or two glyphs");
+ // An old manifest has none; an engine before v89 just ignores the key.
+ Check(SectionManifestParser.Parse("p", GoodManifest, out _).Windows.Length == 0, "no windows key: none");
+ var many = "{\"windows\":[" + string.Join(",", Enumerable.Range(0, 20).Select(i => $"{{\"id\":\"w{i}\",\"title\":\"W{i}\",\"surface\":\"window:w{i}\"}}")) + "]}";
+ Check(SectionManifestParser.Parse("p", many, out _).Windows.Length == SectionManifestParser.MaxWindows, "capped at MaxWindows");
+ }
+
+ private static void WindowPlanChoices()
+ {
+ Case("plugin windows: which are hosted");
+ SectionManifest net = SectionManifestParser.Parse("RynthNet", WindowsManifest, out _);
+ SectionManifest other = SectionManifestParser.Parse("Other",
+ "{\"windows\":[{\"id\":\"c\",\"title\":\"Characters\",\"surface\":\"window:c\"},{\"id\":\"inv\",\"title\":\"Inventory\",\"surface\":\"window:i\"}]}", out _);
+ var offIlt = new[] { new ServerState("ilt", "Infinite Leaftide", false, false, ServerForce.Auto, true, "") };
+ var onIlt = new[] { new ServerState("ilt", "Infinite Leaftide", true, true, ServerForce.Auto, true, "") };
+ var refused = new List();
+ var plan = WindowPlan.Build(new[] { net, other }, offIlt, t => t == "Inventory", refused);
+ Check(plan.ContainsKey("Characters") && plan["Characters"].Plugin == "RynthNet", "the first plugin keeps a title");
+ Check(!plan.ContainsKey("Bank"), "a server's window waits for its server");
+ Check(!plan.ContainsKey("Inventory"), "an engine panel's title is refused");
+ Check(refused.Count == 2 && refused.Exists(r => r.Contains("Other") && r.Contains("RynthNet")) && refused.Exists(r => r.Contains("engine panel")),
+ "both refusals say why: " + string.Join(" | ", refused));
+ var on = WindowPlan.Build(new[] { net }, onIlt, _ => false, new List());
+ Check(on.ContainsKey("Bank"), "and shows while its server is active");
+ Check(WindowPlan.Signature(net.Windows[0]) != WindowPlan.Signature(net.Windows[1]), "signatures differ per window");
+ }
+
// ── Harness ────────────────────────────────────────────────────────
private static void Case(string name)
diff --git a/tools/SectionsTests/SectionsTests.csproj b/tools/SectionsTests/SectionsTests.csproj
index 319dc22..63ddfdd 100644
--- a/tools/SectionsTests/SectionsTests.csproj
+++ b/tools/SectionsTests/SectionsTests.csproj
@@ -23,6 +23,7 @@
+