250 lines
13 KiB
C#
250 lines
13 KiB
C#
// SectionsManifest.cs - What RynthAi adds to RynthCore's Mini Remote sections.
|
|
//
|
|
// RynthCore 2026.10.5.46+ shows the Mini Remote as a rail of sections: its core twelve (Session
|
|
// Stats - id "char" -, Map, Skills, Combat, Nav, Inventory, Crafting, Spells, Chat, Friends,
|
|
// Fellowship, Pets) and any a plugin adds. It reads each plugin's optional
|
|
// RynthPluginGetSectionsJson export every couple of seconds (schema: UI/Sections/SectionManifest.cs
|
|
// in RynthCore). RynthAi fills, on every world: Session Stats (the one session: RynthTracker,
|
|
// RynthOracle and RynthILT read the same numbers, and RynthCore drops its own overview for it),
|
|
// Pets, Crafting, Spells and Fellowship (the views of those core sections).
|
|
// Nothing server-specific is listed here: a server plugin lists its own views (since 2026-10-20
|
|
// RynthILT lists its Mini Remote tabs, Gear / Charms / Banking / Games / Vaulted Dungeons, and its
|
|
// Games section itself; RynthAi hosted them until then). Quests are RynthOracle's (since 2026-10-13).
|
|
// Each view is a surface "section:<name>" RynthCore draws through RynthPluginRenderEmbed.
|
|
//
|
|
// Pure, so the host tests build it offline.
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Numerics;
|
|
using System.Text;
|
|
using System.Text.Json;
|
|
using RynthCore.Plugin.RynthAi.MiniRemote;
|
|
|
|
namespace RynthCore.Plugin.RynthAi.Huds;
|
|
|
|
internal static class SectionsManifest
|
|
{
|
|
/// <summary>Prefix of every RynthAi section surface ("section:pets").</summary>
|
|
public const string SurfacePrefix = "section:";
|
|
|
|
public const string PetsSurface = SurfacePrefix + MiniRemoteTabs.Pets;
|
|
public const string CraftingSurface = SurfacePrefix + MiniRemoteTabs.Crafting;
|
|
public const string SpellsSurface = SurfacePrefix + "spells";
|
|
public const string FellowshipSurface = SurfacePrefix + "fellowship";
|
|
/// <summary>The session stats (RynthCore's Session Stats section, "char").</summary>
|
|
public const string SessionSurface = SurfacePrefix + "session";
|
|
|
|
/// <summary>One view RynthAi puts in a section.</summary>
|
|
internal sealed record View(string Section, string Server, string Label, string Surface, bool Primary,
|
|
Vector2 Size, bool Enabled, string Note, string Tooltip, int Order);
|
|
|
|
/// <summary>A section of RynthAi's own (beyond RynthCore's core twelve).</summary>
|
|
internal sealed record Section(string Id, string Label, int Order);
|
|
|
|
/// <summary>RynthAi's own sections beyond the core ones: none (Games went with RynthILT's tabs, 2026-10-20).</summary>
|
|
public static readonly Section[] OwnSections = Array.Empty<Section>();
|
|
|
|
/// <summary>The surface name of a tab's view ("section:pets").</summary>
|
|
public static string SurfaceOf(string tabId) => SurfacePrefix + tabId;
|
|
|
|
/// <summary>Every view RynthAi offers (the same on every world).</summary>
|
|
public static List<View> Views()
|
|
{
|
|
var views = new List<View>
|
|
{
|
|
// Every world. Session Stats first: a universal primary view, so RynthCore drops its own overview.
|
|
new("char", string.Empty, "Session stats", SessionSurface, true, new Vector2(360, 240), true, string.Empty,
|
|
"XP, luminance and kills this session, per hour (RynthAi; RynthTracker, RynthOracle and RynthILT show the same session).", 100),
|
|
new("pets", string.Empty, "Pets", PetsSurface, true, MiniRemoteTabs.Size(MiniRemoteTabs.Pets), true, string.Empty,
|
|
"Combat pets: the summon out, essences, and the pet picker (RynthAi).", 100),
|
|
new("crafting", string.Empty, "Crafting", CraftingSurface, true, MiniRemoteTabs.Size(MiniRemoteTabs.Crafting), true, string.Empty,
|
|
"Tinkering benches: retail tinks, your own rows and the server plugin's salvage (RynthAi).", 100),
|
|
new("spells", string.Empty, "Spells", SpellsSurface, true, new Vector2(900, 560), true, string.Empty,
|
|
"The spell catalog and buff profiles (RynthAi).", 100),
|
|
new("fellowship", string.Empty, "Fellowship", FellowshipSurface, true, new Vector2(380, 360), true, string.Empty,
|
|
"Your fellowship: members, leader, XP sharing (RynthAi; also RynthOracle's Fellowship tab).", 100),
|
|
};
|
|
return views;
|
|
}
|
|
|
|
/// <summary>
|
|
/// RynthAi's dashboard window (RynthAiPlugin.Dashboard.cs, 2026-10-21): the engine's "RynthAi" panel's
|
|
/// place ("takeOver": its saved spot, bar button, hotkeys and /rc commands), drawn whole by RynthAi
|
|
/// ("chrome": "none") and as tall as it draws ("fitHeight"), plugin API v90. The Robot icon is the
|
|
/// engine bar's for RynthAi.
|
|
/// </summary>
|
|
public const string DashboardTitle = "RynthAi", DashboardSurface = "window:dashboard";
|
|
|
|
/// <summary>
|
|
/// The Monster Stats window (RynthAiPlugin.MonsterStats.cs, 2026-10-30): combat per kind of monster
|
|
/// since login, drawn by RynthAi in the engine's frame (plugin API v89), declared only where the
|
|
/// Damage panel doesn't show the numbers under each monster. No bar button: the Session Stats view's
|
|
/// "Monster stats" button and /ra mstats show open it.
|
|
/// </summary>
|
|
public const string MonsterStatsTitle = RynthAiPlugin.MonsterStatsTitle, MonsterStatsSurface = RynthAiPlugin.MonsterStatsSurface;
|
|
|
|
/// <summary>
|
|
/// The Timed Commands window (RynthAiPlugin.TimedCommands.cs, 2026-11-03): commands sent every N
|
|
/// seconds, per character, server and for all, drawn by RynthAi (plugin API v89). No bar button
|
|
/// and no bar menu: the dashboard's options menu (Timed commands) and /ra timed show open it.
|
|
/// </summary>
|
|
public const string TimedCommandsTitle = RynthAiPlugin.TimedCommandsTitle, TimedCommandsSurface = RynthAiPlugin.TimedCommandsSurface;
|
|
|
|
/// <summary>
|
|
/// The Active Gear window (RynthAiPlugin.ActiveGear.cs, 2026-11-11): which worn items have their magic
|
|
/// on, their mana and time left, drawn by RynthAi in the engine's frame (plugin API v89). No bar button
|
|
/// and no bar menu: the dashboard's options menu (Active gear) and /ra gear open it.
|
|
/// </summary>
|
|
public const string ActiveGearTitle = RynthAiPlugin.ActiveGearTitle, ActiveGearSurface = RynthAiPlugin.ActiveGearSurface;
|
|
|
|
/// <summary>
|
|
/// The Find a Feature window (RynthAiPlugin.FeatureSearch.cs, 2026-11-13): searches the feature catalog
|
|
/// (Docs/features/*.json), drawn by RynthAi in the engine's frame (plugin API v89). No bar button (the
|
|
/// bar is full): the dashboard's options menu (Find a feature) and /ra find open it.
|
|
/// </summary>
|
|
public const string FeatureSearchTitle = RynthAiPlugin.FeatureSearchTitle, FeatureSearchSurface = RynthAiPlugin.FeatureSearchSurface;
|
|
|
|
/// <summary>
|
|
/// The manifest JSON for <paramref name="views"/> (UTF-8 text, schema version 1), with the dashboard
|
|
/// window when <paramref name="dashboard"/>, the Monster Stats window when <paramref name="monsterStats"/>,
|
|
/// the Timed Commands window when <paramref name="timedCommands"/>, the Active Gear window when
|
|
/// <paramref name="activeGear"/> and the Find a Feature window when <paramref name="featureSearch"/>.
|
|
/// </summary>
|
|
public static string Build(IReadOnlyList<View> views, IReadOnlyList<Section> sections, bool dashboard = false, bool monsterStats = false,
|
|
bool timedCommands = false, bool activeGear = false, bool featureSearch = false)
|
|
{
|
|
using var stream = new MemoryStream(4096);
|
|
using (var w = new Utf8JsonWriter(stream))
|
|
{
|
|
w.WriteStartObject();
|
|
w.WriteNumber("version", 1);
|
|
bool windows = dashboard || monsterStats || timedCommands || activeGear || featureSearch;
|
|
if (windows)
|
|
w.WriteStartArray("windows");
|
|
if (dashboard)
|
|
{
|
|
w.WriteStartObject();
|
|
w.WriteString("id", "dashboard");
|
|
w.WriteString("title", DashboardTitle);
|
|
w.WriteString("surface", DashboardSurface);
|
|
w.WriteString("icon", "");
|
|
w.WriteNumber("width", 296);
|
|
w.WriteNumber("height", 240);
|
|
w.WriteNumber("minWidth", 280);
|
|
w.WriteNumber("minHeight", 54);
|
|
w.WriteBoolean("bar", true);
|
|
w.WriteBoolean("edgeToEdge", true);
|
|
w.WriteBoolean("takeOver", true);
|
|
w.WriteString("chrome", "none");
|
|
w.WriteBoolean("fitHeight", true);
|
|
w.WriteEndObject();
|
|
}
|
|
if (monsterStats)
|
|
{
|
|
w.WriteStartObject();
|
|
w.WriteString("id", "monsterstats");
|
|
w.WriteString("title", MonsterStatsTitle);
|
|
w.WriteString("surface", MonsterStatsSurface);
|
|
w.WriteString("icon", RynthCore.Plugin.Shared.RynthUi.RynthIcons.ChartBar);
|
|
w.WriteNumber("width", 560);
|
|
w.WriteNumber("height", 360);
|
|
w.WriteNumber("minWidth", 380);
|
|
w.WriteNumber("minHeight", 160);
|
|
w.WriteBoolean("bar", false);
|
|
w.WriteBoolean("edgeToEdge", true);
|
|
w.WriteEndObject();
|
|
}
|
|
if (timedCommands)
|
|
{
|
|
w.WriteStartObject();
|
|
w.WriteString("id", "timedcommands");
|
|
w.WriteString("title", TimedCommandsTitle);
|
|
w.WriteString("surface", TimedCommandsSurface);
|
|
w.WriteString("icon", RynthCore.Plugin.Shared.RynthUi.RynthIcons.Hourglass);
|
|
w.WriteNumber("width", 640);
|
|
w.WriteNumber("height", 300);
|
|
w.WriteNumber("minWidth", 480);
|
|
w.WriteNumber("minHeight", 160);
|
|
w.WriteBoolean("bar", false);
|
|
w.WriteBoolean("edgeToEdge", true);
|
|
w.WriteEndObject();
|
|
}
|
|
if (activeGear)
|
|
{
|
|
w.WriteStartObject();
|
|
w.WriteString("id", "activegear");
|
|
w.WriteString("title", ActiveGearTitle);
|
|
w.WriteString("surface", ActiveGearSurface);
|
|
w.WriteString("icon", RynthCore.Plugin.Shared.RynthUi.RynthIcons.BatteryCharging);
|
|
w.WriteNumber("width", 640);
|
|
w.WriteNumber("height", 320);
|
|
w.WriteNumber("minWidth", 420);
|
|
w.WriteNumber("minHeight", 140);
|
|
w.WriteBoolean("bar", false);
|
|
w.WriteBoolean("edgeToEdge", true);
|
|
w.WriteEndObject();
|
|
}
|
|
if (featureSearch)
|
|
{
|
|
w.WriteStartObject();
|
|
w.WriteString("id", "featuresearch");
|
|
w.WriteString("title", FeatureSearchTitle);
|
|
w.WriteString("surface", FeatureSearchSurface);
|
|
w.WriteString("icon", RynthCore.Plugin.Shared.RynthUi.RynthIcons.MagnifyingGlass);
|
|
w.WriteNumber("width", 560);
|
|
w.WriteNumber("height", 460);
|
|
w.WriteNumber("minWidth", 360);
|
|
w.WriteNumber("minHeight", 200);
|
|
w.WriteBoolean("bar", false);
|
|
w.WriteBoolean("edgeToEdge", true);
|
|
w.WriteEndObject();
|
|
}
|
|
if (windows)
|
|
w.WriteEndArray();
|
|
w.WriteStartArray("sections");
|
|
foreach (Section s in sections)
|
|
{
|
|
w.WriteStartObject();
|
|
w.WriteString("id", s.Id);
|
|
w.WriteString("label", s.Label);
|
|
w.WriteNumber("order", s.Order);
|
|
w.WriteEndObject();
|
|
}
|
|
w.WriteEndArray();
|
|
w.WriteStartArray("contributions");
|
|
foreach (View v in views)
|
|
{
|
|
w.WriteStartObject();
|
|
w.WriteString("section", v.Section);
|
|
w.WriteString("server", v.Server);
|
|
w.WriteString("label", v.Label);
|
|
w.WriteString("surface", v.Surface);
|
|
w.WriteBoolean("primary", v.Primary);
|
|
if (v.Size.X > 0) w.WriteNumber("width", v.Size.X);
|
|
if (v.Size.Y > 0) w.WriteNumber("height", v.Size.Y);
|
|
w.WriteBoolean("enabled", v.Enabled);
|
|
if (v.Note.Length > 0) w.WriteString("note", v.Note);
|
|
if (v.Tooltip.Length > 0) w.WriteString("tooltip", v.Tooltip);
|
|
w.WriteNumber("order", v.Order);
|
|
w.WriteEndObject();
|
|
}
|
|
w.WriteEndArray();
|
|
w.WriteEndObject();
|
|
}
|
|
return Encoding.UTF8.GetString(stream.ToArray());
|
|
}
|
|
|
|
/// <summary>The Mini Remote tab of RynthAi's own a surface draws ("pets", "crafting"), if it is one.</summary>
|
|
public static bool TryOwnTabOf(string surface, out string tabId)
|
|
{
|
|
tabId = surface switch
|
|
{
|
|
PetsSurface => MiniRemoteTabs.Pets,
|
|
CraftingSurface => MiniRemoteTabs.Crafting,
|
|
_ => string.Empty,
|
|
};
|
|
return tabId.Length > 0;
|
|
}
|
|
|
|
}
|