Snapshot for release 2026.10.20.1 (internal 7116fab)

This commit is contained in:
Tom Bohar 2026-10-20 21:28:18 -04:00
commit bfcd48950d
215 changed files with 16200 additions and 2838 deletions

View file

@ -1,7 +1,8 @@
// DataInterface.cs - RynthILT's side of the "RynthILT.Data" interface (Plugins/Shared/RynthIltDataApi.cs):
// the charms list and the bank balances (every character RynthILT has seen on this server) the
// Mini Remote's Charms and Banking tabs show, for other plugins to draw, with the charm Toggle and
// the bank verbs they send back; since version 2 also the pet breeding tracker's JSON and verbs.
// the bank verbs they send back; since version 2 also the pet breeding tracker's JSON and verbs;
// since version 3 the Temple guardians' JSON and verbs (RynthOracle's Quests tab).
//
// The table is allocated once per loaded copy of RynthILT and never freed (a plugin DLL is never
// unloaded); after Release() it reports Version 0 and every function answers 0. Before login there
@ -37,6 +38,8 @@ internal static unsafe class DataInterface
t->BankCommand = &BankCommand;
t->GetPetBreedingJson = &GetPetBreedingJson;
t->PetBreedingCommand = &PetBreedingCommand;
t->GetGuardianJson = &GetGuardianJson;
t->GuardianCommand = &GuardianCommand;
t->Version = RynthIltDataApiV1.InterfaceVersion;
_table = t;
}
@ -128,6 +131,32 @@ internal static unsafe class DataInterface
catch { return 0; }
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int GetGuardianJson(byte* buffer, int capacity)
{
try
{
string? json = Hub?.GuardianJson;
return string.IsNullOrEmpty(json) ? 0 : ProfileInterface.Write(json, buffer, capacity);
}
catch { return 0; }
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int GuardianCommand(byte* utf8)
{
try
{
IltHubController? hub = Hub;
if (hub == null) return 0;
string? line = ReadVerb(utf8);
if (line == null) return 0;
hub.RequestGuardianVerb(line);
return 1;
}
catch { return 0; }
}
/// <summary>A reader's verb line, or null when it is empty, too long or not plain ASCII (no control characters reach a chat command).</summary>
private static string? ReadVerb(byte* utf8)
{

View file

@ -20,6 +20,8 @@
// Fellowship.cs), Zone Share (ZoneShareManager) and the fellowship luminance share.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace RynthCore.Plugin.RynthILT.Hub;
@ -45,6 +47,16 @@ internal enum IltKnown
ProfileOff,
}
/// <summary>The quest bonus list as the profile JSON carries it ("questBonus"), for RynthOracle's Quests tab.</summary>
/// <param name="Disabled">The server has /qb turned off.</param>
/// <param name="Generation">Bumped per parsed "/qb list"; 0 = not loaded this session.</param>
/// <param name="Count">The server's quest bonus count; -1 = unknown.</param>
/// <param name="Status">One line on the last request ("loading...", "12 completed, 3 incomplete", ...).</param>
/// <param name="Completed">Completed bonus flags, sorted.</param>
/// <param name="Incomplete">Incomplete bonus flags, sorted.</param>
internal sealed record IltQuestBonusInfo(bool Disabled, int Generation, long Count, string Status,
IReadOnlyList<string> Completed, IReadOnlyList<string> Incomplete);
internal static class IltFeatureCatalog
{
public const string GroupCharacter = "Character";
@ -257,6 +269,83 @@ internal static class IltFeatureCatalog
/// <summary>The fellowship member limit: ACECustom's 29 on an ILT world, retail's 9 elsewhere.</summary>
public static int FellowshipMax(bool iltWorld) => iltWorld ? IltFellowshipMax : RetailFellowshipMax;
/// <summary>
/// The "RynthILT.Server" profile JSON (schema in Plugins/Shared/RynthIltServerApi.cs). Pure:
/// everything comes in as arguments, so the tests build it without a client. Plain ASCII.
/// </summary>
public static string BuildProfileJson(bool iltWorld, string world, bool forced, string source, DateTime checkedUtc,
Func<string, IltTri> bit, IltQuestBonusInfo? questBonus = null)
{
var sb = new StringBuilder(4096);
sb.Append("{\"ilt\":").Append(iltWorld ? "true" : "false");
sb.Append(",\"world\":\"").Append(Escape(world)).Append('"');
sb.Append(",\"forced\":").Append(forced ? "true" : "false");
sb.Append(",\"source\":\"").Append(Escape(source)).Append('"');
sb.Append(",\"checked\":\"")
.Append(checkedUtc == DateTime.MinValue ? "" : checkedUtc.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture))
.Append('"');
sb.Append(",\"features\":[");
for (int i = 0; i < All.Length; i++)
{
IltFeatureInfo f = All[i];
if (i > 0) sb.Append(',');
sb.Append("{\"key\":\"").Append(Escape(f.Key))
.Append("\",\"label\":\"").Append(Escape(f.Label))
.Append("\",\"group\":\"").Append(Escape(f.Group))
.Append("\",\"state\":").Append(((int)StateOf(f, iltWorld, bit)).ToString(CultureInfo.InvariantCulture))
.Append(",\"where\":\"").Append(Escape(f.Where)).Append("\"}");
}
sb.Append(']');
int State(string key) => (int)StateOf(Find(key)!, iltWorld, bit);
sb.Append(",\"fellowship\":{\"maxMembers\":").Append(FellowshipMax(iltWorld).ToString(CultureInfo.InvariantCulture))
.Append(",\"zoneShare\":").Append(State("zone_share").ToString(CultureInfo.InvariantCulture))
.Append(",\"blackjack\":").Append(State("fellowship_blackjack").ToString(CultureInfo.InvariantCulture))
.Append(",\"luminanceShare\":").Append(State("fellowship_luminance").ToString(CultureInfo.InvariantCulture))
.Append('}');
// The /qb list (ILT worlds only): RynthOracle's Quests tab draws it.
if (questBonus != null && iltWorld)
{
sb.Append(",\"questBonus\":{\"disabled\":").Append(questBonus.Disabled ? "true" : "false")
.Append(",\"generation\":").Append(questBonus.Generation.ToString(CultureInfo.InvariantCulture))
.Append(",\"count\":").Append(questBonus.Count.ToString(CultureInfo.InvariantCulture))
.Append(",\"status\":\"").Append(Escape(questBonus.Status)).Append('"');
AppendList(sb, "completed", questBonus.Completed);
AppendList(sb, "incomplete", questBonus.Incomplete);
sb.Append('}');
}
sb.Append('}');
return sb.ToString();
static void AppendList(StringBuilder b, string name, IReadOnlyList<string> items)
{
b.Append(",\"").Append(name).Append("\":[");
for (int i = 0; i < items.Count; i++)
{
if (i > 0) b.Append(',');
b.Append('"').Append(Escape(items[i])).Append('"');
}
b.Append(']');
}
}
/// <summary>JSON string body: quotes, backslashes and control characters escaped, anything non-ASCII as \uXXXX.</summary>
private static string Escape(string? s)
{
if (string.IsNullOrEmpty(s)) return string.Empty;
var sb = new StringBuilder(s.Length + 8);
foreach (char c in s)
{
if (c == '"') sb.Append("\\\"");
else if (c == '\\') sb.Append("\\\\");
else if (c < 0x20 || c > 0x7E) sb.Append("\\u").Append(((int)c).ToString("x4", CultureInfo.InvariantCulture));
else sb.Append(c);
}
return sb.ToString();
}
/// <summary>The chat listing for "/ra hub features": one line per feature, ASCII only.</summary>
public static List<string> BuildChatLines(bool iltWorld, Func<string, IltTri> bit)
{

View file

@ -9,6 +9,8 @@
// nearest vendor (VendorBuy). Runs as a small pump-thread state machine with timeouts; the
// client busy state is respected between steps.
// * Attribute tracker: IltTempleAttributes.
// * Reader: the same state as JSON with verbs back ("RynthILT.Data" version 3), for RynthOracle's
// Quests tab. The automation (auto hand-in, buy if missing) stays here either way.
//
// Threading: OnChat / Tick / commands run on the pump thread; Render only reads volatile fields
// and posts actions through IltHubContext.Post.
@ -426,6 +428,90 @@ internal sealed class IltGuardian : IIltFeature
}
}
// ── Reader ("RynthILT.Data" GetGuardianJson / GuardianCommand; RynthOracle's Quests tab) ──
/// <summary>
/// The reader JSON (Plugins/Shared/RynthIltDataApi.cs header has the shape): the switches, the
/// last answer and hand-in status, and the attribute turn-in rows. Built on demand: everything it
/// reads is volatile or an immutable snapshot. Any thread.
/// </summary>
public string ReaderJson(string world)
{
TimeSpan age = LastAnswerAge;
return BuildJson(world, S.AutoDetectFromChat, S.AutoHandIn, S.BuyMissingFromVendor, S.CooldownHoursAssumed,
_lastAnswer, _lastNpc, age == TimeSpan.MaxValue ? -1 : (long)age.TotalSeconds,
IltGuardianPhrasebook.MessageOf(_lastLine), HandInRunning, _handInStatus, Attributes.SyncedUtc, Attributes.Snapshot);
}
/// <summary>The reader JSON from its parts. Pure: the tests drive it.</summary>
internal static string BuildJson(string world, bool chat, bool auto, bool buy, int cooldownHours,
string answer, string npc, long answerAgeSec, string heard, bool running, string status,
DateTime syncedUtc, System.Collections.Generic.IReadOnlyList<IltTempleAttrStatus> rows)
{
var sb = new System.Text.StringBuilder(1024);
sb.Append("{\"available\":true");
Str(sb, "world", world);
sb.Append(",\"chat\":").Append(chat ? "true" : "false");
sb.Append(",\"auto\":").Append(auto ? "true" : "false");
sb.Append(",\"buy\":").Append(buy ? "true" : "false");
sb.Append(",\"cooldownHours\":").Append(cooldownHours);
Str(sb, "answer", answer);
Str(sb, "npc", npc);
sb.Append(",\"answerAgeSec\":").Append(answerAgeSec);
Str(sb, "heard", heard);
sb.Append(",\"running\":").Append(running ? "true" : "false");
Str(sb, "status", status);
Str(sb, "synced", syncedUtc == DateTime.MinValue ? "" : syncedUtc.ToString("yyyy-MM-ddTHH:mm:ssZ", System.Globalization.CultureInfo.InvariantCulture));
sb.Append(",\"rows\":[");
for (int i = 0; i < rows.Count; i++)
{
IltTempleAttrStatus r = rows[i];
if (i > 0) sb.Append(',');
sb.Append('{');
Str(sb, "attribute", r.Attribute, first: true);
Str(sb, "npc", r.Npc);
sb.Append(",\"count\":").Append(r.Count);
Str(sb, "status", r.Status);
Str(sb, "eta", r.Eta);
sb.Append(",\"ready\":").Append(r.Ready ? "true" : "false");
sb.Append(",\"exact\":").Append(r.FromMyQuests ? "true" : "false");
sb.Append('}');
}
sb.Append("]}");
return sb.ToString();
}
private static void Str(System.Text.StringBuilder sb, string name, string? value, bool first = false)
{
if (!first) sb.Append(',');
sb.Append('"').Append(name).Append("\":\"").Append(IltStyle.JsonEscape(value ?? string.Empty)).Append('"');
}
/// <summary>
/// A reader's verb line (header of Plugins/Shared/RynthIltDataApi.cs): handin | stop | refresh |
/// chat on|off | auto on|off | buy on|off. The reader shows the new state, so the switches don't
/// echo in chat; hand-in and refresh report as the Guardian window's buttons do. Pump thread.
/// </summary>
public void RunVerb(string line)
{
string[] parts = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);
if (parts.Length == 0) return;
string arg = parts.Length > 1 ? parts[1] : "";
switch (parts[0].ToLowerInvariant())
{
case "handin": StartHandIn(_lastAnswer, _lastNpc, asked: true); break;
case "stop": StopHandIn(); break;
case "refresh": _ctx.Chat("[ILT Guardian] " + Attributes.Refresh()); break;
case "chat": S.AutoDetectFromChat = Toggle(arg, S.AutoDetectFromChat); break;
case "auto": S.AutoHandIn = Toggle(arg, S.AutoHandIn); break;
case "buy": S.BuyMissingFromVendor = Toggle(arg, S.BuyMissingFromVendor); break;
default:
RynthLog.Trace(LogCat.IltHub, $"[IltGuardian] reader verb ignored: {line}");
return;
}
RynthLog.Write(LogCat.IltHub, $"[IltGuardian] reader verb: {line}");
}
private static bool Toggle(string mode, bool current) => mode.Trim().ToLowerInvariant() switch
{
"on" or "true" or "1" or "show" => true,

View file

@ -34,6 +34,8 @@ internal sealed class IltHubController
private int _questGeneration; // RynthAi's /myquests refreshes seen (NoteQuestTrackerOutcome)
private bool _availabilityAnnounced; // "open the Mini Remote" hint printed this session
private volatile int _forceRequest = -1; // SetForceIlt from another thread, applied on the next tick
private long _tabDrawnAt = long.MinValue / 2; // a tab drawn as RynthCore's section view (render thread)
private const long TabDrawnMs = 2000;
// "RynthILT.Data" (Plugins/Shared/RynthIltDataApi.cs): the charms and bank snapshots, rebuilt on
// the pump every DataRebuildMs only while a reader has asked within DataWatchMs.
@ -45,6 +47,11 @@ internal sealed class IltHubController
private long _charmsBuiltAt, _bankBuiltAt, _siblingsReadAt;
private volatile string _charmsJson = string.Empty;
private volatile string _bankJson = string.Empty;
// "RynthILT.Server" profile JSON (RynthOracle: feature states, fellowship rules, the /qb list). Rebuilt ~1 s.
private const long ProfileRebuildMs = 1000;
private long _profileBuiltAt;
private volatile string _profileJson = string.Empty;
private List<IltBankExport.Row> _siblings = new();
public IltBanking Banking { get; }
@ -55,6 +62,8 @@ internal sealed class IltHubController
public IltPetLogs PetLogs { get; }
/// <summary>The pet breeding tracker (the Pets tab's Breeding sub-tab, and the "RynthILT.Data" breeding JSON).</summary>
public IltPetBreeding Breeding { get; }
/// <summary>The Pets tab's ACECustom sections: pet charms, the summon-from-empty refill path, siphon auto-capture.</summary>
public IltPetAutomation PetAutomation { get; }
public IltProgression Progression { get; }
public IltGear Gear { get; }
public IltGames Games { get; }
@ -64,8 +73,12 @@ internal sealed class IltHubController
public IltCharms CharmsTab { get; }
/// <summary>Temple guardians: riddle translator, hand-in, attribute turn-in tracker.</summary>
public IltGuardian Guardian { get; }
/// <summary>Vaulted Dungeons keeper (Mini Remote tab). ILT-only and behind RynthAi's master switch, off by default.</summary>
/// <summary>Vaulted Dungeons keeper (Mini Remote tab). ILT-only and behind its master switch (State.VaultedDungeonsEnabled), off by default.</summary>
public IltVaultedDungeons VaultedDungeons { get; }
/// <summary>The Empyrean Handler's lethal ring: asks RynthAi to back away (RynthAi.Hub BackAwayFrom).</summary>
public IltRingEvade RingEvade { get; }
/// <summary>T11 gear: the "/aug" wield counters for RynthAi's loot rules, "/ilt t11".</summary>
public IltT11 T11 { get; }
/// <param name="writesBlocked">True while this character's copy from RynthAi is unfinished (IltHubStore.WritesBlocked).</param>
/// <param name="legacyFolder">The character's RynthAi folder while that copy is unfinished (read-only fallback).</param>
@ -86,6 +99,7 @@ internal sealed class IltHubController
Banking = new IltBanking(_ctx);
PetLogs = new IltPetLogs(_ctx);
Breeding = new IltPetBreeding(_ctx);
PetAutomation = new IltPetAutomation(_ctx);
Rates = new IltSessionRates(_ctx);
QuestBonus = new IltQuestBonus(_ctx);
Progression = new IltProgression(_ctx);
@ -95,13 +109,33 @@ internal sealed class IltHubController
CharmsTab = new IltCharms(_ctx, Charms);
Guardian = new IltGuardian(_ctx, QuestBonus);
VaultedDungeons = new IltVaultedDungeons(_ctx);
_features.AddRange(new IIltFeature[] { Banking, PetLogs, Breeding, Rates, QuestBonus, Progression, Gear, CharmsTab, Games, VaultedDungeons, Guardian });
RingEvade = new IltRingEvade(_ctx);
T11 = new IltT11(_ctx);
_features.AddRange(new IIltFeature[] { Banking, PetLogs, Breeding, PetAutomation, Rates, QuestBonus, Progression, Gear, CharmsTab, Games, VaultedDungeons, Guardian, RingEvade, T11 });
Banking.BalanceChanged += Rates.OnBankBalanceChanged;
Rates.MovingMoney = () => Banking.MovingMoney;
options.ProbeReplyTap = OnProbeReply;
_ui = new IltHubUi(this, _ctx);
_ctx.ShowTab = section => _ctx.Ai.MiniRemoteTab(IltSections.TabId(section), "show");
RebuildProfile();
}
/// <summary>
/// The latest "RynthILT.Server" profile JSON: Leaftide features, fellowship rules and the /qb
/// list (Plugins/Shared/RynthIltServerApi.cs). Rebuilt on the pump about once a second so any
/// thread (ServerInterface) may read it.
/// </summary>
public string ProfileJson => _profileJson;
/// <summary>Rebuilds <see cref="ProfileJson"/> from the current server options. Pump thread.</summary>
private void RebuildProfile()
{
IltServerOptions o = _ctx.Options;
_profileJson = IltFeatureCatalog.BuildProfileJson(
o.IsIltLikeWorld, o.WorldName, _ctx.State.ForceLeaftideFeatures,
o.Source ?? string.Empty, o.LastRefreshUtc, o.Get,
QuestBonus.Snapshot());
}
/// <summary>
@ -144,6 +178,20 @@ internal sealed class IltHubController
Breeding.RunVerb(line);
});
/// <summary>
/// The Temple guardian JSON ("RynthILT.Data" GetGuardianJson): switches, last answer, hand-in
/// status and attribute turn-ins. "" off an ILT world. Any thread.
/// </summary>
public string GuardianJson => _ctx.Options.IsIltLikeWorld ? Guardian.ReaderJson(_ctx.Options.WorldName) : string.Empty;
/// <summary>A reader's guardian verb line, posted to the pump (IltGuardian.RunVerb). Any thread.</summary>
public void RequestGuardianVerb(string line)
=> _ctx.Post(() =>
{
if (!_ctx.Options.IsIltLikeWorld) return;
Guardian.RunVerb(line);
});
/// <summary>A reader's bank verb line, posted to the pump (IltBanking.RunVerb). Any thread.</summary>
public void RequestBankVerb(string line)
=> _ctx.Post(() =>
@ -195,7 +243,7 @@ internal sealed class IltHubController
IltSection.Character => true,
IltSection.Banking => Available && !_ctx.Options.IsOff(IltFeature.Bank),
IltSection.Games => Available && Games.AnyGameAvailable,
// Content, not a server feature bit: an ILT world and the master switch (RynthAi's setting).
// Content, not a server feature bit: an ILT world and the master switch.
IltSection.VaultedDungeons => _ctx.Options.IsIltLikeWorld && VaultedDungeons.MasterEnabled(),
_ => Available,
};
@ -212,6 +260,9 @@ internal sealed class IltHubController
/// <summary>Render thread: one Mini Remote ILT tab's body (RynthAi's MiniRemoteHud draws the tab bar).</summary>
public void RenderTab(IltSection section) => _ui.RenderTab(section);
/// <summary>Render thread: a tab was just drawn as RynthCore's section view (it counts as the Mini Remote on screen).</summary>
public void NoteTabDrawn() => System.Threading.Interlocked.Exchange(ref _tabDrawnAt, IltHubContext.NowMs);
/// <summary>
/// Render thread: the ILT session extras (coins, pyreals, item conversions) in RynthCore's Mini
/// Remote "Session Stats" section, below RynthAi's session stats (surface "section:ilt-rates").
@ -288,8 +339,18 @@ internal sealed class IltHubController
try { RebuildReaderData(now); }
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "RebuildReaderData"); }
// "Mini Remote on screen" gates bank auto-refresh and the gear / split-arrow scans.
_ctx.State.WindowVisible = _ctx.Ai.MiniRemoteVisible;
// The profile other plugins read ("RynthILT.Server"): world, feature states, fellowship, /qb.
if (now - _profileBuiltAt >= ProfileRebuildMs)
{
_profileBuiltAt = now;
try { RebuildProfile(); }
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "RebuildProfile"); }
}
// "Mini Remote on screen" gates bank auto-refresh and the gear / split-arrow scans: RynthAi's Mini
// Remote, or one of the tabs drawn as RynthCore's section view in the last couple of seconds.
_ctx.State.WindowVisible = _ctx.Ai.MiniRemoteVisible
|| now - System.Threading.Interlocked.Read(ref _tabDrawnAt) < TabDrawnMs;
// One hint per session once the server confirms ILT features. The Mini Remote is separate
// from the main RynthAi panel, so say how to open it.
@ -325,6 +386,59 @@ internal sealed class IltHubController
}
}
/// <summary>A creature's health update from the server (RynthPluginOnUpdateHealth): auto-capture's fallback health read.</summary>
public void OnUpdateHealth(uint objectId, float healthRatio)
{
if (!_ctx.Options.IsIltLikeWorld) return;
PetAutomation.NoteHealth(objectId, healthRatio);
}
/// <summary>
/// The sub-tabs RynthILT adds to one of RynthAi's tabs (RynthILT.Hub GetSubTabs): the Pets tab's
/// Breeding on an ILT world whose server hasn't reported pet breeding off. (Id, label) pairs; the
/// id is a RenderSection id. Any thread.
/// </summary>
public (string Id, string Label)[] SubTabs(string parent)
{
if (!string.Equals(parent, RynthCore.Plugin.Shared.RynthIltHub.TabParentPets, StringComparison.OrdinalIgnoreCase)
|| !_ctx.Options.IsIltLikeWorld || _ctx.Options.IsOff(RynthCore.Plugin.Shared.RynthIltHub.FeaturePetBreeding))
return Array.Empty<(string, string)>();
return new[] { (RynthCore.Plugin.Shared.RynthIltHub.SectionPetBreeding, "Breeding") };
}
/// <summary>
/// RynthILT.Hub GetSetting: a setting another plugin mirrors (RynthIltHub.Setting*), -1 when not offered
/// (unknown key, or off an ILT world: the engine row then hides). Any thread.
/// </summary>
public int GetSetting(string key) => key switch
{
RynthCore.Plugin.Shared.RynthIltHub.SettingVaultedDungeons when _ctx.Options.IsIltLikeWorld
=> _ctx.State.VaultedDungeonsEnabled ? 1 : 0,
_ => -1,
};
/// <summary>
/// RynthILT.Hub GetText: a short text RynthAi shows (RynthIltHub.Text*); "" for an unknown id, and
/// the session tail off ILT. Any thread.
/// </summary>
public string GetText(string id) => id switch
{
RynthCore.Plugin.Shared.RynthIltHub.TextServerId => IltSectionsManifest.Server,
RynthCore.Plugin.Shared.RynthIltHub.TextSessionReport when _ctx.Options.IsIltLikeWorld => _ui.SessionReportTail(),
_ => string.Empty,
};
/// <summary>RynthILT.Hub SetSetting: false for an unknown key. Saved with the state (next periodic save). Any thread.</summary>
public bool SetSetting(string key, int value)
{
if (key != RynthCore.Plugin.Shared.RynthIltHub.SettingVaultedDungeons) return false;
bool on = value != 0;
if (_ctx.State.VaultedDungeonsEnabled != on)
RynthLog.Write(LogCat.IltHub, $"Vaulted Dungeons master switch {(on ? "on" : "off")} (Settings window)");
_ctx.State.VaultedDungeonsEnabled = on;
return true;
}
/// <summary>The server's killer notification (pump thread): restarts the Vaulted Dungeons no-kill timer, on ILT only.</summary>
public void OnKillNotification()
{
@ -334,13 +448,16 @@ internal sealed class IltHubController
}
/// <summary>Pump-thread chat line. Returns true when the line should be hidden.</summary>
public bool OnChat(string text)
public bool OnChat(string text, int chatType = -1)
{
if (string.IsNullOrEmpty(text)) return false;
string line = text.TrimEnd('\r', '\n');
_ctx.Options.OnChatLine(line);
bool eat = _ctx.Capture.OnChatLine(line);
if (!_ctx.Options.IsIltLikeWorld) return eat;
// The ring line needs its chat type (a player repeating it is ignored).
try { RingEvade.OnChatLine(line, chatType); }
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "IltRingEvade.OnChatLine"); }
foreach (var f in _features)
{
try { eat |= f.OnChat(line); }
@ -353,7 +470,7 @@ internal sealed class IltHubController
private static LogCat CategoryOf(IIltFeature f) => f switch
{
IltBanking => LogCat.IltBanking,
IltPetLogs or IltPetBreeding => LogCat.IltPets,
IltPetLogs or IltPetBreeding or IltPetAutomation => LogCat.IltPets,
IltSessionRates => LogCat.IltRates,
IltQuestBonus => LogCat.IltQuests,
IltProgression => LogCat.IltProgression,
@ -513,7 +630,7 @@ internal sealed class IltHubController
default:
_ctx.Chat("[Mini Remote] /ra hub [show|hide|toggle] (Mini Remote)|refresh|bank|status|features|force on|off|servers [list]|clap|confirm|cancel");
_ctx.Chat("[Mini Remote] /ra hub open pets|banking|gear|charms|games|vaulted [show|hide|toggle] (Mini Remote tabs; character: /ro character, quests: /ro)");
_ctx.Chat("[Mini Remote] /ilt vaulted [on|off|toggle|status] (Vaulted Dungeons; master switch: Settings > Navigation > Vaulted Dungeons)");
_ctx.Chat("[Mini Remote] /ilt vaulted [on|off|toggle|status] (Vaulted Dungeons; master switch: /ilt settings or Settings > Navigation > Vaulted Dungeons)");
_ctx.Chat("[Mini Remote] /ra hub profile list|save <name> [shared]|load <name> /ra hub suit list|test|load [name]");
_ctx.Chat("[Mini Remote] /ra hub attr run|stop|costs|status|auto on|off|every <min>|raise <stat> <n> (Skills panel > Progression)");
_ctx.Chat("[Mini Remote] /ra quests refresh (quiet /myquests) /ra pets [show|hide] /ilt qb (the quest bonus list)");
@ -602,7 +719,7 @@ internal sealed class IltHubController
if (section == IltSection.VaultedDungeons && !SectionAvailable(section))
{
_ctx.Chat(_ctx.Options.IsIltLikeWorld
? "[Mini Remote] The Vaulted Dungeons tab is off: turn on \"Vaulted Dungeons\" in Settings > Navigation (the master switch, off by default)."
? "[Mini Remote] The Vaulted Dungeons tab is off: turn on \"Vaulted Dungeons\" in the ILT settings (/ilt settings; also Settings > Navigation) (the master switch, off by default)."
: "[Mini Remote] Vaulted Dungeons is not available on this server (Infinite Leaftide / ACECustom only).");
return;
}

View file

@ -38,6 +38,12 @@ public sealed class IltHubState
/// <summary>True once the one-time UtilityBelt sidecar import has run for this character.</summary>
public bool UbSidecarsImported;
/// <summary>
/// True once the RynthAi settings that moved to RynthILT on 2026-10-20 (the Pets tab's ACECustom
/// options, ...) were copied from this character's RynthAi files (IltMigration.ImportRynthAiSettings).
/// </summary>
public bool RynthAiSettingsImported;
/// <summary>Last-seen server feature bits. Cache only — overwritten by every login refresh.</summary>
public IltServerOptionsSnapshot ServerOptions = new();
@ -47,6 +53,56 @@ public sealed class IltHubState
public IltGearState Gear = new();
public IltGamesState Games = new();
public IltGuardianState Guardian = new();
/// <summary>Infinite Leaftide combat helpers (moved from RynthAi's profile 2026-10-20).</summary>
public IltCombatState Combat = new();
/// <summary>
/// The Vaulted Dungeons keeper's master switch (off by default): while off it does nothing (no
/// recalls, no /rc quit, no tab). RynthAi's "Vaulted Dungeons" setting until 2026-10-20 (copied once);
/// set in the ILT settings ("/ilt settings") or the engine's Settings > Navigation row (RynthAi
/// mirrors it through RynthILT.Hub GetSetting / SetSetting).
/// </summary>
public bool VaultedDungeonsEnabled;
/// <summary>ACECustom T11 gear (IltT11): the item-aug override (moved from RynthAi's profile 2026-10-20).</summary>
public IltT11State T11 = new();
/// <summary>The ILT sections of RynthAi's Remote tab (moved from RynthAi's huds.json 2026-10-20).</summary>
public IltRemoteState Remote = new();
}
// ── RynthAi's Remote tab ────────────────────────────────────────────────────
public sealed class IltRemoteState
{
/// <summary>The Remote tab's Bank section (ILT bank balances). Was RynthAi's MiniShowBank.</summary>
public bool ShowBank = true;
/// <summary>The Remote tab's Guardian line (the last Temple guardian answer). Was RynthAi's MiniShowGuardian.</summary>
public bool ShowGuardian = true;
}
// ── T11 ─────────────────────────────────────────────────────────────────────
public sealed class IltT11State
{
/// <summary>
/// The item augmentation count T11 wield gates use ("T11: Can Wield" in RynthAi's loot rules) instead
/// of the "/aug" reply's; -1 = automatic (read from /aug). "/ilt t11 augs &lt;n|auto&gt;". Was RynthAi's
/// T11ItemAugsOverride.
/// </summary>
public int ItemAugsOverride = -1;
}
// ── Combat ──────────────────────────────────────────────────────────────────
public sealed class IltCombatState
{
/// <summary>
/// When the Empyrean Handler channels its lethal ring and the character is inside it, have RynthAi
/// back-jump away and re-engage (IltRingEvade; RynthAi acts only while its macro runs with combat
/// on). On by default because it is gated that way. Was RynthAi's HandlerRingEvade.
/// </summary>
public bool HandlerRingEvade = true;
}
/// <summary>Cached result of the server-options check (see IltServerOptions).</summary>
@ -110,8 +166,22 @@ public sealed class IltPetState
public List<string> ShinyLog = new();
/// <summary>The breeding tracker: rules this server showed, growth stage names, recent events (IltPetBreeding).</summary>
public IltBreedingState Breeding = new();
// The Pets tab's own settings (roster, healing / cosmetic pets, refill path) are RynthAi's
// (its miniremote.json); older ilt-hub.json files still carry them, and they are ignored here.
// ACECustom's parts of the Pets tab (IltPetAutomation, moved from RynthAi 2026-10-20; copied once
// from RynthAi's miniremote.json by IltMigration.ImportRynthAiSettings). New names on purpose: an
// old ilt-hub.json copy still carries RynthAi's UsePyrealRefillPath / AutoCaptureEnabled /
// CaptureLensIndex from before 2026-10-13, and those stale values must not be read back.
/// <summary>
/// Summon from an EMPTY essence while the Summon Essence Refill charm is on (the server refills it
/// from banked pyreals). Still needs the server to confirm the feature (RynthAi.Hub's PetManager
/// asks AllowSummonOnEmpty).
/// </summary>
public bool RefillFromEmpty;
/// <summary>Use the chosen siphon lens on the nearest creature once it is weak enough (off by default).</summary>
public bool AutoCapture;
/// <summary>Index into PetCaptureRules.Lenses (Flawed to Asheron's).</summary>
public int CaptureLens;
// The Pets tab's own settings (roster, healing / cosmetic pets) are RynthAi's (its miniremote.json).
}
// ── Character ───────────────────────────────────────────────────────────────

