Snapshot for release 2026.10.15.2 (internal 2d4b0af)

This commit is contained in:
Tom Bohar 2026-10-15 20:32:35 -04:00
commit d5e0b50de7
224 changed files with 17914 additions and 1182 deletions

View file

@ -0,0 +1,309 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Text.Json;
namespace RynthCore.Plugin.RynthOracle.Data;
/// <summary>
/// One character's quest notes: the quests tracked in the Quest Timers window and the rewards
/// recorded per quest (UtilityBelt ILT's quest_rewards.json, kept by RynthOracle now). Lives in
/// %APPDATA%\RynthCore\RynthOracle\characters\&lt;world&gt;\&lt;character&gt;.json, written by hand and
/// read with JsonDocument (no reflection serializer: it roots plugin types across hot reloads).
///
/// The first time a character has no file, an existing UtilityBelt quest_rewards.json for the
/// same world and character is imported once (Documents\Decal Plugins\UtilityBelt\&lt;world&gt;\&lt;character&gt;).
/// Pump thread only.
/// </summary>
internal sealed class QuestBook
{
public const int SchemaVersion = 1;
private readonly List<string> _tracked = new();
private readonly HashSet<string> _trackedSet = new(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, QuestReward> _rewards = new(StringComparer.OrdinalIgnoreCase);
/// <summary>The character the book belongs to ("" = none loaded: changes are not saved).</summary>
public string Character { get; private set; } = "";
public string World { get; private set; } = "";
/// <summary>Bumps on every change (views rebuild their caches on it).</summary>
public int Revision { get; private set; }
/// <summary>What happened at load ("imported 4 rewards from UtilityBelt"), shown once in chat; "" = nothing to say.</summary>
public string LoadNote { get; private set; } = "";
/// <summary>Overrides the folder (tests).</summary>
internal string? RootOverride { get; set; }
/// <summary>Overrides UtilityBelt's folder (tests); "" turns the import off.</summary>
internal string? UbRootOverride { get; set; }
public bool Loaded => Character.Length > 0;
public IReadOnlyList<string> Tracked => _tracked;
public int RewardCount => _rewards.Count;
public bool IsTracked(string flag) => _trackedSet.Contains(flag);
public bool TryGetReward(string flag, out QuestReward reward) => _rewards.TryGetValue(flag, out reward!);
/// <summary>The recorded rewards' compact text, or "".</summary>
public string RewardText(string flag) => _rewards.TryGetValue(flag, out QuestReward? r) ? r.ShortSummary() : "";
private string Root => RootOverride ?? Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RynthCore", "RynthOracle", "characters");
private string UbRoot => UbRootOverride ?? Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Decal Plugins", "UtilityBelt");
/// <summary>The file for a world and character (names made safe for a path).</summary>
public string PathFor(string world, string character) =>
Path.Combine(Root, SafeName(world.Length > 0 ? world : "default"), SafeName(character) + ".json");
/// <summary>Loads (or starts) the book for a character; a no-op when it is already loaded.</summary>
public void Load(string world, string character)
{
world ??= "";
character = (character ?? "").Trim();
if (character.Length == 0) return;
if (string.Equals(character, Character, StringComparison.Ordinal) && string.Equals(world, World, StringComparison.Ordinal)) return;
ResetData();
Character = character;
World = world;
LoadNote = "";
string file = PathFor(world, character);
try
{
if (File.Exists(file)) Read(File.ReadAllText(file));
else if (ImportUb(world, character) is int n and > 0)
{
LoadNote = $"Imported {n} quest reward{(n == 1 ? "" : "s")} from UtilityBelt.";
Save();
}
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or JsonException)
{
// A broken file means an empty book; the next change rewrites it.
LoadNote = "Couldn't read the saved quest notes (" + ex.GetType().Name + "); starting empty.";
}
Revision++;
}
/// <summary>Forgets the character (logout). Changes were saved as they were made.</summary>
public void Clear()
{
ResetData();
Character = "";
World = "";
LoadNote = "";
Revision++;
}
private void ResetData()
{
_tracked.Clear();
_trackedSet.Clear();
_rewards.Clear();
}
/// <summary>Tracks or untracks a quest; returns the new state. Saved at once.</summary>
public bool SetTracked(string flag, bool tracked)
{
if (string.IsNullOrWhiteSpace(flag)) return false;
if (tracked == _trackedSet.Contains(flag)) return tracked;
if (tracked)
{
_trackedSet.Add(flag);
_tracked.Add(flag);
}
else
{
_trackedSet.Remove(flag);
_tracked.RemoveAll(f => string.Equals(f, flag, StringComparison.OrdinalIgnoreCase));
}
Revision++;
Save();
return tracked;
}
public bool ToggleTracked(string flag) => SetTracked(flag, !IsTracked(flag));
/// <summary>Stores a quest's rewards (an empty entry removes them). Saved at once.</summary>
public void SetReward(string flag, QuestReward? reward)
{
if (string.IsNullOrWhiteSpace(flag)) return;
if (reward == null || reward.IsEmpty) _rewards.Remove(flag);
else _rewards[flag] = reward.Clone();
Revision++;
Save();
}
/// <summary>Writes the book (atomic replace). Does nothing with no character loaded.</summary>
public void Save()
{
if (!Loaded) return;
try
{
string file = PathFor(World, Character);
Directory.CreateDirectory(Path.GetDirectoryName(file)!);
string tmp = file + ".tmp";
File.WriteAllText(tmp, ToJson(), new UTF8Encoding(false));
File.Move(tmp, file, overwrite: true);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
// Notes are a convenience; a failed write keeps the old file.
}
}
/// <summary>The book as JSON (plain ASCII: anything else is escaped).</summary>
internal string ToJson()
{
var sb = new StringBuilder(1024);
sb.Append("{\n");
sb.Append(" \"schemaVersion\": ").Append(SchemaVersion.ToString(CultureInfo.InvariantCulture)).Append(",\n");
sb.Append(" \"character\": ").Append(Q(Character)).Append(",\n");
sb.Append(" \"world\": ").Append(Q(World)).Append(",\n");
sb.Append(" \"savedAtUtc\": ").Append(Q(DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture))).Append(",\n");
sb.Append(" \"tracked\": [");
for (int i = 0; i < _tracked.Count; i++)
sb.Append(i > 0 ? ", " : "").Append(Q(_tracked[i]));
sb.Append("],\n");
sb.Append(" \"rewards\": {");
bool first = true;
var keys = new List<string>(_rewards.Keys);
keys.Sort(StringComparer.OrdinalIgnoreCase);
foreach (string key in keys)
{
QuestReward r = _rewards[key];
sb.Append(first ? "\n" : ",\n");
first = false;
sb.Append(" ").Append(Q(key)).Append(": {");
sb.Append("\"xpPercent\": ").Append(r.XpPercent.ToString("R", CultureInfo.InvariantCulture));
sb.Append(", \"lumPercent\": ").Append(r.LumPercent.ToString("R", CultureInfo.InvariantCulture));
sb.Append(", \"recordedLevel\": ").Append(r.RecordedLevel.ToString(CultureInfo.InvariantCulture));
sb.Append(", \"coins\": ").Append(r.Coins.ToString(CultureInfo.InvariantCulture));
sb.Append(", \"trinkets\": ").Append(r.Trinkets.ToString(CultureInfo.InvariantCulture));
sb.Append(", \"medallions\": ").Append(r.Medallions.ToString(CultureInfo.InvariantCulture));
sb.Append(", \"yellowPowder\": ").Append(r.YellowPowder.ToString(CultureInfo.InvariantCulture));
sb.Append(", \"redPowder\": ").Append(r.RedPowder.ToString(CultureInfo.InvariantCulture));
sb.Append(", \"bluePowder\": ").Append(r.BluePowder.ToString(CultureInfo.InvariantCulture));
sb.Append(", \"mmd\": ").Append(r.Mmd.ToString(CultureInfo.InvariantCulture));
sb.Append('}');
}
sb.Append(first ? "}\n" : "\n }\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>Reads a saved book (RynthOracle's own lower-case keys, or UB's upper-case ones).</summary>
internal void Read(string json)
{
using JsonDocument doc = JsonDocument.Parse(json);
JsonElement root = doc.RootElement;
if (root.ValueKind != JsonValueKind.Object) return;
if (Prop(root, "tracked", out JsonElement tracked) && tracked.ValueKind == JsonValueKind.Array)
{
foreach (JsonElement t in tracked.EnumerateArray())
{
string flag = t.ValueKind == JsonValueKind.String ? (t.GetString() ?? "").Trim() : "";
if (flag.Length > 0 && _trackedSet.Add(flag)) _tracked.Add(flag);
}
}
ReadRewards(root);
}
/// <summary>The "rewards" / "Rewards" object: flag -> entry. Returns how many were kept.</summary>
private int ReadRewards(JsonElement root)
{
if (!Prop(root, "rewards", out JsonElement rewards) || rewards.ValueKind != JsonValueKind.Object) return 0;
int n = 0;
foreach (JsonProperty p in rewards.EnumerateObject())
{
if (p.Value.ValueKind != JsonValueKind.Object || p.Name.Trim().Length == 0) continue;
JsonElement e = p.Value;
var r = new QuestReward
{
XpPercent = Math.Clamp(Dbl(e, "xpPercent"), 0, QuestReward.MaxPercent),
LumPercent = Math.Clamp(Dbl(e, "lumPercent"), 0, QuestReward.MaxPercent),
RecordedLevel = Int(e, "recordedLevel"),
Coins = Int(e, "coins"),
Trinkets = Int(e, "trinkets"),
Medallions = Int(e, "medallions"),
YellowPowder = Int(e, "yellowPowder"),
RedPowder = Int(e, "redPowder"),
BluePowder = Int(e, "bluePowder"),
Mmd = Int(e, "mmd"),
};
if (r.IsEmpty) continue;
_rewards[p.Name.Trim()] = r;
n++;
}
return n;
}
/// <summary>UtilityBelt ILT's quest_rewards.json for this world and character, if there is one. Returns the entries kept.</summary>
private int ImportUb(string world, string character)
{
string ubRoot = UbRoot;
if (ubRoot.Length == 0 || world.Length == 0) return 0;
// UB names the server folder after the world with its spaces removed ("InfiniteLeaftide").
foreach (string w in new[] { world, world.Replace(" ", "") })
{
string file = Path.Combine(ubRoot, SafeName(w), SafeName(character), "quest_rewards.json");
if (!File.Exists(file)) continue;
using JsonDocument doc = JsonDocument.Parse(File.ReadAllText(file));
return doc.RootElement.ValueKind == JsonValueKind.Object ? ReadRewards(doc.RootElement) : 0;
}
return 0;
}
// ── JSON helpers (keys matched without regard to case: UB writes "XpPercent") ──────────────
private static bool Prop(JsonElement o, string name, out JsonElement value)
{
foreach (JsonProperty p in o.EnumerateObject())
{
if (!string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase)) continue;
value = p.Value;
return true;
}
value = default;
return false;
}
private static double Dbl(JsonElement o, string name) =>
Prop(o, name, out JsonElement v) && v.ValueKind == JsonValueKind.Number && v.TryGetDouble(out double d) && double.IsFinite(d) ? d : 0;
private static int Int(JsonElement o, string name)
{
if (!Prop(o, name, out JsonElement v) || v.ValueKind != JsonValueKind.Number) return 0;
if (v.TryGetInt64(out long l)) return (int)Math.Clamp(l, 0, int.MaxValue);
return v.TryGetDouble(out double d) && double.IsFinite(d) ? (int)Math.Clamp(d, 0, int.MaxValue) : 0;
}
/// <summary>A JSON string literal, ASCII only.</summary>
private static string Q(string s)
{
var sb = new StringBuilder(s.Length + 2);
sb.Append('"');
foreach (char c in s)
{
if (c == '"') sb.Append("\\\"");
else if (c == '\\') sb.Append("\\\\");
else if (c < 0x20 || c > 0x7E) sb.Append("\\u").Append(((int)c).ToString("x4", CultureInfo.InvariantCulture));
else sb.Append(c);
}
return sb.Append('"').ToString();
}
/// <summary>A name safe as one path segment (invalid characters become '_').</summary>
internal static string SafeName(string name)
{
var sb = new StringBuilder(name.Length);
char[] bad = Path.GetInvalidFileNameChars();
foreach (char c in name.Trim()) sb.Append(Array.IndexOf(bad, c) >= 0 ? '_' : c);
string s = sb.ToString().Trim('.', ' ');
return s.Length > 0 ? s : "_";
}
}

View file

@ -34,6 +34,9 @@ internal sealed class Quest
/// <summary>The Name column: the curated name, else the one-line info, else "Unknown quest" (upstream's rule).</summary>
public string DisplayName => Name.Length > 0 ? Name : Info.Length > 0 ? Info : "Unknown quest";
/// <summary>The list label: the display name, or for a flag no list knows "(new)" and its description or flag.</summary>
public string Label => IsNew ? "(new) " + (Name.Length > 0 ? Name : Flag) : DisplayName;
/// <summary>The server is the source of truth where it has spoken (the flag's timer); else the lists.</summary>
public bool IsRepeatable(QuestFlagStore flags) =>
flags.TryGet(Flag, out QuestFlag q) ? q.RepeatTime != TimeSpan.Zero : Repeatable;

View file

@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Globalization;
namespace RynthCore.Plugin.RynthOracle.Data;
/// <summary>
/// What one quest pays this character, as the player recorded it (UtilityBelt ILT's
/// QuestRewardEntry, Lib/Quests/QuestRewardsFile.cs). XP and luminance are percentages of a
/// level's worth, so they are kept with the level they were noted at.
/// </summary>
internal sealed class QuestReward
{
/// <summary>The largest percentage accepted (UB's clamp).</summary>
public const double MaxPercent = 1000;
public double XpPercent;
public double LumPercent;
/// <summary>The character level the percentages were noted at; 0 = not recorded.</summary>
public int RecordedLevel;
public int Coins;
public int Trinkets;
public int Medallions;
public int YellowPowder;
public int RedPowder;
public int BluePowder;
public int Mmd;
/// <summary>Nothing recorded (an empty entry is dropped instead of saved).</summary>
public bool IsEmpty =>
XpPercent <= 0 && LumPercent <= 0 && Coins <= 0 && Trinkets <= 0 && Medallions <= 0
&& YellowPowder <= 0 && RedPowder <= 0 && BluePowder <= 0 && Mmd <= 0;
public QuestReward Clone() => (QuestReward)MemberwiseClone();
/// <summary>
/// The compact column text, UB's format: "1.5%XP 2%Lum 3C 1T 2M 1Y 1R 1B 2D L275". Zero fields
/// are left out; " L&lt;level&gt;" follows when XP or luminance is set and the level is known.
/// </summary>
public string ShortSummary()
{
var parts = new List<string>(10);
if (XpPercent > 0) parts.Add(Percent(XpPercent) + "%XP");
if (LumPercent > 0) parts.Add(Percent(LumPercent) + "%Lum");
if (Coins > 0) parts.Add(Coins.ToString(CultureInfo.InvariantCulture) + "C");
if (Trinkets > 0) parts.Add(Trinkets.ToString(CultureInfo.InvariantCulture) + "T");
if (Medallions > 0) parts.Add(Medallions.ToString(CultureInfo.InvariantCulture) + "M");
if (YellowPowder > 0) parts.Add(YellowPowder.ToString(CultureInfo.InvariantCulture) + "Y");
if (RedPowder > 0) parts.Add(RedPowder.ToString(CultureInfo.InvariantCulture) + "R");
if (BluePowder > 0) parts.Add(BluePowder.ToString(CultureInfo.InvariantCulture) + "B");
if (Mmd > 0) parts.Add(Mmd.ToString(CultureInfo.InvariantCulture) + "D");
if ((XpPercent > 0 || LumPercent > 0) && RecordedLevel > 0) parts.Add("L" + RecordedLevel.ToString(CultureInfo.InvariantCulture));
return string.Join(" ", parts);
}
/// <summary>The long form for tooltips and chat: "1.5% XP, 2% luminance (at level 275), 3 coins, ...".</summary>
public string LongSummary()
{
var parts = new List<string>(10);
if (XpPercent > 0) parts.Add(Percent(XpPercent) + "% XP");
if (LumPercent > 0) parts.Add(Percent(LumPercent) + "% luminance");
if ((XpPercent > 0 || LumPercent > 0) && RecordedLevel > 0) parts[parts.Count - 1] += $" (at level {RecordedLevel})";
Add(parts, Coins, "coin");
Add(parts, Trinkets, "trinket");
Add(parts, Medallions, "medallion");
Add(parts, YellowPowder, "yellow powder");
Add(parts, RedPowder, "red powder");
Add(parts, BluePowder, "blue powder");
Add(parts, Mmd, "MMD");
return parts.Count == 0 ? "no rewards recorded" : string.Join(", ", parts);
static void Add(List<string> list, int n, string what)
{
if (n <= 0) return;
bool noPlural = what.EndsWith("powder", StringComparison.Ordinal) || what == "MMD";
list.Add($"{n} {what}{(n == 1 || noPlural ? "" : "s")}");
}
}
/// <summary>UB's percent format: one decimal from 10 up, two from 1 up, three below 1.</summary>
public static string Percent(double v) =>
v.ToString(v >= 10 ? "0.#" : v >= 1 ? "0.##" : "0.###", CultureInfo.InvariantCulture);
/// <summary>A typed percentage ("1.5", "1,5", "2%"); blank = 0. Clamped to 0..<see cref="MaxPercent"/>. False when it isn't a number.</summary>
public static bool TryParsePercent(string? text, out double value)
{
value = 0;
string t = (text ?? "").Trim().TrimEnd('%').Trim().Replace(',', '.');
if (t.Length == 0) return true;
if (!double.TryParse(t, NumberStyles.Float, CultureInfo.InvariantCulture, out double v) || !double.IsFinite(v)) return false;
value = Math.Clamp(v, 0, MaxPercent);
return true;
}
/// <summary>A typed count; blank = 0, negatives become 0. False when it isn't a whole number.</summary>
public static bool TryParseCount(string? text, out int value)
{
value = 0;
string t = (text ?? "").Trim().Replace(",", "");
if (t.Length == 0) return true;
if (!long.TryParse(t, NumberStyles.Integer, CultureInfo.InvariantCulture, out long v)) return false;
value = (int)Math.Clamp(v, 0, int.MaxValue);
return true;
}
}

View file

@ -0,0 +1,94 @@
using System;
using System.Text.RegularExpressions;
namespace RynthCore.Plugin.RynthOracle.Data;
/// <summary>How a quest stands right now, for the timer columns and the Quest Timers window.</summary>
internal enum QuestTimerState
{
/// <summary>Can be done now (never done, or the timer ran out).</summary>
Ready,
/// <summary>Waiting on its repeat timer.</summary>
Waiting,
/// <summary>A kill task still collecting kills.</summary>
InProgress,
/// <summary>Done for good: a one-time quest, a solve limit reached, or a finished kill task with no timer.</summary>
Done,
}
/// <summary>
/// Quest timer text shared by the Quests tab and the Quest Timers window. Kill tasks follow
/// UtilityBelt ILT's rule (QuestTracker.GetKTStatusText): "N left" while counting, then the reset
/// countdown, then "done". Kill-task flags are recognised by name as RynthAi's tracker did.
/// </summary>
internal static class QuestTimer
{
// RynthAi's / UtilityBelt's kill-task pattern (counter flags), with a solve limit set.
private static readonly Regex KillTaskRegex = new(@"(killtask|killcount|slayerquest|totalgolem.*dead|(kills$))",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
/// <summary>A kill-task counter flag (its name says so and it has a solve limit).</summary>
public static bool IsKillTask(QuestFlag f) => f.MaxSolves > 0 && KillTaskRegex.IsMatch(f.Key);
/// <summary>A quest's state; <paramref name="text"/> is what the column shows.</summary>
public static QuestTimerState State(Quest q, QuestFlagStore flags, DateTime utcNow, out string text)
{
if (!flags.TryGet(q.Flag, out QuestFlag f))
{
text = "ready";
return QuestTimerState.Ready;
}
return State(f, q.IsRepeatable(flags), utcNow, out text);
}
/// <summary>A held flag's state (<paramref name="repeatable"/>: the quest can be done again at all).</summary>
public static QuestTimerState State(QuestFlag f, bool repeatable, DateTime utcNow, out string text)
{
TimeSpan left = f.NextAvailableTime(utcNow);
if (IsKillTask(f))
{
if (f.Solves < f.MaxSolves)
{
text = $"{f.MaxSolves - f.Solves} left";
return QuestTimerState.InProgress;
}
if (f.RepeatTime > TimeSpan.Zero && left > TimeSpan.Zero)
{
text = TimeText.Friendly(left);
return QuestTimerState.Waiting;
}
text = "done";
return QuestTimerState.Done;
}
if (!repeatable)
{
text = "completed";
return QuestTimerState.Done;
}
if (f.AtSolveLimit)
{
text = "maxed";
return QuestTimerState.Done;
}
if (left > TimeSpan.Zero)
{
text = TimeText.Friendly(left);
return QuestTimerState.Waiting;
}
text = "ready";
return QuestTimerState.Ready;
}
/// <summary>Sort key: ready first, then by time left, then kill tasks in progress, then done.</summary>
public static double SortKey(Quest q, QuestFlagStore flags, DateTime utcNow)
{
QuestTimerState s = State(q, flags, utcNow, out _);
return s switch
{
QuestTimerState.Ready => 0,
QuestTimerState.Waiting when flags.TryGet(q.Flag, out QuestFlag f) => 1 + Math.Max(0, f.NextAvailableTime(utcNow).TotalSeconds),
QuestTimerState.InProgress => 1e12,
_ => 2e12,
};
}
}

View file

@ -1,4 +1,5 @@
using System;
using RynthCore.Plugin.Shared;
using RynthCore.PluginSdk;
namespace RynthCore.Plugin.RynthOracle.Data;
@ -20,6 +21,8 @@ internal static class ServerTags
/// only load or show where <see cref="Allows"/> says so; untagged (retail) ones work anywhere.
///
/// Sources, best first:
/// 0. Engine API v86 GetServerStateJson (ServerStateClient): RynthCore's active server, with
/// this character's overrides and the Diagnostics page's server pick applied (FromEngine).
/// 1. Engine API v75 GetServerInfo: the engine's own verdict for Aelrynth (connect host,
/// announced world name, Bank mod properties) and the world name the server announced
/// at login. Never the launcher profile name.
@ -28,7 +31,8 @@ internal static class ServerTags
/// mod's player properties 9101-9103, which only Aelrynth sends.
/// Aelrynth's live config still names the world "Aeshnidae" (its earlier name); both count.
/// ConquestAC and Levistras are matched on their world names, as upstream does
/// (Decal's CharacterFilter.Server).
/// (Decal's CharacterFilter.Server). Infinite Leaftide has no RynthOracle pages: its screens are
/// RynthILT's, so RynthCore's "ilt" server gives no tag here.
/// </summary>
internal sealed class ServerIdentity
{
@ -51,8 +55,20 @@ internal sealed class ServerIdentity
Set("", "", "not logged in");
}
public void Refresh(RynthCoreHost host, uint playerId)
/// <param name="engine">
/// RynthCore's server list (plugin API v86, ServerStateClient); null on older engines. When there,
/// it decides: it already applies this character's overrides and the Diagnostics page's pick.
/// </param>
public void Refresh(RynthCoreHost host, uint playerId, EngineServerState? engine = null)
{
if (engine != null)
{
string fallbackWorld = host.TryGetWorldName(out string fw) ? fw.Trim() : "";
FromEngine(engine, fallbackWorld, out string t, out string wn, out string src);
Set(t, wn, src);
return;
}
string tag, world, source;
if (host.TryGetServerInfo(out bool aelrynth, out bool staging, out string announced))
{
@ -85,6 +101,59 @@ internal sealed class ServerIdentity
Set(tag, world, source);
}
/// <summary>
/// The identity from RynthCore's server list. An active server decides the tag (its own, or ""
/// for a server RynthOracle has nothing for). With none active, the world name may still tag a
/// server the engine doesn't know (Conquest without RynthConquest loaded), but never one the
/// engine lists: that one is off on purpose (not detected, or this character's override).
/// Pure: the tests drive it.
/// </summary>
internal static void FromEngine(EngineServerState engine, string fallbackWorld, out string tag, out string world, out string source)
{
world = engine.World.Length > 0 ? engine.World : (fallbackWorld ?? "").Trim();
if (engine.HasActive)
{
tag = TagForEngineId(engine.Active);
EngineServer? s = engine.Find(engine.Active);
string how = engine.Picked ? "picked by hand"
: s != null && s.Force.Equals("on", StringComparison.OrdinalIgnoreCase) ? "forced on for this character"
: s != null && s.Reason.Length > 0 ? s.Reason : "detected";
string name = engine.ActiveName.Length > 0 ? engine.ActiveName : engine.Active;
source = $"RynthCore: {name} ({how})" + (tag.Length == 0 ? " - no RynthOracle pages for it" : "");
return;
}
tag = TagForWorld(world);
string id = EngineIdForTag(tag);
if (tag.Length > 0 && id.Length > 0 && engine.Find(id) != null)
{
source = $"RynthCore: {tag} is off for this world (not detected, or overridden)";
tag = "";
return;
}
source = tag.Length > 0
? $"world name \"{world}\" (RynthCore has no {tag} server loaded)"
: "RynthCore: no server active (retail features only)";
}
/// <summary>The tag for a RynthCore server id; "" for servers without RynthOracle features.</summary>
public static string TagForEngineId(string? id) => (id ?? "").Trim().ToLowerInvariant() switch
{
EngineServerState.AelrynthId => ServerTags.Aelrynth,
"conquest" => ServerTags.Conquest,
"levistras" => ServerTags.Levistras,
_ => "",
};
/// <summary>The RynthCore server id for a tag; "" for none.</summary>
public static string EngineIdForTag(string? tag) => tag switch
{
ServerTags.Aelrynth => EngineServerState.AelrynthId,
ServerTags.Conquest => "conquest",
ServerTags.Levistras => "levistras",
_ => "",
};
/// <summary>The tag for a world name; "" for servers without their own features.</summary>
public static string TagForWorld(string? world)
{

View file

@ -13,10 +13,19 @@ internal sealed class OracleContext
public readonly QuestFlagStore Flags = new();
public readonly QuestCatalog Catalog = new();
public readonly QuestCatalogUpdater Updater = new();
/// <summary>This character's tracked quests and recorded rewards (loaded once the name is known).</summary>
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();
/// <summary>RynthAi's session (the one session every tracker shows); read while the Character tab shows.</summary>
public readonly RynthCore.Plugin.Shared.RynthAiSessionClient AiSession = new();
/// <summary>The last session RynthAi reported; SessionKnown false without RynthAi.</summary>
public RynthCore.Plugin.Shared.SessionStatsV1 Session;
public bool SessionKnown;
/// <summary>RynthCore's server list (API v86) and the active server owner's settings; State null on older engines.</summary>
public readonly RynthCore.Plugin.Shared.ServerStateClient ServerState = new();
/// <summary>ConquestAC-only data (tag Conquest); fed only while on ConquestAC.</summary>
public readonly ConquestData Conquest = new();
/// <summary>Aelrynth's leaderboards (tag Aelrynth); fed only while on Aelrynth.</summary>
@ -39,6 +48,14 @@ internal sealed class OracleContext
/// <summary>Set by the plugin: sends a chat command to the server as if typed (the views' buttons).</summary>
public Func<string, bool> Send = _ => false;
/// <summary>Set by the plugin: runs a chat command through RynthCore's plugin dispatch (another plugin's window).</summary>
public Func<string, bool> RunCommand = _ => false;
/// <summary>Set by the plugin: shows or hides the Quest Timers window.</summary>
public Action<bool> SetQuestTimersWindow = _ => { };
/// <summary>Set by the plugin: whether the Quest Timers window is showing.</summary>
public Func<bool> QuestTimersWindowVisible = () => false;
public Func<uint, int> Props => id => Character.Int(Host, id);
/// <summary>A line in the player's chat window only (nothing is sent to the server).</summary>

View file

@ -23,6 +23,8 @@ internal sealed class OracleSettings
/// <summary>Show the Void target window by itself for characters with Void Magic.</summary>
public bool AutoShowVoidWindow = true;
public bool MainWindowOpen;
/// <summary>The Quest Timers window (tracked quests) was left open; it opens again at login.</summary>
public bool QuestTimersOpen;
/// <summary>The selected tab, by name (the set of tabs depends on the server).</summary>
public string TabName = "Quests";
/// <summary>ConquestAC: "/bank deposit" at every ten-minute mark (upstream's auto-deposit; off by default).</summary>
@ -44,6 +46,7 @@ internal sealed class OracleSettings
CheckQuestListDaily = Bool(r, "checkQuestListDaily", CheckQuestListDaily);
AutoShowVoidWindow = Bool(r, "autoShowVoidWindow", AutoShowVoidWindow);
MainWindowOpen = Bool(r, "mainWindowOpen", MainWindowOpen);
QuestTimersOpen = Bool(r, "questTimersOpen", QuestTimersOpen);
ConquestAutoDeposit = Bool(r, "conquestAutoDeposit", ConquestAutoDeposit);
if (r.TryGetProperty("tabName", out JsonElement t) && t.ValueKind == JsonValueKind.String) TabName = t.GetString() ?? TabName;
if (r.TryGetProperty("lastQuestListCheck", out JsonElement c) && c.ValueKind == JsonValueKind.String
@ -68,6 +71,7 @@ internal sealed class OracleSettings
sb.Append(" \"lastQuestListCheck\": \"").Append(LastQuestListCheckUtc.ToString("o", CultureInfo.InvariantCulture)).Append("\",\n");
sb.Append(" \"autoShowVoidWindow\": ").Append(AutoShowVoidWindow ? "true" : "false").Append(",\n");
sb.Append(" \"mainWindowOpen\": ").Append(MainWindowOpen ? "true" : "false").Append(",\n");
sb.Append(" \"questTimersOpen\": ").Append(QuestTimersOpen ? "true" : "false").Append(",\n");
sb.Append(" \"conquestAutoDeposit\": ").Append(ConquestAutoDeposit ? "true" : "false").Append(",\n");
sb.Append(" \"tabName\": \"").Append(JsonEncodedText.Encode(TabName).ToString()).Append("\"\n");
sb.Append("}\n");

View file

@ -37,7 +37,8 @@ public static unsafe class PluginExports
[UnmanagedCallersOnly(EntryPoint = "RynthPluginVersion", CallConvs = new[] { typeof(CallConvCdecl) })]
public static IntPtr GetVersion()
{
try { return LiteralPointer("0.2.0"u8); }
// Keep in step with RynthOraclePlugin.Version (a u8 literal can't be built from a const string).
try { return LiteralPointer("0.2.1"u8); }
catch { return IntPtr.Zero; }
}

View file

@ -52,6 +52,15 @@
<ItemGroup>
<!-- Fellowship reader (client memory, VirtualQuery-guarded), shared source with RynthAi. -->
<Compile Include="..\RynthCore.Plugin.RynthAi\Combat\FellowshipTracker.cs" Link="Shared\FellowshipTracker.cs" />
<!-- RynthAi's session stats ("RynthAi.Hub" SessionStats): the Character tab's session rates
count the same session as the Mini Remote's Session Stats. -->
<Compile Include="..\Shared\RynthAiHubApi.cs" Link="Shared\RynthAiHubApi.cs" />
<Compile Include="..\Shared\RynthAiSessionClient.cs" Link="Shared\RynthAiSessionClient.cs" />
<!-- RynthCore's server list (API v86) and the active server's settings from its plugin
("RynthServer.Profile"): which server this is, overrides included. -->
<Compile Include="..\Shared\RynthServerProfileApi.cs" Link="Shared\RynthServerProfileApi.cs" />
<Compile Include="..\Shared\EngineServerState.cs" Link="Shared\EngineServerState.cs" />
<Compile Include="..\Shared\ServerStateClient.cs" Link="Shared\ServerStateClient.cs" />
</ItemGroup>
<ItemGroup>

View file

@ -18,24 +18,33 @@ namespace RynthCore.Plugin.RynthOracle;
/// </summary>
public sealed class RynthOraclePlugin : RynthPluginBase
{
public const string Version = "0.2.0";
// Previous release: 0.2.0.
public const string Version = "0.2.1";
private const long QuestReadDelayMs = 6000; // after login, before the hidden /myquests
private const long CharacterReadMs = 1000;
// The Character tab's session (RynthAi): read only while that tab is on screen.
private const long CharacterExtrasReadMs = 2000;
private const long BookWorldWaitMs = 15_000; // how long the quest book waits for the world name
private readonly OracleContext _c = new();
private readonly UiHost _ui = new();
private UiWindow? _main, _void;
private UiWindow? _main, _void, _timers;
private OracleView? _mainView;
private VoidView? _voidView;
private QuestTimersView? _timersView;
private int _seenBookRevision = -1;
private readonly ConcurrentQueue<string> _commands = new();
private long _questReadAtMs = -1;
private long _loginMs;
private long _nextCharacterReadMs;
private long _nextCharacterExtrasMs;
private bool _voidAutoDecided;
private bool _dailyCheckStarted;
private int _seenFlagRevision = -1, _seenCatalogRevision = -1, _seenVoidRevision = -1;
// RynthCore's server list (ServerStateClient.Revision) last applied to the server identity.
private int _seenServerStateRevision = -1;
private bool _noUiLogged;
private string? _catalogTag; // the server tag the catalog and server data were loaded for
private bool _conquestLoginRead;
@ -49,13 +58,15 @@ public sealed class RynthOraclePlugin : RynthPluginBase
_c.Settings.Load();
_c.RequestQuests = RequestQuests;
_c.Send = cmd => _c.InWorld && Host.InvokeChatParser(cmd);
_c.RunCommand = cmd => _c.InWorld && Host.InvokeChatParser(cmd);
_ui.Log = msg => Host.Log(msg);
_mainView = new OracleView(_c);
_voidView = new VoidView(_c);
_timersView = new QuestTimersView(_c);
_main = _ui.Add(new UiWindow("RynthOracle/Oracle", "Oracle")
{
DefaultWidth = 620f, DefaultHeight = 560f, MinWidth = 420f, MinHeight = 260f,
DefaultWidth = 700f, DefaultHeight = 600f, MinWidth = 420f, MinHeight = 260f,
});
// 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).
@ -66,11 +77,34 @@ public sealed class RynthOraclePlugin : RynthPluginBase
});
_mainView.SetVoidWindow = v => { if (_void != null) { _void.Visible = v; _void.NeedsPass = true; } };
_mainView.VoidWindowVisible = () => _void?.Visible ?? false;
// The Quest Timers window (tracked quests): opened from the Quests tab, /ro timers or the
// engine's Character menu; like the Void window it has no bar button of its own.
_timers = _ui.Add(new UiWindow("RynthOracle/QuestTimers", "Quest Timers")
{
DefaultWidth = 310f, DefaultHeight = 220f, MinWidth = 220f, MinHeight = 90f,
ShowInBar = false,
});
_c.SetQuestTimersWindow = SetQuestTimers;
_c.QuestTimersWindowVisible = () => _timers?.Visible ?? false;
Host.Log($"[RynthOracle] {Version} initialized. /ro opens the window. Based on Oracle of Dereth by Advis Eveldan - thank you!");
return 0;
}
/// <summary>Shows or hides the Quest Timers window and remembers the choice for the next login.</summary>
private void SetQuestTimers(bool visible)
{
if (_timers == null) return;
_timers.Visible = visible;
_timers.NeedsPass = true;
if (_c.Settings.QuestTimersOpen != visible)
{
_c.Settings.QuestTimersOpen = visible;
_c.Settings.Save();
}
if (_main != null) _main.NeedsPass = true;
}
// The engine calls this on a real login and on a freshly (re)loaded plugin already in game.
public override void OnLoginComplete()
{
@ -78,7 +112,10 @@ public sealed class RynthOraclePlugin : RynthPluginBase
_c.Flags.Clear();
_c.Void.Clear();
_c.Server.Reset();
_c.Server.Refresh(Host, Host.GetPlayerId());
_c.ServerState.Clear();
_c.ServerState.Poll(Host, Environment.TickCount64, force: true);
_seenServerStateRevision = _c.ServerState.Revision;
_c.Server.Refresh(Host, Host.GetPlayerId(), _c.ServerState.State);
_catalogTag = null;
ApplyServer();
_conquestLoginRead = false;
@ -90,10 +127,15 @@ public sealed class RynthOraclePlugin : RynthPluginBase
_loginMs = now;
_questReadAtMs = _c.Settings.ReadQuestsAtLogin ? now + QuestReadDelayMs : -1;
_nextCharacterReadMs = now;
_nextCharacterExtrasMs = now;
ClearCharacterExtras();
_voidAutoDecided = false;
_dailyCheckStarted = false;
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).
_c.Book.Clear();
if (_timers != null) { _timers.Visible = _c.Settings.QuestTimersOpen; _timers.NeedsPass = true; }
}
public override void OnLogout()
@ -103,14 +145,51 @@ public sealed class RynthOraclePlugin : RynthPluginBase
// Closed for character select (the saved "left open" choice is kept for the next login).
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; }
_ui.SubmitEmpty(Host);
_c.Book.Clear(); // saved as it changed
_c.Flags.Clear();
_c.Void.Clear();
_c.Conquest.Clear();
_c.Boards.Clear();
_c.Server.Reset();
_c.ServerState.Clear();
_c.TitlesKnown = false;
_c.EarnedTitles.Clear();
ClearCharacterExtras();
}
/// <summary>Forgets the Character tab's session (login, logout): the next character's comes fresh.</summary>
private void ClearCharacterExtras()
{
_c.Session = default;
_c.SessionKnown = false;
_c.AiSession.Reset();
}
/// <summary>
/// While the Character tab is on screen: RynthAi's session, every <see cref="CharacterExtrasReadMs"/>.
/// Nothing is read with the window closed or on another tab.
/// </summary>
private void ReadCharacterExtras(long now)
{
if (_main == null || _mainView == null || !_main.Visible || _mainView.Tab != OracleView.TabCharacter) return;
if (now < _nextCharacterExtrasMs) return;
_nextCharacterExtrasMs = now + CharacterExtrasReadMs;
bool known = _c.AiSession.TryGet(Host, now, out Shared.SessionStatsV1 s);
if (known != _c.SessionKnown || known && (s.Xp != _c.Session.Xp || s.Lum != _c.Session.Lum || s.Kills != _c.Session.Kills))
_main.NeedsPass = true;
_c.SessionKnown = known;
_c.Session = known ? s : default;
}
/// <summary>Shows the main window on a tab (another plugin's link, or a /ro tab command).</summary>
private void ShowTab(string tab)
{
if (_mainView != null) _mainView.Tab = tab;
if (_main != null) { _main.Visible = true; _main.NeedsPass = true; }
if (tab == OracleView.TabCharacter) _nextCharacterExtrasMs = 0; // read at once
}
/// <summary>
@ -215,10 +294,27 @@ public sealed class RynthOraclePlugin : RynthPluginBase
case "void":
if (_void != null) { _void.Visible = !_void.Visible; _void.NeedsPass = true; }
break;
case "timers":
case "timer":
if (_timers != null) SetQuestTimers(!_timers.Visible);
break;
case "quests":
case "refresh":
RequestQuests();
break;
case "fellowship":
case "fellow":
case "fship":
// The main window on its Fellowship tab (RynthCore's Char menu and RynthAi's Mini Remote use this).
ShowTab(OracleView.TabFellowship);
break;
case "character":
case "char":
// The Character tab: the character overview and RynthAi's session (the generic part of
// the Mini Remote's old Character tab; Infinite Leaftide's charms stay RynthILT's).
// RynthAi, RynthILT and RynthCore's menus link here; it shows, never toggles off.
ShowTab(OracleView.TabCharacter);
break;
case "status":
string pack = _c.Catalog.PackServer.Length > 0 ? $" + {_c.Catalog.ServerCount} {_c.Catalog.PackServer}" : "";
string titles = _c.TitlesKnown ? $", {_c.EarnedTitles.Count} titles held" : "";
@ -226,13 +322,18 @@ public sealed class RynthOraclePlugin : RynthPluginBase
+ $"{_c.Flags.Flags.Count} quest flags read, {_c.Catalog.RetailCount} retail quests{pack}, {_c.Void.Dots.Count} Void spells tracked{titles}.");
break;
case "about":
// The About tab (settings, the server RynthCore says this is).
_c.Print("Based on Oracle of Dereth by Advis Eveldan - thank you! github.com/advis61/OracleOfDereth (MIT)");
ShowTab(OracleView.TabAbout);
break;
default:
_c.Print("Commands: /ro (window), /ro void (Void window), /ro quests (read quest flags), /ro status, /ro about");
_c.Print("Commands: /ro (window), /ro character (Character tab: status, session), /ro void (Void window), "
+ "/ro timers (Quest Timers window), /ro fellowship (Fellowship tab), /ro quests (read quest flags), /ro status, "
+ "/ro about (About tab: settings, server)");
break;
}
if (arg is "" or "void" && !Host.HasUi && !_noUiLogged)
if (arg is "" or "void" or "timers" or "timer" or "fellowship" or "fellow" or "fship" or "character" or "char"
or "about" && !Host.HasUi && !_noUiLogged)
{
_noUiLogged = true;
_c.Print("This RynthCore engine can't show plugin windows (it needs script windows, API v71, with ImGui on). /ro status still works.");
@ -270,6 +371,13 @@ public sealed class RynthOraclePlugin : RynthPluginBase
_c.Settings.MainWindowOpen = _main.Visible;
_c.Settings.Save();
}
// The same for the Quest Timers window (closed with its X or opened from the engine's menu).
if (_c.InWorld && _timers != null && _timers.Visible != _c.Settings.QuestTimersOpen)
{
_c.Settings.QuestTimersOpen = _timers.Visible;
_c.Settings.Save();
if (_main != null) _main.NeedsPass = true;
}
}
private void TickData(long now)
@ -280,11 +388,19 @@ public sealed class RynthOraclePlugin : RynthPluginBase
_seenFlagRevision = _c.Flags.Revision;
_c.Catalog.SyncDiscoveries(_c.Flags);
if (_main != null) _main.NeedsPass = true;
if (_timers != null) _timers.NeedsPass = true;
}
if (_c.Catalog.Revision != _seenCatalogRevision)
{
_seenCatalogRevision = _c.Catalog.Revision;
if (_main != null) _main.NeedsPass = true;
if (_timers != null) _timers.NeedsPass = true;
}
if (_c.Book.Revision != _seenBookRevision)
{
_seenBookRevision = _c.Book.Revision;
if (_main != null) _main.NeedsPass = true;
if (_timers != null) _timers.NeedsPass = true;
}
string? result = _c.Updater.TakeResult(out bool updated);
@ -302,6 +418,18 @@ public sealed class RynthOraclePlugin : RynthPluginBase
if (!_c.InWorld) return;
ReadCharacterExtras(now);
// 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);
if (_c.ServerState.Revision != _seenServerStateRevision)
{
_seenServerStateRevision = _c.ServerState.Revision;
_c.Server.Refresh(Host, _c.Character.PlayerId != 0 ? _c.Character.PlayerId : Host.GetPlayerId(), _c.ServerState.State);
ApplyServer();
if (_main != null) _main.NeedsPass = true;
}
if (_questReadAtMs >= 0 && now >= _questReadAtMs)
{
_questReadAtMs = -1;
@ -323,8 +451,9 @@ public sealed class RynthOraclePlugin : RynthPluginBase
_nextCharacterReadMs = now + CharacterReadMs;
_c.Character.Read(Host);
_c.Void.RemoveExpired(now);
_c.Server.Refresh(Host, _c.Character.PlayerId);
_c.Server.Refresh(Host, _c.Character.PlayerId, _c.ServerState.State);
ApplyServer();
LoadQuestBook(now);
ReadTitles();
TickConquest(now);
if (!_voidAutoDecided && _c.Character.Valid)
@ -346,6 +475,19 @@ public sealed class RynthOraclePlugin : RynthPluginBase
}
}
/// <summary>
/// Loads this character's quest book (tracked quests, rewards) once the name is known and the
/// world has been announced, or after <see cref="BookWorldWaitMs"/> without one (then filed
/// under "default"), so the file isn't picked before the world name arrives.
/// </summary>
private void LoadQuestBook(long now)
{
if (_c.Book.Loaded || !_c.Character.Valid || _c.Character.Name.Length == 0) return;
if (_c.Server.WorldName.Length == 0 && now - _loginMs < BookWorldWaitMs) return;
_c.Book.Load(_c.Server.WorldName, _c.Character.Name);
if (_c.Book.LoadNote.Length > 0) _c.Print(_c.Book.LoadNote);
}
/// <summary>The titles the character holds (engine API v75), re-read each second (cheap; changes are rare).</summary>
private void ReadTitles()
{
@ -395,6 +537,8 @@ public sealed class RynthOraclePlugin : RynthPluginBase
}
if (_void != null && _voidView != null)
Record(_void, now, 500, _voidView.Draw);
if (_timers != null && _timersView != null)
Record(_timers, now, 1000, _timersView.Draw);
}
/// <summary>

View file

@ -28,6 +28,21 @@ internal sealed partial class OracleView
ServerIdentity sv = _c.Server;
w.Text(sv.Tag.Length > 0 ? $"{sv.Tag}: its own pages and quest pack are on." : "No server-specific pages here (retail features only).");
w.TextDisabled($"How it was decided: {sv.Source}");
// RynthCore's server list (API v86) and the active server's settings from the plugin that owns it.
RynthCore.Plugin.Shared.ServerStateClient st = _c.ServerState;
if (st.State is { } es)
{
w.TextDisabled(es.HasActive
? $"RynthCore: {es.ActiveName} ({es.Active}){(es.Picked ? ", picked by hand" : "")}; settings from {(es.ActivePlugin.Length > 0 ? es.ActivePlugin : "no plugin")}"
: "RynthCore: no server active" + (es.Picked ? " (picked by hand)" : ""));
if (RynthCore.Plugin.Shared.ServerProfileView.Parse(st.ProfileJson) is { } prof)
w.TextDisabled($"{st.ProfilePlugin} ({RynthCore.Plugin.Shared.RynthServerProfileApiV1.InterfaceName}): {prof.Summary()}");
else if (es.ActivePlugin.Length > 0)
w.TextDisabled($"{es.ActivePlugin} hasn't sent its server settings (an older plugin?).");
w.TextDisabled("Change the server: RynthCore Options > Diagnostics > Server, or /rc server pick <id>|auto.");
}
else if (_c.Host.Version >= 75 && _c.Host.Version < 85)
w.TextDisabled($"This engine is API v{_c.Host.Version}; v86 lets RynthOracle follow RynthCore's server pick and overrides.");
if (_c.Host.Version < 75) w.TextDisabled($"This engine is API v{_c.Host.Version}; v75 adds a surer server check and the titles you hold.");
w.SeparatorText("Quest list");
@ -48,6 +63,10 @@ internal sealed partial class OracleView
w.SeparatorText("Commands");
w.BulletText("/ro open or close this window");
w.BulletText("/ro character the Character tab (status, session)");
w.BulletText("/ro timers open or close the Quest Timers window");
w.BulletText("/ro fellowship the Fellowship tab");
w.BulletText("/ro about this tab (settings, server)");
w.BulletText("/ro void open or close the Void window");
w.BulletText("/ro quests read your quest flags now");
w.BulletText("/ro help list the commands in chat");

View file

@ -8,7 +8,9 @@ namespace RynthCore.Plugin.RynthOracle.Views;
/// <summary>
/// Character: level and experience, luminance, the status summary (upstream's Status HUD: buff,
/// house, beer, page and rare timers, key skills, aetheria surges) and the full buff list.
/// house, beer, page and rare timers, key skills, aetheria surges), RynthAi's session (the generic
/// part of the Mini Remote's old Character tab, moved here 2026-10-13) and the full buff list.
/// Infinite Leaftide's charms stay RynthILT's (its Charms tab in the Mini Remote).
/// </summary>
internal sealed partial class OracleView
{
@ -54,6 +56,8 @@ internal sealed partial class OracleView
Field(w, "Melee D", SkillText(c.MeleeDefense), 0f, 100f);
Field(w, "Summoning", SkillText(c.Summoning), 300f, 400f);
DrawSession(w);
var list = new List<ActiveEnchantment>(c.Enchantments);
list.Sort((a, b) => a.Remaining.CompareTo(b.Remaining));
if (w.CollapsingHeader($"Buffs and debuffs ({list.Count})", "c.buffs", defaultOpen: true))
@ -69,6 +73,38 @@ internal sealed partial class OracleView
}
}
/// <summary>
/// "Session": RynthAi's session (the Mini Remote's Session Stats), so every tracker shows the same
/// XP, luminance and kills. Read through "RynthAi.Hub" only while this tab is on screen.
/// </summary>
private void DrawSession(UiWindow w)
{
w.SeparatorText("Session");
if (!_c.SessionKnown)
{
w.TextDisabled("Load RynthAi for the session rates (the Mini Remote's Session Stats).");
return;
}
RynthCore.Plugin.Shared.SessionStatsV1 s = _c.Session;
w.TextDisabled($"From RynthAi's Mini Remote, {TimeText.Clock(Math.Max(0, s.SessionSeconds))} so far.");
Field(w, "XP", $"{TimeText.Number(s.Xp)} ({RateText(s.XpPerHour)}/h)", 0f, 100f);
Field(w, "Luminance", $"{TimeText.Number(s.Lum)} ({RateText(s.LumPerHour)}/h)", 300f, 400f);
Field(w, "Kills", $"{s.Kills} ({s.KillsPerHour:0}/h)", 0f, 100f);
Field(w, "Lum, 5 min", TimeText.Number(s.LumLast5Min), 300f, 400f);
if (s.PassUpTracked != 0)
Field(w, "Pass-up", $"{TimeText.Number(s.LumPassUp)} ({RateText(s.PassUpPerHour)}/h)", 0f, 100f);
w.SmallButton("Session Stats", "c.session.open", () => _c.RunCommand(SessionStatsCommand));
w.Tooltip("Opens RynthCore's Mini Remote on Session Stats (reset the session there).");
}
/// <summary>
/// The Mini Remote's Session Stats section (RynthCore 2026-10-13). "section", not "tab": the
/// engine sends "tab char" back here (/ro character), since that tab moved to this one.
/// </summary>
internal const string SessionStatsCommand = "/rc miniremote section char";
private static string RateText(double perHour) => perHour > 0 ? TimeText.Number((long)Math.Round(perHour)) : "0";
/// <summary>
/// The buff timer: the soonest-ending long (over 15 minutes) buff that isn't a beer, a debuff
/// or one of the not-really-buffs, with how many there are (upstream's rule).

View file

@ -1,13 +1,17 @@
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
using System.Collections.Generic;
using RynthCore.Plugin.RynthAi;
using RynthCore.Plugin.RynthOracle.Ui;
namespace RynthCore.Plugin.RynthOracle.Views;
/// <summary>
/// Fellowship: name, leader, open/locked, experience sharing and the members (upstream's status
/// list). Read from the client's fellowship object through RynthAi's FellowshipTracker (shared
/// source). The recruiting tools are not ported (see the port report).
/// Fellowship: name, leader, open/locked, experience sharing and the members with their levels
/// (upstream's status list). Read from the client's fellowship object through RynthAi's
/// FellowshipTracker (shared source). The Mini Remote's Fellowship view links here ("/ro fellowship").
/// A server's own fellowship rules and commands (Infinite Leaftide's larger fellowships and /fship
/// buttons) are its server plugin's (RynthILT's Fellowship section), not drawn here. The upstream
/// recruiting tools are not ported (see the port report).
/// </summary>
internal sealed partial class OracleView
{
@ -22,28 +26,40 @@ internal sealed partial class OracleView
return;
}
// One snapshot for every row: the index getters could each see a different refresh.
List<(int Id, string Name, int Level)> members = f.GetMembers();
int leaderId = f.LeaderId;
int count = f.MemberCount;
int count = System.Math.Max(f.MemberCount, members.Count);
string leaderName = "";
for (int i = 0; i < count; i++)
if (f.GetMemberId(i) == leaderId) leaderName = f.GetMemberName(i);
foreach ((int id, string name, int _) in members)
if (id == leaderId) leaderName = name;
// A server that allows more than retail's nine: no limit is shown (its server plugin knows it).
bool overRetail = count > MaxFellows;
w.SeparatorText(f.FellowshipName.Length > 0 ? f.FellowshipName : "Fellowship");
Field(w, "Leader", leaderName.Length > 0 ? leaderName : "-", 0f, 110f);
Field(w, "Members", $"{count} / {MaxFellows}", 300f, 400f);
Field(w, "Members", overRetail ? count.ToString() : $"{count} / {MaxFellows}", 300f, 400f);
Field(w, "Open", f.IsOpen ? "yes" : "no", 0f, 110f);
Field(w, "Locked", f.IsLocked ? "yes" : "no", 300f, 400f);
Field(w, "Experience", f.ShareXP ? "shared" : "not shared", 0f, 110f);
bool canRecruit = (leaderId == (int)_c.Character.PlayerId || f.IsOpen) && count < MaxFellows;
Field(w, "Recruit", count >= MaxFellows ? "fellowship full" : canRecruit ? "you can recruit" : "must be open or leader", 300f, 400f);
bool mayRecruit = leaderId == (int)_c.Character.PlayerId || f.IsOpen;
Field(w, "Recruit", !overRetail && count >= MaxFellows ? "fellowship full" : mayRecruit ? "you can recruit" : "must be open or leader", 300f, 400f);
w.SeparatorText("Members");
for (int i = 0; i < count; i++)
if (members.Count == 0) w.TextDisabled("Reading the member list...");
// Leader first, then everyone else by name; the level (0 = not read yet) in its own column.
members.Sort((a, b) => a.Id == leaderId ? -1 : b.Id == leaderId ? 1
: string.Compare(a.Name, b.Name, System.StringComparison.OrdinalIgnoreCase));
foreach ((int id, string name, int level) in members)
{
string name = f.GetMemberName(i);
if (name.Length == 0) continue;
if (f.GetMemberId(i) == leaderId) w.TextColored(UiColors.Gold, name + " (leader)");
if (id == leaderId) w.TextColored(UiColors.Gold, name + " (leader)");
else w.Text(name);
if (level > 0)
{
w.SameLine(260f);
w.TextDisabled("level " + level);
}
}
}
}

