// ============================================================================ // RynthSuite - Plugins/Shared/RynthAiHubApi.cs // The "RynthAi.Hub" interface: what RynthILT (the Infinite Leaftide features) // borrows from RynthAi. The Mini Remote that hosts the ILT tabs, the /myquests // tracker (the Temple attribute tracker reads its flags), spell names (the dispel // keeper), VTank loot-profile matching (equipment suits) and the VTank .usd // importer (which edits RynthAi's own rules; drawn in RynthILT's Gear tab), and the // Mini Remote's session stats (the Character tab's rates count the same session). // Compiled into both plugins (linked source), so the layout can't drift. // // Rules: as RynthILT.Hub (Shared/RynthIltHubApi.cs): append-only, UTF-8 strings, // each function says its thread, no exception crosses, the table lives as long as // the RynthAi copy (never freed; Version 0 after Shutdown), callers re-query. // RynthILT works without RynthAi: every feature that needs it says so. // ============================================================================ using System.Runtime.InteropServices; namespace RynthCore.Plugin.Shared; /// Constants of the "RynthAi.Hub" interface. public static class RynthAiHub { /// The providing plugin's display name. public const string PluginName = "RynthAi"; /// RenderSection: the VTank .usd settings importer (RynthAi's monster / weapon / consumable rules). public const string SectionVTankImport = "vtank-import"; } /// One /myquests flag as RynthAi's quest tracker has it. Blittable. [StructLayout(LayoutKind.Sequential)] public struct QuestFlagV1 { public int Solves; /// -1 unlimited (as the server prints it). public int MaxSolves; /// Last completion, UTC ticks (DateTime.Ticks); 0 = never / unknown. public long CompletedOnUtcTicks; /// Repeat time in seconds (0 = none). public long RepeatSeconds; } /// The quest tracker's state. Blittable. [StructLayout(LayoutKind.Sequential)] public struct QuestStatusV1 { /// 1 when the server said /myquests is disabled. public int Disabled; /// Flags cached. public int Count; /// Bumped each time a refresh ends (0 = none yet this session). public int Generation; /// 1 while a refresh is running. public int Refreshing; } /// The Mini Remote's session stats (RynthTracker's SessionStats code). Blittable. [StructLayout(LayoutKind.Sequential)] public struct SessionStatsV1 { /// Session start, UTC ticks (DateTime.Ticks); 0 = no session yet. public long StartUtcTicks; public double SessionSeconds; public long Xp; public double XpPerHour; public long Lum; public double LumPerHour; public long LumLast5Min; /// 1 when the pass-up figures below are tracked. public int PassUpTracked; public long LumPassUp; public double PassUpPerHour; public long Kills; public double KillsPerHour; } /// /// The rest of the Mini Remote's session (SessionStatsMore, appended 2026-10-13): what RynthTracker's /// panel shows beyond , so it can show RynthAi's session whole. Blittable. /// [StructLayout(LayoutKind.Sequential)] public struct SessionStatsMoreV1 { /// XP per kill of your own kills (0 = none yet). public long XpPerKill; public int Deaths; /// 1 at the level cap (experience can't rise). public int MaxLevel; /// Radiance (Aelrynth); 0 elsewhere. public long Rad; public double RadPerHour; } [StructLayout(LayoutKind.Sequential)] public unsafe struct RynthAiHubApiV1 { public const string InterfaceName = "RynthAi.Hub"; public const uint InterfaceVersion = 1; /// /// The table's size up to and including SessionReset, as every RynthAi since the interface's /// first release fills it. Readers check StructSize against this (not sizeof, which grows as /// functions are appended) and check for the appended functions with . /// public static uint BaseStructSize => (uint)(2 * sizeof(uint) + 10 * sizeof(nint)); /// Whether a table RynthAi built is big enough to hold the function at . public static bool Has(RynthAiHubApiV1* t, int offset) => t != null && t->StructSize >= (uint)(offset + sizeof(nint)); /// /// The byte offset of (for ): the first function /// appended after the base table. Sequential layout of 4-byte fields and pointers has no padding. /// public static int SessionStatsMoreOffset => (int)BaseStructSize; public uint Version; // InterfaceVersion of the table RynthAi filled; 0 once it has shut down public uint StructSize; // sizeof(RynthAiHubApiV1) as RynthAi built it /// /// MiniRemoteTab(tabId, mode, reply, replyCapacity): puts the Mini Remote on a tab (tabId "" = /// its Remote tab; mode "show" / "hide" / "toggle", or "select" to switch tabs without showing /// it). Writes the chat-ready reply (UTF-8, truncated to capacity). 1 = done, 0 = no Mini Remote /// yet (before login). Any thread. /// public delegate* unmanaged[Cdecl] MiniRemoteTab; /// MiniRemoteVisible(): 1 while the Mini Remote is on screen. Any thread. public delegate* unmanaged[Cdecl] MiniRemoteVisible; /// QuestFlag(key, flag): 1 and the flag filled when /myquests has it (case-insensitive key). Pump thread. public delegate* unmanaged[Cdecl] QuestFlag; /// QuestStatus(status): fills the tracker state; 0 when there is no tracker (before login). Pump thread. public delegate* unmanaged[Cdecl] QuestStatus; /// /// QuestRefresh(reply, replyCapacity): a quiet /myquests refresh, with the Quests tab's one-a-minute /// cooldown. Writes what happened ("Refreshing quests...", "Wait 40s ..."). 1 = sent. Pump thread. /// public delegate* unmanaged[Cdecl] QuestRefresh; /// SpellName(spellId, buffer, capacity): the spell's name from RynthAi's spell table; its length, 0 unknown. Any thread. public delegate* unmanaged[Cdecl] SpellName; /// /// LootKeeps(utlPath, ids, count, keep, error, errorCapacity): evaluates the VTank loot profile at /// utlPath (.utl) against each object id; keep[i] = 1 when that item's first matching rule is Keep. /// 1 = evaluated; 0 = the profile couldn't be read (error says why). Pump thread. /// public delegate* unmanaged[Cdecl] LootKeeps; /// RenderSection(id): draws a RynthAiHub.Section* into the current window; 1 = drawn. Render thread. public delegate* unmanaged[Cdecl] RenderSection; /// SessionStats(stats): the Mini Remote's session (XP, luminance, kills); 0 before login. Any thread. public delegate* unmanaged[Cdecl] SessionStats; /// SessionReset(): starts the Mini Remote's session over (as its Reset XP button). Any thread. public delegate* unmanaged[Cdecl] SessionReset; // ── Appended 2026-10-13 (check with Has before calling) ───────────────── /// /// SessionStatsMore(more): the rest of the same session (XP per kill, deaths, Radiance, level /// cap); 0 before login. RynthTracker shows RynthAi's session through this and SessionStats. Any thread. /// public delegate* unmanaged[Cdecl] SessionStatsMore; }