- ILT Hub (overlay window, /ra hub): character progression, pets, quests, gear, banking, guardian, buff keepers, session rates, USD import. - Floating HUDs: combat tracker, item count HUD, Mini Remote (/ra remote, /ra huds). - Item info (Mag-style describer) on select, with its own settings window. - Chat translation (/ra translate) for chosen channels. - Ground loot: loose items matching the loot profile are picked up when no corpse is in range (CorpseOpenController). - Nav: breadcrumb recorder, route overlay, and the route editor commands the engine Nav panel sends (multi-select move/duplicate/delete, reverse, snap to path, pauses, portals, simplify, trail -> route). - Pets: refill-loop guard for essences the server just confirmed full; optional ILT Hub hooks (summon on empty, hold, yield a cosmetic pet). - QuestTracker: quiet refreshes, Disabled / LastStatus for the hub. - WorldObjectCache: typed items (keys, gems, comps, food) are placed in inventory or landscape by ownership instead of staying Unknown. - Install-aware data folders (RynthInstallPaths) and a per-category diagnostics log (Diagnostics/RynthLog, diagnostics.json). - Monster Editor: VirindiTank USD import and "Import UB damage insights" (ub-mob-seed.json); RynthAi loads the seed (UbMobSeedStore). Kept as on rynth/main: combat (ammo, off-hand/shield rules), AutoStack in InventoryManager, LegacyAdvancedSettingsUi and the version stamping. No host API slots are used; new engine data comes from optional exports (RynthPluginRenderOverlay, RynthPluginGetProgressionJson, RynthPluginGetCharmsJson). Co-authored-by: Cursor <cursoragent@cursor.com>
183 lines
7.8 KiB
C#
183 lines
7.8 KiB
C#
// HudSetupUi.cs — "Inventory HUDs" setup window (UtilityBelt Item Hud tab equivalent).
|
|
//
|
|
// * Show / hide the pack item count HUD and the Mini Remote.
|
|
// * Two lists: items on the HUD (left) and carried items not on it (right).
|
|
// "<" pins the highlighted right row, ">" unpins the highlighted left row,
|
|
// Up / Down reorder the HUD. "Add from inventory" pins the item selected in the game.
|
|
// * Mini Remote slots: pick a slot, then Set (selected game item) or Clear.
|
|
// Render thread only; list edits are posted to the pump thread.
|
|
using System;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using ImGuiNET;
|
|
using RynthCore.Plugin.RynthAi.LegacyUi;
|
|
|
|
namespace RynthCore.Plugin.RynthAi.Huds;
|
|
|
|
internal sealed class HudSetupUi
|
|
{
|
|
private const float ListIcon = 18f;
|
|
|
|
private readonly HudController _hud;
|
|
private string _selOnHud = string.Empty;
|
|
private string _selInPack = string.Empty;
|
|
private string _packFilter = string.Empty;
|
|
private int _slot;
|
|
|
|
public HudSetupUi(HudController hud) => _hud = hud;
|
|
|
|
public void Render()
|
|
{
|
|
var s = _hud.State;
|
|
ImGui.SetNextWindowSize(new Vector2(640, 520), ImGuiCond.FirstUseEver);
|
|
bool open = true;
|
|
bool visible = ImGui.Begin("Inventory HUDs##rynthhudsetup", ref open);
|
|
if (!open) s.ShowSetup = false;
|
|
if (!visible) { ImGui.End(); return; }
|
|
|
|
RenderHudToggles(s);
|
|
ImGui.Separator();
|
|
RenderItemLists(s);
|
|
ImGui.Separator();
|
|
RenderSlotPicker(s);
|
|
ImGui.End();
|
|
}
|
|
|
|
private static void RenderHudToggles(HudState s)
|
|
{
|
|
bool itemHud = s.ShowItemHud;
|
|
if (ImGui.Checkbox("Show pack item count HUD", ref itemHud)) s.ShowItemHud = itemHud;
|
|
ImGui.SameLine();
|
|
bool names = s.ItemHudShowNames;
|
|
if (ImGui.Checkbox("with names", ref names)) s.ItemHudShowNames = names;
|
|
ImGui.SameLine();
|
|
bool remote = s.ShowMiniRemote;
|
|
if (ImGui.Checkbox("Show Mini Remote", ref remote)) s.ShowMiniRemote = remote;
|
|
ImGui.TextDisabled("Both are separate windows: drag them anywhere, dock them into other RynthAi windows,");
|
|
ImGui.TextDisabled("or pull them outside the game window. Right-click a HUD for its options.");
|
|
}
|
|
|
|
private void RenderItemLists(HudState s)
|
|
{
|
|
ImGui.TextWrapped("Left = shown on the HUD. Right = in your pack but not on the HUD. "
|
|
+ "< pins the highlighted right row; > removes the highlighted left row. "
|
|
+ "Add from inventory uses the item selected in the game.");
|
|
|
|
if (ImGui.Button("Scan pack")) _hud.Post(_hud.RequestScan);
|
|
ImGui.SameLine();
|
|
if (ImGui.Button("Add from inventory")) _hud.Post(_hud.AddSelectedToItemHud);
|
|
ImGui.SameLine();
|
|
if (ImGui.Button("Drop missing")) _hud.Post(_hud.DropMissingFromItemHud);
|
|
if (ImGui.IsItemHovered()) ImGui.SetTooltip("Remove HUD items you no longer carry.");
|
|
|
|
var entries = s.ItemHudItems.ToArray();
|
|
var pack = _hud.Pack;
|
|
float listH = 230f;
|
|
float colW = Math.Max(180f, (ImGui.GetContentRegionAvail().X - 50f) * 0.5f);
|
|
|
|
// ── Left: on the HUD ──
|
|
ImGui.BeginGroup();
|
|
ImGui.TextUnformatted($"On HUD ({entries.Length})");
|
|
if (ImGui.BeginChild("##hudon", new Vector2(colW, listH), ImGuiChildFlags.Borders))
|
|
{
|
|
foreach (var e in entries)
|
|
{
|
|
long count = pack.CountOf(e.Name);
|
|
if (Row(e.Name, e.IconDid, $"{e.Name} | {count:N0}", _selOnHud == e.Name, count == 0))
|
|
_selOnHud = e.Name;
|
|
}
|
|
}
|
|
ImGui.EndChild();
|
|
bool haveLeft = entries.Any(e => e.Name == _selOnHud);
|
|
ImGui.BeginDisabled(!haveLeft);
|
|
string upName = _selOnHud;
|
|
if (ImGui.SmallButton("Up")) _hud.Post(() => _hud.MoveItemHudEntry(upName, -1));
|
|
ImGui.SameLine();
|
|
if (ImGui.SmallButton("Down")) _hud.Post(() => _hud.MoveItemHudEntry(upName, +1));
|
|
ImGui.EndDisabled();
|
|
ImGui.EndGroup();
|
|
|
|
// ── Middle: move buttons ──
|
|
ImGui.SameLine();
|
|
ImGui.BeginGroup();
|
|
ImGui.Dummy(new Vector2(1, listH * 0.35f));
|
|
ImGui.BeginDisabled(string.IsNullOrEmpty(_selInPack));
|
|
string add = _selInPack;
|
|
if (ImGui.Button("<", new Vector2(36, 0))) { _hud.Post(() => _hud.AddToItemHud(add)); _selInPack = string.Empty; }
|
|
ImGui.EndDisabled();
|
|
ImGui.BeginDisabled(!haveLeft);
|
|
string remove = _selOnHud;
|
|
if (ImGui.Button(">", new Vector2(36, 0))) { _hud.Post(() => _hud.RemoveFromItemHud(remove)); _selOnHud = string.Empty; }
|
|
ImGui.EndDisabled();
|
|
ImGui.EndGroup();
|
|
|
|
// ── Right: in pack, not on the HUD ──
|
|
ImGui.SameLine();
|
|
ImGui.BeginGroup();
|
|
ImGui.TextUnformatted("Not on HUD");
|
|
ImGui.SameLine();
|
|
ImGui.SetNextItemWidth(Math.Max(80f, colW - 90f));
|
|
ImGui.InputTextWithHint("##hudpackfilter", "filter", ref _packFilter, 64u);
|
|
if (ImGui.BeginChild("##hudoff", new Vector2(colW, listH), ImGuiChildFlags.Borders))
|
|
{
|
|
var pinned = entries.Select(e => e.Name).ToHashSet(StringComparer.OrdinalIgnoreCase);
|
|
foreach (var r in pack.Rows)
|
|
{
|
|
if (pinned.Contains(r.Name)) continue;
|
|
if (_packFilter.Length > 0 && !r.Name.Contains(_packFilter, StringComparison.OrdinalIgnoreCase)) continue;
|
|
if (Row(r.Name, r.IconDid, $"{r.Name} | {r.Count:N0}", _selInPack == r.Name, false))
|
|
_selInPack = r.Name;
|
|
// Double-click pins straight away.
|
|
if (ImGui.IsItemHovered() && ImGui.IsMouseDoubleClicked(ImGuiMouseButton.Left))
|
|
{
|
|
string name = r.Name;
|
|
_hud.Post(() => _hud.AddToItemHud(name));
|
|
}
|
|
}
|
|
if (pack.Rows.Length == 0) ImGui.TextDisabled("Scanning your pack...");
|
|
}
|
|
ImGui.EndChild();
|
|
ImGui.EndGroup();
|
|
}
|
|
|
|
/// <summary>Icon + label selectable row; returns true when clicked.</summary>
|
|
private bool Row(string name, uint iconDid, string label, bool selected, bool dim)
|
|
{
|
|
Vector2 start = ImGui.GetCursorPos();
|
|
bool clicked = ImGui.Selectable($"##row{name}", selected, ImGuiSelectableFlags.AllowOverlap, new Vector2(0, ListIcon));
|
|
ImGui.SetCursorPos(start);
|
|
HudDraw.Icon(_hud.Icons, iconDid, name, ListIcon, dim);
|
|
ImGui.SameLine();
|
|
if (dim) ImGui.TextDisabled(label);
|
|
else ImGui.TextUnformatted(label);
|
|
return clicked;
|
|
}
|
|
|
|
private void RenderSlotPicker(HudState s)
|
|
{
|
|
var slots = s.MiniRemoteSlots.ToArray();
|
|
if (slots.Length == 0) return;
|
|
ImGui.TextColored(LegacyDashboardRenderer.ColTeal, "Mini Remote slots");
|
|
ImGui.TextDisabled($"Slot 01 = top-left of the Mini Remote grid ({HudState.MiniRemoteColumns} per row). "
|
|
+ "Select an item in your pack, pick the slot, then Set.");
|
|
_slot = Math.Clamp(_slot, 0, slots.Length - 1);
|
|
string Label(int i) => $"{i + 1:00} - {(slots[i].IsEmpty ? "(empty)" : slots[i].Name)}";
|
|
|
|
ImGui.SetNextItemWidth(320);
|
|
if (ImGui.BeginCombo("##mrslot", Label(_slot)))
|
|
{
|
|
for (int i = 0; i < slots.Length; i++)
|
|
if (ImGui.Selectable(Label(i), i == _slot)) _slot = i;
|
|
ImGui.EndCombo();
|
|
}
|
|
int slot = _slot;
|
|
ImGui.SameLine();
|
|
if (ImGui.Button("Set")) _hud.Post(() => _hud.SetSlotFromSelection(slot));
|
|
ImGui.SameLine();
|
|
ImGui.BeginDisabled(slots[slot].IsEmpty);
|
|
if (ImGui.Button("Clear")) _hud.Post(() => _hud.ClearSlot(slot));
|
|
ImGui.EndDisabled();
|
|
ImGui.SameLine();
|
|
if (ImGui.Button("Refresh")) _hud.Post(_hud.RequestScan);
|
|
}
|
|
}
|