RynthSuite/Plugins/RynthCore.Plugin.RynthInventory/InventoryCommand.cs
BlankenshipG dc08e1abba feat: SK backlog from test through 2026.11.22.48 (Trade Shop, Oracle, quests, loot, nav)
Squash of test/main-merge-2026-10-25 onto aelrynth main 2026.11.19.1 for the standing sk PR. Includes Trade Shop, Oracle wiki/ILT tracker, quest runs, loot checklist, RynthNav, VTank import. HandWrittenVersion remains 0.5.0-legacy-ui. See Changelog/2026-11-22-sk-backlog-test-merge.md.
2026-11-23 00:08:38 -05:00

44 lines
2.2 KiB
C#

using RynthCore.Plugin.Shared;
namespace RynthCore.Plugin.RynthInventory;
internal enum InventoryVerb { Window, Scan, Keep, Reload, Status, Help, Search, Bank, Trade }
/// <summary>
/// A parsed "/ginv ..." and the lines it answers with (2026-10-28: every command answers,
/// Plugins/Shared/CommandReply.cs). Anything that isn't a verb is a search. Pure, so
/// RynthInventory.Tests checks every word.
/// </summary>
internal readonly record struct InventoryCommand(InventoryVerb Verb, string Text = "")
{
public static InventoryCommand Parse(string? arg)
{
string a = (arg ?? string.Empty).Trim();
return a.ToLowerInvariant() switch
{
"" => new(InventoryVerb.Window),
"scan" or "rescan" => new(InventoryVerb.Scan),
"keep" => new(InventoryVerb.Keep),
"reload" => new(InventoryVerb.Reload),
"status" => new(InventoryVerb.Status),
"help" or "?" => new(InventoryVerb.Help),
// The test branch's Banking tab (Infinite Leaftide) and trade list.
"bank" or "banking" => new(InventoryVerb.Bank),
"trade" => new(InventoryVerb.Trade),
_ => new(InventoryVerb.Search, a),
};
}
public const string Usage =
"/ginv (window), /ginv <text> (search), /ginv trade (trade list), /ginv bank (every character's bank, Infinite Leaftide), /ginv scan (rescan and save now), /ginv keep (record the open container as storage), /ginv reload, /ginv status. "
+ "To find items like one you carry, right-click it in the Inventory panel: Find like this in Global Inventory (/ginv like clear removes that filter).";
public const string NoWindows =
"This RynthCore engine can't show plugin windows (it needs script windows, API v71, with ImGui on). Scanning and saving still work; /ginv status shows what was saved.";
/// <summary>/ginv alone: the window after the toggle.</summary>
public static string Window(bool shown) => CommandReply.Shown("Global Inventory", shown);
/// <summary>/ginv &lt;text&gt;: the search the window now shows.</summary>
public static string Searching(string text) => $"Global Inventory: searching for '{text.Trim()}'.";
}