namespace XFEWarframe.Desktop.Editing;
/// <summary>One category tree for both desktop applications. Keys are inventory/API keys.</summary>
public sealed record InventorySection(string Key, string Title, params InventorySection[] Children)
{
public string Label => UiText.Translate(Title);
}
public static class InventoryNavigation
{
public const string Prefix = "inventory:";
public static IReadOnlyList<InventorySection> Sections { get; } =
[
new("MiscItems", "物品", new("catalog", "全部物品目录"), new("Recipes", "蓝图"), new("Consumables", "消耗品"), new("VoidProjections", "虚空遗物"), new("LevelKeys", "任务钥匙"), new("Boosters", "加成")),
new("Suits", "战甲"),
new("LongGuns", "武器", new("Pistols", "副武器"), new("Melee", "近战武器"), new("DataKnives", "灭骸之刃"), new("OperatorAmps", "指挥官增幅器"), new("DrifterWeapons", "漂泊者远程武器"), new("DrifterMelee", "漂泊者近战武器")),
new("RawUpgrades", "MOD 与赋能", new("Upgrades", "已升级 MOD"), new("riven", "紫卡工坊")),
new("Sentinels", "伙伴", new("SentinelWeapons", "守护武器"), new("KubrowPets", "动物伙伴"), new("MoaPets", "机械伙伴"), new("Drones", "无人机")),
new("SpaceSuits", "载具与 Archwing", new("SpaceGuns", "Archwing 枪械"), new("SpaceMelee", "Archwing 近战"), new("MechSuits", "殁世机甲"), new("Hoverboards", "K 驱悬浮板"), new("Horses", "凯骸"), new("Motorcycles", "原拓密骑")),
new("CrewShips", "航道星舰", new("CrewShipHarnesses", "锐捷号"), new("CrewMembers", "船员"), new("CrewShipWeapons", "星舰武器"), new("CrewShipWeaponSkins", "星舰部件"), new("CrewShipSalvagedWeapons", "星舰武器残骸"), new("CrewShipSalvagedWeaponSkins", "星舰部件残骸"), new("CrewShipRawSalvage", "星舰残骸"), new("CrewShipAmmo", "星舰弹药")),
new("FlavourItems", "外观与装饰", new("WeaponSkins", "武器外观"), new("ShipDecorations", "飞船装饰"), new("Ships", "登陆艇"), new("OperatorSuits", "指挥官服饰")),
new("QuestKeys", "系列任务"), new("EvolutionProgress", "灵化进度"),
new("settings", "账号规则"), new("templates", "存档模板"),
new("guild.settings", "氏族", new("guild.research", "研究"), new("guild.members", "成员"), new("guild.alliance", "联盟"), new("guild.VaultMiscItems", "资源金库"), new("guild.VaultShipDecorations", "装饰金库"), new("guild.VaultDecoRecipes", "装饰蓝图"), new("guild.currency", "货币金库")),
new("SpecialItems", "显赫武器与其他装备", new("Antiques", "古物"), new("Scoops", "月动球装备"))
];
public static IEnumerable<InventorySection> All => Flatten(Sections);
private static IEnumerable<InventorySection> Flatten(IEnumerable<InventorySection> sections) => sections.SelectMany(x => new[] { x }.Concat(Flatten(x.Children)));
public static string Route(string key) => Prefix + key;
public static string? Category(object? parameter) => parameter is string text && text.StartsWith(Prefix, StringComparison.Ordinal)
? All.FirstOrDefault(x => x.Key == text[Prefix.Length..])?.Key : null;
public static string Label(string key) => All.FirstOrDefault(x => x.Key == key)?.Label ?? key;
public static bool RequiresEditing(string key) => key is "settings" or "progress" or "templates" || key.StartsWith("guild.", StringComparison.Ordinal);
public static string? CatalogCategory(string key) => key switch
{
"Upgrades" => "RawUpgrades",
"QuestKeys" or "EvolutionProgress" or "riven" or "catalog" => null,
_ when RequiresEditing(key) => null,
_ => key
};
}
namespace XFEWarframe.Desktop.Editing;
/// <summary>One category tree for both desktop applications. Keys are inventory/API keys.</summary>
public sealed record InventorySection(string Key, string Title, params InventorySection[] Children)
{
public string Label => UiText.Translate(Title);
}
public static class InventoryNavigation
{
public const string Prefix = "inventory:";
public static IReadOnlyList<InventorySection> Sections { get; } =
[
new("MiscItems", "物品", new("catalog", "全部物品目录"), new("Recipes", "蓝图"), new("Consumables", "消耗品"), new("VoidProjections", "虚空遗物"), new("LevelKeys", "任务钥匙"), new("Boosters", "加成")),
new("Suits", "战甲"),
new("LongGuns", "武器", new("Pistols", "副武器"), new("Melee", "近战武器"), new("DataKnives", "灭骸之刃"), new("OperatorAmps", "指挥官增幅器"), new("DrifterWeapons", "漂泊者远程武器"), new("DrifterMelee", "漂泊者近战武器")),
new("RawUpgrades", "MOD 与赋能", new("Upgrades", "已升级 MOD"), new("riven", "紫卡工坊")),
new("Sentinels", "伙伴", new("SentinelWeapons", "守护武器"), new("KubrowPets", "动物伙伴"), new("MoaPets", "机械伙伴"), new("Drones", "无人机")),
new("SpaceSuits", "载具与 Archwing", new("SpaceGuns", "Archwing 枪械"), new("SpaceMelee", "Archwing 近战"), new("MechSuits", "殁世机甲"), new("Hoverboards", "K 驱悬浮板"), new("Horses", "凯骸"), new("Motorcycles", "原拓密骑")),
new("CrewShips", "航道星舰", new("CrewShipHarnesses", "锐捷号"), new("CrewMembers", "船员"), new("CrewShipWeapons", "星舰武器"), new("CrewShipWeaponSkins", "星舰部件"), new("CrewShipSalvagedWeapons", "星舰武器残骸"), new("CrewShipSalvagedWeaponSkins", "星舰部件残骸"), new("CrewShipRawSalvage", "星舰残骸"), new("CrewShipAmmo", "星舰弹药")),
new("FlavourItems", "外观与装饰", new("WeaponSkins", "武器外观"), new("ShipDecorations", "飞船装饰"), new("Ships", "登陆艇"), new("OperatorSuits", "指挥官服饰")),
new("QuestKeys", "系列任务"), new("EvolutionProgress", "灵化进度"),
new("settings", "账号规则"), new("templates", "存档模板"),
new("guild.settings", "氏族", new("guild.research", "研究"), new("guild.members", "成员"), new("guild.alliance", "联盟"), new("guild.VaultMiscItems", "资源金库"), new("guild.VaultShipDecorations", "装饰金库"), new("guild.VaultDecoRecipes", "装饰蓝图"), new("guild.currency", "货币金库")),
new("SpecialItems", "显赫武器与其他装备", new("Antiques", "古物"), new("Scoops", "月动球装备"))
];
public static IEnumerable<InventorySection> All => Flatten(Sections);
private static IEnumerable<InventorySection> Flatten(IEnumerable<InventorySection> sections) => sections.SelectMany(x => new[] { x }.Concat(Flatten(x.Children)));
public static string Route(string key) => Prefix + key;
public static string? Category(object? parameter) => parameter is string text && text.StartsWith(Prefix, StringComparison.Ordinal)
? All.FirstOrDefault(x => x.Key == text[Prefix.Length..])?.Key : null;
public static string Label(string key) => All.FirstOrDefault(x => x.Key == key)?.Label ?? key;
public static bool RequiresEditing(string key) => key is "settings" or "progress" or "templates" || key.StartsWith("guild.", StringComparison.Ordinal);
public static string? CatalogCategory(string key) => key switch
{
"Upgrades" => "RawUpgrades",
"QuestKeys" or "EvolutionProgress" or "riven" or "catalog" => null,
_ when RequiresEditing(key) => null,
_ => key
};
}