View file

@ -150,6 +150,7 @@ internal sealed class IltHubStore
s.Pet.Breeding.StageNames ??= new();
s.Pet.Breeding.Log ??= new();
s.Pet.Breeding.LastDebug ??= new();
s.Pet.CaptureLens = Math.Clamp(s.Pet.CaptureLens, 0, PetCaptureRules.Lenses.Length - 1);
s.Pet.Breeding.Rules.RemoveAll(r => r == null || string.IsNullOrEmpty(r.Key));
s.Pet.Breeding.Log.RemoveAll(e => e == null);
for (int i = 0; i < s.Pet.Breeding.StageNames.Count; i++) s.Pet.Breeding.StageNames[i] ??= string.Empty;
@ -169,6 +170,10 @@ internal sealed class IltHubStore
s.Gear.DispelExclusions ??= new();
s.Gear.RingRuns = new Dictionary<string, int>(s.Gear.RingRuns ?? new(), StringComparer.OrdinalIgnoreCase);
s.Games ??= new IltGamesState();
s.Combat ??= new IltCombatState();
s.T11 ??= new IltT11State();
s.Remote ??= new IltRemoteState();
if (s.T11.ItemAugsOverride < -1) s.T11.ItemAugsOverride = -1;
s.Guardian ??= new IltGuardianState();
s.Guardian.TurnInCounts = new Dictionary<string, int>(s.Guardian.TurnInCounts ?? new(), StringComparer.OrdinalIgnoreCase);
s.Guardian.CooldownUntilUtc = new Dictionary<string, DateTime>(s.Guardian.CooldownUntilUtc ?? new(), StringComparer.OrdinalIgnoreCase);

View file

