// IltSections.cs - The ILT Hub's sections, each its own window, opened from the Mini Remote's // Options or "/ra hub open
". Open flags live in IltCharacterState (per character). using System; namespace RynthCore.Plugin.RynthAi.IltHub; /// Section windows. Values index per-section arrays, so new sections go at the end. internal enum IltSection { Character, Quests, Pet, Banking, Gear, Games, Guardian, } internal static class IltSections { /// Menu order (the old Hub's tab order, then the Guardian window). public static readonly IltSection[] All = { IltSection.Character, IltSection.Quests, IltSection.Pet, IltSection.Banking, IltSection.Gear, IltSection.Games, IltSection.Guardian, }; public static string Label(IltSection s) => s switch { IltSection.Character => "Character", IltSection.Quests => "Quests", IltSection.Pet => "Pets", IltSection.Banking => "Banking", IltSection.Gear => "Gear", IltSection.Games => "Games", IltSection.Guardian => "Guardian", _ => s.ToString(), }; /// Parses a "/ra hub open" section name (a few aliases accepted). public static bool TryParse(string text, out IltSection section) { switch ((text ?? string.Empty).Trim().ToLowerInvariant()) { case "character": case "char": case "rates": section = IltSection.Character; return true; case "quests": case "quest": section = IltSection.Quests; return true; case "pets": case "pet": section = IltSection.Pet; return true; case "banking": case "bank": section = IltSection.Banking; return true; case "gear": section = IltSection.Gear; return true; case "games": case "game": section = IltSection.Games; return true; case "guardian": case "temple": case "riddle": section = IltSection.Guardian; return true; default: section = IltSection.Character; return false; } } public static bool IsOpen(IltCharacterState cs, IltSection s) => s switch { IltSection.Character => cs.CharacterWindowOpen, IltSection.Quests => cs.QuestTrackerPoppedOut, IltSection.Pet => cs.PetsWindowOpen, IltSection.Banking => cs.BankingWindowOpen, IltSection.Gear => cs.GearWindowOpen, IltSection.Games => cs.GamesWindowOpen, IltSection.Guardian => cs.GuardianWindowOpen, _ => false, }; public static void SetOpen(IltCharacterState cs, IltSection s, bool open) { switch (s) { case IltSection.Character: cs.CharacterWindowOpen = open; break; case IltSection.Quests: cs.QuestTrackerPoppedOut = open; break; case IltSection.Pet: cs.PetsWindowOpen = open; break; case IltSection.Banking: cs.BankingWindowOpen = open; break; case IltSection.Gear: cs.GearWindowOpen = open; break; case IltSection.Games: cs.GamesWindowOpen = open; break; case IltSection.Guardian: cs.GuardianWindowOpen = open; break; } } /// True when any section window is open. public static bool AnyOpen(IltCharacterState cs) { foreach (IltSection s in All) if (IsOpen(cs, s)) return true; return false; } /// "show" / "hide" / "toggle" (anything else toggles) applied to the current state. public static bool Resolve(string mode, bool current) => (mode ?? string.Empty).ToLowerInvariant() switch { "show" or "on" or "open" => true, "hide" or "off" or "close" => false, _ => !current, }; }