- 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>
89 lines
3.7 KiB
C#
89 lines
3.7 KiB
C#
// ItemCountHud.cs — Floating "pack item count" HUD: one row per pinned item with its
|
|
// icon, carried count and (optionally) name. Right-click for options. Render thread only.
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using ImGuiNET;
|
|
|
|
namespace RynthCore.Plugin.RynthAi.Huds;
|
|
|
|
internal sealed class ItemCountHud
|
|
{
|
|
private const string OptionsPopup = "##itemhudopts";
|
|
private static readonly Vector4 ColCount = new(0.95f, 0.95f, 0.95f, 1f);
|
|
private static readonly Vector4 ColNone = new(0.95f, 0.45f, 0.40f, 1f);
|
|
private static readonly Vector4 ColName = new(0.70f, 0.75f, 0.80f, 1f);
|
|
|
|
private readonly HudController _hud;
|
|
private bool _rescueChecked; // off-screen check done for the current show
|
|
|
|
public ItemCountHud(HudController hud) => _hud = hud;
|
|
|
|
/// <summary>The HUD was not drawn this frame: check its position again on the next show.</summary>
|
|
public void OnHidden() => _rescueChecked = false;
|
|
|
|
public void Render()
|
|
{
|
|
var s = _hud.State;
|
|
var entries = s.ItemHudItems.ToArray();
|
|
var pack = _hud.Pack;
|
|
|
|
var flags = ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar
|
|
| ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav;
|
|
if (s.ItemHudLocked) flags |= ImGuiWindowFlags.NoMove;
|
|
|
|
// Right of and above centre, clear of the character in the middle of the view.
|
|
UiPlacement.CenterFirstUse(new Vector2(220, -160));
|
|
ImGui.SetNextWindowBgAlpha(0.55f);
|
|
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(4, 4));
|
|
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(4, 2));
|
|
bool visible = ImGui.Begin("Item HUD##rynthitemhud", flags);
|
|
ImGui.PopStyleVar(2);
|
|
if (!visible) { ImGui.End(); return; }
|
|
UiPlacement.RescueOncePerShow(ref _rescueChecked);
|
|
|
|
if (entries.Length == 0)
|
|
{
|
|
ImGui.TextDisabled("Item HUD is empty.");
|
|
ImGui.TextDisabled("Right-click > Edit items...");
|
|
}
|
|
|
|
float size = s.ItemHudIconSize;
|
|
foreach (var e in entries)
|
|
{
|
|
long count = pack.CountOf(e.Name);
|
|
HudDraw.Icon(_hud.Icons, e.IconDid, e.Name, size, count == 0);
|
|
if (ImGui.IsItemHovered()) ImGui.SetTooltip($"{e.Name}\n{count:N0} carried");
|
|
ImGui.SameLine();
|
|
// Vertically centre the text on the icon.
|
|
float pad = (size - ImGui.GetTextLineHeight()) * 0.5f;
|
|
if (pad > 0) ImGui.SetCursorPosY(ImGui.GetCursorPosY() + pad);
|
|
ImGui.TextColored(count == 0 ? ColNone : ColCount, count.ToString("N0"));
|
|
if (s.ItemHudShowNames)
|
|
{
|
|
ImGui.SameLine();
|
|
ImGui.TextColored(ColName, e.Name);
|
|
}
|
|
}
|
|
|
|
if (ImGui.IsWindowHovered() && ImGui.IsMouseReleased(ImGuiMouseButton.Right)) ImGui.OpenPopup(OptionsPopup);
|
|
RenderOptions(s);
|
|
ImGui.End();
|
|
}
|
|
|
|
private void RenderOptions(HudState s)
|
|
{
|
|
if (!ImGui.BeginPopup(OptionsPopup)) return;
|
|
ImGui.TextDisabled("Item HUD");
|
|
bool names = s.ItemHudShowNames;
|
|
if (ImGui.Checkbox("Show names", ref names)) s.ItemHudShowNames = names;
|
|
bool locked = s.ItemHudLocked;
|
|
if (ImGui.Checkbox("Lock position", ref locked)) s.ItemHudLocked = locked;
|
|
float size = s.ItemHudIconSize;
|
|
ImGui.SetNextItemWidth(120);
|
|
if (ImGui.SliderFloat("Icon size", ref size, 12f, 48f, "%.0f")) s.ItemHudIconSize = size;
|
|
ImGui.Separator();
|
|
if (ImGui.MenuItem("Edit items...")) s.ShowSetup = true;
|
|
if (ImGui.MenuItem("Hide HUD")) s.ShowItemHud = false;
|
|
ImGui.EndPopup();
|
|
}
|
|
}
|