@ -121,13 +121,21 @@ internal sealed class IltHubUi
switch (id)
{
case RynthIltHub.SectionRemoteBank:
if (!o.IsIltLikeWorld || o.IsOff(IltFeature.Bank)) return false;
if (!o.IsIltLikeWorld || o.IsOff(IltFeature.Bank) || !_ctx.State.Remote.ShowBank) return false;
RenderRemoteBank();
return true;
case RynthIltHub.SectionRemoteGuardian:
if (!o.IsIltLikeWorld) return false;
if (!o.IsIltLikeWorld || !_ctx.State.Remote.ShowGuardian) return false;
_hub.Guardian.RenderRemoteLine();
return true;
case RynthIltHub.SectionRemoteStats:
if (!o.IsIltLikeWorld) return false;
RenderRemoteStats();
return true;
case RynthIltHub.SectionRemoteOptions:
if (!o.IsIltLikeWorld) return false;
RenderRemoteOptions();
return true;
case RynthIltHub.SectionQuestBonus:
if (!o.IsIltLikeWorld) return false;
_hub.QuestBonus.RenderSection();
@ -140,6 +148,14 @@ internal sealed class IltHubUi
if (!o.IsIltLikeWorld) return false;
_hub.Breeding.RenderSection();
return true;
case RynthIltHub.SectionPetCharms:
if (!o.IsIltLikeWorld) return false;
_hub.PetAutomation.RenderCharms();
return true;
case RynthIltHub.SectionPetCapture:
if (!o.IsIltLikeWorld) return false;
_hub.PetAutomation.RenderCapture();
return true;
case RynthIltHub.SectionIltStatus:
return RenderIltStatus();
case RynthIltHub.SectionServerMenu:
@ -206,6 +222,34 @@ internal sealed class IltHubUi
}
}
// ── RynthAi's Mini Remote: the Remote tab's Stats lines and Options switches ──
/// <summary>Coins and pyreals per hour under RynthAi's per-hour lines (the Remote tab's Stats).</summary>
private void RenderRemoteStats()
{
var r = _hub.Rates.Summary;
Stat("Coins:", Compact(r.CoinsPerHour) + "/h");
Stat("Pyr:", Compact(r.PyrealsPerHour) + "/h");
}
/// <summary>The Remote tab's ILT sections' switches, in RynthAi's Options popup.</summary>
private void RenderRemoteOptions()
{
var st = _ctx.State.Remote;
bool bank = st.ShowBank, guardian = st.ShowGuardian;
if (ImGui.Checkbox("Bank##iltmrbank", ref bank)) st.ShowBank = bank;
if (ImGui.IsItemHovered()) ImGui.SetTooltip("Infinite Leaftide bank balances (RynthILT).");
if (ImGui.Checkbox("Guardian answer##iltmrguardian", ref guardian)) st.ShowGuardian = guardian;
if (ImGui.IsItemHovered()) ImGui.SetTooltip("The last Temple guardian answer with a Give button (RynthILT).");
}
/// <summary>The tail of RynthAi's one-line session report: the coin / pyreal rates (RynthIltHub.TextSessionReport).</summary>
public string SessionReportTail()
{
var r = _hub.Rates.Summary;
return $", Coins {Compact(r.CoinsPerHour)}/h, Pyr {Compact(r.PyrealsPerHour)}/h";
}
// ── RynthAi's Mini Remote: the Remote tab's Bank section ────────────────
private void RenderRemoteBank()

View file

