using System; using RynthCore.Plugin.RynthAi; using RynthCore.Plugin.RynthOracle.Data; using RynthCore.PluginSdk; namespace RynthCore.Plugin.RynthOracle; /// Everything the views read and the actions they can take. Pump thread only. internal sealed class OracleContext { public RynthCoreHost Host; public readonly OracleSettings Settings = new(); public readonly QuestFlagStore Flags = new(); public readonly QuestCatalog Catalog = new(); public readonly QuestCatalogUpdater Updater = new(); /// This character's tracked quests and recorded rewards (loaded once the name is known). public readonly QuestBook Book = new(); public readonly CharacterSnapshot Character = new(); public readonly VoidTracker Void = new(); public readonly FellowshipTracker Fellowship = new(); public readonly ServerIdentity Server = new(); /// RynthILT's server profile (Leaftide features, fellowship rules); None without RynthILT. public readonly IltServerLink Ilt = new(); /// RynthILT's "RynthILT.Data" (the Character tab's charms list and Toggle buttons). public readonly RynthCore.Plugin.Shared.RynthIltDataClient IltData = new(); /// The charms RynthILT last reported (None without RynthILT); read while the Character tab shows. public RynthCore.Plugin.Shared.IltCharmsView Charms = RynthCore.Plugin.Shared.IltCharmsView.None; /// RynthAi's session (the one session every tracker shows); read while the Character tab shows. public readonly RynthCore.Plugin.Shared.RynthAiSessionClient AiSession = new(); /// The last session RynthAi reported; SessionKnown false without RynthAi. public RynthCore.Plugin.Shared.SessionStatsV1 Session; public bool SessionKnown; /// The last charm Toggle's outcome, shown under the charms list. public string CharmMessage = ""; /// RynthILT's pet breeding tracker (None without it); read while the Pet Breeding tab shows. public RynthCore.Plugin.Shared.IltBreedingView Breeding = RynthCore.Plugin.Shared.IltBreedingView.None; /// The last breeding button's outcome, shown under the tab's buttons. public string BreedingMessage = ""; /// Set by the plugin: sends a verb to RynthILT's breeding tracker (RynthIltDataApi PetBreedingCommand). public Func BreedingCommand = _ => false; /// RynthILT's Temple guardians (None without RynthILT 0.2.20+); read while the Quests tab shows on Infinite Leaftide. public RynthCore.Plugin.Shared.IltGuardianView Guardian = RynthCore.Plugin.Shared.IltGuardianView.None; /// Goes up each time changes, so the Quests list rebuilds its guardian rows. public int GuardianRevision; /// The last guardian button's outcome, shown under the guardian controls. public string GuardianMessage = ""; /// Set by the plugin: sends a verb to RynthILT's guardians (RynthIltDataApi GuardianCommand). public Func GuardianCommand = _ => false; /// RynthCore's server list (API v86) and the active server owner's settings; State null on older engines. public readonly RynthCore.Plugin.Shared.ServerStateClient ServerState = new(); /// ConquestAC-only data (tag Conquest); fed only while on ConquestAC. public readonly ConquestData Conquest = new(); /// Aelrynth's leaderboards (tag Aelrynth); fed only while on Aelrynth. public readonly AelrynthBoards Boards = new(); /// Titles the character holds (engine API v75); TitlesKnown false until the engine has the list. public readonly System.Collections.Generic.HashSet EarnedTitles = new(); public bool TitlesKnown; public uint CurrentTitle; public bool InWorld; public long NowMs; public DateTime UtcNow; /// The last thing the quest list check said, shown on the About tab. public string UpdaterMessage = ""; /// Set by the plugin: sends /myquests (reply hidden when the setting says so). public Action RequestQuests = () => { }; /// Set by the plugin: sends a chat command to the server as if typed (the views' buttons). public Func Send = _ => false; /// Set by the plugin: asks RynthILT to use a carried charm or Guardian Hand (its toggle id). public Func ToggleCharm = _ => false; /// Set by the plugin: runs a chat command through RynthCore's plugin dispatch (another plugin's window). public Func RunCommand = _ => false; /// /// Set by the plugin: tells the engine which SkillsFace body to embed in Oracle /// (0 Skills, 1 Attributes, 2 Progress, -1 off). Bridge is /rc oracle-skills. /// public Action SkillsEmbedChanged = _ => { }; /// Set by the plugin: shows or hides the Quest Timers window. public Action SetQuestTimersWindow = _ => { }; /// Set by the plugin: whether the Quest Timers window is showing. public Func QuestTimersWindowVisible = () => false; public Func Props => id => Character.Int(Host, id); /// A line in the player's chat window only (nothing is sent to the server). public void Print(string text) { if (!Host.WriteToChat("[RynthOracle] " + text, 1)) Host.Log("[RynthOracle] " + text); } }