View file

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using RynthCore.Plugin.RynthOracle.Data;
using RynthCore.Plugin.RynthOracle.Ui;
namespace RynthCore.Plugin.RynthOracle.Views;
/// <summary>
/// The Quest Timers window: the quests this character tracks (the * column on the Quests tab),
/// each with the time left before it can be done again, "ready", a kill task's kills left, or
/// done. Replaces RynthAi's Mini Remote quest favorites HUD and UtilityBelt ILT's favorites HUD.
/// Ready quests first, then by time left. Hovering a quest shows its flag and recorded rewards.
/// </summary>
internal sealed class QuestTimersView
{
private const float StatusX = 190f;
private const float RemoveX = 275f;
private readonly OracleContext _c;
private readonly List<Quest> _rows = new();
public QuestTimersView(OracleContext c) => _c = c;
public void Draw(UiWindow w)
{
if (!_c.InWorld)
{
w.TextDisabled("Not in the world.");
return;
}
if (!_c.Book.Loaded)
{
w.TextDisabled("Waiting for the character...");
return;
}
QuestFlagStore flags = _c.Flags;
if (_c.Book.Tracked.Count == 0)
{
w.TextDisabled("No quests tracked.");
w.TextWrapped("Tick * next to a quest on Oracle's Quests tab (/ro) to list it here.");
return;
}
DateTime now = _c.UtcNow;
_rows.Clear();
foreach (string flag in _c.Book.Tracked)
_rows.Add(_c.Catalog.TryGet(flag, out Quest q) ? q : new Quest { Flag = flag, IsNew = true });
_rows.Sort((a, b) =>
{
int c = QuestTimer.SortKey(a, flags, now).CompareTo(QuestTimer.SortKey(b, flags, now));
return c != 0 ? c : string.Compare(a.Label, b.Label, StringComparison.OrdinalIgnoreCase);
});
foreach (Quest q in _rows)
{
string flag = q.Flag;
w.Text(Cut(q.Label, 26));
string reward = _c.Book.RewardText(flag);
w.Tooltip(reward.Length > 0 ? $"{q.Label}\n{flag}\nRewards: {reward}" : $"{q.Label}\n{flag}");
w.SameLine(StatusX);
QuestTimerState s = QuestTimer.State(q, flags, now, out string text);
bool held = flags.TryGet(flag, out _);
switch (s)
{
case QuestTimerState.Ready: w.TextColored(UiColors.Green, held ? text : "not done"); break;
case QuestTimerState.InProgress: w.TextColored(UiColors.Yellow, text); break;
case QuestTimerState.Done: w.TextColored(UiColors.Grey, text); break;
default: w.Text(text); break;
}
w.SameLine(RemoveX);
w.SmallButton("x", "qt.x." + flag, () => _c.Book.SetTracked(flag, false));
w.Tooltip("Stop tracking this quest.");
}
if (flags.Loading) w.TextColored(UiColors.Yellow, "Reading quest flags...");
else if (flags.LastReadUtc == DateTime.MinValue) w.TextDisabled("Quest flags not read yet.");
w.SmallButton("Refresh", "qt.refresh", _c.RequestQuests);
w.Tooltip("Sends /myquests and reads the reply (timers count down by themselves between reads).");
if (flags.LastReadUtc != DateTime.MinValue)
{
w.SameLine();
w.TextDisabled($"read {flags.LastReadUtc.ToLocalTime():HH:mm}");
}
}
private static string Cut(string s, int max) => s.Length <= max ? s : s.Substring(0, Math.Max(0, max - 3)) + "...";
}

