From b0a3a7737d894dcb9a1c7e729113b073272ec3bd Mon Sep 17 00:00:00 2001 From: BlankenshipG Date: Mon, 5 Oct 2026 11:44:49 -0400 Subject: [PATCH] feat(engine): Settings > Charms Tracking tab - CharmsSource polls RynthPluginGetCharmsJson while the Settings panel is open - New last sidebar tab lists every ACECustom charm: acquired, ON/OFF, tier, server state - Changelog: 2026-10-05-charms-tracking-tab.md Co-authored-by: Cursor --- Changelog/2026-10-05-charms-tracking-tab.md | 58 +++++++ .../ImGui/Panels/SettingsFace.cs | 155 +++++++++++++++++- src/RynthCore.Engine/UI/Data/CharmsData.cs | 78 +++++++++ src/RynthCore.Engine/UI/Data/UiSources.cs | 2 + 4 files changed, 288 insertions(+), 5 deletions(-) create mode 100644 Changelog/2026-10-05-charms-tracking-tab.md create mode 100644 src/RynthCore.Engine/UI/Data/CharmsData.cs diff --git a/Changelog/2026-10-05-charms-tracking-tab.md b/Changelog/2026-10-05-charms-tracking-tab.md new file mode 100644 index 0000000..39b4690 --- /dev/null +++ b/Changelog/2026-10-05-charms-tracking-tab.md @@ -0,0 +1,58 @@ +# Charms Tracking tab (Settings) - RynthAi 0.5.10-legacy-ui + +Date: 2026-10-05 +Previous RynthAi version: 0.5.9-legacy-ui +Next installer: 2026.10.5.9 (not built yet; includes the Nav breadcrumb / route overlay toggles) + +## Charm list check against ACECustom + +RynthAi's charm registry (`IltHub/IltInventory.cs`, `Charms`) was compared with ACECustom's +`CharmAbilityRegistry.cs`. All 13 registry charms are present with every tier WCID: + +| Charm | WCIDs | Player ability flag | +|-------|-------|---------------------| +| Mana Barrier | 777700001, 777700054, 777710004, 777720004 | 50010 | +| Infinite Casting Stone | 777700019, 777700055 | 50028 | +| Asheron's Favor | 777700020, 777710002, 777720002 | 50030 | +| Artisan's | 777700021, 777710003, 777720003 | 50031 | +| Shrapnel | 777700022 | 50032 | +| Agony | 777700023 | 50033 | +| Split Cast | 777700024 | 50035 | +| Explosive Arrow | 777700025, 777710005, 777720005 | 50036 | +| Omni Strike | 777700026 | 50037 | +| Fork | 777700027, 777710007, 777720007 | 50039 | +| Auto-Rebuff | 777700300 | none (server keeps it in memory) | +| Summon Essence Refill | 78780030 | 9049 | +| Universal Summoning Mastery (universal pet charm) | 78780031 | 50038 | + +Guardian Hand is not an ACECustom registry charm; RynthAi still recognises it by name on the Gear window. + +## New: Settings > Charms Tracking + +The engine Settings panel has a new last sidebar tab, **Charms Tracking**, with one row per charm: + +- **Acquired**: `Carried` (in your pack or equipped, with a count when you have several), + `Stored` (this character carried it before; RynthAi remembers it per character in + `ilt-hub.json`, because the client only sees carried items) or `Not yet`. +- **Status**: `ON` / `OFF` from the charm's appraisal text ("Status: ON"), falling back to the + character's ability flag. Appraisal is requested automatically (throttled to every 30 s per item). +- **Tier**: current / max tier (CharmLevel / CharmMaxLevel, or "Charm [Tier x/y]" from the appraisal). +- **Server**: `Disabled` when the server refused the charm (Auto-Rebuff, Universal Summoning + Mastery) or a feature dump reported it off, `Enabled` when reported on, otherwise `-` + (players can't query the server's /charms list). +- Hover a charm name for its effect. A summary line shows how many are acquired and active. +- Off ILT worlds the tab says so and points to `/ra hub force on`. + +## Fix + +- Pets: an Infinite Casting Stone that is switched OFF no longer counts as "casting supplies" + (an OFF stone doesn't waive spell components). + +## Files + +- RynthSuite: `IltHub/IltCharmTracker.cs` (new), `IltHub/IltInventory.cs` (charm flags, effects, + tier reader, casting-stone check), `IltHub/IltHubState.cs` / `IltHubStore.cs` (`CharmsSeen`), + `IltHub/IltHubController.cs`, `PluginExports.cs` (`RynthPluginGetCharmsJson`), + `RynthAiPlugin.LocalFeatures.cs`, `RynthAiVersionCommand.cs` (0.5.10-legacy-ui). +- RynthCore: `UI/Data/CharmsData.cs` (new `CharmsSource`), `UI/Data/UiSources.cs`, + `ImGui/Panels/SettingsFace.cs` (Charms Tracking tab). \ No newline at end of file diff --git a/src/RynthCore.Engine/ImGui/Panels/SettingsFace.cs b/src/RynthCore.Engine/ImGui/Panels/SettingsFace.cs index 6f47a20..e37aac2 100644 --- a/src/RynthCore.Engine/ImGui/Panels/SettingsFace.cs +++ b/src/RynthCore.Engine/ImGui/Panels/SettingsFace.cs @@ -54,13 +54,24 @@ internal sealed class SettingsFace : IImGuiPanel } private readonly Dictionary _edits = new(); + /// Extra sidebar tab after the schema tabs; drawn from UiSources.Charms, not settings rows. + private const string CharmsTabName = "Charms Tracking"; + private static int CharmsTab => SettingsSchema.Tabs.Length; + private const string CharmsHeader = "Advanced Settings > " + CharmsTabName; + public void OnShown() { UiSources.Settings.Subscribe(); UiSources.Settings.RequestRefresh(); + UiSources.Charms.Subscribe(); + UiSources.Charms.RequestRefresh(); } - public void OnHidden() => UiSources.Settings.Unsubscribe(); + public void OnHidden() + { + UiSources.Settings.Unsubscribe(); + UiSources.Charms.Unsubscribe(); + } public void Draw() { @@ -100,9 +111,9 @@ internal sealed class SettingsFace : IImGuiPanel var dl = ImGuiNET.ImGui.GetWindowDrawList(); float w = ImGuiNET.ImGui.GetContentRegionAvail().X; SettingsTab[] tabs = SettingsSchema.Tabs; - for (int i = 0; i < tabs.Length; i++) + for (int i = 0; i <= tabs.Length; i++) { - string tabName = tabs[i].Name; + string tabName = i < tabs.Length ? tabs[i].Name : CharmsTabName; ImGuiNET.ImGui.Dummy(new Vector2(0, 1)); Vector2 p = ImGuiNET.ImGui.GetCursorScreenPos(); ImGuiNET.ImGui.PushID(i); @@ -133,14 +144,23 @@ internal sealed class SettingsFace : IImGuiPanel float w = ImGuiNET.ImGui.GetContentRegionAvail().X; ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.UiBold11)); - if (_tab >= SettingsSchema.Tabs.Length) _tab = 0; - ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFF26D9E6), Headers[_tab]); + if (_tab > CharmsTab) _tab = 0; + bool charms = _tab == CharmsTab; + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFF26D9E6), charms ? CharmsHeader : Headers[_tab]); ImGuiNET.ImGui.PopFont(); ImGuiNET.ImGui.Dummy(new Vector2(0, 4)); Vector2 lp = ImGuiNET.ImGui.GetCursorScreenPos(); dl.AddLine(lp, lp + new Vector2(w, 0), BtnBord); ImGuiNET.ImGui.Dummy(new Vector2(0, 6)); + if (charms) + { + CharmsTabContent(w); + ImGuiNET.ImGui.PopStyleVar(); + ImGuiNET.ImGui.EndChild(); + return; + } + SettingRow[] rows = SettingsSchema.Tabs[_tab].Rows; for (int i = 0; i < rows.Length; i++) { @@ -397,6 +417,130 @@ internal sealed class SettingsFace : IImGuiPanel } } + // ── Charms Tracking tab ─────────────────────────────────────────────── + + private static readonly uint CharmOn = C(0xFF33FF33), CharmDisabled = C(0xFFFF5555); + + /// Summary line, one table row per ACECustom registry charm, then how each column is known. + private static void CharmsTabContent(float w) + { + var snap = UiSources.Charms.Current; + if (snap == null) + { + Note("Waiting for RynthAi...", w); + return; + } + CharmsInfo info = snap.Value; + if (!info.Available) + { + Note("Charm tracking is for ILT (Infinite Leaftide / ACECustom) worlds." + + (info.World.Length > 0 ? " Current world: " + info.World + "." : ""), w); + Note("Use /ra hub force on to treat this world as ILT.", w); + return; + } + + ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.UiBold11)); + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFE8B333), + $"{info.AcquiredCount} of {info.Total} acquired | {info.ActiveCount} active"); + ImGuiNET.ImGui.PopFont(); + ImGuiNET.ImGui.Dummy(new Vector2(0, 4)); + + ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(4, 3)); + ImGuiNET.ImGui.PushStyleColor(ImGuiCol.TableRowBg, PanelBg); + ImGuiNET.ImGui.PushStyleColor(ImGuiCol.TableRowBgAlt, ShellBg); + ImGuiNET.ImGui.PushStyleColor(ImGuiCol.TableHeaderBg, TabActive); + ImGuiNET.ImGui.PushStyleColor(ImGuiCol.TableBorderLight, BtnBord); + const ImGuiTableFlags flags = ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersInnerH | ImGuiTableFlags.SizingFixedFit; + if (ImGuiNET.ImGui.BeginTable("##charms", 5, flags, new Vector2(w, 0))) + { + ImGuiNET.ImGui.TableSetupColumn("Charm", ImGuiTableColumnFlags.WidthStretch); + ImGuiNET.ImGui.TableSetupColumn("Acquired", ImGuiTableColumnFlags.WidthFixed, 70); + ImGuiNET.ImGui.TableSetupColumn("Status", ImGuiTableColumnFlags.WidthFixed, 44); + ImGuiNET.ImGui.TableSetupColumn("Tier", ImGuiTableColumnFlags.WidthFixed, 32); + ImGuiNET.ImGui.TableSetupColumn("Server", ImGuiTableColumnFlags.WidthFixed, 56); + ImGuiNET.ImGui.TableHeadersRow(); + + CharmRow[] rows = info.Charms; + for (int i = 0; i < rows.Length; i++) + { + CharmRow r = rows[i]; + ImGuiNET.ImGui.PushID(i); + ImGuiNET.ImGui.TableNextRow(); + + ImGuiNET.ImGui.TableNextColumn(); + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFF2F7FC), r.Name); + if (r.Effect.Length > 0) ImGuiNET.ImGui.SetItemTooltip(r.Effect); + + ImGuiNET.ImGui.TableNextColumn(); + switch (r.Acquired) + { + case "carried": + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFF26D9E6), r.Count > 1 ? $"Carried x{r.Count}" : "Carried"); + ImGuiNET.ImGui.SetItemTooltip("In your pack or equipped."); + break; + case "seen": + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFE8B333), "Stored"); + ImGuiNET.ImGui.SetItemTooltip("Owned but not carried" + + (r.LastSeen.Length > 0 ? " (last carried " + r.LastSeen + ")" : "") + + ". The client only sees items you carry."); + break; + default: + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFB8C8D8), "Not yet"); + break; + } + + ImGuiNET.ImGui.TableNextColumn(); + if (r.Acquired != "carried") + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFB8C8D8), "-"); + else if (r.Active == "on") + ColoredText(CharmOn, "ON"); + else if (r.Active == "off") + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFB8C8D8), "OFF"); + else + { + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFE8B333), "?"); + ImGuiNET.ImGui.SetItemTooltip("Waiting for the charm's appraisal (requested automatically)."); + } + + ImGuiNET.ImGui.TableNextColumn(); + string tier = r.Tier <= 0 ? "-" : r.MaxTier > 0 ? $"{r.Tier}/{r.MaxTier}" : r.Tier.ToString(CultureInfo.InvariantCulture); + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFF2F7FC), tier); + + ImGuiNET.ImGui.TableNextColumn(); + if (r.Server == "off") + { + ColoredText(CharmDisabled, "Disabled"); + ImGuiNET.ImGui.SetItemTooltip("The server refused or reported this charm as disabled."); + } + else if (r.Server == "on") + ColoredText(CharmOn, "Enabled"); + else + { + ImGuiNET.ImGui.TextColored(RynthTheme.Vec(0xFFB8C8D8), "-"); + ImGuiNET.ImGui.SetItemTooltip("Not reported. The server only tells players when a charm is refused."); + } + + ImGuiNET.ImGui.PopID(); + } + ImGuiNET.ImGui.EndTable(); + } + ImGuiNET.ImGui.PopStyleColor(4); + ImGuiNET.ImGui.PopStyleVar(); + + ImGuiNET.ImGui.Dummy(new Vector2(0, 6)); + Note("Double-click a carried charm in your pack to toggle it. Status comes from the charm's appraisal " + + "(Status: ON/OFF) or your character's ability flag. Charms not carried are inactive.", w); + Note("Stored = carried by this character before; RynthAi remembers it per character.", w); + } + + /// TextUnformatted in a packed ImGui colour. + private static void ColoredText(uint abgr, string text) + { + ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Text, abgr); + ImGuiNET.ImGui.TextUnformatted(text); + ImGuiNET.ImGui.PopStyleColor(); + } + private static bool StepButton(string id, Vector2 pos, string glyph) { var dl = ImGuiNET.ImGui.GetWindowDrawList(); @@ -424,6 +568,7 @@ internal sealed class SettingsFace : IImGuiPanel ["Crafting"] = PhosphorIcons.Hammer, ["Looting"] = PhosphorIcons.Bag, ["Vendoring"] = PhosphorIcons.Storefront, + [CharmsTabName] = PhosphorIcons.Gift, }; private static readonly System.Collections.Generic.Dictionary TabLabels = new(); diff --git a/src/RynthCore.Engine/UI/Data/CharmsData.cs b/src/RynthCore.Engine/UI/Data/CharmsData.cs new file mode 100644 index 0000000..3d3cac4 --- /dev/null +++ b/src/RynthCore.Engine/UI/Data/CharmsData.cs @@ -0,0 +1,78 @@ +// ============================================================================ +// RynthCore.Engine - UI/Data/CharmsData.cs +// RynthAi's ACECustom charm tracker for the Settings panel's "Charms +// Tracking" tab. RynthAi owns the charm registry (WCIDs, ability flags) and +// the per-character "seen" memory; this side only shows the snapshot. +// ============================================================================ + +using System; +using System.Runtime.InteropServices; +using System.Text.Json; +using System.Text.Json.Serialization; +using RynthCore.Engine.Plugins; + +namespace RynthCore.Engine.UI.Data; + +/// RynthPluginGetCharmsJson's payload. +internal sealed class CharmsInfo +{ + /// False off ILT-like worlds (or before RynthAi's ILT Hub exists). + [JsonPropertyName("available")] public bool Available { get; set; } + [JsonPropertyName("world")] public string World { get; set; } = ""; + [JsonPropertyName("total")] public int Total { get; set; } + [JsonPropertyName("acquiredCount")] public int AcquiredCount { get; set; } + [JsonPropertyName("activeCount")] public int ActiveCount { get; set; } + [JsonPropertyName("charms")] public CharmRow[] Charms { get; set; } = Array.Empty(); +} + +internal sealed class CharmRow +{ + [JsonPropertyName("name")] public string Name { get; set; } = ""; + [JsonPropertyName("effect")] public string Effect { get; set; } = ""; + /// "carried" (in pack / equipped now), "seen" (carried before, now elsewhere) or "no". + [JsonPropertyName("acquired")] public string Acquired { get; set; } = "no"; + /// Copies carried right now. + [JsonPropertyName("count")] public int Count { get; set; } + /// Best tier carried or last seen; 0 until an appraisal reports it. + [JsonPropertyName("tier")] public int Tier { get; set; } + [JsonPropertyName("maxTier")] public int MaxTier { get; set; } + /// Ability toggled on: "on", "off" or "unknown". + [JsonPropertyName("active")] public string Active { get; set; } = "unknown"; + /// Server-side global switch as far as the client has learned it: "on", "off" or "unknown". + [JsonPropertyName("server")] public string Server { get; set; } = "unknown"; + /// yyyy-MM-dd the charm was last carried (empty when never). + [JsonPropertyName("lastSeen")] public string LastSeen { get; set; } = ""; +} + +[JsonSerializable(typeof(CharmsInfo))] +internal sealed partial class CharmsJsonContext : JsonSerializerContext { } + +/// +/// RynthPluginGetCharmsJson (single static buffer: one caller only) while the Settings panel +/// is open. Every 2 s is plenty: charm state only changes when one is picked up or toggled. +/// +internal sealed unsafe class CharmsSource : UiSource +{ + private delegate* unmanaged[Cdecl] _getCharmsJson; + + public CharmsSource() : base("Charms", periodMs: 2000) { } + + protected internal override void Poll() + { + if (_getCharmsJson == null) + _getCharmsJson = (delegate* unmanaged[Cdecl])PluginExportBinder.Resolve("RynthAi", "RynthPluginGetCharmsJson"); + if (_getCharmsJson == null) return; + IntPtr p = _getCharmsJson(); + string json = p == IntPtr.Zero ? "{}" : Marshal.PtrToStringAnsi(p) ?? "{}"; + CharmsInfo info; + try { info = JsonSerializer.Deserialize(json, CharmsJsonContext.Default.CharmsInfo) ?? new CharmsInfo(); } + catch (JsonException) { info = new CharmsInfo(); } + Publish(info); + } + + protected internal override void Reset() + { + _getCharmsJson = null; + ClearSnapshot(); + } +} diff --git a/src/RynthCore.Engine/UI/Data/UiSources.cs b/src/RynthCore.Engine/UI/Data/UiSources.cs index 62aab2e..4be0072 100644 --- a/src/RynthCore.Engine/UI/Data/UiSources.cs +++ b/src/RynthCore.Engine/UI/Data/UiSources.cs @@ -17,6 +17,7 @@ internal static class UiSources public static readonly RynthAiSource RynthAi = new(); public static readonly PatrolSource Patrol = new(); public static readonly ProgressionSource Progression = new(); + public static readonly CharmsSource Charms = new(); public static readonly RadarSource Radar = new(); public static readonly SettingsSource Settings = new(); public static readonly MetaSource Meta = new(); @@ -54,6 +55,7 @@ internal static class UiSources UiDataHub.Register(RynthAi); UiDataHub.Register(Patrol); UiDataHub.Register(Progression); + UiDataHub.Register(Charms); UiDataHub.Register(PluginStatus); UiDataHub.Register(Log); UiDataHub.Register(Tracker);