RynthCore as of 2026-11-12 (internal eb12118): release 2026.11.12.1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
55e15c0ac4
commit
7f1e7d5039
71 changed files with 3413 additions and 587 deletions
|
|
@ -636,7 +636,8 @@ internal sealed class ChatView
|
|||
private void MeasureLine(ImFontPtr font, int i, float textW)
|
||||
{
|
||||
ChatLine line = _vis[i];
|
||||
ChatSpan[]? spans = line.Route.Spans;
|
||||
// The rules' match colours over the plugin's own colour runs (per-part item info).
|
||||
ChatSpan[]? spans = ChatOwnColors.EffectiveSpans(line.OwnSpans, line.Route.Spans, line.Route.LineArgb != null);
|
||||
// Map coordinates ("82.3N, 34.2E") become links. Found here, when the line is measured,
|
||||
// never per frame; a line without any keeps the plain (or highlighted) path.
|
||||
List<ChatCoord> coords = ChatCoords.MayHaveCoords(line.Text) ? ChatCoords.Find(line.Text) : NoCoords;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
// RynthAiFace draws this instead of the dashboard while
|
||||
// RynthAiDashboardState.Classic is on; the title bar's Modern button and
|
||||
// Settings > Display switch back. Minimized (the dashboard's shared flag)
|
||||
// Settings > Interface switch back. Minimized (the dashboard's shared flag)
|
||||
// shows the title bar over a compact strip: the systems, Stop/Start and the
|
||||
// three vitals meters.
|
||||
//
|
||||
|
|
@ -166,8 +166,8 @@ internal sealed class ClassicDashboard
|
|||
_fittedH = wantH;
|
||||
_fittedW = wantW;
|
||||
ImGuiPanelHost.RequestSize(RynthAiFace.Title, new Vector2(wantW / place, wantH / place));
|
||||
// Applied after the size, clamped to the screen at it (the dashboard's MeasureAndFit does the same):
|
||||
// a taller tab near the bottom of the screen moves the window up instead of running off it.
|
||||
// A taller tab near the bottom of the screen moves the window up instead of running off it: the host
|
||||
// pulls it onto the screen from its home at the new size (UI/PanelPlacement), and back once it fits.
|
||||
ImGuiPanelHost.RequestPos(RynthAiFace.Title, ImGuiNET.ImGui.GetWindowPos() / place);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ internal sealed class DamageDetailFace : IImGuiPanel
|
|||
? "Pull-away for every monster without its own. Default = Off (fight in place).\n"
|
||||
: "Pull-away for the monsters it covers. Default = the DEFAULT line's.\n") +
|
||||
"Off = kill where it stands. PullAway = tag, run until it has been dragged\n" +
|
||||
"Kite Pull Distance metres from its lock spot (Settings > Melee Combat), then kill.");
|
||||
"Kite Pull Distance metres from its lock spot (Settings > Combat), then kill.");
|
||||
|
||||
// The DEFAULT line's own choice is the Prefer chip in the Damage panel's top bar.
|
||||
if (!isDefault)
|
||||
|
|
|
|||
|
|
@ -212,7 +212,8 @@ internal sealed unsafe class LogFace : IImGuiPanel
|
|||
|
||||
/// <summary>
|
||||
/// Tracker: the session-stat rows (TrackerSource) over an adjustable-opacity background, or text only
|
||||
/// (TrackerSettings.TextOnly: bare, the rows shadowed, clicks pass through except over them).
|
||||
/// (TrackerSettings.TextOnly: bare, the Ledger, clicks pass through except over it, or everywhere with
|
||||
/// TrackerSettings.ClickThrough unless Ctrl is held). Rows can be hidden (the gear menu, TrackerSettings.Stats).
|
||||
/// </summary>
|
||||
internal sealed class TrackerFace : IImGuiPanel
|
||||
{
|
||||
|
|
@ -220,20 +221,60 @@ internal sealed class TrackerFace : IImGuiPanel
|
|||
private static readonly Vector4 LabelColor = RynthTheme.Vec(0xFF999999);
|
||||
private static readonly uint ResetBg = RynthTheme.Argb(0xFF1A2E40);
|
||||
private static uint ResetBorder => RynthTheme.AccentFill;
|
||||
// Text only: no background behind it, so brighter than the framed look, each with a shadow.
|
||||
private static readonly uint BareLabel = RynthTheme.Argb(0xFFCFCFCF);
|
||||
private static readonly uint BareValue = RynthTheme.Argb(0xFFFFFFFF);
|
||||
private static readonly uint BareShadow = RynthTheme.Argb(0xD0000000);
|
||||
|
||||
// Text only, the Ledger (2026-11-12, the owner: "something similar to how our Lua script works for
|
||||
// item tracking ... no windows or background. Just text"; picked "Ledger", tinted, from the
|
||||
// artifact "Bare Tracker"). Each label right-aligned beside its number, the rates, a gap, then the
|
||||
// totals; numbers of a thousand and up shortened (3.12M, 148k); the rates tinted by what they
|
||||
// count, deaths green at 0 and red above; every letter in a dark halo so it reads on any ground.
|
||||
private static readonly uint LedgerLabel = RynthTheme.Argb(0xFFD8D8D8);
|
||||
private static readonly uint LedgerValue = RynthTheme.Argb(0xFFFFFFFF);
|
||||
private static readonly uint LedgerDim = RynthTheme.Argb(0xFFBDBDBD);
|
||||
private static readonly uint LedgerXp = RynthTheme.Argb(0xFFEFC054);
|
||||
private static readonly uint LedgerLum = RynthTheme.Argb(0xFF7FB9F9);
|
||||
private static readonly uint LedgerKill = RynthTheme.Argb(0xFFF98075);
|
||||
private static readonly uint LedgerPass = RynthTheme.Argb(0xFFC5ABF4);
|
||||
private static readonly uint LedgerRad = RynthTheme.Argb(0xFF62D5C8);
|
||||
private static readonly uint LedgerOk = RynthTheme.Argb(0xFF73D885);
|
||||
// The halo: the four sides firm, the corners soft.
|
||||
private static readonly uint HaloNear = RynthTheme.Argb(0xE6000000);
|
||||
private static readonly uint HaloFar = RynthTheme.Argb(0x8C000000);
|
||||
private static readonly Vector2[] HaloSides = { new(1, 0), new(-1, 0), new(0, 1), new(0, -1) };
|
||||
private static readonly Vector2[] HaloCorners = { new(1, 1), new(-1, -1), new(1, -1), new(-1, 1) };
|
||||
private const float LedgerGap = 8f, LedgerGroupGap = 5f, ToolsGap = 10f;
|
||||
|
||||
// The Ledger's rows, worked out when the snapshot or the hidden set changes (not per frame).
|
||||
private TrackerSnapshot? _ledgerFor;
|
||||
private bool _ledgerBuilt;
|
||||
private int _ledgerHiddenVersion;
|
||||
private string[] _ledgerLabels = Array.Empty<string>(), _ledgerValues = Array.Empty<string>();
|
||||
private uint[] _ledgerColors = Array.Empty<uint>();
|
||||
private int _ledgerTotalsAt = -1; // the first shown total's row (the gap goes above it)
|
||||
private int _opacity;
|
||||
private const string StatsMenuId = "##tracker_stats";
|
||||
private static readonly string AllHiddenText = "All stats hidden (" + PhosphorIcons.Gear + ")";
|
||||
|
||||
// Text only: the mouse is over what the last frame drew, so the window takes input (to drag it, or
|
||||
// for the frame button); elsewhere clicks reach the game. A press that began there keeps it.
|
||||
// for the buttons); elsewhere clicks reach the game. A press that began while it took input keeps it.
|
||||
// With full click-through (TrackerSettings.ClickThrough) it takes input only while Ctrl is held.
|
||||
private bool _hot, _pressHot;
|
||||
|
||||
/// <summary>Text only is bare: docked, no frame, title, background or grip (popped out it is framed as usual).</summary>
|
||||
public bool Bare => TrackerSettings.TextOnly;
|
||||
|
||||
public bool ClickThrough => Bare && !_hot && !_pressHot;
|
||||
public bool ClickThrough
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Bare) return false;
|
||||
if (_pressHot) return false; // a press of ours: keep the mouse until the button is up
|
||||
if (!TrackerSettings.ClickThrough) return !_hot;
|
||||
// Full click-through (2026-11-12): only Ctrl over the Ledger takes the mouse, and not in the
|
||||
// middle of a press the game already has (Ctrl pressed while holding a game click).
|
||||
if (!_hot || !ImGuiNET.ImGui.GetIO().KeyCtrl) return true;
|
||||
return ImGuiNET.ImGui.IsMouseDown(ImGuiMouseButton.Left) && !ImGuiNET.ImGui.IsMouseClicked(ImGuiMouseButton.Left);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnShown()
|
||||
{
|
||||
|
|
@ -256,9 +297,10 @@ internal sealed class TrackerFace : IImGuiPanel
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Text only: each row's label and value with a 1 px shadow, nothing behind them. The rows are a
|
||||
/// drag handle; the button at the end of the first row (faint until the mouse is on the rows)
|
||||
/// brings the frame back.
|
||||
/// Text only, the Ledger: each row's label right-aligned beside its number, in a dark halo, nothing
|
||||
/// behind them. The rows are a drag handle. While the mouse is on them four small buttons show at
|
||||
/// the end of the first row, Reset, click-through, the stats menu and the frame; the rest of the time
|
||||
/// it is only the text. With full click-through the rows and buttons need Ctrl held.
|
||||
/// </summary>
|
||||
private void DrawTextOnly()
|
||||
{
|
||||
|
|
@ -266,65 +308,233 @@ internal sealed class TrackerFace : IImGuiPanel
|
|||
Vector2 origin = ImGuiNET.ImGui.GetCursorScreenPos();
|
||||
float width = Math.Max(60, ImGuiNET.ImGui.GetContentRegionAvail().X);
|
||||
Vector2 mouse = ImGuiNET.ImGui.GetIO().MousePos;
|
||||
bool wasHot = _hot;
|
||||
bool locked = TrackerSettings.ClickThrough;
|
||||
// Whether the host gave this window the mouse this frame (the same test it made before Begin).
|
||||
bool takingInput = !ClickThrough;
|
||||
bool showTools = locked ? takingInput : _hot || _pressHot;
|
||||
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Ui9));
|
||||
float rowH = ImGuiNET.ImGui.GetTextLineHeight() + 1;
|
||||
float buttonW = rowH + 4;
|
||||
TrackerSnapshot? snap = UiSources.Tracker.Current?.Value;
|
||||
string[]? values = snap?.Values;
|
||||
string[] labels = snap?.Labels ?? TrackerSnapshot.DefaultLabels;
|
||||
BuildLedger(snap);
|
||||
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Narrow10));
|
||||
ImFontPtr labelFont = ImGuiNET.ImGui.GetFont();
|
||||
float labelSize = ImGuiNET.ImGui.GetFontSize();
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Mono9));
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Mono10));
|
||||
ImFontPtr valueFont = ImGuiNET.ImGui.GetFont();
|
||||
float valueSize = ImGuiNET.ImGui.GetFontSize();
|
||||
float y = origin.Y;
|
||||
for (int i = 0; i < labels.Length; i++)
|
||||
float rowH = Math.Max(labelSize, valueSize) + 1;
|
||||
float labelDrop = MathF.Round((valueSize - labelSize) * 0.6f); // the labels sit on the numbers' baseline
|
||||
|
||||
float labelW = 0, valueW = 0;
|
||||
for (int i = 0; i < _ledgerLabels.Length; i++)
|
||||
{
|
||||
// The first row stops short of the frame button.
|
||||
float right = origin.X + width - (i == 0 ? buttonW + 2 : 0);
|
||||
Shadowed(dl, labelFont, labelSize, new Vector2(origin.X, y), BareLabel, labels[i]);
|
||||
string value = values != null && i < values.Length ? values[i] : "—";
|
||||
float w = ImGuiNET.ImGui.CalcTextSize(value).X;
|
||||
Shadowed(dl, valueFont, valueSize, new Vector2(Math.Max(origin.X, right - w), y), BareValue, value);
|
||||
labelW = Math.Max(labelW, labelFont.CalcTextSizeA(labelSize, float.MaxValue, 0f, _ledgerLabels[i]).X);
|
||||
valueW = Math.Max(valueW, valueFont.CalcTextSizeA(valueSize, float.MaxValue, 0f, _ledgerValues[i]).X);
|
||||
}
|
||||
float valueX = origin.X + MathF.Ceiling(labelW) + LedgerGap;
|
||||
float y = origin.Y;
|
||||
for (int i = 0; i < _ledgerLabels.Length; i++)
|
||||
{
|
||||
if (i == _ledgerTotalsAt && i > 0) y += LedgerGroupGap;
|
||||
float lw = labelFont.CalcTextSizeA(labelSize, float.MaxValue, 0f, _ledgerLabels[i]).X;
|
||||
Haloed(dl, labelFont, labelSize, new Vector2(MathF.Round(origin.X + labelW - lw), y + labelDrop), LedgerLabel, _ledgerLabels[i]);
|
||||
Haloed(dl, valueFont, valueSize, new Vector2(valueX, y), _ledgerColors[i], _ledgerValues[i]);
|
||||
y += rowH;
|
||||
}
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
float blockW = Math.Max(1, valueX + valueW - origin.X);
|
||||
float height = Math.Max(rowH, y - origin.Y);
|
||||
|
||||
// The rows: a drag handle (the window has no title bar to hold).
|
||||
ImGuiNET.ImGui.SetCursorScreenPos(origin);
|
||||
ImGuiNET.ImGui.InvisibleButton("##tracker_textonly_drag", new Vector2(Math.Max(1, width - buttonW - 2), height));
|
||||
ImGuiNET.ImGui.InvisibleButton("##tracker_textonly_drag", new Vector2(blockW, height));
|
||||
ImGuiPanelHost.DragWindowWithLastItem();
|
||||
if (ImGuiNET.ImGui.IsItemHovered() && !ImGuiNET.ImGui.IsItemActive())
|
||||
ImGuiNET.ImGui.SetTooltip("Drag to move the Tracker.");
|
||||
ImGuiNET.ImGui.SetTooltip(locked ? "Ctrl-drag to move the Tracker (click-through is on)." : "Drag to move the Tracker.");
|
||||
|
||||
// Frame button: faint until the mouse is on the rows.
|
||||
Vector2 bp = new(origin.X + width - buttonW, origin.Y);
|
||||
ImGuiNET.ImGui.SetCursorScreenPos(bp);
|
||||
float alpha = wasHot ? 1f : 0.35f;
|
||||
ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.Alpha, alpha);
|
||||
ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(1, 0));
|
||||
ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Button, ResetBg);
|
||||
if (ImGuiNET.ImGui.Button(PhosphorIcons.SquaresFour + "##tracker_frame", new Vector2(buttonW, rowH)))
|
||||
TrackerSettings.SetTextOnly(false);
|
||||
ImGuiNET.ImGui.SetItemTooltip("Show the Tracker's frame and background again.");
|
||||
ImGuiNET.ImGui.PopStyleColor();
|
||||
ImGuiNET.ImGui.PopStyleVar(2);
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
// Reset, click-through, the stats menu and the frame, only while the mouse is on the Tracker
|
||||
// (with click-through, while Ctrl is held there): at the end of the first row (inside the
|
||||
// window when it is narrower than that).
|
||||
float buttonW = rowH + 4;
|
||||
const int ToolCount = 4;
|
||||
float toolsW = ToolCount * buttonW + (ToolCount - 1) * 2;
|
||||
float toolsX = Math.Max(origin.X, Math.Min(origin.X + blockW + ToolsGap, origin.X + width - toolsW));
|
||||
if (showTools)
|
||||
{
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Ui9)); // the icons' font, as the framed look's buttons
|
||||
ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(1, 0));
|
||||
ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Button, ResetBg);
|
||||
var size = new Vector2(buttonW, rowH);
|
||||
float x = toolsX;
|
||||
ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(x, origin.Y));
|
||||
if (ImGuiNET.ImGui.Button(PhosphorIcons.ArrowCounterClockwise + "##tracker_reset", size))
|
||||
UiSources.Tracker.RequestReset();
|
||||
ImGuiNET.ImGui.SetItemTooltip("Reset the session stats");
|
||||
x += buttonW + 2;
|
||||
ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(x, origin.Y));
|
||||
if (locked) ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Button, RynthTheme.AccentFill);
|
||||
bool lockClicked = ImGuiNET.ImGui.Button((locked ? PhosphorIcons.Lock : PhosphorIcons.LockOpen) + "##tracker_clickthrough", size);
|
||||
if (locked) ImGuiNET.ImGui.PopStyleColor();
|
||||
ImGuiNET.ImGui.SetItemTooltip(locked ? ClickThroughOnTip : ClickThroughOffTip);
|
||||
if (lockClicked) TrackerSettings.SetClickThrough(!locked);
|
||||
x += buttonW + 2;
|
||||
ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(x, origin.Y));
|
||||
if (ImGuiNET.ImGui.Button(PhosphorIcons.Gear + "##tracker_statsbtn", size))
|
||||
ImGuiNET.ImGui.OpenPopup(StatsMenuId);
|
||||
ImGuiNET.ImGui.SetItemTooltip("Choose which stats the Tracker shows");
|
||||
x += buttonW + 2;
|
||||
ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(x, origin.Y));
|
||||
if (ImGuiNET.ImGui.Button(PhosphorIcons.SquaresFour + "##tracker_frame", size))
|
||||
TrackerSettings.SetTextOnly(false);
|
||||
ImGuiNET.ImGui.SetItemTooltip("Show the Tracker's frame again (its background and opacity).");
|
||||
ImGuiNET.ImGui.PopStyleColor();
|
||||
ImGuiNET.ImGui.PopStyleVar();
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
}
|
||||
DrawStatsMenu();
|
||||
|
||||
// Hot for the next frame: the mouse over the rows or the button.
|
||||
bool over = mouse.X >= origin.X && mouse.X <= origin.X + width && mouse.Y >= origin.Y && mouse.Y <= origin.Y + height;
|
||||
// Hot for the next frame: the mouse over the rows, or over the buttons while they show.
|
||||
bool overRows = mouse.X >= origin.X && mouse.X <= origin.X + blockW && mouse.Y >= origin.Y && mouse.Y <= origin.Y + height;
|
||||
bool overTools = showTools && mouse.X >= origin.X + blockW && mouse.X <= toolsX + toolsW && mouse.Y >= origin.Y && mouse.Y <= origin.Y + rowH;
|
||||
bool over = overRows || overTools;
|
||||
_hot = over;
|
||||
bool down = ImGuiNET.ImGui.IsMouseDown(ImGuiMouseButton.Left);
|
||||
if (!down) _pressHot = false;
|
||||
else if (over && ImGuiNET.ImGui.IsMouseClicked(ImGuiMouseButton.Left)) _pressHot = true;
|
||||
// Only a press this window took (a game click over the text never grabs the mouse mid-press).
|
||||
else if (over && takingInput && ImGuiNET.ImGui.IsMouseClicked(ImGuiMouseButton.Left)) _pressHot = true;
|
||||
}
|
||||
|
||||
private static void Shadowed(ImDrawListPtr dl, ImFontPtr font, float size, Vector2 p, uint color, string text)
|
||||
private const string ClickThroughOffTip =
|
||||
"Click-through: every click reaches the game, even over the numbers.\nHold Ctrl to move it or reach these buttons.";
|
||||
private const string ClickThroughOnTip =
|
||||
"Click-through is on: every click reaches the game, even over the numbers.\nHold Ctrl to move it or reach these buttons. Click to turn it off.";
|
||||
|
||||
/// <summary>
|
||||
/// The stats menu (2026-11-12, the owner: "a small settings menu to show/hide some of the stats"): a
|
||||
/// box per row the Tracker can show, Show all, and click-through. Opened by the gear in either look.
|
||||
/// </summary>
|
||||
private static void DrawStatsMenu()
|
||||
{
|
||||
dl.AddText(font, size, p + new Vector2(1, 1), BareShadow, text);
|
||||
if (!ImGuiNET.ImGui.BeginPopup(StatsMenuId)) return;
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Ui11));
|
||||
ImGuiNET.ImGui.TextColored(TitleColor, "Show on the Tracker");
|
||||
foreach (TrackerStat s in TrackerSettings.Stats)
|
||||
{
|
||||
bool shown = !TrackerSettings.IsHidden(s.Id);
|
||||
ImGuiNET.ImGui.PushID(s.Id);
|
||||
if (ImGuiNET.ImGui.Checkbox(s.Name, ref shown))
|
||||
TrackerSettings.SetHidden(s.Id, !shown);
|
||||
if (s.Note != null)
|
||||
ImGuiNET.ImGui.SetItemTooltip(s.Note);
|
||||
ImGuiNET.ImGui.PopID();
|
||||
}
|
||||
if (ImGuiNET.ImGui.Button("Show all"))
|
||||
TrackerSettings.ShowAll();
|
||||
ImGuiNET.ImGui.Separator();
|
||||
bool clickThrough = TrackerSettings.ClickThrough;
|
||||
if (ImGuiNET.ImGui.Checkbox("Click-through (text only)", ref clickThrough))
|
||||
TrackerSettings.SetClickThrough(clickThrough);
|
||||
ImGuiNET.ImGui.SetItemTooltip("Text only, every click reaches the game, even over the numbers.\nHold Ctrl to move it or reach its buttons.");
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
ImGuiNET.ImGui.EndPopup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Ledger's labels, numbers and colours for <paramref name="snap"/> without the hidden rows;
|
||||
/// only when the snapshot or the hidden set changed. Every row hidden leaves one dim line saying so.
|
||||
/// </summary>
|
||||
private void BuildLedger(TrackerSnapshot? snap)
|
||||
{
|
||||
int hiddenVersion = TrackerSettings.HiddenVersion;
|
||||
if (_ledgerBuilt && ReferenceEquals(snap, _ledgerFor) && hiddenVersion == _ledgerHiddenVersion) return;
|
||||
_ledgerBuilt = true;
|
||||
_ledgerFor = snap;
|
||||
_ledgerHiddenVersion = hiddenVersion;
|
||||
string[] labels = snap?.Labels ?? TrackerSnapshot.DefaultLabels;
|
||||
string[]? values = snap?.Values;
|
||||
var names = new List<string>(labels.Length);
|
||||
var shownValues = new List<string>(labels.Length);
|
||||
var colors = new List<uint>(labels.Length);
|
||||
int totalsFrom = Array.IndexOf(labels, "XP"); // the rates come before XP, the totals from it
|
||||
_ledgerTotalsAt = -1;
|
||||
for (int i = 0; i < labels.Length; i++)
|
||||
{
|
||||
if (TrackerSettings.IsLabelHidden(labels[i])) continue;
|
||||
string value = values != null && i < values.Length ? values[i] : "—";
|
||||
// The gap goes above the first total shown, and only with a rate shown above it.
|
||||
if (_ledgerTotalsAt < 0 && totalsFrom >= 0 && i >= totalsFrom) _ledgerTotalsAt = names.Count;
|
||||
names.Add(LedgerName(labels[i]));
|
||||
shownValues.Add(Shorten(value));
|
||||
colors.Add(LedgerColor(labels[i], value));
|
||||
}
|
||||
if (names.Count == 0)
|
||||
{
|
||||
names.Add("TRACKER");
|
||||
shownValues.Add("all stats hidden");
|
||||
colors.Add(LedgerDim);
|
||||
}
|
||||
_ledgerLabels = names.ToArray();
|
||||
_ledgerValues = shownValues.ToArray();
|
||||
_ledgerColors = colors.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>The Ledger's name for a row: in capitals, with the framed look's abbreviations spelled out.</summary>
|
||||
internal static string LedgerName(string label) => label switch
|
||||
{
|
||||
"Kls/hr" => "KILLS/HR",
|
||||
"XP/kl" => "XP/KILL",
|
||||
_ => label.ToUpperInvariant(),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A number of a thousand and up as three figures and a unit (1.23k, 12.3k, 148k, 3.12M, 1.05B);
|
||||
/// anything else (the session clock, a rate with a decimal, "max level", "—") as it is.
|
||||
/// </summary>
|
||||
internal static string Shorten(string value)
|
||||
{
|
||||
if (value.IndexOf(',') < 0 || !long.TryParse(value.Replace(",", ""), System.Globalization.NumberStyles.AllowLeadingSign,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out long n))
|
||||
return value;
|
||||
string[] units = { "", "k", "M", "B", "T" };
|
||||
double x = n;
|
||||
int u = 0;
|
||||
while (Math.Abs(x) >= 1000 && u < units.Length - 1) { x /= 1000; u++; }
|
||||
string s = Three(x);
|
||||
if (Math.Abs(double.Parse(s, System.Globalization.CultureInfo.InvariantCulture)) >= 1000 && u < units.Length - 1)
|
||||
{
|
||||
x /= 1000; // 999,999 rounds to 1000k: one unit up instead
|
||||
u++;
|
||||
s = Three(x);
|
||||
}
|
||||
return s + units[u];
|
||||
|
||||
static string Three(double v)
|
||||
{
|
||||
double a = Math.Abs(v);
|
||||
string format = a < 10 ? "0.##" : a < 100 ? "0.#" : "0";
|
||||
return v.ToString(format, System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A row's colour: the rates by what they count, deaths green at 0 and red above, the clock dim, totals white.</summary>
|
||||
private static uint LedgerColor(string label, string value) => label switch
|
||||
{
|
||||
"Session" => LedgerDim,
|
||||
"XP/hr" => LedgerXp,
|
||||
"Lum/hr" or "Lum/5m" => LedgerLum,
|
||||
"Kls/hr" => LedgerKill,
|
||||
"Pass/hr" => LedgerPass,
|
||||
"Rad/hr" => LedgerRad,
|
||||
"Deaths" => value == "0" ? LedgerOk : LedgerKill,
|
||||
_ => LedgerValue,
|
||||
};
|
||||
|
||||
/// <summary>Text in a dark halo: the four sides firm, the corners soft, then the text.</summary>
|
||||
private static void Haloed(ImDrawListPtr dl, ImFontPtr font, float size, Vector2 p, uint color, string text)
|
||||
{
|
||||
foreach (Vector2 o in HaloCorners) dl.AddText(font, size, p + o, HaloFar, text);
|
||||
foreach (Vector2 o in HaloSides) dl.AddText(font, size, p + o, HaloNear, text);
|
||||
dl.AddText(font, size, p, color, text);
|
||||
}
|
||||
|
||||
|
|
@ -340,12 +550,14 @@ internal sealed class TrackerFace : IImGuiPanel
|
|||
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Ui9));
|
||||
|
||||
// Title row: [Tracker] [===slider===] [text only] [reset]
|
||||
// Title row: [Tracker] [===slider===] [text only] [stats menu] [reset]
|
||||
ImGuiNET.ImGui.TextColored(TitleColor, "Tracker");
|
||||
ImGuiNET.ImGui.SameLine();
|
||||
float resetW = ImGuiNET.ImGui.CalcTextSize(PhosphorIcons.ArrowCounterClockwise).X + 8;
|
||||
float textOnlyW = ImGuiNET.ImGui.CalcTextSize(PhosphorIcons.TextAa).X + 8;
|
||||
ImGuiNET.ImGui.SetNextItemWidth(Math.Max(10, ImGuiNET.ImGui.GetContentRegionAvail().X - resetW - textOnlyW - 8));
|
||||
float gearW = ImGuiNET.ImGui.CalcTextSize(PhosphorIcons.Gear).X + 8;
|
||||
float spacing = ImGuiNET.ImGui.GetStyle().ItemSpacing.X;
|
||||
ImGuiNET.ImGui.SetNextItemWidth(Math.Max(10, ImGuiNET.ImGui.GetContentRegionAvail().X - resetW - textOnlyW - gearW - 8 - spacing));
|
||||
ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(2, 0));
|
||||
if (ImGuiNET.ImGui.SliderInt("##opacity", ref _opacity, 0, 100, ""))
|
||||
TrackerSettings.SetBgAlpha((byte)Math.Round(_opacity * 2.55), save: false);
|
||||
|
|
@ -363,9 +575,15 @@ internal sealed class TrackerFace : IImGuiPanel
|
|||
TrackerSettings.SetTextOnly(true);
|
||||
ImGuiNET.ImGui.EndDisabled();
|
||||
ImGuiNET.ImGui.SetItemTooltip(canBare
|
||||
? "Text only: hide the frame and background, just the numbers (clicks pass through to the game).\nThe button at the end of its first row brings the frame back."
|
||||
? (TrackerSettings.ClickThrough
|
||||
? "Text only: just the numbers, no frame or background. Click-through is on: every click reaches the game,\neven over the numbers; hold Ctrl over them to move it or for its buttons (Reset, click-through, stats, frame)."
|
||||
: "Text only: just the numbers, no frame or background (clicks pass through to the game except over the numbers).\nHover them for Reset, click-through, the stats menu and the button that brings the frame back.")
|
||||
: "Text only works while the Tracker is docked (not popped out).");
|
||||
ImGuiNET.ImGui.SameLine();
|
||||
if (ImGuiNET.ImGui.Button(PhosphorIcons.Gear + "##stats"))
|
||||
ImGuiNET.ImGui.OpenPopup(StatsMenuId);
|
||||
ImGuiNET.ImGui.SetItemTooltip("Choose which stats the Tracker shows, and click-through for text only");
|
||||
ImGuiNET.ImGui.SameLine();
|
||||
if (ImGuiNET.ImGui.Button(PhosphorIcons.ArrowCounterClockwise + "##reset"))
|
||||
UiSources.Tracker.RequestReset();
|
||||
ImGuiNET.ImGui.SetItemTooltip("Reset the session stats");
|
||||
|
|
@ -380,8 +598,11 @@ internal sealed class TrackerFace : IImGuiPanel
|
|||
float grip = ImGuiPanelHost.BodyGripReserve;
|
||||
float gripTop = grip > 0 ? ImGuiNET.ImGui.GetWindowPos().Y + ImGuiNET.ImGui.GetWindowHeight() - grip : float.MaxValue;
|
||||
float rowH = ImGuiNET.ImGui.GetTextLineHeight();
|
||||
int drawn = 0;
|
||||
for (int i = 0; i < labels.Length; i++)
|
||||
{
|
||||
if (TrackerSettings.IsLabelHidden(labels[i])) continue;
|
||||
drawn++;
|
||||
float rowRight = ImGuiNET.ImGui.GetCursorPosX() + ImGuiNET.ImGui.GetContentRegionAvail().X;
|
||||
if (ImGuiNET.ImGui.GetCursorScreenPos().Y + rowH > gripTop) rowRight -= grip;
|
||||
SafeImGui.TextColored(LabelColor, labels[i]);
|
||||
|
|
@ -396,6 +617,8 @@ internal sealed class TrackerFace : IImGuiPanel
|
|||
ImGuiNET.ImGui.TextUnformatted(value);
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
}
|
||||
if (drawn == 0)
|
||||
ImGuiNET.ImGui.TextDisabled(AllHiddenText);
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
|
||||
float bottom = ImGuiNET.ImGui.GetCursorScreenPos().Y;
|
||||
|
|
@ -403,5 +626,6 @@ internal sealed class TrackerFace : IImGuiPanel
|
|||
uint bg = RynthTheme.Argb(((uint)TrackerSettings.BgAlpha << 24) | 0x0A121A);
|
||||
dl.AddRectFilled(top, new Vector2(top.X + width, bottom), bg);
|
||||
dl.ChannelsMerge();
|
||||
DrawStatsMenu();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ internal sealed class PluginWindowFace : IImGuiPanel
|
|||
float screenW = ImGuiNET.ImGui.GetIO().DisplaySize.X / place;
|
||||
if (screenW > 1f) width = MathF.Min(width, screenW);
|
||||
ImGuiPanelHost.RequestSize(_title, new Vector2(width, height));
|
||||
// Clamped to the screen at the new size: near the right or bottom edge it moves in.
|
||||
// Near the right or bottom edge it moves in at the new size: the host pulls it onto the screen
|
||||
// from its home (UI/PanelPlacement; this spot is where it draws, so it changes nothing there).
|
||||
ImGuiPanelHost.RequestPos(_title, ImGuiNET.ImGui.GetWindowPos() / place);
|
||||
}
|
||||
else if (mouseUp && MathF.Abs(shownHeight - height) > 0.5f)
|
||||
|
|
|
|||
|
|
@ -953,7 +953,7 @@ internal sealed class RadarFace : IImGuiPanel
|
|||
|
||||
/// <summary>
|
||||
/// "Hide the retail radar": RynthAi's own SuppressRetailRadar setting (RynthAi pushes it to the engine every
|
||||
/// tick), the same switch as Settings > UI > Hide retail radar. This reads it from RynthAi's settings payload
|
||||
/// tick), the same switch as Settings > Interface > Hide retail radar. This reads it from RynthAi's settings payload
|
||||
/// and saves it back through the same command, so the two always agree whichever is changed; saved with the
|
||||
/// character's RynthAi settings. Greyed out until RynthAi has answered. The box shows the new value at once,
|
||||
/// until RynthAi's answer catches up.
|
||||
|
|
@ -976,7 +976,7 @@ internal sealed class RadarFace : IImGuiPanel
|
|||
}
|
||||
ImGuiNET.ImGui.EndDisabled();
|
||||
if (ImGuiNET.ImGui.IsItemHovered())
|
||||
ImGuiNET.ImGui.SetTooltip("Hides the game's built-in radar (bezel, compass, coordinates, blips).\nThe same switch as RynthAi's Settings > UI > Hide retail radar: change it in either place.");
|
||||
ImGuiNET.ImGui.SetTooltip("Hides the game's built-in radar (bezel, compass, coordinates, blips).\nThe same switch as Settings > Interface > Hide retail radar: change it in either place.");
|
||||
if (ra == null)
|
||||
{
|
||||
ImGuiNET.ImGui.SameLine();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
// Chromeless (like the Avalonia face): the title row is the drag surface.
|
||||
//
|
||||
// Size: the dashboard's panel text size (PanelTextScale.Get(Title): its own
|
||||
// row in Settings > Display, else All Panels). The host draws the face with
|
||||
// row in Settings > Interface, else All Panels). The host draws the face with
|
||||
// the fonts baked for that step (ImGuiFonts.CurrentStep, the nearest baked
|
||||
// one until a re-bake lands) and every box here is multiplied by that same
|
||||
// step's factor (Px), so text, icons and boxes grow together; size 0 is the
|
||||
|
|
@ -176,7 +176,7 @@ internal sealed partial class RynthAiFace : IImGuiPanel
|
|||
|
||||
/// <summary>
|
||||
/// Switches the dashboard between its Modern (compact) and Classic (retail) looks: the title bar
|
||||
/// buttons of either look and Settings > Display. The window refits on the next frame. AC thread.
|
||||
/// buttons of either look and Settings > Interface. The window refits on the next frame. AC thread.
|
||||
/// </summary>
|
||||
internal static void SwitchLook(bool classic) => RynthAiDashboardState.SetClassic(classic);
|
||||
|
||||
|
|
@ -289,8 +289,9 @@ internal sealed partial class RynthAiFace : IImGuiPanel
|
|||
if (screenW > 1) width = MathF.Min(width, screenW);
|
||||
width = MathF.Max(width, MinWidth * _k);
|
||||
ImGuiPanelHost.RequestSize(Title, new Vector2(width, _contentHeight));
|
||||
// Applied after the size, clamped to the screen at it: a bigger dashboard near the right or
|
||||
// bottom edge moves in rather than running off (saved with the new size, like the bar's clamp).
|
||||
// A bigger dashboard near the right or bottom edge moves in rather than running off: the host
|
||||
// pulls it onto the screen from its home at the new size (UI/PanelPlacement; the spot asked for
|
||||
// here is where it draws, so it changes nothing), and the home stays the saved spot.
|
||||
ImGuiPanelHost.RequestPos(Title, ImGuiNET.ImGui.GetWindowPos() / place);
|
||||
}
|
||||
else if (_fit)
|
||||
|
|
@ -422,7 +423,7 @@ internal sealed partial class RynthAiFace : IImGuiPanel
|
|||
|
||||
/// <summary>
|
||||
/// The title row's right-click popup: the dashboard's size (its panel text size, the same
|
||||
/// setting as Settings > Display > RynthAi Dashboard, or All Panels until it is set on its own).
|
||||
/// setting as Settings > Interface > RynthAi Dashboard, or All Panels until it is set on its own).
|
||||
/// </summary>
|
||||
private static void SizePopup()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// ============================================================================
|
||||
// RynthCore.Engine - ImGui/Panels/ServerPickSettingsUi.cs
|
||||
// Settings > Diagnostics > Server: which server this character counts as.
|
||||
// Settings > Game Client > Server: which server this character counts as.
|
||||
//
|
||||
// A picker (Auto, or one of the servers the engine knows: the built-in ones
|
||||
// and every server a loaded plugin declares), what is active and why, and the
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
// the other plugins ask for that server's settings. Picking a server forces it
|
||||
// on and every other server off for this character (ServerSelectionStore);
|
||||
// the menus, the "servermenu" push and plugin API v85 follow on the next frame.
|
||||
// Drawn by SettingsFace for the Diagnostics tab's ServerPick row, in its look.
|
||||
// Drawn by SettingsFace for the Game Client tab's ServerPick row, in its look.
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,9 @@ internal sealed class SettingsFace : IImGuiPanel
|
|||
if (_requestedTab is { } wanted)
|
||||
{
|
||||
_requestedTab = null;
|
||||
int idx = Array.FindIndex(SettingsSchema.Tabs, t => t.Name.Equals(wanted, StringComparison.OrdinalIgnoreCase));
|
||||
// FindTab also takes the names from before the 2026-11-11 regroup (Misc = General).
|
||||
SettingsTab? found = SettingsSchema.FindTab(wanted);
|
||||
int idx = found == null ? -1 : Array.IndexOf(SettingsSchema.Tabs, found);
|
||||
if (idx >= 0) _tab = idx;
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +109,14 @@ internal sealed class SettingsFace : IImGuiPanel
|
|||
for (int i = 0; i < tabs.Length; i++)
|
||||
{
|
||||
string tabName = tabs[i].Name;
|
||||
// A group's heading above its first tab (RynthCore · this PC, RynthAi · saved in the profile, Support).
|
||||
if (tabs[i].Group is { } group)
|
||||
{
|
||||
ImGuiNET.ImGui.Dummy(new Vector2(0, i == 0 ? 2 : 8));
|
||||
Vector2 gp = ImGuiNET.ImGui.GetCursorScreenPos();
|
||||
dl.AddText(new Vector2(gp.X + 4, gp.Y), Mute, group);
|
||||
ImGuiNET.ImGui.Dummy(new Vector2(0, ImGuiNET.ImGui.GetFontSize() + 1));
|
||||
}
|
||||
ImGuiNET.ImGui.Dummy(new Vector2(0, 1));
|
||||
Vector2 p = ImGuiNET.ImGui.GetCursorScreenPos();
|
||||
ImGuiNET.ImGui.PushID(i);
|
||||
|
|
@ -184,18 +194,18 @@ internal sealed class SettingsFace : IImGuiPanel
|
|||
// Tab icons by tab name (SettingsSchema); a tab not listed shows its name alone.
|
||||
private static readonly System.Collections.Generic.Dictionary<string, string> TabIcons = new()
|
||||
{
|
||||
["Display"] = PhosphorIcons.Monitor,
|
||||
["UI"] = PhosphorIcons.AppWindow,
|
||||
["Interface"] = PhosphorIcons.AppWindow,
|
||||
["Game Client"] = PhosphorIcons.Monitor,
|
||||
["Hotkeys"] = PhosphorIcons.Keyboard,
|
||||
["Misc"] = PhosphorIcons.DotsThree,
|
||||
["General"] = PhosphorIcons.SlidersHorizontal,
|
||||
["Recharge"] = PhosphorIcons.BatteryCharging,
|
||||
["Melee Combat"] = PhosphorIcons.Sword,
|
||||
["Combat"] = PhosphorIcons.Sword,
|
||||
["Spell Combat"] = PhosphorIcons.MagicWand,
|
||||
["Ranges"] = PhosphorIcons.Ruler,
|
||||
["Navigation"] = PhosphorIcons.SneakerMove,
|
||||
["Buffing"] = PhosphorIcons.Sparkle,
|
||||
["Crafting"] = PhosphorIcons.Hammer,
|
||||
["Looting"] = PhosphorIcons.Bag,
|
||||
["Inventory"] = PhosphorIcons.Backpack,
|
||||
["Vendoring"] = PhosphorIcons.Storefront,
|
||||
["Diagnostics"] = PhosphorIcons.Wrench,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,9 +14,11 @@
|
|||
// three vital maximums.
|
||||
// - Raise: "+1" raises one rank at once; the caret beside it drops down +10,
|
||||
// +100 and Max (each with its XP cost; Max asks first only when it spends
|
||||
// over half the unassigned XP). PlayerTraining.Raise(defer) queues it for
|
||||
// AC's main thread outside the ImGui frame; raise buttons stay locked until
|
||||
// the new values arrive (or 5 s pass). Train (skill credits) always asks first.
|
||||
// over half the unassigned XP, and says when it stops short of the top).
|
||||
// PlayerTraining.Raise(defer) queues it for AC's main thread outside the
|
||||
// ImGui frame; raise buttons stay locked until the new values arrive (or 5 s
|
||||
// pass: then the panel says the server hasn't taken it). Train (skill
|
||||
// credits) always asks first.
|
||||
// - Aelrynth only (ServerInfo.IsAelrynth): skill mastery from the SkillMastery
|
||||
// mod's /mastery-data reply (MasteryFeed). A crown badge with the mastery
|
||||
// points on trained rows that have any; the open row shows points, bonus,
|
||||
|
|
@ -169,6 +171,11 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
private long _pendingUnassigned;
|
||||
private int _pendingCredits;
|
||||
private int _pendingVersion;
|
||||
// The raise in flight (-1 key: a train), to tell the player when the server never took it.
|
||||
private int _pendingKey = -1;
|
||||
private uint _pendingRanks, _pendingSpent;
|
||||
private long _pendingCost;
|
||||
private string _pendingWhat = "";
|
||||
|
||||
private string _status = "";
|
||||
private uint _statusColor;
|
||||
|
|
@ -350,10 +357,19 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
Order();
|
||||
}
|
||||
|
||||
if (_pending && (now > _pendingUntilMs
|
||||
|| (snap != null && snap.Version != _pendingVersion
|
||||
&& (snap.UnassignedXp != _pendingUnassigned || snap.SkillCredits != _pendingCredits))))
|
||||
_pending = false;
|
||||
if (_pending)
|
||||
{
|
||||
if (snap != null && snap.Version != _pendingVersion
|
||||
&& (snap.UnassignedXp != _pendingUnassigned || snap.SkillCredits != _pendingCredits))
|
||||
_pending = false;
|
||||
else if (now > _pendingUntilMs)
|
||||
{
|
||||
_pending = false;
|
||||
// Only while the panel kept drawing (its numbers kept coming): not on a reopen much later.
|
||||
if (now - _pendingUntilMs < 2000) NoteUnanswered(snap);
|
||||
else _pendingKey = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// The open row's time-left text, once a second.
|
||||
if (second != _detailSecond && _byKey.TryGetValue(_expandedKey, out Row? open))
|
||||
|
|
@ -1278,14 +1294,17 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
}
|
||||
PlayerProgress s = _snap;
|
||||
long have = s.UnassignedXp;
|
||||
int maxLeft = Math.Max(0, r.Table.Length - 1 - (int)Math.Min(r.Ranks, (uint)int.MaxValue));
|
||||
int affordable = SkillDat.Affordable(r.Table, r.Ranks, r.Spent, have);
|
||||
MaxRaisePlan plan = TrainingCosts.PlanMax(r.Table, r.Ranks, r.Spent, have);
|
||||
int maxLeft = plan.RanksLeft;
|
||||
int affordable = plan.Ranks;
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Ui10));
|
||||
Vector2 p = ImGuiNET.ImGui.GetCursorScreenPos();
|
||||
float y = p.Y;
|
||||
MultiItem(r, s, "##m10", "+10", 10, maxLeft, have, p.X, ref y);
|
||||
MultiItem(r, s, "##m100", "+100", 100, maxLeft, have, p.X, ref y);
|
||||
MultiItem(r, s, "##mmax", affordable > 0 ? $"Max (+{affordable})" : "Max", affordable, maxLeft, have, p.X, ref y);
|
||||
// Max says when the XP doesn't reach the top ("+150 of 208"), and the tooltip how much more it needs.
|
||||
string maxLabel = affordable <= 0 ? "Max" : plan.ReachesTop ? $"Max (+{affordable})" : $"Max (+{affordable} of {maxLeft})";
|
||||
MultiItem(r, s, "##mmax", maxLabel, affordable, maxLeft, have, p.X, ref y, plan);
|
||||
NextLine(p, y - p.Y);
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
}
|
||||
|
|
@ -1296,7 +1315,8 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
}
|
||||
|
||||
/// <summary>One drop-down line: label left, XP cost right; greyed with the reason when it can't act.</summary>
|
||||
private void MultiItem(Row r, PlayerProgress s, string id, string label, int n, int maxLeft, long have, float x, ref float y)
|
||||
private void MultiItem(Row r, PlayerProgress s, string id, string label, int n, int maxLeft, long have, float x, ref float y,
|
||||
MaxRaisePlan plan = default)
|
||||
{
|
||||
const float h = 22;
|
||||
long cost = n > 0 && n <= maxLeft ? SkillDat.CostOf(r.Table!, r.Ranks, r.Spent, n) : -1;
|
||||
|
|
@ -1319,7 +1339,10 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
right = Compact(cost) + " XP";
|
||||
ok = !_pending && PlayerTraining.Available;
|
||||
why = $"Raise {r.Name} {r.Base} → {r.Base + n} for {cost:N0} XP"
|
||||
+ (isMax && cost * 2 > have ? " (asks first: over half your unassigned XP)" : "");
|
||||
+ (isMax && cost * 2 > have ? " (asks first: over half your unassigned XP)" : "")
|
||||
+ (isMax && !plan.ReachesTop && plan.Missing > 0
|
||||
? $"\nThe top rank is {maxLeft} ranks away and costs {plan.CostToTop:N0} XP: {plan.Missing:N0} more than you have."
|
||||
: "");
|
||||
}
|
||||
var pos = new Vector2(x, y);
|
||||
var size = new Vector2(MultiW - 6, h);
|
||||
|
|
@ -1403,6 +1426,12 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
Label(cost >= 0 && cost <= have
|
||||
? $"Unassigned: {have:N0} → {have - cost:N0}"
|
||||
: $"Unassigned: {have:N0} (not enough)", Mute);
|
||||
if (n < maxLeft && cost >= 0)
|
||||
{
|
||||
long toTop = SkillDat.CostOf(table, r.Ranks, r.Spent, maxLeft);
|
||||
int gap = maxLeft - n;
|
||||
Label($"Stops {gap} rank{(gap == 1 ? "" : "s")} short of the top: that needs {Math.Max(0L, toTop - have):N0} more XP.", Amber);
|
||||
}
|
||||
ImFontPtr f9 = ImGuiFonts.Get(UiFont.Ui9);
|
||||
ImGuiNET.ImGui.PushFont(f9);
|
||||
Label("That is more than half of your unassigned XP. Spent XP can't be taken back.", Dim);
|
||||
|
|
@ -1458,7 +1487,7 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
{
|
||||
if (PlayerTraining.TrainSkill(r.Stype, (uint)r.TrainCost, defer: true))
|
||||
{
|
||||
MarkPending(s);
|
||||
MarkPending(s, null, 0);
|
||||
SetStatus($"Sent: train {r.Name} for {Credits(r.TrainCost)}.", Teal);
|
||||
}
|
||||
else
|
||||
|
|
@ -1467,16 +1496,42 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
}
|
||||
}
|
||||
|
||||
private void MarkPending(PlayerProgress s)
|
||||
/// <summary>Locks the buttons until the server answers; <paramref name="raised"/> is the raise's row (null for a train).</summary>
|
||||
private void MarkPending(PlayerProgress s, Row? raised, long cost)
|
||||
{
|
||||
_pending = true;
|
||||
_pendingUntilMs = Environment.TickCount64 + 5000;
|
||||
_pendingUnassigned = s.UnassignedXp;
|
||||
_pendingCredits = s.SkillCredits;
|
||||
_pendingVersion = s.Version;
|
||||
_pendingKey = raised?.Key ?? -1;
|
||||
_pendingRanks = raised?.Ranks ?? 0;
|
||||
_pendingSpent = raised?.Spent ?? 0;
|
||||
_pendingCost = cost;
|
||||
_pendingWhat = raised?.Name ?? "";
|
||||
PlayerProgressHooks.RefreshSoon();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The 5 s lock ran out with nothing changed. ACE turns a raise down without a word (more XP
|
||||
/// than it thinks is left to the top, or than you have), so say so here and log the numbers
|
||||
/// the raise was worked out from.
|
||||
/// </summary>
|
||||
private void NoteUnanswered(PlayerProgress? snap)
|
||||
{
|
||||
int key = _pendingKey;
|
||||
_pendingKey = -1;
|
||||
if (key < 0 || snap == null || !_byKey.TryGetValue(key, out Row? r) || r.Table == null) return;
|
||||
if (r.Ranks != _pendingRanks || r.Spent != _pendingSpent || snap.UnassignedXp != _pendingUnassigned) return;
|
||||
SetStatus($"{_pendingWhat}: the server hasn't taken the raise ({_pendingCost:N0} XP) after 5 s; nothing was spent.", Red);
|
||||
RynthLog.Compat($"Skills panel: {_pendingWhat} raise for {_pendingCost:N0} XP got no answer in 5 s " +
|
||||
$"(rank {r.Ranks}, XP spent {r.Spent:N0}, unassigned {snap.UnassignedXp:N0}, class {RowClass(r, snap)}, " +
|
||||
$"top rank {r.Table.Length - 1} at {r.Table[^1]:N0} XP)");
|
||||
}
|
||||
|
||||
private static uint RowClass(Row r, PlayerProgress s) =>
|
||||
r.Kind == RowKind.Skill && r.Stype <= PlayerProgress.MaxSkill ? s.SkillClass[r.Stype] : 0;
|
||||
|
||||
/// <summary>
|
||||
/// Raises <paramref name="n"/> ranks at once: the XP is worked out from the current
|
||||
/// snapshot, checked against the unassigned XP and the top rank, then queued for AC's
|
||||
|
|
@ -1500,7 +1555,9 @@ internal sealed partial class SkillsFace : IImGuiPanel
|
|||
uint stype = r.Kind == RowKind.Vital ? r.Stype * 2 - 1 : r.Stype; // vitals by their maximum
|
||||
if (PlayerTraining.Raise(kind, stype, (uint)cost, defer: true))
|
||||
{
|
||||
MarkPending(s);
|
||||
RynthLog.Compat($"Skills panel: raise {r.Name} +{n} from rank {r.Ranks} (XP spent {r.Spent:N0}, " +
|
||||
$"unassigned {s.UnassignedXp:N0}) for {cost:N0} XP");
|
||||
MarkPending(s, r, cost);
|
||||
SetStatus($"Sent: raise {r.Name} +{n} for {cost:N0} XP.", Teal);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue