Snapshot for release 2026.11.2.1 (internal 8d9795d)

This commit is contained in:
Tom Bohar 2026-11-02 03:33:33 -05:00
commit 00ee01167e
29 changed files with 925 additions and 52 deletions

View file

@ -8,7 +8,7 @@
// (the subsystem toggles) with a live line
// Ranges monster range, ring range, approach, follow/nav min
// Behavior autostack, autocram, peace mode / rebuff when idle,
// navigation first, looting first, rare corpses only,
// navigate only, looting first, rare corpses only,
// manage fellowship
// Magic and pets dispel items / self, M. charges when off, summon pets,
// pet range, pet min monsters
@ -50,7 +50,7 @@ internal sealed class ClassicMainTab : IClassicTab
private static readonly (string Schema, string Label)[] BehaviorRight =
{
("Boost Nav Priority", "Navigation first"), ("Boost Loot Priority", "Looting first"),
("Boost Nav Priority", "Navigate only (no hunting, no looting)"), ("Boost Loot Priority", "Looting first"),
("Loot Only Rare Corpses", "Rare corpses only"), ("Auto Fellowship Management", "Manage fellowship"),
};

View file

@ -0,0 +1,143 @@
// ============================================================================
// RynthCore.Engine - ImGui/Panels/ItemToolFace.cs
// The Item Tool panel: two small tools of RynthAi's, each picked, started and
// stopped by the player. Engine only, ImGui only; the work is RynthAi's
// (RynthAiPlugin.ItemTool.cs), this is its buttons and status lines.
//
// Chest looter "Pick a chest. Pick a key. It just loots the chest based on the
// current loot profile until it's out of keys."
// Select the chest in the world, press Use selected as chest;
// select the key in your pack, press Use selected as key; Start.
// Quick give Select an item in your pack (Use selected as item) and a player
// or NPC in the world (Use selected as target), press Give: every
// such item in your packs is handed over, one give at a time.
// The target's name is shown (PLAYER for a player).
//
// Data: ItemToolSource (RynthPluginGetItemToolJson, 250 ms while open). Buttons
// post words to RynthPluginItemToolCommand (ItemToolCommands.Send), the same
// words as "/ra itemtool ...". Draw reads a snapshot and posts; no AC calls.
// ============================================================================
using System;
using System.Numerics;
using ImGuiNET;
using RynthCore.Engine.UI.Data;
using static RynthCore.Engine.ImGuiBackend.Panels.FaceKit;
namespace RynthCore.Engine.ImGuiBackend.Panels;
internal sealed class ItemToolFace : IImGuiPanel
{
public const string Title = "Item Tool";
public static void Register() => ImGuiPanelHost.Register(Title,
new PanelSpec(new Vector2(320, 400), new Vector2(240, 260), EdgeToEdge: true, GripInBody: true),
() => new ItemToolFace());
public void OnShown()
{
UiSources.ItemTool.Subscribe();
UiSources.ItemTool.RequestRefresh();
}
public void OnHidden() => UiSources.ItemTool.Unsubscribe();
public void Draw()
{
float w = Begin(out Vector2 origin, out Vector2 size);
ItemToolSnapshot? snap = UiSources.ItemTool.Current?.Value;
float bodyH = Math.Max(30, Remaining(origin, size) - GripOverlap());
ImGuiNET.ImGui.BeginChild("##itemtool_body", new Vector2(w, bodyH));
if (snap == null)
Wrapped("Waiting for RynthAi (log in, and RynthAi must be loaded).", Mute, w);
else
{
DrawChest(snap.Chest, w);
ImGuiNET.ImGui.Dummy(new Vector2(0, 4));
Separator(w);
DrawGive(snap.Give, w);
}
ImGuiNET.ImGui.EndChild();
End(origin, size);
}
// ── Chest looter ────────────────────────────────────────────────────
private static void DrawChest(ChestToolState c, float w)
{
Label("Chest looter", Teal);
Wrapped("Loots the chest with the current loot profile, then waits for it to re-lock and goes again, until the key is used up.", Mute, w);
Pick("Chest:", c.Name, "(none: select the chest in the world)", w);
Pick("Key:", c.Key, "(none: select the key in your pack)", w);
bool ready = c.Name.Length > 0 && c.Key.Length > 0;
int hit = WrapButtons("##chest_pick", new[] { "Use selected as chest", "Use selected as key" }, w, 22,
new[] { !c.Running, !c.Running });
if (hit == 0) ItemToolCommands.Send("chest set");
else if (hit == 1) ItemToolCommands.Send("chest key");
hit = StartStop("##chest_run", "Start", "Stop", ready && !c.Running, c.Running, w);
if (hit == 0) ItemToolCommands.Send("chest start");
else if (hit == 1) ItemToolCommands.Send("chest stop");
Wrapped(c.Status, c.Running ? Amber : Text, w);
}
// ── Quick give ──────────────────────────────────────────────────────
private static void DrawGive(GiveToolState g, float w)
{
Label("Quick give", Teal);
Wrapped("Hands every matching item in your packs to one player or NPC, one give at a time, until none is left or you press Stop. Never worn gear.", Mute, w);
Pick("Item:", g.Item, "(none: select the item in your pack)", w);
Pick("Target:", g.Target, "(none: select the player or NPC in the world)", w);
bool ready = g.Item.Length > 0 && g.Target.Length > 0;
int hit = WrapButtons("##give_pick", new[] { "Use selected as item", "Use selected as target" }, w, 22,
new[] { !g.Running, !g.Running });
if (hit == 0) ItemToolCommands.Send("giveitem");
else if (hit == 1) ItemToolCommands.Send("givetarget");
hit = StartStop("##give_run", "Give", "Stop", ready && !g.Running, g.Running, w);
if (hit == 0) ItemToolCommands.Send("give");
else if (hit == 1) ItemToolCommands.Send("givestop");
Wrapped(g.Status, g.Running ? Amber : Text, w);
}
// ── Pieces ──────────────────────────────────────────────────────────
/// <summary>"Label value" (amber while nothing is picked, the hint then).</summary>
private static void Pick(string label, string value, string hint, float w)
{
Label(label, Mute);
ImGuiNET.ImGui.SameLine(0, 6);
bool none = value.Length == 0;
Wrapped(none ? hint : value, none ? Mute : Text, Math.Max(40, w - ImGuiNET.ImGui.CalcTextSize(label).X - 10));
}
/// <summary>A Start and a Stop button side by side; returns 0 (start), 1 (stop) or -1.</summary>
private static int StartStop(string id, string startLabel, string stopLabel, bool canStart, bool canStop, float w)
{
Vector2 start = ImGuiNET.ImGui.GetCursorScreenPos();
const float h = 24;
float bw = Math.Max(ButtonWidth(startLabel), ButtonWidth(stopLabel)) + 20;
int hit = -1;
ImGuiNET.ImGui.PushID(id);
if (Button("##start", startLabel, start, new Vector2(bw, h), Text, StartBg, canStart)) hit = 0;
if (Button("##stop", stopLabel, new Vector2(start.X + bw + 6, start.Y), new Vector2(bw, h), Text, StopBg, canStop)) hit = 1;
ImGuiNET.ImGui.PopID();
NextLine(start, h + 4);
return hit;
}
private static void Wrapped(string text, uint color, float w)
{
if (text.Length == 0) return;
ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Text, color);
ImGuiNET.ImGui.PushTextWrapPos(ImGuiNET.ImGui.GetCursorPosX() + w);
ImGuiNET.ImGui.TextUnformatted(text);
ImGuiNET.ImGui.PopTextWrapPos();
ImGuiNET.ImGui.PopStyleColor();
}
}