@ -23,11 +23,41 @@ using RynthCore.Plugin.Shared;
namespace RynthCore.Plugin.RynthILT.Hub;
/// <summary>The two Server Features fields of a RynthAi profile (the rest of the file is ignored).</summary>
/// <summary>
/// The fields of a RynthAi profile RynthILT reads (the rest of the file is ignored): the two Server
/// Features fields, and the settings that moved to RynthILT on 2026-10-20 (null when the profile
/// predates them: the default applies).
/// </summary>
public sealed class IltLegacyProfileFlags
{
public List<string>? FeatureServerNames;
public bool ForceServerFeatures;
/// <summary>RynthAi's Empyrean Handler ring evade (on by default there too).</summary>
public bool? HandlerRingEvade;
/// <summary>RynthAi's Vaulted Dungeons master switch (off by default).</summary>
public bool? EnableVaultedDungeons;
/// <summary>RynthAi's T11 item-aug override (-1 = automatic).</summary>
public int? T11ItemAugsOverride;
}
/// <summary>The Remote tab switches of RynthAi's huds.json that moved to RynthILT (2026-10-20).</summary>
public sealed class IltLegacyHuds
{
public bool? MiniShowBank;
public bool? MiniShowGuardian;
}
/// <summary>The Pets tab fields of RynthAi's miniremote.json that moved to RynthILT (2026-10-20).</summary>
public sealed class IltLegacyMiniRemote
{
public IltLegacyPetTab? Pet;
}
public sealed class IltLegacyPetTab
{
public bool? UsePyrealRefillPath;
public bool? AutoCaptureEnabled;
public int? CaptureLensIndex;
}
internal static class IltMigration
@ -67,6 +97,7 @@ internal static class IltMigration
|| File.Exists(Path.Combine(dir, "ilt-hub-transactions.json"))
|| Directory.Exists(Path.Combine(dir, "ilt-hub-profiles"))
|| File.Exists(Path.Combine(dir, "active_profile.txt"))
|| File.Exists(Path.Combine(dir, LegacyMiniRemoteFile))
|| File.Exists(Path.Combine(dir, "Default.json"))))
return dir;
return null;
@ -163,6 +194,70 @@ internal static class IltMigration
return done;
}
/// <summary>RynthAi's per-character Mini Remote file (the Pets tab's settings).</summary>
public const string LegacyMiniRemoteFile = "miniremote.json";
/// <summary>RynthAi's per-character HUD file (the Remote tab's section switches).</summary>
public const string LegacyHudsFile = "huds.json";
/// <summary>
/// Once per character (IltHubState.RynthAiSettingsImported): the RynthAi settings that moved to
/// RynthILT on 2026-10-20 are copied from the character's RynthAi files into <paramref name="state"/>:
/// from miniremote.json the Pets tab's ACECustom options (summon from empty with the refill
/// charm, siphon auto-capture and its lens); from the active profile (as ReadProfileFlags) the
/// Empyrean Handler ring evade, the Vaulted Dungeons master switch and the T11 item-aug override;
/// from huds.json the Remote tab's Bank / Guardian switches. The RynthAi files are only read (RynthAi keeps the
/// old fields readable and no longer uses them). A character with no RynthAi files keeps
/// RynthILT's defaults. Returns what was copied (for the log); empty when nothing was done.
/// </summary>
public static List<string> ImportRynthAiSettings(IltHubState state, string world, string charName)
{
var done = new List<string>();
if (state.RynthAiSettingsImported || string.IsNullOrWhiteSpace(charName)) return done;
string? legacy = FindLegacyCharFolder(world, charName);
if (legacy != null)
{
if (ReadJson(Path.Combine(legacy, LegacyMiniRemoteFile), IltHubJsonContext.Default.IltLegacyMiniRemote) is { Pet: { } pet })
{
if (pet.UsePyrealRefillPath is bool refill) { state.Pet.RefillFromEmpty = refill; done.Add($"summon from empty essences {(refill ? "on" : "off")}"); }
if (pet.AutoCaptureEnabled is bool capture) { state.Pet.AutoCapture = capture; done.Add($"auto-capture {(capture ? "on" : "off")}"); }
if (pet.CaptureLensIndex is int lens)
{
state.Pet.CaptureLens = Math.Clamp(lens, 0, PetCaptureRules.Lenses.Length - 1);
done.Add("capture lens " + PetCaptureRules.LensAt(state.Pet.CaptureLens).Name);
}
}
if (ReadJson(Path.Combine(legacy, LegacyHudsFile), IltHubJsonContext.Default.IltLegacyHuds) is { } huds)
{
if (huds.MiniShowBank is bool bank) { state.Remote.ShowBank = bank; if (!bank) done.Add("the Remote tab's Bank hidden"); }
if (huds.MiniShowGuardian is bool g) { state.Remote.ShowGuardian = g; if (!g) done.Add("the Remote tab's Guardian line hidden"); }
}
if (ReadProfileFlags(legacy, out IltLegacyProfileFlags flags))
{
if (flags.HandlerRingEvade is bool ring) { state.Combat.HandlerRingEvade = ring; done.Add($"Empyrean Handler ring evade {(ring ? "on" : "off")}"); }
if (flags.EnableVaultedDungeons is bool vaulted) { state.VaultedDungeonsEnabled = vaulted; done.Add($"Vaulted Dungeons master switch {(vaulted ? "on" : "off")}"); }
if (flags.T11ItemAugsOverride is int augs && augs >= 0) { state.T11.ItemAugsOverride = augs; done.Add($"T11 item augmentations fixed at {augs:N0}"); }
}
}
state.RynthAiSettingsImported = true;
if (done.Count == 0) done.Add(legacy == null ? "no RynthAi settings for this character (defaults kept)" : "nothing set in RynthAi (defaults kept)");
return done;
}
/// <summary>A JSON file read with <paramref name="info"/>, or null (missing or unreadable: logged).</summary>
private static T? ReadJson<T>(string path, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> info) where T : class
{
try
{
return File.Exists(path) ? JsonSerializer.Deserialize(File.ReadAllText(path), info) : null;
}
catch (Exception ex)
{
RynthLog.Exception(LogCat.IltStore, ex, $"migration: read {path}");
return null;
}
}
/// <summary>The character's active RynthAi profile's Server Features fields.</summary>
internal static bool ReadProfileFlags(string legacyCharFolder, out IltLegacyProfileFlags flags)
{

View file

@ -0,0 +1,394 @@
// IltPetAutomation.cs — ACECustom's parts of RynthAi's Pets tab: the pet charms, the "summon from an
// empty essence" refill path and siphon-lens auto-capture.
// Moved out of RynthAi's MiniRemote/PetsTab.cs 2026-10-20 (originally SilentKelpie's IltPets, ILT
// Hub): summoning is every server's, so the roster, healing and cosmetic pets stay RynthAi's, but
// these three are ACECustom content and live here now.
//
// * Pet charms (section "pets-charms"): Summon Essence Refill (the server refills an empty essence
// from banked pyreals) and Universal Summoning Mastery, read from the charm's appraisal text and
// the player bools the server stamps, plus the "no spell components" warning when the server
// requires them. The refill opt-in feeds RynthAi's PetManager through RynthILT.Hub
// AllowSummonOnEmpty (cached here every tick; an unknown state never spends pyreals).
// * Auto siphon capture (section "pets-capture", ACECustom MonsterCapture): when enabled, uses the
// chosen lens on the nearest attackable creature within 5 m once it is <=20% health or under
// 20 HP (Asheron's Lens skips the health gate). Resonance still needs a prior failed capture on
// the server. Bounded per creature and overall (PetCaptureThrottle).
// Ticks only on an ILT-like world (IltHubController); the sections draw nothing elsewhere.
using System;
using ImGuiNET;
using RynthCore.Plugin.Shared;
namespace RynthCore.Plugin.RynthILT.Hub;
internal sealed class IltPetAutomation : IIltFeature
{
private const long CaptureThinkMs = 250;
private const long CaptureCooldownMs = 2500;
private const long CaptureFailBackoffMs = 8000;
private const long CharmScanMs = 2000;
private const long GateMs = 500;
private readonly IltHubContext _ctx;
private readonly PetCaptureThrottle _captureThrottle = new();
private long _lastCaptureThink;
private long _captureCooldownUntil;
private long _lastCharmScan;
private long _lastGate;
// Read by the render thread and (AllowSummonOnEmpty) by RynthAi's pump.
private volatile string _captureStatus = "off";
private volatile bool _uiRefillActive;
private volatile bool _uiMasteryActive;
private volatile bool _uiHasCasting = true;
private volatile bool _allowSummonOnEmpty;
// The server's health updates (RynthPluginOnUpdateHealth), for creatures the client has no vitals for.
private const int MaxHealthEntries = 512;
private readonly object _healthGate = new();
private readonly System.Collections.Generic.Dictionary<int, float> _healthRatios = new();
public IltPetAutomation(IltHubContext ctx) => _ctx = ctx;
private IltPetState S => _ctx.State.Pet;
/// <summary>The auto-capture line under the switch (render thread).</summary>
public string CaptureStatus => _captureStatus;
/// <summary>
/// RynthILT.Hub AllowSummonOnEmpty: the last tick's answer, false off an ILT world. Any thread.
/// </summary>
public bool AllowSummonOnEmpty => _ctx.Options.IsIltLikeWorld && _allowSummonOnEmpty;
// ── Charms / gates ──────────────────────────────────────────────────────
/// <summary>Summon Essence Refill charm is carried and switched on (or the server stamped the player bool).</summary>
public bool RefillCharmActive()
{
var inv = _ctx.Inventory;
if (inv.PlayerBool(IltInventory.BoolPyrealRefillActive)) return true;
var charm = inv.FindByWcid(IltInventory.WcidSummonRefillCharm);
return charm != null && inv.CharmStatus(charm) == IltTri.On;
}
public bool MasteryCharmActive()
{
if (_ctx.Options.IsOff(IltFeature.UniversalMastery)) return false;
var inv = _ctx.Inventory;
if (inv.PlayerBool(IltInventory.BoolUniversalMasteryActive)) return true;
var charm = inv.FindByWcid(IltInventory.WcidUniversalMasteryCharm);
return charm != null && inv.CharmStatus(charm) == IltTri.On;
}
/// <summary>
/// Summon from an empty essence (spends banked pyreals) only when the player opted in, the refill
/// charm is active, and the server has positively confirmed the feature: either the feature check
/// reported pet_refill on, or the server stamped the player's refill bool. Pump thread.
/// </summary>
internal bool ComputeAllowSummonOnEmpty()
{
if (!S.RefillFromEmpty || !_ctx.Options.IsIltLikeWorld || !RefillCharmActive()) return false;
bool confirmed = _ctx.Options.IsOn(IltFeature.PetRefill)
|| _ctx.Inventory.PlayerBool(IltInventory.BoolPyrealRefillActive);
if (!confirmed) RynthLog.Trace(LogCat.IltPets, "summon-on-empty refused: pet_refill not confirmed by the server");
return confirmed;
}
// ── IIltFeature ─────────────────────────────────────────────────────────
public void Tick(long nowMs)
{
if (nowMs - _lastGate >= GateMs)
{
_lastGate = nowMs;
_allowSummonOnEmpty = ComputeAllowSummonOnEmpty();
}
if (nowMs - _lastCharmScan >= CharmScanMs)
{
_lastCharmScan = nowMs;
// Host reads (and appraisal requests) happen here, never on the render thread.
_uiRefillActive = RefillCharmActive();
_uiMasteryActive = MasteryCharmActive();
_uiHasCasting = _ctx.Inventory.HasCastingSupplies();
}
if (nowMs - _lastCaptureThink >= CaptureThinkMs)
{
_lastCaptureThink = nowMs;
TickCapture(nowMs);
}
}
/// <summary>ACECustom MonsterCapture replies: back off after a refuse so lenses aren't burned. Never eats.</summary>
public bool OnChat(string text)
{
if (!S.AutoCapture || string.IsNullOrEmpty(text)) return false;
long now = IltHubContext.NowMs;
if (PetCaptureLines.IsSuccess(text))
{
_captureStatus = "captured";
_captureThrottle.RecordSuccess();
_captureCooldownUntil = now + CaptureCooldownMs;
}
else if (ContainsAny(text,
"too strong",
"blind rage",
"cannot be siphoned",
"cannot be captured",
"No creatures nearby",
"already dead",
"already being captured",
"hasn't failed a capture",
"echo has faded",
"Failed to consume"))
{
_captureStatus = "refused: " + Truncate(text, 48);
_captureCooldownUntil = now + CaptureFailBackoffMs;
}
else if (ContainsAny(text, "siphon failed", "lens shatters", "resisted your capture", "resonance fades"))
{
_captureStatus = "failed (creature may enrage)";
_captureCooldownUntil = now + CaptureFailBackoffMs;
}
return false;
}
/// <summary>A creature's health ratio from the server (RynthPluginOnUpdateHealth; any thread).</summary>
public void NoteHealth(uint objectId, float ratio)
{
if (objectId == 0 || float.IsNaN(ratio)) return;
lock (_healthGate)
{
if (_healthRatios.Count >= MaxHealthEntries) _healthRatios.Clear();
_healthRatios[unchecked((int)objectId)] = Math.Clamp(ratio, 0f, 1f);
}
}
/// <summary>The last health ratio the server sent for a creature, -1 when none.</summary>
private float HealthRatio(int id)
{
lock (_healthGate) return _healthRatios.TryGetValue(id, out float v) ? v : -1f;
}
public void OnLogout()
{
lock (_healthGate) _healthRatios.Clear();
_captureCooldownUntil = 0;
_captureStatus = "off";
_captureThrottle.Reset();
_allowSummonOnEmpty = false;
}
private static bool ContainsAny(string text, params string[] parts)
{
foreach (string p in parts)
if (text.IndexOf(p, StringComparison.OrdinalIgnoreCase) >= 0) return true;
return false;
}
private static string Truncate(string s, int max) => s.Length <= max ? s : s[..(max - 3)] + "...";
// ── Auto siphon capture (ACECustom MonsterCapture) ───────────────────────
/// <summary>
/// When Auto Capture is on, use the chosen siphon lens on the nearest attackable creature within
/// 5 m once ACECustom's health gate is met (≤20% or under 20 HP; Asheron's skips it). The server
/// picks the nearest creature itself, so this fires only when that nearest candidate is already
/// weak enough: a full-health neighbour closer than the wounded target won't waste a lens.
/// </summary>
internal void TickCapture(long now)
{
if (!S.AutoCapture)
{
_captureStatus = "off";
return;
}
if (_ctx.Options.IsOff(RynthIltHub.FeatureMonsterCapture))
{
_captureStatus = "monster capture disabled on this server";
return;
}
if (now < _captureCooldownUntil)
{
long left = (_captureCooldownUntil - now + 999) / 1000;
if (!_captureStatus.StartsWith("waiting", StringComparison.Ordinal))
_captureStatus = $"waiting {left}s";
return;
}
var inv = _ctx.Inventory;
if (inv.IsBusy) { _captureStatus = "busy"; return; }
var lens = PetCaptureRules.LensAt(S.CaptureLens);
var lensItem = inv.FindByWcid(lens.Wcid);
if (lensItem == null)
{
_captureStatus = $"no {lens.Name} carried";
return;
}
if (!TryFindNearestCaptureTarget(out WorldObject? target, out double distM, out uint curHp, out uint maxHp))
{
_captureStatus = "no attackable creature within 5 m";
return;
}
if (!PetCaptureRules.InRange(distM))
{
_captureStatus = $"{target!.Name} at {distM:0.0} m (need <={PetCaptureRules.CaptureRangeM:0} m)";
return;
}
if (!PetCaptureRules.CanAttempt(lens, curHp, maxHp))
{
float pct = maxHp > 0 ? curHp * 100f / maxHp : -1f;
_captureStatus = pct >= 0
? $"{target!.Name} at {pct:0}% / {curHp} HP (need <={PetCaptureRules.CaptureMaxHealthFraction:P0} or <{PetCaptureRules.CaptureMaxHealthPoints} HP)"
: $"{target!.Name}: health unknown";
return;
}
if (!_captureThrottle.MayAttempt(target!.Id, now))
{
_captureStatus = $"{target.Name}: {PetCaptureThrottle.MaxTriesPerTarget} tries, no capture; left alone for {_captureThrottle.BlockedSecondsLeft(target.Id, now)}s";
return;
}
if (!inv.Use(lensItem))
{
_captureStatus = "UseObject refused";
return;
}
_captureThrottle.RecordAttempt(target.Id, now);
if (_captureThrottle.Exhausted)
{
// Backstop: this many lenses with no recognized capture means something is off. Stop, don't keep burning them.
S.AutoCapture = false;
RynthLog.Write(LogCat.IltPets,
$"auto-capture: {PetCaptureThrottle.MaxTriesWithoutSuccess} lens uses without a capture reply; auto-capture switched off");
}
float shown = maxHp > 0 ? curHp * 100f / maxHp : 0f;
_captureStatus = $"using {lens.Name} on {target.Name} ({shown:0}% / {curHp} HP)";
_captureCooldownUntil = now + CaptureCooldownMs;
RynthLog.Write(LogCat.IltPets,
$"auto-capture: {lens.Name} -> 0x{target.Id:X8} '{target.Name}' d={distM:0.0}m hp={curHp}/{maxHp}");
}
/// <summary>
/// Nearest attackable landscape creature within capture range, with vitals from the host when
/// available, else the server's last health ratio (fraction-only gate). A creature with neither
/// is skipped: no health, no capture decision.
/// </summary>
private bool TryFindNearestCaptureTarget(out WorldObject? best, out double bestDist, out uint curHp, out uint maxHp)
{
best = null;
bestDist = double.MaxValue;
curHp = maxHp = 0;
var host = _ctx.Host;
var objects = _ctx.Inventory.Cache;
uint playerId = _ctx.Inventory.PlayerId;
if (playerId == 0) return false;
int pid = unchecked((int)playerId);
string ownPrefix = _ctx.CharName.Length > 0 ? _ctx.CharName + "'s " : string.Empty;
foreach (var wo in objects.GetLandscape())
{
if (wo == null || wo.Id == pid) continue;
if (wo.ObjectClass != RynthCore.Loot.AcObjectClass.Monster) continue;
if (ownPrefix.Length > 0 && wo.Name.StartsWith(ownPrefix, StringComparison.Ordinal)) continue;
// Skip corpses / non-attackable when the host can tell.
if (host.HasObjectIsAttackable && !host.ObjectIsAttackable(unchecked((uint)wo.Id))) continue;
double d = objects.Distance(pid, wo.Id);
if (d < 0 || d > PetCaptureRules.CaptureRangeM || d >= bestDist) continue;
if (!TryReadCreatureVitals(wo.Id, out uint h, out uint mh)) continue;
if (h == 0) continue; // dead
best = wo;
bestDist = d;
curHp = h;
maxHp = mh;
}
return best != null;
}
/// <summary>
/// Absolute vitals via TryGetTargetVitals when bound; else the health ratio as a 0-1000 scale so
/// only the fraction half of ACECustom's gate can fire.
/// </summary>
private bool TryReadCreatureVitals(int id, out uint cur, out uint max)
{
cur = max = 0;
var host = _ctx.Host;
if (host.HasGetTargetVitals
&& host.TryGetTargetVitals(unchecked((uint)id), out uint h, out uint mh, out _, out _, out _, out _)
&& mh > 0)
{
cur = h;
max = mh;
return true;
}
float ratio = HealthRatio(id);
if (ratio < 0f) return false;
// Synthetic scale: ratio 0.20 -> 200/1000 so IsWeakEnough's fraction half matches.
max = 1000;
cur = (uint)Math.Clamp((int)Math.Round(ratio * 1000f), 1, 1000);
return true;
}
// ── UI (render thread): the Pets tab's ACECustom sections ────────────────
/// <summary>The pet charms and the refill opt-in (section "pets-charms").</summary>
public void RenderCharms()
{
ImGui.Separator();
SafeImGui.TextColored(IltStyle.ColTeal, "Pet charms");
var o = _ctx.Options;
bool refillOff = o.IsOff(IltFeature.PetRefill);
ImGui.TextUnformatted("Summon Essence Refill: " + (refillOff ? "disabled on this server" : _uiRefillActive ? "ON" : "off / not carried"));
ImGui.BeginDisabled(refillOff);
bool usePath = S.RefillFromEmpty;
if (ImGui.Checkbox("Summon from empty essences while the refill charm is ON (spends banked pyreals)", ref usePath))
S.RefillFromEmpty = usePath;
ImGui.EndDisabled();
ImGui.TextUnformatted("Universal Summoning Mastery: "
+ (o.IsOff(IltFeature.UniversalMastery) ? "disabled on this server" : _uiMasteryActive ? "ON" : "off / not carried"));
if (!o.IsOff(IltFeature.RequireComps) && !_uiHasCasting)
SafeImGui.TextColored(IltStyle.ColAmber, "No spell components or Infinite Casting Stone carried.");
}
/// <summary>Siphon-lens auto-capture: enable + which lens to use (section "pets-capture").</summary>
public void RenderCapture()
{
ImGui.Separator();
SafeImGui.TextColored(IltStyle.ColTeal, "Monster capture");
bool captureOff = _ctx.Options.IsOff(RynthIltHub.FeatureMonsterCapture);
ImGui.BeginDisabled(captureOff);
bool en = S.AutoCapture;
if (ImGui.Checkbox("Auto-capture when a creature is weak enough", ref en))
{
S.AutoCapture = en;
_ctx.Post(_captureThrottle.Reset);
}
if (ImGui.IsItemHovered())
{
SafeImGui.SetTooltip(
"Uses the selected siphon lens on the nearest attackable creature within 5 m once it is\n" +
"at or below 20% health or under 20 HP (ACECustom MonsterCapture). Asheron's Lens skips\n" +
"the health gate. Resonance Lens still needs a prior failed capture on the server.\n" +
"Off by default. Stops on its own after 5 tries on one creature (it is left alone for 2 min)\n" +
"or 15 lens uses in a row with no capture.");
}
ImGui.SameLine();
ImGui.SetNextItemWidth(120);
int lens = Math.Clamp(S.CaptureLens, 0, PetCaptureRules.LensNames.Length - 1);
if (ImGui.Combo("##petcapturelens", ref lens, PetCaptureRules.LensNames, PetCaptureRules.LensNames.Length))
S.CaptureLens = lens;
if (ImGui.IsItemHovered())
SafeImGui.SetTooltip("Which siphon lens to use. Must be carried in your pack.");
ImGui.EndDisabled();
if (captureOff)
SafeImGui.TextDisabled("Monster capture is disabled on this server.");
else
SafeImGui.TextDisabled("Status: " + _captureStatus);
}
}

View file

@ -0,0 +1,166 @@
// IltPetCaptureRules.cs — ACECustom MonsterCapture thresholds for siphon lenses (pure; no host).
// Moved from RynthAi's Pets tab (MiniRemote/PetCaptureRules.cs) 2026-10-20 with the auto-capture
// itself (IltPetAutomation): monster capture is ACECustom's, so it is RynthILT's.
//
// Copied from ACECustom Source/ACE.Server/Entity/MonsterCapture.cs so the client can tell when
// a creature is weak enough to siphon before using a lens. Keep these numbers in lockstep with
// the server: CaptureMaxHealthFraction / CaptureMaxHealthPoints / CaptureRangeM and the lens
// WCID table in PetGuideController.
using System;
using System.Collections.Generic;
namespace RynthCore.Plugin.RynthILT.Hub;
/// <summary>One siphon lens the Pets tab can auto-use (name, WCID, whether health is gated).</summary>
internal readonly struct PetCaptureLens
{
public PetCaptureLens(string name, uint wcid, bool bypassesHealthGate)
{
Name = name;
Wcid = wcid;
BypassesHealthGate = bypassesHealthGate;
}
public string Name { get; }
public uint Wcid { get; }
/// <summary>Asheron's (and Debug) lenses skip the 20% / 20 HP gate.</summary>
public bool BypassesHealthGate { get; }
}
/// <summary>
/// When a siphon lens can be used, matching ACECustom MonsterCapture.UseCaptureCrystal.
/// A creature is weak enough when its health fraction is ≤ 20% OR its current HP is under 20
/// (whichever comes first). Asheron's Lens skips that check.
/// </summary>
internal static class PetCaptureRules
{
/// <summary>A lens targets the nearest attackable creature within this many meters.</summary>
public const float CaptureRangeM = 5.0f;
/// <summary>Siphon once at or below this fraction of max health…</summary>
public const float CaptureMaxHealthFraction = 0.20f;
/// <summary>…or below this many hit points (the gate is OR with the fraction).</summary>
public const int CaptureMaxHealthPoints = 20;
/// <summary>
/// Lenses the player can pick for auto-capture. Order is the combo index.
/// Resonance needs a prior failed capture (server-side); Asheron's bypasses the health gate.
/// </summary>
public static readonly PetCaptureLens[] Lenses =
{
new("Flawed Siphon Lens", 78780001, bypassesHealthGate: false),
new("Pristine Siphon Lens", 78780002, bypassesHealthGate: false),
new("Perfect Siphon Lens", 78780003, bypassesHealthGate: false),
new("Resonance Lens", 78780010, bypassesHealthGate: false),
new("Asheron's Lens", 78780012, bypassesHealthGate: true),
};
/// <summary>Combo labels for the Pets tab (same order as <see cref="Lenses"/>).</summary>
public static readonly string[] LensNames =
{
"Flawed", "Pristine", "Perfect", "Resonance", "Asheron's",
};
public static PetCaptureLens LensAt(int index)
{
int i = Math.Clamp(index, 0, Lenses.Length - 1);
return Lenses[i];
}
/// <summary>
/// True when ACECustom would accept a siphon on this creature for a normal (non-bypass) lens.
/// Pass current/max when known; when only a 0–1 ratio is known, pass ratio as current and 1 as max
/// (then only the fraction half of the gate can fire).
/// </summary>
public static bool IsWeakEnough(uint currentHp, uint maxHp)
{
if (currentHp == 0) return false; // dead — server refuses
if (maxHp == 0) return false;
float pct = (float)currentHp / maxHp;
// Server: refuse when pct > 0.20 AND current >= 20. Allowed otherwise.
return pct <= CaptureMaxHealthFraction || currentHp < CaptureMaxHealthPoints;
}
/// <summary>Same gate from a 0–1 health ratio only (no absolute HP). Dead / unknown = false.</summary>
public static bool IsWeakEnoughRatio(float healthRatio)
{
if (healthRatio <= 0f || healthRatio > 1f) return false;
return healthRatio <= CaptureMaxHealthFraction;
}
/// <summary>True when this lens may be used given the creature's vitals (bypass lenses always, if alive).</summary>
public static bool CanAttempt(PetCaptureLens lens, uint currentHp, uint maxHp)
{
if (currentHp == 0) return false;
if (lens.BypassesHealthGate) return maxHp == 0 || currentHp > 0;
return IsWeakEnough(currentHp, maxHp);
}
/// <summary>Distance gate: ACECustom CaptureRangeM.</summary>
public static bool InRange(double distanceM) => distanceM >= 0 && distanceM <= CaptureRangeM;
}
/// <summary>
/// A brake on the auto-capture loop. Auto-capture fires a lens every couple of seconds and only stops
/// on reply strings it guesses at, so an unrecognized reply (or a creature the server never lets go of)
/// would burn lenses without end. This caps consecutive tries per target and, as a backstop, consecutive
/// tries over all targets; both reset on a recognized success. Pure: the tests drive it.
/// </summary>
internal sealed class PetCaptureThrottle
{
/// <summary>Lens uses on one creature, with no success in between, before it is left alone.</summary>
public const int MaxTriesPerTarget = 5;
/// <summary>How long a creature that used up its tries is left alone (ms).</summary>
public const long TargetBlockMs = 120_000;
/// <summary>Lens uses over all creatures with no success before auto-capture switches itself off.</summary>
public const int MaxTriesWithoutSuccess = 15;
private readonly Dictionary<int, int> _tries = new();
private readonly Dictionary<int, long> _blockedUntil = new();
private int _sinceSuccess;
/// <summary>Consecutive lens uses with no recognized success (all targets).</summary>
public int TriesWithoutSuccess => _sinceSuccess;
/// <summary>True when the backstop was hit: the caller should switch auto-capture off.</summary>
public bool Exhausted => _sinceSuccess >= MaxTriesWithoutSuccess;
/// <summary>False while this target is blocked (it used its tries) or the backstop is hit.</summary>
public bool MayAttempt(int targetId, long nowMs)
{
if (Exhausted) return false;
if (_blockedUntil.TryGetValue(targetId, out long until))
{
if (nowMs < until) return false;
_blockedUntil.Remove(targetId); // block served: a fresh set of tries
_tries.Remove(targetId);
}
return true;
}
/// <summary>Seconds left on this target's block, 0 when it is not blocked.</summary>
public long BlockedSecondsLeft(int targetId, long nowMs)
=> _blockedUntil.TryGetValue(targetId, out long until) && nowMs < until ? (until - nowMs + 999) / 1000 : 0;
/// <summary>Count a lens use on this target; blocks it once it reaches <see cref="MaxTriesPerTarget"/>.</summary>
public void RecordAttempt(int targetId, long nowMs)
{
_sinceSuccess++;
int n = _tries.TryGetValue(targetId, out int t) ? t + 1 : 1;
_tries[targetId] = n;
if (n >= MaxTriesPerTarget) _blockedUntil[targetId] = nowMs + TargetBlockMs;
}
/// <summary>A recognized success reply: everything starts over.</summary>
public void RecordSuccess() => Reset();
public void Reset()
{
_tries.Clear();
_blockedUntil.Clear();
_sinceSuccess = 0;
}
}

View file

@ -2,8 +2,9 @@
// (RynthILT.Hub section "pets-logs").
// Originally the roster-capture part of SilentKelpie's IltPets (ILT Hub, RynthAi); split out and
// moved to RynthILT 2026-10-13. The Pets tab itself (essence roster, combat / healing / cosmetic
// pets, the refill charm path) stayed in RynthAi (MiniRemote/PetsTab.cs): summoning is every
// server's, these two commands are ACECustom's.
// pets) stayed in RynthAi (MiniRemote/PetsTab.cs): summoning is every server's, these two commands
// are ACECustom's (as are the pet charms, the refill path and siphon capture: IltPetAutomation,
// moved 2026-10-20).
using System;
using System.Collections.Generic;
using ImGuiNET;

View file

@ -125,6 +125,12 @@ internal sealed class IltQuestBonus : IIltFeature
/// <summary>Increments each time a "/qb list" reply is parsed (0 = not loaded this session).</summary>
public int QbGeneration => _qbGeneration;
/// <summary>
/// Snapshot for the "RynthILT.Server" profile JSON (Oracle Quests / Fellowship). Pump thread.
/// </summary>
public IltQuestBonusInfo Snapshot() =>
new(_ctx.Options.IsOff(IltFeature.Qb), _qbGeneration, _qbCount, _qbStatus, _qbCompleted, _qbIncomplete);
/// <summary>True when the last "/qb list" (completed or incomplete) contains the flag.</summary>
public bool QbHasFlag(string flag)
{

View file

@ -0,0 +1,121 @@
// IltRingEvade.cs — Infinite Leaftide's Empyrean Handler lethal ring: hear it, and have RynthAi jump clear.
// Moved out of RynthAi's CombatManager 2026-10-20 (Silentkelpie's PR 12): the Handler is ACECustom
// content, so the detection and its setting are RynthILT's; RynthAi keeps the generic back-away it
// does on request (RynthAi.Hub BackAwayFrom: face the danger, run-back jump, hold attacks until the
// jump settles, re-engage the same target; only while its macro runs with combat on).
//
// ACECustom's Handler emote: "The handler briefly channels infused Empyrean hatred to release a lethal
// ring." The ring can't be melee-evaded; inside its cast radius the character dies. On that line, when
// an Empyrean Handler is near, ask RynthAi to back away from the nearest one (12 yards, or Ring Range
// when RynthAi's is larger). One request per HandlerRingCooldownMs.
// Setting: IltHubState.Combat.HandlerRingEvade (on by default; the ILT settings view, "/ilt settings").
using System;
using RynthCore.Loot;
using RynthCore.Plugin.Shared;
namespace RynthCore.Plugin.RynthILT.Hub;
internal sealed class IltRingEvade : IIltFeature
{
internal const string ChannelHint = "channels infused Empyrean hatred to release a lethal ring";
internal const string ChannelStart = "The handler briefly channels";
internal const string HandlerName = "Empyrean Handler";
/// <summary>Yards: the Handler's lethal ring is treated as at least this wide (RynthAi widens it to Ring Range).</summary>
internal const float DangerYards = 12f;
/// <summary>Back-jump charge (ms): run-back + jump must clear about the ring's radius.</summary>
internal const int JumpHoldMs = 750;
internal const long CooldownMs = 4_000;
private readonly IltHubContext _ctx;
private long _lastRequestAt = long.MinValue;
public IltRingEvade(IltHubContext ctx) => _ctx = ctx;
/// <summary>What the last ring line did (for the log and the tests).</summary>
public string LastOutcome { get; private set; } = string.Empty;
/// <summary>
/// True when <paramref name="text"/> is the Handler's channel line (not a player repeating it).
/// The channel is an Emote (0x0C), which counts as player speech elsewhere, so it is anchored on
/// the phrase that starts the line; mid-line only for a chat type that can't be player speech.
/// </summary>
internal static bool IsChannelLine(string? text, int chatType)
{
if (string.IsNullOrEmpty(text)) return false;
bool anchored =
ChatSource.StartsWithMarker(text, ChannelStart, StringComparison.OrdinalIgnoreCase)
|| (ChatSource.StartsWithMarker(text, "The handler", StringComparison.OrdinalIgnoreCase)
&& text.IndexOf(ChannelHint, StringComparison.OrdinalIgnoreCase) >= 0);
if (anchored) return true;
// Mid-line only when the type is clearly not player speech (some clients strip "The ").
if (chatType is ChatSource.Speech or ChatSource.Tell or ChatSource.OutgoingTell or ChatSource.Channel
or ChatSource.ChannelSend or ChatSource.Allegiance or ChatSource.Fellowship)
return false;
if (text.IndexOf(ChannelHint, StringComparison.OrdinalIgnoreCase) < 0) return false;
return text.IndexOf(" says,", StringComparison.OrdinalIgnoreCase) < 0
&& text.IndexOf(" tells you,", StringComparison.OrdinalIgnoreCase) < 0;
}
/// <summary>
/// A chat line with its type (pump thread; IltHubController.OnChat, ILT only). On the Handler's
/// channel line asks RynthAi to back away from the nearest Handler. Never eats the line.
/// </summary>
public void OnChatLine(string text, int chatType)
{
if (!_ctx.State.Combat.HandlerRingEvade || !IsChannelLine(text, chatType)) return;
long now = IltHubContext.NowMs;
if (_lastRequestAt != long.MinValue && now - _lastRequestAt < CooldownMs) return;
if (!TryFindNearestHandler(out int handlerId, out double dist))
{
Outcome("Handler lethal-ring channel heard, but no Empyrean Handler is nearby: no jump.");
return;
}
_lastRequestAt = now;
int r = _ctx.Ai.BackAwayFrom(unchecked((uint)handlerId), DangerYards, JumpHoldMs);
Outcome(r switch
{
RynthAiHub.BackAwayStarted => $"Empyrean Handler lethal ring: RynthAi backs away from it ({dist:0.0} m).",
RynthAiHub.BackAwayOutside => $"Empyrean Handler lethal ring: the Handler is {dist:0.0} m away, outside the ring; staying put.",
RynthAiHub.BackAwayUnknownObject => "Empyrean Handler lethal ring: RynthAi has no position for the Handler; no jump.",
RynthAiHub.BackAwayJumpRefused => "Empyrean Handler lethal ring: in range, but RynthAi's back-jump did not start.",
int.MinValue => "Empyrean Handler lethal ring: " + RynthAiClient.NotLoaded + " (the back-away is RynthAi's).",
_ => "Empyrean Handler lethal ring: RynthAi isn't fighting (macro or combat off), so it doesn't take the keyboard.",
});
}
private void Outcome(string text)
{
LastOutcome = text;
RynthLog.Write(LogCat.IltHub, "[RingEvade] " + text);
}
/// <summary>The nearest Empyrean Handler the client knows (a creature with that in its name).</summary>
private bool TryFindNearestHandler(out int id, out double dist)
{
id = 0;
dist = double.MaxValue;
var objects = _ctx.Inventory.Cache;
int me = unchecked((int)_ctx.Inventory.PlayerId);
if (me == 0) return false;
foreach (var wo in objects.GetLandscape())
{
if (wo == null || wo.ObjectClass != AcObjectClass.Monster) continue;
if (wo.Name.IndexOf(HandlerName, StringComparison.OrdinalIgnoreCase) < 0) continue;
double d = objects.Distance(me, wo.Id);
if (d >= dist) continue;
dist = d;
id = wo.Id;
}
return id != 0;
}
// ── IIltFeature ─────────────────────────────────────────────────────────
public void Tick(long nowMs) { }
/// <summary>Unused: the controller passes the chat type (OnChatLine).</summary>
public bool OnChat(string text) => false;
public void OnLogout() => _lastRequestAt = long.MinValue;
}

View file

@ -15,6 +15,15 @@ namespace RynthCore.Plugin.RynthILT.Hub;
internal static class IltSalvage
{
/// <summary>
/// Leaftide trinkets (compass, goggles, scarab, watch, puzzle box, tops): jewelry that takes the
/// Trinkets bench's recipes (UB-IT's IsLeaftideTrinketJewelry; RynthAi's TinkerCatalog.IsTrinket until
/// 2026-10-20). Sent in the profile's "trinkets" (RynthServer.Profile).
/// </summary>
internal static readonly string[] TrinketNames = { "compass", "goggles", "scarab", "watch", "puzzle box", "top" };
/// <summary>"top" but not "topaz".</summary>
internal static readonly string[] TrinketExcept = { "topaz" };
// MaterialType (131) ids.
private const int Wool = 8, BlackGarnet = 15, Diamond = 20, GreenJade = 24, Ruby = 38, TigerEye = 42, Tourmaline = 43,
Turquoise = 44, WhiteQuartz = 46, YellowGarnet = 48, Leather = 52, GromnieHide = 54, Copper = 59, Pyreal = 62,

View file

@ -31,7 +31,7 @@ internal enum IltSection
Games,
/// <summary>
/// Vaulted Dungeons keeper (portal-recall gem + kill-client). A Mini Remote tab on ILT worlds only,
/// and only while RynthAi's "Vaulted Dungeons" master switch (Settings > Navigation) is on.
/// and only while its "Vaulted Dungeons" master switch (/ilt settings, Settings > Navigation) is on.
/// </summary>
VaultedDungeons,
/// <summary>Registry charms (acquired / status / tier / server) and the Guardian Hand.</summary>

View file

@ -105,6 +105,7 @@ internal sealed class IltSessionRates : IIltFeature
public void Tick(long nowMs)
{
FollowSharedSession();
// The shared stats move every 0.5 s; their rows refresh each second, coins every 5 s.
if (nowMs - _lastSampleAt < SampleIntervalMs)
{
@ -138,6 +139,23 @@ internal sealed class IltSessionRates : IIltFeature
BuildRows();
}
private long _sharedStartTicks; // RynthAi's session start as last seen (0 = not yet)
/// <summary>
/// The coins / pyreals start over with RynthAi's shared session (its Reset XP, or a session that
/// restarted): one clock for both, without RynthAi telling RynthILT. Pump thread.
/// </summary>
private void FollowSharedSession()
{
if (!_ctx.Ai.TryGetSessionStats(out SessionStatsV1 s) || s.StartUtcTicks == 0) return;
if (_sharedStartTicks != 0 && s.StartUtcTicks > _sharedStartTicks)
{
RynthLog.Trace(LogCat.IltRates, "RynthAi's session restarted: coins and pyreals start over too");
Reset();
}
_sharedStartTicks = s.StartUtcTicks;
}
/// <summary>Positive change since the last sample; the first sample only sets the baseline.</summary>
private static long Gain(ref long last, long current)
{

View file

@ -86,6 +86,8 @@ internal static class IltSettingsStore
[JsonSerializable(typeof(List<IltBankTransaction>), TypeInfoPropertyName = "IltBankTransactionList")]
[JsonSerializable(typeof(IltAugCostFile))]
[JsonSerializable(typeof(IltLegacyProfileFlags))]
[JsonSerializable(typeof(IltLegacyMiniRemote))]
[JsonSerializable(typeof(IltLegacyHuds))]
[JsonSourceGenerationOptions(
WriteIndented = true,
IncludeFields = true,

View file

@ -0,0 +1,213 @@
// IltT11.cs — ACECustom T11 (tier 11+ gear): the player's wield counters for RynthAi's loot rules, and
// "/ilt t11" (also "/ra t11", which RynthAi passes on).
// Moved out of RynthAi 2026-10-20 (RynthAiT11Command.cs and its "/aug" chat feed): the counters and the
// command are ACECustom's, so RynthILT reads them; RynthAi keeps the loot keys and the evaluator
// (Loot/T11ItemSupport.cs, users' .utl profiles use them) and gets the counters through RynthAi.Hub
// SetPlayerCounter.
//
// * Counters: ACECustom doesn't send them at login ([SendOnLogin] is off), so they come from the
// "/aug" reply (RynthILT's login probe asks for it on ILT), read by the shared T11AugReportParser.
// The item-aug override (IltHubState.T11.ItemAugsOverride, "/ilt t11 augs <n|auto>") replaces the
// /aug Item count. Each change is reported to RynthAi, and every ResendMs anyway (RynthAi may have
// reloaded or logged in later); -1 = unknown.
// * "/ilt t11 [status | augs <n|auto> | refresh | item [0xId]]": the counters, the override, a fresh
// "/aug", and how the selected item's T11 text reads (tier, grade, modifiers, the loot keys' values).
// Ticks only on an ILT-like world (IltHubController): elsewhere RynthAi's counters stay unknown.
using System;
using System.Globalization;
using System.Linq;
using RynthCore.Loot.T11;
namespace RynthCore.Plugin.RynthILT.Hub;
internal sealed class IltT11 : IIltFeature
{
private const long ResendMs = 5_000;
// ACE string properties of an item's appraisal (RynthAi's StringValueKey).
private const uint StrName = 1, StrUse = 14, StrLongDesc = 16;
private readonly IltHubContext _ctx;
private readonly T11AugReportParser _parser = new();
private long _sentAt = long.MinValue;
private bool _dirty = true;
private int _overrideApplied = int.MinValue;
public IltT11(IltHubContext ctx) => _ctx = ctx;
/// <summary>The counters this character's "/aug" reply gave, with the override applied.</summary>
public T11PlayerAugs Player { get; } = new();
/// <summary>How many counters the last report to RynthAi carried (for the tests).</summary>
public int LastReported { get; private set; }
private IltT11State S => _ctx.State.T11;
// ── IIltFeature ─────────────────────────────────────────────────────────
public void Tick(long nowMs)
{
int ov = S.ItemAugsOverride;
if (ov != _overrideApplied)
{
_overrideApplied = ov;
Player.ItemAugOverride = ov >= 0 ? ov : null;
_dirty = true;
}
if (!_dirty && _sentAt != long.MinValue && nowMs - _sentAt < ResendMs) return;
Report();
_sentAt = nowMs;
_dirty = false;
}
/// <summary>The "/aug" reply's counter lines. Never eats (the login probe's capture decides that).</summary>
public bool OnChat(string text)
{
if (_parser.Feed(text, IltHubContext.NowMs, Player)) _dirty = true;
return false;
}
public void OnLogout()
{
Player.Clear();
_dirty = true;
_sentAt = long.MinValue;
}
/// <summary>Every counter to RynthAi (-1 for an unknown one). Pump thread.</summary>
private void Report()
{
int n = 0;
foreach ((T11Counter counter, _) in T11Catalog.CounterNames)
{
long? v = Player.Get(counter);
if (_ctx.Ai.SetPlayerCounter(unchecked((uint)counter), v ?? -1)) n++;
}
LastReported = n;
}
// ── "/ilt t11 ..." ──────────────────────────────────────────────────────
/// <summary>"/ilt t11 [status | augs &lt;n|auto&gt; | refresh | item [0xId]]" (args after "t11"). Pump thread.</summary>
public void HandleCommand(string[] args)
{
string sub = args.Length >= 1 ? args[0].ToLowerInvariant() : string.Empty;
switch (sub)
{
case "":
case "status":
PrintStatus();
break;
case "augs":
SetOverride(args.Length >= 2 ? args[1] : string.Empty);
break;
case "refresh":
if (!_ctx.Host.HasInvokeChatParser) { _ctx.Chat("[RynthILT] This engine can't send chat commands."); break; }
_ctx.Host.InvokeChatParser("/aug");
_ctx.Chat("[RynthILT] T11: sent /aug - the counters update from its reply.");
break;
case "item":
PrintItem(args.Length >= 2 ? args[1] : null);
break;
default:
_ctx.Chat("[RynthILT] Usage: /ilt t11 [augs <n|auto> | refresh | item [0xId]] (also /ra t11)");
break;
}
}
/// <summary>The counters the "T11: Can Wield" loot key compares wield gates against.</summary>
private void PrintStatus()
{
string updated = Player.UpdatedUtc is DateTime t ? t.ToLocalTime().ToString("t", CultureInfo.CurrentCulture) : "never";
_ctx.Chat($"[RynthILT] === T11 loot (last /aug read: {updated}) ===");
foreach ((T11Counter counter, string name) in T11Catalog.CounterNames)
{
long? v = Player.Get(counter);
string source = counter == T11Counter.ItemAugmentations && S.ItemAugsOverride >= 0 ? " (override)" : string.Empty;
_ctx.Chat($"[RynthILT] {name}: {(v.HasValue ? v.Value.ToString("N0", CultureInfo.CurrentCulture) : "unknown")}{source}");
}
if (Player.UpdatedUtc == null && S.ItemAugsOverride < 0)
_ctx.Chat("[RynthILT] Unknown counters make \"T11: Can Wield\" -1. Use /ilt t11 refresh, or /ilt t11 augs <n>.");
if (!_ctx.Ai.Available)
_ctx.Chat("[RynthILT] (The loot rules are RynthAi's; it isn't loaded, so nothing uses these yet.)");
}
/// <summary>"/ilt t11 augs &lt;n|auto&gt;": the item-aug override (-1 = read from /aug), saved with the Hub's state.</summary>
private void SetOverride(string arg)
{
int value;
if (arg.Equals("auto", StringComparison.OrdinalIgnoreCase) || arg == "-1")
value = -1;
else if (!int.TryParse(arg.Replace(",", string.Empty), NumberStyles.Integer, CultureInfo.InvariantCulture, out value) || value < 0)
{
_ctx.Chat("[RynthILT] Usage: /ilt t11 augs <n|auto> (n = your item augmentation count)");
return;
}
S.ItemAugsOverride = value;
Tick(IltHubContext.NowMs); // applied and reported now
_ctx.Chat(value < 0
? "[RynthILT] T11: item augmentations now come from /aug."
: $"[RynthILT] T11: item augmentations fixed at {value:N0} for loot rules.");
}
/// <summary>"/ilt t11 item [0xId]": the parsed T11 text of an item (the selected item by default).</summary>
private void PrintItem(string? idArg)
{
var host = _ctx.Host;
uint id = 0;
if (!string.IsNullOrEmpty(idArg))
uint.TryParse(idArg.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? idArg[2..] : idArg,
NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id);
if (id == 0 && host.HasGetSelectedItemId) id = host.GetSelectedItemId();
if (id == 0) { _ctx.Chat("[RynthILT] T11: select an item first (or pass 0xId)."); return; }
int iid = unchecked((int)id);
var inv = _ctx.Inventory;
WorldObject? item = inv.Cache[iid];
string name = item?.Name ?? string.Empty;
if (item == null) { _ctx.Chat($"[RynthILT] T11: the client doesn't know 0x{id:X8}."); return; }
if (name.Length == 0) name = inv.Str(item, StrName);
var server = new T11ServerProps(inv.Int(item, (uint)T11Catalog.PropZcTier, 0),
inv.Int(item, (uint)T11Catalog.PropWeaponAugScaleTier, 0),
inv.Int(item, (uint)T11Catalog.PropWeaponAugScaleQuality, -1));
T11ItemInfo info = T11ItemInfo.Parse(name, inv.Str(item, StrLongDesc), inv.Str(item, StrUse), server);
if (!info.IsT11)
{
bool appraised = !host.HasHasAppraisalData || host.HasAppraisalData(id);
_ctx.Chat(appraised
? $"[RynthILT] T11: {name} is not a T11 item."
: $"[RynthILT] T11: {name} isn't appraised yet - ID it and try again.");
return;
}
_ctx.Chat($"[RynthILT] === T11: {name} (0x{id:X8}) ===");
_ctx.Chat($"[RynthILT] Tier {(info.TierIsExact ? info.Tier.ToString(CultureInfo.InvariantCulture) : "~" + info.Tier.ToString(CultureInfo.InvariantCulture))}"
+ (info.Grade != null ? $", grade {info.Grade} ({info.DamagePercent}% of max damage)" : string.Empty)
+ (info.WeaponQuality >= 0 ? $", quality {info.WeaponQuality}/1000" : string.Empty)
+ (info.GearGrade != null ? $", gear grade {info.GearGrade} ({info.GearGradeLines} lines)" : string.Empty)
+ (info.ZoneLocked ? ", zone locked" : string.Empty));
if (info.PropertySlots >= 0 || info.Tainted)
_ctx.Chat("[RynthILT] Properties "
+ (info.PropertySlots < 0 ? "?" : info.PropertySlotCap > 0 ? $"{info.PropertySlots} of {info.PropertySlotCap}" : info.PropertySlots.ToString(CultureInfo.InvariantCulture))
+ (info.Tainted ? ", tainted (bags no longer work)" : string.Empty));
foreach (T11WieldGate g in info.WieldGates)
_ctx.Chat($"[RynthILT] Wield requires {g.Amount:N0} {T11Catalog.CounterName(g.Counter)}");
foreach (T11Modifier m in info.Modifiers)
{
string band = m.Min.HasValue && m.Max.HasValue ? $" [{m.Min}-{m.Max}] roll {m.RollPercent}%" : string.Empty;
string marks = (m.Tinkered != 0 ? $" ({m.Tinkered:+#;-#} tinkered)" : string.Empty)
+ (m.BuiltIn ? " (built-in)" : string.Empty) + (m.Locked ? " (locked)" : string.Empty);
_ctx.Chat($"[RynthILT] Mod {m.Name} {(m.IsSlotSpecial ? "(special)" : "+" + m.Value)}{band}{marks}");
}
foreach ((string proc, double chance) in info.Procs)
_ctx.Chat($"[RynthILT] Cast on strike: {proc} ({chance.ToString("0.#", CultureInfo.CurrentCulture)}%)");
int canWield = T11Keys.TryGetValue(info, T11Keys.CanWield, Player, out int cw) ? cw : -1;
_ctx.Chat($"[RynthILT] Can wield: {(canWield == 1 ? "yes" : canWield == 0 ? "no" : "unknown (no /aug read, or not appraised)")}"
+ $", modifier ratings {info.ModifierRatingTotal}, average roll {info.AverageRollPercent}%");
string keys = string.Join(", ", T11Keys.Names()
.Where(k => k.Id < T11Keys.ModifierBase)
.Select(k => $"{k.Name.Replace("T11: ", string.Empty)}={(T11Keys.TryGetValue(info, k.Id, Player, out int v) ? v : 0)}"));
_ctx.Chat($"[RynthILT] Loot keys (RynthAi's loot rules read the same): {keys}");
}
}

View file

@ -7,8 +7,9 @@
// * ILT only. The module does nothing (no tick work, no recall, no quit, no tab) unless
// IltServerOptions.IsIltLikeWorld says this is an Infinite Leaftide / ACECustom world, the same
// verdict every other ILT feature follows. A command answers "not available on this server".
// * Master switch, off by default: RynthAi's "Vaulted Dungeons" setting (Settings > Navigation),
// read through RynthAi.Hub VaultedDungeonsEnabled. It is the only copy. While it is off the module
// * Master switch, off by default: IltHubState.VaultedDungeonsEnabled (the ILT settings, and the
// engine's Settings > Navigation row RynthAi mirrors; RynthAi's profile setting until 2026-10-20,
// copied once). It is the only copy. While it is off the module
// ignores AutoStart, never ticks, sends no recall and no /rc quit, and the tab is hidden. Turning
// it off while running stops the keeper at once and says so once.
// * Active is never resumed from the saved settings. It starts when the player turns it on, or on
@ -122,7 +123,7 @@ internal sealed class IltVaultedDungeons : IIltFeature
public IltVaultedDungeons(IltHubContext ctx)
{
_ctx = ctx;
MasterEnabled = () => _ctx.Ai.VaultedDungeonsEnabled;
MasterEnabled = () => _ctx.State.VaultedDungeonsEnabled;
Activity = () => _ctx.Ai.Activity();
UseGem = gemName =>
{
@ -152,7 +153,7 @@ internal sealed class IltVaultedDungeons : IIltFeature
private static string? GateReply(string gate) => gate switch
{
GateWorld => "Not available on this server (Infinite Leaftide / ACECustom only).",
GateMaster => "Off: turn on \"Vaulted Dungeons\" in Settings > Navigation first (the master switch, off by default).",
GateMaster => "Off: turn on \"Vaulted Dungeons\" in the ILT settings (/ilt settings; also Settings > Navigation) first (the master switch, off by default).",
_ => null,
};
@ -431,7 +432,7 @@ internal sealed class IltVaultedDungeons : IIltFeature
_state = "paused";
_ctx.Chat("[Vaulted Dungeons] Stopped: " + (gate == GateWorld
? "this is not an Infinite Leaftide / ACECustom world."
: "\"Vaulted Dungeons\" was turned off in Settings > Navigation."));
: "\"Vaulted Dungeons\" (the master switch) was turned off."));
SaveIfDirty();
}
@ -552,7 +553,7 @@ internal sealed class IltVaultedDungeons : IIltFeature
? GemNames[_cfg.Gem - 1] : "(none)";
_ctx.Chat($"[Vaulted Dungeons] {(_cfg.Active ? "On" : "Off")} — dungeon={d}, gem={g}, "
+ $"kill-client={(_cfg.Quit ? $"{_cfg.QuitMinutes}m" : "off")}, state={_state}.");
_ctx.Chat("[Vaulted Dungeons] /ilt vaulted [on|off|toggle|status] (Mini Remote tab; master switch: Settings > Navigation > Vaulted Dungeons)");
_ctx.Chat("[Vaulted Dungeons] /ilt vaulted [on|off|toggle|status] (Mini Remote tab; master switch: /ilt settings or Settings > Navigation > Vaulted Dungeons)");
return true;
}
}

View file

@ -51,11 +51,23 @@ internal sealed unsafe class RynthAiClient
private bool _checked;
private long _checkedAt;
private bool _pinned; // tests: a table handed in, never looked up
public RynthAiClient(RynthCoreHost host) => _host = host;
/// <summary>Tests only: use <paramref name="table"/> (a fake RynthAi's table) and never look it up.</summary>
internal void UseTableForTests(IntPtr table)
{
_pinned = true;
_t = (RynthAiHubApiV1*)table;
_checked = true;
System.Threading.Volatile.Write(ref _renderTable, table);
}
/// <summary>Forget the table; the next call looks it up again (login, logout, RynthAi reload).</summary>
public void Reset()
{
if (_pinned) return;
_t = null;
_checked = false;
System.Threading.Volatile.Write(ref _renderTable, IntPtr.Zero);
@ -66,6 +78,7 @@ internal sealed unsafe class RynthAiClient
{
get
{
if (_pinned) return _t;
long now = Environment.TickCount64;
if (_checked && now - _checkedAt < RecheckMs && (_t == null || _t->Version >= 1)) return _t;
_checked = true;
@ -123,22 +136,9 @@ internal sealed unsafe class RynthAiClient
}
}
// ── Vaulted Dungeons (master switch, activity) ──────────────────────────
/// <summary>
/// RynthAi's "Vaulted Dungeons" setting (Settings > Navigation): the master switch of the Vaulted
/// Dungeons keeper, and the only place it is stored. False when RynthAi isn't loaded, is older than
/// the call, hasn't logged in, or has it off (the default): the keeper then does nothing. Any thread.
/// </summary>
public bool VaultedDungeonsEnabled
{
get
{
var t = AnyThreadTable;
return t != null && RynthAiHubApiV1.Has(t, RynthAiHubApiV1.VaultedDungeonsEnabledOffset)
&& t->VaultedDungeonsEnabled != null && t->VaultedDungeonsEnabled() != 0;
}
}
// ── Vaulted Dungeons (activity) ─────────────────────────────────────────
// The master switch is RynthILT's own since 2026-10-20 (IltHubState.VaultedDungeonsEnabled);
// RynthAi.Hub VaultedDungeonsEnabled is no longer read.
/// <summary>
/// What RynthAi is doing now (its "RynthAi.Activity" interface: combat, buffing, loot, a use or cast
@ -161,6 +161,31 @@ internal sealed unsafe class RynthAiClient
}
}
// ── Combat ──────────────────────────────────────────────────────────────
/// <summary>
/// Asks RynthAi to back away from <paramref name="objectId"/> (RynthAi.Hub BackAwayFrom): a
/// RynthAiHub.BackAway* result, or int.MinValue when RynthAi isn't loaded or is older than the
/// call. Pump thread.
/// </summary>
public int BackAwayFrom(uint objectId, float radiusYards, int holdMs)
{
var t = Table;
if (t == null || !RynthAiHubApiV1.Has(t, RynthAiHubApiV1.BackAwayFromOffset) || t->BackAwayFrom == null) return int.MinValue;
return t->BackAwayFrom(objectId, radiusYards, holdMs);
}
/// <summary>
/// Reports one player wield counter to RynthAi's loot rules (RynthAi.Hub SetPlayerCounter; the T11
/// "Can Wield" key): <paramref name="value"/> &lt; 0 = unknown. False without RynthAi (or an older one). Pump thread.
/// </summary>
public bool SetPlayerCounter(uint propertyId, long value)
{
var t = Table;
return t != null && RynthAiHubApiV1.Has(t, RynthAiHubApiV1.SetPlayerCounterOffset)
&& t->SetPlayerCounter != null && t->SetPlayerCounter(propertyId, value) != 0;
}
// ── Quests (/myquests) ──────────────────────────────────────────────────
/// <summary>A /myquests flag from RynthAi's tracker (pump thread).</summary>

View file

@ -27,7 +27,9 @@ internal static unsafe class HubInterface
/// <summary>The table for (<paramref name="iface"/>, <paramref name="version"/>), or 0 when it isn't ours.</summary>
public static IntPtr Query(string iface, uint version)
{
if (iface != RynthIltHubApiV1.InterfaceName || version < 1 || version > RynthIltHubApiV1.InterfaceVersion || _released)
// Its own name, and the neutral one RynthAi asks the active server's owner for (the same table).
if ((iface != RynthIltHubApiV1.InterfaceName && iface != RynthIltHubApiV1.NeutralInterfaceName)
|| version < 1 || version > RynthIltHubApiV1.InterfaceVersion || _released)
return IntPtr.Zero;
if (_table == null)
{
@ -42,6 +44,11 @@ internal static unsafe class HubInterface
t->RenderTab = &RenderTab;
t->RenderSection = &RenderSection;
t->Command = &Command;
t->AllowSummonOnEmpty = &AllowSummonOnEmpty;
t->GetSubTabs = &GetSubTabs;
t->GetSetting = &GetSetting;
t->SetSetting = &SetSetting;
t->GetText = &GetText;
t->Version = RynthIltHubApiV1.InterfaceVersion;
_table = t;
}
@ -186,6 +193,82 @@ internal static unsafe class HubInterface
catch { return 0; }
}
/// <summary>The Pets tab's summon-from-empty gate (IltPetAutomation's last tick; 0 off ILT).</summary>
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int AllowSummonOnEmpty()
{
try { return Hub?.PetAutomation.AllowSummonOnEmpty == true ? 1 : 0; }
catch { return 0; }
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int GetSubTabs(byte* parent, IltTabV1* tabs, int capacity)
{
try
{
var hub = Hub;
string? p = Utf8(parent);
if (hub == null || p == null) return 0;
var all = hub.SubTabs(p);
if (tabs != null)
{
for (int i = 0; i < all.Length && i < capacity; i++)
{
IltTabV1* t = &tabs[i];
WriteUtf8(all[i].Id, t->Id, 24);
WriteUtf8(all[i].Label, t->Label, 32);
t->Width = 0;
t->Height = 0;
t->Flags = RynthIltHub.TabShown | RynthIltHub.TabAvailable;
}
}
return all.Length;
}
catch { return 0; }
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int GetSetting(byte* key)
{
try
{
var hub = Hub;
string? k = Utf8(key);
return hub == null || k == null ? -1 : hub.GetSetting(k);
}
catch { return -1; }
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int SetSetting(byte* key, int value)
{
try
{
var hub = Hub;
string? k = Utf8(key);
return hub != null && k != null && hub.SetSetting(k, value) ? 1 : 0;
}
catch { return 0; }
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int GetText(byte* id, byte* buffer, int capacity)
{
try
{
var hub = Hub;
string? k = Utf8(id);
if (hub == null || k == null || buffer == null || capacity <= 0) return 0;
string text = hub.GetText(k);
if (text.Length == 0) { buffer[0] = 0; return 0; }
WriteUtf8(text, buffer, capacity);
int n = 0;
while (n < capacity && buffer[n] != 0) n++;
return n;
}
catch { return 0; }
}
/// <summary>Writes <paramref name="s"/> as NUL-terminated UTF-8 into a fixed buffer, truncated to fit.</summary>
private static void WriteUtf8(string s, byte* dest, int capacity)
{

View file

@ -0,0 +1,129 @@
// IltSectionsManifest.cs - What RynthILT adds to RynthCore's Mini Remote sections (RynthPluginGetSectionsJson,
// schema 1: UI/Sections/SectionManifest.cs in RynthCore).
//
// always (Infinite Leaftide views, shown while RynthCore treats this world as ILT)
// Session Stats ("char") the ILT session extras section:ilt-rates
// Fellowship ILT's /fship commands section:ilt-fellowship
// Quests (RynthILT's own) the /qb list section:ilt-questbonus
// while the Hub shows them (an ILT world; each once the server reports its feature)
// Inventory Gear, Charms, Banking section:gear|charms|banking
// Games (RynthILT's own) Games section:games
// Nav Vaulted Dungeons (master switch) section:vaulted
// The Mini Remote tabs were listed by RynthAi, which hosted them, until 2026-10-20; RynthILT lists and
// draws them itself now (RynthPluginRenderEmbed "section:<tab>"), so RynthAi's manifest names no
// server's tabs. Their names stay the same, so "/rc miniremote tab charms|banking" finds them.
// Pure: the tabs come in as a list, so the tests build it offline.
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.Json;
using RynthCore.Plugin.RynthILT.Hub;
namespace RynthCore.Plugin.RynthILT;
internal static class IltSectionsManifest
{
/// <summary>RynthCore's id for Infinite Leaftide.</summary>
public const string Server = "ilt";
/// <summary>One Mini Remote tab as the Hub has it now.</summary>
internal readonly record struct Tab(string Id, float Width, float Height, bool Shown, bool Available);
private const string NotReportedNote = "Shows once the server reports this ILT feature on (the ILT settings can ask again).";
/// <summary>Where each tab goes: section, label, order, tooltip. A tab not listed here isn't offered.</summary>
internal static readonly Dictionary<string, (string Section, string Label, int Order, string Tooltip)> Placement = new()
{
["gear"] = ("inventory", "Gear", 210, "ILT gear tools (RynthILT)."),
["charms"] = ("inventory", "Charms", 220, "ILT charms and Guardian Hands: acquired, status, tier, toggles (RynthILT)."),
["banking"] = ("inventory", "Banking", 230, "Your ILT bank: balances, deposits, withdrawals and transfers (RynthILT)."),
["games"] = ("games", "Games", 100, "ILT games (RynthILT)."),
// Listed only while the Hub shows the tab: the master switch is on, on an ILT world.
["vaulted"] = ("nav", "Vaulted Dungeons", 220,
"Keep the character in one Vaulted Dungeon (RynthILT; master switch: /ilt settings or Settings > Navigation)."),
};
/// <summary>The surface of a tab's view ("section:gear").</summary>
public static string SurfaceOf(string tabId) => "section:" + tabId;
/// <summary>The tab a "section:&lt;tab&gt;" surface draws, when it names one placed here.</summary>
public static bool TryTabOf(string surface, out IltSection section)
{
section = IltSection.Gear;
if (!surface.StartsWith("section:", System.StringComparison.Ordinal)) return false;
string id = surface.Substring("section:".Length);
if (!Placement.ContainsKey(id) || !IltSections.TryParse(id, out section) || !IltSections.IsTab(section)) return false;
return IltSections.TabId(section) == id;
}
/// <summary>The Hub's tabs now (empty without a Hub). Render thread.</summary>
public static List<Tab> TabsOf(IltHubController? hub)
{
var list = new List<Tab>();
if (hub == null) return list;
foreach (IltSection s in IltSections.Tabs)
{
var size = IltSections.TabSize(s);
list.Add(new Tab(IltSections.TabId(s), size.X, size.Y, hub.TabShown(s), hub.SectionAvailable(s)));
}
return list;
}
/// <summary>The manifest JSON (UTF-8 text, schema 1).</summary>
public static string Build(IReadOnlyList<Tab> tabs)
{
using var stream = new MemoryStream(4096);
using (var w = new Utf8JsonWriter(stream))
{
w.WriteStartObject();
w.WriteNumber("version", 1);
w.WriteStartArray("sections");
Section(w, "quests", "Quests", 1160);
Section(w, "games", "Games", 1150);
w.WriteEndArray();
w.WriteStartArray("contributions");
View(w, "char", "ILT session rates (RynthILT)", RynthILTPlugin.RatesSurface, primary: false, 0, 220, enabled: true, note: "",
"Enlightened Coins, pyreals and item conversions this session, on the same clock as RynthAi's session stats (RynthILT).", 120);
View(w, "fellowship", "ILT fellowship (RynthILT)", RynthILTPlugin.FellowshipSurface, primary: false, 0, 110, enabled: true, note: "",
"Infinite Leaftide's /fship commands: create, invite, dismiss, invite your landblock, list nearby, leave, disband (RynthILT; also /ilt fellow).", 120);
View(w, "quests", "Quest bonus (/qb)", RynthILTPlugin.QuestBonusSurface, primary: true, 520, 440, enabled: true, note: "",
"Infinite Leaftide's quest bonus list: completed and incomplete /qb flags (RynthILT; the quest list, timers and rewards are RynthOracle's, /ro).", 100);
foreach (Tab t in tabs)
{
if (!t.Shown || !Placement.TryGetValue(t.Id, out var place)) continue;
View(w, place.Section, place.Label, SurfaceOf(t.Id), primary: true, t.Width, t.Height, t.Available,
t.Available ? string.Empty : NotReportedNote, place.Tooltip, place.Order);
}
w.WriteEndArray();
w.WriteEndObject();
}
return Encoding.UTF8.GetString(stream.ToArray());
}
private static void Section(Utf8JsonWriter w, string id, string label, int order)
{
w.WriteStartObject();
w.WriteString("id", id);
w.WriteString("label", label);
w.WriteNumber("order", order);
w.WriteEndObject();
}
private static void View(Utf8JsonWriter w, string section, string label, string surface, bool primary, float width, float height,
bool enabled, string note, string tooltip, int order)
{
w.WriteStartObject();
w.WriteString("section", section);
w.WriteString("server", Server);
w.WriteString("label", label);
w.WriteString("surface", surface);
w.WriteBoolean("primary", primary);
if (width > 0) w.WriteNumber("width", width);
if (height > 0) w.WriteNumber("height", height);
w.WriteBoolean("enabled", enabled);
if (note.Length > 0) w.WriteString("note", note);
if (tooltip.Length > 0) w.WriteString("tooltip", tooltip);
w.WriteNumber("order", order);
w.WriteEndObject();
}
}

View file

@ -1,8 +1,10 @@
// IltSettingsUi.cs - The "ILT settings" view: RynthILT's copy of the Infinite Leaftide settings.
//
// Drawn in its own window ("/ilt settings"). Shows RynthCore's verdict and reason, this character's
// Auto / On / Off override, the ILT world names (edited through RynthCore), and every ILT feature
// with the state RynthILT's Hub read from the server (IltSettingsModel has where each comes from).
// Auto / On / Off override, the ILT world names (edited through RynthCore), this character's ILT
// options (the settings that moved here from RynthAi on 2026-10-20: the Empyrean Handler ring
// evade, ...; saved in the Hub's state), and every ILT feature with the state RynthILT's Hub read
// from the server (IltSettingsModel has where each comes from).
// Edits are RynthCore commands, queued for the plugin tick; the next server-list poll shows the
// result. Render thread only.
using System;
@ -25,6 +27,7 @@ internal sealed class IltSettingsUi
private readonly IltSettingsModel _model;
private readonly Action<string> _runCommand;
private readonly Func<bool> _refreshFeatures;
private readonly Func<IltHubController?> _hub;
private string _newName = string.Empty;
private string _status = string.Empty;
@ -33,11 +36,13 @@ internal sealed class IltSettingsUi
/// <param name="runCommand">Queues a RynthCore command (run on the plugin tick).</param>
/// <param name="refreshFeatures">Asks the Hub to read the server's features again; false before it exists.</param>
public IltSettingsUi(IltSettingsModel model, Action<string> runCommand, Func<bool> refreshFeatures)
/// <param name="hub">This character's Hub (its options live in the Hub's state); null before login.</param>
public IltSettingsUi(IltSettingsModel model, Action<string> runCommand, Func<bool> refreshFeatures, Func<IltHubController?>? hub = null)
{
_model = model;
_runCommand = runCommand;
_refreshFeatures = refreshFeatures;
_hub = hub ?? (() => null);
}
/// <summary>The standalone window, while open.</summary>
@ -56,6 +61,8 @@ internal sealed class IltSettingsUi
{
RenderVerdict();
ImGui.Separator();
RenderCharacterOptions();
ImGui.Separator();
RenderFeatures();
if (_status.Length > 0)
{
@ -123,6 +130,38 @@ internal sealed class IltSettingsUi
}
}
/// <summary>
/// This character's Infinite Leaftide options: the ones that were RynthAi settings until
/// 2026-10-20 (copied over once). Saved with the Hub's state.
/// </summary>
private void RenderCharacterOptions()
{
ImGui.TextUnformatted("This character");
IltHubController? hub = _hub();
if (hub == null)
{
ImGui.TextDisabled("Shown once this character is logged in.");
return;
}
IltHubState st = hub.State;
bool vaulted = st.VaultedDungeonsEnabled;
if (ImGui.Checkbox("Vaulted Dungeons (the keeper's master switch)##iltvaulted", ref vaulted)) st.VaultedDungeonsEnabled = vaulted;
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Off by default. While off the Vaulted Dungeons keeper does nothing: no recalls, no /rc quit, no Mini\n"
+ "Remote tab. On: the \"Vaulted Dungeons\" tab shows, where you pick a dungeon and a tied Portal Recall\n"
+ "Gem and start it (/ilt vaulted on). Also in RynthCore's Settings > Navigation (it was a RynthAi setting).");
bool ring = st.Combat.HandlerRingEvade;
if (ImGui.Checkbox("Evade the Empyrean Handler's lethal ring##iltring", ref ring)) st.Combat.HandlerRingEvade = ring;
if (ImGui.IsItemHovered())
ImGui.SetTooltip("When an Empyrean Handler channels its lethal ring and you are within 12 yards (or RynthAi's\n"
+ "Ring Range if larger), RynthAi back-jumps away and re-engages. Only while RynthAi's macro\n"
+ "is running with combat on. On by default (it was RynthAi's \"Evade Handler Ring\").");
int augs = st.T11.ItemAugsOverride;
SafeImGui.TextDisabled(augs >= 0
? $"T11 item augmentations: fixed at {augs:N0} for RynthAi's loot rules (/ilt t11 augs auto to read /aug)"
: "T11 item augmentations: read from /aug (/ilt t11 augs <n> fixes them; /ilt t11 shows the counters)");
}
/// <summary>
/// The server's ILT features, one collapsible section per group (Character, Items, Pets,
/// Fellowship, Combat, Activities, then the charms and any other bit chat or a probe set), with

View file

@ -15,8 +15,10 @@ public static unsafe class PluginExports
// sections RynthAi's Mini Remote hosts (Plugins/Shared/RynthIltHubApi.cs, HubInterface.cs), and
// "RynthServer.Profile" v1, ILT's settings and tinkering salvage for any reader, as every server
// plugin serves its own (Plugins/Shared/RynthServerProfileApi.cs, ProfileInterface.cs), and
// "RynthILT.Data" v1, the charms list and bank balances with their actions
// (Plugins/Shared/RynthIltDataApi.cs, DataInterface.cs).
// "RynthILT.Data" v1..v3, the charms list and bank balances with their actions, the pet breeding
// tracker and the Temple guardians (Plugins/Shared/RynthIltDataApi.cs, DataInterface.cs), and
// "RynthILT.Server" v1, the Leaftide feature / fellowship / quest bonus profile RynthOracle reads
// (Plugins/Shared/RynthIltServerApi.cs, ServerInterface.cs).
// Fixed signature: void* (const char* iface, uint version).
[UnmanagedCallersOnly(EntryPoint = "RynthPluginQueryInterface", CallConvs = new[] { typeof(CallConvCdecl) })]
private static IntPtr QueryInterface(IntPtr ifaceAnsi, uint version)
@ -26,6 +28,8 @@ public static unsafe class PluginExports
string iface = ifaceAnsi == IntPtr.Zero ? "" : Marshal.PtrToStringAnsi(ifaceAnsi) ?? "";
IntPtr table = HubInterface.Query(iface, version);
if (table != IntPtr.Zero) return table;
table = ServerInterface.Query(iface, version);
if (table != IntPtr.Zero) return table;
table = ProfileInterface.Query(iface, version);
return table != IntPtr.Zero ? table : DataInterface.Query(iface, version);
}
@ -44,6 +48,7 @@ public static unsafe class PluginExports
// An exception escaping an UnmanagedCallersOnly export fail-fasts the client under NativeAOT.
try { Runtime.Shutdown(); } catch { }
try { HubInterface.Release(); } catch { }
try { ServerInterface.Release(); } catch { }
try { ProfileInterface.Release(); } catch { }
try { DataInterface.Release(); } catch { }
foreach (IntPtr p in new[] { Interlocked.Exchange(ref _bountiesPtr, IntPtr.Zero), Interlocked.Exchange(ref _progressionPtr, IntPtr.Zero),
@ -92,7 +97,9 @@ public static unsafe class PluginExports
/// still asks) are RynthCore's Mini Remote sections. ":popout" is added when one is popped out
/// into a window of its own, and RynthILT draws in the engine's current context either way. The
/// Guardian panel is user-sized (want echoes the size given); a section reports the height it
/// used. 1 = drawn, 0 = not ready / unknown surface.
/// used. "section:gear|charms|banking|games|vaulted" are the Mini Remote ILT tabs as RynthCore's
/// section views (RynthILT lists them since 2026-10-20; RynthAi did before), sized to the tab.
/// 1 = drawn, 0 = not ready / unknown surface.
/// </summary>
[UnmanagedCallersOnly(EntryPoint = "RynthPluginRenderEmbed", CallConvs = new[] { typeof(CallConvCdecl) })]
public static int RenderEmbed(byte* surface, float width, float height, float* wantWidth, float* wantHeight)
@ -116,7 +123,16 @@ public static unsafe class PluginExports
: name.SequenceEqual("section:ilt-rates"u8) ? RynthILTPlugin.RatesSurface
: name.SequenceEqual("section:ilt-questbonus"u8) ? RynthILTPlugin.QuestBonusSurface
: null;
if (view == null || !plugin.RenderEmbedded(view, out float wantH)) return 0;
if (view == null)
{
// "section:gear", "section:banking", ...: the Mini Remote ILT tabs RynthILT lists (IltSectionsManifest).
if (name.Length > 64 || !name.StartsWith("section:"u8)) return 0;
if (!plugin.RenderEmbeddedTab(System.Text.Encoding.UTF8.GetString(name), out float tabW, out float tabH)) return 0;
if (wantWidth != null) *wantWidth = tabW > 0 ? tabW : width;
if (wantHeight != null) *wantHeight = tabH > 0 ? tabH : height;
return 1;
}
if (!plugin.RenderEmbedded(view, out float wantH)) return 0;
if (wantWidth != null) *wantWidth = width;
if (wantHeight != null) *wantHeight = wantH;
return 1;
@ -132,6 +148,11 @@ public static unsafe class PluginExports
public static void OnChatBarEnter(IntPtr textUtf16, IntPtr eatFlag)
=> Runtime.OnChatBarEnter(textUtf16, eatFlag);
// Creatures' health from the server (siphon auto-capture's fallback health read, IltPetAutomation).
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnUpdateHealth", CallConvs = new[] { typeof(CallConvCdecl) })]
public static void OnUpdateHealth(uint targetId, float healthRatio, uint currentHealth, uint maxHealth)
=> Runtime.OnUpdateHealth(targetId, healthRatio, currentHealth, maxHealth);
// This character's kills re-read the bounty list (while the Bounties window is open).
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnKillNotification", CallConvs = new[] { typeof(CallConvCdecl) })]
public static void OnKillNotification(IntPtr textUtf16) => Runtime.OnKillNotification(textUtf16);

View file

@ -29,6 +29,9 @@ internal static unsafe class ProfileInterface
{
Emulator = "ACE",
Salvage = IltSalvage.Rows,
// Leaftide trinkets (UB-IT's IsLeaftideTrinketJewelry): the Crafting tab's Trinkets bench, not Jewelry.
TrinketNames = IltSalvage.TrinketNames,
TrinketExcept = IltSalvage.TrinketExcept,
Source = "RynthILT; salvage from UB-IT's LeaftideImbueHelper (via SilentKelpie)",
};

View file

@ -13,7 +13,15 @@
RynthILT borrows from RynthAi through RynthAi.Hub (Plugins/Shared/RynthIltHubApi.cs,
RynthAiHubApi.cs).
IltSettingsView/ a copy of the ILT settings (RynthCore's verdict, this character's override, the
ILT world names, the Hub's feature read) in its own window ("/ilt settings").
ILT world names, the Hub's feature read) in its own window ("/ilt settings"),
with this character's ILT options (Vaulted Dungeons master switch, Handler
ring evade, T11 item augs).
Moved out of RynthAi 2026-10-20 (Hub/): the Pets tab's ACECustom parts (IltPetAutomation:
pet charms, summon from empty, siphon capture), the Empyrean Handler ring
detection (IltRingEvade; RynthAi does the back-away), the T11 /aug counters
and "/ilt t11" (IltT11; RynthAi keeps the loot keys), the Vaulted Dungeons
switch, the Remote tab's ILT parts, the Mini Remote tab views on the rail
(IltSectionsManifest.cs) and the Leaftide trinket list (the profile).
IltFellowship/ ILT's /fship commands as buttons ("/ilt fellow").
-->
<PropertyGroup>
@ -43,7 +51,7 @@
<RynthPluginServerName>Infinite Leaftide</RynthPluginServerName>
<RynthPluginServerHosts>infiniteleaftide.online</RynthPluginServerHosts>
<RynthPluginServerWorldNames>InfiniteLeaftide|*Leaftide*</RynthPluginServerWorldNames>
<RynthPluginDescription>Infinite Leaftide (ACECustom) features: the ILT Hub (the Mini Remote's ILT tabs: banking, gear, charms, games), the Guardian, bounties, progression, the attribute raiser, the ring inscription chain, the ILT settings and the /fship fellowship commands.</RynthPluginDescription>
<RynthPluginDescription>Infinite Leaftide (ACECustom) features: the ILT Hub (the Mini Remote's ILT tabs: banking, gear, charms, games, Vaulted Dungeons; the Pets tab's charms, siphon capture and breeding), the Guardian, bounties, progression, the attribute raiser, the ring inscription chain, the Empyrean Handler ring evade, the T11 loot counters, the ILT settings and the /fship fellowship commands.</RynthPluginDescription>
</PropertyGroup>
<ItemGroup>
@ -56,12 +64,16 @@
<!-- The two interfaces between RynthILT and RynthAi (linked into both plugins). -->
<Compile Include="..\Shared\RynthIltHubApi.cs" Link="Shared\RynthIltHubApi.cs" />
<Compile Include="..\Shared\RynthAiHubApi.cs" Link="Shared\RynthAiHubApi.cs" />
<!-- Chat types and the line-start marker (the Empyrean Handler's ring line, Hub/IltRingEvade.cs). -->
<Compile Include="..\Shared\ChatSource.cs" Link="Shared\ChatSource.cs" />
<!-- "RynthAi.Activity": what the bot is doing (the Vaulted Dungeons keeper waits out combat and buffing). -->
<Compile Include="..\Shared\RynthAiActivityApi.cs" Link="Shared\RynthAiActivityApi.cs" />
<!-- The pet-capture success lines (shared with RynthAi's Pets tab): they count as a kill for Vaulted Dungeons' timer. -->
<Compile Include="..\Shared\PetCaptureLines.cs" Link="Shared\PetCaptureLines.cs" />
<!-- "RynthILT.Data": the charms list and bank balances for other plugins (DataInterface.cs). -->
<Compile Include="..\Shared\RynthIltDataApi.cs" Link="Shared\RynthIltDataApi.cs" />
<!-- "RynthILT.Server": the feature / fellowship / quest bonus profile for other plugins (ServerInterface.cs). -->
<Compile Include="..\Shared\RynthIltServerApi.cs" Link="Shared\RynthIltServerApi.cs" />
<!-- RynthCore's server list (API v86): the ILT verdict the Hub follows (IltSettingsView/). -->
<Compile Include="..\Shared\EngineServerState.cs" Link="Shared\EngineServerState.cs" />
<!-- "RynthServer.Profile": ILT's settings and tinkering salvage (Hub/IltSalvage.cs) for other
@ -80,6 +92,12 @@
<!-- Save failures (its own files and the copies migrated from RynthAi) said in chat with the
reason and the fix, as RynthAi's are. -->
<Compile Include="..\Shared\DataWriteGuard.cs" Link="Shared\DataWriteGuard.cs" />
<!-- T11 (ACECustom tier 11+ gear): the "/aug" reader, the counters and the item text parser (Hub/IltT11.cs,
"/ilt t11"). RynthAi keeps the loot keys and evaluator; RynthILT reports the counters to it. -->
<Compile Include="..\..\Shared\RynthCore.LootSdk\T11\T11Catalog.cs" Link="Shared\T11\T11Catalog.cs" />
<Compile Include="..\..\Shared\RynthCore.LootSdk\T11\T11ItemInfo.cs" Link="Shared\T11\T11ItemInfo.cs" />
<Compile Include="..\..\Shared\RynthCore.LootSdk\T11\T11Keys.cs" Link="Shared\T11\T11Keys.cs" />
<Compile Include="..\..\Shared\RynthCore.LootSdk\T11\T11PlayerAugs.cs" Link="Shared\T11\T11PlayerAugs.cs" />
<!-- AcObjectClass (the item classes the gear tools check). -->
<Compile Include="..\..\Shared\RynthCore.LootSdk\AcGameEnums.cs" Link="Shared\AcGameEnums.cs" />
<!-- ILT's /fship commands (IltFellowship/): the shared command list format and its button panel. -->

View file

@ -22,6 +22,13 @@
// comes from RynthCore's server list (plugin API v86, polled every 2 s), and the Hub follows it
// once one arrives (IltEngineVerdict).
//
// Moved from RynthAi on 2026-10-20 (Hub/): the Pets tab's ACECustom parts (IltPetAutomation), the
// Empyrean Handler ring detection (IltRingEvade; RynthAi.Hub BackAwayFrom does the jump), the T11
// "/aug" counters and "/ilt t11" (IltT11; RynthAi.Hub SetPlayerCounter), the Vaulted Dungeons
// master switch, the Remote tab's ILT parts, and the Mini Remote ILT tab views on RynthCore's rail
// (IltSectionsManifest.cs, RenderEmbeddedTab). Their settings were copied once from the
// character's RynthAi files (IltMigration.ImportRynthAiSettings, at the Hub's start).
//
// Third: ILT's fellowship commands (IltFellowship/, ACECustom /fship) as buttons in RynthCore's
// Fellowship section and their own window ("/ilt fellow"). While ILT is active the list is also
// sent to RynthAi ("servercommands"), whose Fellowship view draws them; an empty list clears it.
@ -50,8 +57,8 @@ namespace RynthCore.Plugin.RynthILT;
public sealed class RynthILTPlugin : RynthPluginBase
{
internal static readonly IntPtr NamePointer = Marshal.StringToHGlobalAnsi("RynthILT");
// Previous release: 0.3.1.
internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.3.2");
// Previous release: 0.3.2.
internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.3.3");
/// <summary>
/// The settings view's surface. Not in the sections manifest (the force-server override lives
@ -83,7 +90,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
public RynthILTPlugin()
{
_settingsUi = new IltSettingsUi(_settingsModel, cmd => QueueChatCommand(cmd), RefreshFeatures);
_settingsUi = new IltSettingsUi(_settingsModel, cmd => QueueChatCommand(cmd), RefreshFeatures, () => _hub);
_fellowshipUi = new IltFellowshipUi(QueueChatCommand);
IltEngineVerdict.Attach(_settingsModel);
}
@ -353,27 +360,50 @@ public sealed class RynthILTPlugin : RynthPluginBase
/// <summary>
/// RynthPluginGetSectionsJson (schema 1, UI/Sections/SectionManifest.cs in RynthCore): the ILT
/// session extras in Session Stats ("char"), the fellowship commands in Fellowship and the /qb
/// list in a Quests section of RynthILT's own, all Infinite Leaftide areas (shown while RynthCore
/// treats this world as ILT). The Mini Remote ILT tabs (Banking, Gear, Charms, Games) are listed
/// by RynthAi, which hosts them. Null before login.
/// session extras in Session Stats ("char"), the fellowship commands in Fellowship, the /qb list in
/// a Quests section of RynthILT's own, and the Mini Remote ILT tabs the Hub shows (Gear, Charms,
/// Banking in Inventory, Games in a section of RynthILT's own, Vaulted Dungeons in Nav), all
/// Infinite Leaftide areas (shown while RynthCore treats this world as ILT). IltSectionsManifest.cs.
/// The tabs were listed by RynthAi, which hosted them, until 2026-10-20. Null before login.
/// </summary>
internal string? BuildSectionsJson() => _loginComplete ? SectionsJson : null;
internal string? BuildSectionsJson() => _loginComplete ? IltSectionsManifest.Build(IltSectionsManifest.TabsOf(_hub)) : null;
internal const string SectionsJson =
"{\"version\":1,\"sections\":[{\"id\":\"quests\",\"label\":\"Quests\",\"order\":1160}],\"contributions\":[" +
"{\"section\":\"char\",\"server\":\"ilt\"," +
"\"label\":\"ILT session rates (RynthILT)\",\"surface\":\"" + RatesSurface + "\",\"primary\":false," +
"\"height\":220,\"enabled\":true,\"tooltip\":\"Enlightened Coins, pyreals and item conversions this session, " +
"on the same clock as RynthAi's session stats (RynthILT).\",\"order\":120}," +
"{\"section\":\"fellowship\",\"server\":\"ilt\"," +
"\"label\":\"ILT fellowship (RynthILT)\",\"surface\":\"" + FellowshipSurface + "\",\"primary\":false," +
"\"height\":110,\"enabled\":true,\"tooltip\":\"Infinite Leaftide's /fship commands: create, invite, dismiss, " +
"invite your landblock, list nearby, leave, disband (RynthILT; also /ilt fellow).\",\"order\":120}," +
"{\"section\":\"quests\",\"server\":\"ilt\"," +
"\"label\":\"Quest bonus (/qb)\",\"surface\":\"" + QuestBonusSurface + "\",\"primary\":true," +
"\"width\":520,\"height\":440,\"enabled\":true,\"tooltip\":\"Infinite Leaftide's quest bonus list: completed and " +
"incomplete /qb flags (RynthILT; the quest list, timers and rewards are RynthOracle's, /ro).\",\"order\":100}]}";
/// <summary>
/// RynthPluginRenderEmbed "section:&lt;tab&gt;": one Mini Remote ILT tab as RynthCore's section view
/// (IltSectionsManifest lists them), drawn into the engine's current window and context in the
/// dashboard colours. <paramref name="wantWidth"/> / <paramref name="wantHeight"/> are the tab's
/// size. False until the Hub exists, or for a surface that is no ILT tab. Render thread.
/// </summary>
internal bool RenderEmbeddedTab(string surface, out float wantWidth, out float wantHeight)
{
wantWidth = wantHeight = 0;
IltHubController? hub = _hub;
if (!_loginComplete || hub == null || !IltSectionsManifest.TryTabOf(surface, out IltSection section)) return false;
IntPtr previous = ImGui.GetCurrentContext();
IntPtr context = previous != IntPtr.Zero ? previous : Host.ImGuiContext;
if (context == IntPtr.Zero) return false;
ImGui.SetCurrentContext(context);
int pushed = IltStyle.PushDashboardStyle();
try
{
var size = IltSections.TabSize(section);
wantWidth = size.X;
wantHeight = size.Y;
hub.NoteTabDrawn();
hub.RenderTab(section);
return true;
}
catch (Exception ex)
{
RynthLog.Exception(LogCat.IltHub, ex, "RenderEmbeddedTab " + surface);
return false;
}
finally
{
ImGui.PopStyleColor(pushed);
ImGui.SetCurrentContext(previous);
}
}
/// <summary>Plugin tick: runs the settings and fellowship views' chat commands through the engine.</summary>
private void DrainChatCommands()
@ -486,7 +516,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
try
{
// The Hub eats its own probe / capture replies (IltChatCapture).
if (_hub?.OnChat(text) == true) eat = 1;
if (_hub?.OnChat(text, chatType) == true) eat = 1;
}
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "OnChat"); }
if (_bounties == null) return;
@ -519,6 +549,13 @@ public sealed class RynthILTPlugin : RynthPluginBase
_commands.Enqueue(trimmed.Split(' ', StringSplitOptions.RemoveEmptyEntries));
}
// A creature's health from the server: siphon auto-capture's fallback health read (ILT only).
public override void OnUpdateHealth(uint targetId, float healthRatio, uint currentHealth, uint maxHealth)
{
try { _hub?.OnUpdateHealth(targetId, healthRatio); }
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "OnUpdateHealth"); }
}
// The server's killer notification: this character landed the killing blow.
public override void OnKillNotification(string? deathMessage)
{
@ -624,15 +661,18 @@ public sealed class RynthILTPlugin : RynthPluginBase
/// <summary>
/// The verbs RynthILT answers: the ILT "/ra hub" verbs (not RynthAi's Quests / Pets tabs or its
/// Remote tab), "/ra guardian", "/ra bounty|bounties|bountys" and "rates".
/// Remote tab), "/ra guardian", "/ra bounty|bounties|bountys", "rates" and "t11".
/// </summary>
internal static bool IsIltVerb(string[] words)
{
string verb = words[0].ToLowerInvariant();
switch (verb)
{
case "guardian": case "bounty": case "bounties": case "bountys": case "rates":
case "guardian": case "bounty": case "bounties": case "bountys": case "rates": case "t11":
return true;
case "ub":
// ub-IT's ACECustom verbs RynthAi passes on ("/ub qblist", "/ub augs").
return words.Length >= 2 && words[1].ToLowerInvariant() is "qblist" or "augs";
case "hub":
if (words.Length < 2) return false; // "/ra hub" alone toggles RynthAi's Mini Remote
string sub = words[1].ToLowerInvariant();
@ -678,6 +718,23 @@ public sealed class RynthILTPlugin : RynthPluginBase
case "hub":
case "rates":
break;
case "ub":
{
// ub-IT's "/ub qblist" and "/ub augs" (RynthAi passes them on): ACECustom's own commands.
string sub = args.Length > 0 ? args[0].ToLowerInvariant() : string.Empty;
string? server = sub == "qblist" ? "/qb list" : sub == "augs" ? "/aug" : null;
if (server == null) { ChatLine("[RynthILT] /ub qblist or /ub augs"); return; }
if (_hub?.Options.IsIltLikeWorld != true) { ChatLine($"[RynthILT] /ub {sub}: not an Infinite Leaftide world."); return; }
if (!Host.HasInvokeChatParser || !Host.InvokeChatParser(server)) ChatLine("[RynthILT] RynthCore didn't take: " + server);
return;
}
case "t11":
{
// "/ilt t11 ..." and RynthAi's "/ra t11 ..." (T11 loot counters; IltT11).
if (_hub == null) { ChatLine("[RynthILT] ILT features not ready (log in first)."); return; }
_hub.T11.HandleCommand(args);
return;
}
case "vaulted":
case "vaulteddungeons":
{
@ -707,7 +764,8 @@ public sealed class RynthILTPlugin : RynthPluginBase
case "help":
ChatLine("[RynthILT] /ilt hub ... (the Mini Remote's ILT tabs; same as /ra hub ...), /ilt guardian ..., /ilt servers [list|<names>|default],");
ChatLine("[RynthILT] /ilt bounty [list|refresh] - the tracked ACECustom bounties (the Bounties window: the ILT button on the RynthCore bar, or /rc bounties),");
ChatLine("[RynthILT] /ilt vaulted [on|off|toggle|status] - Vaulted Dungeons keeper (ILT only; master switch: RynthAi Settings > Navigation > Vaulted Dungeons, off by default),");
ChatLine("[RynthILT] /ilt vaulted [on|off|toggle|status] - Vaulted Dungeons keeper (ILT only; master switch: /ilt settings or Settings > Navigation > Vaulted Dungeons, off by default),");
ChatLine("[RynthILT] /ilt t11 [augs <n|auto>|refresh|item [0xId]] - T11 loot: the /aug wield counters RynthAi's loot rules use, the item-aug override, an item's T11 text (also /ra t11),");
ChatLine("[RynthILT] /ilt settings [show|hide|toggle] - the ILT settings: the world verdict, the ILT world names and the server's features (force a server: RynthCore Options > Diagnostics),");
ChatLine("[RynthILT] /ilt fellow [show|hide|toggle] - ILT's /fship commands as buttons (also in the Mini Remote's Fellowship section),");
ChatLine("[RynthILT] /ilt trace <category|all|list> [on|off], /ilt debug [on|off].");
@ -835,6 +893,10 @@ public sealed class RynthILTPlugin : RynthPluginBase
{
_hub = new IltHubController(Host, folder, _settings, _ai, () => _hubWritesBlocked,
pending ? IltMigration.FindLegacyCharFolder(world, charName) : null);
// Once per character: the RynthAi settings that moved here on 2026-10-20.
var imported = IltMigration.ImportRynthAiSettings(_hub.State, world, charName);
if (imported.Count > 0)
RynthLog.Write(LogCat.IltStore, $"Carried {charName}'s RynthAi settings that moved to RynthILT over: {string.Join(", ", imported)}.");
_hub.OnLoginComplete(charName, force);
}
catch (Exception ex)

View file

@ -0,0 +1,81 @@
// ServerInterface.cs - RynthILT's side of the "RynthILT.Server" interface (Plugins/Shared/RynthIltServerApi.cs):
// the profile JSON other plugins read (RynthOracle's Fellowship / Quests qb list / feature list):
// the Leaftide feature list with the server's state for each, and the server's fellowship rules.
//
// Restored 2026-10-16: this export was dropped when "RynthServer.Profile" (salvage / identity) was
// added, so Oracle still detected ILT via RynthCore but never received feature / qb / fellowship
// data from RynthILT. Hub + Data stay separate; this table is the feature-profile channel.
//
// The table is allocated once per loaded copy of RynthILT and never freed (a plugin DLL is never
// unloaded); after Release() it reports Version 0 and GetProfileJson answers 0. Before login there
// is no controller, so the profile is the not-ILT default (every feature unknown, retail fellowships).
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using RynthCore.Plugin.RynthILT.Hub;
using RynthCore.Plugin.Shared;
namespace RynthCore.Plugin.RynthILT;
internal static unsafe class ServerInterface
{
private static RynthIltServerApiV1* _table;
private static volatile bool _released;
/// <summary>The profile before any login: not an ILT world, nothing known (built once).</summary>
private static readonly string NotLoggedInJson =
IltFeatureCatalog.BuildProfileJson(false, string.Empty, false, string.Empty, DateTime.MinValue, _ => IltTri.Unknown);
/// <summary>The table for (<paramref name="iface"/>, <paramref name="version"/>), or 0 when it isn't ours.</summary>
public static IntPtr Query(string iface, uint version)
{
if (iface != RynthIltServerApiV1.InterfaceName || version < 1 || version > RynthIltServerApiV1.InterfaceVersion || _released)
return IntPtr.Zero;
if (_table == null)
{
var t = (RynthIltServerApiV1*)NativeMemory.AllocZeroed((nuint)sizeof(RynthIltServerApiV1));
t->StructSize = (uint)sizeof(RynthIltServerApiV1);
t->GetProfileJson = &GetProfileJson;
t->Version = RynthIltServerApiV1.InterfaceVersion;
_table = t;
}
return (IntPtr)_table;
}
/// <summary>Plugin shutdown: readers see Version 0 and re-query; GetProfileJson answers 0.</summary>
public static void Release()
{
_released = true;
if (_table != null) _table->Version = 0;
}
/// <summary>The JSON to hand out now: the live controller's snapshot, or the not-logged-in default.</summary>
internal static string CurrentJson()
=> (_released ? null : PluginExports.Runtime.Plugin?.Hub?.ProfileJson) ?? NotLoggedInJson;
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int GetProfileJson(byte* buffer, int capacity)
{
try
{
if (_released) return 0;
return ProfileInterface.Write(CurrentJson(), buffer, capacity);
}
catch { return 0; }
}
/// <summary>
/// Copies <paramref name="json"/> as NUL-terminated UTF-8 into the caller's buffer when it fits,
/// and returns its byte length either way (length >= capacity: too small, nothing written).
/// </summary>
internal static int Write(string json, byte* buffer, int capacity)
{
int length = Encoding.UTF8.GetByteCount(json);
if (buffer == null || capacity <= length) return length;
fixed (char* src = json)
Encoding.UTF8.GetBytes(src, json.Length, buffer, capacity);
buffer[length] = 0;
return length;
}
}