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.
This commit is contained in:
parent
660e6b5b1c
commit
dc08e1abba
521 changed files with 47247 additions and 795 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
using RynthCore.Plugin.RynthOracle.Views;
|
||||
|
|
@ -19,10 +21,15 @@ namespace RynthCore.Plugin.RynthOracle;
|
|||
/// </summary>
|
||||
public sealed class RynthOraclePlugin : RynthPluginBase
|
||||
{
|
||||
// Previous release: 0.2.2.
|
||||
public const string Version = "0.3.0";
|
||||
// The landblock the character was last outdoors in (a building's rooms belong to it; 0: not seen yet).
|
||||
private uint _lastOutdoorLandblock;
|
||||
|
||||
// Previous release: 0.7.5.
|
||||
public const string Version = "0.7.6";
|
||||
|
||||
private const long QuestReadDelayMs = 6000; // after login, before the hidden /myquests
|
||||
// After /myquests: ask RynthILT for /qb list so Dynamic stamps match (those flags are not in /myquests).
|
||||
private const long QbListDelayMs = 8000;
|
||||
private const long CharacterReadMs = 1000;
|
||||
// The Character tab's session (RynthAi): read only while that tab is on screen.
|
||||
private const long CharacterExtrasReadMs = 2000;
|
||||
|
|
@ -39,7 +46,7 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
|
||||
private readonly OracleContext _c = new();
|
||||
private readonly UiHost _ui = new();
|
||||
private UiWindow? _main, _void, _timers;
|
||||
private UiWindow? _main, _void, _timers, _offerWin, _iltTracker;
|
||||
private OracleView? _mainView;
|
||||
private VoidView? _voidView;
|
||||
private QuestTimersView? _timersView;
|
||||
|
|
@ -52,8 +59,20 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
private long _nextCharacterReadMs;
|
||||
private long _nextCharacterExtrasMs;
|
||||
private bool _voidAutoDecided;
|
||||
private bool _dailyCheckStarted;
|
||||
private int _seenFlagRevision = -1, _seenCatalogRevision = -1, _seenVoidRevision = -1;
|
||||
// Auto refresh (Settings QuestRefreshMinutes): the later of the login and RynthOracle's own last
|
||||
// automatic /myquests; the flags' last reply counts too (TickData).
|
||||
private DateTime _autoQuestSinceUtc = DateTime.MinValue;
|
||||
private int _seenFlagRevision = -1, _seenCatalogRevision = -1, _seenVoidRevision = -1, _seenIltRevision = -1;
|
||||
private int _seenGuideRevision = -1, _seenRunnerRevision = -1;
|
||||
// Infinite Leaftide (ServerIdentity.IsIlt): RynthILT's Temple guardian JSON last read, and when next.
|
||||
private long _nextGuardianMs;
|
||||
private string _guardianJson = "";
|
||||
// The Dynamic stamp sources last logged (LogStampSources), and the revisions they were read at.
|
||||
private (int InMyQuests, int InQb, int Matched) _loggedStamps = (-1, -1, -1);
|
||||
private int _stampFlagRevision = -1, _stampIltRevision = -1;
|
||||
// Infinite Leaftide: /qb list asked once this session for Dynamic stamps (does not need the Quests tab open).
|
||||
private bool _qbAskedForStamps;
|
||||
private long _qbAskAtMs = -1;
|
||||
// RynthCore's server list (ServerStateClient.Revision) last applied to the server identity.
|
||||
private int _seenServerStateRevision = -1;
|
||||
private string? _catalogKey; // what the catalog was loaded for (QuestPackSource.Key; "" = retail only)
|
||||
|
|
@ -61,6 +80,9 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
private int _titleCount = -2;
|
||||
private uint _titleCurrent;
|
||||
private long _nextAutoReadMs;
|
||||
private int _seenServerGuideRevision = -1;
|
||||
// A kill line came while the Kill Tasks tab was open: read /myquests again on the next allowed minute.
|
||||
private bool _killReadWanted;
|
||||
private DateTime _seenReadUtc = DateTime.MinValue;
|
||||
// The server's "again in" wait not yet checked against a read made after it (the log line).
|
||||
private (TimeSpan Left, DateTime AtUtc)? _uncheckedServerWait;
|
||||
|
|
@ -77,10 +99,15 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_c.RequestQuests = RequestQuests;
|
||||
_c.RereadCharacter = RereadCharacter;
|
||||
_c.RereadTitles = RereadTitles;
|
||||
_c.RescanT11 = () => { _nextT11Ms = 0; ReadT11(Environment.TickCount64); };
|
||||
_c.ReloadQuestList = ReloadQuestList;
|
||||
_c.Send = cmd => _c.InWorld && Host.InvokeChatParser(cmd);
|
||||
_c.RunCommand = cmd => _c.InWorld && Host.InvokeChatParser(cmd);
|
||||
_c.GuardianCommand = GuardianCommand;
|
||||
_c.SendNav = line => Host.HasSendPluginCommand && Host.SendPluginCommand("RynthNav", "rnav", line);
|
||||
_c.SendAi = (action, value) => Host.HasSendPluginCommand && Host.SendPluginCommand("RynthAi", action, value);
|
||||
// Run this quest (the wiki quest guide): RynthNav walks the steps, RynthAi picks up the quest's items.
|
||||
_c.Runner = new QuestRunner(line => _c.SendNav(line), line => _c.SendAi("questloot", line), t => _c.Print(t));
|
||||
_ui.Log = msg => Host.Log(msg);
|
||||
|
||||
_mainView = new OracleView(_c);
|
||||
|
|
@ -92,6 +119,13 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
{
|
||||
DefaultWidth = 700f, DefaultHeight = 600f, MinWidth = 420f, MinHeight = 260f,
|
||||
});
|
||||
// Infinite Leaftide only: ILT Tracker left the Oracle tab strip for its own bar icon
|
||||
// (2026-11-22). ShowInBar is toggled with IsIlt on each tick (SyncIltTrackerBar).
|
||||
_iltTracker = _ui.Add(new UiWindow("RynthOracle/IltTracker", OracleView.TabT11)
|
||||
{
|
||||
DefaultWidth = 700f, DefaultHeight = 600f, MinWidth = 420f, MinHeight = 260f,
|
||||
ShowInBar = false, BarButton = true,
|
||||
});
|
||||
// The Void window is opened from the Oracle window: no bar button (and no Scripts menu
|
||||
// line, which would bring back the Scripts button just for it).
|
||||
_void = _ui.Add(new UiWindow("RynthOracle/Void", "Void")
|
||||
|
|
@ -109,6 +143,14 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
ShowInBar = false,
|
||||
});
|
||||
_c.SetQuestTimersWindow = SetQuestTimers;
|
||||
// The quest offer (2026-11-08): an NPC who starts a guide quest talks to you; asks whether to run it.
|
||||
_offerWin = _ui.Add(new UiWindow("RynthOracle/QuestOffer", "Quest offer")
|
||||
{
|
||||
DefaultWidth = 360f, DefaultHeight = 200f, MinWidth = 240f, MinHeight = 100f,
|
||||
ShowInBar = false,
|
||||
});
|
||||
_mainView.SetOfferWindow = v => { if (_offerWin != null) { _offerWin.Visible = v; _offerWin.NeedsPass = true; } };
|
||||
_mainView.ShowMainWindow = () => { if (_main != null) { _main.Visible = true; _main.NeedsPass = true; } };
|
||||
_c.QuestTimersWindowVisible = () => _timers?.Visible ?? false;
|
||||
|
||||
Host.Log($"[RynthOracle] {Version} initialized. /ro opens the window. Based on Oracle of Dereth by Advis Eveldan - thank you!");
|
||||
|
|
@ -135,6 +177,7 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_c.InWorld = true;
|
||||
_c.Flags.Clear();
|
||||
_c.Void.Clear();
|
||||
_c.Gear.Clear();
|
||||
_c.Server.Reset();
|
||||
_c.ServerState.Clear();
|
||||
_c.ServerState.Poll(Host, Environment.TickCount64, force: true);
|
||||
|
|
@ -153,11 +196,14 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
long now = Environment.TickCount64;
|
||||
_loginMs = now;
|
||||
_questReadAtMs = _c.Settings.ReadQuestsAtLogin ? now + QuestReadDelayMs : -1;
|
||||
// Dynamic stamps live in /qb, not /myquests: ask once even when the Oracle window stays closed.
|
||||
_qbAskedForStamps = false;
|
||||
_qbAskAtMs = now + QbListDelayMs;
|
||||
_nextCharacterReadMs = now;
|
||||
_nextCharacterExtrasMs = now;
|
||||
ClearCharacterExtras();
|
||||
_voidAutoDecided = false;
|
||||
_dailyCheckStarted = false;
|
||||
_autoQuestSinceUtc = DateTime.UtcNow;
|
||||
if (_main != null) { _main.Visible = _c.Settings.MainWindowOpen; _main.NeedsPass = true; }
|
||||
if (_void != null) { _void.Visible = false; _void.NeedsPass = true; }
|
||||
// The quest book loads once the character's name (and world) are known (TickData).
|
||||
|
|
@ -183,6 +229,7 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
if (_main != null) { _main.Visible = false; _main.NeedsPass = true; }
|
||||
if (_void != null) { _void.Visible = false; _void.NeedsPass = true; }
|
||||
if (_timers != null) { _timers.Visible = false; _timers.NeedsPass = true; }
|
||||
if (_offerWin != null) { _offerWin.Visible = false; _offerWin.NeedsPass = true; }
|
||||
_skills?.Update(string.Empty, false, false, Environment.TickCount64);
|
||||
_ui.SubmitEmpty(Host);
|
||||
_c.Book.Clear(); // saved as it changed
|
||||
|
|
@ -196,10 +243,144 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_c.QuestPacks.Clear();
|
||||
_c.TitlesKnown = false;
|
||||
_c.EarnedTitles.Clear();
|
||||
_c.Gear.Clear();
|
||||
_c.T11.Clear();
|
||||
_c.QuestBonus.Clear();
|
||||
ClearCharacterExtras();
|
||||
_c.Runner?.Stop("ended at logout");
|
||||
_c.SessionStamps.Clear();
|
||||
_c.Kills.Clear();
|
||||
ClearIlt();
|
||||
}
|
||||
|
||||
/// <summary>Forgets RynthILT's profile and guardians (logout, or the server stopped being Infinite Leaftide).</summary>
|
||||
private void ClearIlt()
|
||||
{
|
||||
_c.Ilt.Clear();
|
||||
_c.Guide.Clear();
|
||||
_c.ServerGuide.Clear();
|
||||
_guardianJson = "";
|
||||
_nextGuardianMs = 0;
|
||||
if (!ReferenceEquals(_c.Guardian, Shared.IltGuardianView.None))
|
||||
{
|
||||
_c.Guardian = Shared.IltGuardianView.None;
|
||||
_c.GuardianRevision++;
|
||||
}
|
||||
_c.GuardianMessage = "";
|
||||
_loggedStamps = (-1, -1, -1);
|
||||
_stampFlagRevision = _stampIltRevision = -1;
|
||||
_qbAskedForStamps = false;
|
||||
_qbAskAtMs = -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Infinite Leaftide: ask RynthILT for /qb list once per login so Dynamic stamps can mark done.
|
||||
/// ACECustom skips Dynamic flags in /myquests when it has no quest text for them; /qb still lists them.
|
||||
/// Used to only run when the Quests tab's stamps bar was drawn, so a closed Oracle window left stamps at 0/N
|
||||
/// (2026-11-22, Silentkelpie: server dump had dozens of Dynamic_1_… flags, log said 0 of 587 done).
|
||||
/// </summary>
|
||||
private void EnsureQbListForStamps(long now)
|
||||
{
|
||||
if (!_c.Server.IsIlt || _qbAskedForStamps) return;
|
||||
if (_qbAskAtMs < 0 || now < _qbAskAtMs) return;
|
||||
IltQuestBonusList? qb = _c.Ilt.QuestBonus;
|
||||
// RynthILT not linked yet: try again on a later tick without spending the once-per-session ask.
|
||||
if (qb == null) return;
|
||||
if (qb.Disabled || qb.Generation > 0)
|
||||
{
|
||||
_qbAskedForStamps = true;
|
||||
return;
|
||||
}
|
||||
_qbAskedForStamps = true;
|
||||
if (_c.Send("/ilt qb"))
|
||||
Host.Log("[RynthOracle] Reading /qb list for Dynamic stamps (/myquests leaves those flags out).");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Infinite Leaftide: logs where the Dynamic stamps come from whenever the flags or the /qb list
|
||||
/// change and the counts move (Dynamic flags in /myquests, in the /qb list, and the listed
|
||||
/// stamps matched), so a stamp shown as not done can be told apart from one never read. Names
|
||||
/// the flags no listed stamp matched (up to 10), so a sheet row that doesn't fit is visible.
|
||||
/// Nothing on any other server.
|
||||
/// </summary>
|
||||
private void LogStampSources()
|
||||
{
|
||||
if (!_c.Server.IsIlt) return;
|
||||
if (_c.Flags.Revision == _stampFlagRevision && _c.Ilt.Revision == _stampIltRevision) return;
|
||||
_stampFlagRevision = _c.Flags.Revision;
|
||||
_stampIltRevision = _c.Ilt.Revision;
|
||||
if (_c.Flags.Flags.Count == 0) return;
|
||||
IReadOnlySet<string> qbStamps = _c.Ilt.QbStampSet;
|
||||
var counts = DynamicStampList.Counts(_c.Flags, qbStamps);
|
||||
if (counts == _loggedStamps) return;
|
||||
_loggedStamps = counts;
|
||||
List<string> unlisted = DynamicStampList.Unlisted(_c.Flags, qbStamps);
|
||||
Host.Log($"[RynthOracle] Dynamic stamps: {counts.InMyQuests} Dynamic flag(s) in /myquests, {counts.InQb} in the /qb list"
|
||||
+ $" ({_c.Ilt.QbCompletedSet.Count} completed flags read); {counts.Matched} of {DynamicStampList.All.Count} listed stamps done"
|
||||
+ (unlisted.Count == 0 ? "." : $"; not in the list: {string.Join(" ", unlisted.Take(10))}{(unlisted.Count > 10 ? " ..." : "")}."));
|
||||
}
|
||||
|
||||
/// <summary>The Quests tab's guardian controls: a verb for RynthILT's guardians, then a quick re-read.</summary>
|
||||
private bool GuardianCommand(string verb)
|
||||
{
|
||||
long now = Environment.TickCount64;
|
||||
bool ok = _c.InWorld && _c.Server.IsIlt && _c.IltData.GuardianCommand(Host, now, verb);
|
||||
_c.GuardianMessage = ok ? "" : "RynthILT didn't take that (not loaded, or older than 0.2.20).";
|
||||
_nextGuardianMs = now + 400;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// While the Quests tab is on screen on Infinite Leaftide: RynthILT's Temple guardian JSON every
|
||||
/// <see cref="CharacterExtrasReadMs"/> (the guardian rows, switches and last answer). Nothing is
|
||||
/// read with the window closed, on another tab, or on another server.
|
||||
/// </summary>
|
||||
private void ReadGuardian(long now)
|
||||
{
|
||||
if (_main == null || _mainView == null || !_main.Visible || _mainView.Tab != OracleView.TabQuests) return;
|
||||
if (!_c.Server.IsIlt) return;
|
||||
if (now < _nextGuardianMs) return;
|
||||
_nextGuardianMs = now + CharacterExtrasReadMs;
|
||||
string json = _c.IltData.ReadGuardian(Host, now);
|
||||
if (string.Equals(json, _guardianJson, StringComparison.Ordinal)) return;
|
||||
_guardianJson = json;
|
||||
_c.Guardian = Shared.IltGuardianView.Parse(json);
|
||||
_c.GuardianRevision++;
|
||||
_main.NeedsPass = true;
|
||||
}
|
||||
|
||||
/// <summary>Forgets the Character tab's session (login, logout): the next character's comes fresh.</summary>
|
||||
private long _nextT11Ms;
|
||||
/// <summary>The ILT Tracker window reads the packs and the bounty slots this often while it shows.</summary>
|
||||
private const long T11ReadMs = 2000;
|
||||
|
||||
/// <summary>
|
||||
/// The ILT Tracker window's data (Infinite Leaftide only): the packs and the bounty slots every <see cref="T11ReadMs"/>
|
||||
/// while that window shows, and one queued appraisal at a time for the items it needs read. Nothing with the window
|
||||
/// closed or on another server.
|
||||
/// </summary>
|
||||
private void ReadT11(long now)
|
||||
{
|
||||
if (_iltTracker == null || !_iltTracker.Visible) return;
|
||||
if (!_c.Server.IsIlt || !_c.InWorld) return;
|
||||
_c.T11.Tick(Host, now);
|
||||
if (now < _nextT11Ms) return;
|
||||
_nextT11Ms = now + T11ReadMs;
|
||||
if (_c.T11.Scan(Host, now)) _iltTracker.NeedsPass = true;
|
||||
}
|
||||
|
||||
/// <summary>Puts the ILT Tracker on the bar only while Infinite Leaftide is the active server.</summary>
|
||||
private void SyncIltTrackerBar()
|
||||
{
|
||||
if (_iltTracker == null) return;
|
||||
bool want = _c.Server.IsIlt;
|
||||
if (_iltTracker.ShowInBar == want) return;
|
||||
_iltTracker.ShowInBar = want;
|
||||
if (!want) _iltTracker.Visible = false;
|
||||
_iltTracker.NeedsPass = true;
|
||||
}
|
||||
|
||||
private void ClearCharacterExtras()
|
||||
{
|
||||
_c.Session = default;
|
||||
|
|
@ -229,6 +410,7 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
{
|
||||
_mainView?.ShowTrackers(kind);
|
||||
if (_main != null) { _main.Visible = true; _main.NeedsPass = true; }
|
||||
_nextGuardianMs = 0; // read at once
|
||||
}
|
||||
|
||||
/// <summary>Shows the main window on a tab (another plugin's link, or a /ro tab command).</summary>
|
||||
|
|
@ -269,6 +451,7 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_skills?.Shutdown();
|
||||
_ui.SubmitEmpty(Host);
|
||||
_c.Updater.Shutdown();
|
||||
_c.Fandom.Shutdown();
|
||||
_c.Settings.Save();
|
||||
}
|
||||
|
||||
|
|
@ -300,6 +483,37 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
}
|
||||
if (!_c.InWorld) return;
|
||||
|
||||
// The quest guide: a stamp counts as done at once (before /myquests is read again), and Run this quest
|
||||
// follows the stamps and RynthNav's arrival.
|
||||
if (GuideStamp.FromChat(line) is string stamp && _c.SessionStamps.Add(GuideStamp.Key(stamp)))
|
||||
{
|
||||
_c.SessionStampRevision++;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
}
|
||||
// A kill task's kill line: the Kill Tasks tab shows the count at once; with the tab open, /myquests is
|
||||
// read again (at most once a minute) so the counter flags follow (2026-11-21).
|
||||
if (_c.Kills.OnChatLine(line, _c.UtcNow))
|
||||
{
|
||||
if (KillTasksOnScreen()) _killReadWanted = true;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
}
|
||||
// The ILT Tracker's /bonus multipliers and /qb count (Infinite Leaftide's ACECustom; read, never eaten, 2026-11-21).
|
||||
if (_c.Server.IsIlt && _c.QuestBonus.OnChatLine(line, _c.UtcNow))
|
||||
{
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
if (_iltTracker != null) _iltTracker.NeedsPass = true;
|
||||
}
|
||||
_c.Runner?.OnChat(line);
|
||||
_mainView?.OnDynChat(line); // Dynamic Stamps' Go and hand in (2026-11-08)
|
||||
|
||||
// An NPC who starts quests in the guide talks to you: ask whether to run one (not during a run).
|
||||
if (_c.Runner?.Active != true && _mainView != null && QuestOffers.TryNpcLine(line, out string npc, out string said)
|
||||
&& _mainView.OfferFor(npc, said, now) && _offerWin != null)
|
||||
{
|
||||
_offerWin.Visible = true;
|
||||
_offerWin.NeedsPass = true;
|
||||
}
|
||||
|
||||
// A server's own command replies (Conquest's /b, Aelrynth's /top, ...) are its server plugin's.
|
||||
// A server's own Void DoT duration rule comes from its plugin's profile (RynthConquest's for
|
||||
// Conquest); 1 everywhere else (VoidScaleFrom).
|
||||
|
|
@ -359,6 +573,20 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
case OracleVerb.Window:
|
||||
if (_main != null) { _main.Visible = !_main.Visible; _main.NeedsPass = true; Shown(OracleCommand.Shown("Oracle window", _main.Visible)); }
|
||||
break;
|
||||
case OracleVerb.Tracker:
|
||||
if (!_c.Server.IsIlt)
|
||||
{
|
||||
_c.PrintFail("The ILT Tracker is Infinite Leaftide only (ACECustom quest bonus and T11 items).");
|
||||
break;
|
||||
}
|
||||
if (_iltTracker != null)
|
||||
{
|
||||
_iltTracker.ShowInBar = true;
|
||||
_iltTracker.Visible = true;
|
||||
_iltTracker.NeedsPass = true;
|
||||
Shown(OracleCommand.Shown("ILT Tracker window", true));
|
||||
}
|
||||
break;
|
||||
case OracleVerb.Void:
|
||||
if (_void != null) { _void.Visible = !_void.Visible; _void.NeedsPass = true; Shown(OracleCommand.Shown("Void window", _void.Visible)); }
|
||||
break;
|
||||
|
|
@ -379,6 +607,14 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
break;
|
||||
case OracleVerb.Trackers:
|
||||
// A server's own trackers and tabs are its server plugin's pages (since 2026-10-21).
|
||||
if (c.Trackers is QuestKind.Dynamic or QuestKind.Guardian && !_c.Server.IsIlt)
|
||||
{
|
||||
// Infinite Leaftide's trackers (the Dynamic Stamps, RynthILT's Temple guardians).
|
||||
_c.PrintFail((c.Trackers == QuestKind.Guardian ? "The Temple guardians are" : "Dynamic stamps are")
|
||||
+ " an Infinite Leaftide quest line; the active server isn't Infinite Leaftide.");
|
||||
ShowTrackers(null);
|
||||
break;
|
||||
}
|
||||
ShowTrackers(c.Trackers);
|
||||
Shown(OracleCommand.OnTrackers(c.Trackers));
|
||||
break;
|
||||
|
|
@ -396,12 +632,45 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
case OracleVerb.Help:
|
||||
_c.Print(OracleCommand.Usage);
|
||||
break;
|
||||
case OracleVerb.LootProfiles:
|
||||
BuildLootProfiles(c.Word);
|
||||
break;
|
||||
default:
|
||||
_c.PrintFail(OracleCommand.Unknown(c.Word));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "/ro lootprofiles [quest]": RynthAi writes each wiki quest's loot profile (LootProfiles\Quests\<quest>.utl,
|
||||
/// base-quest-dynamic.utl and the quest's items; RynthAiPlugin.QuestLootProfiles.cs). A quest without loot has none.
|
||||
/// </summary>
|
||||
private void BuildLootProfiles(string quest)
|
||||
{
|
||||
QuestGuide g = _c.Wiki;
|
||||
if (g.Quests.Count == 0) { _c.PrintFail("No wiki quests yet: the AC Community Wiki is still being read (Quests > Guide shows it)" + (_c.Server.IsIlt ? ", or RynthILT's (/ilt wiki)." : ".")); return; }
|
||||
var list = new System.Collections.Generic.List<GuideQuest>();
|
||||
if (quest.Length > 0)
|
||||
{
|
||||
GuideQuest? q = g.Find(quest);
|
||||
if (q == null) { _c.PrintFail($"No wiki quest called '{quest}' (the name as the guide shows it)."); return; }
|
||||
if (q.Loot.Count == 0) { _c.PrintFail($"{q.Title} has no loot on its wiki page, so no loot profile."); return; }
|
||||
list.Add(q);
|
||||
}
|
||||
else
|
||||
foreach (GuideQuest q in g.Quests) if (q.Loot.Count > 0) list.Add(q);
|
||||
int sent = 0;
|
||||
foreach (GuideQuest q in list)
|
||||
{
|
||||
if (_c.Runner == null || !_c.Runner.BuildProfile(q)) break;
|
||||
sent++;
|
||||
}
|
||||
if (sent == 0) { _c.PrintFail("RynthAi isn't loaded: it writes the loot profiles."); return; }
|
||||
_c.Print(list.Count == 1
|
||||
? $"RynthAi wrote the loot profile for {list[0].Title}: LootProfiles\\Quests\\ (base-quest-dynamic and its {list[0].Loot.Count} item(s))."
|
||||
: $"RynthAi wrote {sent} quest loot profiles to LootProfiles\\Quests\\ (base-quest-dynamic and each quest's items; {g.Quests.Count - list.Count} quests have no loot). Run this quest uses them.");
|
||||
}
|
||||
|
||||
/// <summary>Sends /myquests; false when nothing went out (not in the world, or one was sent moments ago).</summary>
|
||||
private bool RequestQuests()
|
||||
{
|
||||
|
|
@ -440,14 +709,19 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
return tab == OracleView.TabQuests || tab == OracleView.TabAugs || tab == OracleView.TabSociety;
|
||||
}
|
||||
|
||||
/// <summary>The Oracle window shows the Quests tab's Kill Tasks list.</summary>
|
||||
private bool KillTasksOnScreen() => _main?.Visible == true && _mainView != null && _mainView.KillTasksShowing;
|
||||
|
||||
/// <summary>Re-reads /myquests when the flags are known stale, or old and on screen; at most once a minute.</summary>
|
||||
private void RereadIfStale(long now)
|
||||
{
|
||||
if (now < _nextAutoReadMs || !AutoRereads()) return;
|
||||
bool wanted = _c.Flags.RereadWanted;
|
||||
if (!_c.Flags.NeedsReread(_c.UtcNow, TimersOnScreen())) return;
|
||||
bool kills = _killReadWanted && KillTasksOnScreen() && _c.Flags.LastReadUtc != DateTime.MinValue && !_c.Flags.Loading && !_c.Flags.ServerDisabled;
|
||||
if (!kills && !_c.Flags.NeedsReread(_c.UtcNow, TimersOnScreen())) return;
|
||||
_nextAutoReadMs = now + AutoReadGapMs;
|
||||
string why = wanted
|
||||
_killReadWanted = false;
|
||||
string why = kills && !wanted ? "a kill task's kill came in with the Kill Tasks tab open" : wanted
|
||||
? "the server turned a quest down, or a timer alert wants a fresh reading"
|
||||
: $"the quest timers are on screen and the flags were read {TimeText.Friendly(_c.UtcNow - _c.Flags.LastReadUtc)} ago";
|
||||
if (RequestQuests()) Host.Log($"[RynthOracle] Re-reading /myquests: {why}.");
|
||||
|
|
@ -550,6 +824,18 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
|
||||
_ui.Poll(Host);
|
||||
TickData(now);
|
||||
// Run this quest inside a dungeon (2026-11-07): the run hears when the character goes in or out.
|
||||
if (Host.HasGetPlayerPose && Host.TryGetPlayerPose(out uint cell, out _, out _, out _, out _, out _, out _, out _) && cell != 0)
|
||||
{
|
||||
// The Town Network (landblock 0x0007) is a portal hub RynthNav routes through, never a quest's dungeon.
|
||||
// A building's rooms are indoor cells of the landblock you walked in from; a dungeon is reached by a
|
||||
// portal, so it is another landblock (2026-11-07: the run took a building by the Tusker Burrow for it).
|
||||
uint lb = cell >> 16;
|
||||
bool indoor = (cell & 0xFFFF) >= 0x0100;
|
||||
if (!indoor) _lastOutdoorLandblock = lb;
|
||||
if (_c.Runner is { Active: true } run)
|
||||
run.OnWhere(indoor && lb != QuestRunner.TownNetworkLandblock && lb != _lastOutdoorLandblock, lb);
|
||||
}
|
||||
|
||||
if (!Host.HasUi) return;
|
||||
// After the poll, so a tab clicked this tick is already selected.
|
||||
|
|
@ -576,15 +862,18 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
private void TickData(long now)
|
||||
{
|
||||
_c.Flags.Tick(now);
|
||||
_mainView?.TickDyn(); // Dynamic Stamps: the hand-in after the arrival settles
|
||||
if (_c.Flags.LastPartialReply is { } partial)
|
||||
{
|
||||
_c.Flags.LastPartialReply = null;
|
||||
Host.Log($"[RynthOracle] /myquests reply looked cut short ({partial.Got} lines, {partial.Had} flags held): merged it instead of replacing the list.");
|
||||
}
|
||||
LogStampSources();
|
||||
NoteRead();
|
||||
if (_c.Flags.Revision != _seenFlagRevision)
|
||||
{
|
||||
_seenFlagRevision = _c.Flags.Revision;
|
||||
_c.Runner?.OnFlagsChanged();
|
||||
_c.Catalog.SyncDiscoveries(_c.Flags);
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
if (_timers != null) _timers.NeedsPass = true;
|
||||
|
|
@ -602,6 +891,13 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
if (_timers != null) _timers.NeedsPass = true;
|
||||
}
|
||||
|
||||
// The AC Community Wiki's guide (2026-11-21): a finished read is taken here.
|
||||
if (_c.Fandom.TakeResult())
|
||||
{
|
||||
Host.Log("[RynthOracle] AC Community Wiki: " + _c.Fandom.Status);
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
}
|
||||
|
||||
string? result = _c.Updater.TakeResult(out bool updated);
|
||||
if (result != null)
|
||||
{
|
||||
|
|
@ -618,6 +914,43 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
if (!_c.InWorld) return;
|
||||
|
||||
ReadCharacterExtras(now);
|
||||
// Infinite Leaftide only: RynthILT's profile (every 2 s; the /qb list for the stamps) and the guardians.
|
||||
if (_c.Server.IsIlt)
|
||||
{
|
||||
_c.Ilt.Poll(Host, now);
|
||||
EnsureQbListForStamps(now);
|
||||
if (_c.Ilt.Revision != _seenIltRevision)
|
||||
{
|
||||
_seenIltRevision = _c.Ilt.Revision;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
if (_iltTracker != null) _iltTracker.NeedsPass = true;
|
||||
}
|
||||
ReadGuardian(now);
|
||||
ReadT11(now);
|
||||
_c.Guide.Poll(Host, now);
|
||||
if (_c.Guide.Revision != _seenGuideRevision)
|
||||
{
|
||||
_seenGuideRevision = _c.Guide.Revision;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Any other server: its plugin's own wiki quest guide, when it has one (RynthConquest's, 2026-11-21).
|
||||
_c.ServerGuide.Poll(Host, Shared.ServerQuestPackClient.OwnerOf(_c.ServerState.State), now);
|
||||
if (_c.ServerGuide.Client.Revision != _seenServerGuideRevision)
|
||||
{
|
||||
_seenServerGuideRevision = _c.ServerGuide.Client.Revision;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
}
|
||||
}
|
||||
if (_c.Runner != null && _c.Runner.Revision != _seenRunnerRevision)
|
||||
{
|
||||
_seenRunnerRevision = _c.Runner.Revision;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
}
|
||||
// The Gear tab's Check runs on (appraisals spaced out) whichever tab is showing.
|
||||
if (_c.Gear.Tick(Host, now, _c.Character.Name) && _main != null) _main.NeedsPass = true;
|
||||
|
||||
// RynthCore's server list (every 2 s): a new pick or override applies now, not at the next character read.
|
||||
_c.ServerState.Poll(Host, now);
|
||||
|
|
@ -626,7 +959,9 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
{
|
||||
_seenServerStateRevision = _c.ServerState.Revision;
|
||||
_c.VoidDotScale = VoidScaleFrom(_c.ServerState.ProfileJson);
|
||||
bool wasIlt = _c.Server.IsIlt;
|
||||
_c.Server.Refresh(Host, _c.ServerState.State);
|
||||
if (wasIlt && !_c.Server.IsIlt) ClearIlt();
|
||||
}
|
||||
// The active server plugin's quest pack (every 2 s; the CSV is read only when it changed).
|
||||
_c.QuestPacks.Poll(Host, Shared.ServerQuestPackClient.OwnerOf(_c.ServerState.State), now, force: serverChanged);
|
||||
|
|
@ -645,10 +980,27 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
}
|
||||
RereadIfStale(now);
|
||||
|
||||
if (!_dailyCheckStarted && _c.Settings.CheckQuestListDaily
|
||||
// Keep the flags fresh on a long session: /myquests again once nothing has read it for the
|
||||
// chosen minutes (the login read first; any reply, RynthAi's meta polls too, resets it).
|
||||
if (_questReadAtMs < 0)
|
||||
{
|
||||
DateTime since = _c.Flags.LastReadUtc > _autoQuestSinceUtc ? _c.Flags.LastReadUtc : _autoQuestSinceUtc;
|
||||
if (QuestFlagStore.AutoRefreshDue(_c.Settings.QuestRefreshMinutes, since, _c.UtcNow, _c.Flags.Loading,
|
||||
_c.Flags.ServerDisabled, _c.Flags.ThrottleSecondsLeft(now)))
|
||||
{
|
||||
_autoQuestSinceUtc = _c.UtcNow; // a lost reply tries again after the same wait, not every tick
|
||||
if (_c.Flags.Request(cmd => Host.InvokeChatParser(cmd), now))
|
||||
Host.Log($"[RynthOracle] Quest flags are {(int)(_c.UtcNow - since).TotalMinutes} min old: reading /myquests again.");
|
||||
}
|
||||
}
|
||||
|
||||
// The AC Community Wiki's quests, kill tasks, society quests and contracts: read at login when a day old.
|
||||
_c.Fandom.Tick(_c.UtcNow);
|
||||
|
||||
// Once a day, however long the session (it used to run once per login only).
|
||||
if (_c.Settings.CheckQuestListDaily && !_c.Updater.Running
|
||||
&& _c.UtcNow - _c.Settings.LastQuestListCheckUtc >= QuestCatalogUpdater.Interval)
|
||||
{
|
||||
_dailyCheckStarted = true;
|
||||
_c.Settings.LastQuestListCheckUtc = _c.UtcNow;
|
||||
_c.Settings.Save();
|
||||
_c.Updater.Start();
|
||||
|
|
@ -756,15 +1108,20 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
|
||||
private void RecordWindows(long now)
|
||||
{
|
||||
SyncIltTrackerBar();
|
||||
if (_main != null && _mainView != null)
|
||||
{
|
||||
long interval = _mainView.TabHasLiveTimers ? 1000 : 3000;
|
||||
Record(_main, now, interval, _mainView.Draw);
|
||||
}
|
||||
if (_iltTracker != null && _mainView != null && _c.Server.IsIlt)
|
||||
Record(_iltTracker, now, 2000, _mainView.DrawIltTracker);
|
||||
if (_void != null && _voidView != null)
|
||||
Record(_void, now, 500, _voidView.Draw);
|
||||
if (_timers != null && _timersView != null)
|
||||
Record(_timers, now, 1000, _timersView.Draw);
|
||||
if (_offerWin != null && _mainView != null)
|
||||
Record(_offerWin, now, 2000, _mainView.DrawOffer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue