Snapshot for release 2026.10.13.2 (internal 6cd69e2)

This commit is contained in:
Tom Bohar 2026-10-13 15:07:08 -04:00
commit 56b9f6c813
94 changed files with 5793 additions and 1637 deletions

View file

@ -253,9 +253,11 @@ internal static unsafe class FakeHost
VTankFlags = -1; VTankSeq = 0; LogCostMicros = 0;
ServerGates = false; UseDoneSeq = 0; CastBusy = 0; LastUseDoneError = 0; LastUseDoneCalls = false;
WeenieErrorCalls = false; WeenieErrSeq = 0; WeenieErrCode = WeenieErrEvent = WeenieErrObject = 0;
#if !RYNTHILT_TESTS
// Spell mana costs "unknown" (no reserve beyond Get Mana At, no cost gate), so a portal.dat on
// the PC doesn't change results; the mana reserve tests set their own costs.
RynthCore.Plugin.RynthAi.BuffManager.ManaCostOverride = _ => 0;
#endif
WieldCalls = false; Wields.Clear();
SalvageCalls = false; ExternalMoves.Clear(); SalvageAdds.Clear(); SalvageExecutes.Clear();
RefuseSalvageAdd.Clear(); OnSalvageExecute = null; Wielded.Clear(); _panelItems.Clear();
@ -426,6 +428,7 @@ internal static unsafe class FakeHost
return new RynthCoreHost(api);
}
#if !RYNTHILT_TESTS
/// <summary>
/// A WorldObjectCache that knows the given objects: each id must have a name in
/// <see cref="Names"/>. Ids with a <see cref="Positions"/> entry land on the landscape
@ -445,6 +448,7 @@ internal static unsafe class FakeHost
}
return cache;
}
#endif
private static IntPtr Ansi(string s)
{

View file

@ -36,7 +36,6 @@ internal static class Program
ExpressionEngine.ItemGiverDir = Path.Combine(TempRoot, "ItemGiver");
// The dungeon map bake writes floor plans under C:\Games\RynthSuite\RynthAi\Maps.
RynthCore.Plugin.RynthAi.Maps.DungeonMapBake.CacheDir = Path.Combine(TempRoot, "Maps");
RynthCore.Plugin.RynthAi.IltHub.IltAugCosts.FilePath = Path.Combine(TempRoot, "ilt-aug-costs.json");
// A sighted lava/acid hotspot is persisted under C:\Games\RynthSuite\RynthAi\DungeonHazards.
LiveHazardFolder = RynthCore.Plugin.RynthAi.DungeonHazardStore.Folder;
RynthCore.Plugin.RynthAi.DungeonHazardStore.Folder = Path.Combine(TempRoot, "DungeonHazards");
@ -111,12 +110,10 @@ internal static class Program
NavMapEditTests.Register(runner);
LootSpeedTests.Register(runner);
MeleeStallTests.Register(runner);
AttributeRaiserTests.Register(runner);
SigilChainTests.Register(runner);
ServerMenuTests.Register(runner);
MiniRemoteMoveTests.Register(runner);
ItemsCleanTests.Register(runner);
DeathRecallTests.Register(runner);
BankCommandTests.Register(runner);
InventoryAttributeFilterTests.Register(runner);
StuckCastTests.Register(runner);
PacerEdgeTests.Register(runner);

View file

@ -0,0 +1,175 @@
using System;
using System.IO;
using System.Linq;
using System.Text.Json;
using RynthCore.Plugin.RynthAi;
using RynthCore.Plugin.RynthAi.LegacyUi;
using RynthCore.Plugin.RynthAi.MiniRemote;
using RynthCore.Plugin.Shared;
using RynthCore.PluginSdk;
using RynthCore.RynthAiHostTests.Fakes;
using RynthCore.RynthAiTests.Harness;
namespace RynthCore.RynthAiHostTests.Tests;
// The ILT Hub left RynthAi for the RynthILT plugin (2026-10-13). What stayed: the Mini Remote with its
// universal Quests and Pets tabs (their settings now in miniremote.json, read once from the old
// ilt-hub.json), the "/ra hub|quests|pets" commands (the ILT verbs go to RynthILT, or say it's
// needed), the RynthAi.Hub interface RynthILT borrows from, and the profile's old Server Features
// fields kept for RynthILT's one-time migration.
internal static class MiniRemoteMoveTests
{
private const uint Player = 0x50000E01;
private const string LegacyHubJson = """
{
"Bank": { "Pyreals": 99 },
"Pet": { "HealingEnabled": true, "HealPetName": "Healing Buddy", "RosterKind": 1, "UsePyrealRefillPath": true,
"Assignments": [ { "Name": "Fire Banshee Essence", "Kind": 2 }, { "Name": "", "Kind": 1 } ], "PetLog": ["x"] },
"Character": { "QuestFilter": "temple", "QuestFavorites": ["foo", ""], "ShowQuestFavoritesHud": true, "AttrKeepXp": 5 },
"Gear": { "LastUsdPath": "C:\\vt\\me.usd", "AutoClap": true }
}
""";
public static void Register(Runner r)
{
r.Add("mini remote: Pets / Quests settings come over from ilt-hub.json once, which is never rewritten", LegacyState);
r.Add("mini remote: without RynthILT there are no ILT tabs, bits or verbs", NoRynthIlt);
r.Add("mini remote: /ra hub|quests|pets stay RynthAi's; ILT verbs say RynthILT is needed", Commands);
r.Add("mini remote: the pyreal refill path never spends without RynthILT's confirmation", RefillNeedsIlt);
r.Add("profile: the old Server Features fields still round-trip (RynthILT migrates them)", LegacyProfileFields);
r.Add("RynthAi.Hub: table, spell names, nothing before login", HubTable);
}
private static string Folder(string name)
{
string dir = Path.Combine(Program.TempRoot, "miniremote-" + name);
if (Directory.Exists(dir)) Directory.Delete(dir, recursive: true);
Directory.CreateDirectory(dir);
return dir;
}
private static void LegacyState()
{
string dir = Folder("legacy");
string legacyPath = Path.Combine(dir, MiniRemoteStore.LegacyFileName);
File.WriteAllText(legacyPath, LegacyHubJson);
var store = new MiniRemoteStore(dir);
var s = store.Load();
Check.True(s.Pet.HealingEnabled && s.Pet.HealPetName == "Healing Buddy", "healing pet settings");
Check.Eq(s.Pet.RosterKind, 1, "roster view");
Check.True(s.Pet.UsePyrealRefillPath, "the refill opt-in");
Check.Eq(s.Pet.Assignments.Count, 1, "type overrides (the blank one dropped)");
Check.Eq(s.Quests.QuestFilter, "temple", "quest filter");
Check.Eq(string.Join(",", s.Quests.QuestFavorites), "foo", "favorites (blanks dropped)");
Check.True(s.Quests.ShowQuestFavoritesHud, "favorites HUD");
Check.Eq(s.LastUsdPath, @"C:\vt\me.usd", "the .usd importer's last file");
store.SaveIfDirty(s);
Check.True(File.Exists(Path.Combine(dir, MiniRemoteStore.FileName)), "saved as miniremote.json");
Check.Eq(File.ReadAllText(legacyPath), LegacyHubJson, "ilt-hub.json is left exactly as it was (RynthILT copies it)");
string saved = File.ReadAllText(Path.Combine(dir, MiniRemoteStore.FileName));
Check.False(saved.Contains("Pyreals") || saved.Contains("PetLog") || saved.Contains("AttrKeepXp"), "no ILT data in RynthAi's file");
s.Quests.QuestFilter = "changed";
store.SaveIfDirty(s);
var again = new MiniRemoteStore(dir).Load();
Check.Eq(again.Quests.QuestFilter, "changed", "miniremote.json wins once it exists");
var fresh = new MiniRemoteStore(Folder("fresh")).Load();
Check.False(fresh.Pet.HealingEnabled, "no files at all: defaults");
}
private static MiniRemoteController NewController(string folder, out RynthCoreHost host, out LegacyUiSettings settings)
{
FakeHost.Reset();
host = FakeHost.Create(Player);
var s = new LegacyUiSettings();
settings = s;
var c = new MiniRemoteController(host, Folder(folder), () => null, () => s, () => null, () => { }, new IltClient(host));
string? lastTab = null;
c.MiniRemoteCommand = mode => "[Mini Remote] remote " + mode;
c.MiniRemoteTabCommand = (tab, mode) => { lastTab = tab + ":" + mode; return "tab " + lastTab; };
return c;
}
private static void NoRynthIlt()
{
var c = NewController("noilt", out var host, out _);
var ilt = c.Ilt;
ilt.Tick();
Check.False(ilt.Loaded, "no RynthILT (no plugin interfaces on this host)");
Check.False(ilt.IsIltWorld, "so never an ILT world");
Check.Eq(ilt.Feature(RynthIltHub.FeaturePetRefill), -1, "feature bits unknown");
Check.False(ilt.IsOff(RynthIltHub.FeatureQuests), "unknown is not off (/myquests still refreshes)");
Check.Eq(ilt.Tabs().Count, 0, "no ILT tabs");
Check.False(ilt.RenderSection(RynthIltHub.SectionQuestBonus), "no ILT sections");
Check.False(ilt.Command("hub bank"), "no ILT verbs taken");
Check.False(ilt.TryGetRates(out _, out _), "no ILT rates");
Check.False(c.SkipLoginQuestRefresh, "the login /myquests refresh isn't skipped");
}
private static void Commands()
{
var c = NewController("cmds", out _, out _);
FakeHost.Chat.Clear();
Check.True(c.HandleCommand("hub", new[] { "show" }), "hub show");
Check.True(FakeHost.Chat.Any(x => x.Contains("remote show")), "hub show drives the Mini Remote");
FakeHost.Chat.Clear();
Check.True(c.HandleCommand("hub", new[] { "open", "pets" }), "hub open pets");
Check.True(FakeHost.Chat.Any(x => x.Contains("tab pets:toggle")), "opens RynthAi's Pets tab");
FakeHost.Chat.Clear();
Check.True(c.HandleCommand("pets", new[] { "show" }), "pets show");
Check.True(FakeHost.Chat.Any(x => x.Contains("tab pets:show")), "same tab");
FakeHost.Chat.Clear();
Check.True(c.HandleCommand("hub", new[] { "bank" }), "hub bank is handled (answered)");
Check.True(FakeHost.Chat.Any(x => x.Contains("RynthILT")), "it says the ILT verbs come with RynthILT");
Check.True(FakeHost.Chat.Any(x => x.Contains("/ra hub open quests|pets")), "and lists what RynthAi still has");
FakeHost.Chat.Clear();
Check.True(c.HandleCommand("guardian", new[] { "handin" }), "guardian is answered");
Check.True(FakeHost.Chat.Any(x => x.Contains("RynthILT")), "with the RynthILT note");
FakeHost.Chat.Clear();
Check.True(c.HandleCommand("bountys", Array.Empty<string>()), "the bountys spelling too");
Check.False(c.HandleCommand("start", Array.Empty<string>()), "other verbs aren't the Mini Remote's");
}
private static void RefillNeedsIlt()
{
var c = NewController("refill", out _, out _);
c.State.Pet.UsePyrealRefillPath = true;
FakeHost.Bools[(Player, MiniRemoteInventory.BoolPyrealRefillActive)] = true; // the server's player bool
Check.False(c.Pets.AllowSummonOnEmpty(), "not an ILT world (no RynthILT): an empty essence is never summoned on pyreals");
}
private static void LegacyProfileFields()
{
var s = JsonSerializer.Deserialize("{\"FeatureServerNames\":[\"MyShard\"],\"ForceServerFeatures\":true}",
RynthAiJsonContext.Default.LegacyUiSettings)!;
string json = JsonSerializer.Serialize(s, RynthAiJsonContext.Default.LegacyUiSettings);
Check.True(json.Contains("MyShard"), "the old server list is written back unchanged");
Check.True(json.Contains("\"ForceServerFeatures\": true"), "and the old override");
var fresh = JsonSerializer.Serialize(new LegacyUiSettings(), RynthAiJsonContext.Default.LegacyUiSettings);
Check.False(fresh.Contains("InfiniteLeaftide"), "a fresh profile no longer gets an ILT server list");
}
private static unsafe void HubTable()
{
Check.Eq(HubInterface.Query("RynthILT.Hub", 1), IntPtr.Zero, "not ours");
var t = (RynthAiHubApiV1*)HubInterface.Query(RynthAiHubApiV1.InterfaceName, 1);
Check.True(t != null && t->Version == 1 && t->StructSize == (uint)sizeof(RynthAiHubApiV1), "v1 served");
Check.True(t->MiniRemoteTab != null && t->MiniRemoteVisible != null && t->QuestFlag != null && t->QuestStatus != null
&& t->QuestRefresh != null && t->SpellName != null && t->LootKeeps != null && t->RenderSection != null
&& t->SessionStats != null && t->SessionReset != null, "every function filled in");
byte* buf = stackalloc byte[64];
int n = t->SpellName(1, buf, 64);
Check.Eq(System.Runtime.InteropServices.Marshal.PtrToStringUTF8((IntPtr)buf, n), "Strength Other I", "spell names from RynthAi's table");
Check.Eq(t->SpellName(0, buf, 64), 0, "spell 0 has no name");
QuestStatusV1 st;
Check.Eq(t->QuestStatus(&st), 0, "no quest tracker before login");
Check.Eq(t->MiniRemoteVisible(), 0, "no Mini Remote before login");
SessionStatsV1 ss;
Check.Eq(t->SessionStats(&ss), 0, "no session before login");
}
}

View file

@ -4,7 +4,7 @@ using System.IO;
using System.Reflection;
using RynthCore.Loot.Editing;
using RynthCore.Plugin.RynthAi;
using RynthCore.Plugin.RynthAi.Diagnostics;
using RynthCore.Plugin.Shared;
using RynthCore.Plugin.RynthAi.LegacyUi;
using RynthCore.Plugin.RynthAi.Meta;
using RynthCore.RynthAiHostTests.Fakes;
@ -15,7 +15,7 @@ namespace RynthCore.RynthAiHostTests.Tests;
// 2026-10-13: players reported metas and navs "not saving" and the plugin folders being
// "read only". Every save of a meta, nav, settings profile (and the loot editor's autosave
// path) swallowed its exception, so a folder the client can't write looked like a save that did
// nothing. Diagnostics/DataWriteGuard.cs now:
// nothing. Plugins/Shared/DataWriteGuard.cs now:
// - clears the ReadOnly attribute on our own file before overwriting it;
// - reports a failed save in chat once per folder (path, reason, fix) and logs every one
// (throttled per folder);

View file

@ -13,21 +13,19 @@ internal static class ServerMenuTests
r.Add("server menu: sections and items parse in order", ParsesSections);
r.Add("server menu: malformed lines are skipped, never thrown", SkipsMalformed);
r.Add("server menu: tab features name the Mini Remote tab", TabFeature);
r.Add("mini remote tabs: Quests and Pets are universal and first; Guardian is ILT's panel", UniversalTabs);
r.Add("mini remote tabs: Quests and Pets are RynthAi's and first; the ILT tabs come from RynthILT", UniversalTabs);
}
private static void UniversalTabs()
{
var tabs = RynthCore.Plugin.RynthAi.IltHub.IltSections.Tabs;
Check.Eq(tabs[0], RynthCore.Plugin.RynthAi.IltHub.IltSection.Quests, "Quests leads the tab bar");
Check.Eq(tabs[1], RynthCore.Plugin.RynthAi.IltHub.IltSection.Pet, "Pets second");
int universal = 0;
foreach (var t in tabs)
if (RynthCore.Plugin.RynthAi.IltHub.IltSections.IsUniversal(t)) universal++;
Check.Eq(universal, 2, "only Quests and Pets are universal");
Check.True(!RynthCore.Plugin.RynthAi.IltHub.IltSections.IsUniversal(RynthCore.Plugin.RynthAi.IltHub.IltSection.Guardian), "Guardian is ILT only");
Check.True(!RynthCore.Plugin.RynthAi.IltHub.IltSections.IsTab(RynthCore.Plugin.RynthAi.IltHub.IltSection.Guardian), "Guardian is a panel, not a tab");
Check.True(!RynthCore.Plugin.RynthAi.IltHub.IltSections.IsUniversal(RynthCore.Plugin.RynthAi.IltHub.IltSection.Character), "the Character tab is ILT's");
var tabs = RynthCore.Plugin.RynthAi.MiniRemote.MiniRemoteTabs.Universal;
Check.Eq(tabs.Length, 2, "RynthAi's own tabs: Quests and Pets (the ILT tabs are RynthILT's)");
Check.Eq(tabs[0], "quests", "Quests leads the tab bar");
Check.Eq(tabs[1], "pets", "Pets second");
Check.Eq(RynthCore.Plugin.RynthAi.MiniRemote.MiniRemoteTabs.Parse("Pet"), "pets", "aliases parse");
Check.Null(RynthCore.Plugin.RynthAi.MiniRemote.MiniRemoteTabs.Parse("banking"), "an ILT tab isn't RynthAi's");
Check.Null(RynthCore.Plugin.RynthAi.MiniRemote.MiniRemoteTabs.Parse("guardian"), "nor the Guardian panel");
Check.Eq(RynthCore.Plugin.RynthAi.MiniRemote.MiniRemoteTabs.Remote, "", "the Remote tab's id is empty");
}
private static void ParsesSections()