View file

@ -1,4 +1,7 @@
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
// Tracking, kill tasks and rewards merged in from RynthAi's Mini Remote Quests tab and
// UtilityBelt ILT's quest tracker (2026-10-13). Infinite Leaftide's quest bonus list (/qb) stays
// RynthILT's (the Quests section it draws in the Mini Remote).
using System;
using System.Collections.Generic;
using RynthCore.Plugin.RynthOracle.Data;
@ -8,16 +11,22 @@ namespace RynthCore.Plugin.RynthOracle.Views;
/// <summary>
/// Quests: every flag the character holds, cross-referenced with the master quest list, in one
/// searchable, sortable, paged list (upstream's Quest Flags tab). Click a quest to print its
/// notes and wiki link in chat.
/// searchable, sortable, paged list (upstream's Quest Flags tab). The * column tracks a quest in
/// the Quest Timers window; clicking a quest opens it below the list, with its notes and the
/// rewards editor (UtilityBelt ILT's).
/// </summary>
internal sealed partial class OracleView
{
private const int QuestPageSize = 40;
private const float QuestListHeightWithPanel = 300f;
private static readonly string[] QuestSorts = { "Flag", "Name", "Done first", "Not done first", "Ready soonest", "Most solves" };
// The reward editor's fields, in QuestReward order (two percentages, then counts).
private static readonly string[] RewardLabels =
{ "XP %", "Lum %", "Coins", "Trinkets", "Medallions", "Yellow powder", "Red powder", "Blue powder", "MMDs" };
private string _questSearch = "";
private bool _qDone, _qNotDone, _qRepeatable, _qOneTime, _qNew, _qServer;
private bool _qDone, _qNotDone, _qRepeatable, _qOneTime, _qNew, _qServer, _qTracked, _qKill;
private int _questSort;
private int _questPage;
@ -25,6 +34,11 @@ internal sealed partial class OracleView
private string _questKey = "";
private long _questBuiltMs;
// The quest opened below the list, and its reward editor's text (kept while typing).
private string _questSel = "";
private readonly string[] _rewardEdit = new string[RewardLabels.Length];
private string _rewardMsg = "";
private void DrawQuests(UiWindow w)
{
QuestFlagStore flags = _c.Flags;
@ -40,13 +54,17 @@ internal sealed partial class OracleView
w.Button("Refresh", "q.refresh", _c.RequestQuests);
w.Tooltip("Sends /myquests to the server and reads the reply.");
w.SameLine();
bool timersShown = _c.QuestTimersWindowVisible();
w.Button(timersShown ? "Hide quest timers" : "Show quest timers", "q.timers", () => _c.SetQuestTimersWindow(!timersShown));
w.Tooltip("A small window with the quests you track (the * column) and the time left on each.");
w.SameLine();
QuestCatalog cat = _c.Catalog;
w.TextDisabled(cat.PackServer.Length > 0
? $"{cat.RetailCount} retail quests + {cat.ServerCount} {cat.PackServer} quests"
: $"{cat.RetailCount} retail quests");
w.InputText("Search", "q.search", _questSearch, 64, s => { _questSearch = s; _questPage = 0; });
w.Tooltip("Words to find in the quest's flag or name, e.g. \"kill task\".");
w.Tooltip("Words to find in the quest's flag or name, e.g. \"kill task\". ");
w.Checkbox("Done", "q.done", _qDone, v => { _qDone = v; _questPage = 0; });
w.SameLine();
w.Checkbox("Not done", "q.notdone", _qNotDone, v => { _qNotDone = v; _questPage = 0; });
@ -57,6 +75,11 @@ internal sealed partial class OracleView
w.SameLine();
w.Checkbox("Not in list", "q.new", _qNew, v => { _qNew = v; _questPage = 0; });
w.Tooltip("Flags this character holds that no quest list knows.");
w.Checkbox("Tracked", "q.tracked", _qTracked, v => { _qTracked = v; _questPage = 0; });
w.Tooltip("Only the quests you track (the * column).");
w.SameLine();
w.Checkbox("Kill tasks", "q.kill", _qKill, v => { _qKill = v; _questPage = 0; });
w.Tooltip("Only kill-task counters you hold: kills left, then the reset timer.");
if (_c.Catalog.PackServer.Length > 0)
{
w.SameLine();
@ -70,52 +93,199 @@ internal sealed partial class OracleView
w.SameLine(160f);
_questPage = Pager(w, "q.page", _questPage, rows.Count, QuestPageSize, p => _questPage = p);
w.BeginChild("q.list", 0f, 0f, border: true);
// A fixed-height list when the opened quest follows it; else it fills the page.
bool selected = _questSel.Length > 0;
w.BeginChild("q.list", 0f, selected ? QuestListHeightWithPanel : 0f, border: true);
w.TextDisabled("*");
w.Tooltip("Track: list the quest in the Quest Timers window.");
w.SameLine(28f);
w.TextDisabled("Done");
w.SameLine(50f);
w.SameLine(72f);
w.TextDisabled("Quest");
w.SameLine(370f);
w.TextDisabled("Ready in");
w.SameLine(480f);
w.SameLine(470f);
w.TextDisabled("Solves");
w.SameLine(530f);
w.TextDisabled("Rewards");
w.Tooltip("What you recorded for the quest (click it to edit): %XP, %Lum, Coins, Trinkets, Medallions, Yellow/Red/Blue powder, MMDs (D), at Level.");
DateTime now = _c.UtcNow;
bool canTrack = _c.Book.Loaded;
int start = _questPage * QuestPageSize;
for (int i = start; i < rows.Count && i < start + QuestPageSize; i++)
{
Quest q = rows[i];
string flag = q.Flag;
bool tracked = _c.Book.IsTracked(flag);
w.ToggleButton("*", "q.t." + flag, tracked, () => { if (canTrack) _c.Book.ToggleTracked(flag); }, small: true);
w.SameLine(28f);
bool done = q.IsComplete(flags);
DoneMark(w, done);
w.SameLine(50f);
string name = q.IsNew ? "(new) " + (q.Name.Length > 0 ? q.Name : q.Flag) : q.DisplayName;
w.SameLine(72f);
Quest row = q;
w.Selectable(Cut(name, 46), "q.r." + q.Flag, false, () => PrintQuest(row), 310f);
w.Tooltip(q.Flag);
w.Selectable(Cut(q.Label, 44), "q.r." + flag, flag == _questSel, () => SelectQuest(row), 290f);
w.Tooltip(flag);
w.SameLine(370f);
string status = q.Status(flags, now);
if (status == "ready" && done) w.TextColored(UiColors.Green, status);
else w.Text(status);
TimerText(w, q, flags, now, done);
string solves = q.SolvesText(flags);
if (solves.Length > 0)
{
w.SameLine(480f);
w.SameLine(470f);
w.Text(solves);
}
string reward = _c.Book.RewardText(flag);
if (reward.Length > 0)
{
w.SameLine(530f);
w.Text(Cut(reward, 18));
if (reward.Length > 18) w.Tooltip(reward);
}
}
if (rows.Count == 0) w.TextDisabled("No quests match.");
if (rows.Count == 0) w.TextDisabled(_qTracked ? "No tracked quests match. Tick * on a quest to track it." : "No quests match.");
w.EndChild();
if (selected) DrawSelectedQuest(w);
}
/// <summary>The timer column: "ready" (green once done), a countdown, "N left" (yellow) or done (grey).</summary>
private static void TimerText(UiWindow w, Quest q, QuestFlagStore flags, DateTime now, bool done)
{
QuestTimerState s = QuestTimer.State(q, flags, now, out string text);
switch (s)
{
case QuestTimerState.Ready when done: w.TextColored(UiColors.Green, text); break;
case QuestTimerState.InProgress: w.TextColored(UiColors.Yellow, text); break;
case QuestTimerState.Done: w.TextColored(UiColors.Grey, text); break;
default: w.Text(text); break;
}
}
// ── The opened quest and its rewards ──────────────────────────────────
private void SelectQuest(Quest q)
{
if (_questSel == q.Flag) { _questSel = ""; return; } // a second click closes it
_questSel = q.Flag;
_rewardMsg = "";
LoadRewardEdit(q.Flag);
}
/// <summary>Fills the editor from what is recorded (blank fields for zero).</summary>
private void LoadRewardEdit(string flag)
{
Array.Fill(_rewardEdit, "");
if (!_c.Book.TryGetReward(flag, out QuestReward r)) return;
_rewardEdit[0] = r.XpPercent > 0 ? QuestReward.Percent(r.XpPercent) : "";
_rewardEdit[1] = r.LumPercent > 0 ? QuestReward.Percent(r.LumPercent) : "";
int[] counts = { r.Coins, r.Trinkets, r.Medallions, r.YellowPowder, r.RedPowder, r.BluePowder, r.Mmd };
for (int i = 0; i < counts.Length; i++) _rewardEdit[2 + i] = counts[i] > 0 ? counts[i].ToString() : "";
}
private void DrawSelectedQuest(UiWindow w)
{
Quest q = _c.Catalog.TryGet(_questSel, out Quest found) ? found : new Quest { Flag = _questSel, IsNew = true };
QuestFlagStore flags = _c.Flags;
w.SeparatorText(Cut(q.Label, 60));
w.TextDisabled("Flag");
w.SameLine(90f);
w.Text(q.Flag);
w.TextDisabled("Status");
w.SameLine(90f);
TimerText(w, q, flags, _c.UtcNow, q.IsComplete(flags));
if (flags.TryGet(q.Flag, out QuestFlag f))
{
w.SameLine(260f);
w.TextDisabled(f.MaxSolves > 0 ? $"solves {f.Solves} of {f.MaxSolves}" : $"solves {f.Solves}");
}
string details = q.Details();
if (details.Length > 0) w.TextWrapped(Cut(details, 600));
bool loaded = _c.Book.Loaded;
bool tracked = _c.Book.IsTracked(q.Flag);
string flag = q.Flag;
w.Button(tracked ? "Untrack" : "Track", "q.sel.track", () => { if (loaded) _c.Book.ToggleTracked(flag); });
w.Tooltip("List this quest in the Quest Timers window.");
w.SameLine();
Quest print = q;
w.Button("Print in chat", "q.sel.print", () => PrintQuest(print));
w.SameLine();
w.Button("Close", "q.sel.close", () => _questSel = "");
w.SeparatorText("Rewards");
if (!loaded)
{
w.TextDisabled("Waiting for the character's name before rewards can be saved.");
return;
}
int level = _c.Book.TryGetReward(flag, out QuestReward saved) && saved.RecordedLevel > 0 ? saved.RecordedLevel : _c.Character.Level;
w.TextDisabled($"Level: {level} (XP % and Lum % are for this level)");
for (int i = 0; i < RewardLabels.Length; i++)
{
int field = i;
w.InputText(RewardLabels[i], "q.rw." + i, _rewardEdit[i], 16, s => _rewardEdit[field] = s);
}
w.Button("Save rewards", "q.rw.save", () => SaveReward(flag));
w.SameLine();
w.Button("Clear", "q.rw.clear", () =>
{
_c.Book.SetReward(flag, null);
LoadRewardEdit(flag);
_rewardMsg = "Cleared.";
});
if (_rewardMsg.Length > 0)
{
w.SameLine();
w.TextDisabled(_rewardMsg);
}
}
/// <summary>Parses the editor (UB's rules: percent 0..1000, counts 0 and up) and stores the entry.</summary>
private void SaveReward(string flag)
{
var r = new QuestReward();
if (!QuestReward.TryParsePercent(_rewardEdit[0], out r.XpPercent)) { _rewardMsg = "XP % isn't a number."; return; }
if (!QuestReward.TryParsePercent(_rewardEdit[1], out r.LumPercent)) { _rewardMsg = "Lum % isn't a number."; return; }
var counts = new int[7];
for (int i = 0; i < counts.Length; i++)
{
if (QuestReward.TryParseCount(_rewardEdit[2 + i], out counts[i])) continue;
_rewardMsg = RewardLabels[2 + i] + " isn't a whole number.";
return;
}
r.Coins = counts[0];
r.Trinkets = counts[1];
r.Medallions = counts[2];
r.YellowPowder = counts[3];
r.RedPowder = counts[4];
r.BluePowder = counts[5];
r.Mmd = counts[6];
// The percentages belong to the level they were noted at: keep the old level unless they changed.
bool had = _c.Book.TryGetReward(flag, out QuestReward old);
bool percentChanged = !had || old.XpPercent != r.XpPercent || old.LumPercent != r.LumPercent;
if (r.XpPercent > 0 || r.LumPercent > 0)
r.RecordedLevel = !percentChanged && old.RecordedLevel > 0 ? old.RecordedLevel : _c.Character.Level;
_c.Book.SetReward(flag, r);
LoadRewardEdit(flag);
_rewardMsg = r.IsEmpty ? "Cleared." : "Saved: " + r.ShortSummary();
}
private void PrintQuest(Quest q)
{
string status = q.IsComplete(_c.Flags) ? q.Status(_c.Flags, _c.UtcNow) : "not done";
PrintEntry(q.IsNew ? (q.Name.Length > 0 ? q.Name : "Not in the quest list") : q.DisplayName, q.Flag, status, q.Details(), q.Url);
if (_c.Book.TryGetReward(q.Flag, out QuestReward r)) _c.Print("Rewards: " + r.LongSummary());
}
// ── Rows ──────────────────────────────────────────────────────────────
/// <summary>The filtered, sorted rows; rebuilt when the filter or data changed (or every 5 s for timers).</summary>
private List<Quest> QuestRows()
{
string key = $"{_questSearch}|{_qDone}{_qNotDone}{_qRepeatable}{_qOneTime}{_qNew}{_qServer}|{_questSort}|{_c.Flags.Revision}|{_c.Catalog.Revision}";
string key = $"{_questSearch}|{_qDone}{_qNotDone}{_qRepeatable}{_qOneTime}{_qNew}{_qServer}{_qTracked}{_qKill}|{_questSort}"
+ $"|{_c.Flags.Revision}|{_c.Catalog.Revision}|{(_qTracked ? _c.Book.Revision : 0)}";
bool timeSorted = _questSort == 4;
if (key == _questKey && (!timeSorted || _c.NowMs - _questBuiltMs < 5000)) return _questRows;
_questKey = key;
@ -128,6 +298,8 @@ internal sealed partial class OracleView
{
if (_qNew && !q.IsNew) continue;
if (_qServer && q.Server.Length == 0) continue;
if (_qTracked && !_c.Book.IsTracked(q.Flag)) continue;
if (_qKill && !(flags.TryGet(q.Flag, out QuestFlag kf) && QuestTimer.IsKillTask(kf))) continue;
if (_qDone != _qNotDone && q.IsComplete(flags) != _qDone) continue;
if (_qRepeatable != _qOneTime && q.IsRepeatable(flags) != _qRepeatable) continue;
if (terms.Length > 0)
@ -170,11 +342,10 @@ internal sealed partial class OracleView
}
/// <summary>Held repeatables by time left (ready ones first); everything else after them.</summary>
private static double ReadyKey(Quest q, QuestFlagStore flags, DateTime now)
{
if (!flags.TryGet(q.Flag, out QuestFlag f) || !q.IsRepeatable(flags) || f.AtSolveLimit) return double.MaxValue;
return Math.Max(0, f.NextAvailableTime(now).TotalSeconds);
}
private static double ReadyKey(Quest q, QuestFlagStore flags, DateTime now) =>
flags.TryGet(q.Flag, out _) && (q.IsRepeatable(flags) || flags.TryGet(q.Flag, out QuestFlag f) && QuestTimer.IsKillTask(f))
? QuestTimer.SortKey(q, flags, now)
: double.MaxValue;
private static int Solves(Quest q, QuestFlagStore flags) =>
flags.TryGet(q.Flag, out QuestFlag f) && q.IsRepeatable(flags) ? f.Solves : 0;