View file

@ -288,7 +288,7 @@ internal sealed partial class MetaFace : IImGuiPanel
Vector2 p = ImGuiNET.ImGui.GetCursorScreenPos();
const float refreshW = 26;
float saveAsW = BtnW("Save As", 60), indW = SaveIndicatorWidth();
float pickW = Math.Max(60, w - refreshW - saveAsW - indW - 12);
float pickW = Math.Max(60, w - refreshW * 2 - saveAsW - indW - 16);
int picked = Picker("##file", _fileDisplay, _fileDisplays, MetaVocabulary.CurrentFileIndex(_data), p, pickW);
if (picked >= 0 && picked < _data.Files.Count)
{
@ -302,6 +302,18 @@ internal sealed partial class MetaFace : IImGuiPanel
UiSources.Meta.RequestRefresh();
ImGuiNET.ImGui.SetItemTooltip("Refresh file list");
x += refreshW + 4;
// Reload: read the loaded meta's file again (the same as picking it in the list), e.g. after
// a new build of it was copied in.
int cur = MetaVocabulary.CurrentFileIndex(_data);
string? reloadPath = cur >= 0 && cur < _data.Files.Count ? _data.Files[cur].Path : _data.CurrentMetaPath;
if (IconButton("##reload", PhosphorIcons.ArrowCounterClockwise, new Vector2(x, p.Y), new Vector2(refreshW, 22), TextDim, BtnFill, BtnBord,
font: UiFont.Ui14) && !string.IsNullOrEmpty(reloadPath))
{
FlushEdit();
MetaCommands.Simple("load_file", path: reloadPath);
}
ImGuiNET.ImGui.SetItemTooltip("Reload this meta from its file");
x += refreshW + 4;
bool noFile = string.IsNullOrEmpty(_data.CurrentMetaPath);
if (Button("Save As##save_as", new Vector2(x, p.Y), new Vector2(saveAsW, 22), TextDim, noFile ? NewFill : BtnFill, noFile ? Green : BtnBord))
BeginSaveAs();
@ -875,6 +887,9 @@ internal sealed partial class MetaFace : IImGuiPanel
/// one more entry after the items ("+ New state..."): picking it returns items.Length. Returns the
/// picked index or -1.
/// </summary>
// Set when a picker's list is opened; the first frame of the list scrolls its chosen row to the top.
private bool _pickerScrollToSelected;
private int Picker(string id, string shown, string[] items, int selected, Vector2 pos, float width, float height = 22,
string? extra = null, string? badge = null)
{
@ -888,6 +903,7 @@ internal sealed partial class MetaFace : IImGuiPanel
Vector2 display = ImGuiNET.ImGui.GetIO().DisplaySize;
ImGuiNET.ImGui.SetNextWindowPos(new Vector2(Math.Clamp(pos.X, 0, Math.Max(0, display.X - listW)), pos.Y + height));
ImGuiNET.ImGui.OpenPopup("##list");
_pickerScrollToSelected = true;
}
bool hot = ImGuiNET.ImGui.IsItemHovered();
dl.AddRectFilled(pos, pos + new Vector2(width, height), hot ? Lighten(BtnFill) : BtnFill, 3);
@ -931,6 +947,8 @@ internal sealed partial class MetaFace : IImGuiPanel
ImGuiNET.ImGui.PopID();
bool isExtra = i == items.Length;
bool sel = !isExtra && i == selected;
// The list opens with the chosen row at its top, not at the first row every time.
if (sel && _pickerScrollToSelected) ImGuiNET.ImGui.SetScrollHereY(0f);
pdl.AddRectFilled(ip, ip + new Vector2(iw, 20), sel ? PickSel : ih ? Lighten(BtnFill) : isExtra ? NewFill : BtnFill);
pdl.AddRect(ip, ip + new Vector2(iw, 20), isExtra ? Green : BtnBord);
pdl.AddText(ip + new Vector2(6, (20 - ImGuiNET.ImGui.GetFontSize()) * 0.5f), isExtra ? Green : sel ? Teal : TextDim,
@ -942,6 +960,7 @@ internal sealed partial class MetaFace : IImGuiPanel
}
}
ImGuiNET.ImGui.EndPopup();
_pickerScrollToSelected = false;
}
ImGuiNET.ImGui.PopID();
ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(pos.X, pos.Y + height));

View file

@ -1144,6 +1144,7 @@ internal sealed partial class RynthAiFace : IImGuiPanel
SkillsMenuItem("Progress", "/rc progression", 2, "Augmentation, Enlightenment and XP planners (Infinite Leaftide).");
PanelMenuItem(InventoryFace.Title, "/rc inventory");
PanelMenuItem(ItemCountFace.Title, "/rc itemcount");
PanelMenuItem(ItemToolFace.Title, "/rc itemtool");
// RynthInventory's script window (same as /ginv and Inventory's GInv button).
const string ginvKey = "RynthInventory/Main";
bool hasGinv = UI.ScriptWindows.ScriptWindowRegistry.Has(ginvKey);