feat: SK backlog from test through 2026.11.22.48 (Trade Shop, Oracle, quests, loot, nav)

Squash of test/main-merge-2026-10-25 onto aelrynth main 2026.11.19.1 for the standing sk PR. Includes Trade Shop, Oracle wiki/ILT tracker, quest runs, loot checklist, RynthNav, VTank import. HandWrittenVersion remains 0.5.0-legacy-ui. See Changelog/2026-11-22-sk-backlog-test-merge.md.
This commit is contained in:
BlankenshipG 2026-11-23 00:08:38 -05:00
commit dc08e1abba
521 changed files with 47247 additions and 795 deletions

View file

@ -1528,6 +1528,13 @@ internal static class ActionPacer
/// CastSpell, recorded as the outstanding action. RynthAi's callers check MayStart first;
/// <paramref name="asked"/> (a player command or meta) is never held, only recorded.
/// </summary>
/// <summary>
/// The spell of the last cast sent by any subsystem (0 before the first). A server refusal
/// ("You don't have all the components for this spell.") names no spell: it answers this one,
/// so the buff and combat paths each blame a refusal only when it is their own cast.
/// </summary>
public static int LastCastSpellId { get; private set; }
public static bool CastSpellFor(this RynthCoreHost host, uint targetId, int spellId, string who, string label, bool asked = false)
{
// No cast goes out with a held stop still waiting (2026-10-12): the stop is sent first. The
@ -1539,6 +1546,7 @@ internal static class ActionPacer
if (ok)
{
CastsSent++;
LastCastSpellId = spellId;
LastCastSeqAtSend = host.HasUseDoneSeq ? seq : -1;
Begin(host, PacedKind.Cast, unchecked((uint)spellId), label, who, seq);
lock (Gate) { if (_cur is { Kind: PacedKind.Cast } c && c.Id == unchecked((uint)spellId)) c.Target = targetId; }

View file

@ -4,7 +4,7 @@
// GetServerStateJson), parsed: every server the engine knows (built-in ILT and
// Aelrynth, plus each loaded server plugin's declaration), whether it is
// active, this character's override, and which plugin owns it (the one to ask
// for its settings through "RynthServer.Profile"; RynthILT answers it for "ilt").
// for its settings: "RynthServer.Profile", or RynthILT's "RynthILT.Server").
// The same verdict the Mini Remote, the menus and the Diagnostics server
// picker use, so every plugin follows one choice, overrides included.
//
@ -25,6 +25,50 @@ internal sealed record EngineServer(string Id, string Name, bool Active, bool De
/// <summary>The engine's server list at one moment (GetServerStateJson, schema 1).</summary>
internal sealed class EngineServerState
{
/// <summary>Engine server ids with a meaning across RynthSuite.</summary>
public const string IltId = "ilt";
public const string AelrynthId = "aelrynth";
/// <summary>RynthILT serves "RynthILT.Server" for the "ilt" server, not "RynthServer.Profile".</summary>
public const string IltPlugin = "RynthILT";
/// <summary>
/// Whether this world is one of <paramref name="names"/> (a user's server list, "InfiniteLeaftide,
/// Conquest"): names compare case- and space-insensitively against server ids, names and the world.
/// Without the engine (<paramref name="engine"/> null) the world name decides. With it, an active
/// server decides ("ilt" counts as any Leaftide name); with none active the world name still counts,
/// unless it names a server the engine lists, which is then off on purpose (not detected, or this
/// character's override).
/// </summary>
public static bool MatchesNameList(EngineServerState? engine, string? world, IReadOnlyList<string> names)
{
bool Named(string? s)
{
string n = Norm(s);
if (n.Length == 0) return false;
foreach (string name in names)
if (Norm(name) == n) return true;
return false;
}
bool anyLeaftide = false;
foreach (string name in names)
if (Norm(name).Contains("leaftide", StringComparison.Ordinal)) anyLeaftide = true;
if (engine == null) return Named(world);
if (engine.HasActive)
return Named(engine.Active) || Named(engine.ActiveName) || (anyLeaftide && engine.IsActive(IltId));
if (!Named(world)) return false;
string w = Norm(world);
foreach (EngineServer s in engine.Servers)
{
if (Norm(s.Id) == w || Norm(s.Name) == w) return false;
// ILT's world names ("InfiniteLeaftide") are the engine's own ILT detection.
if (s.Id.Equals(IltId, StringComparison.OrdinalIgnoreCase) && w.Contains("leaftide", StringComparison.Ordinal)) return false;
}
return true;
}
private static string Norm(string? s) => (s ?? string.Empty).Replace(" ", string.Empty).Trim().ToLowerInvariant();
public int Revision { get; private init; }
/// <summary>The connect host the client was launched with ("" when not known).</summary>
public string Host { get; private init; } = string.Empty;
@ -112,8 +156,8 @@ internal sealed class EngineServerState
}
/// <summary>
/// The headline facts of a server owner's profile JSON ("RynthServer.Profile" from the plugin that
/// owns the server), read leniently: a field the owner doesn't send stays "".
/// The headline facts of a server owner's profile JSON ("RynthServer.Profile" from a server plugin,
/// or RynthILT's "RynthILT.Server"), read leniently: a field the owner doesn't send stays "".
/// </summary>
internal sealed record ServerProfileView(string Id, string Name, string Plugin, string Ruleset, string Emulator,
string Botting, string BottingNote, string AccountLimit)
@ -178,8 +222,7 @@ internal sealed record ServerProfileView(string Id, string Name, string Plugin,
/// <summary>
/// One salvage from a server plugin's profile "salvage" list (ServerPackInfo.Salvage): a tinkering
/// recipe the server adds, for the Mini Remote's Crafting tab. The fields after
/// <paramref name="NameMatch"/> are optional in the JSON; absent, a row behaves as before them.
/// recipe the server adds, for the Mini Remote's Crafting tab.
/// </summary>
/// <param name="AppliedInt">"applied": an int property of the item that reads 2 once the row is on it (0 = none).</param>
/// <param name="Prepared">"prepared": the bag must first be prepared on the chosen tier's Ammunition.</param>
@ -241,9 +284,8 @@ internal sealed record ServerSalvageView(string Bench, int Material, string Kind
string StackGroup = "", int StackCap = 0)
{
/// <summary>
/// The profile's salvage rows, read leniently: a missing list (an older plugin) is empty; a row
/// without a bench or a material id is skipped; "slot" defaults to true, the optional fields to
/// none (a stack group without a positive cap is no group).
/// The profile's salvage rows, read leniently: a missing list (an older plugin, or RynthILT's
/// profile) is empty; a row without a bench or a material id is skipped; "slot" defaults to true.
/// </summary>
public static IReadOnlyList<ServerSalvageView> ParseList(string? json)
{
@ -264,16 +306,8 @@ internal sealed record ServerSalvageView(string Bench, int Material, string Kind
if (bench.Length == 0 || material <= 0) continue;
string kind = EngineServerState.Str(e, "kind").Trim().ToLowerInvariant();
bool slot = !(e.TryGetProperty("slot", out JsonElement s) && s.ValueKind == JsonValueKind.False);
string group = EngineServerState.Str(e, "stackGroup").Trim();
int cap = EngineServerState.Int(e, "stackCap");
if (cap <= 0) group = string.Empty;
rows.Add(new ServerSalvageView(bench, material, kind.Length > 0 ? kind : "tink",
EngineServerState.Str(e, "effect"), slot, EngineServerState.Str(e, "nameMatch"),
AppliedInt: EngineServerState.Int(e, "applied"),
Prepared: EngineServerState.Bool(e, "prepared"),
Order: EngineServerState.Int(e, "order"),
AfterCap: EngineServerState.Bool(e, "afterCap"),
StackGroup: group, StackCap: group.Length > 0 ? cap : 0));
EngineServerState.Str(e, "effect"), slot, EngineServerState.Str(e, "nameMatch")));
}
}
catch (JsonException)

View file

@ -0,0 +1,78 @@
// ============================================================================
// RynthSuite - Plugins/Shared/RynthAiDungeonPathApi.cs
// The "RynthAi.DungeonPath" interface (2026-10-29): RynthAi's dungeon pathfinder
// (DungeonPathfinder: the cell graph and doorways read from the client's dats, what
// the Dungeon Patrol and /ra dunnav walk) offered to other plugins through the host's
// GetPluginInterface (API v68). RynthNav uses it to walk inside a dungeon to the one
// portal a route needs when it has never walked there itself. Compiled into both
// plugins (linked source), so the layout can't drift between them.
//
// Rules (same as RynthNav.Path):
// - Append-only: new functions go at the end, and Version goes up. A caller
// checks StructSize before using a field past the ones it knows.
// - Call only from the plugin pump thread (OnTick and the events it drains).
// - Resolve the table again every time it is needed; never keep the pointer
// across ticks. RynthAi may not be loaded, or may be reloaded.
// - Every function returns safely (no exception crosses the boundary).
//
// v2 (2026-10-30): FindPath2 (drops down, cells to avoid, point kinds).
// v3 (2026-11-07): ObstacleAhead (how high the thing in front is, from the dats: RynthNav
// jumps over what the character's jump clears and steps round what it doesn't).
//
// World units: x = east (landblockX * 192 + local x),
// y = north (landblockY * 192 + local y),
// z = height (the pose z). Both ends in the same dungeon landblock.
// ============================================================================
using System.Runtime.InteropServices;
namespace RynthCore.Plugin.Shared;
[StructLayout(LayoutKind.Sequential)]
public unsafe struct RynthAiDungeonPathApiV1
{
public const string PluginName = "RynthAi";
public const string InterfaceName = "RynthAi.DungeonPath";
public const uint InterfaceVersion = 3;
/// <summary>FindPath2 point kinds: walk on to the next point.</summary>
public const int KindWalk = 0;
/// <summary>FindPath2 point kinds: the edge of a drop; the next point is where you land (walk off).</summary>
public const int KindDrop = 1;
/// <summary>FindPath: a path was found.</summary>
public const int ResultOk = 1;
/// <summary>FindPath: both ends are in the dungeon's cells, but no walk joins them (only a drop, or none).</summary>
public const int ResultNoPath = 0;
/// <summary>FindPath: the dats aren't loaded yet, the landblock has no dungeon cells, or an end isn't in a cell.</summary>
public const int ResultNoData = -1;
public uint Version; // InterfaceVersion of the table RynthAi filled
public uint StructSize; // sizeof(RynthAiDungeonPathApiV1) as RynthAi built it
/// <summary>
/// A walk inside dungeon landblock <c>landblock</c> (0xLLLL) from (sx, sy, sz) to (gx, gy, gz):
/// through the doorways the cells share, as the Dungeon Patrol walks. Writes the corners as
/// x,y,z triples into <c>points</c> (room for <c>maxPoints</c> corners), start first and goal
/// last, and the count into <c>*count</c>. Returns ResultOk, ResultNoPath or ResultNoData.
/// </summary>
public delegate* unmanaged[Cdecl]<uint, double, double, double, double, double, double, double*, int, int*, int> FindPath;
/// <summary>
/// v2 (2026-10-30): FindPath with more ways and fewer: <c>maxDrop</c> (world units, 0 = none)
/// lets the walk drop down a ledge or shaft that high (one way: never up); <c>avoid</c> holds
/// <c>avoidCount</c> x,y,z points (world) whose cells are left out (a locked door's doorway);
/// <c>kinds</c> (room for <c>maxPoints</c>, may be null) gets each point's KindWalk / KindDrop.
/// </summary>
public delegate* unmanaged[Cdecl]<uint, double, double, double, double, double, double, double, double*, int, double*, int*, int, int*, int> FindPath2;
/// <summary>
/// v3 (2026-11-07): what stands in front of a walker at (x, y, z) in landcell <c>landcell</c>, looking
/// <c>headingDeg</c> (0 north, 90 east) up to <c>ahead</c> world units: rays at rising heights through the
/// static geometry the dats place there (walls, fences, rocks; not doors or creatures, which are live
/// objects). ResultOk: something is there, and <c>*topAbove</c> is the lowest height above z a ray passes
/// over it (more than <c>maxHeight</c>: <c>maxHeight</c> + 1, too high). ResultNoPath: nothing static in the
/// way. ResultNoData: no geometry loaded.
/// </summary>
public delegate* unmanaged[Cdecl]<uint, double, double, double, double, double, double, double*, int> ObstacleAhead;
}

View file

@ -0,0 +1,52 @@
// ============================================================================
// RynthSuite - Plugins/Shared/RynthServerQuestGuideApi.cs
// The "RynthServer.QuestGuide" interface (2026-11-21): a server plugin's own wiki
// quest guide for a quest reader such as RynthOracle, whose wiki tab shows it
// (with Run this quest, its route and loot profile) without knowing the server.
// RynthConquest serves the Conquest wiki's quests this way; RynthILT has its own
// older table ("RynthILT.Server" v2, GetQuestGuideInfoJson) with the same info.
// The reader asks only the plugin RynthCore names as the active server's owner
// (GetServerStateJson "activePlugin", host GetPluginInterface), so a guide shows
// only while its server is the active one. No interface = no server guide.
// Compiled into the server plugins and their readers (linked source).
//
// Rules (as the other shared interfaces):
// - Append-only: new functions go at the end, and Version goes up.
// - Strings are UTF-8, NUL-terminated.
// - Every function returns safely (no exception crosses the boundary).
// - The table is allocated once per loaded copy of the plugin and never freed;
// shutdown sets Version to 0, and a reader re-queries when it sees that.
//
// GetGuideInfoJson payload (read leniently; RynthILT's guide info plus "tag"):
// {
// "schema": 1,
// "path": "C:\\...\\cq-guide.json", // the guide file (QuestGuide JSON, RynthOracle's Data/QuestGuide.cs)
// "revision": 3, // goes up when the file is written again (read it again)
// "running": false, // a read of the wiki is under way
// "login": true, // the guide needs no login (or has one)
// "status": "317 pages ...", // a line for the reader to show
// "tag": "Conquest" // the server's display name (the tab's label)
// }
// 0 / "" = no guide yet.
// ============================================================================
using System.Runtime.InteropServices;
namespace RynthCore.Plugin.Shared;
[StructLayout(LayoutKind.Sequential)]
public unsafe struct RynthServerQuestGuideApiV1
{
public const string InterfaceName = "RynthServer.QuestGuide";
public const uint InterfaceVersion = 1;
public uint Version; // InterfaceVersion of the table the plugin filled; 0 once it has shut down
public uint StructSize; // sizeof(RynthServerQuestGuideApiV1) as the plugin built it
/// <summary>
/// GetGuideInfoJson(buffer, capacity): writes the info JSON (UTF-8, NUL-terminated) into buffer when it
/// fits, and returns its length in bytes without the NUL. A return value of capacity or more means
/// nothing was written: call again with a bigger buffer. 0 = no guide. Any thread.
/// </summary>
public delegate* unmanaged[Cdecl]<byte*, int, int> GetGuideInfoJson;
}

View file

@ -0,0 +1,104 @@
// ============================================================================
// RynthSuite - Plugins/Shared/SavedWindow.cs
// Keeps a plugin's own floating ImGui window where the player left it, per
// character, through the engine (plugin API v93, Get/SetWindowPlacement).
//
// Plugin windows saved their spot only in imgui.ini, which every running client
// shares and rewrites whole, so a window moved in one client came back where
// another client's next save had it (the Item HUD's spot, the Mini Remote's size;
// 2026-10-26). The engine keeps one file per character instead
// (%LocalAppData%\RynthCore\window_state.<server>.<character>.txt).
//
// Use (linked source, like SafeImGui): the plugin sets SavedWindow.Host once at
// start (each plugin has its own copy of the static), then one per window:
// private readonly SavedWindow _spot = new("RynthAi.ItemHud", trackSize: false);
// _spot.Apply(); // immediately before ImGui.Begin
// if (ImGui.Begin(...)) { _spot.Track(); ... } // after Begin, before End
// _spot.Reset(); // when the window is hidden (optional)
// trackSize false: a window that sizes itself (AlwaysAutoResize); only its spot is kept.
// An engine older than v93 has no store: the window keeps imgui.ini's behaviour.
// Render thread only.
// ============================================================================
using System;
using System.Numerics;
using ImGuiNET;
using RynthCore.PluginSdk;
namespace RynthCore.Plugin.Shared;
internal sealed class SavedWindow
{
private const long RetryMs = 1000;
/// <summary>This plugin's host; set once at start. Null: windows keep imgui.ini's behaviour.</summary>
public static RynthCoreHost? Host { get; set; }
private readonly string _key;
private readonly bool _trackSize;
private bool _applied; // the saved spot was put on the window (or the player placed it since)
private long _nextTryMs;
private bool _seen;
private bool _editing;
private Vector2 _lastPos, _lastSize;
/// <param name="key">The window's name in the store: "Plugin.Window", unique across plugins, up to 96 characters, no '='.</param>
/// <param name="trackSize">Keep the size too (false for a window that sizes itself).</param>
public SavedWindow(string key, bool trackSize = true)
{
_key = key;
_trackSize = trackSize;
}
/// <summary>
/// Immediately before Begin (nothing else may Begin in between): puts the window where this character left it. Looks it up once (again each
/// second while no character is logged in yet, until the player moves the window themselves).
/// </summary>
public void Apply()
{
if (_applied || Host is not RynthCoreHost host || !host.HasWindowPlacements) return;
long now = Environment.TickCount64;
if (now < _nextTryMs) return;
_nextTryMs = now + RetryMs;
try
{
if (!host.TryGetWindowPlacement(_key, out Vector2 pos, out Vector2 size)) return;
_applied = true;
ImGui.SetNextWindowPos(pos, ImGuiCond.Always);
if (_trackSize && size.X > 0 && size.Y > 0) ImGui.SetNextWindowSize(size, ImGuiCond.Always);
}
catch { _applied = true; }
}
/// <summary>
/// Between Begin and End: once the player has finished moving (or resizing) the window - the mouse
/// went up after it changed while it was focused and held - saves the spot for this character. A
/// move the code makes (first-use centring, auto-resize, an off-screen rescue) is never saved.
/// </summary>
public void Track()
{
Vector2 pos = ImGui.GetWindowPos();
Vector2 size = ImGui.GetWindowSize();
bool changed = pos != _lastPos || (_trackSize && size != _lastSize);
bool first = !_seen;
_seen = true;
_lastPos = pos;
_lastSize = size;
if (first) return;
bool down = ImGui.IsMouseDown(ImGuiMouseButton.Left);
if (down && changed && ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows)) _editing = true;
if (down || !_editing) return;
_editing = false;
_applied = true; // the player's own spot from now on, even if the lookup never found one
if (Host is not RynthCoreHost host || !host.HasWindowPlacements) return;
try { host.SetWindowPlacement(_key, pos, _trackSize ? size : Vector2.Zero); }
catch { }
}
/// <summary>The window was hidden: the next show doesn't count its first frame as a player move.</summary>
public void Reset()
{
_seen = false;
_editing = false;
}
}