View file

@ -3,17 +3,16 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using RynthCore.Plugin.RynthAi.IltHub;
using RynthCore.Plugin.RynthAi.LegacyUi;
using RynthCore.Plugin.RynthILT.Hub;
using RynthCore.PluginSdk;
using RynthCore.RynthAiHostTests.Fakes;
using RynthCore.RynthAiTests.Harness;
namespace RynthCore.RynthAiHostTests.Tests;
namespace RynthILT.Tests;
// Server Features gate + the infinite-attribute raiser (2026-10-06). The gate decides from
// Settings > Misc (world-name patterns, manual override) whether the ILT features ask the
// server at all; the raiser reads "/xp all" costs and spends unassigned XP with "/attr <abbr> 1"
// Server Features gate + the infinite-attribute raiser (2026-10-06; RynthAi's ILT Hub, in RynthILT
// since 2026-10-13). The gate decides from RynthILT's server list (world-name patterns) and the
// character's "Treat this world as ILT" whether the ILT features ask the server at all; the raiser reads "/xp all" costs and spends unassigned XP with "/attr <abbr> 1"
// on the ticked stats, in the chosen order, never below the reserve.
internal static class AttributeRaiserTests
{
@ -72,7 +71,7 @@ internal static class AttributeRaiserTests
{
string file = IltAugCosts.FilePath;
if (File.Exists(file)) File.Delete(file);
var settings = new LegacyUiSettings();
var settings = new IltSettings();
var hub = NewHub("InfiniteLeaftide", settings, "aug-costs", out _);
var prog = hub.Progression;
prog.ApplyAugLines(new List<string> { "War: 1700" });
@ -122,7 +121,7 @@ internal static class AttributeRaiserTests
Check.Eq(IltAttributeRaiser.ProjectCost(0, 10), 0L, "unknown cost projects nothing");
Check.Eq(IltAttributeRaiser.ProjectCost(long.MaxValue / 2, 10), long.MaxValue, "saturates instead of overflowing");
var settings = new LegacyUiSettings();
var settings = new IltSettings();
var hub = NewHub("InfiniteLeaftide", settings, "attr-byhand", out _);
var raiser = hub.Progression.Attributes;
FakeHost.Quads[(Player, IltInventory.QuadAvailableXp)] = 5_000;
@ -161,7 +160,7 @@ internal static class AttributeRaiserTests
private static void AugPlanner()
{
var settings = new LegacyUiSettings();
var settings = new IltSettings();
var hub = NewHub("InfiniteLeaftide", settings, "aug-planner", out _);
var prog = hub.Progression;
@ -219,17 +218,17 @@ internal static class AttributeRaiserTests
Check.Eq(string.Join("|", list), "InfiniteLeaftide|*Leaftide*|Aelrynth", "trimmed, split on , and ;, de-duplicated ignoring case");
Check.Eq(ServerFeatureGate.FormatList(list), "InfiniteLeaftide, *Leaftide*, Aelrynth", "formatted back for the text box");
var s = new LegacyUiSettings();
Check.True(s.FeatureServerNames.Contains("InfiniteLeaftide"), "a fresh profile starts with the defaults");
Check.True(ServerFeatureGate.IsEnabled("InfiniteLeaftide", s), "the default list covers InfiniteLeaftide");
Check.False(ServerFeatureGate.IsEnabled("Aelrynth", s), "another world is off by default");
s.ForceServerFeatures = true;
Check.True(ServerFeatureGate.IsEnabled("Aelrynth", s), "the manual override turns it on anywhere");
s.ForceServerFeatures = false;
s.FeatureServerNames = new List<string> { "Aelrynth" };
Check.True(ServerFeatureGate.IsEnabled("aelrynth", s), "a world added to the list is on");
Check.False(ServerFeatureGate.IsEnabled("InfiniteLeaftide", s), "a world removed from the list is off");
Check.True(ServerFeatureGate.IsEnabled("InfiniteLeaftide", null), "no profile yet: the defaults apply");
var s = new IltSettings();
Check.True(s.ServerNames.Contains("InfiniteLeaftide"), "fresh settings start with the defaults");
Check.True(ServerFeatureGate.IsEnabled("InfiniteLeaftide", s, forceOn: false), "the default list covers InfiniteLeaftide");
Check.False(ServerFeatureGate.IsEnabled("Aelrynth", s, forceOn: false), "another world is off by default");
Check.True(ServerFeatureGate.IsEnabled("Aelrynth", s, forceOn: true), "the character's override turns it on anywhere");
s.ServerNames = new List<string> { "Aelrynth" };
Check.True(ServerFeatureGate.IsEnabled("aelrynth", s, forceOn: false), "a world added to the list is on");
Check.False(ServerFeatureGate.IsEnabled("InfiniteLeaftide", s, forceOn: false), "a world removed from the list is off");
Check.True(ServerFeatureGate.IsEnabled("InfiniteLeaftide", null, forceOn: false), "no settings yet: the defaults apply");
s.ServerNames = new List<string>();
Check.True(ServerFeatureGate.IsEnabled("InfiniteLeaftide", s, forceOn: false), "an emptied list falls back to the defaults");
}
private static readonly string[] Order = { "coo", "qui", "str", "end", "foc", "sel", "hea", "sta", "man" };
@ -302,14 +301,15 @@ internal static class AttributeRaiserTests
// ── The loop on the fake host ─────────────────────────────────────────────
private static IltHubController NewHub(string world, LegacyUiSettings settings, string folder, out RynthCoreHost host)
private static IltHubController NewHub(string world, IltSettings settings, string folder, out RynthCoreHost host)
{
FakeHost.Reset();
FakeHost.WorldName = world;
host = FakeHost.Create(Player);
string dir = Path.Combine(Program.TempRoot, folder);
Directory.CreateDirectory(dir);
return new IltHubController(host, dir, () => null, () => settings, () => null, () => { });
// No RynthAi here (the fake host has no GetPluginInterface): RynthILT runs on its own.
return new IltHubController(host, dir, settings, new RynthAiClient(host));
}
/// <summary>Ticks the hub until <paramref name="done"/> or the timeout (the chat queue spaces sends by real time).</summary>
@ -332,7 +332,7 @@ internal static class AttributeRaiserTests
private static void FullRun()
{
var settings = new LegacyUiSettings();
var settings = new IltSettings();
var hub = NewHub("InfiniteLeaftide", settings, "attr-run", out _);
var c = hub.State.Character;
c.AttrRaiseStats = new List<string> { "coo", "qui" };
@ -391,7 +391,7 @@ internal static class AttributeRaiserTests
private static void Safety()
{
var settings = new LegacyUiSettings();
var settings = new IltSettings();
var hub = NewHub("InfiniteLeaftide", settings, "attr-safety", out _);
var c = hub.State.Character;
var raiser = hub.Progression.Attributes;
@ -418,11 +418,11 @@ internal static class AttributeRaiserTests
FakeHost.ChatCommands.Clear();
raiser.Start(auto: false);
Check.True(TickUntil(hub, () => FakeHost.ChatCommands.Contains("/xp all")), "second run reads costs");
settings.FeatureServerNames = new List<string> { "SomewhereElse" };
settings.ServerNames = new List<string> { "SomewhereElse" };
Reply(hub, "[XP] Your XP cost for next 1 Coordination level is: 100");
Check.True(TickUntil(hub, () => !raiser.Running), "the run stops once the world is off");
Check.False(FakeHost.ChatCommands.Any(x => x.StartsWith("/attr", StringComparison.Ordinal)), "no raise after the gate closed");
settings.FeatureServerNames = new List<string>(ServerFeatureGate.DefaultServerNames);
settings.ServerNames = new List<string>(ServerFeatureGate.DefaultServerNames);
// Another XP spender running: neither Raise now nor +N starts.
bool spending = true;
@ -437,7 +437,7 @@ internal static class AttributeRaiserTests
private static void GatedOff()
{
var settings = new LegacyUiSettings();
var settings = new IltSettings();
var hub = NewHub("Aelrynth", settings, "attr-gated", out _);
var raiser = hub.Progression.Attributes;
hub.State.Character.AttrRaiseStats = new List<string> { "coo" };
@ -446,10 +446,10 @@ internal static class AttributeRaiserTests
TickUntil(hub, () => false, 600);
Check.False(FakeHost.ChatCommands.Any(), "nothing is sent off a feature world");
settings.FeatureServerNames.Add("Aelrynth");
Check.Null(raiser.Blocker(), "adding the world to Server Features unblocks it");
settings.FeatureServerNames.Remove("Aelrynth");
settings.ForceServerFeatures = true;
Check.Null(raiser.Blocker(), "so does the manual override");
settings.ServerNames.Add("Aelrynth");
Check.Null(raiser.Blocker(), "adding the world to the server list unblocks it");
settings.ServerNames.Remove("Aelrynth");
hub.State.ForceLeaftideFeatures = true;
Check.Null(raiser.Blocker(), "so does the character's override");
}
}

View file

@ -1,7 +1,7 @@
using RynthCore.Plugin.RynthAi.IltHub;
using RynthCore.Plugin.RynthILT.Hub;
using RynthCore.RynthAiTests.Harness;
namespace RynthCore.RynthAiHostTests.Tests;
namespace RynthILT.Tests;
// Banking tab (IltBankCommands): the deposit / withdraw commands match ACECustom's /bank handler
// (upstream 2026-10-11), and only the bank's own reply lines count as a deposit / withdraw result.

View file

@ -0,0 +1,450 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using RynthCore.Loot;
using RynthCore.Plugin.RynthILT;
using RynthCore.Plugin.RynthILT.Hub;
using RynthCore.Plugin.Shared;
using RynthCore.RynthAiTests.Harness;
namespace RynthILT.Tests;
// The ILT Hub's move out of RynthAi into RynthILT (2026-10-13): the saved data carried over from
// RynthAi's folders (copied, never moved), the RynthILT.Hub interface table RynthAi's Mini Remote
// reads, which "/ra" verbs RynthILT takes from RynthAi, and the host-backed object view that
// replaced RynthAi's WorldObjectCache.
internal static class MoveTests
{
public static void Register(Runner r)
{
r.Add("move: a character's RynthAi ILT Hub files are copied, the RynthAi copies left alone", MigratesCharacter);
r.Add("move: migration never overwrites RynthILT's files and runs once", MigrationIdempotent);
r.Add("move: the pre-per-server ACEmulator folder is found too", MigratesFromAceEmulatorFolder);
r.Add("move: shared Hub profiles and aug costs are copied once", MigratesShared);
r.Add("move: a migration copy that fails is reported (log + chat) and the shared ones retried", MigrationFailuresReported);
r.Add("move: a failed Hub save is reported once and retried", StoreSaveFailureReported);
r.Add("move: an unfinished copy blocks the character's Hub writes until the retry copies the original", PendingMigrationNeverShadowed);
r.Add("move: an old ilt-hub.json loads into RynthILT's state (ILT parts kept)", LegacyStateLoads);
r.Add("move: RynthAi's \"/ra\" verbs RynthILT takes (and the ones it leaves)", VerbRouting);
r.Add("move: item classes from the client's item type (the gear tools' checks)", Classification);
r.Add("move: the interface structs have the agreed layout", InterfaceLayout);
r.Add("move: server-list status lines", DescribeLines);
r.Add("move: off ILT nothing is sent, no tab or section shows; on ILT the login probe runs", DormantOffIlt);
// Last: Release() switches the table off for the rest of the process.
r.Add("move: the RynthILT.Hub table: query, functions, release", HubTable);
}
private static string Root(string name)
{
string dir = Path.Combine(Program.TempRoot, "move-" + name);
if (Directory.Exists(dir)) Directory.Delete(dir, recursive: true);
Directory.CreateDirectory(dir);
IltMigration.LegacyProfilesBase = Path.Combine(dir, "RynthAi", "SettingsProfiles");
IltMigration.LegacySharedRoot = Path.Combine(dir, "RynthAi");
return dir;
}
private const string LegacyHubJson = """
{
"SchemaVersion": 1,
"ForceLeaftideFeatures": false,
"UbSidecarsImported": true,
"Bank": { "Pyreals": 1234567, "Luminance": 89, "EnlightenedCoins": 42, "AutoRefreshSeconds": 300 },
"Pet": { "HealingEnabled": true, "HealPetName": "Healing Buddy", "PetLog": ["Fire Banshee"], "ShinyLog": [] },
"Character": {
"QuestFilter": "temple", "QbFilter": "wait", "QuestFavorites": ["foo"],
"AttrOrder": ["qui","coo","str","end","foc","sel","hea","sta","man"], "AttrRaiseStats": ["qui"],
"AugTargets": { "war": 1800 }
},
"Gear": { "AutoClap": true, "LastUsdPath": "C:\\vt\\x.usd", "LastEquipProfile": "Melee" },
"Guardian": { "AutoHandIn": true, "TurnInCounts": { "Strength": 3 } }
}
""";
private static string MakeLegacyChar(string world, string charName, bool withProfile = true)
{
string dir = Path.Combine(IltMigration.LegacyProfilesBase, IltMigration.RynthAiSafeName(world), IltMigration.RynthAiSafeName(charName));
Directory.CreateDirectory(Path.Combine(dir, "ilt-hub-profiles"));
File.WriteAllText(Path.Combine(dir, "ilt-hub.json"), LegacyHubJson);
File.WriteAllText(Path.Combine(dir, "ilt-hub-transactions.json"), "[{\"Type\":\"Received\",\"Currency\":\"Pyreals\",\"Amount\":5}]");
File.WriteAllText(Path.Combine(dir, "ilt-hub-profiles", "farm.json"), "{\"SchemaVersion\":1}");
if (withProfile)
{
File.WriteAllText(Path.Combine(dir, "active_profile.txt"), "Melee");
File.WriteAllText(Path.Combine(dir, "Melee.json"),
"{\"MetaDebug\":false,\"FeatureServerNames\":[\"InfiniteLeaftide\",\"*Leaftide*\",\"MyShard\"],\"ForceServerFeatures\":true}");
File.WriteAllText(Path.Combine(dir, "Default.json"), "{\"FeatureServerNames\":[\"Unused\"]}");
}
return dir;
}
private static void MigratesCharacter()
{
string root = Root("char");
string legacy = MakeLegacyChar("Infinite Leaftide", "Sir Tester");
string before = File.ReadAllText(Path.Combine(legacy, "ilt-hub.json"));
var settings = new IltSettings();
string dest = Path.Combine(root, "RynthILT", "Infinite Leaftide", "Sir Tester");
var done = IltMigration.MigrateCharacter(dest, "Infinite Leaftide", "Sir Tester", settings, out bool force);
Check.True(File.Exists(Path.Combine(dest, IltHubStore.StateFile)), "ilt-hub.json -> hub.json");
Check.Eq(File.ReadAllText(Path.Combine(dest, IltHubStore.StateFile)), before, "copied byte for byte");
Check.True(File.Exists(Path.Combine(dest, IltHubStore.TransactionsFile)), "transactions copied");
Check.True(File.Exists(Path.Combine(dest, IltHubStore.ProfilesFolder, "farm.json")), "per-character Hub profiles copied");
Check.True(File.Exists(Path.Combine(legacy, "ilt-hub.json")) && File.Exists(Path.Combine(legacy, "ilt-hub-transactions.json")),
"RynthAi's files are still there (copy, not move)");
Check.True(settings.ServerNames.Contains("MyShard"), "the active profile's server names are added");
Check.False(settings.ServerNames.Contains("Unused"), "only the ACTIVE profile is read");
Check.Eq(settings.ServerNames.Count(n => n.Equals("InfiniteLeaftide", StringComparison.OrdinalIgnoreCase)), 1, "no duplicates");
Check.True(force, "\"Force enable\" carries over as Treat this world as ILT");
Check.True(done.Count >= 4, "the log line lists what was carried over: " + string.Join(", ", done));
}
private static void MigrationIdempotent()
{
string root = Root("idem");
string legacy = MakeLegacyChar("InfiniteLeaftide", "Again", withProfile: false);
string dest = Path.Combine(root, "RynthILT", "InfiniteLeaftide", "Again");
Directory.CreateDirectory(dest);
File.WriteAllText(Path.Combine(dest, IltHubStore.TransactionsFile), "[]"); // RynthILT already has one
var settings = new IltSettings();
IltMigration.MigrateCharacter(dest, "InfiniteLeaftide", "Again", settings, out bool force);
Check.Eq(File.ReadAllText(Path.Combine(dest, IltHubStore.TransactionsFile)), "[]", "an existing RynthILT file is never overwritten");
Check.True(File.Exists(Path.Combine(dest, IltHubStore.StateFile)), "the missing hub.json is still copied");
Check.False(force, "no profile, no override");
File.WriteAllText(Path.Combine(legacy, "ilt-hub.json"), "{\"Bank\":{\"Pyreals\":1}}");
var second = IltMigration.MigrateCharacter(dest, "InfiniteLeaftide", "Again", settings, out _);
Check.Eq(second.Count, 0, "once hub.json exists the character is never migrated again");
Check.False(File.ReadAllText(Path.Combine(dest, IltHubStore.StateFile)).Contains("\"Pyreals\":1}"), "later RynthAi edits don't overwrite RynthILT's state");
var none = IltMigration.MigrateCharacter(Path.Combine(root, "RynthILT", "X", "Nobody"), "X", "Nobody", settings, out _);
Check.Eq(none.Count, 0, "a character RynthAi never saw: nothing to do");
Check.False(Directory.Exists(Path.Combine(root, "RynthILT", "X", "Nobody")), "and no folder is made for it");
}
private static void MigratesFromAceEmulatorFolder()
{
string root = Root("ace");
MakeLegacyChar("ACEmulator", "Old Timer", withProfile: false);
var settings = new IltSettings();
string dest = Path.Combine(root, "RynthILT", "InfiniteLeaftide", "Old Timer");
Check.NotNull(IltMigration.FindLegacyCharFolder("InfiniteLeaftide", "Old Timer"), "the world folder is missing, ACEmulator\\<char> is used");
IltMigration.MigrateCharacter(dest, "InfiniteLeaftide", "Old Timer", settings, out _);
Check.True(File.Exists(Path.Combine(dest, IltHubStore.StateFile)), "copied from the ACEmulator folder");
Check.Eq(IltMigration.RynthAiSafeName("Sir O'Neil-Smith"), "Sir_O'Neil-Smith", "RynthAi's folder names keep ' and - only");
}
private static void MigratesShared()
{
string root = Root("shared");
Directory.CreateDirectory(Path.Combine(IltMigration.LegacySharedRoot, "IltHubProfiles"));
File.WriteAllText(Path.Combine(IltMigration.LegacySharedRoot, "IltHubProfiles", "team.json"), "{}");
File.WriteAllText(Path.Combine(IltMigration.LegacySharedRoot, "ilt-aug-costs.json"), "{\"x\":1}");
var settings = new IltSettings();
string dest = Path.Combine(root, "RynthILT");
var done = IltMigration.MigrateShared(settings, dest);
Check.True(File.Exists(Path.Combine(dest, "Profiles", "team.json")), "shared profiles copied");
Check.True(File.Exists(Path.Combine(dest, "ilt-aug-costs.json")), "aug costs copied");
Check.True(settings.SharedFilesMigrated, "marked done in the settings");
Check.Eq(done.Count, 2, "both reported");
File.Delete(Path.Combine(dest, "ilt-aug-costs.json"));
Check.Eq(IltMigration.MigrateShared(settings, dest).Count, 0, "once only");
Check.False(File.Exists(Path.Combine(dest, "ilt-aug-costs.json")), "a file deleted afterwards isn't brought back");
}
// A copy that fails (here: the RynthAi file held open by another program) is never silent: it
// is logged and queued for chat with the reason, the rest still copies, and the shared files
// aren't marked done so the next login tries again.
private static void MigrationFailuresReported()
{
string root = Root("fail");
DataWriteGuard.Reset();
string legacy = MakeLegacyChar("InfiniteLeaftide", "Locked Out");
string dest = Path.Combine(root, "RynthILT", "InfiniteLeaftide", "Locked Out");
var settings = new IltSettings();
List<string> done;
using (new FileStream(Path.Combine(legacy, "ilt-hub-transactions.json"), FileMode.Open, FileAccess.Read, FileShare.None))
done = IltMigration.MigrateCharacter(dest, "InfiniteLeaftide", "Locked Out", settings, out _);
Check.True(File.Exists(Path.Combine(dest, IltHubStore.StateFile)), "the other files are still copied");
Check.False(File.Exists(Path.Combine(dest, IltHubStore.TransactionsFile)), "the held file isn't");
Check.True(done.Any(l => l.Contains("NOT copied") && l.Contains(legacy)), "the log line says so and where the originals are: " + string.Join(", ", done));
Check.Eq(DataWriteGuard.PendingCount, 1, "one chat line queued (shown on ILT)");
var lines = new List<string>();
DataWriteGuard.DrainChat(lines.Add);
Check.True(lines.Count == 1 && lines[0].StartsWith("[RynthILT]", StringComparison.Ordinal)
&& lines[0].Contains("ilt-hub-transactions.json") && lines[0].Contains("another program"),
"it names the file and the reason: " + string.Join(" | ", lines));
DataWriteGuard.Reset();
Directory.CreateDirectory(Path.Combine(IltMigration.LegacySharedRoot, "IltHubProfiles"));
File.WriteAllText(Path.Combine(IltMigration.LegacySharedRoot, "IltHubProfiles", "team.json"), "{}");
string aug = Path.Combine(IltMigration.LegacySharedRoot, "ilt-aug-costs.json");
File.WriteAllText(aug, "{\"x\":1}");
string sharedDest = Path.Combine(root, "RynthILT");
using (new FileStream(aug, FileMode.Open, FileAccess.Read, FileShare.None))
done = IltMigration.MigrateShared(settings, sharedDest);
Check.False(settings.SharedFilesMigrated, "a failed shared copy isn't marked done");
Check.True(done.Any(l => l.Contains("NOT copied")), "and is reported: " + string.Join(", ", done));
Check.True(DataWriteGuard.PendingCount >= 1, "in chat too");
done = IltMigration.MigrateShared(settings, sharedDest);
Check.True(File.Exists(Path.Combine(sharedDest, "ilt-aug-costs.json")), "the next login copies it");
Check.True(settings.SharedFilesMigrated, "then it is marked done");
Check.Eq(done.Count, 1, "only the missing file is copied the second time: " + string.Join(", ", done));
DataWriteGuard.Reset();
}
// A character whose ilt-hub.json couldn't be copied (held open by another program): the Hub
// runs from the RynthAi original read-only (or the defaults), writes no hub.json, bank log or
// per-character profile there, the pending mark survives a restart, and the next attempt copies
// the original byte for byte - never shadowed by a fresh file.
private static void PendingMigrationNeverShadowed()
{
string root = Root("pending");
DataWriteGuard.Reset();
string legacy = MakeLegacyChar("InfiniteLeaftide", "Held Open");
string legacyHub = Path.Combine(legacy, "ilt-hub.json");
string dest = Path.Combine(root, "RynthILT", "InfiniteLeaftide", "Held Open");
string hubJson = Path.Combine(dest, IltHubStore.StateFile);
var settings = new IltSettings();
// Held open by another program: neither copied nor readable.
using (var held = new FileStream(legacyHub, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
{
var done = IltMigration.MigrateCharacter(dest, "InfiniteLeaftide", "Held Open", settings, out _);
Check.False(File.Exists(hubJson), "the held ilt-hub.json isn't copied");
Check.True(IltMigration.IsPending(settings, dest), "the character is marked pending");
Check.True(done.Any(l => l.Contains("NOT copied")), "and the log says so: " + string.Join(", ", done));
var store = new IltHubStore(default, dest)
{
WritesBlocked = () => IltMigration.IsPending(settings, dest),
LegacyFolder = legacy,
};
IltHubState state = store.LoadState();
Check.Eq(state.Bank.Pyreals, 0L, "unreadable: the Hub runs from the defaults");
state.Bank.Pyreals = 1;
store.SaveStateIfDirty(state);
Check.False(File.Exists(hubJson), "no hub.json is written while the copy is unfinished");
Check.False(store.SaveProfile(state, "mine", shared: false, out string why), "nor a per-character profile");
Check.True(why.Contains("RynthAi"), "with the reason: " + why);
Check.True(store.SaveProfile(state, "team-" + Guid.NewGuid().ToString("N"), shared: true, out _), "shared profiles still save");
// A second login while still held: still pending, still nothing written.
IltMigration.MigrateCharacter(dest, "InfiniteLeaftide", "Held Open", settings, out _);
Check.True(IltMigration.IsPending(settings, dest) && !File.Exists(hubJson), "still pending, still no hub.json");
}
// Readable again but not yet retried: a Hub started now reads the original, still writes nothing.
var readOnly = new IltHubStore(default, dest)
{
WritesBlocked = () => IltMigration.IsPending(settings, dest),
LegacyFolder = legacy,
};
IltHubState fromLegacy = readOnly.LoadState();
Check.Eq(fromLegacy.Bank.Pyreals, 1234567L, "the Hub runs from the RynthAi original, read only");
fromLegacy.Bank.Pyreals = 2;
readOnly.SaveStateIfDirty(fromLegacy);
Check.False(File.Exists(hubJson), "and still writes no hub.json");
// The mark is in settings.json, so a client restart still knows the copy is unfinished.
IltSettingsStore.Save(settings);
IltSettings reloaded = IltSettingsStore.Load();
Check.True(IltMigration.IsPending(reloaded, dest), "pending survives a restart");
var finished = IltMigration.MigrateCharacter(dest, "InfiniteLeaftide", "Held Open", reloaded, out bool force);
Check.True(File.Exists(hubJson), "the next attempt copies it");
Check.Eq(File.ReadAllText(hubJson), File.ReadAllText(legacyHub), "byte for byte: the original, not a fresh file");
Check.False(IltMigration.IsPending(reloaded, dest), "no longer pending");
Check.True(force, "the profile's Force enable still carries over on the retry");
Check.True(finished.Any(l => l.Contains("complete")), "the log says it finished: " + string.Join(", ", finished));
var after = new IltHubStore(default, dest) { WritesBlocked = () => IltMigration.IsPending(reloaded, dest) };
IltHubState loaded = after.LoadState();
Check.Eq(loaded.Bank.Pyreals, 1234567L, "the restarted Hub loads the copied file");
loaded.Bank.Pyreals = 7;
after.SaveStateIfDirty(loaded);
Check.True(File.ReadAllText(hubJson).Contains("\"Pyreals\": 7"), "and saves normally from then on");
File.Delete(Path.Combine(IltSettingsStore.Folder, IltSettingsStore.FileName));
DataWriteGuard.Reset();
}
// RynthILT's own saves report a failure (DataWriteGuard) and try again on the next save.
private static void StoreSaveFailureReported()
{
string root = Root("storefail");
DataWriteGuard.Reset();
string blocker = Path.Combine(root, "NotAFolder");
File.WriteAllText(blocker, "a file where the character folder should be");
var store = new IltHubStore(default, blocker);
var state = new IltHubState();
store.SaveStateIfDirty(state);
Check.Eq(DataWriteGuard.PendingCount, 1, "the failed Hub save is queued for chat");
store.SaveStateIfDirty(state);
Check.Eq(DataWriteGuard.PendingCount, 1, "once per folder, not every retry");
File.Delete(blocker);
store.SaveStateIfDirty(state);
Check.True(File.Exists(Path.Combine(blocker, IltHubStore.StateFile)), "the next save retries and works");
DataWriteGuard.Reset();
}
private static void LegacyStateLoads()
{
string root = Root("state");
string dir = Path.Combine(root, "char");
Directory.CreateDirectory(dir);
File.WriteAllText(Path.Combine(dir, IltHubStore.StateFile), LegacyHubJson);
var store = new IltHubStore(default, dir);
var s = store.LoadState();
Check.Eq(s.Bank.Pyreals, 1234567L, "bank balances");
Check.Eq(s.Bank.AutoRefreshSeconds, 300, "bank settings");
Check.Eq(s.Pet.PetLog.FirstOrDefault(), "Fire Banshee", "the /pets log (an ILT part of the Pet section)");
Check.Eq(s.Character.QbFilter, "wait", "the /qb filter");
Check.Eq(s.Character.AttrOrder.FirstOrDefault(), "qui", "the attribute raiser's order");
Check.Eq(s.Character.AugTargets["war"], 1800, "aug targets");
Check.True(s.Gear.AutoClap && s.Gear.LastEquipProfile == "Melee", "gear settings");
Check.True(s.Guardian.AutoHandIn && s.Guardian.TurnInCounts["Strength"] == 3, "guardian settings");
Check.True(s.UbSidecarsImported, "the UB import isn't redone");
store.SaveStateIfDirty(s);
string saved = File.ReadAllText(Path.Combine(dir, IltHubStore.StateFile));
Check.False(saved.Contains("HealPetName"), "the Pets tab's settings (RynthAi's now) aren't written back here");
Check.False(saved.Contains("QuestFavorites"), "nor the Quests tab's");
}
private static void VerbRouting()
{
static bool Takes(string line) => RynthILTPlugin.IsIltVerb(line.Split(' ', StringSplitOptions.RemoveEmptyEntries));
Check.True(Takes("hub bank"), "hub bank");
Check.True(Takes("hub attr run"), "hub attr run");
Check.True(Takes("hub refresh"), "hub refresh");
Check.True(Takes("hub help"), "hub help (RynthILT prints the whole list)");
Check.True(Takes("hub open banking show"), "hub open <ILT tab>");
Check.True(Takes("hub open guardian"), "hub open guardian (the engine panel)");
Check.True(Takes("hub open bounties"), "hub open bounties");
Check.False(Takes("hub open pets"), "hub open pets is RynthAi's");
Check.False(Takes("hub open quests hide"), "hub open quests is RynthAi's");
Check.True(Takes("hub tab gear"), "hub tab <ILT tab>");
Check.False(Takes("hub tab quests"), "hub tab quests is RynthAi's");
Check.False(Takes("hub tab remote"), "the Remote tab is RynthAi's");
Check.False(Takes("hub"), "bare /ra hub toggles RynthAi's Mini Remote");
Check.True(Takes("guardian handin"), "guardian");
Check.True(Takes("bounty show") && Takes("bounties") && Takes("bountys"), "bounty, bounties, bountys");
Check.True(Takes("rates reset"), "rates reset (the Mini Remote's Reset XP)");
Check.False(Takes("quests refresh"), "/ra quests is RynthAi's");
Check.False(Takes("pets show"), "/ra pets is RynthAi's");
Check.False(Takes("start"), "anything else is RynthAi's");
// The VTank hotkey verbs (RynthAi 2026-10-13, RynthAiPlugin.VTankHotkeys.cs) stay RynthAi's.
foreach (string vt in new[] { "vtkeys", "targetlock", "recharge", "lootthis", "meleelow", "navprio", "lootprio", "navlootprio", "setmetastate Default", "testitem", "propertydump" })
Check.False(Takes(vt), $"{vt} is RynthAi's (VTank hotkeys)");
}
private static void Classification()
{
Check.Eq(IltObjects.ClassifyByItemType(0x00000800), AcObjectClass.Gem, "gem (aetheria)");
Check.Eq(IltObjects.ClassifyByItemType(0x00000001), AcObjectClass.MeleeWeapon, "melee weapon");
Check.Eq(IltObjects.ClassifyByItemType(0x00000100), AcObjectClass.MissileWeapon, "missile weapon");
Check.Eq(IltObjects.ClassifyByItemType(0x00008000), AcObjectClass.WandStaffOrb, "caster");
Check.Eq(IltObjects.ClassifyByItemType(0x40000000), AcObjectClass.Salvage, "salvage (white quartz)");
Check.Eq(IltObjects.ClassifyByItemType(0x00001000), AcObjectClass.SpellComponent, "spell component");
Check.Eq(IltObjects.ClassifyByItemType(0x00000200), AcObjectClass.Container, "pack");
Check.Eq(IltObjects.ClassifyByItemType(0x00000010), AcObjectClass.Monster, "creature");
Check.Eq(IltObjects.ClassifyByItemType(0x00000002 | 0x00000004), AcObjectClass.Armor, "armor wins over clothing");
Check.Eq(IltObjects.ClassifyByItemType(0), AcObjectClass.Unknown, "no type yet");
}
private static unsafe void InterfaceLayout()
{
Check.Eq(sizeof(IltTabV1), 24 + 32 + 4 + 4 + 4, "IltTabV1: id, label, width, height, flags");
Check.Eq((int)Marshal.OffsetOf<IltTabV1>(nameof(IltTabV1.Flags)), 64, "IltTabV1.Flags offset");
Check.Eq(sizeof(RynthIltHubApiV1), 8 + 9 * IntPtr.Size, "RynthIltHubApiV1: header + 9 functions");
Check.Eq(sizeof(RynthAiHubApiV1), 8 + 10 * IntPtr.Size, "RynthAiHubApiV1: header + 10 functions");
Check.Eq(sizeof(QuestFlagV1), 24, "QuestFlagV1");
Check.Eq(sizeof(QuestStatusV1), 16, "QuestStatusV1");
Check.Eq(RynthIltHubApiV1.InterfaceName, "RynthILT.Hub", "interface name");
Check.Eq(RynthAiHubApiV1.InterfaceName, "RynthAi.Hub", "RynthAi's interface name");
}
private static void DescribeLines()
{
var s = new IltSettings();
Check.True(ServerFeatureGate.Describe("InfiniteLeaftide", s, false).Contains("ON - matches 'InfiniteLeaftide'"), "on by name");
Check.True(ServerFeatureGate.Describe("Aelrynth", s, true).Contains("Treat this world as ILT"), "on by the override");
Check.True(ServerFeatureGate.Describe("Aelrynth", s, false).Contains("OFF"), "off");
Check.True(ServerFeatureGate.Describe("", s, false).Contains("not logged in"), "before login");
}
private static IltHubController NewHub(string world, string folder)
{
RynthCore.RynthAiHostTests.Fakes.FakeHost.Reset();
RynthCore.RynthAiHostTests.Fakes.FakeHost.WorldName = world;
var host = RynthCore.RynthAiHostTests.Fakes.FakeHost.Create(0x50000F01);
string dir = Path.Combine(Program.TempRoot, "move-" + folder);
Directory.CreateDirectory(dir);
return new IltHubController(host, dir, new IltSettings(), new RynthAiClient(host));
}
private static void TickFor(IltHubController hub, int ms)
{
var until = DateTime.UtcNow.AddMilliseconds(ms);
while (DateTime.UtcNow < until) { hub.Tick(); System.Threading.Thread.Sleep(50); }
}
private static void DormantOffIlt()
{
var off = NewHub("Aeshnidae", "dormant");
off.OnLoginComplete("Tester", forceFromMigration: false);
foreach (string line in new[] { "Your Pet Log:", "[BANK] Pyreals: 5", "Guardian of Strength tells you, \"x\"" }) off.OnChat(line);
TickFor(off, 6800); // past the 6 s login delay
Check.Eq(RynthCore.RynthAiHostTests.Fakes.FakeHost.ChatCommands.Count, 0, "off ILT: no probe, no command at all");
Check.False(off.Options.IsIltLikeWorld, "not an ILT world");
foreach (var s in IltSections.Tabs) Check.False(off.TabShown(s), $"no {IltSections.Label(s)} tab");
Check.False(off.RenderSection(RynthIltHub.SectionRemoteBank) || off.RenderSection(RynthIltHub.SectionQuestBonus)
|| off.RenderSection(RynthIltHub.SectionPetLogs) || off.RenderSection(RynthIltHub.SectionRemoteGuardian)
|| off.RenderSection(RynthIltHub.SectionServerMenu), "no ILT section draws (checked before any ImGui call)");
Check.True(off.BuildProgressionJson().StartsWith("{\"available\":false"), "Progression: not available");
off.OnLogout();
var on = NewHub("InfiniteLeaftide", "awake");
on.OnLoginComplete("Tester", forceFromMigration: false);
TickFor(on, 6800);
Check.True(on.Options.IsIltLikeWorld, "InfiniteLeaftide is ILT");
Check.True(RynthCore.RynthAiHostTests.Fakes.FakeHost.ChatCommands.Count > 0, "on ILT the login probe asks the server");
Check.True(on.TabShown(IltSection.Character), "and the Character tab shows");
on.OnLogout();
var forced = NewHub("Aeshnidae", "forced");
forced.OnLoginComplete("Tester", forceFromMigration: true);
Check.True(forced.Options.IsIltLikeWorld, "a migrated \"Force enable\" makes the world ILT for this character");
forced.OnLogout();
}
private static unsafe void HubTable()
{
Check.Eq(HubInterface.Query("RynthAi.Hub", 1), IntPtr.Zero, "another interface's name: not ours");
Check.Eq(HubInterface.Query(RynthIltHubApiV1.InterfaceName, 2), IntPtr.Zero, "a newer version than we have: none");
var t = (RynthIltHubApiV1*)HubInterface.Query(RynthIltHubApiV1.InterfaceName, 1);
Check.True(t != null, "v1 is served");
Check.Eq(t->Version, 1u, "Version 1");
Check.Eq(t->StructSize, (uint)sizeof(RynthIltHubApiV1), "StructSize");
Check.True(t->IsIltWorld != null && t->GetFeature != null && t->GetRates != null && t->GetForceIlt != null && t->SetForceIlt != null
&& t->GetTabs != null && t->RenderTab != null && t->RenderSection != null && t->Command != null, "every function is filled in");
Check.Eq((IntPtr)t, HubInterface.Query(RynthIltHubApiV1.InterfaceName, 1), "the same table each time");
// No plugin instance here (not logged in): every function answers "nothing".
Check.Eq(t->IsIltWorld(), 0, "not ILT before login");
byte* key = stackalloc byte[] { (byte)'b', (byte)'a', (byte)'n', (byte)'k', 0 };
Check.Eq(t->GetFeature(key), -1, "feature unknown before login");
Check.Eq(t->GetTabs(null, 0), 0, "no tabs before login");
Check.Eq(t->Command(key), 0, "no command taken before login");
HubInterface.Release();
Check.Eq(t->Version, 0u, "Release zeroes Version (callers re-query)");
Check.Eq(HubInterface.Query(RynthIltHubApiV1.InterfaceName, 1), IntPtr.Zero, "and nothing is served after shutdown");
Check.Eq(t->IsIltWorld(), 0, "the old table stays callable and answers nothing");
}
}

View file

@ -5,8 +5,9 @@ using RynthCore.RynthAiTests.Harness;
namespace RynthILT.Tests;
// Offline tests for the RynthILT plugin: the ACECustom bounty tracker (parsing, merging, the
// quiet /bounty list read loop on a fake clock, persistence, the bridge JSON). Each test prints
// PASS / FAIL.
// quiet /bounty list read loop on a fake clock, persistence, the bridge JSON) and the ILT Hub
// (attribute raiser, aug costs, bank commands, sigil chain, and the move out of RynthAi: data
// migration, the RynthILT.Hub table, verb routing, the object view). Each test prints PASS / FAIL.
//
// Run: dotnet run -c Release (all tests)
// dotnet run -c Release -- window (tests whose name contains "window")
@ -20,9 +21,23 @@ internal static class Program
if (Directory.Exists(TempRoot)) Directory.Delete(TempRoot, recursive: true);
Directory.CreateDirectory(TempRoot);
// SAFETY: every file the ILT Hub would write under %APPDATA%\RynthCore\RynthILT or read from
// the RynthAi folder points at the scratch folder before any test runs.
RynthCore.Plugin.RynthILT.Hub.IltAugCosts.FilePath = Path.Combine(TempRoot, "ilt-aug-costs.json");
RynthCore.Plugin.RynthILT.Hub.IltHubStore.SharedRoot = Path.Combine(TempRoot, "RynthILT");
RynthCore.Plugin.RynthILT.Hub.IltSettingsStore.Folder = Path.Combine(TempRoot, "RynthILT");
RynthCore.Plugin.RynthILT.Hub.IltMigration.LegacyProfilesBase = Path.Combine(TempRoot, "RynthAi", "SettingsProfiles");
RynthCore.Plugin.RynthILT.Hub.IltMigration.LegacySharedRoot = Path.Combine(TempRoot, "RynthAi");
RynthCore.Plugin.RynthILT.RynthLog.Init(default, Path.Combine(TempRoot, "Logs"));
RynthCore.Plugin.Shared.DataWriteGuard.PluginName = "RynthILT"; // as RynthILTPlugin.Initialize sets it
var runner = new Runner();
BountyTests.Register(runner);
BountyReviewTests.Register(runner);
AttributeRaiserTests.Register(runner);
SigilChainTests.Register(runner);
BankCommandTests.Register(runner);
MoveTests.Register(runner);
return runner.Run("RynthILT tests", args.Length > 0 ? args[0] : null);
}
}

View file

@ -1,28 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
Tests for the RynthILT plugin's ACECustom bounty tracker (Bounty/BountyParse.cs and
Bounty/BountyTracker.cs, ported from SilentKelpie's rynth/RynthSuite PR #11 with his
BountyTests). The plugin is a NativeAOT x86 library, so its host-agnostic sources are
compiled in here directly instead of referencing the project. File tests use a scratch
folder next to the exe, never %APPDATA%\RynthCore.
Tests for the RynthILT plugin: the ACECustom bounty tracker (Bounty/, ported from SilentKelpie's
rynth/RynthSuite PR #11 with his BountyTests) and the ILT Hub moved out of RynthAi 2026-10-13
(the attribute raiser and aug costs, bank commands and the sigil chain, which ran in
RynthCore.RynthAiHostTests before, plus the move itself: data migration, the RynthILT.Hub
interface table, which "/ra" verbs RynthILT takes, the host-backed object view).
Like RynthCore.RynthAiHostTests this references the plugin project itself, so it is a
net10.0-windows x86 exe and needs the x86 .NET runtime (C:\Program Files (x86)\dotnet). The
plugin grants InternalsVisibleTo to this assembly name. The fake engine host is the RynthAi
host tests' FakeHost (linked; RYNTHILT_TESTS leaves out its RynthAi-only helpers). File tests
use a scratch folder next to the exe, never %APPDATA%\RynthCore or C:\Games.
Run: dotnet run -c Release (exit 0 = pass, 1 = fail; an argument filters by test name)
-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>RynthILT.Tests</RootNamespace>
<AssemblyName>RynthILT.Tests</AssemblyName>
<Platforms>x86</Platforms>
<DefineConstants>$(DefineConstants);RYNTHILT_TESTS</DefineConstants>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthILT\Bounty\BountyParse.cs" Link="Plugin\BountyParse.cs" />
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthILT\Bounty\BountyTracker.cs" Link="Plugin\BountyTracker.cs" />
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthILT\RynthILTJsonContext.cs" Link="Plugin\RynthILTJsonContext.cs" />
<!-- The RynthAi test tools' check/runner harness (no plugin code in it). -->
<ProjectReference Include="..\..\Plugins\RynthCore.Plugin.RynthILT\RynthCore.Plugin.RynthILT.csproj" />
</ItemGroup>
<ItemGroup>
<!-- The RynthAi test tools' check/runner harness and fake engine host (no plugin code in them). -->
<Compile Include="..\RynthCore.RynthAiTests\Harness\Check.cs" Link="Harness\Check.cs" />
<Compile Include="..\RynthCore.RynthAiTests\Harness\Runner.cs" Link="Harness\Runner.cs" />
<Compile Include="..\RynthCore.RynthAiHostTests\Fakes\FakeHost.cs" Link="Fakes\FakeHost.cs" />
</ItemGroup>
<!-- The engine's Bounties snapshot reader (self-contained DTOs), so BountyTests checks the plugin's
@ -35,4 +51,9 @@
<Compile Include="..\..\..\RynthCore\src\RynthCore.Engine\UI\Data\BountiesSnapshotJson.cs" Link="Engine\BountiesSnapshotJson.cs" />
</ItemGroup>
<!-- The engine supplies cimgui; never copy ImGui.NET's own next to the test exe either. -->
<Target Name="RemoveBundledImGuiNative" AfterTargets="Build">
<Delete Files="$(OutputPath)cimgui.dll" Condition="Exists('$(OutputPath)cimgui.dll')" />
</Target>
</Project>

View file

@ -1,7 +1,7 @@
using RynthCore.Plugin.RynthAi.IltHub;
using RynthCore.Plugin.RynthILT.Hub;
using RynthCore.RynthAiTests.Harness;
namespace RynthCore.RynthAiHostTests.Tests;
namespace RynthILT.Tests;
// Enlightenment 301-325 sigil craft chain (2026-10-07). Each target level T costs T - 5 sigils and
// T x 2B luminance (ACECustom tier 5). Sigil = Lifeblood Elixir + Ascension Coin; Ascension Coin =