SK fork: SK-local features through release 2026.10.5.12 #1
5 changed files with 351 additions and 5 deletions
feat(ui): attribute raiser on the Progression tab, Server Features text row
Skills panel > Progression gains an "Attribute raiser (infinite attributes)" section for RynthAi's new IltAttributeRaiser: unassigned XP, Raise now / Stop / Refresh costs, auto-raise every N minutes, raise-order mode (priority, round robin, cheapest), an XP reserve, and a row per attribute/vital with a tick (what may be spent on), the client's base value, the server's next-level cost, up/down order arrows and +1 / +10. Edits go back as "prog attr..." commands. An older RynthAi (no "attr" in the snapshot) shows "Update RynthAi". Settings > Misc gains "Server Features (ILT / infinite attributes)": a status line, the server-name list (comma separated, * wildcard) and a manual override. To carry the list, the settings schema gets two row kinds, Text (commits on Enter or focus loss) and Status (read-only line), drawn by both the ImGui and the Avalonia faces. RynthAi lays a save over its current values, so an older RynthAi just ignores the new fields. Pairs with RynthSuite SK-local (RynthAi 0.5.14-legacy-ui). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019zqH4e21Ceruc5ussksSjy
commit
b361152949
|
|
@ -53,6 +53,8 @@ internal sealed class SettingsFace : IImGuiPanel
|
|||
public bool Active; // the box had keyboard focus last frame
|
||||
}
|
||||
private readonly Dictionary<SettingRow, NumberEdit> _edits = new();
|
||||
// Text rows being typed in (the saved value shows again once the box loses focus).
|
||||
private readonly Dictionary<SettingRow, string> _textEdits = new();
|
||||
|
||||
/// <summary>Extra sidebar tab after the schema tabs; drawn from UiSources.Charms, not settings rows.</summary>
|
||||
private const string CharmsTabName = "Charms Tracking";
|
||||
|
|
@ -190,6 +192,8 @@ internal sealed class SettingsFace : IImGuiPanel
|
|||
case SettingKind.CraftingStatus: CraftingStatus(row); break;
|
||||
case SettingKind.Button: ButtonRow(row, w); break;
|
||||
case SettingKind.TraceCategories: TraceCategoriesRow(row, w); break;
|
||||
case SettingKind.Text: TextRow(row, w); break;
|
||||
case SettingKind.Status: StatusRow(row, w); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -245,6 +249,59 @@ internal sealed class SettingsFace : IImGuiPanel
|
|||
SettingsCommands.Save(_data.Clone());
|
||||
}
|
||||
|
||||
// Label, then a full-width box; the value commits on Enter or focus loss (like the number boxes).
|
||||
private void TextRow(SettingRow row, float w)
|
||||
{
|
||||
ImGuiNET.ImGui.Dummy(new Vector2(0, 2));
|
||||
ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Text, TextDim);
|
||||
ImGuiNET.ImGui.TextUnformatted(row.Label);
|
||||
ImGuiNET.ImGui.PopStyleColor();
|
||||
Tooltip(row);
|
||||
|
||||
string saved = row.GetText?.Invoke(_data) ?? string.Empty;
|
||||
string text = _textEdits.TryGetValue(row, out string? typing) ? typing : saved;
|
||||
ImGuiNET.ImGui.SetNextItemWidth(Math.Max(80, w - 4));
|
||||
ImGuiNET.ImGui.PushStyleColor(ImGuiCol.FrameBg, PanelBg);
|
||||
ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Text, Amber);
|
||||
ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Border, BtnBord);
|
||||
ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1f);
|
||||
ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 0f);
|
||||
bool enter = ImGuiNET.ImGui.InputTextWithHint("##text", row.Hint ?? string.Empty, ref text, 512u,
|
||||
ImGuiInputTextFlags.EnterReturnsTrue);
|
||||
bool active = ImGuiNET.ImGui.IsItemActive();
|
||||
bool committed = enter || ImGuiNET.ImGui.IsItemDeactivatedAfterEdit();
|
||||
ImGuiNET.ImGui.PopStyleVar(2);
|
||||
ImGuiNET.ImGui.PopStyleColor(3);
|
||||
Tooltip(row);
|
||||
_editing |= active;
|
||||
|
||||
if (committed)
|
||||
{
|
||||
_textEdits.Remove(row);
|
||||
if (!string.Equals(text, saved, StringComparison.Ordinal))
|
||||
{
|
||||
row.SetText?.Invoke(_data, text);
|
||||
SettingsCommands.Save(_data.Clone());
|
||||
}
|
||||
}
|
||||
else if (active) _textEdits[row] = text;
|
||||
else _textEdits.Remove(row);
|
||||
ImGuiNET.ImGui.Dummy(new Vector2(0, 2));
|
||||
}
|
||||
|
||||
// RynthAi's one-line status (teal), wrapped to the column.
|
||||
private void StatusRow(SettingRow row, float w)
|
||||
{
|
||||
string text = row.GetText?.Invoke(_data) ?? string.Empty;
|
||||
if (text.Length == 0) return;
|
||||
ImGuiNET.ImGui.Dummy(new Vector2(0, 2));
|
||||
ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Text, Teal);
|
||||
ImGuiNET.ImGui.PushTextWrapPos(ImGuiNET.ImGui.GetCursorPosX() + w);
|
||||
ImGuiNET.ImGui.TextUnformatted(text);
|
||||
ImGuiNET.ImGui.PopTextWrapPos();
|
||||
ImGuiNET.ImGui.PopStyleColor();
|
||||
}
|
||||
|
||||
// Label | [caption]; Click posts its own work (never runs plugin code on AC's thread).
|
||||
private static void ButtonRow(SettingRow row, float w)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
// The Skills panel's Progression tab, shown on ILT-like worlds only:
|
||||
// - XP planner: exact XP for the next N raises of every attribute and vital,
|
||||
// from the client's XP tables (raising stays on the Attributes & Vitals tab).
|
||||
// - Attribute raiser: infinite attributes past the retail cap. RynthAi reads the
|
||||
// server's costs ("/xp all") and raises with "/attr", by hand (+1 / +10) or on a
|
||||
// timer from unassigned XP, in the order and mode set here.
|
||||
// - Augmentations / Enlightenment: RynthAi's ILT Hub planners. RynthAi owns the
|
||||
// math and the saved inputs (UiSources.Progression snapshot); edits and
|
||||
// actions go back as "prog ..." remote commands. /enl and arming
|
||||
|
|
@ -10,6 +13,7 @@
|
|||
// ============================================================================
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using ImGuiNET;
|
||||
|
|
@ -99,6 +103,8 @@ internal sealed partial class SkillsFace
|
|||
Message("Augmentations and Enlightenment need RynthAi's ILT Hub on an ILT world.", w);
|
||||
return;
|
||||
}
|
||||
DrawAttrRaiser(info.Attr, w);
|
||||
ImGuiNET.ImGui.Dummy(new Vector2(0, 6));
|
||||
DrawAugPlanner(info.Aug, w);
|
||||
ImGuiNET.ImGui.Dummy(new Vector2(0, 6));
|
||||
DrawEnlPlanner(info.Enl, w);
|
||||
|
|
@ -136,7 +142,8 @@ internal sealed partial class SkillsFace
|
|||
foreach (Row r in _vitals) PlannerRow(r, have);
|
||||
ImGuiNET.ImGui.EndTable();
|
||||
}
|
||||
Label("Exact costs from the client's XP tables. Raise on the Attributes & Vitals tab.", Dim);
|
||||
Label("Exact costs from the client's XP tables. Raise on the Attributes & Vitals tab"
|
||||
+ (ProgressionTabVisible ? ", or past the cap with the Attribute raiser below." : "."), Dim);
|
||||
ImGuiNET.ImGui.Unindent(8);
|
||||
}
|
||||
|
||||
|
|
@ -159,6 +166,152 @@ internal sealed partial class SkillsFace
|
|||
Label(text, many >= 0 && many <= have ? Teal : Dim);
|
||||
}
|
||||
|
||||
private static readonly string[] AttrModes =
|
||||
{
|
||||
"Priority - top of the order first",
|
||||
"Round robin - one level each, in order",
|
||||
"Cheapest next level first",
|
||||
};
|
||||
|
||||
private string? _attrKeepEdit; // reserve box being typed in (null = show RynthAi's value)
|
||||
private int? _attrEveryEdit; // interval box being typed in
|
||||
|
||||
private void DrawAttrRaiser(AttrRaiser? a, float w)
|
||||
{
|
||||
Section("Attribute raiser (infinite attributes)", w);
|
||||
ImGuiNET.ImGui.Indent(8);
|
||||
float wrap = ImGuiNET.ImGui.GetCursorPosX() + w - 24;
|
||||
ImGuiNET.ImGui.PushTextWrapPos(wrap);
|
||||
try
|
||||
{
|
||||
if (a == null) { Label("Update RynthAi to use the attribute raiser.", Mute); return; }
|
||||
if (a.Off) { Label(a.Reason, Mute); return; }
|
||||
|
||||
Label(a.Unassigned, Teal);
|
||||
Vector2 p = ImGuiNET.ImGui.GetCursorScreenPos();
|
||||
if (a.Running)
|
||||
{
|
||||
if (Button("##attr_stop", "Stop", p, new Vector2(90, 24), Text, StopBg)) SendProg("attrstop");
|
||||
}
|
||||
else if (Button("##attr_run", "Raise now", p, new Vector2(110, 24), Text, StartBg, border: Teal))
|
||||
SendProg("attrrun");
|
||||
if (Button("##attr_costs", "Refresh costs", new Vector2(p.X + 116, p.Y), new Vector2(110, 24), Text, BtnFill))
|
||||
SendProg("attrcosts");
|
||||
NextLine(p, 28);
|
||||
if (a.Status.Length > 0) ImGuiNET.ImGui.TextWrapped(a.Status);
|
||||
if (a.LastRun.Length > 0) Label("Last run: " + a.LastRun, Dim);
|
||||
|
||||
ImGuiNET.ImGui.Separator();
|
||||
bool auto = a.Auto;
|
||||
if (ImGuiNET.ImGui.Checkbox("Auto-raise from unassigned XP##attr_auto", ref auto))
|
||||
SendProg("attrauto " + (auto ? "on" : "off"));
|
||||
ImGuiNET.ImGui.SameLine();
|
||||
// Commit on Enter, the +/- buttons or focus loss (not on every keystroke: each send
|
||||
// restarts the auto-raise timer).
|
||||
int every = _attrEveryEdit ?? a.Every;
|
||||
ImGuiNET.ImGui.SetNextItemWidth(90);
|
||||
bool everyCommit = ImGuiNET.ImGui.InputInt("every (min)##attr_every", ref every, 1, 10, ImGuiInputTextFlags.EnterReturnsTrue);
|
||||
bool everyActive = ImGuiNET.ImGui.IsItemActive();
|
||||
if (everyCommit || ImGuiNET.ImGui.IsItemDeactivatedAfterEdit())
|
||||
{
|
||||
_attrEveryEdit = null;
|
||||
if (every != a.Every) SendProg("attrevery " + Math.Clamp(every, 1, 1440).ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
else _attrEveryEdit = everyActive ? every : null;
|
||||
if (a.Auto && a.Next.Length > 0) Label($"Next auto-raise: {a.Next}", Dim);
|
||||
|
||||
int mode = Math.Clamp(a.Mode, 0, AttrModes.Length - 1);
|
||||
ImGuiNET.ImGui.SetNextItemWidth(260);
|
||||
if (ImGuiNET.ImGui.Combo("Raise order##attr_mode", ref mode, AttrModes, AttrModes.Length))
|
||||
SendProg("attrmode " + mode.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
// The box holds the exact reserve (KeepFull); it is sent only when the text changed, so an
|
||||
// Enter on an untouched box can't round the reserve.
|
||||
string shownKeep = a.KeepFull.Length > 0 ? a.KeepFull : a.Keep;
|
||||
string keep = _attrKeepEdit ?? shownKeep;
|
||||
ImGuiNET.ImGui.SetNextItemWidth(140);
|
||||
bool enter = ImGuiNET.ImGui.InputTextWithHint("Keep in reserve (XP)##attr_keep", "0, 500m, 2b", ref keep, 32u,
|
||||
ImGuiInputTextFlags.EnterReturnsTrue);
|
||||
bool keepActive = ImGuiNET.ImGui.IsItemActive();
|
||||
if (enter || ImGuiNET.ImGui.IsItemDeactivatedAfterEdit())
|
||||
{
|
||||
_attrKeepEdit = null;
|
||||
if (!string.Equals(keep.Trim(), shownKeep, StringComparison.Ordinal))
|
||||
SendProg("attrkeep " + keep.Replace(" ", "", StringComparison.Ordinal).Replace(",", "", StringComparison.Ordinal));
|
||||
}
|
||||
else _attrKeepEdit = keepActive ? keep : null;
|
||||
ImGuiNET.ImGui.SetItemTooltip("Unassigned XP the raiser never spends. Accepts k / m / b / t suffixes.");
|
||||
|
||||
DrawAttrTable(a, w);
|
||||
Label("Tick the stats Raise now / auto-raise may spend on; arrows set the order. " + a.CostsAge + ".", Dim);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ImGuiNET.ImGui.PopTextWrapPos();
|
||||
ImGuiNET.ImGui.Unindent(8);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawAttrTable(AttrRaiser a, float w)
|
||||
{
|
||||
if (!ImGuiNET.ImGui.BeginTable("##prog_attr", 5, ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersInnerV | ImGuiTableFlags.SizingStretchProp,
|
||||
new Vector2(w - 16, 0)))
|
||||
return;
|
||||
ImGuiNET.ImGui.TableSetupColumn("Raise", ImGuiTableColumnFlags.WidthFixed, 40);
|
||||
ImGuiNET.ImGui.TableSetupColumn("Stat");
|
||||
ImGuiNET.ImGui.TableSetupColumn("Base", ImGuiTableColumnFlags.WidthFixed, 56);
|
||||
ImGuiNET.ImGui.TableSetupColumn("Next level", ImGuiTableColumnFlags.WidthFixed, 80);
|
||||
ImGuiNET.ImGui.TableSetupColumn("Order / by hand", ImGuiTableColumnFlags.WidthFixed, 150);
|
||||
ImGuiNET.ImGui.TableHeadersRow();
|
||||
for (int i = 0; i < a.Rows.Length; i++)
|
||||
{
|
||||
AttrRow r = a.Rows[i];
|
||||
ImGuiNET.ImGui.PushID("attr_" + r.Key);
|
||||
ImGuiNET.ImGui.TableNextRow();
|
||||
|
||||
ImGuiNET.ImGui.TableNextColumn();
|
||||
bool on = r.On;
|
||||
if (ImGuiNET.ImGui.Checkbox("##on", ref on)) SendProg($"attron {r.Key} {(on ? "on" : "off")}");
|
||||
|
||||
ImGuiNET.ImGui.TableNextColumn();
|
||||
Label($"{i + 1}. {r.Label}", r.On ? Text : Mute);
|
||||
|
||||
ImGuiNET.ImGui.TableNextColumn();
|
||||
int clientBase = ClientBase(r);
|
||||
Label(clientBase > 0 ? clientBase.ToString("N0", CultureInfo.InvariantCulture)
|
||||
: r.Base >= 0 ? r.Base.ToString("N0", CultureInfo.InvariantCulture) : "-", Text);
|
||||
|
||||
ImGuiNET.ImGui.TableNextColumn();
|
||||
Label(r.Cost, r.Afford ? Teal : Dim);
|
||||
|
||||
ImGuiNET.ImGui.TableNextColumn();
|
||||
ImGuiNET.ImGui.BeginDisabled(i == 0);
|
||||
if (ImGuiNET.ImGui.ArrowButton("##up", ImGuiDir.Up)) SendProg($"attrmove {r.Key} up");
|
||||
ImGuiNET.ImGui.EndDisabled();
|
||||
ImGuiNET.ImGui.SameLine(0, 2);
|
||||
ImGuiNET.ImGui.BeginDisabled(i == a.Rows.Length - 1);
|
||||
if (ImGuiNET.ImGui.ArrowButton("##down", ImGuiDir.Down)) SendProg($"attrmove {r.Key} down");
|
||||
ImGuiNET.ImGui.EndDisabled();
|
||||
ImGuiNET.ImGui.SameLine(0, 6);
|
||||
ImGuiNET.ImGui.BeginDisabled(a.Running);
|
||||
if (ImGuiNET.ImGui.SmallButton("+1")) SendProg($"attrraise {r.Key} 1");
|
||||
ImGuiNET.ImGui.SameLine(0, 2);
|
||||
if (ImGuiNET.ImGui.SmallButton("+10")) SendProg($"attrraise {r.Key} 10");
|
||||
ImGuiNET.ImGui.EndDisabled();
|
||||
ImGuiNET.ImGui.PopID();
|
||||
}
|
||||
ImGuiNET.ImGui.EndTable();
|
||||
}
|
||||
|
||||
/// <summary>The client's own base value for a raiser row (0 when the snapshot has none).</summary>
|
||||
private int ClientBase(AttrRow r)
|
||||
{
|
||||
List<Row> rows = r.Vital ? _vitals : _attributes;
|
||||
foreach (Row row in rows)
|
||||
if (row.Name.Equals(r.Label, StringComparison.OrdinalIgnoreCase)) return row.Base;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void DrawAugPlanner(AugPlanner a, float w)
|
||||
{
|
||||
Section("Augmentations", w);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// ============================================================================
|
||||
// RynthCore.Engine - UI/Data/ProgressionData.cs
|
||||
// RynthAi's ILT progression planners (augmentations, enlightenment) for the
|
||||
// Skills panel's Progression tab. RynthAi owns the math and the persisted
|
||||
// RynthAi's ILT progression planners (augmentations, enlightenment) and the
|
||||
// infinite-attribute raiser for the Skills panel's Progression tab. RynthAi owns the math and the persisted
|
||||
// inputs; this side only shows the snapshot and sends "prog ..." remote
|
||||
// commands (RynthAiCommands.ApplyRemoteCommand) for edits and actions.
|
||||
// ============================================================================
|
||||
|
|
@ -22,6 +22,49 @@ internal sealed class ProgressionInfo
|
|||
[JsonPropertyName("world")] public string World { get; set; } = "";
|
||||
[JsonPropertyName("aug")] public AugPlanner Aug { get; set; } = new();
|
||||
[JsonPropertyName("enl")] public EnlPlanner Enl { get; set; } = new();
|
||||
/// <summary>Absent from an older RynthAi: stays empty and the section shows "update RynthAi".</summary>
|
||||
[JsonPropertyName("attr")] public AttrRaiser? Attr { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>RynthAi's IltAttributeRaiser: server costs ("/xp all") and the raise settings.</summary>
|
||||
internal sealed class AttrRaiser
|
||||
{
|
||||
/// <summary>The raiser can't run here; <see cref="Reason"/> says why.</summary>
|
||||
[JsonPropertyName("off")] public bool Off { get; set; }
|
||||
[JsonPropertyName("reason")] public string Reason { get; set; } = "";
|
||||
[JsonPropertyName("auto")] public bool Auto { get; set; }
|
||||
/// <summary>Minutes between auto-raise runs.</summary>
|
||||
[JsonPropertyName("every")] public int Every { get; set; } = 5;
|
||||
/// <summary>0 priority, 1 round robin, 2 cheapest first.</summary>
|
||||
[JsonPropertyName("mode")] public int Mode { get; set; }
|
||||
[JsonPropertyName("running")] public bool Running { get; set; }
|
||||
/// <summary>XP reserve, preformatted ("0", "1.50B").</summary>
|
||||
[JsonPropertyName("keep")] public string Keep { get; set; } = "0";
|
||||
/// <summary>XP reserve in full ("1,234,567"): what the reserve box edits.</summary>
|
||||
[JsonPropertyName("keepFull")] public string KeepFull { get; set; } = "";
|
||||
[JsonPropertyName("status")] public string Status { get; set; } = "";
|
||||
[JsonPropertyName("lastRun")] public string LastRun { get; set; } = "";
|
||||
[JsonPropertyName("unassigned")] public string Unassigned { get; set; } = "";
|
||||
/// <summary>Time to the next auto run ("" when auto is off).</summary>
|
||||
[JsonPropertyName("next")] public string Next { get; set; } = "";
|
||||
[JsonPropertyName("costsAge")] public string CostsAge { get; set; } = "";
|
||||
/// <summary>In raise-priority order.</summary>
|
||||
[JsonPropertyName("rows")] public AttrRow[] Rows { get; set; } = Array.Empty<AttrRow>();
|
||||
}
|
||||
|
||||
internal sealed class AttrRow
|
||||
{
|
||||
/// <summary>/attr abbreviation: str end coo qui foc sel hea sta man.</summary>
|
||||
[JsonPropertyName("key")] public string Key { get; set; } = "";
|
||||
[JsonPropertyName("label")] public string Label { get; set; } = "";
|
||||
[JsonPropertyName("vital")] public bool Vital { get; set; }
|
||||
/// <summary>Ticked: "Raise now" and auto-raise may spend on it.</summary>
|
||||
[JsonPropertyName("on")] public bool On { get; set; }
|
||||
/// <summary>Base value RynthAi last saw in a server reply (-1 = unknown; the panel prefers the client's).</summary>
|
||||
[JsonPropertyName("base")] public int Base { get; set; } = -1;
|
||||
/// <summary>Next-level cost from "/xp all", preformatted ("?" until read).</summary>
|
||||
[JsonPropertyName("cost")] public string Cost { get; set; } = "?";
|
||||
[JsonPropertyName("afford")] public bool Afford { get; set; }
|
||||
}
|
||||
|
||||
internal sealed class AugPlanner
|
||||
|
|
|
|||
|
|
@ -45,6 +45,13 @@ internal sealed class RynthAiSettings
|
|||
// Decal bridge: stop RynthAi's macro when VTank's starts (one bot per client). Default on;
|
||||
// an older RynthAi doesn't send it, and a missing field must not read as "off".
|
||||
public bool YieldToVTank { get; set; } = true;
|
||||
// Server Features (RynthAi ServerFeatureGate): world names that turn on the ILT Hub, the
|
||||
// Progression planners and the attribute raiser, plus a manual override. An older RynthAi
|
||||
// doesn't send them; RynthAi lays a save over its current values, so these defaults are
|
||||
// only ever shown, never applied. ServerFeaturesStatus is read-only (RynthAi ignores it).
|
||||
public string FeatureServerNames { get; set; } = "InfiniteLeaftide, *Leaftide*";
|
||||
public bool ForceServerFeatures { get; set; }
|
||||
public string ServerFeaturesStatus { get; set; } = string.Empty;
|
||||
public bool EnableRaycasting { get; set; }
|
||||
public bool UseArcs { get; set; }
|
||||
public float BowArcVelocity { get; set; } = 25f;
|
||||
|
|
@ -283,7 +290,7 @@ internal static unsafe class SettingsCommands
|
|||
|
||||
// ── Schema ─────────────────────────────────────────────────────────────────
|
||||
|
||||
internal enum SettingKind { Bool, Int, Float, Double, Combo, Section, Spacer, Note, CraftingStatus, Button, TraceCategories }
|
||||
internal enum SettingKind { Bool, Int, Float, Double, Combo, Section, Spacer, Note, CraftingStatus, Button, TraceCategories, Text, Status }
|
||||
|
||||
/// <summary>
|
||||
/// Reads and edits <see cref="RynthAiSettings.DiagCategories"/> ("Name=Level,..."). The category
|
||||
|
|
@ -357,7 +364,12 @@ internal sealed record SettingRow(
|
|||
bool Gates = false,
|
||||
// Button rows: the button's caption (Label is the row label) and its action. Any thread.
|
||||
string? ButtonText = null,
|
||||
Action? Click = null)
|
||||
Action? Click = null,
|
||||
// Text rows: the string value (committed on Enter / focus loss); Status rows: GetText only.
|
||||
Func<RynthAiSettings, string>? GetText = null,
|
||||
Action<RynthAiSettings, string>? SetText = null,
|
||||
// Text rows: greyed hint shown while the box is empty.
|
||||
string? Hint = null)
|
||||
{
|
||||
public bool IsVisible(RynthAiSettings s) => VisibleWhen == null || VisibleWhen(s);
|
||||
}
|
||||
|
|
@ -438,6 +450,14 @@ internal static class SettingsSchema
|
|||
private static SettingRow Button(string label, string buttonText, Action click, string? tip = null) =>
|
||||
new(SettingKind.Button, label, tip, ButtonText: buttonText, Click: click);
|
||||
|
||||
private static SettingRow Text(string label, Func<RynthAiSettings, string> get, Action<RynthAiSettings, string> set,
|
||||
string? tip = null, string? hint = null) =>
|
||||
new(SettingKind.Text, label, tip, GetText: get, SetText: set, Hint: hint);
|
||||
|
||||
// A one-line status RynthAi computes (read-only; empty = hidden).
|
||||
private static SettingRow Status(Func<RynthAiSettings, string> get) =>
|
||||
new(SettingKind.Status, "", GetText: get, VisibleWhen: s => !string.IsNullOrEmpty(get(s)));
|
||||
|
||||
private static SettingRow[] Tiers(Func<RynthAiSettings, int>[] get, Action<RynthAiSettings, int>[] set)
|
||||
{
|
||||
var rows = new SettingRow[get.Length];
|
||||
|
|
@ -534,6 +554,17 @@ internal static class SettingsSchema
|
|||
"With Decal: when VTank's macro starts (/vt start), RynthAi's macro stops, and it won't start while VTank runs.\nOne bot per client. Without Decal this does nothing. Also: /ra vtankyield on|off."),
|
||||
Bool("Enable Raycasting", s => s.EnableRaycasting, (s, v) => s.EnableRaycasting = v),
|
||||
Spacer(),
|
||||
Section("Server Features (ILT / infinite attributes)"),
|
||||
Status(s => s.ServerFeaturesStatus),
|
||||
Text("Servers", s => s.FeatureServerNames, (s, v) => s.FeatureServerNames = v,
|
||||
"Comma-separated world names that turn on the ILT Hub, the Skills panel's Progression planners\n" +
|
||||
"and the attribute raiser. * is a wildcard (*Leaftide* matches any name containing Leaftide).\n" +
|
||||
"Case does not matter. Saved with the RynthAi profile.",
|
||||
hint: "InfiniteLeaftide, *Leaftide*"),
|
||||
Bool("Force enable on this server (manual override)", s => s.ForceServerFeatures, (s, v) => s.ForceServerFeatures = v,
|
||||
"Turn the features on for whatever world you are on, even if it is not in the list.\n" +
|
||||
"Each feature still follows what the server reports (for example /xp off keeps the attribute raiser off)."),
|
||||
Spacer(),
|
||||
Section("Missile Arc Velocities (m/s)"),
|
||||
Bool("Use Arcs for Missile LoS", s => s.UseArcs, (s, v) => s.UseArcs = v,
|
||||
"A missile target must pass both the straight line and the real arrow arc, ceilings included (dungeons too).\nWhen off, all missile LoS checks are linear (eye-to-eye).", gates: true),
|
||||
|
|
|
|||
|
|
@ -337,6 +337,21 @@ internal static class SettingsPanel
|
|||
return ButtonRow(row.Label, row.ButtonText ?? row.Label, () => row.Click?.Invoke(), row.Tooltip);
|
||||
case SettingKind.TraceCategories:
|
||||
return TraceCategoriesRow(state, row);
|
||||
case SettingKind.Text:
|
||||
return TextRow(row.Label, row.GetText?.Invoke(d) ?? string.Empty, row.Hint, v =>
|
||||
{
|
||||
row.SetText?.Invoke(state.Data, v);
|
||||
Push(state);
|
||||
}, row.Tooltip);
|
||||
case SettingKind.Status:
|
||||
{
|
||||
string status = row.GetText?.Invoke(d) ?? string.Empty;
|
||||
return status.Length == 0 ? null : new TextBlock
|
||||
{
|
||||
Text = status, Foreground = ColTeal, FontSize = 11,
|
||||
TextWrapping = Avalonia.Media.TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2),
|
||||
};
|
||||
}
|
||||
case SettingKind.Note:
|
||||
return new TextBlock
|
||||
{
|
||||
|
|
@ -420,6 +435,53 @@ internal static class SettingsPanel
|
|||
return row;
|
||||
}
|
||||
|
||||
/// <summary>Label above a full-width text box; commits on Enter or focus loss when the text changed.</summary>
|
||||
private static Control TextRow(string label, string value, string? hint, Action<string> onChange, string? tooltip = null)
|
||||
{
|
||||
string committed = value;
|
||||
var box = new StackPanel { Margin = new Thickness(0, 2, 0, 2) };
|
||||
box.Children.Add(new TextBlock { Text = label, Foreground = ColTextDim, FontSize = 11, Margin = new Thickness(0, 0, 0, 2) });
|
||||
var tb = new TextBox
|
||||
{
|
||||
Text = value,
|
||||
Watermark = hint,
|
||||
FontSize = 11,
|
||||
Height = 22,
|
||||
Padding = new Thickness(4, 2),
|
||||
Background = ColPanelBg,
|
||||
Foreground = ColAmber,
|
||||
BorderBrush = ColBtnBord,
|
||||
BorderThickness = new Thickness(1),
|
||||
VerticalContentAlignment = VerticalAlignment.Center,
|
||||
};
|
||||
DisableInnerScroll(tb);
|
||||
void Commit()
|
||||
{
|
||||
string text = tb.Text ?? string.Empty;
|
||||
if (string.Equals(text, committed, StringComparison.Ordinal)) return;
|
||||
committed = text;
|
||||
onChange(text);
|
||||
}
|
||||
// Same keyboard gate as the number boxes: typed keys go to Avalonia, not the game.
|
||||
tb.GotFocus += (_, _) => Win32Backend.AvaloniaTextInputActive = true;
|
||||
tb.LostFocus += (_, _) =>
|
||||
{
|
||||
Win32Backend.AvaloniaTextInputActive = false;
|
||||
Commit();
|
||||
};
|
||||
tb.KeyDown += (_, e) =>
|
||||
{
|
||||
if (e.Key == Avalonia.Input.Key.Enter) Commit();
|
||||
};
|
||||
box.Children.Add(tb);
|
||||
if (tooltip != null)
|
||||
{
|
||||
ToolTip.SetTip(box, tooltip);
|
||||
ToolTip.SetShowDelay(box, 400);
|
||||
}
|
||||
return box;
|
||||
}
|
||||
|
||||
private static Control IntRow(string label, int value, int min, int max, int step, Action<int> onChange, string? tooltip = null)
|
||||
{
|
||||
int current = Math.Clamp(value, min, max);
|
||||
|
|
|
|||
Loading…
Reference in a new issue