RynthSuite/Plugins/RynthCore.Plugin.RynthAi/IltHub/IltHubState.cs
BlankenshipG 09b14d4ed1 feat(rynthai): ILT Hub, HUDs, item info, chat translation, ground loot and nav editing
- 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>
2026-10-05 16:52:13 -04:00

285 lines
13 KiB
C#

// IltHubState.cs — Persisted per-character state for the ILT Hub (Infinite Leaftide tools).
//
// Lives in <charFolder>\ilt-hub.json, deliberately separate from the combat settings
// profile (Default.json / /ra settings) so ILT data never leaks into combat profiles and
// non-ILT characters stay untouched. Serialized with the NativeAOT source-generated
// RynthAiJsonContext (IncludeFields = true), so plain public fields are used throughout.
using System;
using System.Collections.Generic;
namespace RynthCore.Plugin.RynthAi.IltHub;
/// <summary>Root of everything the Hub remembers between sessions.</summary>
public sealed class IltHubState
{
/// <summary>Bumped when the shape changes in a way that needs a migration.</summary>
public int SchemaVersion = 1;
// ── Window / shell ──────────────────────────────────────────────────────
/// <summary>
/// Hub UI on screen: the Mini Remote or any ILT section window (IltHubController.Tick keeps it
/// current). Bank auto-refresh and the gear / split-arrow scans run only while it is true.
/// </summary>
public bool WindowVisible;
/// <summary>Unused since the tabbed Hub window was retired; kept so old files still load.</summary>
public int SelectedTab;
public bool GamesHudVisible = true;
/// <summary>
/// "This world is an ACECustom/ILT shard even though its name isn't InfiniteLeaftide."
/// World-identity override ONLY: it makes the Hub ask the server for its options, it
/// never turns a feature on by itself.
/// </summary>
public bool ForceLeaftideFeatures;
/// <summary>True once the one-time UtilityBelt sidecar import has run for this character.</summary>
public bool UbSidecarsImported;
/// <summary>Last-seen server feature bits. Cache only — overwritten by every login refresh.</summary>
public IltServerOptionsSnapshot ServerOptions = new();
public IltBankState Bank = new();
public IltPetState Pet = new();
public IltCharacterState Character = new();
public IltGearState Gear = new();
public IltGamesState Games = new();
public IltGuardianState Guardian = new();
}
/// <summary>Cached result of the server-options check (see IltServerOptions).</summary>
public sealed class IltServerOptionsSnapshot
{
public string WorldName = string.Empty;
/// <summary>"ilt-features" (structured dump), "probe" (command probing) or "" (never refreshed).</summary>
public string Source = string.Empty;
public DateTime LastRefreshUtc = DateTime.MinValue;
/// <summary>Feature key → -1 unknown, 0 off, 1 on.</summary>
public Dictionary<string, int> Bits = new(StringComparer.OrdinalIgnoreCase);
}
// ── Banking ─────────────────────────────────────────────────────────────────
public sealed class IltBankState
{
public long Pyreals;
public long Luminance;
public long LegendaryKeys;
public long MythicalKeys;
public long EnlightenedCoins;
public long WeaklyEnlightenedCoins;
public DateTime LastUpdated = DateTime.MinValue;
/// <summary>Last transfer recipient typed into the transfer form.</summary>
public string TransferTarget = string.Empty;
public int TransferCurrencyIndex;
/// <summary>Re-issue /bank every N seconds while the Hub is open (0 = manual only).</summary>
public int AutoRefreshSeconds = 120;
}
/// <summary>One "Transferred …" / "Received …" bank line seen in chat.</summary>
public sealed class IltBankTransaction
{
public DateTime Timestamp;
/// <summary>"Sent" or "Received".</summary>
public string Type = string.Empty;
public string Currency = string.Empty;
public long Amount;
public string OtherPlayer = string.Empty;
public string Description = string.Empty;
}
// ── Pet ─────────────────────────────────────────────────────────────────────
public sealed class IltPetState
{
// Healing-pet automation (UB "HealingBuddy" subset).
public bool HealingEnabled;
/// <summary>Exact name of the heal-pet essence to use; empty = auto-detect (Healing Buddy / Dule box).</summary>
public string HealPetName = string.Empty;
public int HealthThresholdPercent = 80;
/// <summary>Do not summon when current HP is below this (summoning mid-death wastes the use). 0 = off.</summary>
public int MinHealthPoints = 100;
public bool AutoDespawnAfterHeal = true;
public int RespawnDelaySeconds = 2;
public int PetTimeoutSeconds = 30;
/// <summary>
/// Allow a combat summon from an EMPTY essence when the Summon Essence Refill Charm is
/// active (server refills from banked pyreals). Still requires the server flag to be on.
/// </summary>
public bool UsePyrealRefillPath;
/// <summary>Last captured /pets and /shinies rosters (display only).</summary>
public List<string> PetLog = new();
public List<string> ShinyLog = new();
// ── Pet roster (UB Pets-tab style) ──
/// <summary>Roster type shown in the Pet tab (IltPetKind: 0 Combat, 1 Healing, 2 Cosmetic).</summary>
public int RosterKind;
/// <summary>Roster sort (IltPetSort: 0 Priority, 1 Bond, 2 Potency, 3 Breed ready, 4 Level, 5 Uses, 6 Name).</summary>
public int RosterSort;
/// <summary>User type overrides by essence name; essences not listed are auto-classified.</summary>
public List<IltPetAssignment> Assignments = new();
/// <summary>Essence name of the chosen cosmetic (display) pet; empty = none.</summary>
public string CosmeticPetName = string.Empty;
/// <summary>Keep the cosmetic pet summoned while in peace mode; it is dismissed when a combat pet is needed.</summary>
public bool KeepCosmeticOut;
/// <summary>Seconds to wait before re-summoning the cosmetic pet after it despawns.</summary>
public int CosmeticRespawnSeconds = 15;
}
/// <summary>A user's choice of summon type for one essence (matched by name, case-insensitive).</summary>
public sealed class IltPetAssignment
{
public string Name = string.Empty;
/// <summary>IltPetKind as int (0 Combat, 1 Healing, 2 Cosmetic).</summary>
public int Kind;
}
// ── Character ───────────────────────────────────────────────────────────────
public sealed class IltCharacterState
{
/// <summary>Item → coin conversion table used by the session-rates strip.</summary>
public List<IltItemConversion> ItemConversions = new()
{
new IltItemConversion { ItemName = "Strawberry Jam Jar", ItemsPerConversion = 100, CoinsPerConversion = 10 },
new IltItemConversion { ItemName = "Ancient Pyreal", ItemsPerConversion = 100, CoinsPerConversion = 37 },
};
/// <summary>Augmentation planner targets, keyed by aug type (lowercase).</summary>
public Dictionary<string, int> AugTargets = new(StringComparer.OrdinalIgnoreCase);
/// <summary>Luminance price of one Enlightened Coin (planner math only; 0 = don't price coins).</summary>
public long LumPerEnlightenedCoin;
/// <summary>Enlightenment planner target level (0 = current + 5).</summary>
public int EnlTargetLevel;
public int EnlightenedCoinsPerToken = 20;
/// <summary>
/// Auto-enlighten preference. Even when true it stays DISARMED each session until the
/// player confirms in the Hub, and the server's own Yes/No dialog is never auto-clicked.
/// </summary>
public bool AutoEnlightenEnabled;
public int AutoEnlightenCheckSeconds = 30;
/// <summary>Spend unassigned XP with /attr before sending /enl (enlightening wipes unspent XP).</summary>
public bool AutoEnlightenSpendXpFirst;
/// <summary>Quest Tracker search box contents.</summary>
public string QuestFilter = string.Empty;
public string QbFilter = string.Empty;
/// <summary>Starred quest flag keys (lowercase), shown on the floating favorites HUD.</summary>
public List<string> QuestFavorites = new();
/// <summary>Quest tracker lists starred quests only.</summary>
public bool QuestFavoritesOnly;
/// <summary>Floating quest favorites HUD is shown.</summary>
public bool ShowQuestFavoritesHud;
public bool QuestFavoritesHudLocked;
// ILT section windows, opened from the Mini Remote's Options (IltSections).
/// <summary>The "Quests" window (tracker + quest bonus) is open.</summary>
public bool QuestTrackerPoppedOut;
/// <summary>The "Pets" window is open.</summary>
public bool PetsWindowOpen;
/// <summary>The "ILT Character" window (world status, session rates) is open.</summary>
public bool CharacterWindowOpen;
/// <summary>The "Banking" window is open.</summary>
public bool BankingWindowOpen;
/// <summary>The "Gear" window is open.</summary>
public bool GearWindowOpen;
/// <summary>The "Games" window is open.</summary>
public bool GamesWindowOpen;
/// <summary>The "Guardian" window (riddle translator, attribute tracker) is open.</summary>
public bool GuardianWindowOpen;
/// <summary>
/// Registry charms this character has carried, keyed by charm name. Lets the Charms Tracking
/// tab report "acquired" for charms that are now in storage (the client only sees carried items).
/// </summary>
public Dictionary<string, IltCharmSeen> CharmsSeen = new(StringComparer.OrdinalIgnoreCase);
}
/// <summary>Last time a charm was seen in the character's possession, with its best tier.</summary>
public sealed class IltCharmSeen
{
public int Tier;
public int MaxTier;
public DateTime LastSeenUtc;
}
public sealed class IltItemConversion
{
public string ItemName = string.Empty;
public int ItemsPerConversion = 100;
public int CoinsPerConversion;
}
// ── Gear ────────────────────────────────────────────────────────────────────
public sealed class IltGearState
{
// Dispel (Rune of Dispel on harmful debuffs)
public bool AutoDispel;
public int DispelCooldownSeconds = 10;
/// <summary>Spell-name substrings that are ALWAYS dispelled.</summary>
public List<string> DispelInclusions = new();
/// <summary>Spell-name substrings that are NEVER dispelled.</summary>
public List<string> DispelExclusions = new();
// Surging Strength (Empowered Volcanic Ember keeper)
public bool SurgingStrength;
public int SurgingCooldownSeconds = 15;
// Aetheria / corrupted-weapon chunking
public bool AutoChunkAetheria;
public bool AutoChunkCorrupted;
public bool ChunkInCombat;
public int ChunkIntervalMs = 2000;
/// <summary>Only chunk aetheria whose max level is below this (Coalesced always chunks).</summary>
public int ChunkAetheriaUnderLevel = 4;
// Auto-clap (/clap all)
public bool AutoClap;
public int ClapIntervalMinutes = 30;
// Guardian Hand charm (WCID unpublished — name match until set)
public uint GuardianHandWcid;
public string GuardianHandName = "Guardian Hand";
// Split arrows (White Quartz imbue on missile weapons)
public int SplitArrowTarget = 3;
public bool SplitIgnoreImbued = true;
// Equipment profiles (.utl suits) and VTank .usd import
public string LastEquipProfile = string.Empty;
public string LastUsdPath = string.Empty;
}
// ── Games ───────────────────────────────────────────────────────────────────
public sealed class IltGamesState
{
public long BlackjackBet = 1_000_000;
public long FellowshipBlackjackBet = 1_000_000;
public int PowerballQuantity = 1;
}
// ── Guardian (Temple of Enlightenment) ──────────────────────────────────────
public sealed class IltGuardianState
{
/// <summary>Translate incoming guardian tells and show the answer (Guardian window + Mini Remote).</summary>
public bool AutoDetectFromChat = true;
/// <summary>After a chat answer, give the item to the guardian automatically.</summary>
public bool AutoHandIn;
/// <summary>Temple guardian only: buy one of the item from the nearest vendor when none is carried.</summary>
public bool BuyMissingFromVendor = true;
/// <summary>Assumed attribute turn-in cooldown when only /qb wait stamps are known (hours).</summary>
public int CooldownHoursAssumed = 20;
/// <summary>Turn-ins counted from /qb wait-stamp transitions, keyed by attribute (fallback when /myquests lacks the flag).</summary>
public Dictionary<string, int> TurnInCounts = new(StringComparer.OrdinalIgnoreCase);
/// <summary>Estimated end of each attribute's cooldown (UTC), keyed by attribute (same fallback).</summary>
public Dictionary<string, DateTime> CooldownUntilUtc = new(StringComparer.OrdinalIgnoreCase);
}