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
245
Plugins/RynthCore.Plugin.RynthOracle/Data/DynamicStamps.cs
Normal file
245
Plugins/RynthCore.Plugin.RynthOracle/Data/DynamicStamps.cs
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>
|
||||
/// One Infinite Leaftide Dynamic Stamp (dynstamps.csv): an NPC hand-in that puts a
|
||||
/// "Dynamic_N_..." quest flag on the character. List from the players' "ExtraDyn" sheet
|
||||
/// (10.13.2026, one sheet per area, the wiki's Dynamic Stamps page); NPCs that give no stamp
|
||||
/// are left out. A stamp is a one-time flag: having it in /myquests means it's done.
|
||||
/// </summary>
|
||||
internal sealed class DynamicStamp
|
||||
{
|
||||
public string Area = "";
|
||||
/// <summary>Where in the area (a town, a dungeon, coordinates), or "".</summary>
|
||||
public string Place = "";
|
||||
public string Npc = "";
|
||||
/// <summary>What the NPC gives back (the sheet's "X gives you Y"), or "".</summary>
|
||||
public string Reward = "";
|
||||
/// <summary>The quest flag, lower case (as QuestFlagStore keys it).</summary>
|
||||
public string Stamp = "";
|
||||
public string Note = "";
|
||||
|
||||
/// <summary>The NPC, else the place (a few sheet rows only name the spot).</summary>
|
||||
public string Label => Npc.Length > 0 ? Npc : Place;
|
||||
|
||||
/// <summary>
|
||||
/// The stamp without the "!" the sheet copied from the server's "You've stamped {flag}!" line.
|
||||
/// ACECustom names a stamp "Dynamic_1_" plus random letters, digits and ! @ # $ ^ &
|
||||
/// (QuestManager.ComputeDynamicQuest), yet 238 of the 243 listed stamps end in "!".
|
||||
/// </summary>
|
||||
public string Stem => Stamp.EndsWith('!') ? Stamp[..^1] : Stamp;
|
||||
|
||||
/// <summary>
|
||||
/// The flag this character has for the stamp, or null. Tried in order: the stamp as listed,
|
||||
/// without the copied closing "!" (the server's flag, almost always), with "!" added (a few
|
||||
/// rows lost a real one), its errand's delivery flag ("_d"), then, when the stem is at least
|
||||
/// <see cref="MinPrefixLength"/> long, the one errand whose flag starts with it (a row cut
|
||||
/// short). <paramref name="qbStamps"/> is the Dynamic flags of RynthILT's /qb list (Infinite
|
||||
/// Leaftide): /myquests leaves out flags the server holds no quest text for, so a stamp that
|
||||
/// isn't in /myquests is looked for there too, with the same rules.
|
||||
/// </summary>
|
||||
public string? MatchedFlag(QuestFlagStore flags, IReadOnlySet<string>? qbStamps = null)
|
||||
{
|
||||
string? mine = Match(k => flags.TryGet(k, out _), flags.Flags.Keys);
|
||||
if (mine != null || qbStamps == null || qbStamps.Count == 0) return mine;
|
||||
return Match(qbStamps.Contains, qbStamps);
|
||||
}
|
||||
|
||||
/// <summary>The matching rules over one source (see <see cref="MatchedFlag"/>).</summary>
|
||||
private string? Match(Func<string, bool> has, IEnumerable<string> keys)
|
||||
{
|
||||
string stem = Stem;
|
||||
if (has(Stamp)) return Stamp;
|
||||
if (stem != Stamp && has(stem)) return stem;
|
||||
if (stem == Stamp && has(Stamp + "!")) return Stamp + "!";
|
||||
if (has(stem + DynamicStampList.DeliverySuffix)) return stem + DynamicStampList.DeliverySuffix;
|
||||
if (stem.Length < MinPrefixLength) return null;
|
||||
string? only = null;
|
||||
foreach (string key in keys)
|
||||
{
|
||||
if (!key.StartsWith(stem, StringComparison.OrdinalIgnoreCase)) continue;
|
||||
// An errand's own flag and its "_d" delivery flag are one stamp; two errands can't be told apart.
|
||||
if (only != null && !DynamicStampList.ErrandOf(only).Equals(DynamicStampList.ErrandOf(key), StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
if (only == null || key.Length < only.Length) only = key; // the errand's own flag over its "_d"
|
||||
}
|
||||
return only;
|
||||
}
|
||||
|
||||
public bool Have(QuestFlagStore flags, IReadOnlySet<string>? qbStamps = null) => MatchedFlag(flags, qbStamps) != null;
|
||||
|
||||
// Sheet areas that are groupings, not places on the map.
|
||||
private static readonly HashSet<string> NotPlaces = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"Looking Around", "Odd Stamps", "Odd Stamps 2",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Where RynthNav should go for this stamp, best first (RynthNav takes the first that is on its
|
||||
/// map): the coordinates in the note or the place, the place and its parts ("Mhoire Castle -
|
||||
/// Great Hall" also tries "Mhoire Castle"), the NPC, then the area. Empty when there is nothing.
|
||||
/// </summary>
|
||||
public List<string> NavCandidates()
|
||||
{
|
||||
var list = new List<string>();
|
||||
void Add(string s)
|
||||
{
|
||||
s = s.Trim().Trim('.', ',', ';', ':').Trim();
|
||||
if (s.Length >= 4 && !char.IsDigit(s[0]) && !list.Contains(s, StringComparer.OrdinalIgnoreCase)) list.Add(s);
|
||||
}
|
||||
|
||||
foreach (string text in new[] { Note, Place })
|
||||
if (NavTargets.FirstCoords(text) is string c && !list.Contains(c)) list.Add(c);
|
||||
|
||||
string place = NavTargets.WithoutCoords(Place);
|
||||
place = System.Text.RegularExpressions.Regex.Replace(place, @"\b(at|in the|nearby)\b", " ", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
place = System.Text.RegularExpressions.Regex.Replace(place, @"\s+", " ").Trim();
|
||||
Add(place);
|
||||
foreach (string part in place.Split(new[] { " - ", " / ", "(", ")" }, StringSplitOptions.RemoveEmptyEntries))
|
||||
Add(part);
|
||||
Add(Npc);
|
||||
if (!NotPlaces.Contains(Area)) Add(Area);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>A truncated stamp shorter than this is matched exactly only (too many flags share a short stem).</summary>
|
||||
public const int MinPrefixLength = 14;
|
||||
}
|
||||
|
||||
internal static class DynamicStampList
|
||||
{
|
||||
/// <summary>Dynamic stamp quest flags start with this (lower case).</summary>
|
||||
public const string FlagPrefix = "dynamic_";
|
||||
|
||||
/// <summary>
|
||||
/// A chain errand's second flag: the NPC the item is delivered to stamps the errand's flag
|
||||
/// with this added (QuestManager.ComputeDynamicQuest, questName + "_d").
|
||||
/// </summary>
|
||||
public const string DeliverySuffix = "_d";
|
||||
|
||||
/// <summary>The errand a Dynamic flag belongs to: the flag without its "_d" delivery suffix.</summary>
|
||||
public static string ErrandOf(string flag) =>
|
||||
flag.EndsWith(DeliverySuffix, StringComparison.OrdinalIgnoreCase) ? flag[..^DeliverySuffix.Length] : flag;
|
||||
|
||||
private static readonly List<DynamicStamp> Sheet = Load();
|
||||
|
||||
/// <summary>
|
||||
/// The stamps: the wiki's Dynamic Stamps page when RynthILT has read it (2026-11-21, Silentkelpie: "the dynamic
|
||||
/// stamp tab should be using" it), else the players' sheet shipped with RynthOracle.
|
||||
/// </summary>
|
||||
public static List<DynamicStamp> All { get; private set; } = Sheet;
|
||||
|
||||
/// <summary>The areas in list order (the wiki's towns and camps, or the sheet's Facility Hub, Looking Around, ...).</summary>
|
||||
public static List<string> Areas { get; private set; } = BuildAreas(Sheet);
|
||||
|
||||
/// <summary>Where the list comes from: "wiki" or "sheet".</summary>
|
||||
public static string Source { get; private set; } = "sheet";
|
||||
|
||||
/// <summary>Goes up when the list is swapped.</summary>
|
||||
public static int Revision { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Uses the wiki's Dynamic Stamps (QuestGuide.DynStamps) when there are any, else goes back to the sheet.
|
||||
/// Pump thread. The wiki's coordinates go into the note, where RynthNav's candidates look first.
|
||||
/// </summary>
|
||||
public static void UseWiki(IReadOnlyList<GuideDynStamp>? wiki)
|
||||
{
|
||||
if (wiki == null || wiki.Count == 0)
|
||||
{
|
||||
if (Source == "sheet") return;
|
||||
All = Sheet;
|
||||
Areas = BuildAreas(Sheet);
|
||||
Source = "sheet";
|
||||
Revision++;
|
||||
return;
|
||||
}
|
||||
var list = new List<DynamicStamp>(wiki.Count);
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (GuideDynStamp d in wiki)
|
||||
{
|
||||
string stamp = d.Stamp.Trim().ToLowerInvariant();
|
||||
if (!stamp.StartsWith(FlagPrefix, StringComparison.Ordinal) || !seen.Add(stamp)) continue;
|
||||
string note = d.Coords.Length > 0 && d.Note.Length > 0 ? d.Coords + " - " + d.Note : d.Coords + d.Note;
|
||||
list.Add(new DynamicStamp { Area = d.Area, Place = d.Place, Npc = d.Npc, Reward = d.Reward, Stamp = stamp, Note = note });
|
||||
}
|
||||
if (list.Count == 0) { UseWiki(null); return; }
|
||||
All = list;
|
||||
Areas = BuildAreas(list);
|
||||
Source = "wiki";
|
||||
Revision++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dynamic stamps on this character that the list doesn't have (new or unlisted NPCs), so the
|
||||
/// tab can show them and the count isn't only what the sheet knows.
|
||||
/// </summary>
|
||||
public static List<string> Unlisted(QuestFlagStore flags, IReadOnlySet<string>? qbStamps = null)
|
||||
{
|
||||
// By errand: a listed stamp's "_d" delivery flag is that stamp, and an unlisted errand shows once.
|
||||
var matched = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (DynamicStamp s in All)
|
||||
if (s.MatchedFlag(flags, qbStamps) is string f) matched.Add(ErrandOf(f));
|
||||
var extra = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (string key in flags.Flags.Keys)
|
||||
if (key.StartsWith(FlagPrefix, StringComparison.OrdinalIgnoreCase) && !matched.Contains(ErrandOf(key)))
|
||||
extra.Add(ErrandOf(key));
|
||||
if (qbStamps != null)
|
||||
foreach (string key in qbStamps)
|
||||
if (key.StartsWith(FlagPrefix, StringComparison.OrdinalIgnoreCase) && !matched.Contains(ErrandOf(key)))
|
||||
extra.Add(ErrandOf(key));
|
||||
var list = extra.ToList();
|
||||
list.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Where this character's stamps come from, for the log: Dynamic flags in /myquests, Dynamic
|
||||
/// flags in the /qb list, and the listed stamps matched from either.
|
||||
/// </summary>
|
||||
public static (int InMyQuests, int InQb, int Matched) Counts(QuestFlagStore flags, IReadOnlySet<string>? qbStamps)
|
||||
{
|
||||
int mine = flags.Flags.Keys.Count(k => k.StartsWith(FlagPrefix, StringComparison.OrdinalIgnoreCase));
|
||||
int qb = qbStamps?.Count(k => k.StartsWith(FlagPrefix, StringComparison.OrdinalIgnoreCase)) ?? 0;
|
||||
int matched = All.Count(s => s.Have(flags, qbStamps));
|
||||
return (mine, qb, matched);
|
||||
}
|
||||
|
||||
private static List<DynamicStamp> Load()
|
||||
{
|
||||
var list = new List<DynamicStamp>();
|
||||
using StreamReader r = Csv.OpenEmbedded("dynstamps.csv");
|
||||
Dictionary<string, int> col = Csv.MapColumns(r.ReadLine() ?? "");
|
||||
int cArea = Csv.Column(col, "Area"), cPlace = Csv.Column(col, "Place"), cNpc = Csv.Column(col, "Npc"),
|
||||
cReward = Csv.Column(col, "Reward"), cStamp = Csv.Column(col, "Stamp"), cNote = Csv.Column(col, "Note");
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
while (r.ReadLine() is string line)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(line)) continue;
|
||||
string[] f = Csv.ParseLine(line);
|
||||
string stamp = Csv.Field(f, cStamp).Trim().ToLowerInvariant();
|
||||
if (!stamp.StartsWith(FlagPrefix, StringComparison.Ordinal) || !seen.Add(stamp)) continue;
|
||||
list.Add(new DynamicStamp
|
||||
{
|
||||
Area = Csv.Field(f, cArea),
|
||||
Place = Csv.Field(f, cPlace),
|
||||
Npc = Csv.Field(f, cNpc),
|
||||
Reward = Csv.Field(f, cReward),
|
||||
Stamp = stamp,
|
||||
Note = Csv.Field(f, cNote),
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<string> BuildAreas(List<DynamicStamp> all)
|
||||
{
|
||||
var areas = new List<string>();
|
||||
foreach (DynamicStamp s in all)
|
||||
if (!areas.Contains(s.Area)) areas.Add(s.Area);
|
||||
return areas;
|
||||
}
|
||||
}
|
||||
297
Plugins/RynthCore.Plugin.RynthOracle/Data/FandomFeed.cs
Normal file
297
Plugins/RynthCore.Plugin.RynthOracle/Data/FandomFeed.cs
Normal file
|
|
@ -0,0 +1,297 @@
|
|||
// FandomFeed.cs - RynthOracle's own quest guide from the AC Community Wiki, asheron.fandom.com (2026-11-21,
|
||||
// Silentkelpie: "under oracle duplicate itl functions for pulling in overall quests ... pull a dynamic feed from
|
||||
// https://asheron.fandom.com/wiki/Category:Quests for the quests, .../Category:Kill_Tasks for kill task,
|
||||
// .../Category:Society_Quests for socity quests, .../Category:Contracts for contracts ... should not be gated
|
||||
// behind any server check"). The same reading as RynthILT's WikiFeed (leaftidewiki.com, a fork of this wiki
|
||||
// with the same templates), but anonymous and on every server:
|
||||
// - the quests: every page with the {{Quest Summary}} box, and the pages under Category:Quests (its
|
||||
// sub-categories followed, the item ones left out);
|
||||
// - the kill tasks: Category:Kill_Tasks and its sub-categories;
|
||||
// - the society quests: Category:Society_Quests, each page's rank from the sub-category it is in
|
||||
// ("Society Quests: Initiate Rank" -> Initiate; "Joining a Society Quests" -> Joining);
|
||||
// - the contracts: Category:Contracts' item pages (WikiQuestParser.ParseContract).
|
||||
// Only pages changed since the last read are fetched (their revision ids), unless the page reader is newer
|
||||
// (WikiQuestParser.Version). Saved to %APPDATA%\RynthCore\RynthOracle\fandom-quests.json, read at load. The
|
||||
// read runs on a pool thread and only builds a new QuestGuide and writes the file; the pump takes it
|
||||
// (TakeResult). Read at login when the saved one is a day old (or older reader, or none), and on Refresh.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal sealed class FandomFeed
|
||||
{
|
||||
public const string Api = "https://asheron.fandom.com/api.php";
|
||||
public const string WikiBase = "https://asheron.fandom.com/wiki/";
|
||||
public const string QuestTemplate = "Template:Quest_Summary";
|
||||
public const string QuestsCategory = "Category:Quests";
|
||||
public const string KillTasksCategory = "Category:Kill_Tasks";
|
||||
public const string SocietyCategory = "Category:Society_Quests";
|
||||
public const string ContractsCategory = "Category:Contracts";
|
||||
public const int RefreshHours = 24;
|
||||
/// <summary>Category:Quests is a tree; this many categories at most are followed.</summary>
|
||||
internal const int MaxCategories = 400;
|
||||
private const int RequestGapMs = 250;
|
||||
|
||||
public static string DefaultPath => Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RynthCore", "RynthOracle", "fandom-quests.json");
|
||||
|
||||
private readonly string _path;
|
||||
private CancellationTokenSource? _cts;
|
||||
private Task? _task;
|
||||
private volatile QuestGuide? _ready; // a new guide for the pump
|
||||
private volatile string _status = "";
|
||||
private bool _autoTried;
|
||||
|
||||
/// <summary>The guide in use (pump thread).</summary>
|
||||
public QuestGuide Guide { get; private set; } = new();
|
||||
/// <summary>Goes up when <see cref="Guide"/> is replaced.</summary>
|
||||
public int Revision { get; private set; }
|
||||
public bool Running => _task is { IsCompleted: false };
|
||||
public string Status => _status;
|
||||
|
||||
public FandomFeed(string? path = null)
|
||||
{
|
||||
_path = path ?? DefaultPath;
|
||||
try
|
||||
{
|
||||
if (File.Exists(_path)) Guide = QuestGuide.Parse(File.ReadAllText(_path));
|
||||
}
|
||||
catch { Guide = new QuestGuide(); }
|
||||
_status = Guide.Quests.Count > 0
|
||||
? $"{Guide.Quests.Count} quests, {Guide.Contracts.Count} contracts (read {Guide.UpdatedUtc.ToLocalTime():MM-dd HH:mm})"
|
||||
: "not read yet";
|
||||
}
|
||||
|
||||
/// <summary>The saved guide wants reading: none yet, a day old, or made by an older page reader.</summary>
|
||||
internal static bool Due(QuestGuide g, DateTime utcNow) =>
|
||||
g.Quests.Count == 0 || g.Parser < WikiQuestParser.Version || utcNow - g.UpdatedUtc >= TimeSpan.FromHours(RefreshHours);
|
||||
|
||||
/// <summary>Pump thread, in the world: the read at login, once a session, when the saved guide is due.</summary>
|
||||
public void Tick(DateTime utcNow)
|
||||
{
|
||||
if (_autoTried) return;
|
||||
_autoTried = true;
|
||||
if (Due(Guide, utcNow)) Start();
|
||||
}
|
||||
|
||||
/// <summary>Starts a read unless one is running. Pump thread.</summary>
|
||||
public bool Start()
|
||||
{
|
||||
if (Running) return false;
|
||||
_cts?.Dispose();
|
||||
_cts = new CancellationTokenSource();
|
||||
CancellationToken token = _cts.Token;
|
||||
QuestGuide old = Guide;
|
||||
_status = "reading...";
|
||||
_task = Task.Run(async () =>
|
||||
{
|
||||
try { _status = await RefreshAsync(old, token).ConfigureAwait(false); }
|
||||
catch (OperationCanceledException) { _status = "stopped"; }
|
||||
catch (Exception ex) { _status = "couldn't read the wiki: " + ex.GetType().Name + ": " + ex.Message; }
|
||||
}, token);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Pump thread: takes a finished read's guide; true when the guide changed.</summary>
|
||||
public bool TakeResult()
|
||||
{
|
||||
QuestGuide? g = _ready;
|
||||
if (g == null) return false;
|
||||
_ready = null;
|
||||
Guide = g;
|
||||
Revision++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Uses a guide (the tests).</summary>
|
||||
internal void Use(QuestGuide g)
|
||||
{
|
||||
Guide = g;
|
||||
Revision++;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
try { _cts?.Cancel(); _task?.Wait(2000); } catch { }
|
||||
}
|
||||
|
||||
// ── The read (pool thread) ──────────────────────────────────────────────
|
||||
|
||||
private static readonly Regex RankRx = new(@"(?:^|:\s*)(\w+)\s+Rank\b", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>The society rank a society sub-category stands for ("Society Quests: Knight Rank" -> Knight), or "".</summary>
|
||||
internal static string RankOf(string category)
|
||||
{
|
||||
Match m = RankRx.Match(category);
|
||||
if (m.Success) return char.ToUpperInvariant(m.Groups[1].Value[0]) + m.Groups[1].Value.Substring(1).ToLowerInvariant();
|
||||
return category.Contains("Joining", StringComparison.OrdinalIgnoreCase) ? "Joining" : "";
|
||||
}
|
||||
|
||||
/// <summary>A Category:Quests sub-category not followed: item and NPC lists, not quests.</summary>
|
||||
internal static bool SkipCategory(string category) =>
|
||||
category.Contains("Quest Items", StringComparison.OrdinalIgnoreCase)
|
||||
|| category.Contains("Items", StringComparison.OrdinalIgnoreCase) && !category.Contains("Quest", StringComparison.OrdinalIgnoreCase)
|
||||
|| category.Contains("NPC", StringComparison.OrdinalIgnoreCase)
|
||||
|| category.Contains("Brokers", StringComparison.OrdinalIgnoreCase)
|
||||
|| category.Contains("Images", StringComparison.OrdinalIgnoreCase)
|
||||
|| category.Contains("Maps", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private async Task<string> RefreshAsync(QuestGuide old, CancellationToken token)
|
||||
{
|
||||
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
|
||||
http.DefaultRequestHeaders.UserAgent.ParseAdd("RynthOracle/1.0 (RynthCore quest guide; Asheron's Call)");
|
||||
|
||||
var titles = new SortedSet<string>(StringComparer.Ordinal);
|
||||
var killTasks = new SortedSet<string>(StringComparer.Ordinal);
|
||||
var contracts = new SortedSet<string>(StringComparer.Ordinal);
|
||||
var society = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
_status = "listing the quest pages...";
|
||||
await ListAsync(http, "embeddedin", new[] { ("list", "embeddedin"), ("eititle", QuestTemplate), ("einamespace", "0"), ("eilimit", "max") },
|
||||
p => titles.Add(p), _ => { }, token).ConfigureAwait(false);
|
||||
await WalkAsync(http, QuestsCategory, (p, _) => titles.Add(p), SkipCategory, token).ConfigureAwait(false);
|
||||
_status = "listing the kill tasks...";
|
||||
await WalkAsync(http, KillTasksCategory, (p, _) => { killTasks.Add(p); titles.Add(p); }, SkipCategory, token).ConfigureAwait(false);
|
||||
_status = "listing the society quests...";
|
||||
await WalkAsync(http, SocietyCategory, (p, cat) =>
|
||||
{
|
||||
titles.Add(p);
|
||||
string rank = RankOf(cat);
|
||||
if (rank.Length > 0 && !society.ContainsKey(p)) society[p] = rank;
|
||||
}, SkipCategory, token).ConfigureAwait(false);
|
||||
_status = "listing the contracts...";
|
||||
await ListAsync(http, "categorymembers", new[] { ("list", "categorymembers"), ("cmtitle", ContractsCategory), ("cmlimit", "max"), ("cmtype", "page") },
|
||||
p => { contracts.Add(p); titles.Add(p); }, _ => { }, token).ConfigureAwait(false);
|
||||
if (titles.Count == 0) return "the wiki listed no quest pages";
|
||||
|
||||
// Which pages changed since the saved guide.
|
||||
var list = new List<string>(titles);
|
||||
var revs = new Dictionary<string, long>(StringComparer.Ordinal);
|
||||
int done = 0;
|
||||
foreach (string batch in MediaWikiJson.Batches(list))
|
||||
{
|
||||
_status = $"checking pages ({done}/{list.Count})...";
|
||||
string json = await GetAsync(http, MediaWikiJson.Url(Api, ("action", "query"), ("prop", "info"), ("titles", batch)), token).ConfigureAwait(false);
|
||||
foreach (var kv in MediaWikiJson.LastRevisions(json)) revs[kv.Key] = kv.Value;
|
||||
done += MediaWikiJson.TitlesPerRequest;
|
||||
}
|
||||
List<string> changed = PagesToRead(old, revs);
|
||||
|
||||
var fresh = new Dictionary<string, GuideQuest>(StringComparer.Ordinal);
|
||||
var freshContracts = new Dictionary<string, GuideContract>(StringComparer.Ordinal);
|
||||
var notQuest = new HashSet<string>(StringComparer.Ordinal);
|
||||
int read = 0;
|
||||
foreach (string batch in MediaWikiJson.Batches(changed))
|
||||
{
|
||||
_status = $"reading pages ({read}/{changed.Count})...";
|
||||
string json = await GetAsync(http, MediaWikiJson.Url(Api, ("action", "query"), ("prop", "revisions"), ("rvprop", "content|ids"),
|
||||
("rvslots", "main"), ("titles", batch)), token).ConfigureAwait(false);
|
||||
foreach (var (title, rev, text) in MediaWikiJson.Contents(json))
|
||||
{
|
||||
if (WikiQuestParser.IsQuestPage(text)) fresh[title] = WikiQuestParser.Parse(title, text, rev, WikiBase);
|
||||
else if (contracts.Contains(title) && WikiQuestParser.IsContractPage(title, text)) freshContracts[title] = WikiQuestParser.ParseContract(title, text, rev, WikiBase);
|
||||
else notQuest.Add(title);
|
||||
}
|
||||
read += MediaWikiJson.TitlesPerRequest;
|
||||
}
|
||||
|
||||
QuestGuide g = Merge(old, revs, fresh, freshContracts);
|
||||
g.KillTasks = new List<string>(killTasks);
|
||||
g.Society = society;
|
||||
token.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(_path)!);
|
||||
File.WriteAllText(_path + ".tmp", g.ToJson());
|
||||
File.Move(_path + ".tmp", _path, overwrite: true);
|
||||
}
|
||||
catch (Exception ex) { _status = "read, but couldn't save: " + ex.Message; }
|
||||
_ready = g;
|
||||
return $"{g.Quests.Count} quests ({fresh.Count} read now), {g.KillTasks.Count} kill tasks, {g.Society.Count} society quests, {g.Contracts.Count} contracts";
|
||||
}
|
||||
|
||||
/// <summary>The pages to read: new or edited since the saved guide; every one when it came from an older reader.</summary>
|
||||
internal static List<string> PagesToRead(QuestGuide old, IReadOnlyDictionary<string, long> revs)
|
||||
{
|
||||
var known = new Dictionary<string, long>(StringComparer.Ordinal);
|
||||
foreach (GuideQuest q in old.Quests) known[q.Title] = q.Rev;
|
||||
foreach (GuideContract c in old.Contracts) known[c.Title] = c.Rev;
|
||||
bool whole = old.Parser < WikiQuestParser.Version;
|
||||
var changed = new List<string>();
|
||||
foreach (var kv in revs)
|
||||
if (whole || kv.Value == 0 || !known.TryGetValue(kv.Key, out long rev) || rev != kv.Value) changed.Add(kv.Key);
|
||||
return changed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The new guide: the pages listed now, each the fresh read when there is one, else the saved one (a page that
|
||||
/// is no longer listed goes). Pages that aren't quests or contracts aren't kept, so they are read again next
|
||||
/// time (cheap: they are few once the item categories are left out).
|
||||
/// </summary>
|
||||
internal static QuestGuide Merge(QuestGuide old, IReadOnlyDictionary<string, long> listed,
|
||||
IReadOnlyDictionary<string, GuideQuest> fresh, IReadOnlyDictionary<string, GuideContract> freshContracts)
|
||||
{
|
||||
var oldQuests = new Dictionary<string, GuideQuest>(StringComparer.Ordinal);
|
||||
foreach (GuideQuest q in old.Quests) oldQuests[q.Title] = q;
|
||||
var oldContracts = new Dictionary<string, GuideContract>(StringComparer.Ordinal);
|
||||
foreach (GuideContract c in old.Contracts) oldContracts[c.Title] = c;
|
||||
var g = new QuestGuide { Source = "fandom", UpdatedUtc = DateTime.UtcNow, Parser = WikiQuestParser.Version, KillTasks = old.KillTasks, Society = old.Society };
|
||||
foreach (string title in listed.Keys)
|
||||
{
|
||||
if (fresh.TryGetValue(title, out GuideQuest? f)) g.Quests.Add(f);
|
||||
else if (oldQuests.TryGetValue(title, out GuideQuest? o)) g.Quests.Add(o);
|
||||
if (freshContracts.TryGetValue(title, out GuideContract? fc)) g.Contracts.Add(fc);
|
||||
else if (oldContracts.TryGetValue(title, out GuideContract? oc)) g.Contracts.Add(oc);
|
||||
}
|
||||
g.Quests.Sort((a, b) => string.Compare(a.Title, b.Title, StringComparison.OrdinalIgnoreCase));
|
||||
g.Contracts.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
|
||||
return g;
|
||||
}
|
||||
|
||||
/// <summary>A category's pages and, followed breadth first, its sub-categories' (each page with the category it was in).</summary>
|
||||
private async Task WalkAsync(HttpClient http, string root, Action<string, string> page, Func<string, bool> skip, CancellationToken token)
|
||||
{
|
||||
var queue = new Queue<string>();
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { root.Replace('_', ' '), root };
|
||||
queue.Enqueue(root);
|
||||
while (queue.Count > 0 && seen.Count <= MaxCategories)
|
||||
{
|
||||
string cat = queue.Dequeue();
|
||||
await ListAsync(http, "categorymembers", new[] { ("list", "categorymembers"), ("cmtitle", cat), ("cmlimit", "max"), ("cmtype", "page|subcat") },
|
||||
p => page(p, cat), sub =>
|
||||
{
|
||||
if (!skip(sub) && seen.Add(sub)) queue.Enqueue(sub);
|
||||
}, token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task ListAsync(HttpClient http, string listName, (string, string)[] args, Action<string> page, Action<string> sub, CancellationToken token)
|
||||
{
|
||||
var cont = new List<(string, string)>();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
var all = new List<(string, string)> { ("action", "query") };
|
||||
all.AddRange(args);
|
||||
all.AddRange(cont);
|
||||
string json = await GetAsync(http, MediaWikiJson.Url(Api, all.ToArray()), token).ConfigureAwait(false);
|
||||
var (pages, subs, next) = MediaWikiJson.Members(json, listName);
|
||||
foreach (string p in pages) page(p);
|
||||
foreach (string s in subs) sub(s);
|
||||
if (next.Count == 0) return;
|
||||
cont = next;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<string> GetAsync(HttpClient http, string url, CancellationToken token)
|
||||
{
|
||||
await Task.Delay(RequestGapMs, token).ConfigureAwait(false);
|
||||
using HttpResponseMessage resp = await http.GetAsync(url + "&maxlag=5", token).ConfigureAwait(false);
|
||||
return await resp.Content.ReadAsStringAsync(token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
789
Plugins/RynthCore.Plugin.RynthOracle/Data/GearAnalysis.cs
Normal file
789
Plugins/RynthCore.Plugin.RynthOracle/Data/GearAnalysis.cs
Normal file
|
|
@ -0,0 +1,789 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>
|
||||
/// One item read from the game for the Gear tab: what it is, where it sits, its spells (from the
|
||||
/// appraisal) and the properties the ratings view shows. Filled by <see cref="GearScanner"/>.
|
||||
/// </summary>
|
||||
internal sealed class GearPiece
|
||||
{
|
||||
public uint Id;
|
||||
public string Name = "";
|
||||
/// <summary>ItemType flags (MeleeWeapon 0x1, Armor 0x2, Clothing 0x4, Jewelry 0x8, MissileWeapon 0x100, Caster 0x8000).</summary>
|
||||
public uint ItemType;
|
||||
/// <summary>EquipMask it is worn in; 0 in a pack.</summary>
|
||||
public uint Location;
|
||||
public bool Equipped;
|
||||
/// <summary>The appraisal reached the client (or it was asked for and answered with no spells).</summary>
|
||||
public bool Appraised;
|
||||
/// <summary>The item's own spells (cantrips, banes, procs): Decal's Spell list.</summary>
|
||||
public uint[] Inscribed = Array.Empty<uint>();
|
||||
/// <summary>Item enchantments active on it right now (appraisal ids with 0x80000000): Decal's ActiveSpell.</summary>
|
||||
public uint[] OnItem = Array.Empty<uint>();
|
||||
public int SetId;
|
||||
public int MaxLevel;
|
||||
public int XpStyle;
|
||||
public long BaseXp;
|
||||
public long TotalXp;
|
||||
/// <summary>PropertyInt.DamageType (45): the weapon's element (a caster's too).</summary>
|
||||
public int DamageType;
|
||||
/// <summary>The gear ratings it carries (PropertyInt 370-389), non-zero only.</summary>
|
||||
public (int Prop, int Value)[] Ratings = Array.Empty<(int, int)>();
|
||||
/// <summary>T11+ modifier lines from the appraisal's "Modifiers:" section (<see cref="T11Modifiers"/>); none elsewhere.</summary>
|
||||
public GearModifier[] Modifiers = Array.Empty<GearModifier>();
|
||||
/// <summary>The appraisal says "Zone Locked (Power Reduced)": the modifiers are dormant outside their zones.</summary>
|
||||
public bool ZoneLocked;
|
||||
/// <summary>The appraised int properties the Mag-style line reads (<see cref="MagFormat.IntProps"/>), present ones only.</summary>
|
||||
public Dictionary<int, int> Ints = new();
|
||||
/// <summary>The appraised float properties the Mag-style line reads (<see cref="MagFormat.FloatProps"/>), present ones only.</summary>
|
||||
public Dictionary<int, double> Floats = new();
|
||||
|
||||
public int Int(int prop) => Ints.TryGetValue(prop, out int v) ? v : 0;
|
||||
public double Float(int prop, double fallback) => Floats.TryGetValue(prop, out double v) ? v : fallback;
|
||||
|
||||
/// <summary>Gains levels from experience (ItemBaseXp, ItemMaxLevel and ItemXpStyle all set).</summary>
|
||||
public bool Leveled => BaseXp > 0 && MaxLevel > 0 && XpStyle > 0;
|
||||
|
||||
/// <summary>The item's level from its experience (0 for an item that doesn't level).</summary>
|
||||
public int Level => Leveled ? GearMath.ItemLevel(TotalXp, BaseXp, MaxLevel, XpStyle) : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One T11 modifier line ("Damage Rating +52"): its name, its number, the line as shown, and the
|
||||
/// gear rating it adds (0 for the lines that aren't ratings: All Attributes, the slot specials...).
|
||||
/// </summary>
|
||||
internal readonly record struct GearModifier(string Name, int Value, bool HasValue, string Text, int RatingProp);
|
||||
|
||||
/// <summary>
|
||||
/// T11+ gear's modifier lines (ACECustom "zone modifiers"). The appraisal shows them as a
|
||||
/// "Modifiers:" section of "- Name value [min-max]" lines: in the Use text on armour, clothing and
|
||||
/// jewelry, in the long description on weapons (AppraiseInfo.PromoteZoneModifierLines). A line
|
||||
/// that is a gear rating is taken OUT of the item's appraised ratings so it doesn't show twice,
|
||||
/// which is why the Ratings view adds them back from here. Servers without these lines show none.
|
||||
/// </summary>
|
||||
internal static class T11Modifiers
|
||||
{
|
||||
public const string SectionHeader = "Modifiers:";
|
||||
public const string ZoneLockedLine = "Zone Locked (Power Reduced)";
|
||||
|
||||
/// <summary>The lines that are gear ratings, and the PropertyInt each adds (ACECustom ZoneModifiers.Catalog).</summary>
|
||||
public static readonly (string Name, int Prop)[] RatingLines =
|
||||
{
|
||||
("Damage Rating", 370), ("Damage Resist", 371), ("Crit Chance", 372), ("Crit Resist", 373),
|
||||
("Crit Damage Rating", 374), ("Crit Damage Resist", 375), ("Healing Boost", 376),
|
||||
("Nether Resist", 377), ("Max Health", 379),
|
||||
};
|
||||
|
||||
/// <summary>The slot specials: the highest single one worn counts (MAX-wins), not the sum.</summary>
|
||||
public static readonly HashSet<string> MaxWins = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"Fortify Vitals", "Battle Mending", "Pct HP Damage", "Cheat Death", "Regeneration",
|
||||
};
|
||||
|
||||
/// <summary>Lines that change only their own piece (its armour), so they have no character total.</summary>
|
||||
public static readonly HashSet<string> PerPiece = new(StringComparer.OrdinalIgnoreCase) { "Armor Level", "Reinforced" };
|
||||
|
||||
/// <summary>Every line name the catalog has, longest first so "Max Health Pct" is not read as "Max Health".</summary>
|
||||
private static readonly string[] KnownNames = new[]
|
||||
{
|
||||
"Max Health", "Armor Level", "Damage Rating", "Crit Damage Rating", "Healing Boost", "Spell Duration",
|
||||
"Crit Chance", "Fortify Vitals", "Battle Mending", "Pct HP Damage", "Cheat Death", "Regeneration",
|
||||
"Max Health Pct", "Life on Hit", "Reinforced", "All Attributes", "Damage Resist", "Crit Damage Resist",
|
||||
"Crit Resist", "Nether Resist",
|
||||
}.OrderByDescending(n => n.Length).ToArray();
|
||||
|
||||
private static readonly System.Text.RegularExpressions.Regex Range =
|
||||
new(@"\s*\[\s*-?\d+\s*-\s*-?\d+\s*\]\s*$", System.Text.RegularExpressions.RegexOptions.CultureInvariant);
|
||||
private static readonly System.Text.RegularExpressions.Regex Number =
|
||||
new(@"[+-]?\d+", System.Text.RegularExpressions.RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>The modifier lines in any of the appraisal texts given (Use, long description), and the zone lock.</summary>
|
||||
public static (GearModifier[] Lines, bool ZoneLocked) Parse(params string?[] texts)
|
||||
{
|
||||
var lines = new List<GearModifier>();
|
||||
bool locked = false;
|
||||
foreach (string? text in texts)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text) || text.IndexOf(SectionHeader, StringComparison.Ordinal) < 0) continue;
|
||||
bool inSection = false;
|
||||
foreach (string raw in text.Split('\n'))
|
||||
{
|
||||
string line = raw.Trim();
|
||||
if (!inSection)
|
||||
{
|
||||
inSection = line == SectionHeader;
|
||||
continue;
|
||||
}
|
||||
if (!line.StartsWith("- ", StringComparison.Ordinal)) break; // the section ends at the first other line
|
||||
string body = line[2..].Trim();
|
||||
if (body.Equals(ZoneLockedLine, StringComparison.OrdinalIgnoreCase)) { locked = true; continue; }
|
||||
if (body.Length == 0) continue;
|
||||
GearModifier m = ParseLine(body);
|
||||
if (!lines.Contains(m)) lines.Add(m);
|
||||
}
|
||||
}
|
||||
return (lines.ToArray(), locked);
|
||||
}
|
||||
|
||||
/// <summary>"Damage Rating +52 [14-69]": the name, the first number after it, the line without the roll range.</summary>
|
||||
internal static GearModifier ParseLine(string body)
|
||||
{
|
||||
string shown = Range.Replace(body, "").Trim();
|
||||
string name = "";
|
||||
foreach (string known in KnownNames)
|
||||
if (shown.StartsWith(known, StringComparison.OrdinalIgnoreCase)
|
||||
&& (shown.Length == known.Length || shown[known.Length] == ' '))
|
||||
{
|
||||
name = known;
|
||||
break;
|
||||
}
|
||||
if (name.Length == 0)
|
||||
{
|
||||
// A line the catalog didn't have when this was written: its name runs up to the first number.
|
||||
System.Text.RegularExpressions.Match first = Number.Match(shown);
|
||||
name = (first.Success ? shown[..first.Index] : shown).Trim();
|
||||
}
|
||||
string rest = shown.Length > name.Length ? shown[name.Length..] : "";
|
||||
System.Text.RegularExpressions.Match num = Number.Match(rest);
|
||||
int value = num.Success && int.TryParse(num.Value, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out int v) ? v : 0;
|
||||
int prop = 0;
|
||||
foreach (var (n, p) in RatingLines)
|
||||
if (n.Equals(name, StringComparison.OrdinalIgnoreCase)) { prop = p; break; }
|
||||
return new GearModifier(name, value, num.Success, shown, prop);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A spell as the Gear tab knows it: from portal.dat, else SpellData.txt, else only its id.</summary>
|
||||
internal readonly record struct SpellMeta(uint Id, string Name, uint Category, uint Power, bool Enchantment, bool ItemTarget, bool Known)
|
||||
{
|
||||
public static SpellMeta Unknown(uint id) => new(id, "Spell " + id.ToString(CultureInfo.InvariantCulture), 0, 0, true, false, false);
|
||||
}
|
||||
|
||||
/// <summary>Where a spell on the character comes from.</summary>
|
||||
internal enum SpellLayer
|
||||
{
|
||||
/// <summary>One of the item's own spells.</summary>
|
||||
Inscribed,
|
||||
/// <summary>An item enchantment active on the item (a bane cast on it, Blood Drinker).</summary>
|
||||
OnItem,
|
||||
/// <summary>An equipment set's bonus for the pieces worn.</summary>
|
||||
SetBonus,
|
||||
/// <summary>An enchantment on the character (spells cast on you, and worn items' cantrips).</summary>
|
||||
Buff,
|
||||
}
|
||||
|
||||
/// <summary>One spell from one source.</summary>
|
||||
internal sealed class SpellSource
|
||||
{
|
||||
/// <summary>The item (0 for a set bonus or a buff on the character).</summary>
|
||||
public uint ItemId;
|
||||
public string ItemName = "";
|
||||
public SpellLayer Layer;
|
||||
public SpellMeta Spell;
|
||||
/// <summary>The equipment set of a set bonus, else 0.</summary>
|
||||
public int SetId;
|
||||
|
||||
public string LayerLabel => GearAnalysis.LayerLabel(Layer);
|
||||
}
|
||||
|
||||
/// <summary>What a family's spells do together.</summary>
|
||||
internal enum OverlapKind
|
||||
{
|
||||
/// <summary>Different spells of one enchantment family: only the highest power works, the rest are wasted.</summary>
|
||||
Overlap,
|
||||
/// <summary>The same spell from more than one item: one copy works, the others are wasted.</summary>
|
||||
Duplicate,
|
||||
/// <summary>Not enchantments (procs, heals): each works on its own.</summary>
|
||||
Stacks,
|
||||
/// <summary>One spell, one source.</summary>
|
||||
Ok,
|
||||
}
|
||||
|
||||
/// <summary>One family on one target (the character, or one item for item spells).</summary>
|
||||
internal sealed class OverlapRow
|
||||
{
|
||||
public OverlapKind Kind;
|
||||
public uint Category;
|
||||
public string Family = "";
|
||||
/// <summary>The item the spells are on (item spells), or "" for the character.</summary>
|
||||
public string Scope = "";
|
||||
public SpellSource Winner = null!;
|
||||
public List<SpellSource> Sources = new();
|
||||
/// <summary>"item/layer/power" per source, highest first; "(beat)" on the ones that lose.</summary>
|
||||
public string Summary = "";
|
||||
}
|
||||
|
||||
/// <summary>Ward and bane tiers, lowest to highest: a higher tier in the family wins.</summary>
|
||||
internal enum ProtTier { Missing = 0, Lower = 1, Minor = 2, Major = 3, Epic = 4, Legendary = 5 }
|
||||
|
||||
/// <summary>One element of the life wards or banes: the spell that wins and what it beats.</summary>
|
||||
internal sealed class ProtRow
|
||||
{
|
||||
public string Element = "";
|
||||
public uint Category;
|
||||
public ProtTier Tier;
|
||||
public string Winner = "";
|
||||
public string Source = "";
|
||||
public string Beaten = "";
|
||||
public bool Missing => Tier == ProtTier.Missing;
|
||||
}
|
||||
|
||||
/// <summary>Life wards (on the character) and banes (on the armour), seven elements each.</summary>
|
||||
internal sealed class ProtSummary
|
||||
{
|
||||
public List<ProtRow> Life = new();
|
||||
public List<ProtRow> Crit = new();
|
||||
public int LifeLegendary => Life.Count(r => r.Tier == ProtTier.Legendary);
|
||||
public int CritLegendary => Crit.Count(r => r.Tier == ProtTier.Legendary);
|
||||
public string LifeMissing => string.Join(", ", Life.Where(r => r.Missing).Select(r => r.Element));
|
||||
public string CritMissing => string.Join(", ", Crit.Where(r => r.Missing).Select(r => r.Element));
|
||||
}
|
||||
|
||||
/// <summary>An equipment set worn, its level and the bonus spells it gives.</summary>
|
||||
internal sealed class SetBonusGroup
|
||||
{
|
||||
public int SetId;
|
||||
public string Name = "";
|
||||
public int Pieces;
|
||||
public int Level;
|
||||
public uint Tier;
|
||||
public bool LeveledSet;
|
||||
public string Label = "";
|
||||
public string PieceNames = "";
|
||||
public List<SpellSource> Spells = new();
|
||||
}
|
||||
|
||||
/// <summary>The Overlap view's whole picture at one moment.</summary>
|
||||
internal sealed class GearReport
|
||||
{
|
||||
public DateTime CheckedLocal;
|
||||
public int Equipped;
|
||||
public int NotAppraised;
|
||||
public int SpellSources;
|
||||
public int UnknownSpells;
|
||||
public List<GearPiece> Pieces = new();
|
||||
public Dictionary<uint, List<SpellSource>> PieceSpells = new();
|
||||
public List<SetBonusGroup> Sets = new();
|
||||
public List<SpellSource> Buffs = new();
|
||||
public List<SpellSource> Paragon = new();
|
||||
public List<OverlapRow> Rows = new();
|
||||
public ProtSummary Protection = new();
|
||||
public int Count(OverlapKind kind) => Rows.Count(r => r.Kind == kind);
|
||||
}
|
||||
|
||||
/// <summary>One item of the Ratings view (sets, item levels, gear ratings; UB-ILT's Paragon gear, for every server).</summary>
|
||||
internal sealed class RatingRow
|
||||
{
|
||||
public GearPiece Piece = null!;
|
||||
public string Category = "";
|
||||
public string TypeLabel = "";
|
||||
public string SetName = "-";
|
||||
public bool Paragon;
|
||||
public string Stats = "";
|
||||
/// <summary>The ratings with the T11 modifier lines' added (the appraisal leaves those out).</summary>
|
||||
public (int Prop, int Value)[] Effective = Array.Empty<(int, int)>();
|
||||
/// <summary>The T11 modifier lines, as the appraisal shows them ("Damage Rating +52, All Attributes +40").</summary>
|
||||
public string T11 = "";
|
||||
/// <summary>Has a set, an item level, gear ratings or T11 modifiers (the column view lists only these).</summary>
|
||||
public bool Rated;
|
||||
/// <summary>The item as one Mag-Tools ItemInfo line (<see cref="MagFormat"/>).</summary>
|
||||
public string Mag = "";
|
||||
}
|
||||
|
||||
internal sealed class RatingsReport
|
||||
{
|
||||
public DateTime CheckedLocal;
|
||||
public bool IncludePack;
|
||||
public List<RatingRow> Rows = new();
|
||||
/// <summary>Every rating summed over the worn items (T11 modifier ratings included).</summary>
|
||||
public List<(int Prop, int Value)> WornTotals = new();
|
||||
/// <summary>The worn T11 modifiers that aren't ratings: summed, the slot specials the highest one.</summary>
|
||||
public List<(string Name, string Value)> T11Totals = new();
|
||||
/// <summary>The rows with a set, a level, ratings or modifiers (<see cref="RatingRow.Rated"/>).</summary>
|
||||
public IEnumerable<RatingRow> RatedRows => Rows.Where(r => r.Rated);
|
||||
public int EquippedRows => Rows.Count(r => r.Rated && r.Piece.Equipped);
|
||||
public int T11Rows => Rows.Count(r => r.T11.Length > 0);
|
||||
}
|
||||
|
||||
/// <summary>Item experience to level (ACE ExperienceSystem.ItemTotalXPToLevel).</summary>
|
||||
internal static class GearMath
|
||||
{
|
||||
public static int ItemLevel(long totalXp, long baseXp, int maxLevel, int xpStyle)
|
||||
{
|
||||
if (baseXp <= 0 || maxLevel <= 0) return 0;
|
||||
ulong gained = (ulong)Math.Max(0, totalXp), b = (ulong)baseXp;
|
||||
int level = 0;
|
||||
switch (xpStyle)
|
||||
{
|
||||
case 1: // Fixed
|
||||
level = (int)(gained / b);
|
||||
break;
|
||||
case 2: // ScalesWithLevel: each level costs twice the last
|
||||
{
|
||||
ulong cost = b, left = gained;
|
||||
while (left >= cost && level < maxLevel)
|
||||
{
|
||||
level++;
|
||||
left -= cost;
|
||||
if (cost > ulong.MaxValue / 2) break;
|
||||
cost *= 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: // FixedPlusBase
|
||||
if (gained >= b && gained < b * 3UL) level = 1;
|
||||
else if (gained >= b) level = (int)((gained - b) / b);
|
||||
break;
|
||||
}
|
||||
return Math.Min(level, maxLevel);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Gear tab's analysis, all of it pure (the tests build pieces by hand). Ported from UB-ILT's
|
||||
/// EquippedSpellOverlapAnalyzer, EquippedProtectionCoverage, EquippedGearSetBonus and
|
||||
/// ParagonGearAnalyzer, with the spell facts taken from the client's own spell table instead of
|
||||
/// a catalog exported from one server, so it reads any server's gear.
|
||||
/// </summary>
|
||||
internal static class GearAnalysis
|
||||
{
|
||||
public const uint ItemMelee = 0x1, ItemArmor = 0x2, ItemClothing = 0x4, ItemJewelry = 0x8,
|
||||
ItemMissile = 0x100, ItemContainer = 0x200, ItemCaster = 0x8000;
|
||||
public const uint ItemWeapons = ItemMelee | ItemMissile | ItemCaster;
|
||||
public const uint ItemWearables = ItemWeapons | ItemArmor | ItemClothing | ItemJewelry;
|
||||
|
||||
/// <summary>ACE's paragon weapon sets (ACECustom EquipmentSet 138-140); harmless where they don't exist.</summary>
|
||||
public const int ParagonSetFirst = 138, ParagonSetLast = 140;
|
||||
/// <summary>Luminous Amber puts ItemBaseXp at 2,000,000,000 on a paragon weapon.</summary>
|
||||
public const long ParagonWeaponBaseXp = 2_000_000_000L;
|
||||
|
||||
/// <summary>The life ward families, in UB-ILT's order (ACE SpellCategory).</summary>
|
||||
public static readonly (uint Category, string Element)[] LifeWards =
|
||||
{
|
||||
(403, "Slashing"), (405, "Piercing"), (401, "Bludgeon"), (287, "Fire"), (289, "Cold"), (285, "Acid"), (291, "Storm"),
|
||||
};
|
||||
|
||||
/// <summary>The bane families (ExtraXResistanceRaising: armour against an element).</summary>
|
||||
public static readonly (uint Category, string Element)[] CritBanes =
|
||||
{
|
||||
(395, "Slashing"), (393, "Piercing"), (383, "Bludgeon"), (385, "Fire"), (387, "Cold"), (381, "Acid"), (397, "Storm"),
|
||||
};
|
||||
|
||||
/// <summary>The gear ratings (ACE PropertyInt), short and long names.</summary>
|
||||
public static readonly (int Prop, string Short, string Long)[] RatingProps =
|
||||
{
|
||||
(370, "D", "Damage"), (371, "DR", "Damage resist"), (372, "C", "Crit"), (373, "CR", "Crit resist"),
|
||||
(374, "CD", "Crit damage"), (375, "CDR", "Crit damage resist"), (376, "HB", "Healing boost"),
|
||||
(377, "NR", "Nether resist"), (378, "LR", "Life resist"), (379, "V", "Max health"),
|
||||
(383, "PKD", "PK damage"), (384, "PKDR", "PK damage resist"), (388, "OP", "Overpower"), (389, "OPR", "Overpower resist"),
|
||||
};
|
||||
|
||||
public static string LayerLabel(SpellLayer layer) => layer switch
|
||||
{
|
||||
SpellLayer.Inscribed => "Inscribed",
|
||||
SpellLayer.OnItem => "Active",
|
||||
SpellLayer.SetBonus => "Set bonus",
|
||||
_ => "Active buff",
|
||||
};
|
||||
|
||||
private static string LayerShort(SpellLayer layer) => layer switch
|
||||
{
|
||||
SpellLayer.Inscribed => "Ins",
|
||||
SpellLayer.OnItem => "Act",
|
||||
SpellLayer.SetBonus => "Set",
|
||||
_ => "Buff",
|
||||
};
|
||||
|
||||
// ── Overlap ──────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Everything on the worn gear and the character at once: each piece's spells, the set bonuses,
|
||||
/// the character's enchantments, the overlap rows and the ward / bane coverage.
|
||||
/// </summary>
|
||||
public static GearReport Analyze(IReadOnlyList<GearPiece> equipped, IReadOnlyList<uint> buffSpellIds,
|
||||
Func<uint, SpellMeta> lookup, Func<int, SpellSetDef?> setOf,
|
||||
string characterName, DateTime nowLocal)
|
||||
{
|
||||
var report = new GearReport { CheckedLocal = nowLocal, Equipped = equipped.Count };
|
||||
var all = new List<SpellSource>();
|
||||
var unknown = new HashSet<uint>();
|
||||
SpellMeta Look(uint id)
|
||||
{
|
||||
SpellMeta m = lookup(id);
|
||||
if (!m.Known) unknown.Add(id);
|
||||
return m;
|
||||
}
|
||||
|
||||
foreach (GearPiece p in equipped.OrderBy(p => p.Name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
report.Pieces.Add(p);
|
||||
if (!p.Appraised) report.NotAppraised++;
|
||||
var list = new List<SpellSource>();
|
||||
foreach (uint id in p.Inscribed.Distinct())
|
||||
list.Add(new SpellSource { ItemId = p.Id, ItemName = p.Name, Layer = SpellLayer.Inscribed, Spell = Look(id) });
|
||||
foreach (uint id in p.OnItem.Distinct())
|
||||
list.Add(new SpellSource { ItemId = p.Id, ItemName = p.Name, Layer = SpellLayer.OnItem, Spell = Look(id) });
|
||||
report.PieceSpells[p.Id] = list;
|
||||
all.AddRange(list);
|
||||
}
|
||||
|
||||
report.Sets = SetBonuses(equipped, setOf, Look);
|
||||
foreach (SetBonusGroup g in report.Sets) all.AddRange(g.Spells);
|
||||
|
||||
string who = characterName.Length > 0 ? characterName : "(character)";
|
||||
foreach (uint id in buffSpellIds.Distinct())
|
||||
report.Buffs.Add(new SpellSource { ItemName = who, Layer = SpellLayer.Buff, Spell = Look(id) });
|
||||
report.Buffs.Sort((a, b) => string.Compare(a.Spell.Name, b.Spell.Name, StringComparison.OrdinalIgnoreCase));
|
||||
all.AddRange(report.Buffs);
|
||||
|
||||
report.SpellSources = all.Count;
|
||||
report.UnknownSpells = unknown.Count;
|
||||
report.Rows = BuildRows(all);
|
||||
report.Protection = Protection(all);
|
||||
report.Paragon = all.Where(IsParagonSource)
|
||||
.OrderByDescending(s => s.Spell.Power).ThenBy(s => s.Spell.Name, StringComparer.OrdinalIgnoreCase).ToList();
|
||||
return report;
|
||||
}
|
||||
|
||||
/// <summary>Spells cast on an item are per item (each piece is its own target); the rest land on the character.</summary>
|
||||
private static bool ItemScoped(SpellSource s) =>
|
||||
s.Spell.ItemTarget && s.ItemId != 0 && (s.Layer == SpellLayer.Inscribed || s.Layer == SpellLayer.OnItem);
|
||||
|
||||
/// <summary>A family key that keeps spells with no known family apart (each its own row).</summary>
|
||||
private static long FamilyKey(SpellMeta m) => m.Category != 0 ? m.Category : (1L << 32) | m.Id;
|
||||
|
||||
internal static List<OverlapRow> BuildRows(List<SpellSource> sources)
|
||||
{
|
||||
var rows = new List<OverlapRow>();
|
||||
foreach (var g in sources.GroupBy(s => (Family: FamilyKey(s.Spell), Item: ItemScoped(s) ? s.ItemId : 0u)))
|
||||
rows.Add(MakeRow(g.ToList(), g.Key.Item != 0));
|
||||
return rows
|
||||
.OrderBy(r => (int)r.Kind)
|
||||
.ThenBy(r => r.Family, StringComparer.OrdinalIgnoreCase)
|
||||
.ThenBy(r => r.Scope, StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static OverlapRow MakeRow(List<SpellSource> group, bool itemScope)
|
||||
{
|
||||
var ordered = group.OrderByDescending(s => s.Spell.Power).ThenBy(s => s.Spell.Id)
|
||||
.ThenBy(s => s.ItemName, StringComparer.OrdinalIgnoreCase).ToList();
|
||||
SpellSource winner = ordered[0];
|
||||
int distinctSpells = group.Select(s => s.Spell.Id).Distinct().Count();
|
||||
// The same spell on two pieces (a worn cantrip also shows as the character's buff: that one
|
||||
// doesn't count, it is the same copy).
|
||||
int itemsWithWinner = group.Where(s => s.Spell.Id == winner.Spell.Id && s.Layer != SpellLayer.Buff)
|
||||
.Select(s => s.Layer == SpellLayer.SetBonus ? 0x8000_0000u | (uint)s.SetId : s.ItemId)
|
||||
.Distinct().Count();
|
||||
bool exclusive = group.All(s => s.Spell.Enchantment);
|
||||
OverlapKind kind = distinctSpells > 1
|
||||
? (exclusive ? OverlapKind.Overlap : OverlapKind.Stacks)
|
||||
: (itemsWithWinner > 1 && exclusive ? OverlapKind.Duplicate : OverlapKind.Ok);
|
||||
|
||||
return new OverlapRow
|
||||
{
|
||||
Kind = kind,
|
||||
Category = winner.Spell.Category,
|
||||
Family = GearNames.FamilyLabel(winner.Spell.Category),
|
||||
Scope = itemScope ? winner.ItemName : "",
|
||||
Winner = winner,
|
||||
Sources = ordered,
|
||||
Summary = Summary(ordered, winner, kind),
|
||||
};
|
||||
}
|
||||
|
||||
private static string Summary(List<SpellSource> ordered, SpellSource winner, OverlapKind kind)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
bool winnerCopySeen = false;
|
||||
foreach (SpellSource s in ordered)
|
||||
{
|
||||
if (sb.Length > 0) sb.Append("; ");
|
||||
sb.Append(Cut(s.ItemName, 18)).Append('/').Append(LayerShort(s.Layer)).Append("/P").Append(s.Spell.Power.ToString(CultureInfo.InvariantCulture));
|
||||
if (kind == OverlapKind.Overlap && s.Spell.Id != winner.Spell.Id) sb.Append(" (beat)");
|
||||
else if (kind == OverlapKind.Duplicate && s.Layer != SpellLayer.Buff)
|
||||
{
|
||||
if (winnerCopySeen) sb.Append(" (extra)");
|
||||
winnerCopySeen = true;
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
// ── Life wards and banes ─────────────────────────────────────────────────
|
||||
|
||||
internal static ProtSummary Protection(IReadOnlyList<SpellSource> sources) => new()
|
||||
{
|
||||
Life = LifeWards.Select(s => ProtSlot(s.Element, s.Category, sources, life: true)).ToList(),
|
||||
Crit = CritBanes.Select(s => ProtSlot(s.Element, s.Category, sources, life: false)).ToList(),
|
||||
};
|
||||
|
||||
private static ProtRow ProtSlot(string element, uint category, IReadOnlyList<SpellSource> sources, bool life)
|
||||
{
|
||||
var mine = sources.Where(s => InSlot(s, element, category, life)).ToList();
|
||||
if (mine.Count == 0) return new ProtRow { Element = element, Category = category, Tier = ProtTier.Missing, Winner = "MISSING" };
|
||||
|
||||
var distinct = mine.GroupBy(s => s.Spell.Id).Select(g => g.First())
|
||||
.OrderByDescending(s => (int)TierOf(s.Spell.Name)).ThenByDescending(s => s.Spell.Power).ThenByDescending(s => s.Spell.Id)
|
||||
.ToList();
|
||||
SpellSource winner = distinct[0];
|
||||
ProtTier tier = TierOf(winner.Spell.Name);
|
||||
var beaten = distinct.Skip(1).Select(s => Cut(s.Spell.Name, 20)).ToList();
|
||||
return new ProtRow
|
||||
{
|
||||
Element = element,
|
||||
Category = category,
|
||||
Tier = tier,
|
||||
Winner = winner.Spell.Name,
|
||||
Source = winner.Layer == SpellLayer.SetBonus ? winner.ItemName + " [set]" : winner.ItemName,
|
||||
Beaten = beaten.Count == 0 ? "" : string.Join(", ", beaten.Take(3)) + (beaten.Count > 3 ? "..." : ""),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A source fills a ward slot (on the character) or a bane slot (on an item) by its family; a spell
|
||||
/// the tables don't know is placed by its name ("... Fire Ward", "... Flame Bane").
|
||||
/// </summary>
|
||||
private static bool InSlot(SpellSource s, string element, uint category, bool life)
|
||||
{
|
||||
if (s.Spell.Known && s.Spell.Category != 0)
|
||||
return s.Spell.Category == category && s.Spell.ItemTarget != life;
|
||||
string n = s.Spell.Name;
|
||||
if (n.IndexOf(life ? " Ward" : " Bane", StringComparison.OrdinalIgnoreCase) < 0) return false;
|
||||
foreach (string word in ElementWords(element))
|
||||
if (n.IndexOf(word, StringComparison.OrdinalIgnoreCase) >= 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static string[] ElementWords(string element) => element switch
|
||||
{
|
||||
"Slashing" => new[] { "Slashing" },
|
||||
"Piercing" => new[] { "Piercing" },
|
||||
"Bludgeon" => new[] { "Bludgeon" },
|
||||
"Fire" => new[] { "Fire", "Flame" },
|
||||
"Cold" => new[] { "Cold", "Frost" },
|
||||
"Acid" => new[] { "Acid" },
|
||||
"Storm" => new[] { "Storm", "Lightning", "Electric" },
|
||||
_ => Array.Empty<string>(),
|
||||
};
|
||||
|
||||
/// <summary>A ward or bane's tier from its name ("Legendary ...", "Epic ...").</summary>
|
||||
public static ProtTier TierOf(string name)
|
||||
{
|
||||
if (name.StartsWith("Legendary", StringComparison.OrdinalIgnoreCase)) return ProtTier.Legendary;
|
||||
if (name.StartsWith("Epic", StringComparison.OrdinalIgnoreCase)) return ProtTier.Epic;
|
||||
if (name.StartsWith("Major", StringComparison.OrdinalIgnoreCase)) return ProtTier.Major;
|
||||
if (name.StartsWith("Minor", StringComparison.OrdinalIgnoreCase)) return ProtTier.Minor;
|
||||
return ProtTier.Lower;
|
||||
}
|
||||
|
||||
public static string TierLabel(ProtTier tier) => tier switch
|
||||
{
|
||||
ProtTier.Legendary => "Legendary",
|
||||
ProtTier.Epic => "Epic",
|
||||
ProtTier.Major => "Major",
|
||||
ProtTier.Minor => "Minor",
|
||||
ProtTier.Lower => "Other",
|
||||
_ => "MISSING",
|
||||
};
|
||||
|
||||
// ── Equipment sets ───────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// The worn pieces grouped by set, as ACE's GetSpellSet: a leveled set's level is the sum of its
|
||||
/// pieces' item levels, any other set's the number of pieces worn; the set's spells for that level.
|
||||
/// </summary>
|
||||
internal static List<SetBonusGroup> SetBonuses(IReadOnlyList<GearPiece> equipped, Func<int, SpellSetDef?> setOf, Func<uint, SpellMeta> look)
|
||||
{
|
||||
var groups = new List<SetBonusGroup>();
|
||||
foreach (var bySet in equipped.Where(p => p.SetId > 0).GroupBy(p => p.SetId))
|
||||
{
|
||||
SpellSetDef? def = setOf(bySet.Key);
|
||||
if (def == null) continue;
|
||||
var pieces = bySet.ToList();
|
||||
bool leveled = pieces[0].XpStyle > 0;
|
||||
int level = leveled ? pieces.Sum(p => p.Level) : pieces.Count;
|
||||
uint tier = def.TierAt((uint)Math.Max(0, level));
|
||||
uint[] spells = def.SpellsAt((uint)Math.Max(0, level));
|
||||
if (spells.Length == 0) continue;
|
||||
string name = GearNames.SetName(bySet.Key);
|
||||
string label = leveled ? $"{name} ({pieces.Count} pc, level {level})" : $"{name} ({pieces.Count} pc)";
|
||||
var g = new SetBonusGroup
|
||||
{
|
||||
SetId = bySet.Key,
|
||||
Name = name,
|
||||
Pieces = pieces.Count,
|
||||
Level = level,
|
||||
Tier = tier,
|
||||
LeveledSet = leveled,
|
||||
Label = label,
|
||||
PieceNames = string.Join(", ", pieces.Select(p => p.Name).OrderBy(n => n, StringComparer.OrdinalIgnoreCase)),
|
||||
};
|
||||
foreach (uint id in spells.Where(id => id != 0).Distinct())
|
||||
g.Spells.Add(new SpellSource { ItemName = label, Layer = SpellLayer.SetBonus, Spell = look(id), SetId = bySet.Key });
|
||||
groups.Add(g);
|
||||
}
|
||||
groups.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
|
||||
return groups;
|
||||
}
|
||||
|
||||
public static bool IsParagonSet(int setId) => setId >= ParagonSetFirst && setId <= ParagonSetLast;
|
||||
|
||||
/// <summary>A paragon mastery spell (family "Paragon...") or a paragon set's bonus.</summary>
|
||||
private static bool IsParagonSource(SpellSource s) =>
|
||||
GearNames.FamilyRaw(s.Spell.Category).StartsWith("Paragon", StringComparison.Ordinal)
|
||||
|| (s.Layer == SpellLayer.SetBonus && IsParagonSet(s.SetId));
|
||||
|
||||
// ── Ratings (sets, levels, gear ratings) ─────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Every wearable, worn first, each with its Mag-style line; the ones with a set, an item level,
|
||||
/// gear ratings or T11 modifiers marked <see cref="RatingRow.Rated"/>; and the ratings summed over
|
||||
/// what is worn. UB-ILT's Paragon gear view, without the server's paragon gate: paragon items are
|
||||
/// marked where they exist. <paramref name="lookup"/> names the spells in the Mag-style lines.
|
||||
/// </summary>
|
||||
public static RatingsReport Ratings(IReadOnlyList<GearPiece> items, bool includePack, DateTime nowLocal, Func<uint, SpellMeta>? lookup = null)
|
||||
{
|
||||
var report = new RatingsReport { CheckedLocal = nowLocal, IncludePack = includePack };
|
||||
foreach (GearPiece p in items)
|
||||
{
|
||||
if (!includePack && !p.Equipped) continue;
|
||||
bool rated = p.SetId > 0 || p.Ratings.Length > 0 || p.Modifiers.Length > 0 || (p.MaxLevel > 0 && (p.ItemType & ItemWearables) != 0);
|
||||
if (!rated && (p.ItemType & ItemWearables) == 0) continue;
|
||||
string category = CategoryOf(p.ItemType);
|
||||
string element = (p.ItemType & ItemWeapons) != 0 ? ElementShort(p.DamageType) : "";
|
||||
var effective = EffectiveRatings(p);
|
||||
report.Rows.Add(new RatingRow
|
||||
{
|
||||
Piece = p,
|
||||
Rated = rated,
|
||||
Mag = MagFormat.Describe(p, lookup, effective),
|
||||
Category = category,
|
||||
TypeLabel = element.Length > 0 ? category + " " + element : category,
|
||||
SetName = GearNames.SetName(p.SetId),
|
||||
Paragon = IsParagonSet(p.SetId) || ((p.ItemType & ItemWeapons) != 0 && p.MaxLevel > 0 && p.BaseXp >= ParagonWeaponBaseXp),
|
||||
Effective = effective,
|
||||
Stats = string.Join(", ", effective.Select(r => RatingLong(r.Prop) + " " + r.Value.ToString(CultureInfo.InvariantCulture))),
|
||||
T11 = string.Join(", ", p.Modifiers.Select(m => m.Text)),
|
||||
});
|
||||
}
|
||||
report.Rows = report.Rows
|
||||
.OrderByDescending(r => r.Piece.Equipped)
|
||||
.ThenBy(r => r.Category, StringComparer.OrdinalIgnoreCase)
|
||||
.ThenBy(r => r.Piece.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
var totals = new Dictionary<int, int>();
|
||||
foreach (GearPiece p in items.Where(p => p.Equipped))
|
||||
foreach (var (prop, value) in EffectiveRatings(p))
|
||||
totals[prop] = totals.TryGetValue(prop, out int t) ? t + value : value;
|
||||
foreach (var (prop, _, _) in RatingProps)
|
||||
if (totals.TryGetValue(prop, out int v) && v != 0) report.WornTotals.Add((prop, v));
|
||||
report.T11Totals = T11Totals(items.Where(p => p.Equipped));
|
||||
return report;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A piece's ratings with its T11 rating lines folded in. A line's rating is only added where
|
||||
/// the appraisal didn't send that rating: on T11 gear the server removes it (it shows under
|
||||
/// Modifiers instead); on older pieces it sends both, and the sent value already holds it.
|
||||
/// </summary>
|
||||
public static (int Prop, int Value)[] EffectiveRatings(GearPiece p)
|
||||
{
|
||||
if (p.Modifiers.Length == 0) return p.Ratings;
|
||||
var list = p.Ratings.ToList();
|
||||
foreach (GearModifier m in p.Modifiers)
|
||||
{
|
||||
if (m.RatingProp == 0 || !m.HasValue || m.Value == 0) continue;
|
||||
int at = list.FindIndex(r => r.Prop == m.RatingProp);
|
||||
if (at < 0) list.Add((m.RatingProp, m.Value));
|
||||
else if (p.Ratings.All(r => r.Prop != m.RatingProp)) list[at] = (m.RatingProp, list[at].Value + m.Value); // two lines of one rating
|
||||
}
|
||||
return list.OrderBy(r => Array.FindIndex(RatingProps, x => x.Prop == r.Prop)).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The worn T11 modifiers that aren't ratings, by name: summed across pieces (All Attributes,
|
||||
/// Max Health Pct, Life on Hit), the slot specials the highest single one, and a line with no
|
||||
/// number (Battle Mending, Cheat Death) as "yes".
|
||||
/// </summary>
|
||||
internal static List<(string Name, string Value)> T11Totals(IEnumerable<GearPiece> worn)
|
||||
{
|
||||
var sums = new Dictionary<string, (int Value, bool HasValue, string Suffix)>(StringComparer.OrdinalIgnoreCase);
|
||||
var order = new List<string>();
|
||||
foreach (GearPiece p in worn)
|
||||
foreach (GearModifier m in p.Modifiers)
|
||||
{
|
||||
if (m.RatingProp != 0 || T11Modifiers.PerPiece.Contains(m.Name)) continue;
|
||||
string suffix = m.Text.Contains('%') ? "%" : "";
|
||||
if (!sums.TryGetValue(m.Name, out var cur))
|
||||
{
|
||||
sums[m.Name] = (m.Value, m.HasValue, suffix);
|
||||
order.Add(m.Name);
|
||||
continue;
|
||||
}
|
||||
int next = T11Modifiers.MaxWins.Contains(m.Name) ? Math.Max(cur.Value, m.Value) : cur.Value + m.Value;
|
||||
sums[m.Name] = (next, cur.HasValue || m.HasValue, cur.Suffix);
|
||||
}
|
||||
var list = new List<(string, string)>();
|
||||
foreach (string name in order)
|
||||
{
|
||||
var (value, has, suffix) = sums[name];
|
||||
string best = T11Modifiers.MaxWins.Contains(name) ? " (best)" : "";
|
||||
string shown = !has ? "yes"
|
||||
// Its number is tenths of a percent of the target's maximum health.
|
||||
: name.Equals("Pct HP Damage", StringComparison.OrdinalIgnoreCase)
|
||||
? (value / 10.0).ToString("0.#", CultureInfo.InvariantCulture) + "% of max HP per hit" + best
|
||||
: (value >= 0 ? "+" : "") + value.ToString(CultureInfo.InvariantCulture) + suffix + best;
|
||||
list.Add((name, shown));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static string RatingShort(int prop)
|
||||
{
|
||||
foreach (var r in RatingProps) if (r.Prop == prop) return r.Short;
|
||||
return prop.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public static string RatingLong(int prop)
|
||||
{
|
||||
foreach (var r in RatingProps) if (r.Prop == prop) return r.Long;
|
||||
return "Rating " + prop.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public static string CategoryOf(uint itemType)
|
||||
{
|
||||
if ((itemType & ItemWeapons) != 0) return "Weapon";
|
||||
if ((itemType & ItemArmor) != 0) return "Armor";
|
||||
if ((itemType & ItemJewelry) != 0) return "Jewelry";
|
||||
if ((itemType & ItemClothing) != 0) return "Clothing";
|
||||
return "Other";
|
||||
}
|
||||
|
||||
/// <summary>A weapon's element, short (PropertyInt.DamageType flags; Nether wins where it is set).</summary>
|
||||
public static string ElementShort(int damageType)
|
||||
{
|
||||
if ((damageType & 0x400) != 0) return "Neth";
|
||||
return damageType switch
|
||||
{
|
||||
0 => "",
|
||||
0x1 => "Slash",
|
||||
0x2 => "Pierce",
|
||||
0x3 => "Sl+Pi",
|
||||
0x4 => "Bludg",
|
||||
0x8 => "Cold",
|
||||
0x10 => "Fire",
|
||||
0x20 => "Acid",
|
||||
0x40 => "Storm",
|
||||
_ => "0x" + damageType.ToString("X", CultureInfo.InvariantCulture),
|
||||
};
|
||||
}
|
||||
|
||||
private static string Cut(string s, int max) => s.Length <= max ? s : s.Substring(0, Math.Max(0, max - 3)) + "...";
|
||||
}
|
||||
111
Plugins/RynthCore.Plugin.RynthOracle/Data/GearNames.cs
Normal file
111
Plugins/RynthCore.Plugin.RynthOracle/Data/GearNames.cs
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Names for the numbers the Gear tab reads: spell families (portal.dat SpellBase.Category, ACE
|
||||
/// SpellCategory) and equipment sets (PropertyInt.EquipmentSetId 265, ACE EquipmentSet), from
|
||||
/// Resources\spellcategories.csv and equipmentsets.csv (Tools\RynthOracle.QuestPackGen\Make-GearNames.ps1).
|
||||
/// A number missing from a table still shows ("Family 812", "Set 301").
|
||||
/// </summary>
|
||||
internal static class GearNames
|
||||
{
|
||||
private static Dictionary<int, string>? _families, _sets, _materials, _masteries, _skills;
|
||||
|
||||
/// <summary>A material ("Black Garnet") by PropertyInt.MaterialType (131); "" when unknown or none.</summary>
|
||||
public static string Material(int id) => Named(ref _materials, "materials.csv", id);
|
||||
|
||||
/// <summary>A weapon mastery ("Two Handed") by PropertyInt.WeaponType (353); "" when unknown or none.</summary>
|
||||
public static string Mastery(int id) => Named(ref _masteries, "masteries.csv", id);
|
||||
|
||||
/// <summary>A skill ("Melee Defense") by its number; "" when unknown.</summary>
|
||||
public static string Skill(int id) => Named(ref _skills, "skills.csv", id);
|
||||
|
||||
private static string Named(ref Dictionary<int, string>? table, string file, int id)
|
||||
{
|
||||
if (id <= 0) return "";
|
||||
table ??= Load(file);
|
||||
return table.TryGetValue(id, out string? n) ? Pretty(n) : "";
|
||||
}
|
||||
|
||||
/// <summary>ACE's name for a spell family ("SlashWardProtection"), or "".</summary>
|
||||
public static string FamilyRaw(uint category)
|
||||
{
|
||||
_families ??= Load("spellcategories.csv");
|
||||
return _families.TryGetValue((int)category, out string? n) ? n : "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A family for a narrow column: "Slash Ward", "Extra Fire Resistance" as "Fire Resistance",
|
||||
/// "Strength" for StrengthRaising (UB-ILT's FormatSpellFamilyShort, with the spaces put in).
|
||||
/// </summary>
|
||||
public static string FamilyLabel(uint category)
|
||||
{
|
||||
if (category == 0) return "?"; // no family known (ACE's 0 is "Undef")
|
||||
string fam = FamilyRaw(category);
|
||||
if (fam.Length == 0) return "Family " + category.ToString(CultureInfo.InvariantCulture);
|
||||
if (fam.EndsWith("Protection", StringComparison.Ordinal) && fam.Length > "Protection".Length)
|
||||
fam = fam[..^"Protection".Length];
|
||||
else if (fam.StartsWith("Extra", StringComparison.Ordinal) && fam.EndsWith("ResistanceRaising", StringComparison.Ordinal)
|
||||
&& fam.Length > "Extra".Length + "ResistanceRaising".Length)
|
||||
fam = fam["Extra".Length..^"Raising".Length];
|
||||
else if (fam.EndsWith("Raising", StringComparison.Ordinal) && fam.Length > "Raising".Length)
|
||||
fam = fam[..^"Raising".Length];
|
||||
return Pretty(fam);
|
||||
}
|
||||
|
||||
/// <summary>An equipment set's name ("Shimmering Shadows Set", "Paragon Melee"); "-" for none.</summary>
|
||||
public static string SetName(int setId)
|
||||
{
|
||||
if (setId <= 0) return "-";
|
||||
_sets ??= Load("equipmentsets.csv");
|
||||
return _sets.TryGetValue(setId, out string? n) ? Pretty(n) : "Set " + setId.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>CamelCase to words: "ShimmeringShadowsSet" as "Shimmering Shadows Set", "PKDamage" as "PK Damage".</summary>
|
||||
public static string Pretty(string camel)
|
||||
{
|
||||
if (string.IsNullOrEmpty(camel)) return "";
|
||||
var sb = new StringBuilder(camel.Length + 8);
|
||||
for (int i = 0; i < camel.Length; i++)
|
||||
{
|
||||
char c = camel[i];
|
||||
if (i > 0 && c != '_')
|
||||
{
|
||||
char p = camel[i - 1];
|
||||
bool next = i + 1 < camel.Length && char.IsLower(camel[i + 1]);
|
||||
// A capital after a lower-case letter or a digit, or the last capital of a run before lower case.
|
||||
if (char.IsUpper(c) && (char.IsLower(p) || char.IsDigit(p) || (char.IsUpper(p) && next))) sb.Append(' ');
|
||||
else if (char.IsDigit(c) && char.IsLetter(p)) sb.Append(' ');
|
||||
}
|
||||
sb.Append(c == '_' ? ' ' : c);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static Dictionary<int, string> Load(string file)
|
||||
{
|
||||
var map = new Dictionary<int, string>();
|
||||
try
|
||||
{
|
||||
using StreamReader r = Csv.OpenEmbedded(file);
|
||||
r.ReadLine(); // header
|
||||
while (r.ReadLine() is string line)
|
||||
{
|
||||
int comma = line.IndexOf(',');
|
||||
if (comma <= 0) continue;
|
||||
if (int.TryParse(line.AsSpan(0, comma), NumberStyles.None, CultureInfo.InvariantCulture, out int id))
|
||||
map[id] = line[(comma + 1)..].Trim();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// A missing table only costs names ("Family 287").
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
328
Plugins/RynthCore.Plugin.RynthOracle/Data/GearScanner.cs
Normal file
328
Plugins/RynthCore.Plugin.RynthOracle/Data/GearScanner.cs
Normal file
|
|
@ -0,0 +1,328 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>
|
||||
/// The Gear tab's Check: reads the character's worn items (and, for the Ratings view, the packs),
|
||||
/// gets each one appraised so its spells and properties are known, waits for the answers and for
|
||||
/// the client's spell table, then builds the Overlap and Ratings reports. Nothing here is
|
||||
/// server-specific: the items, their appraisals and the character's enchantments come from the
|
||||
/// client, the spell facts from its portal.dat. Pump thread only.
|
||||
/// </summary>
|
||||
internal sealed class GearScanner
|
||||
{
|
||||
public enum Phase { Idle, Identifying, Settling, WaitingForSpells, Done }
|
||||
|
||||
/// <summary>One RequestId this often, so a full pack doesn't flood the server.</summary>
|
||||
private const long IdSpacingMs = 150;
|
||||
/// <summary>After the last RequestId, how long the answers get to arrive.</summary>
|
||||
private const long SettleMs = 1500;
|
||||
/// <summary>An item asked about within this long isn't asked about again (one with no spells never caches a list).</summary>
|
||||
private const long ReaskMs = 5 * 60_000;
|
||||
/// <summary>At most this many pack items are asked about in one Check.</summary>
|
||||
private const int MaxPackIds = 200;
|
||||
|
||||
public Phase State { get; private set; } = Phase.Idle;
|
||||
public GearReport? Overlap { get; private set; }
|
||||
public RatingsReport? Ratings { get; private set; }
|
||||
/// <summary>Goes up when the state or a report changes (the window re-records).</summary>
|
||||
public int Revision { get; private set; }
|
||||
/// <summary>Why the last Check couldn't run, or "".</summary>
|
||||
public string Problem { get; private set; } = "";
|
||||
public int IdsQueued { get; private set; }
|
||||
public int IdsSent { get; private set; }
|
||||
|
||||
/// <summary>The book the reports read spells from (tests put their own in).</summary>
|
||||
internal PortalSpellBook Book = PortalSpellBook.Shared;
|
||||
|
||||
private readonly Queue<uint> _idQueue = new();
|
||||
private readonly Dictionary<uint, long> _askedAt = new();
|
||||
private List<uint> _equipped = new();
|
||||
private List<uint> _pack = new();
|
||||
private bool _includePack;
|
||||
private long _nextIdAt, _settleUntil;
|
||||
private Action<string>? _log;
|
||||
|
||||
public bool Busy => State is Phase.Identifying or Phase.Settling or Phase.WaitingForSpells;
|
||||
|
||||
/// <summary>Tests: show reports built by hand, as if a Check had just finished.</summary>
|
||||
internal void UseReports(GearReport? overlap, RatingsReport? ratings)
|
||||
{
|
||||
Overlap = overlap;
|
||||
Ratings = ratings;
|
||||
State = Phase.Done;
|
||||
Revision++;
|
||||
}
|
||||
|
||||
/// <summary>Forget everything (logout): the next character starts with no report.</summary>
|
||||
public void Clear()
|
||||
{
|
||||
State = Phase.Idle;
|
||||
Overlap = null;
|
||||
Ratings = null;
|
||||
Problem = "";
|
||||
_idQueue.Clear();
|
||||
_askedAt.Clear();
|
||||
_equipped.Clear();
|
||||
_pack.Clear();
|
||||
IdsQueued = IdsSent = 0;
|
||||
Revision++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts a Check: lists the items, queues an appraisal for each one the client hasn't seen
|
||||
/// appraised (or asked about lately), and starts the spell table read. False with
|
||||
/// <see cref="Problem"/> set when there is nothing to read from.
|
||||
/// </summary>
|
||||
public bool Start(RynthCoreHost host, long now, bool includePack, Action<string>? log = null)
|
||||
{
|
||||
_log = log;
|
||||
_includePack = includePack;
|
||||
Problem = "";
|
||||
Book.EnsureLoading(log);
|
||||
uint player = host.GetPlayerId();
|
||||
if (player == 0) { Problem = "Log in first."; Revision++; return false; }
|
||||
|
||||
_equipped = WornItems(host, player);
|
||||
_pack = includePack ? PackItems(host, player) : new List<uint>();
|
||||
if (_equipped.Count == 0 && _pack.Count == 0)
|
||||
{
|
||||
Problem = host.HasGetWieldedItems || host.GetLiveObjectIds().Length > 0
|
||||
? "Nothing worn or wielded was found."
|
||||
: "This RynthCore engine can't list worn items (it needs engine API 69 or newer).";
|
||||
State = Phase.Idle;
|
||||
Revision++;
|
||||
return false;
|
||||
}
|
||||
|
||||
_idQueue.Clear();
|
||||
var buf = new uint[1];
|
||||
int packAsked = 0;
|
||||
foreach (uint id in _equipped) QueueIfNeeded(host, id, now, buf);
|
||||
foreach (uint id in _pack)
|
||||
{
|
||||
if (packAsked >= MaxPackIds) break;
|
||||
if (QueueIfNeeded(host, id, now, buf)) packAsked++;
|
||||
}
|
||||
IdsQueued = _idQueue.Count;
|
||||
IdsSent = 0;
|
||||
_nextIdAt = now;
|
||||
State = _idQueue.Count > 0 ? Phase.Identifying : Phase.WaitingForSpells;
|
||||
_settleUntil = now;
|
||||
Revision++;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool QueueIfNeeded(RynthCoreHost host, uint id, long now, uint[] buf)
|
||||
{
|
||||
if (host.GetObjectSpellIds(id, buf, buf.Length) >= 0) return false; // already appraised this session
|
||||
if (_askedAt.TryGetValue(id, out long at) && now - at < ReaskMs) return false;
|
||||
_idQueue.Enqueue(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Moves the Check along; true when something the tab shows changed.</summary>
|
||||
public bool Tick(RynthCoreHost host, long now, string characterName)
|
||||
{
|
||||
switch (State)
|
||||
{
|
||||
case Phase.Identifying:
|
||||
if (now < _nextIdAt) return false;
|
||||
if (_idQueue.Count > 0)
|
||||
{
|
||||
uint id = _idQueue.Dequeue();
|
||||
if (host.HasRequestId) host.RequestId(id);
|
||||
_askedAt[id] = now;
|
||||
IdsSent++;
|
||||
_nextIdAt = now + IdSpacingMs;
|
||||
Revision++;
|
||||
return true;
|
||||
}
|
||||
State = Phase.Settling;
|
||||
_settleUntil = now + SettleMs;
|
||||
Revision++;
|
||||
return true;
|
||||
case Phase.Settling:
|
||||
if (now < _settleUntil) return false;
|
||||
State = Phase.WaitingForSpells;
|
||||
Revision++;
|
||||
return true;
|
||||
case Phase.WaitingForSpells:
|
||||
if (!Book.Done) return false;
|
||||
Build(host, now, characterName);
|
||||
State = Phase.Done;
|
||||
Revision++;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Build(RynthCoreHost host, long now, string characterName)
|
||||
{
|
||||
var worn = new List<GearPiece>();
|
||||
var all = new List<GearPiece>();
|
||||
var seen = new HashSet<uint>();
|
||||
var locations = new Dictionary<uint, uint>();
|
||||
if (host.TryGetWieldedItems(out var wielded))
|
||||
foreach (var (id, loc) in wielded) locations[id] = loc;
|
||||
foreach (uint id in _equipped)
|
||||
{
|
||||
if (!seen.Add(id)) continue;
|
||||
GearPiece p = Read(host, id, now, equipped: true, locations.TryGetValue(id, out uint l) ? l : 0);
|
||||
worn.Add(p);
|
||||
all.Add(p);
|
||||
}
|
||||
foreach (uint id in _pack)
|
||||
if (seen.Add(id)) all.Add(Read(host, id, now, equipped: false, 0));
|
||||
|
||||
uint[] buffs = PlayerBuffs(host);
|
||||
DateTime local = DateTime.Now;
|
||||
Overlap = GearAnalysis.Analyze(worn, buffs, Lookup, SetOf, characterName, local);
|
||||
Ratings = GearAnalysis.Ratings(all, _includePack, local, Lookup);
|
||||
_log?.Invoke($"[RynthOracle] Gear check: {worn.Count} worn, {Overlap.SpellSources} spells, "
|
||||
+ $"{Overlap.Count(OverlapKind.Overlap)} overlap, {Overlap.Count(OverlapKind.Duplicate)} duplicate; "
|
||||
+ $"{Ratings.RatedRows.Count()} rated item(s), {Ratings.T11Rows} with T11 modifiers; spells from {(Book.HasDat ? "portal.dat" : "SpellData.txt (" + Book.Status + ")")}.");
|
||||
}
|
||||
|
||||
/// <summary>The spell facts: the client's spell table, else SpellData.txt, else only the id.</summary>
|
||||
internal SpellMeta Lookup(uint id)
|
||||
{
|
||||
if (Book.TryGet(id, out PortalSpell s))
|
||||
return new SpellMeta(id, s.Name, s.Category, s.Power, s.IsEnchantment, s.IsItemTarget, true);
|
||||
if (SpellTable.TryGet(id, out SpellInfo info))
|
||||
{
|
||||
uint cat = (uint)Math.Max(0, info.Category);
|
||||
return new SpellMeta(id, info.Name, cat, (uint)Math.Max(0, info.Power), true, ItemFamilyGuess(cat), true);
|
||||
}
|
||||
return SpellMeta.Unknown(id);
|
||||
}
|
||||
|
||||
private SpellSetDef? SetOf(int setId) => Book.TryGetSet((uint)setId, out SpellSetDef d) ? d : null;
|
||||
|
||||
/// <summary>
|
||||
/// Without portal.dat there is no target type: the families cast on items (weapon buffs, armour,
|
||||
/// banes) by name, so their per-item rows still form.
|
||||
/// </summary>
|
||||
private static bool ItemFamilyGuess(uint category)
|
||||
{
|
||||
string fam = GearNames.FamilyRaw(category);
|
||||
if (fam.StartsWith("Extra", StringComparison.Ordinal) && fam.Contains("ResistanceRaising", StringComparison.Ordinal)) return true;
|
||||
return fam.StartsWith("DamageRaising", StringComparison.Ordinal) || fam.StartsWith("AttackModRaising", StringComparison.Ordinal)
|
||||
|| fam.StartsWith("DefenseModRaising", StringComparison.Ordinal) || fam.StartsWith("WeaponTimeRaising", StringComparison.Ordinal)
|
||||
|| fam.StartsWith("ManaConversionModRaising", StringComparison.Ordinal) || fam.StartsWith("SpellDamageRaising", StringComparison.Ordinal)
|
||||
|| fam.StartsWith("ArmorValueRaising", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private GearPiece Read(RynthCoreHost host, uint id, long now, bool equipped, uint location)
|
||||
{
|
||||
var p = new GearPiece { Id = id, Equipped = equipped, Location = location };
|
||||
p.Name = host.TryGetObjectName(id, out string name) && name.Length > 0 ? name : $"Item 0x{id:X8}";
|
||||
if (host.TryGetItemType(id, out uint type)) p.ItemType = type;
|
||||
|
||||
var buf = new uint[128];
|
||||
int n = host.GetObjectSpellIds(id, buf, buf.Length);
|
||||
// No cached list: never appraised, or appraised with no spells (the engine keeps no empty list).
|
||||
p.Appraised = n >= 0 || (_askedAt.TryGetValue(id, out long at) && now - at >= SettleMs);
|
||||
if (n > 0)
|
||||
{
|
||||
var inscribed = new List<uint>();
|
||||
var onItem = new List<uint>();
|
||||
for (int i = 0; i < Math.Min(n, buf.Length); i++)
|
||||
{
|
||||
uint raw = buf[i];
|
||||
if (raw == 0) continue;
|
||||
if ((raw & 0x8000_0000u) != 0) onItem.Add(raw & 0x7FFF_FFFFu);
|
||||
else inscribed.Add(raw);
|
||||
}
|
||||
p.Inscribed = inscribed.ToArray();
|
||||
p.OnItem = onItem.ToArray();
|
||||
}
|
||||
|
||||
p.SetId = Int(host, id, 265);
|
||||
p.MaxLevel = Int(host, id, 319);
|
||||
p.XpStyle = Int(host, id, 320);
|
||||
p.DamageType = Int(host, id, 45);
|
||||
p.BaseXp = host.TryGetObjectQuadProperty(id, 5, out long b) ? b : 0;
|
||||
p.TotalXp = host.TryGetObjectQuadProperty(id, 4, out long t) ? t : 0;
|
||||
var ratings = new List<(int, int)>();
|
||||
foreach (var (prop, _, _) in GearAnalysis.RatingProps)
|
||||
{
|
||||
int v = Int(host, id, (uint)prop);
|
||||
if (v != 0) ratings.Add((prop, v));
|
||||
}
|
||||
p.Ratings = ratings.ToArray();
|
||||
|
||||
// T11 modifier lines: the appraisal's "Modifiers:" section, in the Use text (14) on armour
|
||||
// and jewelry, in the long description (16) on weapons.
|
||||
string use = host.TryGetObjectStringProperty(id, 14, out string u) ? u : "";
|
||||
string longDesc = host.TryGetObjectStringProperty(id, 16, out string d) ? d : "";
|
||||
(p.Modifiers, p.ZoneLocked) = T11Modifiers.Parse(use, longDesc);
|
||||
|
||||
// The Mag-style line's properties (only the ones the appraisal has).
|
||||
foreach (int prop in MagFormat.IntProps)
|
||||
if (host.TryGetObjectIntProperty(id, (uint)prop, out int iv)) p.Ints[prop] = iv;
|
||||
foreach (int prop in MagFormat.FloatProps)
|
||||
if (host.TryGetObjectDoubleProperty(id, (uint)prop, out double fv)) p.Floats[prop] = fv;
|
||||
return p;
|
||||
}
|
||||
|
||||
private static int Int(RynthCoreHost host, uint id, uint stype) =>
|
||||
host.TryGetObjectIntProperty(id, stype, out int v) ? v : 0;
|
||||
|
||||
/// <summary>
|
||||
/// What the character wears and wields: the engine's equipment record (API 87), else every
|
||||
/// object the client knows whose wielder is the character.
|
||||
/// </summary>
|
||||
private static List<uint> WornItems(RynthCoreHost host, uint player)
|
||||
{
|
||||
var list = new List<uint>();
|
||||
if (host.TryGetWieldedItems(out var items))
|
||||
{
|
||||
foreach (var (id, _) in items) if (id != 0 && !list.Contains(id)) list.Add(id);
|
||||
if (list.Count > 0) return list;
|
||||
}
|
||||
foreach (uint id in host.GetLiveObjectIds())
|
||||
if (host.TryGetObjectWielderInfo(id, out uint wielder, out uint loc) && wielder == player && loc != 0 && !list.Contains(id))
|
||||
list.Add(id);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>The wearables in the main pack and the packs inside it (one level, as AC nests them).</summary>
|
||||
private static List<uint> PackItems(RynthCoreHost host, uint player)
|
||||
{
|
||||
var list = new List<uint>();
|
||||
var buf = new uint[512];
|
||||
var packs = new List<uint>();
|
||||
int n = host.GetContainerContents(player, buf);
|
||||
for (int i = 0; i < n; i++) Consider(host, buf[i], list, packs);
|
||||
foreach (uint pack in packs)
|
||||
{
|
||||
int m = host.GetContainerContents(pack, buf);
|
||||
for (int i = 0; i < m; i++) Consider(host, buf[i], list, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static void Consider(RynthCoreHost host, uint id, List<uint> items, List<uint>? packs)
|
||||
{
|
||||
if (id == 0 || !host.TryGetItemType(id, out uint type)) return;
|
||||
if ((type & GearAnalysis.ItemContainer) != 0) { packs?.Add(id); return; }
|
||||
if ((type & GearAnalysis.ItemWearables) != 0 && !items.Contains(id)) items.Add(id);
|
||||
}
|
||||
|
||||
/// <summary>The character's enchantments by spell id (life wards, buffs, worn items' cantrips).</summary>
|
||||
private static uint[] PlayerBuffs(RynthCoreHost host)
|
||||
{
|
||||
var ids = new uint[256];
|
||||
var exp = new double[256];
|
||||
int n = host.ReadPlayerEnchantments(ids, exp, ids.Length);
|
||||
if (n <= 0) return Array.Empty<uint>();
|
||||
var list = new List<uint>(n);
|
||||
for (int i = 0; i < Math.Min(n, ids.Length); i++) if (ids[i] != 0) list.Add(ids[i]);
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
72
Plugins/RynthCore.Plugin.RynthOracle/Data/GuideProgress.cs
Normal file
72
Plugins/RynthCore.Plugin.RynthOracle/Data/GuideProgress.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
// Where a guide quest stands, in four states (2026-11-22, Silentkelpie: "on all the quest, society, contracts tabs it
|
||||
// should flag 4 states, quest fully done (no extra flags still needed), quest partially done (stamps to still get) redo
|
||||
// timer not up, quest partially done (stamps to still get) timer up, or quest not done (no stamps done)"), and whether a
|
||||
// kill task was done before ("the kill task tab should flag if the kill task has been done before or if it is the 1st
|
||||
// time"). On every server, for every guide (the server's wiki, the AC Community Wiki, a server plugin's).
|
||||
// A stamp counts as held when the character has it in /myquests (any run), the account's /qb list names it, or it was
|
||||
// stamped this session. The timer is the redo timer of the stamps held: the longest wait left on any of them.
|
||||
|
||||
internal enum GuideProgressState
|
||||
{
|
||||
/// <summary>No stamp of the quest held.</summary>
|
||||
NotDone,
|
||||
/// <summary>Some stamps held, some still to get, and the held ones' redo timer is still running.</summary>
|
||||
PartialWaiting,
|
||||
/// <summary>Some stamps held, some still to get, and the held ones' redo timer is up (or there is none).</summary>
|
||||
PartialReady,
|
||||
/// <summary>Every stamp held: no flag still needed.</summary>
|
||||
Done,
|
||||
}
|
||||
|
||||
internal static class GuideProgress
|
||||
{
|
||||
/// <summary>The state from the stamps held of all and the held stamps' redo wait.</summary>
|
||||
public static GuideProgressState Of(int held, int all, TimeSpan wait)
|
||||
{
|
||||
if (all <= 0 || held <= 0) return GuideProgressState.NotDone;
|
||||
if (held >= all) return GuideProgressState.Done;
|
||||
return wait > TimeSpan.Zero ? GuideProgressState.PartialWaiting : GuideProgressState.PartialReady;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The list's short status (it has about 14 letters of room) and the tooltip's sentence. <paramref name="repeats"/>:
|
||||
/// the quest can be done again (a timer on the wiki or the server).
|
||||
/// </summary>
|
||||
public static (string Status, string Tip) Text(GuideProgressState s, int held, int all, TimeSpan wait, bool repeats)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case GuideProgressState.Done:
|
||||
if (wait > TimeSpan.Zero)
|
||||
return ("Done " + Short(wait), $"Fully done: all {all} stamps held. It can be done again in {Short(wait)}.");
|
||||
return repeats
|
||||
? ("Done, redo", $"Fully done: all {all} stamps held. Its timer is up: it can be done again now.")
|
||||
: ("Done", all > 0 ? $"Fully done: all {all} stamps held, nothing still needed." : "Fully done.");
|
||||
case GuideProgressState.PartialWaiting:
|
||||
return ($"{held}/{all} wait {Short(wait)}",
|
||||
$"Partly done: {held} of {all} stamps held, {all - held} still to get. The redo timer isn't up: {Short(wait)} left.");
|
||||
case GuideProgressState.PartialReady:
|
||||
return ($"{held}/{all} ready",
|
||||
$"Partly done: {held} of {all} stamps held, {all - held} still to get. The redo timer is up: go get them.");
|
||||
default:
|
||||
return ("Not done", all > 0 ? $"Not done: none of its {all} stamps held yet." : "Not done.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"3d 4h", "5h", "9m" (short: the list's status column is narrow).</summary>
|
||||
public static string Short(TimeSpan t)
|
||||
{
|
||||
if (t.TotalDays >= 1) return $"{(int)t.TotalDays}d{(t.Hours > 0 ? " " + t.Hours + "h" : "")}";
|
||||
if (t.TotalHours >= 1) return $"{(int)t.TotalHours}h{(t.Minutes > 0 ? " " + t.Minutes + "m" : "")}";
|
||||
return $"{Math.Max(1, (int)Math.Ceiling(t.TotalMinutes))}m";
|
||||
}
|
||||
|
||||
/// <summary>The kill task tag: done before ("Again") or the first time ("1st").</summary>
|
||||
public static (string Tag, string Tip) KillTag(bool doneBefore) => doneBefore
|
||||
? ("Again", "Done before: a stamp or flag of this kill task is held (this character's /myquests, or the account's /qb list).")
|
||||
: ("1st", "First time: no stamp or flag of this kill task held yet.");
|
||||
}
|
||||
332
Plugins/RynthCore.Plugin.RynthOracle/Data/IltServerProfile.cs
Normal file
332
Plugins/RynthCore.Plugin.RynthOracle/Data/IltServerProfile.cs
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>One Leaftide feature from RynthILT's profile: its state on this server and where it lives.</summary>
|
||||
internal sealed record IltFeature(string Key, string Label, string Group, int State, string Where);
|
||||
|
||||
/// <summary>One QB Deeds tier as RynthILT's last /deeds list gave it (its reward lines as the server printed them).</summary>
|
||||
internal sealed record IltDeedTier(int Number, long Qb, bool Unlocked, IReadOnlyList<string> Rewards);
|
||||
|
||||
/// <summary>
|
||||
/// ACECustom's QB Deeds as RynthILT last read them (the profile's "deeds" object, RynthILT 2026-11-21): the account QB,
|
||||
/// Deeds on or off (null unknown), the tiers unlocked, the next tier's QB (0 at the top) and every tier's rewards.
|
||||
/// </summary>
|
||||
internal sealed record IltDeedsInfo(bool Loaded, bool Unsupported, bool Busy, long Qb, bool? On, int Unlocked, long NextAt,
|
||||
string Status, DateTime LoadedUtc, IReadOnlyList<IltDeedTier> Tiers);
|
||||
|
||||
/// <summary>
|
||||
/// The ACECustom quest bonus list ("/qb list") as RynthILT last read it (the profile's "questBonus"
|
||||
/// object). <see cref="Generation"/> 0 = not loaded this session; <see cref="Count"/> -1 = unknown.
|
||||
/// <see cref="CompletedCount"/> / <see cref="IncompleteCount"/> are the list sizes RynthILT reports
|
||||
/// (-1 = an older RynthILT that sent the lists inline); from RynthILT 0.2.22 the lists themselves
|
||||
/// arrive separately (<see cref="IltServerLink.QuestBonus"/>).
|
||||
/// </summary>
|
||||
internal sealed record IltQuestBonusList(bool Disabled, int Generation, long Count, string Status,
|
||||
IReadOnlyList<string> Completed, IReadOnlyList<string> Incomplete,
|
||||
int CompletedCount = -1, int IncompleteCount = -1)
|
||||
{
|
||||
/// <summary>The profile names flags whose lists it didn't carry: they come from GetQuestBonusJson.</summary>
|
||||
public bool ListsElsewhere => Completed.Count == 0 && Incomplete.Count == 0 && CompletedCount + IncompleteCount > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What RynthILT reports about the Infinite Leaftide server (the "RynthILT.Server" profile JSON,
|
||||
/// Plugins/Shared/RynthIltServerApi.cs): whether this is an ILT world, the Leaftide features with
|
||||
/// their server state, and the fellowship rules. <see cref="None"/> without RynthILT; every field is
|
||||
/// read leniently so an older or newer RynthILT still parses.
|
||||
/// </summary>
|
||||
internal sealed class IltServerProfile
|
||||
{
|
||||
/// <summary>No RynthILT (or nothing parsed): a retail fellowship and no features.</summary>
|
||||
public static readonly IltServerProfile None = new();
|
||||
|
||||
/// <summary>RynthILT answered with a profile.</summary>
|
||||
public bool Available { get; private init; }
|
||||
public bool Ilt { get; private init; }
|
||||
public string World { get; private init; } = "";
|
||||
public bool Forced { get; private init; }
|
||||
public string Source { get; private init; } = "";
|
||||
/// <summary>Last server-options check (UTC); MinValue = never.</summary>
|
||||
public DateTime CheckedUtc { get; private init; } = DateTime.MinValue;
|
||||
public IReadOnlyList<IltFeature> Features { get; private init; } = Array.Empty<IltFeature>();
|
||||
|
||||
/// <summary>The server's fellowship size limit (retail 9 without RynthILT or off ILT).</summary>
|
||||
public int FellowshipMax { get; private init; } = RynthIltServer.RetailFellowshipMax;
|
||||
/// <summary>Fellowship feature states (RynthIltServer.State*): Zone Share, Fellowship Blackjack, luminance share.</summary>
|
||||
public int ZoneShare { get; private init; } = RynthIltServer.StateUnknown;
|
||||
public int Blackjack { get; private init; } = RynthIltServer.StateUnknown;
|
||||
public int LuminanceShare { get; private init; } = RynthIltServer.StateUnknown;
|
||||
|
||||
/// <summary>The /qb list (ILT worlds with RynthILT 0.2.3 or later); null = none offered.</summary>
|
||||
public IltQuestBonusList? QuestBonus { get; private init; }
|
||||
|
||||
/// <summary>QB Deeds (RynthILT from 2026-11-21, ILT worlds); null = none offered.</summary>
|
||||
public IltDeedsInfo? Deeds { get; private init; }
|
||||
|
||||
/// <summary>The features in one group, in RynthILT's order.</summary>
|
||||
public IEnumerable<IltFeature> InGroup(string group)
|
||||
{
|
||||
foreach (IltFeature f in Features)
|
||||
if (string.Equals(f.Group, group, StringComparison.OrdinalIgnoreCase)) yield return f;
|
||||
}
|
||||
|
||||
/// <summary>Parses the profile JSON; <see cref="None"/> when it is empty or not JSON.</summary>
|
||||
public static IltServerProfile Parse(string? json)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(json)) return None;
|
||||
try
|
||||
{
|
||||
using JsonDocument doc = JsonDocument.Parse(json);
|
||||
JsonElement root = doc.RootElement;
|
||||
if (root.ValueKind != JsonValueKind.Object) return None;
|
||||
|
||||
var features = new List<IltFeature>();
|
||||
if (root.TryGetProperty("features", out JsonElement fs) && fs.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
foreach (JsonElement f in fs.EnumerateArray())
|
||||
{
|
||||
if (f.ValueKind != JsonValueKind.Object) continue;
|
||||
string key = Str(f, "key");
|
||||
if (key.Length == 0) continue;
|
||||
string label = Str(f, "label");
|
||||
features.Add(new IltFeature(key, label.Length > 0 ? label : key, Str(f, "group"),
|
||||
Int(f, "state", RynthIltServer.StateUnknown), Str(f, "where")));
|
||||
}
|
||||
}
|
||||
|
||||
bool ilt = Bool(root, "ilt");
|
||||
int max = RynthIltServer.RetailFellowshipMax;
|
||||
int zone = RynthIltServer.StateUnknown, bj = RynthIltServer.StateUnknown, lum = RynthIltServer.StateUnknown;
|
||||
if (root.TryGetProperty("fellowship", out JsonElement fel) && fel.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
max = Int(fel, "maxMembers", max);
|
||||
zone = Int(fel, "zoneShare", zone);
|
||||
bj = Int(fel, "blackjack", bj);
|
||||
lum = Int(fel, "luminanceShare", lum);
|
||||
}
|
||||
// A bogus size would let the tab claim room nobody has; stay within what the reader handles.
|
||||
if (max < 1 || max > 64) max = RynthIltServer.RetailFellowshipMax;
|
||||
|
||||
DateTime checkedUtc = DateTime.MinValue;
|
||||
string when = Str(root, "checked");
|
||||
if (when.Length > 0
|
||||
&& DateTime.TryParse(when, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime t))
|
||||
checkedUtc = t;
|
||||
|
||||
return new IltServerProfile
|
||||
{
|
||||
Available = true,
|
||||
Ilt = ilt,
|
||||
World = Str(root, "world"),
|
||||
Forced = Bool(root, "forced"),
|
||||
Source = Str(root, "source"),
|
||||
CheckedUtc = checkedUtc,
|
||||
Features = features,
|
||||
FellowshipMax = max,
|
||||
ZoneShare = zone,
|
||||
Blackjack = bj,
|
||||
LuminanceShare = lum,
|
||||
QuestBonus = ParseQuestBonus(root),
|
||||
Deeds = ParseDeeds(root),
|
||||
};
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The "questBonus" object, or null when the profile has none.</summary>
|
||||
private static IltQuestBonusList? ParseQuestBonus(JsonElement root)
|
||||
{
|
||||
if (!root.TryGetProperty("questBonus", out JsonElement q) || q.ValueKind != JsonValueKind.Object) return null;
|
||||
long count = q.TryGetProperty("count", out JsonElement c) && c.ValueKind == JsonValueKind.Number && c.TryGetInt64(out long n) ? n : -1;
|
||||
return new IltQuestBonusList(Bool(q, "disabled"), Int(q, "generation", 0), count, Str(q, "status"),
|
||||
Strings(q, "completed"), Strings(q, "incomplete"),
|
||||
Int(q, "completedCount", -1), Int(q, "incompleteCount", -1));
|
||||
}
|
||||
|
||||
/// <summary>The "deeds" object, or null when the profile has none.</summary>
|
||||
private static IltDeedsInfo? ParseDeeds(JsonElement root)
|
||||
{
|
||||
if (!root.TryGetProperty("deeds", out JsonElement d) || d.ValueKind != JsonValueKind.Object) return null;
|
||||
var tiers = new List<IltDeedTier>();
|
||||
if (d.TryGetProperty("tiers", out JsonElement a) && a.ValueKind == JsonValueKind.Array)
|
||||
foreach (JsonElement t in a.EnumerateArray())
|
||||
if (t.ValueKind == JsonValueKind.Object)
|
||||
tiers.Add(new IltDeedTier(Int(t, "n", 0), Long(t, "qb", 0), Bool(t, "unlocked"), Strings(t, "rewards")));
|
||||
bool? on = d.TryGetProperty("on", out JsonElement o) ? o.ValueKind == JsonValueKind.True ? true : o.ValueKind == JsonValueKind.False ? false : null : null;
|
||||
DateTime at = DateTime.TryParse(Str(d, "loadedUtc"), System.Globalization.CultureInfo.InvariantCulture,
|
||||
System.Globalization.DateTimeStyles.AdjustToUniversal | System.Globalization.DateTimeStyles.AssumeUniversal, out DateTime p) ? p : DateTime.MinValue;
|
||||
return new IltDeedsInfo(Bool(d, "loaded"), Bool(d, "unsupported"), Bool(d, "busy"), Long(d, "qb", -1), on,
|
||||
Int(d, "unlocked", 0), Long(d, "nextAt", 0), Str(d, "status"), at, tiers);
|
||||
}
|
||||
|
||||
private static long Long(JsonElement o, string name, long fallback) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.Number && v.TryGetInt64(out long l) ? l : fallback;
|
||||
|
||||
private static string[] Strings(JsonElement o, string name)
|
||||
{
|
||||
if (!o.TryGetProperty(name, out JsonElement a) || a.ValueKind != JsonValueKind.Array) return Array.Empty<string>();
|
||||
var list = new List<string>(a.GetArrayLength());
|
||||
foreach (JsonElement e in a.EnumerateArray())
|
||||
if (e.ValueKind == JsonValueKind.String && e.GetString() is { Length: > 0 } s) list.Add(s);
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>"on", "off" or "checking" for a feature state.</summary>
|
||||
public static string StateText(int state) => state switch
|
||||
{
|
||||
RynthIltServer.StateOn => "on",
|
||||
RynthIltServer.StateOff => "off",
|
||||
_ => "checking",
|
||||
};
|
||||
|
||||
private static string Str(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.String ? v.GetString() ?? "" : "";
|
||||
|
||||
private static bool Bool(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.True;
|
||||
|
||||
private static int Int(JsonElement o, string name, int fallback) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.Number && v.TryGetInt32(out int i) ? i : fallback;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads RynthILT's "RynthILT.Server" interface on the plugin pump (Infinite Leaftide only: the
|
||||
/// caller polls it while ServerIdentity.IsIlt). Looks the table up through the host (re-checked
|
||||
/// while RynthILT is missing or after it unloads, Version 0) and copies the JSON out every
|
||||
/// <see cref="PollMs"/>; <see cref="Revision"/> goes up when the profile changes. The profile
|
||||
/// carries the /qb lists inline ("questBonus"), which is where the Dynamic stamps /myquests
|
||||
/// leaves out are found.
|
||||
/// </summary>
|
||||
internal sealed unsafe class IltServerLink
|
||||
{
|
||||
private const long PollMs = 2000;
|
||||
private const long RequeryMs = 10_000;
|
||||
// The profile with the /qb lists inline: 25,000 flags are about 1 MB; room for well past that.
|
||||
private const int MaxBuffer = 8 * 1024 * 1024;
|
||||
|
||||
private RynthIltServerApiV1* _table;
|
||||
private long _nextPollAt, _nextQueryAt;
|
||||
private byte[] _buffer = new byte[8192];
|
||||
private string _lastJson = "";
|
||||
|
||||
public IltServerProfile Profile { get; private set; } = IltServerProfile.None;
|
||||
public int Revision { get; private set; }
|
||||
|
||||
/// <summary>The /qb summary and lists, or null (no RynthILT, or not an ILT world).</summary>
|
||||
public IltQuestBonusList? QuestBonus => Profile.QuestBonus;
|
||||
|
||||
/// <summary>QB Deeds as RynthILT last read them, or null (no RynthILT, an older one, or not an ILT world).</summary>
|
||||
public IltDeedsInfo? Deeds => Profile.Deeds;
|
||||
|
||||
private IReadOnlyList<string>? _qbSetSource;
|
||||
private HashSet<string> _qbSet = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>The completed /qb flags (any case), empty until RynthILT has read the list this session.</summary>
|
||||
public IReadOnlySet<string> QbCompletedSet
|
||||
{
|
||||
get
|
||||
{
|
||||
IReadOnlyList<string> done = QuestBonus?.Completed ?? Array.Empty<string>();
|
||||
if (!ReferenceEquals(done, _qbSetSource))
|
||||
{
|
||||
_qbSetSource = done;
|
||||
_qbSet = new HashSet<string>(done, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return _qbSet;
|
||||
}
|
||||
}
|
||||
|
||||
private IReadOnlyList<string>? _stampDoneSource, _stampTodoSource;
|
||||
private HashSet<string> _stampSet = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Every Dynamic stamp flag in the /qb list (any case), from both sections; empty until
|
||||
/// RynthILT has read the list this session. ACECustom writes a stamp's account row with one
|
||||
/// completion when the NPC stamps it, so a Dynamic flag in the list is a done stamp (the
|
||||
/// incomplete section is read too: the server splits the same flags differently read to read).
|
||||
/// </summary>
|
||||
public IReadOnlySet<string> QbStampSet
|
||||
{
|
||||
get
|
||||
{
|
||||
IltQuestBonusList? qb = QuestBonus;
|
||||
IReadOnlyList<string> done = qb?.Completed ?? Array.Empty<string>();
|
||||
IReadOnlyList<string> todo = qb?.Incomplete ?? Array.Empty<string>();
|
||||
if (!ReferenceEquals(done, _stampDoneSource) || !ReferenceEquals(todo, _stampTodoSource))
|
||||
{
|
||||
_stampDoneSource = done;
|
||||
_stampTodoSource = todo;
|
||||
_stampSet = new HashSet<string>(done.Concat(todo).Where(f => f.StartsWith(DynamicStampList.FlagPrefix, StringComparison.OrdinalIgnoreCase)),
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return _stampSet;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Forget the profile (logout, or off Infinite Leaftide); the next poll reads it again.</summary>
|
||||
public void Clear()
|
||||
{
|
||||
_nextPollAt = 0;
|
||||
SetJson("");
|
||||
}
|
||||
|
||||
/// <summary>Pump thread. Cheap when not due.</summary>
|
||||
public void Poll(RynthCoreHost host, long now)
|
||||
{
|
||||
if (now < _nextPollAt) return;
|
||||
_nextPollAt = now + PollMs;
|
||||
RynthIltServerApiV1* t = Table(host, now);
|
||||
SetJson(t == null ? "" : Read(t->GetProfileJson));
|
||||
}
|
||||
|
||||
/// <summary>The table, re-queried when it is missing or RynthILT has shut down (Version 0).</summary>
|
||||
private RynthIltServerApiV1* Table(RynthCoreHost host, long now)
|
||||
{
|
||||
if (_table != null && _table->Version >= 1) return _table;
|
||||
_table = null;
|
||||
if (now < _nextQueryAt || !host.HasGetPluginInterface) return null;
|
||||
_nextQueryAt = now + RequeryMs;
|
||||
// v1 is all the profile needs (v2 added the quest guide's calls after it: QuestGuideClient), so an
|
||||
// older RynthILT's shorter table still serves.
|
||||
var p = (RynthIltServerApiV1*)host.GetPluginInterface(RynthIltServer.PluginName, RynthIltServerApiV1.InterfaceName, 1);
|
||||
if (p != null && p->Version >= 1 && p->StructSize >= (uint)(8 + sizeof(IntPtr)) && p->GetProfileJson != null)
|
||||
_table = p;
|
||||
return _table;
|
||||
}
|
||||
|
||||
/// <summary>Copies the JSON out, growing the buffer when RynthILT says it didn't fit.</summary>
|
||||
private string Read(delegate* unmanaged[Cdecl]<byte*, int, int> get)
|
||||
{
|
||||
if (get == null) return "";
|
||||
for (int attempt = 0; attempt < 2; attempt++)
|
||||
{
|
||||
int len;
|
||||
fixed (byte* b = _buffer) len = get(b, _buffer.Length);
|
||||
if (len <= 0) return "";
|
||||
if (len < _buffer.Length) return Encoding.UTF8.GetString(_buffer, 0, len);
|
||||
if (len + 1 > MaxBuffer) return "";
|
||||
_buffer = new byte[len + 1024];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>Takes a profile JSON (internal: the tests feed one without RynthILT).</summary>
|
||||
internal void SetJson(string json)
|
||||
{
|
||||
if (json == _lastJson) return;
|
||||
_lastJson = json;
|
||||
Profile = IltServerProfile.Parse(json);
|
||||
Revision++;
|
||||
}
|
||||
}
|
||||
75
Plugins/RynthCore.Plugin.RynthOracle/Data/IltWikiGuide.cs
Normal file
75
Plugins/RynthCore.Plugin.RynthOracle/Data/IltWikiGuide.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
// How to get the Leaftide wiki login the ILT quest guide needs, on the ILT Tracker tab (2026-11-21, Silentkelpie: "add in
|
||||
// the itl wiki how to to this tab as well"). The same steps as RynthILT's WikiLoginGuide (RynthServers,
|
||||
// IltWiki/WikiLoginGuide.cs, shown in /ilt settings > Quest guide and by "/ilt wiki help"): every page of
|
||||
// leaftidewiki.com needs a login, so RynthILT reads it with a bot password, a read-only second password of the player's
|
||||
// own wiki account. RynthOracle never sees or keeps the login: the last step hands over to RynthILT's settings. The pages
|
||||
// open in the system browser (ShellExecuteW on its own short STA thread, never Process.Start inside acclient); only the
|
||||
// fixed addresses below are ever opened.
|
||||
internal static class IltWikiGuide
|
||||
{
|
||||
public const string CreateAccountUrl = "https://www.leaftidewiki.com/index.php?title=Special:CreateAccount";
|
||||
public const string LoginUrl = "https://www.leaftidewiki.com/index.php?title=Special:UserLogin";
|
||||
public const string BotPasswordsUrl = "https://www.leaftidewiki.com/index.php?title=Special:BotPasswords";
|
||||
public const string SuggestedBotName = "rynth";
|
||||
|
||||
/// <summary>One step: a heading, what to do, and the page it happens on ("" none).</summary>
|
||||
public readonly record struct Step(string Title, string Text, string Url);
|
||||
|
||||
public static readonly Step[] Steps =
|
||||
{
|
||||
new("Make a wiki account",
|
||||
"Open the wiki's Create account page. Pick a user name and a password, and answer the Asheron's Call question it "
|
||||
+ "asks (it keeps bots out). The account works at once; if the wiki turns it down, ask on the Infinite Leaftide "
|
||||
+ "Discord (the wiki's home page links it). Already have one? Skip to step 2.",
|
||||
CreateAccountUrl),
|
||||
new("Log in on the wiki",
|
||||
"Log in with that user name and password, in your browser. RynthILT and RynthOracle never see this password.",
|
||||
LoginUrl),
|
||||
new("Make a bot password",
|
||||
"Open Special:BotPasswords. Type a bot name (for example \"" + SuggestedBotName + "\") and press Create. Tick only "
|
||||
+ "\"Basic rights\" (reading is all RynthILT does), leave the rest, and press Create again.",
|
||||
BotPasswordsUrl),
|
||||
new("Copy the login it shows",
|
||||
"The wiki shows the new login once: the login name, YourName@" + SuggestedBotName + ", and a long password. Copy "
|
||||
+ "both now; the password can't be shown again (make a new one if you lose it).",
|
||||
""),
|
||||
new("Type it into RynthILT",
|
||||
"Press RynthILT settings below. Under Quest guide, type the login name (YourName@" + SuggestedBotName + ") and the "
|
||||
+ "bot password, then Save login and Read the wiki now. The password stays on this PC, sealed for your Windows "
|
||||
+ "user; /ilt wiki logout forgets it.",
|
||||
""),
|
||||
new("Done",
|
||||
"RynthILT reads the wiki's quest pages, Dynamic Stamps and Kill Tasks; RynthOracle's Wiki, Kill Tasks and Stamps "
|
||||
+ "tabs show them. It reads them again at login once a day (/ilt wiki for the status).",
|
||||
""),
|
||||
};
|
||||
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Unicode, EntryPoint = "ShellExecuteW")]
|
||||
private static extern IntPtr ShellExecuteW(IntPtr hwnd, string? operation, string file, string? parameters, string? directory, int showCmd);
|
||||
|
||||
/// <summary>The guide's own pages only (nothing typed or read elsewhere is ever opened).</summary>
|
||||
internal static bool IsGuidePage(string url) => url is CreateAccountUrl or LoginUrl or BotPasswordsUrl;
|
||||
|
||||
/// <summary>Opens one of the guide's pages in the system browser, off the render thread. False for any other address.</summary>
|
||||
public static bool Open(string url)
|
||||
{
|
||||
if (!IsGuidePage(url)) return false;
|
||||
try
|
||||
{
|
||||
var t = new Thread(() =>
|
||||
{
|
||||
try { ShellExecuteW(IntPtr.Zero, "open", url, null, null, 1); } catch { }
|
||||
}) { IsBackground = true, Name = "RynthOracle wiki page" };
|
||||
t.SetApartmentState(ApartmentState.STA);
|
||||
t.Start();
|
||||
return true;
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
}
|
||||
81
Plugins/RynthCore.Plugin.RynthOracle/Data/KillChat.cs
Normal file
81
Plugins/RynthCore.Plugin.RynthOracle/Data/KillChat.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
// Kill task counts from chat (2026-11-21): the server says each kill of a kill task's creature as
|
||||
// "You have killed 27 Empyrean Handlers! You must kill 250 to complete your task." (Silentkelpie's chat
|
||||
// log), and some tasks only "You have killed some Coral Golem Viceroys". /myquests holds the same count on
|
||||
// the task's counter flag, but may be read only once a minute; this keeps the last count each creature's
|
||||
// line gave this session, so the Kill Tasks tab moves with every kill. Pump thread.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>One creature's last kill line: the count and the goal (0: the line gave none), and when.</summary>
|
||||
internal readonly record struct KillCount(string Creature, int Kills, int Goal, DateTime AtUtc);
|
||||
|
||||
internal sealed class KillChat
|
||||
{
|
||||
private static readonly Regex CountRx = new(
|
||||
@"^You have killed (?<n>\d{1,6}) (?<what>.+?)! You must kill (?<max>\d{1,6}) to complete your task",
|
||||
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex SomeRx = new(@"^You have killed (?:some|enough|all(?: the)?) (?<what>.+?)[.!]*$",
|
||||
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
|
||||
|
||||
private readonly Dictionary<string, KillCount> _byKey = new(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>Goes up with every kill line taken (the view redraws).</summary>
|
||||
public int Revision { get; private set; }
|
||||
|
||||
public IReadOnlyDictionary<string, KillCount> ByCreature => _byKey;
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
if (_byKey.Count == 0) return;
|
||||
_byKey.Clear();
|
||||
Revision++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a chat line; true when it was a kill task's kill line (the counter flags then need reading
|
||||
/// again). A "some X" line keeps the count it had, so it only marks the creature as being killed.
|
||||
/// </summary>
|
||||
public bool OnChatLine(string? line, DateTime utcNow)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line) || !line.StartsWith("You have killed ", StringComparison.OrdinalIgnoreCase)) return false;
|
||||
string text = line.Trim();
|
||||
Match m = CountRx.Match(text);
|
||||
if (m.Success)
|
||||
{
|
||||
string what = m.Groups["what"].Value.Trim();
|
||||
int n = int.Parse(m.Groups["n"].Value, NumberStyles.None, CultureInfo.InvariantCulture);
|
||||
int max = int.Parse(m.Groups["max"].Value, NumberStyles.None, CultureInfo.InvariantCulture);
|
||||
_byKey[GuideQuest.KillKey(what)] = new KillCount(what, n, max, utcNow);
|
||||
Revision++;
|
||||
return true;
|
||||
}
|
||||
m = SomeRx.Match(text);
|
||||
if (!m.Success) return false;
|
||||
string some = m.Groups["what"].Value.Trim();
|
||||
string key = GuideQuest.KillKey(some);
|
||||
_byKey[key] = _byKey.TryGetValue(key, out KillCount had) ? had with { AtUtc = utcNow } : new KillCount(some, 0, 0, utcNow);
|
||||
Revision++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The last kill line for a task's creature: the same key, else one that holds the other
|
||||
/// ("Rare Game" tasks name many creatures, so a key shorter than 5 letters never matches loosely).
|
||||
/// </summary>
|
||||
public KillCount? For(string creatureKey)
|
||||
{
|
||||
if (creatureKey.Length == 0) return null;
|
||||
if (_byKey.TryGetValue(creatureKey, out KillCount k)) return k;
|
||||
if (creatureKey.Length < 5) return null;
|
||||
KillCount? best = null;
|
||||
foreach (KeyValuePair<string, KillCount> kv in _byKey)
|
||||
if (kv.Key.Length >= 5 && (kv.Key.Contains(creatureKey, StringComparison.Ordinal) || creatureKey.Contains(kv.Key, StringComparison.Ordinal))
|
||||
&& (best == null || kv.Value.AtUtc > best.Value.AtUtc))
|
||||
best = kv.Value;
|
||||
return best;
|
||||
}
|
||||
}
|
||||
220
Plugins/RynthCore.Plugin.RynthOracle/Data/MagFormat.cs
Normal file
220
Plugins/RynthCore.Plugin.RynthOracle/Data/MagFormat.cs
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>
|
||||
/// An item as one Mag-Tools ItemInfo line (Mag-Plugins Mag-Tools/ItemInfo/ItemInfo.cs, the text
|
||||
/// Mag-Tools prints when an item is identified), read from the appraisal:
|
||||
/// "Gold Heavy Crossbow (Crossbow), Shimmering Shadows Set, AL 300, CS, Tinks 3, 35.25-47, +12,
|
||||
/// +20%, +5%a, 10%md, Legendary Strength, Wield Lvl 180, Diff 300, Craft 9, Value 12,345, BU 50,
|
||||
/// [D 3, CD 2]"
|
||||
/// Same order, abbreviations and spell filter as Mag-Tools. Added for the Gear tab: the item's level
|
||||
/// after its set ("Lvl 12/50"), the rating cluster with T11 modifier ratings included, and the
|
||||
/// T11 modifier lines at the end. Mag's "buffed values" (its own weapon damage maths) are left out.
|
||||
/// </summary>
|
||||
internal static class MagFormat
|
||||
{
|
||||
// ACE PropertyInt ids (Decal's LongValueKey numbers where Decal has them).
|
||||
public const int PropBurden = 5, PropValue = 19, PropArmorLevel = 28, PropResistMagic = 36, PropDamage = 44,
|
||||
PropWorkmanship = 105, PropDifficulty = 109, PropActivationLevel = 115, PropMaterial = 131,
|
||||
PropWieldRequirement = 158, PropWieldSkill = 159, PropWieldDifficulty = 160, PropTinks = 171,
|
||||
PropActivationSkill = 176, PropImbued = 179, PropElementalBonus = 204, PropMastery = 353;
|
||||
|
||||
// ACE PropertyFloat ids.
|
||||
public const int FloatSlashProt = 13, FloatPierceProt = 14, FloatBludgeonProt = 15, FloatColdProt = 16,
|
||||
FloatFireProt = 17, FloatAcidProt = 18, FloatLightningProt = 19, FloatVariance = 22,
|
||||
FloatMeleeDefense = 29, FloatOffense = 62, FloatDamageMod = 63, FloatManaConversion = 144,
|
||||
FloatMissileDefense = 149, FloatMagicDefense = 150, FloatElementalVsMonsters = 152;
|
||||
|
||||
/// <summary>The int properties <see cref="GearScanner"/> reads for the line.</summary>
|
||||
public static readonly int[] IntProps =
|
||||
{
|
||||
PropBurden, PropValue, PropArmorLevel, PropResistMagic, PropDamage, PropWorkmanship, PropDifficulty,
|
||||
PropActivationLevel, PropMaterial, PropWieldRequirement, PropWieldSkill, PropWieldDifficulty, PropTinks,
|
||||
PropActivationSkill, PropImbued, PropElementalBonus, PropMastery,
|
||||
};
|
||||
|
||||
/// <summary>The float properties <see cref="GearScanner"/> reads for the line.</summary>
|
||||
public static readonly int[] FloatProps =
|
||||
{
|
||||
FloatSlashProt, FloatPierceProt, FloatBludgeonProt, FloatColdProt, FloatFireProt, FloatAcidProt, FloatLightningProt,
|
||||
FloatVariance, FloatMeleeDefense, FloatOffense, FloatDamageMod, FloatManaConversion, FloatMissileDefense,
|
||||
FloatMagicDefense, FloatElementalVsMonsters,
|
||||
};
|
||||
|
||||
/// <summary>Mag's imbue abbreviations by PropertyInt.ImbuedEffect bit.</summary>
|
||||
private static readonly (int Bit, string Text)[] Imbues =
|
||||
{
|
||||
(1, "CS"), (2, "CB"), (4, "AR"), (8, "SlashRend"), (16, "PierceRend"), (32, "BludgeRend"), (64, "AcidRend"),
|
||||
(128, "FrostRend"), (256, "LightRend"), (512, "FireRend"), (1024, "MeleeImbue"), (4096, "MagicImbue"),
|
||||
(8192, "Hematited"), (536870912, "MagicAbsorb"),
|
||||
};
|
||||
|
||||
/// <summary>The weapon-buff spell families Mag-Tools keeps only at level 7 and up.</summary>
|
||||
private static bool IsWeaponBuffFamily(uint family) => family is >= 152 and <= 158 or 195 or 325;
|
||||
|
||||
private static readonly string[] LowLevels = { " I", " II", " III", " IV", " V", " VI" };
|
||||
|
||||
/// <summary>The whole Mag-style line for one piece.</summary>
|
||||
public static string Describe(GearPiece p, Func<uint, SpellMeta>? lookup, (int Prop, int Value)[] ratings)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
CultureInfo inv = CultureInfo.InvariantCulture;
|
||||
|
||||
int material = p.Int(PropMaterial);
|
||||
if (material > 0)
|
||||
{
|
||||
string m = GearNames.Material(material);
|
||||
sb.Append(m.Length > 0 ? m : "unknown material " + material.ToString(inv)).Append(' ');
|
||||
}
|
||||
sb.Append(p.Name);
|
||||
int mastery = p.Int(PropMastery);
|
||||
if (mastery > 0)
|
||||
{
|
||||
string m = GearNames.Mastery(mastery);
|
||||
sb.Append(" (").Append(m.Length > 0 ? m : "Unknown mastery " + mastery.ToString(inv)).Append(')');
|
||||
}
|
||||
|
||||
if (p.SetId != 0) sb.Append(", ").Append(GearNames.SetName(p.SetId));
|
||||
if (p.MaxLevel > 0 && p.Leveled) sb.Append(", Lvl ").Append(p.Level.ToString(inv)).Append('/').Append(p.MaxLevel.ToString(inv));
|
||||
|
||||
int al = p.Int(PropArmorLevel);
|
||||
if (al > 0) sb.Append(", AL ").Append(al.ToString(inv));
|
||||
|
||||
int imbued = p.Int(PropImbued);
|
||||
if (imbued > 0)
|
||||
{
|
||||
sb.Append(',');
|
||||
foreach (var (bit, text) in Imbues)
|
||||
if ((imbued & bit) == bit) sb.Append(' ').Append(text);
|
||||
}
|
||||
|
||||
int tinks = p.Int(PropTinks);
|
||||
if (tinks > 0) sb.Append(", Tinks ").Append(tinks.ToString(inv));
|
||||
|
||||
int maxDamage = p.Int(PropDamage);
|
||||
double variance = p.Float(FloatVariance, 0);
|
||||
if (maxDamage != 0 && variance != 0)
|
||||
sb.Append(", ").Append((maxDamage - maxDamage * variance).ToString("N2", inv)).Append('-').Append(maxDamage.ToString(inv));
|
||||
else if (maxDamage != 0)
|
||||
sb.Append(", ").Append(maxDamage.ToString(inv));
|
||||
|
||||
int elemental = p.Int(PropElementalBonus);
|
||||
if (elemental != 0) sb.Append(", +").Append(elemental.ToString(inv));
|
||||
|
||||
AppendPercent(sb, p.Float(FloatDamageMod, 1), "+", "%", 0);
|
||||
AppendPercent(sb, p.Float(FloatElementalVsMonsters, 1), "+", "%vs. Monsters", 0);
|
||||
AppendPercent(sb, p.Float(FloatOffense, 1), "+", "%a", 0);
|
||||
AppendPercent(sb, p.Float(FloatMeleeDefense, 1), "", "%md", 0);
|
||||
AppendPercent(sb, p.Float(FloatMagicDefense, 1), "", "%mgc.d", 1);
|
||||
AppendPercent(sb, p.Float(FloatMissileDefense, 1), "", "%msl.d", 1);
|
||||
double manaC = p.Float(FloatManaConversion, 0);
|
||||
if (manaC != 0) sb.Append(", ").Append(Math.Round(manaC * 100).ToString(inv)).Append("%mc");
|
||||
|
||||
if (lookup != null)
|
||||
foreach (string spell in ShownSpells(p, lookup)) sb.Append(", ").Append(spell);
|
||||
|
||||
int wieldDiff = p.Int(PropWieldDifficulty);
|
||||
if (wieldDiff > 0)
|
||||
{
|
||||
int req = p.Int(PropWieldRequirement), skill = p.Int(PropWieldSkill);
|
||||
if (req == 7 && skill == 1) sb.Append(", Wield Lvl ").Append(wieldDiff.ToString(inv));
|
||||
else
|
||||
{
|
||||
string s = GearNames.Skill(skill);
|
||||
sb.Append(", ").Append(s.Length > 0 ? s : "Unknown skill: " + skill.ToString(inv)).Append(' ').Append(wieldDiff.ToString(inv));
|
||||
}
|
||||
}
|
||||
|
||||
// "Melee Defense 300 to Activate", unless the wield requirement already says as much.
|
||||
int actLevel = p.Int(PropActivationLevel), actSkill = p.Int(PropActivationSkill);
|
||||
if (actLevel > 0 && (p.Int(PropWieldSkill) != actSkill || wieldDiff < actLevel))
|
||||
{
|
||||
string s = GearNames.Skill(actSkill);
|
||||
sb.Append(", ").Append(s.Length > 0 ? s : "Unknown skill: " + actSkill.ToString(inv))
|
||||
.Append(' ').Append(actLevel.ToString(inv)).Append(" to Activate");
|
||||
}
|
||||
|
||||
int diff = p.Int(PropDifficulty);
|
||||
if (diff > 0) sb.Append(", Diff ").Append(diff.ToString(inv));
|
||||
|
||||
int work = p.Int(PropWorkmanship);
|
||||
if (work > 0 && tinks != 10) sb.Append(", Craft ").Append(work.ToString(inv)); // Mag hides it on a 10-tink item
|
||||
|
||||
// Unenchantable armour: its fixed protections, Slash/Pierce/Bludge/Cold/Fire/Acid/Lightning.
|
||||
if ((p.ItemType & GearAnalysis.ItemArmor) != 0 && Unenchantable(p))
|
||||
{
|
||||
sb.Append(", [");
|
||||
int[] prots = { FloatSlashProt, FloatPierceProt, FloatBludgeonProt, FloatColdProt, FloatFireProt, FloatAcidProt, FloatLightningProt };
|
||||
for (int i = 0; i < prots.Length; i++)
|
||||
{
|
||||
if (i > 0) sb.Append('/');
|
||||
sb.Append(p.Float(prots[i], 0).ToString("N1", inv));
|
||||
}
|
||||
sb.Append(']');
|
||||
}
|
||||
|
||||
int value = p.Int(PropValue);
|
||||
if (value > 0) sb.Append(", Value ").Append(value.ToString("N0", inv));
|
||||
int burden = p.Int(PropBurden);
|
||||
if (burden > 0) sb.Append(", BU ").Append(burden.ToString(inv));
|
||||
|
||||
var shown = ratings.Where(r => r.Value > 0).ToList();
|
||||
if (shown.Count > 0)
|
||||
sb.Append(", [").Append(string.Join(", ", shown.Select(r => GearAnalysis.RatingShort(r.Prop) + " " + r.Value.ToString(inv)))).Append(']');
|
||||
|
||||
if (p.Modifiers.Length > 0)
|
||||
{
|
||||
sb.Append(", T11 [").Append(string.Join(", ", p.Modifiers.Select(m => m.Text))).Append(']');
|
||||
if (p.ZoneLocked) sb.Append(" (zone locked)");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Mag's "+20%" style: a multiplier shown as the percent it adds (only when it isn't 1).</summary>
|
||||
private static void AppendPercent(StringBuilder sb, double mod, string sign, string suffix, int digits)
|
||||
{
|
||||
if (mod == 1) return;
|
||||
sb.Append(", ").Append(sign).Append(Math.Round((mod - 1) * 100, digits).ToString(CultureInfo.InvariantCulture)).Append(suffix);
|
||||
}
|
||||
|
||||
/// <summary>ResistMagic 9999: the item can't be enchanted (Mag's "Unenchantable").</summary>
|
||||
private static bool Unenchantable(GearPiece p) => p.Int(PropResistMagic) >= 9999;
|
||||
|
||||
/// <summary>
|
||||
/// Mag-Tools' spell filter, highest id first: everything on an item that isn't loot (no
|
||||
/// material); on loot the cantrips and the notable spells, without the level 1-7 noise.
|
||||
/// Banes and Impenetrability show only on unenchantable gear (on the rest they get recast).
|
||||
/// </summary>
|
||||
internal static List<string> ShownSpells(GearPiece p, Func<uint, SpellMeta> lookup)
|
||||
{
|
||||
var shown = new List<string>();
|
||||
bool loot = p.Int(PropMaterial) > 0;
|
||||
bool unenchantable = Unenchantable(p);
|
||||
foreach (uint id in p.Inscribed.Distinct().OrderByDescending(i => i))
|
||||
{
|
||||
SpellMeta s = lookup(id);
|
||||
string n = s.Name;
|
||||
if (!loot || Keep(n, s, unenchantable)) shown.Add(n);
|
||||
}
|
||||
return shown;
|
||||
}
|
||||
|
||||
private static bool Keep(string n, SpellMeta s, bool unenchantable)
|
||||
{
|
||||
if (n.Contains("Minor Impenetrability") || n.Contains("Major Impenetrability") || n.Contains("Epic Impenetrability")
|
||||
|| n.Contains("Legendary Impenetrability") || n.Contains("Augmented"))
|
||||
return true;
|
||||
bool baneOrImpen = n.Contains(" Bane") || n.Contains("Impen") || n.StartsWith("Brogard", StringComparison.Ordinal);
|
||||
if (baneOrImpen) return unenchantable;
|
||||
if (IsWeaponBuffFamily(s.Category)) return s.Power == 300 || s.Power >= 400;
|
||||
foreach (string level in LowLevels) if (n.EndsWith(level, StringComparison.Ordinal)) return false;
|
||||
if (s.Power == 300) return false;
|
||||
if (n.Contains("Incantation")) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
132
Plugins/RynthCore.Plugin.RynthOracle/Data/MediaWikiJson.cs
Normal file
132
Plugins/RynthCore.Plugin.RynthOracle/Data/MediaWikiJson.cs
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
// MediaWikiJson.cs - The MediaWiki API's answers, for RynthOracle's own wiki reader (FandomFeed.cs, 2026-11-21).
|
||||
// A copy of RynthILT's IltWiki/WikiApi.cs (Silentkelpie: "under oracle duplicate ilt functions for pulling in
|
||||
// overall quests"), without the login: the AC Community Wiki (asheron.fandom.com) reads without one.
|
||||
// list=categorymembers a category's pages and sub-categories
|
||||
// list=embeddedin eititle=Template:Quest_Summary (every page with the quest box)
|
||||
// prop=info the pages' last revision ids (an unchanged page isn't fetched again)
|
||||
// prop=revisions the changed pages' wikitext (50 a request)
|
||||
// Pure JSON reading here (the offline tests feed it answers); FandomFeed.cs does the HTTP.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal static class MediaWikiJson
|
||||
{
|
||||
/// <summary>Titles per prop=info / prop=revisions request (the API's limit for an anonymous reader).</summary>
|
||||
public const int TitlesPerRequest = 50;
|
||||
|
||||
/// <summary>The URL for a GET with these parameters (format=json, formatversion=2 added).</summary>
|
||||
public static string Url(string api, params (string Key, string Value)[] args)
|
||||
{
|
||||
var sb = new StringBuilder(api);
|
||||
sb.Append(api.Contains('?') ? '&' : '?').Append("format=json&formatversion=2");
|
||||
foreach (var (k, v) in args) sb.Append('&').Append(Uri.EscapeDataString(k)).Append('=').Append(Uri.EscapeDataString(v));
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list=categorymembers or list=embeddedin page: the members' titles (pages, namespace 0), the
|
||||
/// sub-categories, and the "continue" parameters for the next page (empty = done).
|
||||
/// </summary>
|
||||
public static (List<string> Pages, List<string> SubCats, List<(string Key, string Value)> Continue) Members(string json, string listName)
|
||||
{
|
||||
var pages = new List<string>();
|
||||
var cats = new List<string>();
|
||||
var cont = new List<(string, string)>();
|
||||
try
|
||||
{
|
||||
using JsonDocument d = JsonDocument.Parse(json);
|
||||
JsonElement root = d.RootElement;
|
||||
if (root.TryGetProperty("query", out JsonElement q) && q.TryGetProperty(listName, out JsonElement list) && list.ValueKind == JsonValueKind.Array)
|
||||
foreach (JsonElement m in list.EnumerateArray())
|
||||
{
|
||||
string title = Str(m, "title");
|
||||
if (title.Length == 0) continue;
|
||||
int ns = m.TryGetProperty("ns", out JsonElement n) && n.TryGetInt32(out int v) ? v : 0;
|
||||
if (ns == 14) cats.Add(title);
|
||||
else if (ns == 0) pages.Add(title);
|
||||
}
|
||||
if (root.TryGetProperty("continue", out JsonElement c) && c.ValueKind == JsonValueKind.Object)
|
||||
foreach (JsonProperty p in c.EnumerateObject())
|
||||
cont.Add((p.Name, p.Value.ValueKind == JsonValueKind.String ? p.Value.GetString() ?? "" : p.Value.GetRawText()));
|
||||
}
|
||||
catch (JsonException) { }
|
||||
return (pages, cats, cont);
|
||||
}
|
||||
|
||||
/// <summary>prop=info: each page's title and last revision id (missing pages left out).</summary>
|
||||
public static Dictionary<string, long> LastRevisions(string json)
|
||||
{
|
||||
var map = new Dictionary<string, long>(StringComparer.Ordinal);
|
||||
foreach (JsonElement p in Pages(json))
|
||||
{
|
||||
if (p.TryGetProperty("missing", out _)) continue;
|
||||
string title = Str(p, "title");
|
||||
long rev = p.TryGetProperty("lastrevid", out JsonElement r) && r.TryGetInt64(out long v) ? v : 0;
|
||||
if (title.Length > 0) map[title] = rev;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// <summary>prop=revisions (rvprop=content|ids, rvslots=main): each page's title, revision id and wikitext.</summary>
|
||||
public static List<(string Title, long Rev, string Text)> Contents(string json)
|
||||
{
|
||||
var list = new List<(string, long, string)>();
|
||||
foreach (JsonElement p in Pages(json))
|
||||
{
|
||||
string title = Str(p, "title");
|
||||
if (title.Length == 0 || !p.TryGetProperty("revisions", out JsonElement revs) || revs.ValueKind != JsonValueKind.Array) continue;
|
||||
foreach (JsonElement r in revs.EnumerateArray())
|
||||
{
|
||||
long id = r.TryGetProperty("revid", out JsonElement i) && i.TryGetInt64(out long v) ? v : 0;
|
||||
string text = "";
|
||||
if (r.TryGetProperty("slots", out JsonElement slots) && slots.TryGetProperty("main", out JsonElement main))
|
||||
text = Str(main, "content");
|
||||
else
|
||||
text = Str(r, "content");
|
||||
list.Add((title, id, text));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>query.pages (formatversion=2: an array), copied out so the document can go.</summary>
|
||||
private static List<JsonElement> Pages(string json)
|
||||
{
|
||||
var list = new List<JsonElement>();
|
||||
try
|
||||
{
|
||||
using JsonDocument d = JsonDocument.Parse(json);
|
||||
if (d.RootElement.TryGetProperty("query", out JsonElement q) && q.TryGetProperty("pages", out JsonElement pages))
|
||||
{
|
||||
if (pages.ValueKind == JsonValueKind.Array)
|
||||
foreach (JsonElement p in pages.EnumerateArray()) list.Add(p.Clone());
|
||||
else if (pages.ValueKind == JsonValueKind.Object) // formatversion=1: keyed by page id
|
||||
foreach (JsonProperty p in pages.EnumerateObject()) list.Add(p.Value.Clone());
|
||||
}
|
||||
}
|
||||
catch (JsonException) { }
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>Titles split into requests of at most <see cref="TitlesPerRequest"/>, joined with '|'.</summary>
|
||||
public static List<string> Batches(IReadOnlyList<string> titles)
|
||||
{
|
||||
var list = new List<string>();
|
||||
for (int i = 0; i < titles.Count; i += TitlesPerRequest)
|
||||
{
|
||||
int n = Math.Min(TitlesPerRequest, titles.Count - i);
|
||||
var part = new string[n];
|
||||
for (int k = 0; k < n; k++) part[k] = titles[i + k];
|
||||
list.Add(string.Join("|", part));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static string Str(JsonElement o, string name) =>
|
||||
o.ValueKind == JsonValueKind.Object && o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.String ? v.GetString() ?? "" : "";
|
||||
}
|
||||
|
|
@ -80,6 +80,19 @@ internal static class NavTargets
|
|||
return label.Length > 60 ? label.Substring(0, 60).TrimEnd() : label;
|
||||
}
|
||||
|
||||
/// <summary>Every coordinate pair in <paramref name="text"/>, in order, written "8.8S, 53.1E" (the same pair once).</summary>
|
||||
public static List<string> AllCoords(string? text)
|
||||
{
|
||||
var list = new List<string>();
|
||||
if (string.IsNullOrEmpty(text)) return list;
|
||||
foreach (Match m in CoordsRx.Matches(text))
|
||||
{
|
||||
string c = Format(m);
|
||||
if (!list.Contains(c)) list.Add(c);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static string Format(Match m) =>
|
||||
string.Create(CultureInfo.InvariantCulture,
|
||||
$"{m.Groups["ns"].Value}{char.ToUpperInvariant(m.Groups["nsc"].Value[0])}, {m.Groups["ew"].Value}{char.ToUpperInvariant(m.Groups["ewc"].Value[0])}");
|
||||
|
|
|
|||
284
Plugins/RynthCore.Plugin.RynthOracle/Data/PortalSpellBook.cs
Normal file
284
Plugins/RynthCore.Plugin.RynthOracle/Data/PortalSpellBook.cs
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using RynthCore.Plugin.RynthAi.Raycasting;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>
|
||||
/// One spell of the client's spell table (portal.dat 0x0E00000E, ACE.DatLoader SpellBase): what
|
||||
/// the Gear tab needs to tell which spells compete. <see cref="Category"/> is the stacking family
|
||||
/// (ACE SpellCategory): enchantments of one family don't stack, the highest <see cref="Power"/> wins.
|
||||
/// </summary>
|
||||
internal readonly record struct PortalSpell(uint Id, string Name, uint School, uint Category, uint Bitfield,
|
||||
uint Power, uint MetaType, uint TargetType)
|
||||
{
|
||||
/// <summary>SpellType Enchantment (1) or FellowEnchantment (12): the kinds that sit in an enchantment registry.</summary>
|
||||
public bool IsEnchantment => MetaType == 1 || MetaType == 12;
|
||||
|
||||
/// <summary>
|
||||
/// Cast on an item (a bane on armour, Blood Drinker on a weapon), not on a creature: its
|
||||
/// NonComponentTargetType names item types and not Creature (ItemType 0x10).
|
||||
/// </summary>
|
||||
public bool IsItemTarget => TargetType != 0 && (TargetType & 0x10) == 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An equipment set's bonus spells by tier (portal.dat SpellTable.SpellSet). The tier key is the
|
||||
/// set's level: the number of pieces worn, or for leveled sets the sum of the pieces' item levels.
|
||||
/// </summary>
|
||||
internal sealed class SpellSetDef
|
||||
{
|
||||
public readonly SortedDictionary<uint, uint[]> Tiers = new();
|
||||
|
||||
public uint HighestTier => Tiers.Count == 0 ? 0 : LastKey();
|
||||
|
||||
private uint LastKey()
|
||||
{
|
||||
uint last = 0;
|
||||
foreach (uint k in Tiers.Keys) last = k;
|
||||
return last;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The spells active at <paramref name="level"/>, as ACE's GetSpellSet: the level is capped at
|
||||
/// the highest tier and a level between two tiers takes the lower one (SpellSetTiersNoGaps).
|
||||
/// Level 0 (or below the first tier) has none.
|
||||
/// </summary>
|
||||
public uint[] SpellsAt(uint level)
|
||||
{
|
||||
uint tier = Math.Min(level, HighestTier);
|
||||
if (tier == 0) return Array.Empty<uint>();
|
||||
uint[]? best = null;
|
||||
foreach (var kv in Tiers)
|
||||
{
|
||||
if (kv.Key > tier) break;
|
||||
best = kv.Value;
|
||||
}
|
||||
return best ?? Array.Empty<uint>();
|
||||
}
|
||||
|
||||
/// <summary>The tier key <see cref="SpellsAt"/> resolves to (for the label), or 0.</summary>
|
||||
public uint TierAt(uint level)
|
||||
{
|
||||
uint tier = Math.Min(level, HighestTier);
|
||||
uint found = 0;
|
||||
foreach (uint k in Tiers.Keys)
|
||||
{
|
||||
if (k > tier) break;
|
||||
found = k;
|
||||
}
|
||||
return tier == 0 ? 0 : found;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The client's own spell table and equipment-set spells, read once from portal.dat in the
|
||||
/// background. Every server's client carries the spells it can show (custom ones included), so
|
||||
/// this works on any server; SpellData.txt (retail) only fills in when the dat can't be read.
|
||||
/// </summary>
|
||||
internal sealed class PortalSpellBook
|
||||
{
|
||||
public const uint SpellTableFileId = 0x0E00000E;
|
||||
|
||||
/// <summary>The one book the plugin shares (the dat is read once per process).</summary>
|
||||
public static PortalSpellBook Shared { get; } = new();
|
||||
|
||||
private volatile Dictionary<uint, PortalSpell>? _spells;
|
||||
private volatile Dictionary<uint, SpellSetDef>? _sets;
|
||||
private int _started;
|
||||
|
||||
/// <summary>"" until the load ends; then what it found, or why it couldn't (for the tab and the log).</summary>
|
||||
public volatile string Status = "";
|
||||
|
||||
/// <summary>True once the load has finished, whether or not the dat was read.</summary>
|
||||
public volatile bool Done;
|
||||
|
||||
public bool HasDat => _spells != null;
|
||||
public int SpellCount => _spells?.Count ?? 0;
|
||||
public int SetCount => _sets?.Count ?? 0;
|
||||
|
||||
/// <summary>Starts the one background read (any later call does nothing).</summary>
|
||||
public void EnsureLoading(Action<string>? log = null)
|
||||
{
|
||||
if (Interlocked.Exchange(ref _started, 1) == 1) return;
|
||||
_ = Task.Run(() => Load(log));
|
||||
}
|
||||
|
||||
/// <summary>Tests: a book from a hand-built table, already loaded.</summary>
|
||||
internal static PortalSpellBook FromParsed(Dictionary<uint, PortalSpell> spells, Dictionary<uint, SpellSetDef> sets)
|
||||
{
|
||||
var b = new PortalSpellBook { _spells = spells, _sets = sets, Done = true, _started = 1, Status = "test" };
|
||||
return b;
|
||||
}
|
||||
|
||||
public bool TryGet(uint id, out PortalSpell spell)
|
||||
{
|
||||
var t = _spells;
|
||||
if (t != null && t.TryGetValue(id, out spell)) return true;
|
||||
spell = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetSet(uint setId, out SpellSetDef set)
|
||||
{
|
||||
var t = _sets;
|
||||
if (t != null && t.TryGetValue(setId, out SpellSetDef? s)) { set = s; return true; }
|
||||
set = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void Load(Action<string>? log)
|
||||
{
|
||||
try
|
||||
{
|
||||
string? path = FindPortalDat();
|
||||
if (path == null) { Status = "portal.dat not found next to the game client"; return; }
|
||||
using var dat = new DatDatabase();
|
||||
if (!dat.Open(path)) { Status = "portal.dat could not be opened"; return; }
|
||||
byte[]? raw = dat.GetFileData(SpellTableFileId);
|
||||
if (raw == null || raw.Length < 8) { Status = "the spell table isn't in portal.dat"; return; }
|
||||
var (spells, sets) = Parse(raw);
|
||||
_sets = sets;
|
||||
_spells = spells;
|
||||
Status = $"{spells.Count:N0} spells and {sets.Count:N0} equipment sets from {Path.GetFileName(path)}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Status = $"spell table read failed: {ex.GetType().Name}: {ex.Message}";
|
||||
}
|
||||
finally
|
||||
{
|
||||
Done = true;
|
||||
log?.Invoke("[RynthOracle] Gear: " + Status);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The SpellTable file: id, a PackedHashTable of SpellBase, then a PackedHashTable of SpellSet
|
||||
/// (ACE.DatLoader FileTypes/SpellTable.cs). Every SpellBase field is read so the table stays
|
||||
/// aligned; a cut-short table keeps what was read before the overrun.
|
||||
/// </summary>
|
||||
internal static (Dictionary<uint, PortalSpell> Spells, Dictionary<uint, SpellSetDef> Sets) Parse(byte[] raw)
|
||||
{
|
||||
var spells = new Dictionary<uint, PortalSpell>();
|
||||
var sets = new Dictionary<uint, SpellSetDef>();
|
||||
var r = new Reader(raw);
|
||||
r.U32(); // file id
|
||||
int total = r.U16();
|
||||
r.U16(); // bucket size
|
||||
for (int i = 0; i < total && r.Ok; i++)
|
||||
{
|
||||
uint id = r.U32();
|
||||
string name = r.ObfuscatedString();
|
||||
r.ObfuscatedString(); // description
|
||||
uint school = r.U32();
|
||||
r.U32(); // icon
|
||||
uint category = r.U32();
|
||||
uint bitfield = r.U32();
|
||||
r.U32(); // base mana
|
||||
r.Skip(8); // base range constant, range mod
|
||||
uint power = r.U32();
|
||||
r.Skip(12); // economy mod, formula version, component loss
|
||||
uint meta = r.U32();
|
||||
r.U32(); // meta spell id
|
||||
if (meta == 1 || meta == 12) r.Skip(16); // duration (f64), degrade modifier, degrade limit
|
||||
else if (meta == 7) r.Skip(8); // portal lifetime (f64)
|
||||
r.Skip(8 * 4); // the component formula
|
||||
r.Skip(12); // caster, target and fizzle effects
|
||||
r.Skip(8 + 4 + 4); // recovery interval (f64), recovery amount, display order
|
||||
uint target = r.U32(); // NonComponentTargetType (ItemType)
|
||||
r.U32(); // mana mod
|
||||
if (!r.Ok) break;
|
||||
spells[id] = new PortalSpell(id, name, school, category, bitfield, power, meta, target);
|
||||
}
|
||||
|
||||
// SpellSet: setId -> PackedHashTable<tier, List<uint> spells>.
|
||||
if (r.Ok)
|
||||
{
|
||||
int setCount = r.U16();
|
||||
r.U16();
|
||||
for (int i = 0; i < setCount && r.Ok; i++)
|
||||
{
|
||||
uint setId = r.U32();
|
||||
var def = new SpellSetDef();
|
||||
int tiers = r.U16();
|
||||
r.U16();
|
||||
for (int t = 0; t < tiers && r.Ok; t++)
|
||||
{
|
||||
uint tier = r.U32();
|
||||
int n = (int)r.U32();
|
||||
if (n < 0 || n > 4096) { r.Fail(); break; }
|
||||
var list = new uint[n];
|
||||
for (int k = 0; k < n; k++) list[k] = r.U32();
|
||||
if (r.Ok) def.Tiers[tier] = list;
|
||||
}
|
||||
if (r.Ok) sets[setId] = def;
|
||||
}
|
||||
}
|
||||
return (spells, sets);
|
||||
}
|
||||
|
||||
/// <summary>The client's portal.dat: beside acclient.exe (we run inside it), else the usual install folders.</summary>
|
||||
private static string? FindPortalDat()
|
||||
{
|
||||
var dirs = new List<string>();
|
||||
try
|
||||
{
|
||||
string? exe = Environment.ProcessPath;
|
||||
if (!string.IsNullOrEmpty(exe) && Path.GetDirectoryName(exe) is string d) dirs.Add(d);
|
||||
}
|
||||
catch { /* no process path: the fixed folders below */ }
|
||||
dirs.Add(@"C:\Turbine\Asheron's Call");
|
||||
dirs.Add(@"C:\Program Files (x86)\Turbine\Asheron's Call");
|
||||
dirs.Add(@"C:\Program Files\Turbine\Asheron's Call");
|
||||
foreach (string dir in dirs)
|
||||
foreach (string name in new[] { "client_portal.dat", "portal.dat" })
|
||||
{
|
||||
string full = Path.Combine(dir, name);
|
||||
if (File.Exists(full)) return full;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Bounds-checked little-endian reader; <see cref="Ok"/> turns false on an overrun.</summary>
|
||||
private sealed class Reader
|
||||
{
|
||||
private readonly byte[] _b;
|
||||
private int _p;
|
||||
public bool Ok = true;
|
||||
|
||||
public Reader(byte[] b) => _b = b;
|
||||
|
||||
private bool Has(int n)
|
||||
{
|
||||
if (Ok && n >= 0 && _p + n <= _b.Length) return true;
|
||||
Ok = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Fail() => Ok = false;
|
||||
public uint U32() { if (!Has(4)) return 0; uint v = BitConverter.ToUInt32(_b, _p); _p += 4; return v; }
|
||||
public ushort U16() { if (!Has(2)) return 0; ushort v = BitConverter.ToUInt16(_b, _p); _p += 2; return v; }
|
||||
public void Skip(int n) { if (Has(n)) _p += n; }
|
||||
|
||||
/// <summary>u16 length, bytes with their nibbles swapped, then aligned to 4 from the file start (as ACE reads it).</summary>
|
||||
public string ObfuscatedString()
|
||||
{
|
||||
int n = U16();
|
||||
if (!Has(n)) return "";
|
||||
var chars = new char[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
byte x = _b[_p + i];
|
||||
chars[i] = (char)(byte)((x >> 4) | (x << 4)); // Latin-1: byte == code point
|
||||
}
|
||||
_p += n;
|
||||
_p = (_p + 3) & ~3;
|
||||
if (_p > _b.Length) Ok = false;
|
||||
return new string(chars);
|
||||
}
|
||||
}
|
||||
}
|
||||
78
Plugins/RynthCore.Plugin.RynthOracle/Data/QbDeeds.cs
Normal file
78
Plugins/RynthCore.Plugin.RynthOracle/Data/QbDeeds.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
// ACECustom's QB Deeds for the ILT Tracker tab (2026-11-21, Silentkelpie: "look at acecustom ... should be called deeds based
|
||||
// on total qb"). ACECustom (origin/master 8d2460ff2, Source/ACE.Server/Entity/DeedsTiers.cs, upstream #564 2026-10-24 and the
|
||||
// damage steps of 2026-11-10): 15 cumulative tiers, tier N at N x 1,000 account QB, always on while Deeds are ON (/deeds on |
|
||||
// off). The server caps the tiers with deeds_max_tier, and the damage step (deeds_damage_step, 2% by default), the Breath of
|
||||
// Renewal chance and the Cheat Death timings are live settings, so the tier lines below are the defaults; RynthILT's /deeds
|
||||
// list read (IltDeedsInfo) is the server's own text and wins when it is in.
|
||||
|
||||
/// <summary>One Deeds tier as ACECustom's DeedsTiers table has it: its QB and a short line of what it gives.</summary>
|
||||
internal readonly record struct QbDeedTier(int Number, long Qb, string Summary);
|
||||
|
||||
internal static class QbDeeds
|
||||
{
|
||||
public const int QbPerTier = 1000;
|
||||
public const int MaxTier = 15;
|
||||
/// <summary>The tier that unlocks /rebuff and the Deedkeeper's Writ (/deeds item).</summary>
|
||||
public const int RebuffTier = 10;
|
||||
/// <summary>The tiers that each add the damage step (2% at the server's default).</summary>
|
||||
public static readonly int[] DamageStepTiers = { 3, 6, 9, 12, 15 };
|
||||
public const double DefaultDamageStep = 0.02;
|
||||
|
||||
public static readonly QbDeedTier[] Tiers =
|
||||
{
|
||||
new(1, 1000, "Legendary attributes, Legendary skills, Legendary Health / Stamina / Mana Gain, Augmented Understanding III, "
|
||||
+ "Asheron's Lesser Benediction and Blackmoor's Favor"),
|
||||
new(2, 2000, "Legendary Armor and the seven Legendary wards (bludgeoning, piercing, slashing, acid, flame, frost, storm)"),
|
||||
new(3, 3000, "Prodigal Dirty Fighting, Life, Deception, Recklessness, Shield, Sneak Attack, Magic Resistance, "
|
||||
+ "Invulnerability, Impregnability, Void, War and Healing"),
|
||||
new(4, 4000, "Dispersion, Uncanny Dodge, Foresight, Master Negator's / Guardian's / Wayfarer's, Master Voidlock's, "
|
||||
+ "Paragon's Void V, Master Warlock's and Paragon's War V"),
|
||||
new(5, 5000, "The health, stamina and mana buffs (31 spells, Sigil of Vigor XV among them)"),
|
||||
new(6, 6000, "Surge of Destruction, Protection and Regeneration always on, with your life augs (your Aetheria no longer "
|
||||
+ "procs these three)"),
|
||||
new(7, 7000, "Prodigal Strength to Willpower, and Prodigal Regeneration, Rejuvenation and Mana Renewal"),
|
||||
new(8, 8000, "Rating and armor buffs: Master Brute's, Hero's, Duelist's, Rover's, Sage's and Adherent's, Sigil of Fury X, "
|
||||
+ "damage and damage reduction ratings, Ruschk Skin, Timaru's Shelter, Society Master's Blessing and more"),
|
||||
new(9, 9000, "The Legendary banes and Legendary Impenetrability as a floor on every armor piece you wear"),
|
||||
new(10, 10000, "/rebuff casts all your known level 8 buffs at once; /deeds item gives a Deedkeeper's Writ that does the same"),
|
||||
new(11, 11000, "Prodigal Armor, the Prodigal protections and the Masterwork resistances"),
|
||||
new(12, 12000, "Breath of Renewal: a chance on every attack"),
|
||||
new(13, 13000, "Cheat Death: a monster's killing blow leaves you at 1 health and immune for a moment (shared cooldown with "
|
||||
+ "Cheat Death boots)"),
|
||||
new(14, 14000, "+100% of your base critical chance (10% becomes 20%)"),
|
||||
new(15, 15000, "Loot luck: every item's quality roll on your kills is rolled twice and the better kept"),
|
||||
};
|
||||
|
||||
/// <summary>The tier a QB reaches: 0 below 1,000, at most 15 (ACECustom's TierFor).</summary>
|
||||
public static int TierFor(long qb) => (int)Math.Clamp(Math.Max(0, qb) / QbPerTier, 0, MaxTier);
|
||||
|
||||
/// <summary>The Deeds damage bonus at a tier at the default step: 0 below tier 3, then +2% at 3, 6, 9, 12 and 15.</summary>
|
||||
public static double DamageBonus(int tier, double step = DefaultDamageStep)
|
||||
{
|
||||
int steps = 0;
|
||||
foreach (int t in DamageStepTiers) if (tier >= t) steps++;
|
||||
return steps * step;
|
||||
}
|
||||
|
||||
/// <summary>The tier's line, with the damage step on the step tiers (at the default).</summary>
|
||||
public static string Line(QbDeedTier t)
|
||||
{
|
||||
if (Array.IndexOf(DamageStepTiers, t.Number) < 0) return t.Summary;
|
||||
return t.Summary + $"; +{DefaultDamageStep * 100:0}% damage ({DamageBonus(t.Number) * 100:0}% in all)";
|
||||
}
|
||||
|
||||
/// <summary>How far the QB is to the next tier: the next tier (0 at the top), its fraction done, the QB still needed.</summary>
|
||||
public static (int Next, float Fraction, long ToNext) Progress(long qb)
|
||||
{
|
||||
qb = Math.Max(0, qb);
|
||||
int tier = TierFor(qb);
|
||||
if (tier >= MaxTier) return (0, 1f, 0);
|
||||
long into = qb - (long)tier * QbPerTier;
|
||||
return (tier + 1, (float)into / QbPerTier, QbPerTier - into);
|
||||
}
|
||||
}
|
||||
115
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestBonus.cs
Normal file
115
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestBonus.cs
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
// The ILT Tracker tab's quest bonus (Infinite Leaftide, ACECustom read 2026-11-21, Silentkelpie: "look at acecustom add in
|
||||
// itl qb bonus levels and bonus tracker"). In ACECustom (Source/ACE.Server):
|
||||
// * the quest bonus (QB) is the account's: one per quest row (AccountQuest, written when any character of the account first
|
||||
// stamps the quest) and one more once it has a completion (Account.CachedQuestBonusCount, what Deeds and the QB bounty
|
||||
// read); the character carries it as PropertyInt64 9006 QuestCount;
|
||||
// * each QB is +0.5% kill XP: GetQuestCountXPBonus() = 1 + QB x 0.005 (Player_Xp.questToBonusRation);
|
||||
// * "/bonus" prints the four XP multipliers: Quests, Equipment (1 + the XP enchantments + 5% a Bonus XP aug),
|
||||
// Enlightenment (1 + ENL x 0.1) and the Total, their product ("[BONUS] Your XP multiplier from Quests is: x2.35");
|
||||
// * "/qb" prints "Your current quest bonus count: 270"; "/qb list" the completed and the incomplete quest bonus list
|
||||
// (RynthILT reads that one and hands it over: IltQuestBonusList); portals can ask for a QB amount
|
||||
// (PortalRequirement.QuestBonus) or a total multiplier (XPMultiplier).
|
||||
// The QB levels are ACECustom's QB Deeds: a tier every 1,000 QB, up to 15 (Data/QbDeeds.cs).
|
||||
|
||||
/// <summary>The four "/bonus" multipliers as the server last printed them (0 = not seen).</summary>
|
||||
internal sealed record BonusReading(double Quests, double Equipment, double Enlightenment, double Total, DateTime AtUtc)
|
||||
{
|
||||
public static readonly BonusReading None = new(0, 0, 0, 0, DateTime.MinValue);
|
||||
public bool Seen => AtUtc != DateTime.MinValue;
|
||||
}
|
||||
|
||||
internal sealed class QuestBonus
|
||||
{
|
||||
/// <summary>ACECustom's Player_Xp.questToBonusRation: kill XP per QB.</summary>
|
||||
public const double PerQb = 0.005;
|
||||
/// <summary>ACECustom's Player_Xp.enlightenmentToBonusRatio: kill XP per enlightenment.</summary>
|
||||
public const double PerEnlightenment = 0.1;
|
||||
|
||||
private static readonly Regex BonusLine = new(
|
||||
@"^\[BONUS\] Your (?:(Total) XP multiplier|XP multiplier from (Quests|Equipment|Enlightenment)) is: x([0-9][0-9,]*(?:\.[0-9]+)?)",
|
||||
RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex CountLine = new(@"^Your current quest bonus count: ([0-9][0-9,]*)",
|
||||
RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
|
||||
|
||||
private double _q, _e, _n, _t;
|
||||
|
||||
/// <summary>The last "/bonus" reply (its four lines).</summary>
|
||||
public BonusReading Bonus { get; private set; } = BonusReading.None;
|
||||
/// <summary>The last "/qb" count seen in chat (-1 none).</summary>
|
||||
public long ChatCount { get; private set; } = -1;
|
||||
/// <summary>Goes up when anything here changes (the view redraws).</summary>
|
||||
public int Revision { get; private set; }
|
||||
/// <summary>Goes up at each logout (the view asks for /bonus and the /qb list again once a session).</summary>
|
||||
public int Session { get; private set; }
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Bonus = BonusReading.None;
|
||||
ChatCount = -1;
|
||||
_q = _e = _n = _t = 0;
|
||||
Revision++;
|
||||
Session++;
|
||||
}
|
||||
|
||||
/// <summary>A chat line: true when it is a "/bonus" or "/qb" count line (read, not eaten).</summary>
|
||||
public bool OnChatLine(string line, DateTime utcNow)
|
||||
{
|
||||
string t = line.Trim();
|
||||
Match m = CountLine.Match(t);
|
||||
if (m.Success)
|
||||
{
|
||||
if (long.TryParse(m.Groups[1].Value.Replace(",", ""), NumberStyles.Integer, CultureInfo.InvariantCulture, out long n))
|
||||
{
|
||||
ChatCount = n;
|
||||
Revision++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
m = BonusLine.Match(t);
|
||||
if (!m.Success) return false;
|
||||
if (!double.TryParse(m.Groups[3].Value.Replace(",", ""), NumberStyles.Float, CultureInfo.InvariantCulture, out double v)) return true;
|
||||
string which = m.Groups[1].Success ? "total" : m.Groups[2].Value.ToLowerInvariant();
|
||||
switch (which)
|
||||
{
|
||||
case "quests": _q = v; break;
|
||||
case "equipment": _e = v; break;
|
||||
case "enlightenment": _n = v; break;
|
||||
default: _t = v; break;
|
||||
}
|
||||
// The server prints Quests, Equipment, Enlightenment, then Total: the reading is whole at Total.
|
||||
if (which == "total") Bonus = new BonusReading(_q, _e, _n, _t, utcNow);
|
||||
Revision++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>The quest multiplier a QB gives: 1 + QB x 0.005.</summary>
|
||||
public static double Multiplier(long qb) => 1 + Math.Max(0, qb) * PerQb;
|
||||
|
||||
/// <summary>The QB a "/bonus" Quests multiplier stands for (it prints two decimals: about +/- 1 QB).</summary>
|
||||
public static long QbFromMultiplier(double m) => m <= 1 ? 0 : (long)Math.Round((m - 1) / PerQb);
|
||||
|
||||
/// <summary>
|
||||
/// The best QB known: RynthILT's /deeds or /qb read, else a "/qb" count in chat, else the "/bonus" Quests multiplier
|
||||
/// (-1 when none). <paramref name="source"/> says which.
|
||||
/// </summary>
|
||||
public long BestCount(IltQuestBonusList? ilt, out string source, IltDeedsInfo? deeds = null)
|
||||
{
|
||||
if (deeds != null && deeds.Loaded && deeds.Qb >= 0) { source = "RynthILT's /deeds read"; return deeds.Qb; }
|
||||
if (ilt != null && ilt.Count >= 0) { source = "RynthILT's /qb read"; return ilt.Count; }
|
||||
if (ilt != null && ilt.Generation > 0 && ilt.Completed.Count > 0) { source = "the /qb list's completed quests"; return ilt.Completed.Count; }
|
||||
if (ChatCount >= 0) { source = "/qb"; return ChatCount; }
|
||||
if (Bonus.Seen && Bonus.Quests > 0) { source = "/bonus (to about 1 QB)"; return QbFromMultiplier(Bonus.Quests); }
|
||||
source = "";
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>A quest bonus flag that is a Dynamic stamp (they count towards QB as any quest does).</summary>
|
||||
public static bool IsStamp(string flag) => flag.StartsWith(DynamicStampList.FlagPrefix, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
|
@ -325,6 +325,16 @@ internal sealed class QuestFlagStore
|
|||
|
||||
public bool TryGet(string flag, out QuestFlag q) => Flags.TryGetValue(flag, out q!);
|
||||
|
||||
/// <summary>
|
||||
/// Whether RynthOracle should read /myquests again by itself: auto refresh is on, nothing
|
||||
/// happened for <paramref name="minutes"/> since <paramref name="sinceUtc"/> (the later of the
|
||||
/// last reply, the login and RynthOracle's own last try), no reply is on its way, the server
|
||||
/// has /myquests on and its once-a-minute limit is up. Pure: the tests drive it.
|
||||
/// </summary>
|
||||
internal static bool AutoRefreshDue(int minutes, DateTime sinceUtc, DateTime utcNow, bool loading, bool serverDisabled, int throttleSecondsLeft)
|
||||
=> minutes > 0 && !loading && !serverDisabled && throttleSecondsLeft == 0
|
||||
&& utcNow - sinceUtc >= TimeSpan.FromMinutes(minutes);
|
||||
|
||||
internal static QuestFlag? Parse(string line)
|
||||
{
|
||||
Match m = LineRegex.Match(line);
|
||||
|
|
|
|||
511
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestGuide.cs
Normal file
511
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestGuide.cs
Normal file
|
|
@ -0,0 +1,511 @@
|
|||
// The quest guide (2026-11-01): Infinite Leaftide's wiki quests (leaftidewiki.com, Category:Quest_Index)
|
||||
// as RynthILT reads them (WikiQuestParser.cs) and saves them, and as RynthOracle's Quests tab shows
|
||||
// them: each quest's summary, its walkthrough as steps (coordinates, the QB stamps each step gives,
|
||||
// the items it names) and its rewards. One JSON file, written by RynthILT and read by RynthOracle
|
||||
// (this file is linked into RynthILT so both use one reader and writer). No reflection serializer:
|
||||
// both plugins are NativeAOT.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>One walkthrough step: what to do, where ("28.5S, 90.9W"), the stamps it gives and the items it names.</summary>
|
||||
internal sealed class GuideStep
|
||||
{
|
||||
public string Text = "";
|
||||
/// <summary>The step's sub-lines (tips), cleaned of markup; stamps and empty lines left out.</summary>
|
||||
public List<string> Notes = new();
|
||||
public List<string> Coords = new();
|
||||
/// <summary>The QB stamps (quest flags) this step gives, as the wiki writes them ("Shiny_Red_Stone_Found").</summary>
|
||||
public List<string> Stamps = new();
|
||||
/// <summary>The {{Itemlink}} items the step names.</summary>
|
||||
public List<string> Items = new();
|
||||
}
|
||||
|
||||
/// <summary>One wiki quest.</summary>
|
||||
internal sealed class GuideQuest
|
||||
{
|
||||
public string Title = "";
|
||||
public string Url = "";
|
||||
/// <summary>The page's revision id (an unchanged page isn't fetched again).</summary>
|
||||
public long Rev;
|
||||
public string Level = "";
|
||||
public string RecommendedLevel = "";
|
||||
public string Type = "";
|
||||
public string KillTask = "";
|
||||
public string StartsWith = "";
|
||||
public string StartsAt = "";
|
||||
public string Route = "";
|
||||
/// <summary>The repeat timer as the wiki writes it ("20 Hours"); "" = none given.</summary>
|
||||
public string Repeat = "";
|
||||
/// <summary>The repeat timer in seconds: 0 = one-time (or none given), -1 = given but not understood.</summary>
|
||||
public long RepeatSec;
|
||||
public string TimeToComplete = "";
|
||||
public string Contracts = "";
|
||||
public int Qb;
|
||||
/// <summary>The society rank the quest is for ("Initiate", "Adept", ...), from the box's "Society Rank"; "" none.</summary>
|
||||
public string SocietyRank = "";
|
||||
public List<string> Categories = new();
|
||||
public string Overview = "";
|
||||
public List<GuideStep> Steps = new();
|
||||
/// <summary>QB stamps the page lists that no step could be tied to.</summary>
|
||||
public List<string> ExtraStamps = new();
|
||||
/// <summary>The items to pick up on the way (named in a step that kills, loots or finds something).</summary>
|
||||
public List<string> Loot = new();
|
||||
public List<string> Rewards = new();
|
||||
|
||||
/// <summary>Every stamp of the quest, steps first, in order, each once.</summary>
|
||||
public IEnumerable<string> AllStamps()
|
||||
{
|
||||
var seen = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (GuideStep s in Steps)
|
||||
foreach (string st in s.Stamps)
|
||||
if (seen.Add(GuideStamp.Key(st))) yield return st;
|
||||
foreach (string st in ExtraStamps)
|
||||
if (seen.Add(GuideStamp.Key(st))) yield return st;
|
||||
}
|
||||
|
||||
/// <summary>A daily: repeats within a day (and more than an hour, so a timer typo isn't a daily).</summary>
|
||||
public bool IsDaily => RepeatSec > 0 && RepeatSec <= 26 * 3600;
|
||||
/// <summary>A weekly: repeats in more than a day, up to about a month.</summary>
|
||||
public bool IsWeekly => RepeatSec > 26 * 3600 && RepeatSec <= 31L * 86400;
|
||||
/// <summary>A one-time (story) quest: no repeat timer given.</summary>
|
||||
public bool IsOneTime => RepeatSec == 0;
|
||||
|
||||
/// <summary>
|
||||
/// A kill task (2026-11-21): the Quest Summary box says "Kill Task = Yes" (150 pages), or, when the box
|
||||
/// doesn't say, the title does ("... Kill Task", "... Killtask", "Kill: ..."). "Kill Task = False" is not one.
|
||||
/// </summary>
|
||||
public bool IsKillTask
|
||||
{
|
||||
get
|
||||
{
|
||||
string k = KillTask.Trim();
|
||||
if (k.Length > 0)
|
||||
return k.StartsWith("y", StringComparison.OrdinalIgnoreCase) || k.StartsWith("t", StringComparison.OrdinalIgnoreCase);
|
||||
return Title.Contains("Kill Task", StringComparison.OrdinalIgnoreCase)
|
||||
|| Title.Contains("Killtask", StringComparison.OrdinalIgnoreCase)
|
||||
|| Title.StartsWith("Kill:", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly System.Text.RegularExpressions.Regex KillCountRx = new(
|
||||
@"\b(?:kill|slay|hunt(?:\s+down)?|defeat|destroy)\s+(?:a\s+total\s+of\s+)?(?<n>\d{1,5})\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>How many kills the walkthrough asks for ("Kill 100 Drudge Lurkers."), from its first step that says; 0 when none does.</summary>
|
||||
public int KillTarget
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (GuideStep s in Steps)
|
||||
{
|
||||
System.Text.RegularExpressions.Match m = KillCountRx.Match(s.Text);
|
||||
if (m.Success && int.TryParse(m.Groups["n"].Value, System.Globalization.NumberStyles.None,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out int n) && n > 0) return n;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The creature a kill task names, as a GuideStamp key ("Drudge Lurker Kill Task" -> "drudgelurker",
|
||||
/// "Kill: Rynthid Minions" -> "rynthidminion"): matches the server's kill chat and counter flags.
|
||||
/// </summary>
|
||||
public string KillCreatureKey
|
||||
{
|
||||
get
|
||||
{
|
||||
string t = Title;
|
||||
foreach (string cut in new[] { "Kill Task", "Killtask", "Kill:" })
|
||||
t = t.Replace(cut, " ", StringComparison.OrdinalIgnoreCase);
|
||||
return KillKey(t);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A creature name as a key, without a plural "s" ("Rynthid Minions" -> "rynthidminion").</summary>
|
||||
public static string KillKey(string name)
|
||||
{
|
||||
string k = GuideStamp.Key(name);
|
||||
return k.Length > 4 && k.EndsWith('s') ? k[..^1] : k;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stamp names as the server and the wiki write them, compared alike.</summary>
|
||||
internal static class GuideStamp
|
||||
{
|
||||
/// <summary>Lower case letters and digits only: "Shiny_Red_Stone_Found", "shinyredstonefound" and "Shiny Red Stone Found" are one stamp.</summary>
|
||||
public static string Key(string? stamp)
|
||||
{
|
||||
if (string.IsNullOrEmpty(stamp)) return "";
|
||||
var sb = new StringBuilder(stamp.Length);
|
||||
foreach (char ch in stamp)
|
||||
if (char.IsLetterOrDigit(ch)) sb.Append(char.ToLowerInvariant(ch));
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static readonly System.Text.RegularExpressions.Regex Qualifier = new(
|
||||
@"^(?<stamp>\S+)\s+(?:(?:on|after|when|at|for|per|if|once|each|every|until|then|from)\b|\().*$",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>
|
||||
/// A stamp as the wiki writes it inside {{stamped|...}}, cut to the flag itself (2026-11-21). 125 pages
|
||||
/// write "KillTaskDrudgeLurkers_0507 on first completion" and three "You've stamped GleeqeoStart!"; the
|
||||
/// words after the flag made the stamp never match /myquests, so every kill task's counter step stayed
|
||||
/// unticked. A stamp of plain words with spaces ("Shiny Red Stone Found") is left alone.
|
||||
/// </summary>
|
||||
public static string Clean(string? stamp)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(stamp)) return "";
|
||||
string s = stamp.Trim();
|
||||
if (FromChat(s) is string chat) s = chat;
|
||||
else if (s.StartsWith("stamped ", StringComparison.OrdinalIgnoreCase)) s = s.Substring(8).Trim();
|
||||
System.Text.RegularExpressions.Match m = Qualifier.Match(s);
|
||||
if (m.Success) s = m.Groups["stamp"].Value;
|
||||
return s.TrimEnd('!', '.', ',', ';', ':', ' ');
|
||||
}
|
||||
|
||||
/// <summary>The stamp in the server's "You've stamped X!" line, or null.</summary>
|
||||
public static string? FromChat(string? line)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line)) return null;
|
||||
const string Lead = "You've stamped ";
|
||||
int i = line.IndexOf(Lead, StringComparison.OrdinalIgnoreCase);
|
||||
if (i < 0) return null;
|
||||
string rest = line.Substring(i + Lead.Length).Trim();
|
||||
rest = rest.TrimEnd('!', '.', ' ');
|
||||
return rest.Length is > 0 and <= 120 ? rest : null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One row of the wiki's Dynamic Stamps page (2026-11-21): the NPC who takes a sheet of parchment, where, the
|
||||
/// stamp it gives and the item back. Area is the page's town or camp heading ("Arwic"), or "Miscellaneous".
|
||||
/// </summary>
|
||||
internal sealed class GuideDynStamp
|
||||
{
|
||||
public string Area = "";
|
||||
public string Place = "";
|
||||
public string Npc = "";
|
||||
public string Coords = "";
|
||||
public string Stamp = "";
|
||||
public string Reward = "";
|
||||
public string Note = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A contract (2026-11-21, the AC Community Wiki's Category:Contracts): the item you buy or are given that starts
|
||||
/// or repeats a quest, where it comes from, and the quests it is for.
|
||||
/// </summary>
|
||||
internal sealed class GuideContract
|
||||
{
|
||||
public string Title = "";
|
||||
public string Name = "";
|
||||
public string Url = "";
|
||||
public long Rev;
|
||||
public string Description = "";
|
||||
public string Level = "";
|
||||
/// <summary>Where it comes from, as the page's notes say ("Purchased from Hanadi the Barkeeper in the Sho hall ...").</summary>
|
||||
public string Where = "";
|
||||
/// <summary>The person it comes from (the first link in <see cref="Where"/>), for RynthNav.</summary>
|
||||
public string Npc = "";
|
||||
/// <summary>The quests it is for (the Intro box's "Related Quests").</summary>
|
||||
public List<string> Quests = new();
|
||||
}
|
||||
|
||||
/// <summary>The whole guide: the quests, where they came from and when.</summary>
|
||||
internal sealed class QuestGuide
|
||||
{
|
||||
public const int Schema = 1;
|
||||
public static readonly QuestGuide Empty = new();
|
||||
|
||||
/// <summary>
|
||||
/// The page reader that made the guide (WikiQuestParser.Version; 1 for a guide saved before 2026-11-21).
|
||||
/// A guide from an older reader is read from the wiki again whole, not just the pages that changed.
|
||||
/// </summary>
|
||||
public int Parser = 1;
|
||||
|
||||
/// <summary>"api" (the wiki's API with the player's bot password) or "export" (a Special:Export file).</summary>
|
||||
public string Source = "";
|
||||
public DateTime UpdatedUtc = DateTime.MinValue;
|
||||
public List<GuideQuest> Quests = new();
|
||||
|
||||
/// <summary>The wiki's Dynamic Stamps page (2026-11-21); empty when it wasn't read. RynthOracle's Stamps tab uses it over its own sheet.</summary>
|
||||
public List<GuideDynStamp> DynStamps = new();
|
||||
/// <summary>The Dynamic Stamps page's revision id (0 unknown).</summary>
|
||||
public long DynStampsRev;
|
||||
|
||||
/// <summary>The pages in the wiki's Category:Kill Tasks (2026-11-21), its list of kill tasks.</summary>
|
||||
public List<string> KillTasks = new();
|
||||
|
||||
/// <summary>Society quests by the rank they are for (title -> "Initiate", ...; the wiki's society categories, 2026-11-21).</summary>
|
||||
public Dictionary<string, string> Society = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>The wiki's contracts (2026-11-21).</summary>
|
||||
public List<GuideContract> Contracts = new();
|
||||
|
||||
/// <summary>The society rank a quest is for: its box's, else the society category it is in; "" none.</summary>
|
||||
public string SocietyRankOf(GuideQuest q) =>
|
||||
q.SocietyRank.Length > 0 ? q.SocietyRank : Society.TryGetValue(q.Title, out string? r) ? r : "";
|
||||
|
||||
/// <summary>A kill task: the wiki's Kill Tasks category lists it, or its own page says so (GuideQuest.IsKillTask).</summary>
|
||||
public bool IsKillTask(GuideQuest q)
|
||||
{
|
||||
if (q.IsKillTask) return true;
|
||||
if (KillTasks.Count == 0) return false;
|
||||
if (!ReferenceEquals(_killSetOf, KillTasks))
|
||||
{
|
||||
_killSet = new HashSet<string>(KillTasks, StringComparer.OrdinalIgnoreCase);
|
||||
_killSetOf = KillTasks;
|
||||
}
|
||||
return _killSet!.Contains(q.Title);
|
||||
}
|
||||
|
||||
private HashSet<string>? _killSet;
|
||||
private List<string>? _killSetOf;
|
||||
|
||||
public GuideQuest? Find(string title)
|
||||
{
|
||||
foreach (GuideQuest q in Quests)
|
||||
if (string.Equals(q.Title, title, StringComparison.OrdinalIgnoreCase)) return q;
|
||||
return null;
|
||||
}
|
||||
|
||||
// ── JSON ────────────────────────────────────────────────────────────────
|
||||
|
||||
public string ToJson()
|
||||
{
|
||||
using var ms = new MemoryStream();
|
||||
using (var w = new Utf8JsonWriter(ms))
|
||||
{
|
||||
w.WriteStartObject();
|
||||
w.WriteNumber("schema", Schema);
|
||||
w.WriteNumber("parser", Parser);
|
||||
w.WriteString("source", Source);
|
||||
w.WriteString("updated", UpdatedUtc == DateTime.MinValue ? "" : UpdatedUtc.ToString("o"));
|
||||
w.WriteStartArray("quests");
|
||||
foreach (GuideQuest q in Quests)
|
||||
{
|
||||
w.WriteStartObject();
|
||||
w.WriteString("title", q.Title);
|
||||
w.WriteString("url", q.Url);
|
||||
w.WriteNumber("rev", q.Rev);
|
||||
Opt(w, "level", q.Level);
|
||||
Opt(w, "recLevel", q.RecommendedLevel);
|
||||
Opt(w, "type", q.Type);
|
||||
Opt(w, "killTask", q.KillTask);
|
||||
Opt(w, "startsWith", q.StartsWith);
|
||||
Opt(w, "startsAt", q.StartsAt);
|
||||
Opt(w, "route", q.Route);
|
||||
Opt(w, "repeat", q.Repeat);
|
||||
w.WriteNumber("repeatSec", q.RepeatSec);
|
||||
Opt(w, "time", q.TimeToComplete);
|
||||
Opt(w, "contracts", q.Contracts);
|
||||
Opt(w, "societyRank", q.SocietyRank);
|
||||
w.WriteNumber("qb", q.Qb);
|
||||
Arr(w, "categories", q.Categories);
|
||||
Opt(w, "overview", q.Overview);
|
||||
w.WriteStartArray("steps");
|
||||
foreach (GuideStep s in q.Steps)
|
||||
{
|
||||
w.WriteStartObject();
|
||||
w.WriteString("text", s.Text);
|
||||
Arr(w, "notes", s.Notes);
|
||||
Arr(w, "coords", s.Coords);
|
||||
Arr(w, "stamps", s.Stamps);
|
||||
Arr(w, "items", s.Items);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndArray();
|
||||
Arr(w, "extraStamps", q.ExtraStamps);
|
||||
Arr(w, "loot", q.Loot);
|
||||
Arr(w, "rewards", q.Rewards);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndArray();
|
||||
Arr(w, "killTasks", KillTasks);
|
||||
if (Society.Count > 0)
|
||||
{
|
||||
w.WriteStartObject("society");
|
||||
foreach (var kv in Society) w.WriteString(kv.Key, kv.Value);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
if (Contracts.Count > 0)
|
||||
{
|
||||
w.WriteStartArray("contracts");
|
||||
foreach (GuideContract c in Contracts)
|
||||
{
|
||||
w.WriteStartObject();
|
||||
w.WriteString("title", c.Title);
|
||||
Opt(w, "name", c.Name == c.Title ? "" : c.Name);
|
||||
Opt(w, "url", c.Url);
|
||||
if (c.Rev != 0) w.WriteNumber("rev", c.Rev);
|
||||
Opt(w, "description", c.Description);
|
||||
Opt(w, "level", c.Level);
|
||||
Opt(w, "where", c.Where);
|
||||
Opt(w, "npc", c.Npc);
|
||||
Arr(w, "quests", c.Quests);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndArray();
|
||||
}
|
||||
if (DynStamps.Count > 0)
|
||||
{
|
||||
w.WriteNumber("dynRev", DynStampsRev);
|
||||
w.WriteStartArray("dynStamps");
|
||||
foreach (GuideDynStamp d in DynStamps)
|
||||
{
|
||||
w.WriteStartObject();
|
||||
Opt(w, "area", d.Area);
|
||||
Opt(w, "place", d.Place);
|
||||
Opt(w, "npc", d.Npc);
|
||||
Opt(w, "coords", d.Coords);
|
||||
w.WriteString("stamp", d.Stamp);
|
||||
Opt(w, "reward", d.Reward);
|
||||
Opt(w, "note", d.Note);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndArray();
|
||||
}
|
||||
w.WriteEndObject();
|
||||
}
|
||||
return Encoding.UTF8.GetString(ms.ToArray());
|
||||
}
|
||||
|
||||
private static void Opt(Utf8JsonWriter w, string name, string value)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value)) w.WriteString(name, value);
|
||||
}
|
||||
|
||||
private static void Arr(Utf8JsonWriter w, string name, List<string> items)
|
||||
{
|
||||
if (items.Count == 0) return;
|
||||
w.WriteStartArray(name);
|
||||
foreach (string s in items) w.WriteStringValue(s);
|
||||
w.WriteEndArray();
|
||||
}
|
||||
|
||||
/// <summary>Reads a guide; <see cref="Empty"/> when the text isn't one (read leniently: missing fields are empty).</summary>
|
||||
public static QuestGuide Parse(string? json)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(json)) return Empty;
|
||||
try
|
||||
{
|
||||
using JsonDocument doc = JsonDocument.Parse(json);
|
||||
JsonElement root = doc.RootElement;
|
||||
if (root.ValueKind != JsonValueKind.Object) return Empty;
|
||||
var g = new QuestGuide { Source = Str(root, "source"), Parser = (int)Math.Max(1, Long(root, "parser")) };
|
||||
if (DateTime.TryParse(Str(root, "updated"), System.Globalization.CultureInfo.InvariantCulture,
|
||||
System.Globalization.DateTimeStyles.RoundtripKind, out DateTime t))
|
||||
g.UpdatedUtc = t.ToUniversalTime();
|
||||
if (root.TryGetProperty("quests", out JsonElement qs) && qs.ValueKind == JsonValueKind.Array)
|
||||
foreach (JsonElement e in qs.EnumerateArray())
|
||||
{
|
||||
if (e.ValueKind != JsonValueKind.Object) continue;
|
||||
var q = new GuideQuest
|
||||
{
|
||||
Title = Str(e, "title"),
|
||||
Url = Str(e, "url"),
|
||||
Rev = Long(e, "rev"),
|
||||
Level = Str(e, "level"),
|
||||
RecommendedLevel = Str(e, "recLevel"),
|
||||
Type = Str(e, "type"),
|
||||
KillTask = Str(e, "killTask"),
|
||||
StartsWith = Str(e, "startsWith"),
|
||||
StartsAt = Str(e, "startsAt"),
|
||||
Route = Str(e, "route"),
|
||||
Repeat = Str(e, "repeat"),
|
||||
RepeatSec = Long(e, "repeatSec"),
|
||||
TimeToComplete = Str(e, "time"),
|
||||
Contracts = Str(e, "contracts"),
|
||||
SocietyRank = Str(e, "societyRank"),
|
||||
Qb = (int)Long(e, "qb"),
|
||||
Categories = Strs(e, "categories"),
|
||||
Overview = Str(e, "overview"),
|
||||
ExtraStamps = Stamps(Strs(e, "extraStamps")),
|
||||
Loot = Strs(e, "loot"),
|
||||
Rewards = Strs(e, "rewards"),
|
||||
};
|
||||
if (q.Title.Length == 0) continue;
|
||||
if (e.TryGetProperty("steps", out JsonElement ss) && ss.ValueKind == JsonValueKind.Array)
|
||||
foreach (JsonElement s in ss.EnumerateArray())
|
||||
{
|
||||
if (s.ValueKind != JsonValueKind.Object) continue;
|
||||
q.Steps.Add(new GuideStep
|
||||
{
|
||||
Text = Str(s, "text"),
|
||||
Notes = Strs(s, "notes"),
|
||||
Coords = Strs(s, "coords"),
|
||||
Stamps = Stamps(Strs(s, "stamps")),
|
||||
Items = Strs(s, "items"),
|
||||
});
|
||||
}
|
||||
g.Quests.Add(q);
|
||||
}
|
||||
g.KillTasks = Strs(root, "killTasks");
|
||||
if (root.TryGetProperty("society", out JsonElement so) && so.ValueKind == JsonValueKind.Object)
|
||||
foreach (JsonProperty p in so.EnumerateObject())
|
||||
if (p.Value.ValueKind == JsonValueKind.String) g.Society[p.Name] = p.Value.GetString() ?? "";
|
||||
if (root.TryGetProperty("contracts", out JsonElement cs) && cs.ValueKind == JsonValueKind.Array)
|
||||
foreach (JsonElement e in cs.EnumerateArray())
|
||||
{
|
||||
if (e.ValueKind != JsonValueKind.Object) continue;
|
||||
var c = new GuideContract
|
||||
{
|
||||
Title = Str(e, "title"), Url = Str(e, "url"), Rev = Long(e, "rev"), Description = Str(e, "description"),
|
||||
Level = Str(e, "level"), Where = Str(e, "where"), Npc = Str(e, "npc"), Quests = Strs(e, "quests"),
|
||||
};
|
||||
string n = Str(e, "name");
|
||||
c.Name = n.Length > 0 ? n : c.Title;
|
||||
if (c.Title.Length > 0) g.Contracts.Add(c);
|
||||
}
|
||||
g.DynStampsRev = Long(root, "dynRev");
|
||||
if (root.TryGetProperty("dynStamps", out JsonElement ds) && ds.ValueKind == JsonValueKind.Array)
|
||||
foreach (JsonElement d in ds.EnumerateArray())
|
||||
{
|
||||
if (d.ValueKind != JsonValueKind.Object) continue;
|
||||
var row = new GuideDynStamp
|
||||
{
|
||||
Area = Str(d, "area"), Place = Str(d, "place"), Npc = Str(d, "npc"), Coords = Str(d, "coords"),
|
||||
Stamp = Str(d, "stamp"), Reward = Str(d, "reward"), Note = Str(d, "note"),
|
||||
};
|
||||
if (row.Stamp.Length > 0) g.DynStamps.Add(row);
|
||||
}
|
||||
return g;
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stamps cleaned (GuideStamp.Clean) and each once: a guide saved by an older reader reads right at once.</summary>
|
||||
private static List<string> Stamps(List<string> raw)
|
||||
{
|
||||
var list = new List<string>(raw.Count);
|
||||
foreach (string r in raw)
|
||||
{
|
||||
string s = GuideStamp.Clean(r);
|
||||
if (s.Length > 0 && !list.Exists(x => GuideStamp.Key(x) == GuideStamp.Key(s))) list.Add(s);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static string Str(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.String ? v.GetString() ?? "" : "";
|
||||
|
||||
private static long Long(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.Number && v.TryGetInt64(out long n) ? n : 0;
|
||||
|
||||
private static List<string> Strs(JsonElement o, string name)
|
||||
{
|
||||
var list = new List<string>();
|
||||
if (!o.TryGetProperty(name, out JsonElement a) || a.ValueKind != JsonValueKind.Array) return list;
|
||||
foreach (JsonElement e in a.EnumerateArray())
|
||||
if (e.ValueKind == JsonValueKind.String && e.GetString() is { Length: > 0 } s) list.Add(s);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
131
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestGuideClient.cs
Normal file
131
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestGuideClient.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
// The Leaftide wiki quest guide as RynthILT keeps it (2026-11-01): "RynthILT.Server" v2's GetQuestGuideInfoJson
|
||||
// says where the guide file is and when it changed; the file is read again only then. Infinite Leaftide only
|
||||
// (RynthOracle polls it while its server is ILT). Pump thread.
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal sealed unsafe class QuestGuideClient
|
||||
{
|
||||
private const long PollMs = 2000;
|
||||
private const long RequeryMs = 10_000;
|
||||
|
||||
private RynthIltServerApiV1* _table;
|
||||
private long _nextPollAt, _nextQueryAt;
|
||||
private readonly byte[] _buffer = new byte[4096];
|
||||
private long _seenRevision = -1;
|
||||
private string _seenPath = "";
|
||||
private DateTime _fileTime = DateTime.MinValue;
|
||||
|
||||
public QuestGuide Guide { get; private set; } = QuestGuide.Empty;
|
||||
/// <summary>Goes up when the guide or its status changes (the view redraws).</summary>
|
||||
public int Revision { get; private set; }
|
||||
/// <summary>RynthILT serves the guide (v2).</summary>
|
||||
public bool Available { get; private set; }
|
||||
public bool Running { get; private set; }
|
||||
public bool LoginSaved { get; private set; }
|
||||
public string Status { get; private set; } = "";
|
||||
/// <summary>The server's name from the info ("tag", the server guide's; "" for RynthILT's).</summary>
|
||||
public string Tag { get; private set; } = "";
|
||||
/// <summary>The Stamps tab follows this guide's Dynamic Stamps (RynthILT's); a server guide's has none.</summary>
|
||||
public bool FeedsDynamicStamps = true;
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_nextPollAt = 0;
|
||||
_seenRevision = -1;
|
||||
_seenPath = "";
|
||||
if (Guide.Quests.Count > 0 || Available) Revision++;
|
||||
Guide = QuestGuide.Empty;
|
||||
Available = false;
|
||||
Tag = "";
|
||||
if (FeedsDynamicStamps) DynamicStampList.UseWiki(null);
|
||||
Status = "";
|
||||
}
|
||||
|
||||
public void Poll(RynthCoreHost host, long now)
|
||||
{
|
||||
if (now < _nextPollAt) return;
|
||||
_nextPollAt = now + PollMs;
|
||||
RynthIltServerApiV1* t = Table(host, now);
|
||||
if (t == null)
|
||||
{
|
||||
if (Available) { Available = false; Revision++; }
|
||||
return;
|
||||
}
|
||||
string json;
|
||||
fixed (byte* b = _buffer)
|
||||
{
|
||||
int len = t->GetQuestGuideInfoJson(b, _buffer.Length);
|
||||
json = len > 0 && len < _buffer.Length ? Encoding.UTF8.GetString(_buffer, 0, len) : "";
|
||||
}
|
||||
Take(json);
|
||||
}
|
||||
|
||||
/// <summary>Takes RynthILT's info JSON and reads the guide file when it changed (internal: the tests feed one).</summary>
|
||||
internal void Take(string infoJson)
|
||||
{
|
||||
if (infoJson.Length == 0) return;
|
||||
try
|
||||
{
|
||||
using JsonDocument d = JsonDocument.Parse(infoJson);
|
||||
JsonElement r = d.RootElement;
|
||||
string path = r.TryGetProperty("path", out JsonElement p) && p.ValueKind == JsonValueKind.String ? p.GetString() ?? "" : "";
|
||||
long rev = r.TryGetProperty("revision", out JsonElement v) && v.TryGetInt64(out long n) ? n : 0;
|
||||
bool running = r.TryGetProperty("running", out JsonElement ru) && ru.ValueKind == JsonValueKind.True;
|
||||
bool login = r.TryGetProperty("login", out JsonElement lo) && lo.ValueKind == JsonValueKind.True;
|
||||
string status = r.TryGetProperty("status", out JsonElement st) && st.ValueKind == JsonValueKind.String ? st.GetString() ?? "" : "";
|
||||
Tag = r.TryGetProperty("tag", out JsonElement tg) && tg.ValueKind == JsonValueKind.String ? tg.GetString() ?? "" : "";
|
||||
bool changed = !Available || running != Running || login != LoginSaved || status != Status;
|
||||
Available = true;
|
||||
Running = running;
|
||||
LoginSaved = login;
|
||||
Status = status;
|
||||
if (rev != _seenRevision || path != _seenPath)
|
||||
{
|
||||
bool pathChanged = path != _seenPath;
|
||||
_seenRevision = rev;
|
||||
_seenPath = path;
|
||||
DateTime t = path.Length > 0 && File.Exists(path) ? File.GetLastWriteTimeUtc(path) : DateTime.MinValue;
|
||||
if (t != _fileTime || pathChanged)
|
||||
{
|
||||
_fileTime = t;
|
||||
Guide = t == DateTime.MinValue ? QuestGuide.Empty : QuestGuide.Parse(File.ReadAllText(path));
|
||||
if (FeedsDynamicStamps) DynamicStampList.UseWiki(Guide.DynStamps); // the Stamps tab follows the wiki (2026-11-21)
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
if (changed) Revision++;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// A guide being written (or a bad one): the next poll tries again.
|
||||
_seenRevision = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Asks RynthILT to "refresh", "import" or open its "settings". False without RynthILT v2.</summary>
|
||||
public bool Command(string line)
|
||||
{
|
||||
if (_table == null || _table->Version < 2) return false;
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(line + "\0");
|
||||
fixed (byte* b = bytes) return _table->QuestGuideCommand(b) != 0;
|
||||
}
|
||||
|
||||
private RynthIltServerApiV1* Table(RynthCoreHost host, long now)
|
||||
{
|
||||
if (_table != null && _table->Version >= 2) return _table;
|
||||
_table = null;
|
||||
if (now < _nextQueryAt || !host.HasGetPluginInterface) return null;
|
||||
_nextQueryAt = now + RequeryMs;
|
||||
var p = (RynthIltServerApiV1*)host.GetPluginInterface(RynthIltServer.PluginName, RynthIltServerApiV1.InterfaceName, 2);
|
||||
if (p != null && p->Version >= 2 && p->StructSize >= (uint)sizeof(RynthIltServerApiV1) && p->GetQuestGuideInfoJson != null && p->QuestGuideCommand != null)
|
||||
_table = p;
|
||||
return _table;
|
||||
}
|
||||
}
|
||||
286
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestNames.cs
Normal file
286
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestNames.cs
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
// Who and where a wiki quest step names (2026-11-07). Most steps have no coordinates (5,739 of the
|
||||
// guide's 7,091): "Talk to Xsao Lann in Fort Tethana.", "Return the collar to Xsao for your rewards.",
|
||||
// "Take the note to Ahyara and she will sign it and hand you Congratulations (Nasun ibn Tifar & Ahyara)."
|
||||
// Run this quest goes to the names instead ("/rnav go Xsao Lann || Fort Tethana": RynthNav takes the
|
||||
// first one on its Atlas as a whole word or more) and, there, has RynthAi talk to the person or hand
|
||||
// them the quest's items ("questloot talk|handin ..."). Host-free: the tests drive it.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal static class QuestNames
|
||||
{
|
||||
/// <summary>Names one step offers at most.</summary>
|
||||
public const int MaxNames = 6;
|
||||
|
||||
// A name: capitalised words, joined by a space, by "ibn", "of", "the"..., or by "al-"/"el-" ("Mara al-Luq").
|
||||
private const string Tok = @"[A-Z][\p{L}'’]*(?:-[A-Z][\p{L}'’]*)*";
|
||||
private static readonly Regex NameRx = new(
|
||||
Tok + @"(?:(?:\s+(?:ibn|bin|of|the|de|du|da|la|le|von|van)\s+|\s+(?:al|el)-|\s+)" + Tok + @")*",
|
||||
RegexOptions.CultureInvariant);
|
||||
|
||||
// A step's first word, when it starts a name ("Talk to ...", "Return ..."): not part of it.
|
||||
private static readonly HashSet<string> Lead = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"a", "an", "the", "this", "that", "these", "those", "then", "once", "after", "before", "when", "while", "if",
|
||||
"you", "your", "he", "she", "they", "it", "his", "her", "their", "there", "here", "now", "next", "also",
|
||||
"talk", "speak", "ask", "tell", "take", "bring", "return", "give", "hand", "deliver", "show", "turn", "go",
|
||||
"run", "head", "walk", "travel", "enter", "exit", "leave", "use", "kill", "slay", "defeat", "loot", "find",
|
||||
"collect", "gather", "get", "open", "read", "visit", "see", "meet", "wait", "repeat", "continue", "follow",
|
||||
"search", "look", "inside", "outside", "at", "on", "in", "to", "from", "into", "with", "by", "near", "for",
|
||||
"note", "notes", "route", "step", "tip", "warning", "optional", "quest", "item", "items", "reward", "rewards",
|
||||
"portal", "recall", "and", "or", "but", "not", "all", "each", "every", "any", "some", "both", "either", "i",
|
||||
"qb", "xp", "level", "lvl", "stamp", "stamps", "flag", "up", "down", "left", "right", "keep", "complete",
|
||||
"close", "escape", "opposite", "npc", "npcs", "dereth", "please", "beware", "remember", "however", "otherwise",
|
||||
"first", "second", "third", "finally", "last", "again", "back", "around", "through", "across", "inner", "outer",
|
||||
"spotted", "seen", "weak", "strong", "immune", "resistant", "you'll", "you’ll", "you're", "you’re", "it's", "it’s",
|
||||
"don't", "don’t", "do", "does", "be", "is", "are", "was", "will", "can", "may", "must", "should",
|
||||
};
|
||||
|
||||
// Words that are never a place or a person on their own (damage types in "(Weak to Acid)").
|
||||
private static readonly HashSet<string> NotNames = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"acid", "fire", "frost", "cold", "lightning", "electric", "pierce", "piercing", "bludgeon", "bludgeoning",
|
||||
"slash", "slashing", "nether", "void", "health", "stamina", "mana", "loot", "boss", "bosses", "key", "keys",
|
||||
"hour", "hours", "minute", "minutes", "day", "days", "week", "weeks", "team", "group", "fellow", "fellowship",
|
||||
};
|
||||
|
||||
// A direction starts a place's name ("North Yaraq Outpost"), so it isn't trimmed off; alone it is no name.
|
||||
private static readonly HashSet<string> Directions = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"north", "south", "east", "west", "northeast", "northwest", "southeast", "southwest", "n", "s", "e", "w",
|
||||
};
|
||||
|
||||
// A hand-in: return/bring/deliver/show, give or hand (not "hand you"/"give you"), turn in, take ... to.
|
||||
private static readonly Regex HandInRx = new(
|
||||
@"\b(?:return|returns|returned|bring|deliver|show)\b"
|
||||
+ @"|\b(?:hand|give)\b(?!\s+(?:you|it\s+to\s+you|them\s+to\s+you)\b)"
|
||||
+ @"|\bturn(?:s|ed)?\s+(?:\w+\s+){0,3}?in\b"
|
||||
+ @"|\btake\b[^.;]*?\bto\b",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>
|
||||
/// The names <paramref name="s"/> gives, best first: the quest's own people ("starts with") the step
|
||||
/// mentions, then the step's names in order, a place it comes "from" last. Item names, the quest's
|
||||
/// title and its stamps are left out. For the first step the quest's start place comes last.
|
||||
/// </summary>
|
||||
public static List<string> Candidates(GuideQuest q, GuideStep s, bool firstStep = false)
|
||||
{
|
||||
var names = new List<string>();
|
||||
var later = new List<string>();
|
||||
string text = Strip(q, s.Text);
|
||||
|
||||
foreach (string person in Split(q.StartsWith))
|
||||
{
|
||||
foreach (string w in person.Split(' ', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (w.Length < 3 || Lead.Contains(w)) continue;
|
||||
if (!WholeWord(text, w.Trim('"', '“', '”'))) continue;
|
||||
Add(names, person);
|
||||
// '"Pistol" Pete': the Atlas may write it without the quotes.
|
||||
string plain = person.Replace("\"", "").Replace("“", "").Replace("”", "").Trim();
|
||||
if (plain != person) Add(names, plain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Match m in NameRx.Matches(text))
|
||||
{
|
||||
string name = TrimLead(m.Value);
|
||||
if (name.Length < 3 || Lead.Contains(name) || Directions.Contains(name) || NotNames.Contains(name) || IsExcluded(q, s, name)) continue;
|
||||
// One word starting a sentence ("Unlock the door", "Jump down", "Just beyond..."): a name only when
|
||||
// the quest knows it (its people, start, title) or the step writes it with a capital elsewhere too.
|
||||
int nameAt = m.Index + Math.Max(0, m.Value.IndexOf(name, StringComparison.Ordinal)); // after "Kill ", "Talk to "...
|
||||
if (!name.Contains(' ') && SentenceStart(text, nameAt) && !KnownToQuest(q, name) && !CapitalElsewhere(text, name, nameAt))
|
||||
continue;
|
||||
// "From Yaraq follow the paths...": where it starts from, not where it goes.
|
||||
bool from = Regex.IsMatch(text.Substring(0, m.Index), @"\bfrom\s+(?:the\s+)?$", RegexOptions.IgnoreCase);
|
||||
// A person already named in full ("Xsao" after "Xsao Lann"): once.
|
||||
bool part = names.Exists(n => n.StartsWith(name + " ", StringComparison.OrdinalIgnoreCase) || n.Equals(name, StringComparison.OrdinalIgnoreCase));
|
||||
if (part) continue;
|
||||
Add(from ? later : names, name);
|
||||
}
|
||||
foreach (string n in later) Add(names, n);
|
||||
if (firstStep)
|
||||
foreach (string at in Split(q.StartsAt, people: false)) Add(names, at);
|
||||
// A name that is only part of another ("Xsao" of Xsao Lann, "Candeth" of Candeth Keep): the longer one.
|
||||
// (Not inside coordinates written with a place: "1.5N, 71.6W in Fort Tethana" keeps Fort Tethana.)
|
||||
names.RemoveAll(n => names.Exists(o => !ReferenceEquals(o, n) && !o.Any(char.IsDigit) && WordsOf(o).IsProperSupersetOf(WordsOf(n))));
|
||||
if (names.Count > MaxNames) names.RemoveRange(MaxNames, names.Count - MaxNames);
|
||||
return names;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The names for step <paramref name="i"/>: its own, or, when it names nobody ("Hand her each note"),
|
||||
/// the step before's (where the run already is).
|
||||
/// </summary>
|
||||
public static List<string> TargetsAt(GuideQuest q, int i)
|
||||
{
|
||||
if (i < 0 || i >= q.Steps.Count) return new List<string>();
|
||||
List<string> c = Candidates(q, q.Steps[i], i == 0);
|
||||
if (c.Count == 0 && i > 0) c = Candidates(q, q.Steps[i - 1], i - 1 == 0);
|
||||
return c;
|
||||
}
|
||||
|
||||
// Talking: talk, speak, ask, tell, visit, meet, see, find, greet, report, listen.
|
||||
private static readonly Regex TalkRx = new(@"\b(?:talk|talks|speak|speaks|ask|asks|tell|visit|meet|see|find|greet|report|listen|chat)\b",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>The step talks to someone: it says so ("Talk to", "find"), or names one of the quest's own people.</summary>
|
||||
public static bool IsTalk(GuideQuest q, GuideStep s)
|
||||
{
|
||||
// A note in brackets ("(see map)") isn't what the step does.
|
||||
string text = Regex.Replace(Strip(q, s.Text), @"\([^)]*\)", " ");
|
||||
// "dropped by Female Tuskers", "kill the Captain": monsters, nobody to talk to (2026-11-07).
|
||||
if (KillRx.IsMatch(text) && !TalkRx.IsMatch(text)) return false;
|
||||
if (TalkRx.IsMatch(text)) return true;
|
||||
foreach (string person in Split(q.StartsWith))
|
||||
if (person.Length >= 3 && WholeWord(text, person.Split(' ')[0])) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static readonly Regex KillRx = new(@"\b(?:dropped\s+by|drops?\s+from|kill|kills|slay|slays|defeat|defeats|loot|loots|hunt)\b",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>
|
||||
/// The items the rewards say the quest hands in ("For Hand in Female Tusker Tusk:", "For Vial of The
|
||||
/// Architect's Blood:"): the run loots them (2026-11-07, the wiki lists no loot for such quests).
|
||||
/// </summary>
|
||||
public static List<string> RewardItems(GuideQuest q)
|
||||
{
|
||||
var list = new List<string>();
|
||||
foreach (string r in q.Rewards)
|
||||
{
|
||||
Match m = RewardForRx.Match(r ?? "");
|
||||
if (!m.Success) continue;
|
||||
string item = m.Groups["item"].Value.Trim();
|
||||
if (item.Length < 3 || Regex.IsMatch(item, @"^(?:completing|completion|finishing|each|the\s+quest|turning)", RegexOptions.IgnoreCase)) continue;
|
||||
if (!list.Exists(x => x.Equals(item, StringComparison.OrdinalIgnoreCase))) list.Add(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static readonly Regex RewardForRx = new(@"^For\s+(?:(?:Hand(?:ing)?\s+in|turning\s+in|giving|returning)\s+)?(?:the\s+|a\s+|an\s+)?(?<item>[^:]+?)\s*:\s*$",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>The step hands something over ("Return the collar to Xsao", "Take the note to Ahyara").</summary>
|
||||
public static bool IsHandIn(GuideStep s) => HandInRx.IsMatch(Strip(null, s.Text));
|
||||
|
||||
/// <summary>
|
||||
/// What to hand over at step <paramref name="step"/>: the quest's items got before it (its loot and the
|
||||
/// items earlier steps name), not the ones this step gives. Those the step's words name ("the collar":
|
||||
/// Darling's Collar) when there are any, else all of them.
|
||||
/// </summary>
|
||||
public static List<string> HandInItems(GuideQuest q, int step)
|
||||
{
|
||||
// Only what is in hand by now: the items of the steps before this one, and loot no step names.
|
||||
var got = new List<string>();
|
||||
for (int i = 0; i < step && i < q.Steps.Count; i++)
|
||||
foreach (string it in q.Steps[i].Items) Add(got, it);
|
||||
foreach (string it in q.Loot)
|
||||
if (!q.Steps.Exists(st => st.Items.Exists(x => x.Equals(it, StringComparison.OrdinalIgnoreCase)))) Add(got, it);
|
||||
if (step >= 0 && step < q.Steps.Count)
|
||||
got.RemoveAll(it => q.Steps[step].Items.Exists(x => x.Equals(it, StringComparison.OrdinalIgnoreCase)));
|
||||
if (step < 0 || step >= q.Steps.Count) return got;
|
||||
|
||||
string text = q.Steps[step].Text;
|
||||
var named = got.FindAll(it =>
|
||||
{
|
||||
foreach (string w in Bare(it).Split(new[] { ' ', '\'', '’' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
if (w.Length >= 4 && !Lead.Contains(w) && WholeWord(text, w)) return true;
|
||||
return false;
|
||||
});
|
||||
return named.Count > 0 ? named : got;
|
||||
}
|
||||
|
||||
private static bool IsExcluded(GuideQuest q, GuideStep s, string name)
|
||||
{
|
||||
if (name.Equals(q.Title, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
foreach (string it in s.Items) if (Bare(it).Equals(name, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
foreach (string it in q.Loot) if (Bare(it).Equals(name, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
foreach (string st in s.Stamps) if (st.Equals(name, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The text without the item names in it (a person named only inside an item's name isn't the step's).</summary>
|
||||
private static string Strip(GuideQuest? q, string text)
|
||||
{
|
||||
text ??= "";
|
||||
if (q == null) return text;
|
||||
var items = new List<string>(q.Loot);
|
||||
foreach (GuideStep st in q.Steps) items.AddRange(st.Items);
|
||||
items.Sort((a, b) => b.Length.CompareTo(a.Length));
|
||||
foreach (string it in items)
|
||||
if (it.Length > 0) text = text.Replace(it, " ", StringComparison.OrdinalIgnoreCase);
|
||||
return text;
|
||||
}
|
||||
|
||||
private static string TrimLead(string name)
|
||||
{
|
||||
string[] w = name.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
int i = 0;
|
||||
// "Using the map", "Killing Burnja", "Eventually you...": a sentence's first word, not a name.
|
||||
while (i < w.Length && (Lead.Contains(w[i]) || (i == 0 && IsAdverbOrVerb(w[i])))) i++;
|
||||
if (i >= w.Length) return "";
|
||||
int j = w.Length - 1;
|
||||
while (j > i && Lead.Contains(w[j])) j--;
|
||||
string n = string.Join(" ", w, i, j - i + 1).Trim('\'', '’', '-');
|
||||
if (n.EndsWith("'s", StringComparison.OrdinalIgnoreCase) || n.EndsWith("’s", StringComparison.OrdinalIgnoreCase)) n = n.Substring(0, n.Length - 2);
|
||||
return n;
|
||||
}
|
||||
|
||||
private static bool IsAdverbOrVerb(string w) =>
|
||||
w.Length > 4 && (w.EndsWith("ing", StringComparison.OrdinalIgnoreCase) || w.EndsWith("ly", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
/// <summary>
|
||||
/// "Nasun ibn Tifar / Ahyara", "Jarvis Hammerstone (Optional)": the separate names, notes in brackets
|
||||
/// left off. A place ("1.5N, 71.6W in Fort Tethana") is not split at its comma.
|
||||
/// </summary>
|
||||
internal static IEnumerable<string> Split(string s, bool people = true)
|
||||
{
|
||||
string pattern = people ? @"\s*(?:/|;|,|\bor\b|\band\b)\s*" : @"\s*(?:\s/\s|;|\bor\b)\s*";
|
||||
foreach (string part in Regex.Split(s ?? "", pattern, RegexOptions.IgnoreCase))
|
||||
{
|
||||
string p = Regex.Replace(part, @"\s*\([^)]*\)", "").Trim();
|
||||
if (p.Length >= 2) yield return p;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool SentenceStart(string text, int at)
|
||||
{
|
||||
string before = text.Substring(0, at).TrimEnd();
|
||||
return before.Length == 0 || ".!?:;-–(\"".IndexOf(before[^1]) >= 0;
|
||||
}
|
||||
|
||||
private static bool KnownToQuest(GuideQuest q, string name) =>
|
||||
WholeWord(q.StartsWith, name) || WholeWord(q.StartsAt, name) || WholeWord(q.Title, name);
|
||||
|
||||
private static bool CapitalElsewhere(string text, string name, int at)
|
||||
{
|
||||
foreach (Match m in Regex.Matches(text, @"(?<![\p{L}\d])" + Regex.Escape(name) + @"(?![\p{L}\d])", RegexOptions.CultureInvariant))
|
||||
if (m.Index != at && !SentenceStart(text, m.Index)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static HashSet<string> WordsOf(string name) =>
|
||||
new(Regex.Split(name, @"[^\p{L}\d'’-]+").Where(w => w.Length > 0), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private static string Bare(string item)
|
||||
{
|
||||
item = (item ?? "").Trim();
|
||||
int open = item.LastIndexOf(" (", StringComparison.Ordinal);
|
||||
return open > 0 && item.EndsWith(")", StringComparison.Ordinal) ? item.Substring(0, open) : item;
|
||||
}
|
||||
|
||||
private static bool WholeWord(string text, string word) =>
|
||||
Regex.IsMatch(text, @"(?<![\p{L}\d])" + Regex.Escape(word) + @"(?![\p{L}\d])", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
private static void Add(List<string> list, string s)
|
||||
{
|
||||
s = s.Trim();
|
||||
if (s.Length > 0 && !list.Exists(x => x.Equals(s, StringComparison.OrdinalIgnoreCase))) list.Add(s);
|
||||
}
|
||||
}
|
||||
74
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestOffers.cs
Normal file
74
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestOffers.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
// Quests an NPC gives (2026-11-08, Silentkelpie: "when one clicks on a npc and they talk back check to see if
|
||||
// their text is the start of a quest and ask if you want to do that quest"). An NPC talking to the character
|
||||
// ("Xsao Lann tells you, \"...\"", "Warden says, \"...\"") is matched against the wiki guide's quests by who
|
||||
// they start with (GuideQuest.StartsWith); the quests it starts are offered (the RynthOracle quest offer
|
||||
// window), the ones whose words the NPC's text shares first. Host-free: the tests drive it.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal static class QuestOffers
|
||||
{
|
||||
/// <summary>Quests one offer lists at most.</summary>
|
||||
public const int MaxQuests = 4;
|
||||
|
||||
// "Xsao Lann tells you, "..."", "Warden says, "..."" (an NPC's Tell and Say emotes).
|
||||
private static readonly Regex NpcLineRx = new(
|
||||
@"^(?<name>[A-Z\""][^,\""]{1,60}?)\s+(?:tells\s+you|says),\s*\""(?<text>.*)\""\s*$",
|
||||
RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>An NPC talking to the character: who and what. False for anything else (and for "You say").</summary>
|
||||
public static bool TryNpcLine(string? line, out string name, out string text)
|
||||
{
|
||||
name = text = "";
|
||||
Match m = NpcLineRx.Match((line ?? "").Trim());
|
||||
if (!m.Success) return false;
|
||||
name = m.Groups["name"].Value.Trim();
|
||||
text = m.Groups["text"].Value.Trim();
|
||||
if (name.Equals("You", StringComparison.OrdinalIgnoreCase)) return false;
|
||||
return name.Length >= 2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The guide's quests <paramref name="npc"/> starts (one of the people its "starts with" names, as the game
|
||||
/// writes them: quotes and a note in brackets left off), the ones the NPC's <paramref name="text"/> shares
|
||||
/// most words with first (its title, overview and first step).
|
||||
/// </summary>
|
||||
public static List<GuideQuest> StartedBy(IEnumerable<GuideQuest> quests, string npc, string text)
|
||||
{
|
||||
string who = Norm(npc);
|
||||
var found = new List<(GuideQuest Q, int Score, int Order)>();
|
||||
int order = 0;
|
||||
if (who.Length < 2) return new List<GuideQuest>();
|
||||
foreach (GuideQuest q in quests)
|
||||
{
|
||||
order++;
|
||||
bool starts = false;
|
||||
foreach (string person in QuestNames.Split(q.StartsWith))
|
||||
if (Norm(person) == who) { starts = true; break; }
|
||||
if (!starts) continue;
|
||||
found.Add((q, Overlap(text, q), order));
|
||||
}
|
||||
return found.OrderByDescending(f => f.Score).ThenBy(f => f.Order).Select(f => f.Q).ToList();
|
||||
}
|
||||
|
||||
/// <summary>How many of the quest's words (4 letters or more) the NPC's text has.</summary>
|
||||
internal static int Overlap(string text, GuideQuest q)
|
||||
{
|
||||
var said = Words(text);
|
||||
if (said.Count == 0) return 0;
|
||||
string about = q.Title + " " + q.Overview + " " + (q.Steps.Count > 0 ? q.Steps[0].Text : "");
|
||||
int n = 0;
|
||||
foreach (string w in Words(about)) if (said.Contains(w)) n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
private static HashSet<string> Words(string s) =>
|
||||
new(Regex.Split(s ?? "", @"[^\p{L}']+").Where(w => w.Length >= 4 && w != "quest"), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private static string Norm(string s) =>
|
||||
Regex.Replace(Regex.Replace(s ?? "", @"[\""“”]", ""), @"\s+", " ").Trim().ToLowerInvariant();
|
||||
}
|
||||
854
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestRunner.cs
Normal file
854
Plugins/RynthCore.Plugin.RynthOracle/Data/QuestRunner.cs
Normal file
|
|
@ -0,0 +1,854 @@
|
|||
using System.Linq;
|
||||
// "Run this quest" (2026-11-01): walks a wiki quest's steps (QuestGuide.cs) with RynthNav. Each step that
|
||||
// isn't done yet (its stamps not all held) is visited in order: RynthNav goes to its coordinates ("/rnav go
|
||||
// 28.5S, 90.9W"; a step with several places goes to each in turn), and when RynthNav says it arrived the
|
||||
// step's instructions go to chat. The step is done when the server stamps it ("You've stamped X!") or its
|
||||
// flags show up, or with Next. A step without coordinates is shown and waits for its stamp or Next. The
|
||||
// quest's loot (the items its steps kill or loot for) goes on RynthAi's quest loot list while it runs
|
||||
// ("questloot" broker action, "add <name>") and comes off again when it ends. Since 2026-11-05 the run also makes the
|
||||
// quest's own loot profile the one in use: RynthAi builds it from LootProfiles\base-quest-dynamic.utl and the
|
||||
// quest's items ("questloot profile <quest>|<item>..."), and goes back to the profile before when the run ends
|
||||
// ("questloot profile off"). Since 2026-11-07 a step without coordinates goes to the people and places it
|
||||
// names (QuestNames: "Talk to Xsao Lann in Fort Tethana" is "/rnav go Xsao Lann || Fort Tethana"), and at
|
||||
// a step's place RynthAi talks to the person it names ("questloot talk ...") or, on a hand-in ("Return the
|
||||
// collar to Xsao"), gives them the quest's items got so far ("questloot handin ..."). Inside a dungeon
|
||||
// (2026-11-07) RynthAi walks the dungeon's map instead of RynthNav: to a step's coordinates ("questloot
|
||||
// dungeon goto"), or all over it for a step that names none ("dungeon patrol"), fighting, looting the quest's
|
||||
// items and opening doors (the quest's keys first on a locked one); a step that only takes you in ("Enter
|
||||
// the Keep") is done once you are in, and "dungeon stop" ends the walk when you come out or the run ends.
|
||||
// A step's place reached outdoors whose text enters something has RynthAi use the portal there ("dungeon
|
||||
// enter"). Since 2026-11-08 (the Acid Axe Quest, 09:01: it went to Suntik Village and stopped there): a step
|
||||
// that only travels ("Travel to Suntik Village at ...") is done on arrival; a step goes to the coordinates its
|
||||
// own words give, not the ones its notes name for another route ("Route 2: ... to 16.9N 3.5E"); a step that
|
||||
// gets items ("grab the Acid Axe on the ground") asks RynthAi which are carried ("questloot have ...": RynthAi
|
||||
// picks the rest up off corpses and the ground) and is done when RynthAi says it got them all ("Quest: got X"),
|
||||
// where the run already is when the step names no place; and entering a building isn't taking a portal.
|
||||
// Pump thread; no host calls here (the tests drive it with fake senders).
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal sealed class QuestRunner
|
||||
{
|
||||
/// <summary>RynthNav's "goto: arrived" line (RynthNavPlugin FinishGoto).</summary>
|
||||
internal const string ArrivedText = "goto: arrived";
|
||||
|
||||
private readonly Func<string, bool> _nav;
|
||||
private readonly Func<string, bool> _ai;
|
||||
private readonly Action<string> _print;
|
||||
private readonly List<string> _lootAdded = new();
|
||||
private bool _profileOn; // RynthAi switched to this quest's loot profile
|
||||
private List<string> _targets = new(); // the step's people and places (QuestNames)
|
||||
private bool _inDungeon; // the character is in a dungeon (OnWhere)
|
||||
private string _fallback = ""; // coordinates to go to when RynthNav knows none of the step's names
|
||||
private uint _dungeon; // the dungeon's landblock (OnWhere), 0 outdoors
|
||||
private string _wentTo = ""; // the coordinates RynthNav last went to outdoors
|
||||
/// <summary>The Town Network's landblock: a portal hub on RynthNav's routes, not a quest dungeon.</summary>
|
||||
internal const uint TownNetworkLandblock = 0x0007;
|
||||
private bool _dungeonWalk; // RynthAi walks the dungeon for the run
|
||||
private int _askedAt = -1; // the step RynthAi was asked about its items ("have")
|
||||
private bool _portalTried; // a travel step's place: its portal looked for once
|
||||
private readonly HashSet<string> _got = new(StringComparer.OrdinalIgnoreCase); // quest items RynthAi got this run (bare names)
|
||||
private bool _insideAsk; // in a dungeon: RynthNav was asked which of the step's people is in it ("inside")
|
||||
private uint _insideCell; // RynthNav's arrival named the cell the step's person is in; walked to once inside
|
||||
|
||||
/// <summary>RynthAi walks a dungeon for the run (its map: a goto or the patrol).</summary>
|
||||
public bool DungeonWalk => _dungeonWalk;
|
||||
public bool InDungeon => _inDungeon;
|
||||
|
||||
/// <summary>What the last arrival had RynthAi do: "talk", "handin" or "" (for the view and the tests).</summary>
|
||||
public string LastNpc { get; private set; } = "";
|
||||
/// <summary>The current step's people and places.</summary>
|
||||
public IReadOnlyList<string> Targets => _targets;
|
||||
private Func<string, bool> _stampDone = _ => false;
|
||||
/// <summary>Player society when the run started (filters CH/EW/RB wiki alternatives).</summary>
|
||||
private SocietyStanding _society;
|
||||
|
||||
public GuideQuest? Quest { get; private set; }
|
||||
/// <summary>The step being done (index into Quest.Steps), -1 before the first.</summary>
|
||||
public int Step { get; private set; } = -1;
|
||||
/// <summary>Which of the step's places RynthNav is going to (0-based).</summary>
|
||||
public int Place { get; private set; }
|
||||
public bool Active => Quest != null;
|
||||
public bool Travelling { get; private set; }
|
||||
/// <summary>What the runner is doing, for the view.</summary>
|
||||
public string Note { get; private set; } = "";
|
||||
public int Revision { get; private set; }
|
||||
public IReadOnlyList<string> LootAdded => _lootAdded;
|
||||
|
||||
/// <param name="nav">Sends a RynthNav command ("go 28.5S, 90.9W", "stop"); false when RynthNav isn't there.</param>
|
||||
/// <param name="ai">Sends a RynthAi command ("questloot add X"); false when RynthAi isn't there.</param>
|
||||
/// <param name="print">A line to chat.</param>
|
||||
public QuestRunner(Func<string, bool> nav, Func<string, bool> ai, Action<string> print)
|
||||
{
|
||||
_nav = nav;
|
||||
_ai = ai;
|
||||
_print = print;
|
||||
}
|
||||
|
||||
/// <summary>A step is done when it has stamps and every one is held.</summary>
|
||||
public bool StepDone(GuideStep s)
|
||||
{
|
||||
if (s.Stamps.Count == 0) return false;
|
||||
foreach (string st in s.Stamps)
|
||||
if (!_stampDone(st)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts <paramref name="q"/> at its first step not done (from <paramref name="fromStep"/> when given).
|
||||
/// <paramref name="stampDone"/> says whether the character holds a stamp. With <paramref name="loot"/>, the
|
||||
/// quest's loot goes on RynthAi's quest loot list.
|
||||
/// <paramref name="society"/> picks Celestial Hand / Eldrytch Web / Radiant Blood NPCs, forts and
|
||||
/// stronghold portals when the wiki lists all three (otherwise the run loops on the wrong faction).
|
||||
/// </summary>
|
||||
public void Start(GuideQuest q, Func<string, bool> stampDone, bool loot, int fromStep = -1,
|
||||
SocietyStanding society = default)
|
||||
{
|
||||
if (Active) Stop("switched quests");
|
||||
_society = society;
|
||||
if (society.IsMember && SocietyQuestResolve.NeedsFilter(q))
|
||||
{
|
||||
q = SocietyQuestResolve.ForPlayer(q, society);
|
||||
_print($"Society run: using {society.SocietyName} ({SocietyQuestResolve.Code(society)}) portals and NPCs.");
|
||||
}
|
||||
else if (!society.IsMember && SocietyQuestResolve.NeedsFilter(q))
|
||||
_print("Society run: you are not in a society — wiki lists all three factions; join one (or pick the right portal yourself).");
|
||||
Quest = q;
|
||||
_got.Clear();
|
||||
_askedAt = -1;
|
||||
_portalTried = false;
|
||||
// A run starts at the quest's first part (2026-11-07): stamps already held (an earlier run of a
|
||||
// repeatable quest) don't finish its steps; only the ones this run gets do.
|
||||
var heldAtStart = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (GuideStep st in q.Steps)
|
||||
foreach (string stamp in st.Stamps)
|
||||
if (stampDone(stamp)) heldAtStart.Add(GuideStamp.Key(stamp));
|
||||
_stampDone = stamp => stampDone(stamp) && !heldAtStart.Contains(GuideStamp.Key(stamp));
|
||||
if (loot)
|
||||
{
|
||||
// The quest's items (its loot, and what the rewards say it hands in), then its loot profile, always:
|
||||
// with no items it is base-quest-dynamic alone (2026-11-07: the Female Tusker Tusk run built none).
|
||||
foreach (string it in QuestNames.RewardItems(q))
|
||||
if (!q.Loot.Exists(x => x.Equals(it, StringComparison.OrdinalIgnoreCase))) q.Loot.Add(it);
|
||||
AddLoot(q);
|
||||
_profileOn = _ai("profile " + ProfileLine(q));
|
||||
}
|
||||
Step = -1;
|
||||
if (fromStep >= 0 && fromStep < q.Steps.Count) { Step = fromStep; Place = 0; GoStep(); }
|
||||
else Advance(first: true);
|
||||
Changed();
|
||||
}
|
||||
|
||||
/// <summary>The quest's loot onto RynthAi's quest loot list (what was added comes off at the end).</summary>
|
||||
public int AddLoot(GuideQuest q)
|
||||
{
|
||||
int n = 0;
|
||||
foreach (string item in q.Loot)
|
||||
{
|
||||
if (_lootAdded.Contains(item)) continue;
|
||||
if (_ai("add " + item)) { _lootAdded.Add(item); n++; }
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
private void RemoveLoot()
|
||||
{
|
||||
if (_dungeonWalk) _ai("dungeon stop");
|
||||
_dungeonWalk = false;
|
||||
foreach (string item in _lootAdded) _ai("remove " + item);
|
||||
_lootAdded.Clear();
|
||||
if (_profileOn) _ai("profile off");
|
||||
_profileOn = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "<quest>|<item>|<item>...": the quest and its loot for RynthAi's quest loot profile
|
||||
/// ("questloot build ..." / "questloot profile ..."). A '|' in a name becomes '/'.
|
||||
/// </summary>
|
||||
public static string ProfileLine(GuideQuest q)
|
||||
{
|
||||
var parts = new List<string> { q.Title.Replace('|', '/') };
|
||||
foreach (string item in q.Loot) parts.Add(item.Replace('|', '/'));
|
||||
return string.Join("|", parts);
|
||||
}
|
||||
|
||||
/// <summary>Has RynthAi write the quest's loot profile (LootProfiles\Quests); false without RynthAi or loot.</summary>
|
||||
public bool BuildProfile(GuideQuest q) => _ai("build " + ProfileLine(q)); // no items: base-quest-dynamic alone
|
||||
|
||||
/// <summary>Next: the next place of this step, else the next step not done.</summary>
|
||||
public void Next()
|
||||
{
|
||||
if (Quest == null) return;
|
||||
if (Step >= 0 && Step < Quest.Steps.Count && Place + 1 < Places(Quest.Steps[Step]).Count)
|
||||
{
|
||||
Place++;
|
||||
GoPlace();
|
||||
}
|
||||
else Advance(first: false);
|
||||
Changed();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The step the player picked (2026-11-08: "click on the step you want to do vs using just next or back"):
|
||||
/// done or not, at its first place; RynthNav's trip to the old step stops.
|
||||
/// </summary>
|
||||
public void GoTo(int step)
|
||||
{
|
||||
if (Quest == null || step < 0 || step >= Quest.Steps.Count) return;
|
||||
if (Travelling) _nav("stop");
|
||||
Travelling = false;
|
||||
Step = step;
|
||||
Place = 0;
|
||||
_askedAt = -1;
|
||||
_print($"Quest run: step {step + 1}/{Quest.Steps.Count}.");
|
||||
GoStep();
|
||||
Changed();
|
||||
}
|
||||
|
||||
/// <summary>Back one step (done or not), at its first place.</summary>
|
||||
public void Back()
|
||||
{
|
||||
if (Quest == null || Step <= 0) return;
|
||||
Step--;
|
||||
Place = 0;
|
||||
GoStep();
|
||||
Changed();
|
||||
}
|
||||
|
||||
/// <summary>Goes to the current step's current place again (RynthNav stopped, the player wandered off).</summary>
|
||||
public void Again()
|
||||
{
|
||||
if (Quest == null) return;
|
||||
GoStep(keepPlace: true);
|
||||
Changed();
|
||||
}
|
||||
|
||||
public void Stop(string why = "stopped")
|
||||
{
|
||||
if (Quest == null) return;
|
||||
if (Travelling) _nav("stop");
|
||||
_print($"Quest run {why}: {Quest.Title}.");
|
||||
Travelling = false;
|
||||
RemoveLoot();
|
||||
Quest = null;
|
||||
Step = -1;
|
||||
Place = 0;
|
||||
Note = "";
|
||||
Changed();
|
||||
}
|
||||
|
||||
/// <summary>A chat line: a stamp (the step may be done) or RynthNav's arrival.</summary>
|
||||
public void OnChat(string line)
|
||||
{
|
||||
if (Quest == null) return;
|
||||
string? stamp = GuideStamp.FromChat(line);
|
||||
if (stamp != null)
|
||||
{
|
||||
CheckStep(GuideStamp.Key(stamp));
|
||||
return;
|
||||
}
|
||||
if (line.Contains(GotPrefix, StringComparison.Ordinal))
|
||||
{
|
||||
OnGot(line);
|
||||
return;
|
||||
}
|
||||
// No portal at a travel step's place after all: being there is the step.
|
||||
if (_portalTried && line.Contains("[RynthAi] Quest: no portal right here", StringComparison.Ordinal)
|
||||
&& Quest != null && Step >= 0 && Step < Quest.Steps.Count && !_inDungeon && TravelOnly(Quest, Step))
|
||||
{
|
||||
_portalTried = false;
|
||||
_print($"Step {Step + 1} done: you're there.");
|
||||
Advance(first: false);
|
||||
Changed();
|
||||
return;
|
||||
}
|
||||
if (_insideAsk && Travelling && line.Contains("[RynthNav] inside:", StringComparison.Ordinal))
|
||||
{
|
||||
// None of the step's people is in this dungeon (by the Atlas): walk it as before.
|
||||
_insideAsk = false;
|
||||
Travelling = false;
|
||||
GuideStep si = Quest.Steps[Step];
|
||||
if (!GoDungeon(Quest, si)) Note = $"Step {Step + 1}: {si.Text} (Next when done)";
|
||||
DoNpc();
|
||||
Changed();
|
||||
return;
|
||||
}
|
||||
if (Travelling && line.Contains("[RynthNav]", StringComparison.Ordinal) && line.Contains(ArrivedText, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Travelling = false;
|
||||
_insideAsk = false;
|
||||
GuideStep s = Quest.Steps[Step];
|
||||
// The step's person is inside a dungeon (RynthNav names the cell): RynthAi walks its map there, and the talk
|
||||
// or hand-in waits for them on the way (2026-11-11).
|
||||
uint cellIn = InsideCell(line);
|
||||
if (cellIn != 0)
|
||||
{
|
||||
_insideCell = cellIn;
|
||||
Note = $"Step {Step + 1}: {s.Text}";
|
||||
_print($"Step {Step + 1}/{Quest.Steps.Count}: {s.Text}");
|
||||
foreach (string n in s.Notes) _print(" " + n);
|
||||
if (_inDungeon) WalkToCell(Quest, s);
|
||||
else Note = $"Step {Step + 1}: in; walking to {string.Join(" or ", _targets)} once the dungeon loads";
|
||||
AskItems(s);
|
||||
Changed();
|
||||
return;
|
||||
}
|
||||
Note = $"Step {Step + 1}: here. {s.Text}";
|
||||
_print($"Step {Step + 1}/{Quest.Steps.Count}: {s.Text}");
|
||||
foreach (string n in s.Notes) _print(" " + n);
|
||||
DoNpc();
|
||||
if (_inDungeon)
|
||||
{
|
||||
// RynthNav's route ended inside (the step's place is in the dungeon): walk it as the step says.
|
||||
if (EntersOnly(s)) { _print($"Step {Step + 1} done: you're in."); Advance(first: false); }
|
||||
else GoDungeon(Quest, s);
|
||||
}
|
||||
// "Enter the Hidden Keep at ...", "Take the portal to ...": the portal at the step's place takes you in.
|
||||
else if (GoesIn(Quest, Step)) _ai("dungeon enter" + PortalHint(s, _society));
|
||||
// The step's place is a dungeon's portal and the next step is inside it (2026-11-10, "the route isn't
|
||||
// going in the portal"): a portal right there is taken; the step ends in the dungeon (OnWhere).
|
||||
else if (TravelOnly(Quest, Step) && NextInside(Quest, Step) && !_portalTried)
|
||||
{
|
||||
_portalTried = true;
|
||||
_ai("dungeon enter near" + PortalHint(s, _society));
|
||||
Changed();
|
||||
return;
|
||||
}
|
||||
// "Travel to Suntik Village at ...": being there is the step (2026-11-08: the run stopped there).
|
||||
else if (TravelOnly(Quest, Step))
|
||||
{
|
||||
if (Place + 1 < Places(s).Count) { Place++; GoPlace(); }
|
||||
else { _print($"Step {Step + 1} done: you're there."); Advance(first: false); }
|
||||
Changed();
|
||||
return;
|
||||
}
|
||||
if (Quest != null && Step >= 0 && Step < Quest.Steps.Count && Quest.Steps[Step] == s) AskItems(s);
|
||||
Changed();
|
||||
}
|
||||
else if (Travelling && line.Contains("[RynthNav]", StringComparison.Ordinal)
|
||||
&& (line.Contains("none of these is a place on the map", StringComparison.OrdinalIgnoreCase)
|
||||
|| line.Contains("on the map", StringComparison.OrdinalIgnoreCase) && line.Contains("no place called", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
// RynthNav doesn't know where the step's names are: coordinates the quest gives elsewhere, else say so.
|
||||
Travelling = false;
|
||||
if (_fallback.Length > 0)
|
||||
{
|
||||
string at = _fallback;
|
||||
_fallback = "";
|
||||
if (Go(at, $"Step {Step + 1}: RynthNav doesn't know the name; going to {at}")) { Changed(); return; }
|
||||
}
|
||||
string who = _targets.Count > 0 ? string.Join(" or ", _targets) : "it";
|
||||
Note = $"Step {Step + 1}: RynthNav doesn't know where {who} is - go there yourself, then Again (to talk) or Next.";
|
||||
_print($"Step {Step + 1}/{Quest.Steps.Count}: {Quest.Steps[Step].Text}");
|
||||
DoNpc();
|
||||
Changed();
|
||||
}
|
||||
else if (Travelling && line.Contains("[RynthNav] goto:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// RynthNav gave up or was stopped: say so; Again tries once more.
|
||||
Travelling = false;
|
||||
Note = $"Step {Step + 1}: RynthNav {line.Substring(line.IndexOf("goto:", StringComparison.OrdinalIgnoreCase))} (Again tries once more).";
|
||||
Changed();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The flags changed (a /myquests read): the current step may be done.</summary>
|
||||
public void OnFlagsChanged() => CheckStep(null);
|
||||
|
||||
private void CheckStep(string? stampKey)
|
||||
{
|
||||
if (Quest == null || Step < 0 || Step >= Quest.Steps.Count) return;
|
||||
GuideStep s = Quest.Steps[Step];
|
||||
if (s.Stamps.Count == 0) return;
|
||||
bool mine = stampKey == null || s.Stamps.Exists(x => GuideStamp.Key(x) == stampKey);
|
||||
if (!mine) return;
|
||||
// The chat line comes before the flag list knows it: the stamp just seen counts.
|
||||
bool done = true;
|
||||
foreach (string st in s.Stamps)
|
||||
if (GuideStamp.Key(st) != stampKey && !_stampDone(st)) { done = false; break; }
|
||||
if (!done) return;
|
||||
_print($"Step {Step + 1} done.");
|
||||
Advance(first: false);
|
||||
Changed();
|
||||
}
|
||||
|
||||
private void Advance(bool first)
|
||||
{
|
||||
GuideQuest q = Quest!;
|
||||
int i = Step + 1;
|
||||
while (i < q.Steps.Count && StepDone(q.Steps[i])) i++;
|
||||
if (i >= q.Steps.Count)
|
||||
{
|
||||
if (first && q.Steps.Count > 0) _print($"Every step of {q.Title} is stamped already.");
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
Step = i;
|
||||
Place = 0;
|
||||
GoStep();
|
||||
}
|
||||
|
||||
private void Finish()
|
||||
{
|
||||
GuideQuest q = Quest!;
|
||||
_print($"Quest run done: {q.Title}." + (q.ExtraStamps.Count > 0 ? " (The wiki lists more stamps: " + string.Join(", ", q.ExtraStamps) + ".)" : ""));
|
||||
Travelling = false;
|
||||
RemoveLoot();
|
||||
Quest = null;
|
||||
Step = -1;
|
||||
Note = "";
|
||||
}
|
||||
|
||||
private void GoStep(bool keepPlace = false)
|
||||
{
|
||||
GuideQuest q = Quest!;
|
||||
GuideStep s = q.Steps[Step];
|
||||
if (!keepPlace) Place = 0;
|
||||
_portalTried = false;
|
||||
_insideAsk = false;
|
||||
_insideCell = 0;
|
||||
_targets = QuestNames.TargetsAt(q, Step);
|
||||
_fallback = "";
|
||||
// In a dungeon, a step that happens outside it (a hand-in, "Return to ...") leaves it: the dungeon walk
|
||||
// stops and RynthNav takes the run there (2026-11-10: it kept fighting there after the last item).
|
||||
if (_inDungeon && HappensOutside(q, Step))
|
||||
{
|
||||
if (_dungeonWalk) { _ai("dungeon stop"); _dungeonWalk = false; }
|
||||
_print($"Step {Step + 1}: leaving the dungeon for it.");
|
||||
}
|
||||
else if (_inDungeon && _targets.Count > 0 && Places(s).Count == 0 && (QuestNames.IsHandIn(s) || QuestNames.IsTalk(q, s))
|
||||
&& _nav("inside " + string.Join(" || ", _targets)))
|
||||
{
|
||||
// The step's person may be in this dungeon (the Bur, a dungeon's quest giver, 2026-11-11): RynthNav says
|
||||
// which cell, and RynthAi walks there; not here, the dungeon is walked as before (OnChat).
|
||||
_insideAsk = true;
|
||||
Travelling = true;
|
||||
Note = $"Step {Step + 1}: looking for {string.Join(" or ", _targets)} in this dungeon";
|
||||
AskItems(s);
|
||||
return;
|
||||
}
|
||||
else if (_inDungeon && GoDungeon(q, s)) { AskItems(s); return; }
|
||||
// Items carried already (picked up by hand, an earlier run) finish the step before the trip.
|
||||
if (Places(s).Count > 0) { GoPlace(); AskItems(s); return; }
|
||||
// Coordinates in the step's own words ("Ollar at 71.4N, 28.6W"): there, before any name.
|
||||
// The same in the names it gives (the start place "A Renegade Stronghold at 71.4N, 28.6W").
|
||||
string? own0 = CoordsIn(s.Text) ?? s.Notes.Select(CoordsIn).FirstOrDefault(c => c != null)
|
||||
?? QuestNames.Candidates(q, s, Step == 0).Select(CoordsIn).FirstOrDefault(c => c != null);
|
||||
if (own0 != null && Go(own0, $"Step {Step + 1}: going to {own0}")) { AskItems(s); return; }
|
||||
// "Enter the blacksmith building and grab the Acid Axe on the ground": no place of its own, so it is
|
||||
// where the run already is (the step before's place); the items are picked up there.
|
||||
if (Step > 0 && IsPickup(s) && !QuestNames.IsHandIn(s))
|
||||
{
|
||||
Travelling = false;
|
||||
Note = $"Step {Step + 1}: picking up {string.Join(", ", s.Items)} here (RynthAi's quest loot) - Next when done";
|
||||
_print($"Step {Step + 1}/{q.Steps.Count}: {s.Text}");
|
||||
foreach (string n in s.Notes) _print(" " + n);
|
||||
AskItems(s);
|
||||
return;
|
||||
}
|
||||
_fallback = FallbackCoords(q, Step) ?? "";
|
||||
// No coordinates: the people and places the step names, in order (RynthNav takes the first on its
|
||||
// Atlas; the first step adds the quest's start place).
|
||||
List<string> own = QuestNames.Candidates(q, s, Step == 0);
|
||||
if (own.Count > 0 && Go(string.Join(" || ", own), $"Step {Step + 1}: going to {string.Join(" or ", own)}"))
|
||||
{
|
||||
AskItems(s);
|
||||
return;
|
||||
}
|
||||
Travelling = false;
|
||||
Note = $"Step {Step + 1}: {s.Text} (Next when done)";
|
||||
_print($"Step {Step + 1}/{q.Steps.Count}: {s.Text}");
|
||||
foreach (string n in s.Notes) _print(" " + n);
|
||||
// Naming nobody ("Hand her each note"): the person of the step before, where the run already is.
|
||||
if (own.Count == 0) DoNpc();
|
||||
AskItems(s);
|
||||
}
|
||||
|
||||
/// <summary>RynthAi's line for a quest item got (RynthAiPlugin.QuestNpc.cs QuestGotPrefix).</summary>
|
||||
internal const string GotPrefix = "[RynthAi] Quest: got ";
|
||||
|
||||
/// <summary>
|
||||
/// A step that gets items and has no stamp to say it's done: RynthAi says which are carried already
|
||||
/// ("questloot have ..."); the rest come off corpses and the ground (the quest loot list).
|
||||
/// </summary>
|
||||
private void AskItems(GuideStep s)
|
||||
{
|
||||
if (s.Items.Count == 0 || QuestNames.IsHandIn(s) || _askedAt == Step) return;
|
||||
_askedAt = Step; // once a step: RynthAi's quest loot list does the rest
|
||||
_ai("have " + string.Join(" | ", s.Items.ConvertAll(i => i.Replace('|', '/'))));
|
||||
}
|
||||
|
||||
private bool Got(string item) => _got.Contains(BareItem(item));
|
||||
|
||||
/// <summary>"[RynthAi] Quest: got Acid Axe." / "... (already in your pack).": the step that wanted it may be done.</summary>
|
||||
private void OnGot(string line)
|
||||
{
|
||||
string name = line.Substring(line.IndexOf(GotPrefix, StringComparison.Ordinal) + GotPrefix.Length).Trim();
|
||||
if (name.EndsWith("(already in your pack).", StringComparison.OrdinalIgnoreCase))
|
||||
name = name.Substring(0, name.Length - "(already in your pack).".Length).Trim();
|
||||
name = name.TrimEnd('.').Trim();
|
||||
if (name.Length == 0) return;
|
||||
_got.Add(BareItem(name));
|
||||
if (Quest == null || Step < 0 || Step >= Quest.Steps.Count) return;
|
||||
GuideStep s = Quest.Steps[Step];
|
||||
// Every item of the step is in the pack: on to the next step, its stamp or not (2026-11-10: "when a quest
|
||||
// pickups the last loot item it should move to the next step vs keep fighting").
|
||||
if (s.Items.Count == 0 || QuestNames.IsHandIn(s) || !s.Items.TrueForAll(Got)) return;
|
||||
if (Travelling) { _nav("stop"); Travelling = false; }
|
||||
_print($"Step {Step + 1} done: you have {string.Join(", ", s.Items)}.");
|
||||
Advance(first: false);
|
||||
Changed();
|
||||
}
|
||||
|
||||
/// <summary>An item's name without a note in brackets at the end ("Darling's Collar (Quest Item)").</summary>
|
||||
internal static string BareItem(string name)
|
||||
{
|
||||
name = (name ?? "").Trim();
|
||||
int open = name.LastIndexOf(" (", StringComparison.Ordinal);
|
||||
return open > 0 && name.EndsWith(")", StringComparison.Ordinal) ? name.Substring(0, open).Trim() : name;
|
||||
}
|
||||
|
||||
// "Return to ...", "Bring ... to", a hand-in: done out of the dungeon.
|
||||
private static readonly System.Text.RegularExpressions.Regex OutsideRx = new(
|
||||
@"\b(?:return|returns|go\s+back|head\s+back|bring|deliver|turn\s+(?:it\s+|them\s+)?in|hand\s+(?:it\s+|them\s+)?in|give)\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// The step happens out of the dungeon the run is in: nothing to loot or kill there, nothing to go into, and
|
||||
/// it hands in or goes back somewhere ("Return to Xsao", "Bring the jaw to ..."), or only travels.
|
||||
/// </summary>
|
||||
internal static bool HappensOutside(GuideQuest q, int i)
|
||||
{
|
||||
if (i < 0 || i >= q.Steps.Count) return false;
|
||||
GuideStep s = q.Steps[i];
|
||||
if (GoesIn(s) || (s.Items.Count > 0 && !QuestNames.IsHandIn(s)) || QuestNames.KillRx.IsMatch(s.Text)) return false;
|
||||
return QuestNames.IsHandIn(s) || OutsideRx.IsMatch(s.Text) || TravelOnly(q, i);
|
||||
}
|
||||
|
||||
/// <summary>The step after <paramref name="i"/> is done inside a dungeon (its loot, its kills, further in).</summary>
|
||||
internal static bool NextInside(GuideQuest q, int i)
|
||||
{
|
||||
if (i + 1 >= q.Steps.Count) return false;
|
||||
GuideStep n = q.Steps[i + 1];
|
||||
// Not into a building ("Enter the blacksmith building and grab ...", the Acid Axe Quest): no portal there.
|
||||
return !HappensOutside(q, i + 1) && !IntoBuilding(n.Text)
|
||||
&& (QuestNames.KillRx.IsMatch(n.Text) || GoesIn(n) || (n.Items.Count > 0 && !QuestNames.IsHandIn(n)));
|
||||
}
|
||||
|
||||
/// <summary>A step that picks items up ("grab the Acid Axe on the ground", "pick up the note").</summary>
|
||||
internal static bool IsPickup(GuideStep s) =>
|
||||
s.Items.Count > 0 && System.Text.RegularExpressions.Regex.IsMatch(s.Text,
|
||||
@"\b(?:grab|grabs|pick(?:s|ed)?\s+(?:it\s+|them\s+)?up|pick|collect|gather|on\s+the\s+(?:ground|floor|table|shelf)|lying)\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// A step whose job is getting somewhere ("Travel to Suntik Village at 16.2N 4.3E."): no stamp, no item,
|
||||
/// nobody to talk to, nothing to go into. Done on arrival.
|
||||
/// </summary>
|
||||
internal static bool TravelOnly(GuideQuest q, int i)
|
||||
{
|
||||
if (i < 0 || i >= q.Steps.Count) return false;
|
||||
GuideStep s = q.Steps[i];
|
||||
return s.Stamps.Count == 0 && s.Items.Count == 0
|
||||
&& System.Text.RegularExpressions.Regex.IsMatch(s.Text, @"^\s*(?:travel|go|head|run|walk|journey|proceed|make\s+your\s+way)\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase)
|
||||
&& !GoesIn(q, i) && !QuestNames.IsTalk(q, s) && !QuestNames.IsHandIn(s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The places a step goes to: the coordinates its own words give ("Travel to Suntik Village at 16.2N 4.3E"),
|
||||
/// not the ones only its notes give for another way there ("Route 2: ... to 16.9N 3.5E"); all of them when
|
||||
/// its words give none.
|
||||
/// </summary>
|
||||
internal static List<string> Places(GuideStep s)
|
||||
{
|
||||
var inText = new List<string>();
|
||||
foreach (System.Text.RegularExpressions.Match m in CoordsRx.Matches(s.Text ?? ""))
|
||||
foreach (string c in s.Coords)
|
||||
if (SameCoords(c, m.Value) && !inText.Contains(c)) inText.Add(c);
|
||||
return inText.Count > 0 ? inText : s.Coords;
|
||||
}
|
||||
|
||||
private static readonly System.Text.RegularExpressions.Regex CoordsRx = new(@"(\d+(?:\.\d+)?)\s*([NnSs])[\s,]+(\d+(?:\.\d+)?)\s*([EeWw])");
|
||||
|
||||
/// <summary>
|
||||
/// The character is in a dungeon (<paramref name="inDungeon"/>) or not: the plugin's tick says so. Going in
|
||||
/// during the run: a step that only takes you in is done, and the step is walked with the dungeon's map.
|
||||
/// Coming out: the dungeon walk ends.
|
||||
/// </summary>
|
||||
public void OnWhere(bool inDungeon) => OnWhere(inDungeon, inDungeon ? 1u : 0u);
|
||||
|
||||
/// <summary>
|
||||
/// As above, with the dungeon's landblock: a portal from one dungeon into another (17:29 on 11-07, into
|
||||
/// Abayar's Laboratory) walks the step again in the new one, not on the old one's route.
|
||||
/// </summary>
|
||||
public void OnWhere(bool inDungeon, uint landblock)
|
||||
{
|
||||
uint was = _dungeon;
|
||||
_dungeon = inDungeon ? landblock : 0;
|
||||
if (inDungeon == _inDungeon)
|
||||
{
|
||||
if (inDungeon && was != 0 && was != landblock && Quest != null && !Travelling && Step >= 0 && Step < Quest.Steps.Count)
|
||||
{
|
||||
if (_dungeonWalk) { _ai("dungeon stop"); _dungeonWalk = false; }
|
||||
GoStep(keepPlace: true);
|
||||
Changed();
|
||||
}
|
||||
return;
|
||||
}
|
||||
_inDungeon = inDungeon;
|
||||
if (Quest == null) return;
|
||||
// RynthNav is still on its way (its route may pass through a dungeon): its arrival decides.
|
||||
if (Travelling) { Changed(); return; }
|
||||
if (!inDungeon)
|
||||
{
|
||||
if (_dungeonWalk) { _ai("dungeon stop"); _dungeonWalk = false; }
|
||||
Changed();
|
||||
return;
|
||||
}
|
||||
Travelling = false;
|
||||
GuideQuest q = Quest;
|
||||
if (_insideCell != 0 && Step >= 0 && Step < q.Steps.Count && _insideCell >> 16 == landblock)
|
||||
{
|
||||
WalkToCell(q, q.Steps[Step]);
|
||||
Changed();
|
||||
return;
|
||||
}
|
||||
if (Step >= 0 && Step < q.Steps.Count && (EntersOnly(q.Steps[Step]) || (TravelOnly(q, Step) && NextInside(q, Step))))
|
||||
{
|
||||
_print($"Step {Step + 1} done: you're in.");
|
||||
Advance(first: false);
|
||||
}
|
||||
else if (Step >= 0 && Step < q.Steps.Count) GoStep(keepPlace: true);
|
||||
Changed();
|
||||
}
|
||||
|
||||
/// <summary>A step whose job is going in ("Enter the Keep", "Take the portal to ..."): no stamp, no item.</summary>
|
||||
internal static bool EntersOnly(GuideStep s) =>
|
||||
s.Stamps.Count == 0 && s.Items.Count == 0 && !IntoBuilding(s.Text)
|
||||
&& System.Text.RegularExpressions.Regex.IsMatch(s.Text, @"\b(?:enter|enters|portal|dungeon|go\s+(?:in|inside|down)|head\s+(?:in|inside|down)|teleport)\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// A step that goes in by a portal, whether or not it also wants a stamp or an item ("Take the portal to
|
||||
/// the Hidden Keep and kill ...", "Enter the dungeon at ..."): at its place the nearest portal is used.
|
||||
/// </summary>
|
||||
internal static bool GoesIn(GuideStep s) =>
|
||||
System.Text.RegularExpressions.Regex.IsMatch(s.Text, @"\b(?:enter|enters|portal|dungeon|go\s+(?:in|inside|down)|head\s+(?:in|inside|down)|teleport)\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase)
|
||||
&& !IntoBuilding(s.Text);
|
||||
|
||||
/// <summary>
|
||||
/// "Enter the blacksmith building and ...": walking into a building (its door), not a portal; unless the
|
||||
/// step also says portal or dungeon.
|
||||
/// </summary>
|
||||
internal static bool IntoBuilding(string text) =>
|
||||
System.Text.RegularExpressions.Regex.IsMatch(text ?? "",
|
||||
@"\benters?\s+(?:the\s+|a\s+|an\s+)?(?:[\p{L}'’\-]+\s+){0,3}?(?:building|house|shop|hut|inn|tavern|cottage|cabin|store|smithy|forge|home|tent|room|bank|temple|chapel|church|mansion|manor)\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase)
|
||||
&& !System.Text.RegularExpressions.Regex.IsMatch(text ?? "", @"\b(?:portal|dungeon|teleport)\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Step <paramref name="i"/> goes in by a portal: it says so, its place is a dungeon by name ("Head to the
|
||||
/// Tusker Burrow at ..."), or the next step happens in a dungeon ("... at the end of the dungeon").
|
||||
/// </summary>
|
||||
internal static bool GoesIn(GuideQuest q, int i)
|
||||
{
|
||||
if (i < 0 || i >= q.Steps.Count) return false;
|
||||
GuideStep s = q.Steps[i];
|
||||
if (GoesIn(s) || DungeonPlaceRx.IsMatch(s.Text)) return true;
|
||||
return i + 1 < q.Steps.Count && System.Text.RegularExpressions.Regex.IsMatch(q.Steps[i + 1].Text,
|
||||
@"\b(?:dungeon|inside|in\s+the\s+(?:burrow|cave|caverns?|crypt|mines?|catacombs?|lair|tomb|sewers?|warren|vault|grotto|barrow|labyrinth))\b",
|
||||
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
||||
private static readonly System.Text.RegularExpressions.Regex DungeonPlaceRx = new(
|
||||
@"\b(?:Burrow|Cave|Caverns?|Crypt|Mines?|Catacombs?|Lair|Tomb|Sewers?|Warren|Vault|Grotto|Barrow|Labyrinth|Dungeon|Hive|Den|Pit|Halls?)\b",
|
||||
System.Text.RegularExpressions.RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>
|
||||
/// " <words>" naming the portal the step means (its capitalised words), for RynthAi to prefer; "" when none.
|
||||
/// With a society membership, faction/society stronghold steps prefer that society's stronghold name words
|
||||
/// so Town Network's three "Stronghold" portals don't loop on the wrong one.
|
||||
/// </summary>
|
||||
internal static string PortalHint(GuideStep s, SocietyStanding society = default)
|
||||
{
|
||||
string societyHint = SocietyQuestResolve.PortalHintExtra(s, society);
|
||||
if (societyHint.Length > 0) return societyHint;
|
||||
|
||||
var words = new List<string>();
|
||||
foreach (System.Text.RegularExpressions.Match m in System.Text.RegularExpressions.Regex.Matches(s.Text, @"\b[A-Z][a-z'\-]{2,}\b"))
|
||||
{
|
||||
string w = m.Value;
|
||||
if (w is "Enter" or "Take" or "The" or "Use" or "Go" or "Head" or "Portal" or "Dungeon" or "Then" or "Kill" or "Talk" or "Find" or "Return"
|
||||
or "Faction" or "Society" or "Your" or "Speak" or "Once" or "Several") continue;
|
||||
if (!words.Contains(w)) words.Add(w);
|
||||
}
|
||||
return words.Count == 0 ? "" : " " + string.Join(" || ", words);
|
||||
}
|
||||
|
||||
/// <summary>"71.4N, 28.6W" from text that has coordinates, else null.</summary>
|
||||
internal static string? CoordsIn(string? text)
|
||||
{
|
||||
var m = System.Text.RegularExpressions.Regex.Match(text ?? "", @"(\d+(?:\.\d+)?)\s*([NnSs])[\s,]+(\d+(?:\.\d+)?)\s*([EeWw])");
|
||||
return m.Success ? $"{m.Groups[1].Value}{char.ToUpperInvariant(m.Groups[2].Value[0])}, {m.Groups[3].Value}{char.ToUpperInvariant(m.Groups[4].Value[0])}" : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Where to go when RynthNav knows none of a step's names: the quest's start place for the first step,
|
||||
/// else the last place of the nearest step before it, else the start place (null: none known).
|
||||
/// </summary>
|
||||
internal static string? FallbackCoords(GuideQuest q, int step)
|
||||
{
|
||||
string? start = CoordsIn(q.StartsAt);
|
||||
if (step == 0 && start != null) return start;
|
||||
for (int i = step - 1; i >= 0; i--)
|
||||
{
|
||||
GuideStep p = q.Steps[i];
|
||||
List<string> pl = Places(p);
|
||||
if (pl.Count > 0) return CoordsIn(pl[^1]) ?? pl[^1];
|
||||
string? inText = CoordsIn(p.Text);
|
||||
if (inText != null) return inText;
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The step inside a dungeon: RynthAi walks its map, to the step's coordinates, else all over it
|
||||
/// (fighting, looting, doors). False when RynthAi isn't there.
|
||||
/// </summary>
|
||||
/// <summary>"... (Drogur is in cell 009C0270)" at the end of RynthNav's arrival line: that cell, else 0.</summary>
|
||||
internal static uint InsideCell(string line)
|
||||
{
|
||||
var m = System.Text.RegularExpressions.Regex.Match(line ?? "", @" is in cell ([0-9A-Fa-f]{8})\)");
|
||||
return m.Success ? uint.Parse(m.Groups[1].Value, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture) : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inside, to the cell RynthNav named: RynthAi walks the dungeon's map there (fighting, doors, the quest's keys),
|
||||
/// and the step's talk or hand-in is sent at once; RynthAi keeps looking for the person while it walks.
|
||||
/// </summary>
|
||||
private void WalkToCell(GuideQuest q, GuideStep s)
|
||||
{
|
||||
uint cell = _insideCell;
|
||||
_insideCell = 0;
|
||||
string keys = string.Join("", QuestKeys(q).ConvertAll(k => " | " + k));
|
||||
if (_ai($"dungeon to {cell:X8}{keys}"))
|
||||
{
|
||||
_dungeonWalk = true;
|
||||
Note = $"Step {Step + 1}: walking the dungeon to {string.Join(" or ", _targets)} (cell {cell:X8})";
|
||||
}
|
||||
DoNpc();
|
||||
}
|
||||
|
||||
private bool GoDungeon(GuideQuest q, GuideStep s)
|
||||
{
|
||||
string keys = string.Join("", QuestKeys(q).ConvertAll(k => " | " + k));
|
||||
string cmd;
|
||||
string note;
|
||||
// The step's own coordinates that RynthNav took it to outdoors are the way in, not a place inside.
|
||||
List<string> places = Places(s);
|
||||
string here = places.Count > 0 ? places[Math.Clamp(Place, 0, places.Count - 1)] : "";
|
||||
bool entrance = here.Length > 0 && SameCoords(here, _wentTo);
|
||||
if (!entrance && here.Length > 0 && TrySignedCoords(here, out double ns, out double ew))
|
||||
{
|
||||
cmd = $"dungeon goto {ns.ToString("0.###", System.Globalization.CultureInfo.InvariantCulture)} {ew.ToString("0.###", System.Globalization.CultureInfo.InvariantCulture)}{keys}";
|
||||
note = $"Step {Step + 1}: walking the dungeon to {here} (fighting, looting, doors)";
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "dungeon patrol" + keys;
|
||||
note = $"Step {Step + 1}: patrolling the dungeon (fighting, looting the quest's items, doors) - the stamp or Next moves on";
|
||||
}
|
||||
if (!_ai(cmd)) return false;
|
||||
_dungeonWalk = true;
|
||||
Travelling = false;
|
||||
Note = note;
|
||||
_print($"Step {Step + 1}/{q.Steps.Count}: {s.Text}");
|
||||
foreach (string n in s.Notes) _print(" " + n);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>The quest's keys (its items named key or keyring), for locked doors.</summary>
|
||||
internal static List<string> QuestKeys(GuideQuest q)
|
||||
{
|
||||
var keys = new List<string>();
|
||||
void Add(string it)
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(it, @"(?<![\p{L}])(?:key|keys|keyring)(?![\p{L}])", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
|
||||
&& !keys.Exists(k => k.Equals(it, StringComparison.OrdinalIgnoreCase))) keys.Add(it.Replace('|', '/'));
|
||||
}
|
||||
foreach (string it in q.Loot) Add(it);
|
||||
foreach (GuideStep st in q.Steps) foreach (string it in st.Items) Add(it);
|
||||
return keys;
|
||||
}
|
||||
|
||||
/// <summary>"28.5S, 90.9W" as signed numbers: north and east positive.</summary>
|
||||
internal static bool TrySignedCoords(string text, out double ns, out double ew)
|
||||
{
|
||||
ns = ew = 0;
|
||||
var m = System.Text.RegularExpressions.Regex.Match(text ?? "",
|
||||
@"(\d+(?:\.\d+)?)\s*([NnSs])[\s,]+(\d+(?:\.\d+)?)\s*([EeWw])");
|
||||
if (!m.Success) return false;
|
||||
var inv = System.Globalization.CultureInfo.InvariantCulture;
|
||||
ns = double.Parse(m.Groups[1].Value, inv) * (char.ToUpperInvariant(m.Groups[2].Value[0]) == 'S' ? -1 : 1);
|
||||
ew = double.Parse(m.Groups[3].Value, inv) * (char.ToUpperInvariant(m.Groups[4].Value[0]) == 'W' ? -1 : 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// At the step's place: a hand-in step gives the quest's items got so far to the person it names, a step
|
||||
/// that talks ("Talk to", "find", the quest's own people) talks to them (RynthAi, "questloot talk|handin").
|
||||
/// </summary>
|
||||
private void DoNpc()
|
||||
{
|
||||
GuideQuest q = Quest!;
|
||||
if (Step < 0 || Step >= q.Steps.Count || _targets.Count == 0) return;
|
||||
GuideStep s = q.Steps[Step];
|
||||
string names = string.Join(" || ", _targets);
|
||||
if (QuestNames.IsHandIn(s))
|
||||
{
|
||||
List<string> items = QuestNames.HandInItems(q, Step);
|
||||
_ai("handin " + names + (items.Count > 0 ? " | " + string.Join(" | ", items) : ""));
|
||||
LastNpc = "handin";
|
||||
}
|
||||
else if (QuestNames.IsTalk(q, s))
|
||||
{
|
||||
_ai("talk " + names);
|
||||
LastNpc = "talk";
|
||||
}
|
||||
else LastNpc = "";
|
||||
}
|
||||
|
||||
private void GoPlace()
|
||||
{
|
||||
List<string> places = Places(Quest!.Steps[Step]);
|
||||
string c = places[Math.Clamp(Place, 0, places.Count - 1)];
|
||||
string more = places.Count > 1 ? $" (place {Place + 1} of {places.Count})" : "";
|
||||
Go(c, $"Step {Step + 1}: going to {c}{more}");
|
||||
}
|
||||
|
||||
/// <summary>Two coordinate texts within 0.5 of each other on both axes.</summary>
|
||||
internal static bool SameCoords(string a, string b) =>
|
||||
TrySignedCoords(a, out double an, out double ae) && TrySignedCoords(b, out double bn, out double be)
|
||||
&& Math.Abs(an - bn) <= 0.5 && Math.Abs(ae - be) <= 0.5;
|
||||
|
||||
private bool Go(string target, string note)
|
||||
{
|
||||
if (!_inDungeon && TrySignedCoords(target, out _, out _)) _wentTo = target;
|
||||
if (_nav("go " + target))
|
||||
{
|
||||
Travelling = true;
|
||||
Note = note;
|
||||
return true;
|
||||
}
|
||||
Travelling = false;
|
||||
Note = note + " - RynthNav isn't loaded: walk there yourself, then Next.";
|
||||
return false;
|
||||
}
|
||||
|
||||
private void Changed() => Revision++;
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
// ServerGuideClient.cs - The active server's own wiki quest guide (2026-11-21): "RynthServer.QuestGuide"
|
||||
// (Plugins/Shared/RynthServerQuestGuideApi.cs) from the plugin RynthCore names as the server's owner, e.g.
|
||||
// RynthConquest's Conquest wiki quests. Its info JSON has RynthILT's guide info's shape, so a QuestGuideClient
|
||||
// takes it (Take) and reads the guide file when it changed. RynthOracle names no server: whatever guide the
|
||||
// active server's plugin offers is used (OracleContext.Wiki merges it over the AC Community Wiki's).
|
||||
// Pump thread.
|
||||
using System.Text;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal sealed unsafe class ServerGuideClient
|
||||
{
|
||||
private const long PollMs = 2000;
|
||||
private const long RequeryMs = 10_000;
|
||||
|
||||
private RynthServerQuestGuideApiV1* _table;
|
||||
private string _owner = "";
|
||||
private long _nextPollAt, _nextQueryAt;
|
||||
private readonly byte[] _buffer = new byte[4096];
|
||||
|
||||
/// <summary>The guide as read (its Guide, Status, Tag, Revision).</summary>
|
||||
public readonly QuestGuideClient Client = new() { FeedsDynamicStamps = false };
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_table = null;
|
||||
_owner = "";
|
||||
_nextPollAt = _nextQueryAt = 0;
|
||||
Client.Clear();
|
||||
}
|
||||
|
||||
public void Poll(RynthCoreHost host, string owner, long now)
|
||||
{
|
||||
if (now < _nextPollAt) return;
|
||||
_nextPollAt = now + PollMs;
|
||||
if (owner != _owner)
|
||||
{
|
||||
_owner = owner;
|
||||
_table = null;
|
||||
_nextQueryAt = 0;
|
||||
Client.Clear();
|
||||
}
|
||||
if (owner.Length == 0) return;
|
||||
if (_table != null && _table->Version == 0) { _table = null; _nextQueryAt = 0; }
|
||||
if (_table == null)
|
||||
{
|
||||
if (now < _nextQueryAt || !host.HasGetPluginInterface) return;
|
||||
_nextQueryAt = now + RequeryMs;
|
||||
var p = (RynthServerQuestGuideApiV1*)host.GetPluginInterface(owner, RynthServerQuestGuideApiV1.InterfaceName, RynthServerQuestGuideApiV1.InterfaceVersion);
|
||||
if (p == null || p->Version < 1 || p->StructSize < (uint)sizeof(RynthServerQuestGuideApiV1) || p->GetGuideInfoJson == null) return;
|
||||
_table = p;
|
||||
}
|
||||
string json;
|
||||
fixed (byte* b = _buffer)
|
||||
{
|
||||
int len = _table->GetGuideInfoJson(b, _buffer.Length);
|
||||
json = len > 0 && len < _buffer.Length ? Encoding.UTF8.GetString(_buffer, 0, len) : "";
|
||||
}
|
||||
if (json.Length == 0)
|
||||
{
|
||||
if (Client.Guide.Quests.Count > 0 || Client.Available) Client.Clear();
|
||||
return;
|
||||
}
|
||||
Client.Take(json);
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,13 @@ internal sealed class ServerIdentity
|
|||
public bool Known => WorldName.Length > 0 || ServerId.Length > 0;
|
||||
public int Revision { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// RynthCore's active server is Infinite Leaftide (EngineServerState.IltId). Gates the rows and
|
||||
/// reads that only that server has: the Dynamic Stamps and Temple guardian rows of the Quests
|
||||
/// tab, RynthILT's /qb list and guardian data, and the Dynamic stamp source log line.
|
||||
/// </summary>
|
||||
public bool IsIlt => string.Equals(ServerId, EngineServerState.IltId, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>The active server's name for the player: its name, its id, or "no server".</summary>
|
||||
public string DisplayName => ServerName.Length > 0 ? ServerName : ServerId.Length > 0 ? ServerId : "no server";
|
||||
|
||||
|
|
|
|||
212
Plugins/RynthCore.Plugin.RynthOracle/Data/SocietyQuestResolve.cs
Normal file
212
Plugins/RynthCore.Plugin.RynthOracle/Data/SocietyQuestResolve.cs
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
// Society quest wiki pages list all three factions (CH / EW / RB NPCs, forts, strongholds).
|
||||
// Running one without picking the player's society sends RynthNav / portal-enter at the wrong
|
||||
// faction forever (Town Network's three "Stronghold" portals, Palm Fort's three coords, …).
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Filters a society wiki quest down to the player's Celestial Hand / Eldrytch Web / Radiant Blood
|
||||
/// alternatives before QuestRunner walks it.
|
||||
/// </summary>
|
||||
internal static class SocietyQuestResolve
|
||||
{
|
||||
// "Aldrion of the Celestial Hand (CH)", "92.1S, 50.3W (CH)", "… (Eldrytch Web)".
|
||||
private static readonly Regex TaggedRx = new(
|
||||
@"(?<body>(?:\d+(?:\.\d+)?\s*[NnSs][\s,]+\d+(?:\.\d+)?\s*[EeWw]|[^()]+?))\s*\((?<tag>CH|EW|RB|Celestial\s+Hand|Eldrytch\s+Web|Radiant\s+Blood)\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex CoordsRx = new(
|
||||
@"(\d+(?:\.\d+)?)\s*([NnSs])[\s,]+(\d+(?:\.\d+)?)\s*([EeWw])",
|
||||
RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex StrongholdPlaceRx = new(
|
||||
@"\b(?:your\s+)?(?:faction|society)\s+stronghold\b|\bsociety\s+chapterhouse\b|\bfaction\s+stronghold\b",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
/// <summary>"CH", "EW", "RB", or "" when not in a society.</summary>
|
||||
public static string Code(SocietyStanding s) => s.SocietyName switch
|
||||
{
|
||||
"Celestial Hand" => "CH",
|
||||
"Eldrytch Web" => "EW",
|
||||
"Radiant Blood" => "RB",
|
||||
_ => "",
|
||||
};
|
||||
|
||||
/// <summary>"Celestial Hand Stronghold" (empty when not a member).</summary>
|
||||
public static string StrongholdName(SocietyStanding s) =>
|
||||
s.IsMember ? s.SocietyName + " Stronghold" : "";
|
||||
|
||||
/// <summary>True when the wiki page is a society quest or its start lists CH/EW/RB alternatives.</summary>
|
||||
public static bool NeedsFilter(GuideQuest q) =>
|
||||
q.SocietyRank.Length > 0
|
||||
|| TaggedRx.IsMatch(q.StartsWith ?? "")
|
||||
|| TaggedRx.IsMatch(q.StartsAt ?? "")
|
||||
|| StrongholdPlaceRx.IsMatch(q.StartsAt ?? "")
|
||||
|| q.Steps.Exists(st => StrongholdPlaceRx.IsMatch(st.Text ?? "") || TaggedRx.IsMatch(st.Text ?? ""));
|
||||
|
||||
/// <summary>
|
||||
/// A copy of <paramref name="q"/> with only this player's society NPCs / coords / stronghold name.
|
||||
/// Unchanged when not a member or the quest has no faction alternatives.
|
||||
/// </summary>
|
||||
public static GuideQuest ForPlayer(GuideQuest q, SocietyStanding s)
|
||||
{
|
||||
if (!s.IsMember || !NeedsFilter(q)) return q;
|
||||
|
||||
string code = Code(s);
|
||||
string stronghold = StrongholdName(s);
|
||||
var copy = new GuideQuest
|
||||
{
|
||||
Title = q.Title,
|
||||
Url = q.Url,
|
||||
Rev = q.Rev,
|
||||
Level = q.Level,
|
||||
RecommendedLevel = q.RecommendedLevel,
|
||||
Type = q.Type,
|
||||
KillTask = q.KillTask,
|
||||
StartsWith = FilterTaggedParts(q.StartsWith, code, s.SocietyName),
|
||||
StartsAt = FilterStartsAt(q.StartsAt, code, s.SocietyName, stronghold),
|
||||
Route = q.Route,
|
||||
Repeat = q.Repeat,
|
||||
RepeatSec = q.RepeatSec,
|
||||
TimeToComplete = q.TimeToComplete,
|
||||
Contracts = q.Contracts,
|
||||
Qb = q.Qb,
|
||||
SocietyRank = q.SocietyRank,
|
||||
Categories = new List<string>(q.Categories),
|
||||
Overview = q.Overview,
|
||||
ExtraStamps = new List<string>(q.ExtraStamps),
|
||||
Loot = new List<string>(q.Loot),
|
||||
Rewards = new List<string>(q.Rewards),
|
||||
};
|
||||
|
||||
// Coords tagged in StartsAt map which of a step's untagged list belongs to this society.
|
||||
var societyCoords = TaggedCoords(q.StartsAt, code, s.SocietyName);
|
||||
foreach (GuideStep st in q.Steps)
|
||||
{
|
||||
copy.Steps.Add(new GuideStep
|
||||
{
|
||||
Text = RewriteStrongholdText(st.Text, stronghold),
|
||||
Notes = st.Notes.ConvertAll(n => RewriteStrongholdText(n, stronghold)),
|
||||
Coords = FilterStepCoords(st.Coords, societyCoords, st.Text, code, s.SocietyName),
|
||||
Stamps = new List<string>(st.Stamps),
|
||||
Items = new List<string>(st.Items),
|
||||
});
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extra portal-name words for RynthAi's "dungeon enter": the player's stronghold when the step
|
||||
/// says faction/society stronghold (Town Network has three portals all named "Stronghold").
|
||||
/// </summary>
|
||||
public static string PortalHintExtra(GuideStep s, SocietyStanding standing)
|
||||
{
|
||||
if (!standing.IsMember) return "";
|
||||
if (!StrongholdPlaceRx.IsMatch(s.Text ?? "")
|
||||
&& !StrongholdPlaceRx.IsMatch(string.Join(" ", s.Notes)))
|
||||
return "";
|
||||
// Full society name words + Stronghold so scoring prefers "Celestial Hand Stronghold" over the others.
|
||||
return " " + string.Join(" || ", standing.SocietyName.Split(' ', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Concat(new[] { "Stronghold" }));
|
||||
}
|
||||
|
||||
private static string FilterStartsAt(string startsAt, string code, string societyName, string stronghold)
|
||||
{
|
||||
string raw = startsAt ?? "";
|
||||
if (raw.Length == 0) return raw;
|
||||
if (StrongholdPlaceRx.IsMatch(raw) && !TaggedRx.IsMatch(raw))
|
||||
{
|
||||
// "Faction Stronghold (east wing)" → "Celestial Hand Stronghold (east wing)".
|
||||
string wing = "";
|
||||
var m = Regex.Match(raw, @"\(([^)]+)\)");
|
||||
if (m.Success) wing = " (" + m.Groups[1].Value.Trim() + ")";
|
||||
return stronghold + wing;
|
||||
}
|
||||
string filtered = FilterTaggedParts(raw, code, societyName);
|
||||
return filtered.Length > 0 ? filtered : raw;
|
||||
}
|
||||
|
||||
/// <summary>Keep only "(CH)" / "(EW)" / "(RB)" (or full society-name) segments for this player.</summary>
|
||||
private static string FilterTaggedParts(string text, string code, string societyName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text) || code.Length == 0) return text ?? "";
|
||||
var kept = new List<string>();
|
||||
foreach (Match m in TaggedRx.Matches(text))
|
||||
{
|
||||
if (!TagMatches(m.Groups["tag"].Value, code, societyName)) continue;
|
||||
string body = m.Groups["body"].Value.Trim().TrimStart(':', '-', ' ');
|
||||
if (body.Length > 0) kept.Add(body);
|
||||
}
|
||||
if (kept.Count == 0) return text; // no tags → leave alone (single-society page)
|
||||
return string.Join(" / ", kept);
|
||||
}
|
||||
|
||||
private static List<string> TaggedCoords(string startsAt, string code, string societyName)
|
||||
{
|
||||
var list = new List<string>();
|
||||
if (string.IsNullOrWhiteSpace(startsAt) || code.Length == 0) return list;
|
||||
foreach (Match m in TaggedRx.Matches(startsAt))
|
||||
{
|
||||
if (!TagMatches(m.Groups["tag"].Value, code, societyName)) continue;
|
||||
Match c = CoordsRx.Match(m.Groups["body"].Value);
|
||||
if (c.Success) list.Add(NormalizeCoords(c));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<string> FilterStepCoords(List<string> coords, List<string> societyCoords,
|
||||
string stepText, string code, string societyName)
|
||||
{
|
||||
if (coords == null || coords.Count == 0) return new List<string>();
|
||||
|
||||
// Coords written with a tag in the step text itself.
|
||||
var fromText = new List<string>();
|
||||
foreach (Match m in TaggedRx.Matches(stepText ?? ""))
|
||||
{
|
||||
if (!TagMatches(m.Groups["tag"].Value, code, societyName)) continue;
|
||||
Match c = CoordsRx.Match(m.Groups["body"].Value);
|
||||
if (c.Success)
|
||||
{
|
||||
string n = NormalizeCoords(c);
|
||||
if (coords.Exists(x => SameCoords(x, n))) fromText.Add(coords.First(x => SameCoords(x, n)));
|
||||
}
|
||||
}
|
||||
if (fromText.Count > 0) return fromText;
|
||||
|
||||
// Palm Fort: step lists all three forts; StartsAt tags say which is ours.
|
||||
if (societyCoords.Count > 0)
|
||||
{
|
||||
var matched = coords.Where(c => societyCoords.Exists(sc => SameCoords(c, sc))).ToList();
|
||||
if (matched.Count > 0) return matched;
|
||||
}
|
||||
|
||||
return new List<string>(coords);
|
||||
}
|
||||
|
||||
private static string RewriteStrongholdText(string text, string stronghold)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text) || stronghold.Length == 0) return text ?? "";
|
||||
return StrongholdPlaceRx.Replace(text, stronghold);
|
||||
}
|
||||
|
||||
private static bool TagMatches(string tag, string code, string societyName)
|
||||
{
|
||||
tag = (tag ?? "").Trim();
|
||||
if (tag.Equals(code, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
return tag.Equals(societyName, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static string NormalizeCoords(Match m) =>
|
||||
$"{m.Groups[1].Value}{char.ToUpperInvariant(m.Groups[2].Value[0])}, {m.Groups[3].Value}{char.ToUpperInvariant(m.Groups[4].Value[0])}";
|
||||
|
||||
private static bool SameCoords(string a, string b)
|
||||
{
|
||||
Match ma = CoordsRx.Match(a ?? ""), mb = CoordsRx.Match(b ?? "");
|
||||
if (!ma.Success || !mb.Success) return false;
|
||||
return string.Equals(NormalizeCoords(ma), NormalizeCoords(mb), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,12 +6,14 @@ using System.Reflection;
|
|||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal readonly record struct SpellInfo(string Name, double Duration, bool IsDebuff);
|
||||
/// <summary>A spell from SpellData.txt. <see cref="Category"/> is ACE's SpellCategory (the stacking family), <see cref="Power"/> its difficulty.</summary>
|
||||
internal readonly record struct SpellInfo(string Name, double Duration, bool IsDebuff, int Category = 0, int Power = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Spell names and base durations from RynthAi's embedded spell table (SpellData.txt, linked
|
||||
/// into this plugin): tab separated, id, name, category, family, words, duration (s, -1 none),
|
||||
/// difficulty, then three flags, the second of which marks a debuff. Loaded on first use.
|
||||
/// difficulty, then three flags, the second of which marks a debuff. Loaded on first use. The
|
||||
/// Gear tab falls back to it (category, power) when the client's portal.dat can't be read.
|
||||
/// </summary>
|
||||
internal static class SpellTable
|
||||
{
|
||||
|
|
@ -46,7 +48,9 @@ internal static class SpellTable
|
|||
if (c.Length < 2 || !uint.TryParse(c[0].Trim(), NumberStyles.None, CultureInfo.InvariantCulture, out uint id)) continue;
|
||||
double duration = c.Length > 5 && double.TryParse(c[5].Trim(), NumberStyles.Float | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out double d) ? d : -1;
|
||||
bool debuff = c.Length > 8 && c[8].Trim().Equals("True", StringComparison.OrdinalIgnoreCase);
|
||||
map[id] = new SpellInfo(c[1].Trim(), duration, debuff);
|
||||
int category = c.Length > 2 && int.TryParse(c[2].Trim(), NumberStyles.None, CultureInfo.InvariantCulture, out int cat) ? cat : 0;
|
||||
int power = c.Length > 6 && int.TryParse(c[6].Trim(), NumberStyles.None, CultureInfo.InvariantCulture, out int pw) ? pw : 0;
|
||||
map[id] = new SpellInfo(c[1].Trim(), duration, debuff, category, power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
272
Plugins/RynthCore.Plugin.RynthOracle/Data/T11Tracking.cs
Normal file
272
Plugins/RynthCore.Plugin.RynthOracle/Data/T11Tracking.cs
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
// The T11 Tracking tab's data (Infinite Leaftide, ACECustom upstream to 8d2460ff2, read 2026-11-11):
|
||||
// * item bounties: the character's slots R1 R2 B1 B2 from PropertyString 57702 ItemBountyDisplay, which the server keeps
|
||||
// current on the client ("v2|R1,R2,B1,B2;R1|tier|kind|progress|kills|target|rewardWcid|amount|icon|overlay|underlay|
|
||||
// bountyName|rewardName|rewardUse|placeShort|placeName;B2|empty"), and bounty items carried, not yet applied (their
|
||||
// description: "... Use it on a ring or bracelet you have to start it");
|
||||
// * the levelled charms (1-100, T11+): their level and the Prestige Coins put in, from the charm's appraisal ("Charm [Level
|
||||
// 41 (95% to 42)]", "Prestige Coins put in: 14,210 - next level in 46"), and the Charm Infusion Gems carried (one gem
|
||||
// puts its number of coins in: Charm Infusion Gem (1) ... (5,000));
|
||||
// * the school gems (T15-T25, +1 to a school past the cap): Battlemage's Wrath (war), Nether Veil (void), Crashing Steel
|
||||
// (melee), True Shot (missile), with the tier each was earned at (PropertyInt 50651 EarnedGemTier) when the client has it;
|
||||
// * the lum tokens the bank takes from the pack: the ten Bounty Reward Tokens and the Event Lum Tokens (1B / 3B / 5B).
|
||||
|
||||
/// <summary>One item bounty slot (R1, R2, B1, B2) as ItemBountyDisplay gives it.</summary>
|
||||
internal sealed record ItemBountySlot(string Key, bool Empty, int Tier, int Kind, double Progress, int Kills, string Target,
|
||||
uint RewardWcid, int RewardAmount, string Name, string RewardName, string RewardUse, string PlaceShort, string PlaceName)
|
||||
{
|
||||
/// <summary>Kind 1: any kill in the place counts. Kind 2 (Species): only <see cref="Target"/>.</summary>
|
||||
public bool Species => Kind == 2;
|
||||
|
||||
/// <summary>Kills still needed (0 when the count is hidden or done).</summary>
|
||||
public double Left => Kills > 0 ? Math.Max(0, Kills - Progress) : 0;
|
||||
|
||||
/// <summary>How far along, 0-1 (0 when the kill count is a mystery until the bounty is applied).</summary>
|
||||
public float Fraction => Kills > 0 ? (float)Math.Clamp(Progress / Kills, 0, 1) : 0f;
|
||||
|
||||
/// <summary>"Kill 250 Banderlings in Tier 15", "Kill 400 creatures in Valley of Death".</summary>
|
||||
public string Task => $"Kill {(Kills > 0 ? Kills.ToString("N0", CultureInfo.InvariantCulture) : "?")} {(Species && Target.Length > 0 ? Target : "creatures")} in {(PlaceName.Length > 0 ? PlaceName : "Tier " + Tier)}";
|
||||
|
||||
/// <summary>"5 x Bounty Reward Token" (or the reward's name alone for one).</summary>
|
||||
public string Reward => RewardName.Length == 0 ? "" : RewardAmount > 1 ? $"{RewardAmount:N0} x {RewardName}" : RewardName;
|
||||
}
|
||||
|
||||
/// <summary>A carried item the tab counts: what it is, how many, and what its appraisal says.</summary>
|
||||
internal sealed record T11Item(uint Id, uint Wcid, string Name, int Stack, string Use, string Desc, int GemTier);
|
||||
|
||||
/// <summary>A levelled charm carried, with its level from the appraisal.</summary>
|
||||
internal sealed record LevelledCharmRow(uint Id, string Name, int Level, int PercentToNext, long CoinsIn, long CoinsToNext, bool Active, bool Known);
|
||||
|
||||
internal static class T11Tracking
|
||||
{
|
||||
/// <summary>PropertyString ItemBountyDisplay on the player.</summary>
|
||||
public const uint StrItemBountyDisplay = 57702;
|
||||
/// <summary>PropertyInt EarnedGemTier on a school gem.</summary>
|
||||
public const uint IntEarnedGemTier = 50651;
|
||||
|
||||
/// <summary>The slot keys, in the order /bounty lists them.</summary>
|
||||
public static readonly string[] SlotKeys = { "R1", "R2", "B1", "B2" };
|
||||
|
||||
/// <summary>Charm Infusion Gems (777700089-097): the coins one gem puts into a levelled charm.</summary>
|
||||
public static readonly IReadOnlyDictionary<uint, int> InfusionGems = new Dictionary<uint, int>
|
||||
{
|
||||
[777700089] = 1, [777700090] = 5, [777700091] = 10, [777700092] = 25, [777700093] = 50,
|
||||
[777700094] = 100, [777700095] = 500, [777700096] = 1_000, [777700097] = 5_000,
|
||||
};
|
||||
|
||||
/// <summary>The school gems (SchoolGems.cs): one per school, reused at every tier.</summary>
|
||||
public static readonly (uint Wcid, string School, string Kind)[] SchoolGems =
|
||||
{
|
||||
(777700052, "Battlemage's Wrath", "War"),
|
||||
(777700057, "Nether Veil", "Void"),
|
||||
(777700062, "Crashing Steel", "Melee"),
|
||||
(777700067, "True Shot", "Missile"),
|
||||
};
|
||||
|
||||
/// <summary>The levelled charms (777700035-040): level 1-100, T11+ only.</summary>
|
||||
public static readonly IReadOnlyDictionary<uint, string> LevelledCharms = new Dictionary<uint, string>
|
||||
{
|
||||
[777700035] = "Split Arrow", [777700036] = "Chain", [777700037] = "Pandemic",
|
||||
[777700038] = "Improved Cleave", [777700039] = "Armor Breaker", [777700040] = "Shield Arc",
|
||||
};
|
||||
|
||||
/// <summary>The lum tokens the bank takes from the pack (a double click banks one): Bounty Reward Tokens and Event Lum Tokens.</summary>
|
||||
public static bool IsLumToken(uint wcid) => wcid is >= 777708001 and <= 777708010 or 99980076 or 99980078 or 99980079;
|
||||
|
||||
/// <summary>An unapplied bounty item: its description ends with how to start it.</summary>
|
||||
public static bool IsBountyItem(string desc) =>
|
||||
desc.Contains("Use it on a ring or bracelet", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// ItemBountyDisplay ("v2|R1,R2,B1,B2;R1|...;B2|empty") as slots; empty for no text, another format version, or junk.
|
||||
/// Fields past the ones known are ignored, missing trailing ones are blank.
|
||||
/// </summary>
|
||||
public static List<ItemBountySlot> ParseDisplay(string? text)
|
||||
{
|
||||
var list = new List<ItemBountySlot>();
|
||||
if (string.IsNullOrWhiteSpace(text)) return list;
|
||||
string[] parts = text.Split(';');
|
||||
string[] head = parts[0].Split('|');
|
||||
if (head.Length < 1 || !head[0].StartsWith("v", StringComparison.Ordinal)) return list;
|
||||
for (int i = 1; i < parts.Length; i++)
|
||||
{
|
||||
string[] f = parts[i].Split('|');
|
||||
if (f.Length < 2 || f[0].Length == 0) continue;
|
||||
string key = f[0].Trim();
|
||||
if (f[1] == "empty") { list.Add(new ItemBountySlot(key, true, 0, 0, 0, 0, "", 0, 0, "", "", "", "", "")); continue; }
|
||||
string F(int n) => n < f.Length ? f[n] : "";
|
||||
int I(int n) => int.TryParse(F(n), NumberStyles.Integer, CultureInfo.InvariantCulture, out int v) ? v : 0;
|
||||
double progress = double.TryParse(F(3), NumberStyles.Float, CultureInfo.InvariantCulture, out double p) ? p : 0;
|
||||
uint reward = uint.TryParse(F(6), NumberStyles.Integer, CultureInfo.InvariantCulture, out uint r) ? r : 0;
|
||||
list.Add(new ItemBountySlot(key, false, I(1), I(2), progress, I(4), F(5), reward, I(7), F(11), F(12), F(13), F(14), F(15)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static readonly Regex LevelText = new(@"Charm \[Level (\d+)(?: \((\d+)% to \d+\)| \(max\))?", RegexOptions.CultureInvariant);
|
||||
private static readonly Regex CoinsText = new(@"Prestige Coins put in: ([\d,]+)(?: - next level in ([\d,]+))?", RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>A levelled charm's appraisal: level, share to the next, coins put in, coins to the next; Known false without the text.</summary>
|
||||
public static (int Level, int Pct, long Coins, long ToNext, bool Known) ParseCharm(string text)
|
||||
{
|
||||
var m = LevelText.Match(text ?? "");
|
||||
if (!m.Success) return (0, 0, 0, 0, false);
|
||||
int level = int.Parse(m.Groups[1].Value, CultureInfo.InvariantCulture);
|
||||
int pct = m.Groups[2].Success ? int.Parse(m.Groups[2].Value, CultureInfo.InvariantCulture) : 0;
|
||||
var c = CoinsText.Match(text ?? "");
|
||||
long coins = c.Success ? long.Parse(c.Groups[1].Value.Replace(",", ""), CultureInfo.InvariantCulture) : 0;
|
||||
long next = c.Success && c.Groups[2].Success ? long.Parse(c.Groups[2].Value.Replace(",", ""), CultureInfo.InvariantCulture) : 0;
|
||||
return (level, pct, coins, next, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads what the T11 Tracking tab shows from the client: the packs (two levels deep, as AC nests them) and the player's
|
||||
/// bounty slots. Items whose appraisal the tab needs (charms, school gems, bounty items) and the client doesn't have yet are
|
||||
/// asked about, a few at a time and not again for a while. Pump thread.
|
||||
/// </summary>
|
||||
internal sealed class T11Scanner
|
||||
{
|
||||
private const long IdSpacingMs = 400, ReaskMs = 60_000;
|
||||
private readonly Dictionary<uint, long> _askedAt = new();
|
||||
private readonly Queue<uint> _idQueue = new();
|
||||
private long _nextIdAt;
|
||||
|
||||
public List<ItemBountySlot> Slots { get; private set; } = new();
|
||||
public List<T11Item> Infusion { get; private set; } = new();
|
||||
public List<T11Item> SchoolGems { get; private set; } = new();
|
||||
public List<T11Item> Bounties { get; private set; } = new();
|
||||
public List<T11Item> LumTokens { get; private set; } = new();
|
||||
public List<LevelledCharmRow> Charms { get; private set; } = new();
|
||||
/// <summary>The player's raw ItemBountyDisplay ("" when the server never sent it).</summary>
|
||||
public string BountyText { get; private set; } = "";
|
||||
public long ScannedAt { get; private set; } = -1;
|
||||
/// <summary>Goes up when anything the tab shows changed.</summary>
|
||||
public int Revision { get; private set; }
|
||||
private string _lastKey = "";
|
||||
|
||||
public long InfusionCoins => Infusion.Sum(g => (long)g.Stack * (T11Tracking.InfusionGems.TryGetValue(g.Wcid, out int c) ? c : 0));
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Slots = new(); Infusion = new(); SchoolGems = new(); Bounties = new(); LumTokens = new(); Charms = new();
|
||||
BountyText = ""; ScannedAt = -1; _lastKey = ""; _askedAt.Clear(); _idQueue.Clear();
|
||||
Revision++;
|
||||
}
|
||||
|
||||
/// <summary>Reads everything again; true when something changed.</summary>
|
||||
public bool Scan(RynthCoreHost host, long now, Func<uint, bool>? charmActive = null)
|
||||
{
|
||||
uint player = host.GetPlayerId();
|
||||
if (player == 0) return false;
|
||||
ScannedAt = now;
|
||||
string bounty = host.HasGetObjectStringProperty && host.TryGetObjectStringProperty(player, T11Tracking.StrItemBountyDisplay, out string b) ? b ?? "" : "";
|
||||
var infusion = new List<T11Item>();
|
||||
var gems = new List<T11Item>();
|
||||
var items = new List<T11Item>();
|
||||
var tokens = new List<T11Item>();
|
||||
var charms = new List<LevelledCharmRow>();
|
||||
foreach (uint id in Carried(host, player))
|
||||
{
|
||||
if (!host.HasGetObjectWcid || !host.TryGetObjectWcid(id, out uint wcid)) continue;
|
||||
bool infusionGem = T11Tracking.InfusionGems.ContainsKey(wcid);
|
||||
bool schoolGem = Array.Exists(T11Tracking.SchoolGems, g => g.Wcid == wcid);
|
||||
bool charm = T11Tracking.LevelledCharms.ContainsKey(wcid);
|
||||
bool token = T11Tracking.IsLumToken(wcid);
|
||||
string desc = Str(host, id, 16);
|
||||
bool bountyItem = !infusionGem && !schoolGem && !charm && !token && T11Tracking.IsBountyItem(desc);
|
||||
if (!infusionGem && !schoolGem && !charm && !token && !bountyItem)
|
||||
{
|
||||
// a bounty item the client hasn't been told about yet: a name with "Bounty" in it is asked about
|
||||
if (desc.Length == 0 && Name(host, id).Contains("Bounty", StringComparison.OrdinalIgnoreCase) && !Name(host, id).Contains("Token", StringComparison.OrdinalIgnoreCase))
|
||||
Ask(id, now);
|
||||
continue;
|
||||
}
|
||||
string use = Str(host, id, 14);
|
||||
int stack = host.TryGetObjectIntProperty(id, 12, out int st) && st > 0 ? st : 1;
|
||||
int tier = host.TryGetObjectIntProperty(id, T11Tracking.IntEarnedGemTier, out int t) ? t : 0;
|
||||
var item = new T11Item(id, wcid, Name(host, id), stack, use, desc, tier);
|
||||
if (infusionGem) infusion.Add(item);
|
||||
else if (schoolGem) { gems.Add(item); if (use.Length == 0 && desc.Length == 0) Ask(id, now); }
|
||||
else if (token) tokens.Add(item);
|
||||
else if (bountyItem) items.Add(item);
|
||||
else
|
||||
{
|
||||
var (level, pct, coins, next, known) = T11Tracking.ParseCharm(use.Length > 0 ? use : desc);
|
||||
if (!known) Ask(id, now);
|
||||
bool active = (use + desc).Contains("Status: ON", StringComparison.OrdinalIgnoreCase) || charmActive?.Invoke(id) == true;
|
||||
charms.Add(new LevelledCharmRow(id, T11Tracking.LevelledCharms[wcid], level, pct, coins, next, active, known));
|
||||
}
|
||||
}
|
||||
infusion.Sort((a, x) => a.Wcid.CompareTo(x.Wcid));
|
||||
gems.Sort((a, x) => a.Wcid != x.Wcid ? a.Wcid.CompareTo(x.Wcid) : a.GemTier.CompareTo(x.GemTier));
|
||||
charms.Sort((a, x) => string.CompareOrdinal(a.Name, x.Name));
|
||||
|
||||
string key = string.Join("#", bounty,
|
||||
string.Join(",", infusion.Select(i => i.Wcid + "x" + i.Stack)),
|
||||
string.Join(",", gems.Select(i => i.Id + "x" + i.Stack + "t" + i.GemTier)),
|
||||
string.Join(",", items.Select(i => i.Id + i.Desc)),
|
||||
string.Join(",", tokens.Select(i => i.Wcid + "x" + i.Stack)),
|
||||
string.Join(",", charms.Select(c => c.Id + ":" + c.Level + ":" + c.PercentToNext + ":" + c.CoinsIn + ":" + c.Active)));
|
||||
if (key == _lastKey) return false;
|
||||
_lastKey = key;
|
||||
BountyText = bounty;
|
||||
Slots = T11Tracking.ParseDisplay(bounty);
|
||||
Infusion = infusion; SchoolGems = gems; Bounties = items; LumTokens = tokens; Charms = charms;
|
||||
Revision++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>One queued appraisal request, spaced out (pump thread, each tick).</summary>
|
||||
public void Tick(RynthCoreHost host, long now)
|
||||
{
|
||||
if (_idQueue.Count == 0 || now < _nextIdAt || !host.HasRequestId) return;
|
||||
host.RequestId(_idQueue.Dequeue());
|
||||
_nextIdAt = now + IdSpacingMs;
|
||||
}
|
||||
|
||||
/// <summary>Forgets when the items were asked about, so Refresh asks again at once.</summary>
|
||||
public void ForgetAsked() => _askedAt.Clear();
|
||||
|
||||
private void Ask(uint id, long now)
|
||||
{
|
||||
if (_askedAt.TryGetValue(id, out long at) && now - at < ReaskMs) return;
|
||||
_askedAt[id] = now;
|
||||
_idQueue.Enqueue(id);
|
||||
}
|
||||
|
||||
private static string Str(RynthCoreHost host, uint id, uint key) =>
|
||||
host.HasGetObjectStringProperty && host.TryGetObjectStringProperty(id, key, out string s) ? s ?? "" : "";
|
||||
|
||||
private static string Name(RynthCoreHost host, uint id) => host.TryGetObjectName(id, out string n) ? n ?? "" : "";
|
||||
|
||||
/// <summary>Every item in the main pack and the packs inside it.</summary>
|
||||
private static List<uint> Carried(RynthCoreHost host, uint player)
|
||||
{
|
||||
var list = new List<uint>();
|
||||
var buf = new uint[512];
|
||||
var packs = new List<uint>();
|
||||
int n = host.GetContainerContents(player, buf);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
uint id = buf[i];
|
||||
if (id == 0) continue;
|
||||
if (host.TryGetItemType(id, out uint type) && (type & GearAnalysis.ItemContainer) != 0) packs.Add(id);
|
||||
else list.Add(id);
|
||||
}
|
||||
foreach (uint pack in packs)
|
||||
{
|
||||
int m = host.GetContainerContents(pack, buf);
|
||||
for (int i = 0; i < m; i++) if (buf[i] != 0) list.Add(buf[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
665
Plugins/RynthCore.Plugin.RynthOracle/Data/WikiQuestParser.cs
Normal file
665
Plugins/RynthCore.Plugin.RynthOracle/Data/WikiQuestParser.cs
Normal file
|
|
@ -0,0 +1,665 @@
|
|||
// Reads an Infinite Leaftide wiki quest page (MediaWiki wikitext, leaftidewiki.com) into a GuideQuest
|
||||
// (QuestGuide.cs), 2026-11-01. Pure text work: RynthILT fetches the pages (its WikiFeed) and the offline
|
||||
// tests feed it the sample pages. Linked into RynthILT.
|
||||
//
|
||||
// The pages look like this (the two samples the player sent, "Pistol" Pete Trophy Hunts and
|
||||
// Mistreated Virindi):
|
||||
// {{Leaftide Content}}
|
||||
// {{Quest Summary | Level = 180+ | Recommended Level = 275+ | Quest Type = Solo/Fellowship
|
||||
// | Starts With = [[Mistreated Virindi]] | Starts At = [[Zaikhal]] | Repeat Timer = 20 Hours | QB = ... }}
|
||||
// == Overview == (also "== Discord Description ==")
|
||||
// == Walkthrough & Notes == either numbered steps: # Talk to ... with #* {{stamped|Sneaky_Virindi}}
|
||||
// or plain paragraphs, one per task, with the stamps listed apart:
|
||||
// == QB Stamps == {{stamped|NephriteTooth}} ...
|
||||
// == Rewards == {{Rewards Table | Quest Task = {{Itemlink|X}} | Item Reward = * {{Icon Link|Y}} (x80) }}
|
||||
// == Images == / == Dialog == / == Update History ==
|
||||
// [[Category:Enlightened Coin Quests]]
|
||||
// Coordinates are written every which way ("28.5S, 90.9W", "62.7s 66.6W", "85.8s,78.8w"): NavTargets reads them.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
internal static class WikiQuestParser
|
||||
{
|
||||
public const string WikiBase = "https://www.leaftidewiki.com/";
|
||||
|
||||
/// <summary>
|
||||
/// This reader's version, saved in the guide (QuestGuide.Parser). Raise it when the reader changes what
|
||||
/// it takes from a page: RynthILT then reads every page again, not only the ones edited since.
|
||||
/// 2: stamps cut to the flag ("X on first completion"), kill tasks, the Kill Tasks category and the
|
||||
/// Dynamic Stamps page (2026-11-21).
|
||||
/// </summary>
|
||||
public const int Version = 2;
|
||||
|
||||
/// <summary>The wiki's page of Dynamic Stamps (2026-11-21).</summary>
|
||||
public const string DynamicStampsPage = "Dynamic Stamps";
|
||||
/// <summary>The wiki's list of kill tasks (2026-11-21; the page "Kill Tasks" redirects here).</summary>
|
||||
public const string KillTasksCategory = "Category:Kill Tasks";
|
||||
|
||||
private static readonly Regex DynStampRx = new(@"\{\{\s*stamped\s*\|\s*(Dynamic_[^}|]+?)\s*\}\}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
private static readonly Regex Heading3Rx = new(@"^\s*===\s*([^=].*?)\s*===\s*$", RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>
|
||||
/// The Dynamic Stamps page (2026-11-21): "== Network ==" headings, "=== [[Town]] ===" under them, each with
|
||||
/// a table "Name | Coordinates | Stamp | Item Reward | Notes" (cells one per line, or on one line split by
|
||||
/// "||"). "==Miscellaneous stamps==" has one table whose Notes say where. Rows without a Dynamic_ stamp
|
||||
/// ("NO STAMP", "?") are left out, and so is "==Original Unsorted List==" (stamps without an NPC). Each
|
||||
/// stamp once, first row wins. Area is the town (the heading's shown text), or "Miscellaneous".
|
||||
/// </summary>
|
||||
public static List<GuideDynStamp> ParseDynamicStamps(string? wikitext)
|
||||
{
|
||||
var list = new List<GuideDynStamp>();
|
||||
if (string.IsNullOrEmpty(wikitext)) return list;
|
||||
string text = CommentRx.Replace(wikitext, "").Replace("\r\n", "\n").Replace('\r', '\n');
|
||||
var seen = new HashSet<string>(StringComparer.Ordinal);
|
||||
string network = "", town = "";
|
||||
bool inTable = false, unsorted = false;
|
||||
var cells = new List<string>();
|
||||
|
||||
void Row()
|
||||
{
|
||||
if (cells.Count == 0 || unsorted) { cells.Clear(); return; }
|
||||
string stampCell = cells.Count > 2 ? cells[2] : string.Join(" ", cells);
|
||||
Match m = DynStampRx.Match(stampCell);
|
||||
if (!m.Success) m = DynStampRx.Match(string.Join(" ", cells));
|
||||
if (m.Success)
|
||||
{
|
||||
string stamp = m.Groups[1].Value.Trim();
|
||||
if (seen.Add(stamp.ToLowerInvariant()))
|
||||
{
|
||||
bool misc = network.StartsWith("Misc", StringComparison.OrdinalIgnoreCase);
|
||||
string notes = cells.Count > 4 ? Clean(cells[4]) : "";
|
||||
string area = misc ? "Miscellaneous" : town.Length > 0 ? town : network;
|
||||
list.Add(new GuideDynStamp
|
||||
{
|
||||
Area = area,
|
||||
Place = misc ? notes : area,
|
||||
Npc = cells.Count > 0 ? Clean(cells[0]) : "",
|
||||
Coords = cells.Count > 1 ? NavTargets.FirstCoords(Clean(cells[1])) ?? Clean(cells[1]) : "",
|
||||
Stamp = stamp,
|
||||
Reward = cells.Count > 3 ? Clean(cells[3]) : "",
|
||||
Note = misc ? "" : notes,
|
||||
});
|
||||
}
|
||||
}
|
||||
cells.Clear();
|
||||
}
|
||||
|
||||
foreach (string raw in text.Split('\n'))
|
||||
{
|
||||
string line = raw.TrimEnd();
|
||||
Match h3 = Heading3Rx.Match(line);
|
||||
if (h3.Success) { Row(); town = Clean(h3.Groups[1].Value); continue; }
|
||||
Match h2 = HeadingRx.Match(line);
|
||||
if (h2.Success)
|
||||
{
|
||||
Row();
|
||||
network = Clean(h2.Groups[1].Value);
|
||||
town = "";
|
||||
unsorted = network.Contains("Unsorted", StringComparison.OrdinalIgnoreCase);
|
||||
continue;
|
||||
}
|
||||
string t = line.TrimStart();
|
||||
if (t.StartsWith("{|", StringComparison.Ordinal)) { inTable = true; cells.Clear(); continue; }
|
||||
if (!inTable) continue;
|
||||
if (t.StartsWith("|}", StringComparison.Ordinal)) { Row(); inTable = false; continue; }
|
||||
if (t.StartsWith("|-", StringComparison.Ordinal)) { Row(); continue; }
|
||||
if (t.StartsWith('!')) continue;
|
||||
if (t.StartsWith('|'))
|
||||
foreach (string c in t.Substring(1).Split("||")) cells.Add(c.Trim());
|
||||
else if (cells.Count > 0)
|
||||
cells[^1] += " " + t;
|
||||
}
|
||||
Row();
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>A contract's item page (2026-11-21, the AC Community Wiki): the {{Item}} box and a contract's name or category.</summary>
|
||||
public static bool IsContractPage(string title, string? wikitext) =>
|
||||
!string.IsNullOrEmpty(wikitext) && wikitext.IndexOf("{{Item", StringComparison.OrdinalIgnoreCase) >= 0
|
||||
&& (title.StartsWith("Contract for ", StringComparison.OrdinalIgnoreCase)
|
||||
|| wikitext.IndexOf("[[Category:Contracts", StringComparison.OrdinalIgnoreCase) >= 0);
|
||||
|
||||
private static readonly Regex FirstLinkRx = new(@"\[\[([^\[\]|#]+)(?:\|[^\[\]]*)?\]\]", RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>
|
||||
/// A contract's item page (2026-11-21): {{Intro | Related Quests = [[Aerbax's Citadel]]}}, {{Item | Name, Description,
|
||||
/// Recommended Level}}, and the notes' "Purchased from [[Hanadi the Barkeeper]] in the Sho hall ...".
|
||||
/// </summary>
|
||||
public static GuideContract ParseContract(string title, string wikitext, long rev = 0, string? wikiBase = null)
|
||||
{
|
||||
string text = RefRx.Replace(CommentRx.Replace(wikitext ?? "", ""), "").Replace("\r\n", "\n").Replace('\r', '\n');
|
||||
var c = new GuideContract { Title = title.Trim(), Url = UrlOf(title.Trim(), wikiBase), Rev = rev };
|
||||
Dictionary<string, string> item = TemplateParams(text, "Item");
|
||||
Dictionary<string, string> intro = TemplateParams(text, "Intro");
|
||||
string name = Clean(Param(item, "Name"));
|
||||
c.Name = name.Length > 0 ? name : c.Title;
|
||||
c.Description = Clean(Param(item, "Description"));
|
||||
c.Level = Clean(Param(item, "Recommended Level", "Level"));
|
||||
foreach (Match m in FirstLinkRx.Matches(Param(intro, "Related Quests", "Related Quest", "Quest")))
|
||||
{
|
||||
string t = m.Groups[1].Value.Trim().TrimStart(':');
|
||||
if (t.Length > 0 && !c.Quests.Contains(t)) c.Quests.Add(t);
|
||||
}
|
||||
foreach (var (heading, lines) in Sections(text))
|
||||
{
|
||||
if (!heading.StartsWith("note", StringComparison.OrdinalIgnoreCase)) continue;
|
||||
foreach (string l in lines)
|
||||
{
|
||||
if (l.IndexOf("purchase", StringComparison.OrdinalIgnoreCase) < 0 && l.IndexOf("sold by", StringComparison.OrdinalIgnoreCase) < 0
|
||||
&& l.IndexOf("given by", StringComparison.OrdinalIgnoreCase) < 0 && l.IndexOf("from [[", StringComparison.OrdinalIgnoreCase) < 0) continue;
|
||||
c.Where = Clean(l.TrimStart('*', '#', ':', ' '));
|
||||
Match m = FirstLinkRx.Match(l);
|
||||
if (m.Success) c.Npc = Clean("[[" + m.Groups[1].Value + "]]");
|
||||
break;
|
||||
}
|
||||
if (c.Where.Length > 0) break;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>The page is a quest page (it has the Quest Summary box).</summary>
|
||||
public static bool IsQuestPage(string? wikitext) =>
|
||||
!string.IsNullOrEmpty(wikitext) && wikitext.IndexOf("{{Quest Summary", StringComparison.OrdinalIgnoreCase) >= 0;
|
||||
|
||||
/// <summary>The page's address on the wiki.</summary>
|
||||
public static string UrlOf(string title, string? wikiBase = null) =>
|
||||
(wikiBase ?? WikiBase) + Uri.EscapeDataString(title.Replace(' ', '_')).Replace("%2F", "/");
|
||||
|
||||
private static readonly Regex CommentRx = new(@"<!--.*?-->", RegexOptions.Singleline | RegexOptions.CultureInvariant);
|
||||
private static readonly Regex RefRx = new(@"<ref[^>/]*/>|<ref[^>]*>.*?</ref>", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
private static readonly Regex HeadingRx = new(@"^\s*==\s*([^=].*?)\s*==\s*$", RegexOptions.CultureInvariant);
|
||||
private static readonly Regex StampRx = new(@"\{\{\s*stamped\s*\|\s*([^}|]+?)\s*\}\}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
private static readonly Regex ItemRx = new(@"\{\{\s*Item\s*link\s*\|\s*([^}|]+?)\s*(?:\|[^}]*)?\}\}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
private static readonly Regex CategoryRx = new(@"\[\[\s*Category\s*:\s*([^\]|]+?)\s*(?:\|[^\]]*)?\]\]", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>Reads a quest page. <paramref name="title"/> is the page's title; <paramref name="rev"/> its revision id (0 unknown).</summary>
|
||||
public static GuideQuest Parse(string title, string wikitext, long rev = 0, string? wikiBase = null)
|
||||
{
|
||||
var q = new GuideQuest { Title = title.Trim(), Url = UrlOf(title.Trim(), wikiBase), Rev = rev };
|
||||
string text = RefRx.Replace(CommentRx.Replace(wikitext ?? "", ""), "").Replace("\r\n", "\n").Replace('\r', '\n');
|
||||
|
||||
foreach (Match m in CategoryRx.Matches(text))
|
||||
{
|
||||
string c = m.Groups[1].Value.Trim();
|
||||
if (c.Length > 0 && !q.Categories.Contains(c)) q.Categories.Add(c);
|
||||
}
|
||||
|
||||
Dictionary<string, string> box = TemplateParams(text, "Quest Summary");
|
||||
q.Level = Clean(Param(box, "Level"));
|
||||
q.RecommendedLevel = Clean(Param(box, "Recommended Level", "Recommended Aug Level", "Recommended"));
|
||||
q.Type = Clean(Param(box, "Quest Type", "Type"));
|
||||
q.KillTask = Clean(Param(box, "Kill Task"));
|
||||
q.StartsWith = Clean(Param(box, "Starts With", "NPC"));
|
||||
q.StartsAt = Clean(Param(box, "Starts At", "Location"));
|
||||
q.Route = Clean(Param(box, "Route"));
|
||||
q.Repeat = Clean(Param(box, "Repeat Timer", "Timer", "Repeat"));
|
||||
q.RepeatSec = RepeatSeconds(q.Repeat);
|
||||
q.TimeToComplete = Clean(Param(box, "Time to Complete"));
|
||||
q.Contracts = Clean(Param(box, "Contracts"));
|
||||
q.Qb = FirstInt(Clean(Param(box, "QB", "Quest Bonus")));
|
||||
q.SocietyRank = Clean(Param(box, "Society Rank"));
|
||||
|
||||
List<(string Heading, List<string> Lines)> sections = Sections(text);
|
||||
string overview = "";
|
||||
List<string>? walk = null;
|
||||
var looseStamps = new List<string>();
|
||||
foreach (var (heading, lines) in sections)
|
||||
{
|
||||
string h = heading.ToLowerInvariant();
|
||||
if (h.StartsWith("overview") || h.Contains("description"))
|
||||
{
|
||||
// The Overview wins over the Discord Description when a page has both.
|
||||
string o = Clean(string.Join(" ", lines));
|
||||
if (o.Length > 0 && (h.StartsWith("overview") || overview.Length == 0)) overview = o;
|
||||
}
|
||||
else if (h.StartsWith("walkthrough") || h == "steps" || h.StartsWith("quest steps") || h == "notes" && walk == null)
|
||||
walk = lines;
|
||||
else if (h.Contains("stamp"))
|
||||
{
|
||||
foreach (string l in lines)
|
||||
foreach (Match m in StampRx.Matches(l))
|
||||
if (GuideStamp.Clean(m.Groups[1].Value) is { Length: > 0 } ls) looseStamps.Add(ls);
|
||||
}
|
||||
else if (h.StartsWith("reward"))
|
||||
q.Rewards = Rewards(string.Join("\n", lines));
|
||||
}
|
||||
q.Overview = overview.Length > 700 ? overview.Substring(0, 700).TrimEnd() + "..." : overview;
|
||||
if (walk != null) q.Steps = Steps(walk);
|
||||
|
||||
// Stamps listed outside the steps: tied to a step by name, else (as many as there are stampless
|
||||
// steps) in order, else kept apart.
|
||||
var have = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (GuideStep s in q.Steps) foreach (string st in s.Stamps) have.Add(GuideStamp.Key(st));
|
||||
var left = new List<string>();
|
||||
foreach (string st in looseStamps)
|
||||
{
|
||||
if (!have.Add(GuideStamp.Key(st))) continue;
|
||||
GuideStep? byName = StepNamed(q.Steps, st);
|
||||
if (byName != null) byName.Stamps.Add(st);
|
||||
else left.Add(st);
|
||||
}
|
||||
var bare = q.Steps.FindAll(s => s.Stamps.Count == 0);
|
||||
if (left.Count > 0 && left.Count == bare.Count)
|
||||
{
|
||||
for (int i = 0; i < left.Count; i++) bare[i].Stamps.Add(left[i]);
|
||||
left.Clear();
|
||||
}
|
||||
q.ExtraStamps = left;
|
||||
q.Loot = LootItems(q.Steps);
|
||||
return q;
|
||||
}
|
||||
|
||||
// ── Sections and steps ──────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The page's "== X ==" sections with their lines (the text before the first heading is "").</summary>
|
||||
internal static List<(string Heading, List<string> Lines)> Sections(string text)
|
||||
{
|
||||
var list = new List<(string, List<string>)>();
|
||||
string heading = "";
|
||||
var lines = new List<string>();
|
||||
foreach (string raw in text.Split('\n'))
|
||||
{
|
||||
Match m = HeadingRx.Match(raw);
|
||||
if (m.Success)
|
||||
{
|
||||
list.Add((heading, lines));
|
||||
heading = m.Groups[1].Value.Trim();
|
||||
lines = new List<string>();
|
||||
continue;
|
||||
}
|
||||
lines.Add(raw);
|
||||
}
|
||||
list.Add((heading, lines));
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The walkthrough's steps: its numbered "# " lines with their "#*" / "#:" / "##" lines under them;
|
||||
/// or, with no numbered lines, its top-level bullets or its paragraphs (one step each). Sub-sections
|
||||
/// ("=== Part 2 ===") only break paragraphs.
|
||||
/// </summary>
|
||||
internal static List<GuideStep> Steps(List<string> lines)
|
||||
{
|
||||
var steps = new List<GuideStep>();
|
||||
bool numbered = lines.Exists(l => IsTopLevel(l, '#'));
|
||||
bool bullets = !numbered && lines.Exists(l => IsTopLevel(l, '*'));
|
||||
char lead = numbered ? '#' : '*';
|
||||
|
||||
if (numbered || bullets)
|
||||
{
|
||||
GuideStep? cur = null;
|
||||
foreach (string raw in lines)
|
||||
{
|
||||
string l = raw.TrimEnd();
|
||||
if (l.Length == 0) continue;
|
||||
if (IsTopLevel(l, lead))
|
||||
{
|
||||
cur = NewStep(l.Substring(1));
|
||||
steps.Add(cur);
|
||||
}
|
||||
else if (cur != null && l[0] == lead)
|
||||
AddSub(cur, l.TrimStart('#', '*', ':', ';'));
|
||||
else if (cur != null && (l[0] == '*' || l[0] == ':'))
|
||||
AddSub(cur, l.TrimStart('#', '*', ':', ';'));
|
||||
// Anything else between steps (a paragraph, a table) is left out.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var para = new StringBuilder();
|
||||
void Flush()
|
||||
{
|
||||
string p = para.ToString().Trim();
|
||||
para.Clear();
|
||||
if (p.Length == 0) return;
|
||||
GuideStep s = NewStep(p);
|
||||
if (s.Text.Length > 0 || s.Stamps.Count > 0) steps.Add(s);
|
||||
}
|
||||
foreach (string raw in lines)
|
||||
{
|
||||
string l = raw.Trim();
|
||||
if (l.Length == 0 || l.StartsWith("===") || l.StartsWith("{|") || l.StartsWith("|}") || l.StartsWith("[[File:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Flush();
|
||||
continue;
|
||||
}
|
||||
if (para.Length > 0) para.Append(' ');
|
||||
para.Append(l);
|
||||
}
|
||||
Flush();
|
||||
}
|
||||
steps.RemoveAll(s => s.Text.Length == 0 && s.Stamps.Count == 0 && s.Coords.Count == 0);
|
||||
return steps;
|
||||
}
|
||||
|
||||
private static bool IsTopLevel(string l, char lead) =>
|
||||
l.Length > 1 && l[0] == lead && l[1] != '*' && l[1] != '#' && l[1] != ':' && l[1] != ';';
|
||||
|
||||
private static GuideStep NewStep(string raw)
|
||||
{
|
||||
var s = new GuideStep();
|
||||
Collect(s, raw);
|
||||
s.Text = Clean(raw);
|
||||
return s;
|
||||
}
|
||||
|
||||
private static void AddSub(GuideStep s, string raw)
|
||||
{
|
||||
Collect(s, raw);
|
||||
string note = Clean(raw);
|
||||
if (note.Length > 0) s.Notes.Add(note);
|
||||
}
|
||||
|
||||
/// <summary>The stamps, items and coordinates in a line of the step.</summary>
|
||||
private static void Collect(GuideStep s, string raw)
|
||||
{
|
||||
foreach (Match m in StampRx.Matches(raw))
|
||||
{
|
||||
string st = GuideStamp.Clean(m.Groups[1].Value);
|
||||
if (st.Length > 0 && !s.Stamps.Exists(x => GuideStamp.Key(x) == GuideStamp.Key(st))) s.Stamps.Add(st);
|
||||
}
|
||||
foreach (Match m in ItemRx.Matches(raw))
|
||||
{
|
||||
string it = m.Groups[1].Value.Trim();
|
||||
if (it.Length > 0 && !s.Items.Contains(it, StringComparer.OrdinalIgnoreCase)) s.Items.Add(it);
|
||||
}
|
||||
foreach (string c in NavTargets.AllCoords(Clean(raw)))
|
||||
if (!s.Coords.Contains(c)) s.Coords.Add(c);
|
||||
}
|
||||
|
||||
private static readonly Regex LootVerbRx = new(
|
||||
@"\b(kill|kills|killing|loot|loots|looted|drop|drops|dropped|collect|collects|gather|find|finds|obtain|obtains|pick\s+up|grab|hunt|hunts|for\s+(a|an|the|their|its|his|her))\b",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>
|
||||
/// The items worth picking up: those named in a step that kills, loots, drops or finds something
|
||||
/// (not one only handed in or upgraded), each once, in order.
|
||||
/// </summary>
|
||||
internal static List<string> LootItems(List<GuideStep> steps)
|
||||
{
|
||||
var loot = new List<string>();
|
||||
foreach (GuideStep s in steps)
|
||||
{
|
||||
if (s.Items.Count == 0) continue;
|
||||
string all = s.Text + " " + string.Join(" ", s.Notes);
|
||||
if (!LootVerbRx.IsMatch(all)) continue;
|
||||
if (Regex.IsMatch(s.Text, @"^\s*(instead|return|turn\s+in|hand\s+in|give|bring|upgrade)\b", RegexOptions.IgnoreCase)) continue;
|
||||
foreach (string it in s.Items)
|
||||
if (!loot.Contains(it, StringComparer.OrdinalIgnoreCase)) loot.Add(it);
|
||||
}
|
||||
return loot;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The step a stamp listed apart belongs to, by its name: "NephriteTooth" goes with the step that
|
||||
/// talks about the Nephrite, "WinstonsLeg" with Winston's. The single best step, or null.
|
||||
/// </summary>
|
||||
internal static GuideStep? StepNamed(List<GuideStep> steps, string stamp)
|
||||
{
|
||||
List<string> tokens = StampTokens(stamp);
|
||||
if (tokens.Count == 0) return null;
|
||||
GuideStep? best = null;
|
||||
int bestScore = 0;
|
||||
bool tie = false;
|
||||
foreach (GuideStep s in steps)
|
||||
{
|
||||
var words = new HashSet<string>(Words(s.Text + " " + string.Join(" ", s.Notes) + " " + string.Join(" ", s.Items)), StringComparer.Ordinal);
|
||||
int score = 0;
|
||||
foreach (string t in tokens)
|
||||
foreach (string w in words)
|
||||
if (w.Length >= 4 && (w == t || w.StartsWith(t, StringComparison.Ordinal) || t.StartsWith(w, StringComparison.Ordinal))) { score++; break; }
|
||||
if (score > bestScore) { best = s; bestScore = score; tie = false; }
|
||||
else if (score == bestScore && score > 0) tie = true;
|
||||
}
|
||||
return tie ? null : best;
|
||||
}
|
||||
|
||||
private static readonly HashSet<string> StampNoise = new(StringComparer.Ordinal)
|
||||
{ "quest", "stamp", "found", "turnin", "turned", "done", "complete", "completed", "kill", "killed", "the", "obtained", "timer", "flag", "started", "start" };
|
||||
|
||||
/// <summary>"Shiny_Red_Stone_Found" → shiny, red, stone; "WinstonsLeg" → winston, leg (words of 3+ letters, an 's dropped).</summary>
|
||||
internal static List<string> StampTokens(string stamp)
|
||||
{
|
||||
string spaced = Regex.Replace(stamp, @"(?<=[a-z0-9])(?=[A-Z])", " ");
|
||||
var list = new List<string>();
|
||||
foreach (string w in Words(spaced))
|
||||
{
|
||||
string t = w.Length > 4 && w.EndsWith("s", StringComparison.Ordinal) ? w.Substring(0, w.Length - 1) : w;
|
||||
if (t.Length >= 3 && !StampNoise.Contains(t) && !list.Contains(t)) list.Add(t);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static IEnumerable<string> Words(string text)
|
||||
{
|
||||
foreach (Match m in Regex.Matches(text.ToLowerInvariant(), @"[a-z0-9]+"))
|
||||
{
|
||||
string w = m.Value;
|
||||
// "Winston's" reads as "winston" + "s".
|
||||
yield return w;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Rewards ─────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The rewards section as short lines: "For Vial of The Architect's Blood:", then "Enlightened Coin (x80)" ...</summary>
|
||||
internal static List<string> Rewards(string section)
|
||||
{
|
||||
var lines = new List<string>();
|
||||
int at = 0;
|
||||
bool anyTable = false;
|
||||
while (true)
|
||||
{
|
||||
int i = section.IndexOf("{{Rewards Table", at, StringComparison.OrdinalIgnoreCase);
|
||||
if (i < 0) break;
|
||||
int end = TemplateEnd(section, i);
|
||||
if (end < 0) break;
|
||||
anyTable = true;
|
||||
Dictionary<string, string> p = SplitParams(section.Substring(i + 2, end - i - 4));
|
||||
string task = Clean(Param(p, "Quest Task", "Task"));
|
||||
if (task.Length > 0) lines.Add("For " + task + ":");
|
||||
foreach (string key in new[] { "Item Reward", "Items", "XP Reward", "Experience", "Luminance Reward", "Luminance", "Other Reward", "Other" })
|
||||
{
|
||||
string v = Param(p, key);
|
||||
if (v.Length == 0) continue;
|
||||
foreach (string part in v.Split('\n'))
|
||||
{
|
||||
string c = Clean(part.TrimStart('*', ' ', '#'));
|
||||
if (c.Length == 0) continue;
|
||||
lines.Add(key.StartsWith("XP") || key.StartsWith("Exp") ? "XP: " + c : key.StartsWith("Lum") ? "Luminance: " + c : c);
|
||||
}
|
||||
}
|
||||
at = end;
|
||||
}
|
||||
if (!anyTable)
|
||||
foreach (string l in section.Split('\n'))
|
||||
{
|
||||
string c = Clean(l.TrimStart('*', '#', ':', ' '));
|
||||
if (c.Length > 0) lines.Add(c);
|
||||
}
|
||||
if (lines.Count > 30) lines.RemoveRange(30, lines.Count - 30);
|
||||
return lines;
|
||||
}
|
||||
|
||||
// ── Templates ───────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The first {{<paramref name="name"/> ...}} template's named parameters (keys trimmed, any case).</summary>
|
||||
internal static Dictionary<string, string> TemplateParams(string text, string name)
|
||||
{
|
||||
int i = text.IndexOf("{{" + name, StringComparison.OrdinalIgnoreCase);
|
||||
if (i < 0) return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
int end = TemplateEnd(text, i);
|
||||
if (end < 0) end = text.Length;
|
||||
int bodyEnd = Math.Max(i + 2, end - 2);
|
||||
return SplitParams(text.Substring(i + 2, bodyEnd - (i + 2)));
|
||||
}
|
||||
|
||||
/// <summary>Where the template starting at <paramref name="start"/> ("{{") ends (just past its "}}"), or -1.</summary>
|
||||
private static int TemplateEnd(string text, int start)
|
||||
{
|
||||
int depth = 0;
|
||||
for (int i = start; i < text.Length - 1; i++)
|
||||
{
|
||||
if (text[i] == '{' && text[i + 1] == '{') { depth++; i++; }
|
||||
else if (text[i] == '}' && text[i + 1] == '}') { depth--; i++; if (depth == 0) return i + 1; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>A template body's "| key = value" parameters, split at the top level only (links and inner templates kept whole).</summary>
|
||||
private static Dictionary<string, string> SplitParams(string body)
|
||||
{
|
||||
var parts = new List<string>();
|
||||
int depthT = 0, depthL = 0, from = 0;
|
||||
for (int i = 0; i < body.Length; i++)
|
||||
{
|
||||
char c = body[i];
|
||||
char n = i + 1 < body.Length ? body[i + 1] : '\0';
|
||||
if (c == '{' && n == '{') { depthT++; i++; }
|
||||
else if (c == '}' && n == '}') { depthT--; i++; }
|
||||
else if (c == '[' && n == '[') { depthL++; i++; }
|
||||
else if (c == ']' && n == ']') { depthL--; i++; }
|
||||
else if (c == '|' && depthT == 0 && depthL == 0)
|
||||
{
|
||||
parts.Add(body.Substring(from, i - from));
|
||||
from = i + 1;
|
||||
}
|
||||
}
|
||||
parts.Add(body.Substring(from));
|
||||
var map = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
for (int k = 1; k < parts.Count; k++)
|
||||
{
|
||||
string p = parts[k];
|
||||
int eq = p.IndexOf('=');
|
||||
if (eq <= 0) continue;
|
||||
string key = Regex.Replace(p.Substring(0, eq), @"\s+", " ").Trim();
|
||||
if (key.Length == 0 || map.ContainsKey(key)) continue;
|
||||
map[key] = p.Substring(eq + 1).Trim();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
internal static string Param(Dictionary<string, string> p, params string[] names)
|
||||
{
|
||||
foreach (string n in names)
|
||||
if (p.TryGetValue(n, out string? v) && v.Trim().Length > 0) return v.Trim();
|
||||
return "";
|
||||
}
|
||||
|
||||
// ── Text ────────────────────────────────────────────────────────────────
|
||||
|
||||
private static readonly Regex FileRx = new(@"\[\[\s*(File|Image)\s*:[^\[\]]*(\[\[[^\]]*\]\][^\[\]]*)*\]\]", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
private static readonly Regex LinkRx = new(@"\[\[([^\[\]|]*)\|([^\[\]]*)\]\]", RegexOptions.CultureInvariant);
|
||||
private static readonly Regex PlainLinkRx = new(@"\[\[([^\[\]|]*)\]\]", RegexOptions.CultureInvariant);
|
||||
private static readonly Regex ExtLinkRx = new(@"\[(https?://[^\s\]]+)(?:\s+([^\]]*))?\]", RegexOptions.CultureInvariant);
|
||||
private static readonly Regex NamedTemplateRx = new(@"\{\{\s*(?:Item\s*link|Icon\s*Link|Creature\s*link|NPC\s*link|Link)\s*\|\s*([^}|]+?)\s*(?:\|[^{}]*)?\}\}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
private static readonly Regex AnyTemplateRx = new(@"\{\{[^{}]*\}\}", RegexOptions.CultureInvariant);
|
||||
private static readonly Regex TagRx = new(@"<[^>]+>", RegexOptions.CultureInvariant);
|
||||
private static readonly Regex SpaceRx = new(@"\s+", RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>Wikitext as plain text: links as their words, item templates as the item, other templates, files, bold and tags dropped.</summary>
|
||||
public static string Clean(string? wikitext)
|
||||
{
|
||||
if (string.IsNullOrEmpty(wikitext)) return "";
|
||||
string s = wikitext;
|
||||
s = StampRx.Replace(s, "");
|
||||
s = FileRx.Replace(s, "");
|
||||
s = CategoryRx.Replace(s, "");
|
||||
s = LinkRx.Replace(s, "$2");
|
||||
s = PlainLinkRx.Replace(s, m => m.Groups[1].Value.TrimStart(':'));
|
||||
s = ExtLinkRx.Replace(s, m => m.Groups[2].Success && m.Groups[2].Value.Length > 0 ? m.Groups[2].Value : m.Groups[1].Value);
|
||||
s = NamedTemplateRx.Replace(s, "$1");
|
||||
for (int pass = 0; pass < 4 && s.Contains("{{"); pass++) s = AnyTemplateRx.Replace(s, "");
|
||||
s = Regex.Replace(s, @"<br\s*/?>", " ", RegexOptions.IgnoreCase);
|
||||
s = TagRx.Replace(s, "");
|
||||
s = s.Replace("'''", "").Replace("''", "");
|
||||
s = s.Replace(" ", " ").Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(""", "\"");
|
||||
s = SpaceRx.Replace(s, " ").Trim();
|
||||
// A "[[A]]s" plural leaves "Tortured Raveners" whole; a list leftover "* " at the start goes.
|
||||
return s.TrimStart('*', '#', ':', ' ').Trim();
|
||||
}
|
||||
|
||||
private static int FirstInt(string s)
|
||||
{
|
||||
Match m = Regex.Match(s, @"\d+");
|
||||
return m.Success && int.TryParse(m.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out int n) ? n : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "20 Hours", "7 days", "1 Week", "20h", "3d 12h", "Daily" → seconds; "", "None", "N/A", "Once",
|
||||
/// "One time" → 0; anything else -1.
|
||||
/// </summary>
|
||||
public static long RepeatSeconds(string? repeat)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(repeat)) return 0;
|
||||
string r = repeat.Trim().ToLowerInvariant();
|
||||
if (r is "none" or "n/a" or "na" or "-" or "once" or "no" or "never" || r.StartsWith("one time") || r.StartsWith("one-time") || r.StartsWith("not repeatable")
|
||||
|| r.StartsWith("non repeatable") || r.StartsWith("non-repeatable") || r.StartsWith("nonrepeatable") || r.StartsWith("unrepeatable")) return 0;
|
||||
if (r.StartsWith("daily")) return 86400;
|
||||
if (r.StartsWith("weekly")) return 7 * 86400;
|
||||
long total = 0;
|
||||
bool any = false;
|
||||
foreach (Match m in Regex.Matches(r, @"(\d+(?:\.\d+)?)\s*(weeks?|w|days?|d|hours?|hrs?|h|minutes?|mins?|m|seconds?|secs?|s)\b"))
|
||||
{
|
||||
double n = double.Parse(m.Groups[1].Value, CultureInfo.InvariantCulture);
|
||||
string u = m.Groups[2].Value;
|
||||
double mult = u[0] switch { 'w' => 7 * 86400, 'd' => 86400, 'h' => 3600, 'm' => 60, _ => 1 };
|
||||
total += (long)Math.Round(n * mult);
|
||||
any = true;
|
||||
}
|
||||
return any && total > 0 ? total : -1;
|
||||
}
|
||||
|
||||
// ── Special:Export ──────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// The pages in a Special:Export XML file: (title, revision id, wikitext), main namespace only.
|
||||
/// </summary>
|
||||
public static List<(string Title, long Rev, string Text)> ReadExport(System.IO.TextReader xml)
|
||||
{
|
||||
var pages = new List<(string, long, string)>();
|
||||
var settings = new System.Xml.XmlReaderSettings { DtdProcessing = System.Xml.DtdProcessing.Ignore, XmlResolver = null, IgnoreWhitespace = true };
|
||||
using var r = System.Xml.XmlReader.Create(xml, settings);
|
||||
string title = "", text = "";
|
||||
long rev = 0;
|
||||
int ns = 0;
|
||||
bool inRevision = false;
|
||||
bool advance = true;
|
||||
while (true)
|
||||
{
|
||||
// ReadElementContentAsString leaves the reader on the next node already: no Read then.
|
||||
if (advance && !r.Read()) break;
|
||||
advance = true;
|
||||
if (r.EOF) break;
|
||||
if (r.NodeType == System.Xml.XmlNodeType.Element)
|
||||
{
|
||||
switch (r.LocalName)
|
||||
{
|
||||
case "page": title = ""; text = ""; rev = 0; ns = 0; inRevision = false; break;
|
||||
case "title": title = r.ReadElementContentAsString(); advance = false; break;
|
||||
case "ns":
|
||||
int.TryParse(r.ReadElementContentAsString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out ns);
|
||||
advance = false;
|
||||
break;
|
||||
case "revision": inRevision = true; break;
|
||||
case "id" when inRevision && rev == 0:
|
||||
long.TryParse(r.ReadElementContentAsString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out rev);
|
||||
advance = false;
|
||||
break;
|
||||
case "text" when inRevision: text = r.ReadElementContentAsString(); advance = false; break;
|
||||
}
|
||||
}
|
||||
else if (r.NodeType == System.Xml.XmlNodeType.EndElement && r.LocalName == "page")
|
||||
{
|
||||
if (ns == 0 && title.Length > 0) pages.Add((title, rev, text));
|
||||
}
|
||||
}
|
||||
return pages;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,18 +3,23 @@ using RynthCore.Plugin.Shared;
|
|||
|
||||
namespace RynthCore.Plugin.RynthOracle;
|
||||
|
||||
internal enum OracleVerb { Window, Void, Timers, Quests, Tab, Trackers, Status, About, Help, Unknown }
|
||||
internal enum OracleVerb { Window, Void, Timers, Quests, Tab, Trackers, Tracker, Status, About, Help, LootProfiles, Unknown }
|
||||
|
||||
/// <summary>A parsed "/ro ..." (the words after /ro, lower case): its verb, and the tab or the trackers it shows.</summary>
|
||||
internal readonly record struct OracleCommand(OracleVerb Verb, string Tab = "", QuestKind? Trackers = null, string Word = "")
|
||||
{
|
||||
/// <summary>The verbs that show a window (they need the engine's plugin windows).</summary>
|
||||
public bool ShowsWindow => Verb is OracleVerb.Window or OracleVerb.Void or OracleVerb.Timers or OracleVerb.Tab
|
||||
or OracleVerb.Trackers or OracleVerb.About;
|
||||
or OracleVerb.Trackers or OracleVerb.Tracker or OracleVerb.About;
|
||||
|
||||
public static OracleCommand Parse(string? arg)
|
||||
{
|
||||
string a = (arg ?? string.Empty).Trim().ToLowerInvariant();
|
||||
// "/ro lootprofiles [quest]" (2026-11-05): RynthAi writes the wiki quests' loot profiles
|
||||
// (base-quest-dynamic.utl and each quest's items); Word is the quest, "" for every quest.
|
||||
foreach (string v in new[] { "lootprofiles", "lootprofile" })
|
||||
if (a == v || a.StartsWith(v + " ", System.StringComparison.Ordinal))
|
||||
return new(OracleVerb.LootProfiles, Word: (arg ?? "").Trim().Substring(v.Length).Trim().Trim('"'));
|
||||
return a switch
|
||||
{
|
||||
"" => new(OracleVerb.Window),
|
||||
|
|
@ -31,6 +36,13 @@ internal readonly record struct OracleCommand(OracleVerb Verb, string Tab = "",
|
|||
"markers" or "marker" => new(OracleVerb.Trackers, OracleView.TabQuests, QuestKind.Marker),
|
||||
// Every tracker: the Legendary Key quests and the exploration markers.
|
||||
"trackers" => new(OracleVerb.Trackers, OracleView.TabQuests),
|
||||
// Infinite Leaftide's trackers (the test branch): the Dynamic Stamps and RynthILT's Temple guardians.
|
||||
"dynamic" or "stamps" or "dyn" => new(OracleVerb.Trackers, OracleView.TabQuests, QuestKind.Dynamic),
|
||||
"guardian" or "guardians" => new(OracleVerb.Trackers, OracleView.TabQuests, QuestKind.Guardian),
|
||||
// The Gear tab: spell overlap on the worn gear, wards and banes, ratings (any server).
|
||||
"gear" or "overlap" => new(OracleVerb.Tab, OracleView.TabGear),
|
||||
// ACECustom T11 / quest-bonus tracker bar window (left the Oracle tab strip 2026-11-22).
|
||||
"tracker" or "ilttracker" or "t11" or "ilt" => new(OracleVerb.Tracker),
|
||||
// The Skills tab: RynthCore's skills panel (raise and train) inside this window.
|
||||
"skills" or "skill" => new(OracleVerb.Tab, OracleView.TabSkills),
|
||||
"attributes" or "attrs" or "attribute" or "vitals" => new(OracleVerb.Tab, OracleView.TabAttributes),
|
||||
|
|
@ -44,10 +56,10 @@ internal readonly record struct OracleCommand(OracleVerb Verb, string Tab = "",
|
|||
|
||||
public const string Usage =
|
||||
"Commands: /ro (window), /ro character (Character tab: status, session), "
|
||||
+ "/ro skills|attributes|progress (those tabs), /ro void (Void window), "
|
||||
+ "/ro gear (Gear tab: spell overlap, wards and banes, ratings), /ro skills|attributes|progress (those tabs), /ro void (Void window), "
|
||||
+ "/ro timers (Quest Timers window), /ro fellowship (Fellowship tab), "
|
||||
+ "/ro trackers (Quests tab, trackers only), /ro legendary (John's 30 key quests), /ro markers, "
|
||||
+ "/ro quests (read quest flags), /ro status, "
|
||||
+ "/ro tracker (T11 / quest-bonus tracker window, ACECustom worlds), /ro trackers (Quests tab, trackers only), /ro legendary (John's 30 key quests), /ro markers, "
|
||||
+ "/ro quests (read quest flags), /ro lootprofiles [quest] (each wiki quest's loot profile, from base-quest-dynamic), /ro status, "
|
||||
+ "/ro about (About tab: settings, server, quest list). A server's own pages are its server plugin's (/rserver).";
|
||||
|
||||
public const string NoWindows =
|
||||
|
|
@ -63,6 +75,8 @@ internal readonly record struct OracleCommand(OracleVerb Verb, string Tab = "",
|
|||
{
|
||||
QuestKind.Legendary => "Oracle window shown on the Quests tab: the Legendary Key quests.",
|
||||
QuestKind.Marker => "Oracle window shown on the Quests tab: the exploration markers.",
|
||||
QuestKind.Dynamic => "Oracle window shown on the Quests tab: the Dynamic Stamps.",
|
||||
QuestKind.Guardian => "Oracle window shown on the Quests tab: the Temple guardians.",
|
||||
_ => "Oracle window shown on the Quests tab: every tracker.",
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
|
@ -21,6 +22,90 @@ internal sealed class OracleContext
|
|||
public readonly VoidTracker Void = new();
|
||||
public readonly FellowshipTracker Fellowship = new();
|
||||
public readonly ServerIdentity Server = new();
|
||||
/// <summary>RynthILT's profile with the /qb lists (Infinite Leaftide only: polled while Server.IsIlt).</summary>
|
||||
public readonly IltServerLink Ilt = new();
|
||||
/// <summary>The Leaftide wiki quest guide RynthILT keeps (Infinite Leaftide only: polled while Server.IsIlt).</summary>
|
||||
public readonly QuestGuideClient Guide = new();
|
||||
|
||||
/// <summary>
|
||||
/// RynthOracle's own quest guide from the AC Community Wiki (asheron.fandom.com), on every server (2026-11-21).
|
||||
/// Settable for the tests (a file of their own).
|
||||
/// </summary>
|
||||
public FandomFeed Fandom = new();
|
||||
|
||||
/// <summary>
|
||||
/// The wiki guide in use: on Infinite Leaftide RynthILT's (its own wiki) once it has quests, else the AC
|
||||
/// Community Wiki's.
|
||||
/// </summary>
|
||||
public QuestGuide Wiki
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Server.IsIlt && Guide.Guide.Quests.Count > 0) return Guide.Guide;
|
||||
QuestGuide sg = ServerGuide.Client.Guide;
|
||||
if (sg.Quests.Count == 0) return Fandom.Guide;
|
||||
// The active server's own wiki quests (RynthConquest's Conquest wiki, 2026-11-21) over the AC
|
||||
// Community Wiki's: its quests first, then the retail ones it doesn't have; the kill tasks, society
|
||||
// quests and contracts are the AC Community Wiki's.
|
||||
int key = unchecked(ServerGuide.Client.Revision * 7919 + Fandom.Revision);
|
||||
if (_merged == null || _mergedKey != key || !ReferenceEquals(_mergedFrom, sg))
|
||||
{
|
||||
var g = new QuestGuide
|
||||
{
|
||||
Source = sg.Source + "+fandom", Parser = Math.Min(sg.Parser, Fandom.Guide.Parser),
|
||||
UpdatedUtc = sg.UpdatedUtc, KillTasks = Fandom.Guide.KillTasks, Society = Fandom.Guide.Society, Contracts = Fandom.Guide.Contracts,
|
||||
};
|
||||
var titles = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (GuideQuest q in sg.Quests) if (titles.Add(q.Title)) g.Quests.Add(q);
|
||||
foreach (GuideQuest q in Fandom.Guide.Quests) if (titles.Add(q.Title)) g.Quests.Add(q);
|
||||
_merged = g;
|
||||
_mergedKey = key;
|
||||
_mergedFrom = sg;
|
||||
}
|
||||
return _merged;
|
||||
}
|
||||
}
|
||||
|
||||
private QuestGuide? _merged, _mergedFrom;
|
||||
private int _mergedKey;
|
||||
|
||||
/// <summary>The active server's own wiki quest guide (RynthServer.QuestGuide; RynthConquest's), on any server but ILT.</summary>
|
||||
public readonly ServerGuideClient ServerGuide = new();
|
||||
|
||||
/// <summary>The wiki tab's name: "ILT Wiki", "<server> Wiki" for a server's own guide, else "AC Wiki".</summary>
|
||||
public string WikiLabel =>
|
||||
Server.IsIlt && Guide.Guide.Quests.Count > 0 ? "ILT Wiki"
|
||||
: ServerGuide.Client.Guide.Quests.Count > 0 ? (ServerGuide.Client.Tag.Length > 0 ? ServerGuide.Client.Tag : "Server") + " Wiki"
|
||||
: "AC Wiki";
|
||||
|
||||
/// <summary>The wiki in use is the AC Community Wiki's.</summary>
|
||||
public bool WikiIsFandom => ReferenceEquals(Wiki, Fandom.Guide);
|
||||
|
||||
/// <summary>Goes up when either guide changes.</summary>
|
||||
public int WikiRevision => unchecked((Guide.Revision * 7919 + Fandom.Revision) * 31 + ServerGuide.Client.Revision);
|
||||
|
||||
/// <summary>A wiki quest by title: the guide in use, else the AC Community Wiki's (a contract's quest, a society quest).</summary>
|
||||
public GuideQuest? FindWiki(string title) => Wiki.Find(title) ?? (WikiIsFandom ? null : Fandom.Guide.Find(title));
|
||||
/// <summary>"Run this quest": the wiki quest RynthNav is walking (set up by the plugin's Initialize).</summary>
|
||||
public QuestRunner? Runner;
|
||||
/// <summary>Stamps the server gave this session ("You've stamped X!"), as GuideStamp keys: done before /myquests says so.</summary>
|
||||
public readonly System.Collections.Generic.HashSet<string> SessionStamps = new(StringComparer.Ordinal);
|
||||
/// <summary>Goes up when <see cref="SessionStamps"/> grows.</summary>
|
||||
public int SessionStampRevision;
|
||||
/// <summary>Kill tasks' kill lines this session (the Kill Tasks tab, 2026-11-21).</summary>
|
||||
public readonly KillChat Kills = new();
|
||||
/// <summary>Sends a RynthAi command through the plugin-command broker (action, value); false without RynthAi.</summary>
|
||||
public Func<string, string, bool> SendAi = (_, _) => false;
|
||||
/// <summary>RynthILT's data interface: the Temple guardians (Infinite Leaftide only).</summary>
|
||||
public readonly RynthCore.Plugin.Shared.RynthIltDataClient IltData = new();
|
||||
/// <summary>The Temple guardians as RynthILT last reported them (None off Infinite Leaftide).</summary>
|
||||
public RynthCore.Plugin.Shared.IltGuardianView Guardian = RynthCore.Plugin.Shared.IltGuardianView.None;
|
||||
/// <summary>Goes up when <see cref="Guardian"/> changes (the Quests list rebuilds its guardian rows).</summary>
|
||||
public int GuardianRevision;
|
||||
/// <summary>The last guardian command's problem, or "".</summary>
|
||||
public string GuardianMessage = "";
|
||||
/// <summary>A verb for RynthILT's Temple guardians (handin, stop, refresh, chat/auto/buy on|off).</summary>
|
||||
public Func<string, bool> GuardianCommand = _ => false;
|
||||
// A server's own screens are its server plugin's (2026-10-20, 2026-10-21): nothing here is one server's.
|
||||
/// <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();
|
||||
|
|
@ -39,6 +124,14 @@ internal sealed class OracleContext
|
|||
/// (RynthConquest publishes Conquest's), 1 on every other server or without the plugin.
|
||||
/// </summary>
|
||||
public double VoidDotScale = 1.0;
|
||||
/// <summary>The Gear tab's Check (worn gear's spells, wards and banes, ratings); every server.</summary>
|
||||
public readonly GearScanner Gear = new();
|
||||
/// <summary>The ILT Tracker window's packs and bounty slots (Infinite Leaftide only): read while that window shows.</summary>
|
||||
public readonly T11Scanner T11 = new();
|
||||
/// <summary>The ILT Tracker's quest bonus: the "/bonus" multipliers and a "/qb" count from chat (2026-11-21).</summary>
|
||||
public readonly QuestBonus QuestBonus = new();
|
||||
/// <summary>Set by the plugin: reads the packs and bounty slots for the ILT Tracker tab now.</summary>
|
||||
public Action RescanT11 = () => { };
|
||||
|
||||
/// <summary>Titles the character holds (engine API v75); TitlesKnown false until the engine has the list.</summary>
|
||||
public readonly System.Collections.Generic.HashSet<int> EarnedTitles = new();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,14 @@ internal sealed class OracleSettings
|
|||
public bool ReadQuestsAtLogin = true;
|
||||
/// <summary>Hide the server's reply to RynthOracle's own /myquests (a typed /myquests always shows).</summary>
|
||||
public bool HideOwnQuestReplies = true;
|
||||
/// <summary>
|
||||
/// Read /myquests again when the flags are this many minutes old (0 = only at login and on
|
||||
/// Refresh). Any reply counts, RynthAi's meta polls too, so this only fills the gaps: before it,
|
||||
/// a character running for days showed flags frozen at whenever something last asked.
|
||||
/// </summary>
|
||||
public int QuestRefreshMinutes = 10;
|
||||
/// <summary>The choices the About tab offers for <see cref="QuestRefreshMinutes"/>.</summary>
|
||||
public static readonly int[] QuestRefreshChoices = { 0, 5, 10, 15, 30 };
|
||||
/// <summary>Check once a day for a newer master quest list at upstream's address.</summary>
|
||||
public bool CheckQuestListDaily;
|
||||
public DateTime LastQuestListCheckUtc = DateTime.MinValue;
|
||||
|
|
@ -31,6 +39,20 @@ internal sealed class OracleSettings
|
|||
public bool AlertTimers = true;
|
||||
/// <summary>false: only tracked quests are watched; true: every quest the character holds.</summary>
|
||||
public bool AlertAllTimers;
|
||||
/// <summary>The Gear tab's view: "Overlap" or "Ratings".</summary>
|
||||
public string GearView = "Overlap";
|
||||
/// <summary>Gear, Overlap: hide the families where spells compete.</summary>
|
||||
public bool GearHideOverlap;
|
||||
/// <summary>The Quests tab shows the quest guide (two panes: the list, the steps) rather than the flag list.</summary>
|
||||
public bool QuestGuideView = DefaultQuestGuideView;
|
||||
/// <summary>The guide view is the default (the offline tests of the flag list turn it off).</summary>
|
||||
internal static bool DefaultQuestGuideView = true;
|
||||
/// <summary>The quest guide hides quests whose stamps are all held.</summary>
|
||||
public bool GuideHideCollected;
|
||||
/// <summary>Gear, Ratings: list the packs' gear as well as what is worn.</summary>
|
||||
public bool GearIncludePack;
|
||||
/// <summary>Gear, Ratings: each item as a Mag-Tools ItemInfo line (true) or in columns (false).</summary>
|
||||
public bool GearRatingsMag = true;
|
||||
|
||||
/// <summary>Where the tests keep the settings file (a scratch path); null means the rynthoracle.json in RynthCore's %APPDATA% folder.</summary>
|
||||
internal static string? PathOverride;
|
||||
|
|
@ -43,6 +65,9 @@ internal sealed class OracleSettings
|
|||
{
|
||||
"readQuestsAtLogin", "hideOwnQuestReplies", "checkQuestListDaily", "lastQuestListCheck", "autoShowVoidWindow",
|
||||
"mainWindowOpen", "questTimersOpen", "alertTimers", "alertAllTimers", "tabName",
|
||||
// Written by Save too: without them here each save wrote them twice (2026-11-01).
|
||||
"questRefreshMinutes", "gearHideOverlap", "gearIncludePack", "gearRatingsMag", "gearView",
|
||||
"questGuideView", "guideHideCollected",
|
||||
};
|
||||
// "conquestAutoDeposit" moved to RynthConquest (2026-10-20), which takes it over from this file once;
|
||||
// it is kept here (as any value this version doesn't use) until then.
|
||||
|
|
@ -66,13 +91,21 @@ internal sealed class OracleSettings
|
|||
if (Array.IndexOf(KnownNames, p.Name) < 0 && !_kept.Exists(k => k.Name == p.Name)) _kept.Add((p.Name, p.Value.GetRawText()));
|
||||
ReadQuestsAtLogin = Bool(r, "readQuestsAtLogin", ReadQuestsAtLogin);
|
||||
HideOwnQuestReplies = Bool(r, "hideOwnQuestReplies", HideOwnQuestReplies);
|
||||
if (r.TryGetProperty("questRefreshMinutes", out JsonElement qr) && qr.ValueKind == JsonValueKind.Number && qr.TryGetInt32(out int qrm))
|
||||
QuestRefreshMinutes = Math.Clamp(qrm, 0, 240);
|
||||
CheckQuestListDaily = Bool(r, "checkQuestListDaily", CheckQuestListDaily);
|
||||
AutoShowVoidWindow = Bool(r, "autoShowVoidWindow", AutoShowVoidWindow);
|
||||
MainWindowOpen = Bool(r, "mainWindowOpen", MainWindowOpen);
|
||||
QuestTimersOpen = Bool(r, "questTimersOpen", QuestTimersOpen);
|
||||
AlertTimers = Bool(r, "alertTimers", AlertTimers);
|
||||
AlertAllTimers = Bool(r, "alertAllTimers", AlertAllTimers);
|
||||
GearHideOverlap = Bool(r, "gearHideOverlap", GearHideOverlap);
|
||||
QuestGuideView = Bool(r, "questGuideView", QuestGuideView);
|
||||
GuideHideCollected = Bool(r, "guideHideCollected", GuideHideCollected);
|
||||
GearIncludePack = Bool(r, "gearIncludePack", GearIncludePack);
|
||||
GearRatingsMag = Bool(r, "gearRatingsMag", GearRatingsMag);
|
||||
if (r.TryGetProperty("tabName", out JsonElement t) && t.ValueKind == JsonValueKind.String) TabName = t.GetString() ?? TabName;
|
||||
if (r.TryGetProperty("gearView", out JsonElement gv) && gv.ValueKind == JsonValueKind.String) GearView = gv.GetString() ?? GearView;
|
||||
if (r.TryGetProperty("lastQuestListCheck", out JsonElement c) && c.ValueKind == JsonValueKind.String
|
||||
&& DateTime.TryParse(c.GetString(), CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out DateTime when))
|
||||
LastQuestListCheckUtc = when.ToUniversalTime();
|
||||
|
|
@ -91,6 +124,7 @@ internal sealed class OracleSettings
|
|||
sb.Append("{\n");
|
||||
sb.Append(" \"readQuestsAtLogin\": ").Append(ReadQuestsAtLogin ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"hideOwnQuestReplies\": ").Append(HideOwnQuestReplies ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"questRefreshMinutes\": ").Append(QuestRefreshMinutes.ToString(CultureInfo.InvariantCulture)).Append(",\n");
|
||||
sb.Append(" \"checkQuestListDaily\": ").Append(CheckQuestListDaily ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"lastQuestListCheck\": \"").Append(LastQuestListCheckUtc.ToString("o", CultureInfo.InvariantCulture)).Append("\",\n");
|
||||
sb.Append(" \"autoShowVoidWindow\": ").Append(AutoShowVoidWindow ? "true" : "false").Append(",\n");
|
||||
|
|
@ -98,6 +132,12 @@ internal sealed class OracleSettings
|
|||
sb.Append(" \"questTimersOpen\": ").Append(QuestTimersOpen ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"alertTimers\": ").Append(AlertTimers ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"alertAllTimers\": ").Append(AlertAllTimers ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"gearHideOverlap\": ").Append(GearHideOverlap ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"questGuideView\": ").Append(QuestGuideView ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"guideHideCollected\": ").Append(GuideHideCollected ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"gearIncludePack\": ").Append(GearIncludePack ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"gearRatingsMag\": ").Append(GearRatingsMag ? "true" : "false").Append(",\n");
|
||||
sb.Append(" \"gearView\": \"").Append(JsonEncodedText.Encode(GearView).ToString()).Append("\",\n");
|
||||
sb.Append(" \"tabName\": \"").Append(JsonEncodedText.Encode(TabName).ToString()).Append('"');
|
||||
foreach ((string name, string raw) in _kept)
|
||||
sb.Append(",\n \"").Append(JsonEncodedText.Encode(name).ToString()).Append("\": ").Append(raw);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public static unsafe class PluginExports
|
|||
public static IntPtr GetVersion()
|
||||
{
|
||||
// Keep in step with RynthOraclePlugin.Version (a u8 literal can't be built from a const string).
|
||||
try { return LiteralPointer("0.3.0"u8); }
|
||||
try { return LiteralPointer("0.7.6"u8); }
|
||||
catch { return IntPtr.Zero; }
|
||||
}
|
||||
|
||||
|
|
|
|||
244
Plugins/RynthCore.Plugin.RynthOracle/Resources/dynstamps.csv
Normal file
244
Plugins/RynthCore.Plugin.RynthOracle/Resources/dynstamps.csv
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
Area,Place,Npc,Reward,Stamp,Note
|
||||
"Facility Hub","Folthid Cellar","Raxanza Folthid","O-Yoroi Leggings","Dynamic_1_Aq2hMsFmW!",""
|
||||
"Facility Hub","Folthid Cellar","Felscuda","Healing Rabbit Pie","Dynamic_1_&9jiyTB!","8.8S, 53.1E"
|
||||
"Facility Hub","Folthid Cellar","Mi Krau-Li","examines your Parchment","Dynamic_1_WAuFukcRLoL5!",""
|
||||
"Looking Around","","Le-Ai Rea","Blue Molly","Dynamic_1_XH!!nh#^NaRp!","75.9S 57.3E"
|
||||
"Looking Around","Frost Haven","Robert","Greater Celdon Shadow Sleeves","Dynamic_1_HLq&!",""
|
||||
"Looking Around","Frost Haven","Elijah","Homemade Stout","Dynamic_1_MpBeVDU!",""
|
||||
"Looking Around","Frost Haven","Emma","Frost Slingshot","Dynamic_1_bEt6H5ECwGb2!",""
|
||||
"Looking Around","Frost Haven","Chef Pleist","Stone Mace","Dynamic_1_HgaUKA#hxa!",""
|
||||
"Looking Around","Frost Haven","The Mayor","Fried Egg","Dynamic_1_MRfxp5!g!",""
|
||||
"Looking Around","Frost Haven","Numb","Perfect Coruscating Isparian Mace","Dynamic_1_z8LpGZpe4rq!",""
|
||||
"Looking Around","Land Bridge Staging Complex","Director's Majordomo","Spitter Trochanter Metamorphi","Dynamic_1_FZYLYrAW1Zb!",""
|
||||
"Looking Around","Frost Haven","Mossy Chamber","Broken Virindi","Dynamic_1_ANND",""
|
||||
"Looking Around","Freebooter","Jusad the Collector","Renegade Atlatl of the Mountains","Dynamic_1_!mqkm9M!",""
|
||||
"Looking Around","Lum Seer","Shade of Lady Adja","Frost Board with Nail","Dynamic_1_ps6iG^P!ndH!",""
|
||||
"Looking Around","Frost Haven","Ka'hiri","Hearty Spiced Applesauce","Dynamic_1_s5MAzDcP9!",""
|
||||
"Looking Around","Frost Haven","Liam of Gelid","Composite Crossbow with Handle","Dynamic_1_7cv3O^MTLLKzs&!",""
|
||||
"Looking Around","84.1N, 44.1E","Aerlinthe Node Golem","Silifi of Crimson Stars","Dynamic_1_D6YxLUyUIW!","84.1N, 44.1E"
|
||||
"Looking Around","62.0N, 18.0E","Esper Node Golem","Composite Bow with Handle","Dynamic_1_LE5V8SVHG!","62.0N, 18.0E"
|
||||
"Looking Around","93.8N, 67.4W","Halaetan Node Golem","Slashing Longbow","Dynamic_1_QfLhcZJ64Hkold!","93.8N, 67.4W"
|
||||
"Looking Around","64.8S, 59.3E","Linvak Node Golem","Greater Celdon Shadow Girth","Dynamic_1_V8&t5$!","64.8S, 59.3E"
|
||||
"Looking Around","Ulgrim Island","Ulgrim the Unappreciated","Applesauce","Dynamic_1_x!zs79y!",""
|
||||
"Looking Around","Fake Niffis Crate Quest","Chef Jonus","Fish","Dynamic_1_j&T!ZrQwKvo!",""
|
||||
"Looking Around","Frost Haven","Larnia","Acid Hand Axe","Dynamic_1_88P$YBwEl!",""
|
||||
"Looking Around","Tanada Chamber of Scroll / Fire","Tanada Han-Tu","Hearty Ice Cream","Dynamic_1_STjY86!0Iu8x!",""
|
||||
"Looking Around","Frost Haven","Tanada Hido","Acid Mace","Dynamic_1_3ZhBEF!",""
|
||||
"Looking Around","Frost Haven","Tanada Shouka","Pouch of Dried Meat","Dynamic_1_YgClBFy!",""
|
||||
"Looking Around","Gerent's Compound at 87.2S, 17.5W","Representative of the Singularity","Fish","Dynamic_1_qkU0b^i!","87.2S, 17.5W"
|
||||
"Odd Stamps","93.2N, 48.2W in the Shattered Outlands","Arialle du Bellenesse","Healing Holtburger","Dynamic_1_ADm5RsrDGCbT!","93.2N, 48.2W"
|
||||
"Odd Stamps","Crater","Silencia's Magma Golem","Slicing Royal Atlatl","Dynamic_1_fR730X5VsPULE5!",""
|
||||
"Odd Stamps","Colosseum","Master Arbitrator","Palenqual's Tewhate","Dynamic_1_XnFt&!",""
|
||||
"Odd Stamps","","Colosseum Ticket Vendor","Silifi of Crimson Stars","Dynamic_1_luguukhgZg!",""
|
||||
"Odd Stamps","Beach Fort","Suzuhara Sheshumi","Silifi of Crimson Stars","Dynamic_1_n5u2imCs!",""
|
||||
"Odd Stamps","Obsidian Plains","Varetha","Major Smoldering Atlan Bow","Dynamic_1_P1&xxk5!","44.3S, 62.5W"
|
||||
"Odd Stamps","Crystal Crag","Oorjit","Perfect Shimmering Isparian Bow","Dynamic_1_lPn&BaZ!",""
|
||||
"Odd Stamps","","Jyotsana","Cragstone Farms Mac&Cheese","Dynamic_1_YCGJJ7cA!",""
|
||||
"Odd Stamps","","Tokashi Ando","Perfect Dissolving Isparian Crossbow","Dynamic_1_R#HIf!",""
|
||||
"Odd Stamps","Ries Woron's Story","Thrungus","Expired Stamina Draught","Dynamic_1_eMJVhyPzaa$aGn!",""
|
||||
"Odd Stamps","Mite Maze","Roderick","Apple Pie","Dynamic_1_#C^p&w0gV$$!",""
|
||||
"Odd Stamps","Sawato","Ssavish","Composite Bow with Handle","Dynamic_1_NMlDXfx2t!",""
|
||||
"Odd Stamps","dryreach rescue","Dansha-Ki","Composite Bow with Handle","Dynamic_1_FnXoHWS&kaM!",""
|
||||
"Odd Stamps","Seat of Knorr","Arikas, Warden of Knorr","Hearty Healing Rabbit Noodle","Dynamic_1_aWOWTc30f4",""
|
||||
"Odd Stamps","Swamp Garden","Terese","Diforsa Bracers","Dynamic_1_PTy0kqqTLP1Dn^!",""
|
||||
"Odd Stamps","Dark Isle","Tyrina of Arwic","Major Shadow Gauntlets","Dynamic_1_zJNxGBc!","84.7n 58.7e"
|
||||
"Odd Stamps","Dark Isle","Francois di Terli","Habraeloi","Dynamic_1_3!Og!",""
|
||||
"Odd Stamps 2","Aun Settlement 82.7N 21.2E.","Aun Tikakhe","Good Chilling Isparian Mace","Dynamic_1_hafO$cQvbkg!","82.7N 21.2E"
|
||||
"Odd Stamps 2","","Aun Saritea","Health Tonic","Dynamic_1_7yW17JvMHKu!",""
|
||||
"Odd Stamps 2","","Aun Aulakhe","Mana Rabbit Pie","Dynamic_1_5xE2TM!",""
|
||||
"Odd Stamps 2","Lost Wish Cottages (Arwic) 42.6n 62.4e","Lartorus","Pants","Dynamic_1_$GB72K!","42.6n 62.4e"
|
||||
"Odd Stamps 2","Catacombs of Opposition","Ripper","Gladiatorial Tunic","Dynamic_1_69Rjbany2pKD!",""
|
||||
"Odd Stamps 2","","Rat Nose","Fine Atlan Staff","Dynamic_1_eBlku!",""
|
||||
"Odd Stamps 2","","Nanoc, Basher of Bugs","Mana Potion","Dynamic_1_XCTiy!",""
|
||||
"Odd Stamps 2","","Narg","Iron Rusted Mace","Dynamic_1_S!AhI!",""
|
||||
"Odd Stamps 2","","Scout Luzumin Abigwei","Alduressa Helm","Dynamic_1_NFf5!",""
|
||||
"Odd Stamps 2","","Teela","Orange Molly","Dynamic_1_Bl#Y!",""
|
||||
"Odd Stamps 2","","Scout Tel al-Arat","Envoy's Heaume","Dynamic_1_AJ3Wm9Bk!",""
|
||||
"Odd Stamps 2","","Pincer Danta","Olthoi Sollerets","Dynamic_1_VezOOBWbn43KU!!",""
|
||||
"Odd Stamps 2","Vissidal","Merwart Pelagurg","Superior Smoldering Atlan Staff","Dynamic_1_DOIC1!",""
|
||||
"Odd Stamps 2","Vissidal","Merwart Urglurg","Butter Knife of Slaying","Dynamic_1_&!iRR#RrhnGA!",""
|
||||
"Odd Stamps 2","Vissidal","Dayla Bint Kazm","Hearty Healing Chicken Pie","Dynamic_1_nDAXG!",""
|
||||
"Odd Stamps 2","Vissidal","Peng-Ya","Major Dissolving Isparian Crossbow","Dynamic_1_sx^9H^&Mnqp!",""
|
||||
"Odd Stamps 2","Vissidal","Colista Fluress","Lesser Amuli Shadow Leggings","Dynamic_1_Ej!Zz!",""
|
||||
"Odd Stamps 2","99.7S 96.7W","Surloshen Realaidain","Hammer of Lightning","Dynamic_1_tiiFC!","99.7S 96.7W"
|
||||
"Odd Stamps 2","Silyiun - 89.1N 47.6W","Fiun Gaya","Enhanced Shadow Gauntlets","Dynamic_1_hev0!","89.1N 47.6W"
|
||||
"Odd Stamps 2","Hermit - Thrungus Hole","Hermit","Scored Amuli Leggings","Dynamic_1_rDBG!",""
|
||||
"Odd Stamps 2","93.2N 48.2W - Eastwatch","Commander Rylane di Cinghalle","Acid Crossbow","Dynamic_1_pZpx41&!","93.2N 48.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Arbelests","Healing Carrot Soup","Dynamic_1_L3Hb3O!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Fists","Platemail Breastplate","Dynamic_1_xj&USOHNL9K&!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Bows","Tasty Stout","Dynamic_1_hw2LNdjT6!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Atlatls","Composite Crossbow with Handle","Dynamic_1_P6!!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Axes","Three Eyed Guppy","Dynamic_1_xX^IHjOo##J$8E!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Blades","Flaming Weeping Dagger","Dynamic_1_iFuvP!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Staves","Composite Crossbow","Dynamic_1_J$JV&VKf!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Orbs","Health Tincture","Dynamic_1_S&JMdWiBDy!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Maces","Wooden Scarecrow Guise","Dynamic_1_^pTx!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","32.0N, 43.2W - Virindi Crafters","Crafter of Knives","Scalemail Hauberk","Dynamic_1_6ZR$k^$Srwc3g!","32.0N, 43.2W"
|
||||
"Odd Stamps 2","83.4S 97.2E - Ithaenc","Abbess Zik'Lir","Hearty Fish Noodle","Dynamic_1_jmCfm1p5a!","83.4S 97.2E"
|
||||
"Odd Stamps 2","72.8N,25.0W - Stonehold nearby","Lord Pyrovor","Enhanced Shadow Greaves","Dynamic_1_Tw$7Zwmutan!","72.8N,25.0W"
|
||||
"Odd Stamps 2","VoD Encampment","Guard Alfric","Bowl of Rice","Dynamic_1_LZkvsu4Ln2$h!",""
|
||||
"Odd Stamps 2","VoD Encampment","Guard Taziq","Blackfire Shadow Sollerets","Dynamic_1_t9uxr!",""
|
||||
"Odd Stamps 2","VoD Encampment","Guard Q'alia","Ancient Relic Gauntlets","Dynamic_1_m1KeUXELMuH!",""
|
||||
"Odd Stamps 2","VoD Encampment","Guard Li","Frost Hatchet","Dynamic_1_XgrV$!",""
|
||||
"Odd Stamps 2","77.7S 97.0E Ithaenc","Shah-hi","Katar","Dynamic_1_G3N9HSXlowLT$!","77.7S 97.0E"
|
||||
"Odd Stamps 2","Releasing the Light - Reward Room","Calitoth","Fish","Dynamic_1_mu^91#T!",""
|
||||
"Odd Stamps 2","VoD Encampment","Guardian of the Forbidden","Princely Runed Dart Flinger","Dynamic_1_#BELoT72Ib!","Small Creepy Statue"
|
||||
"Odd Stamps 2","Shattered Outlands 94.0n 45.9w","Torgash","examines your Parchment","Dynamic_1_S","94.0n 45.9w"
|
||||
"Odd Stamps 2","Hoshino Must Die last room","Spirit of Bist'elle","Enhanced Shadow Breastplate","Dynamic_1_b!",""
|
||||
"Bandit Castle","","Karwin, the Lunatic","Chainmail Pauldrons","Dynamic_1_HIlMkY!",""
|
||||
"Bandit Castle","","Kiriel Shadowborn","Healing Apple Pie","Dynamic_1_WBzVFJpFUzHkC!",""
|
||||
"Bandit Castle","","Jourgensson","Hearty Healing Mushroom Pie","Dynamic_1_$W&Pl4!",""
|
||||
"Bandit Castle","","Gillian the Poacher","Peppermint Ice Cream","Dynamic_1_5oLp!",""
|
||||
"Bandit Castle","","Alison Dulane","Amuli Shadow Leggings","Dynamic_1_079u9!",""
|
||||
"Bandit Castle","","Arianna the Adept","Expired Stamina Draught","Dynamic_1_hZIsyYE!!OmcQ!",""
|
||||
"Bandit Castle","","Shanrek the Forger","Sparring Shirt","Dynamic_1_fbcmDRC!",""
|
||||
"Bandit Castle","","Neela Nashua","Perfect Dissolving Isparian Spear","Dynamic_1_4tXQFu&&o!",""
|
||||
"Bandit Castle","","Gwillim, the Apprentice","Lightning Flanged Mace","Dynamic_1_is#X6rBaprU!",""
|
||||
"Bur","","Drogur","Frost Yari","Dynamic_1_KS8e32dtk7t!",""
|
||||
"Bur","","Collector Golem","Upper Exoskeleton Metamorphi","Dynamic_1_4xdYA1QvaiDf^!",""
|
||||
"Bur","","Kuurak","Hearty Healing Chicken Noodle","Dynamic_1_Zapx!",""
|
||||
"Bur","","Furgal","Spitter Thorax Metamorphi","Dynamic_1_4rk&MTz!",""
|
||||
"Bur","","Tibik","Gear Crossbow","Dynamic_1_!Ce^d!",""
|
||||
"Bur","","Nimeruuk","Greater Celdon Shadow Sleeves","Dynamic_1_zIX1Sf6FJt!",""
|
||||
"Bur","","Kurket","Acidic Rejuvenation","Dynamic_1_snVaz#0Ze3R#4M!",""
|
||||
"Bur","","Brogosh","Lugian Morning Star","Dynamic_1_$9YdvC2jYTxWZ!",""
|
||||
"Bur","","Mohor","Quality Isparian Crossbow","Dynamic_1_qpXiWqwBTN4!",""
|
||||
"Bur","","Kushuk","Silifi of Crimson Stars","Dynamic_1_3ISBG!",""
|
||||
"Bur","","Borsh","Health Tonic","Dynamic_1_Jh4!",""
|
||||
"Bur","","Kuuru","Electric Compound Bow","Dynamic_1_vNktko1!",""
|
||||
"Bur","","Torgluuk, High Shaman of Kor-Gursha","Stout","Dynamic_1_2yxpXSMY!",""
|
||||
"Bur","","Scout Leader Tmauruk","Hood","Dynamic_1_fEiU!",""
|
||||
"Bur","","Gruuk'lar","Rynthid Tentacle Dagger","Dynamic_1_xFipmT1!",""
|
||||
"Gear Knight","Inner Sea Gearknight Invasion","Lieutenant Micham","Dabus","Dynamic_1_CQxkFJvoJrVx!",""
|
||||
"Gear Knight","Inner Sea Gearknight Invasion","Sir Oakley","Composite Crossbow with Handle","Dynamic_1_lh9wOaXR0!",""
|
||||
"Gear Knight","Inner Sea Gearknight Invasion","Lieutenant Faen","Blunt Bow","Dynamic_1_Vz#gp!",""
|
||||
"Gear Knight","Inner Sea Gearknight Invasion","Sir Stavitor","Red Tea","Dynamic_1_ogt05i!",""
|
||||
"Gear Knight","Inner Sea Gearknight Invasion","Dame Alistra","Superb Flaming Isparian Claw","Dynamic_1_y!",""
|
||||
"Gear Knight","Direland Gearknight Invasion","Sir Yanov","Major Shadow Greaves","Dynamic_1_BlAckAuHU#!",""
|
||||
"Gear Knight","Direland Gearknight Invasion","Sir Durnstad","Silifi of Crimson Stars","Dynamic_1_#Dfd!",""
|
||||
"Gear Knight","Direland Gearknight Invasion","Squire Tylaen","Good Coruscating Isparian Atlatl","Dynamic_1_i1Cxg8Bt!",""
|
||||
"Gear Knight","Direland Gearknight Invasion","Dame Trielle","Frost Yari","Dynamic_1_h^MdsKZ$6SSD!",""
|
||||
"Gear Knight","Direland Gearknight Invasion","T'ing Douzen","Panaq","Dynamic_1_p0BEy$e!",""
|
||||
"Gear Knight","Atamarr Tasks Dungeon","Bronze Gauntlet Knight-Commander","Frost Greataxe","Dynamic_1_REv&biyDw!",""
|
||||
"Gear Knight","Direland Gearknight Invasion","Copper Cog Craftsmaster","Greater Amuli Leggings of Frost","Dynamic_1_4uls5J!",""
|
||||
"Wai Jhou","","Kreavon","Skeleton Fish","Dynamic_1_KrPl9N5!",""
|
||||
"Wai Jhou","","Aun Teverea","Singularity Crossbow","Dynamic_1_Y9wg!RfKHoyL!",""
|
||||
"Wai Jhou","","Nona","Fish","Dynamic_1_JrzQr8U!",""
|
||||
"Wai Jhou","","Zho Heishan","Bandit Dagger","Dynamic_1_Abm8qK2!",""
|
||||
"Wai Jhou","","Sarkin Killcrane","Shadow Tassets","Dynamic_1_mb7NAtZEdBaz!",""
|
||||
"Wai Jhou","","Riordin Nightbane","Hafted Serpent Spear","Dynamic_1_cCzQdsl5JxLC!",""
|
||||
"Wai Jhou","","Lacarra Avanthi","Shou-jen Shozoku Trousers","Dynamic_1_ip&NsyQ!",""
|
||||
"Wai Jhou","","Xanda Har","Gold Fish","Dynamic_1_1CiKW8^x^$!",""
|
||||
"Rynthid","","Lohrn","Shreth Hide Shoes","Dynamic_1_cS!mivYZ^b!cAA!",""
|
||||
"Rynthid","","Rhys","Plate Leggings","Dynamic_1_A!!",""
|
||||
"Rynthid","","Morgethais","Silifi of Crimson Stars","Dynamic_1_wDTf#!",""
|
||||
"Rynthid","","Geilla","Audetaunga's Korua of the Mountains","Dynamic_1_&dNG5U4!",""
|
||||
"Rynthid","","Rinne Gorber","Brilliant Celdon Leggings","Dynamic_1_ln!Lx!",""
|
||||
"Rynthid","","Aun Ol'tra","Small Beer","Dynamic_1_&^3Hve4JXH^!",""
|
||||
"Rynthid","","Ranulf","Prismatic Celdon Sleeves","Dynamic_1_8n2l!",""
|
||||
"Rynthid","","Sylvanus","Ursuin Hide Coat","Dynamic_1_veaD!",""
|
||||
"Rynthid","","Marcus","Fish","Dynamic_1_bpNCu!rsf45Fk!",""
|
||||
"Rynthid","","Ilte Krongal","Hearty Mana Rabbit Noodle","Dynamic_1_AusVgDl!",""
|
||||
"Rynthid","","The Bringer of Light","Peppermint Hot Chocolate","Dynamic_1_LrpV!62!",""
|
||||
"Paradox Camp","Paradox Olthoi Camp","Ethan Wintermaine","Superb Flaming Isparian Bow","Dynamic_1_PPtO6!7dB!",""
|
||||
"Paradox Camp","","Adrien Swiftblade","Oak Stormwood Crossbow","Dynamic_1_R^1Uv!J8k!",""
|
||||
"Paradox Camp","","Alicia Swiftblade","Badlands Siraluun Dress","Dynamic_1_G0Rn1lOZKj7C!",""
|
||||
"Paradox Camp","","Tomihino","Dart Flinger","Dynamic_1_!$cc!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Peda's Assistant","examines your Parchment","Dynamic_1_3ddaHUzi!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Peda","examines your Parchment","Dynamic_1_1R9O85L$b!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Crusher","examines your Parchment","Dynamic_1_a&Z2!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Deena","examines your Parchment","Dynamic_1_cIZV2uDB6B!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Mac","examines your Parchment","Dynamic_1_5x^G2$X9!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Swift-Eye","examines your Parchment","Dynamic_1_o$yT7al7ZTxv!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Sasha","examines your Parchment","Dynamic_1_CvzZIz!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Dead-Eye","examines your Parchment","Dynamic_1_fP9y!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Lash","examines your Parchment","Dynamic_1_AniHdl4wtIuF0!",""
|
||||
"Paradox Camp","North Olthoi Burrow","Long-Shot","examines your Parchment","Dynamic_1_jJ^yEFc#m^M!",""
|
||||
"Graveyard","","Renata","Singularity Spear","Dynamic_1_1fDZO3!",""
|
||||
"Graveyard","","Yoite","Composite Bow with Handle","Dynamic_1_OG6jdId!",""
|
||||
"Graveyard","","Gadi","Scored Celdon Girth","Dynamic_1_ELgh#!",""
|
||||
"Graveyard","","Aethelswith","Leather Helm","Dynamic_1_cF!",""
|
||||
"Graveyard","","Mhoire Soldier","Superb Isparian Bow","Dynamic_1_VgB#WcZOIA!","North Soldier - Opposite side of bunker"
|
||||
"Graveyard","","Mhoire Soldier","Hafted Gromnie Banner with Crest","Dynamic_1_z$DX!","South Soldier - Opposite side of bunker"
|
||||
"Graveyard","","Apep-tek the Tolerant","Spectacular Lager","Dynamic_1_Y55^MqgC!","Above ground, outside bunker 65.3w 44.0w"
|
||||
"Graveyard","","Laylana","Stiletto","Dynamic_1_&SRgbH!","Above ground, outside bunker 65.2s 44.3w"
|
||||
"Graveyard","","Lo Shoen","Amateur Explorer Pants","Dynamic_1_102!pkgn8wAYSe!","Floating Platform - Level 50 req"
|
||||
"Graveyard","","Slubbley","Healing Cake","Dynamic_1_mDaEh7!",""
|
||||
"Graveyard","","Jailer","Good Shimmering Isparian Bow","Dynamic_1_2Hm6DL!","NE bunker aboveground 64.9s 44.1w"
|
||||
"Graveyard","","Kousu Temo","Fried Mushroom Rice Dough","Dynamic_1_QUXbn6!","EW Initiation guy, 64.2s 44.0w"
|
||||
"Graveyard","","Candrus Steady-Hand","Academy Mana Potion","Dynamic_1_BKq6N6nXoR!","CH Initiation guy, 65.8s 45.3w"
|
||||
"Graveyard","","Ancient Stones","Bandit Flaming Jambiya","Dynamic_1_xL!g4ZoCuv!H","Pile of stones at 66.5s 44.7w"
|
||||
"Graveyard","Mhoire Castle - Great Hall","Ancient Throne","Taiaha","Dynamic_1_&y4ettwcivZ5Nm!",""
|
||||
"Graveyard","Mhoire Castle - Great Hall","Shade of Antemy","Left Peg Leg","Dynamic_1_CphV&!",""
|
||||
"Graveyard","Mhoire Castle - Great Hall","Shade of Fordroth","Perfect Chilling Isparian Atlatl","Dynamic_1_M0u7js^$E!",""
|
||||
"Graveyard","Mhoire Castle - Great Hall","Shade of Terelev","Silifi of Crimson Stars","Dynamic_1_XPvw!",""
|
||||
"Graveyard","Mhoire Castle - Great Hall","Guliant","Celdon Girth of Acid","Dynamic_1_aCEEdQil42!",""
|
||||
"Neftet","","T'ing Setsuko","Flaming Broad Sword","Dynamic_1_JfmjJmY0O8r!",""
|
||||
"Neftet","","Nephthys","Red Tea","Dynamic_1_mnJCjm5QR$s&!",""
|
||||
"Neftet","","Fahneph","Gear Crossbow","Dynamic_1_owGS9WGJ1Q!",""
|
||||
"Neftet","","Nekshla","Mana Pumpkin Pie","Dynamic_1_AAQ1#!",""
|
||||
"Neftet","","Sir Hassim bin Tamarek","Enhanced Shadow Greaves","Dynamic_1_r7zID$U!",""
|
||||
"Neftet","","Sir Adarl","Bobo's Stout","Dynamic_1_SoBgM6JPckOY9!",""
|
||||
"Neftet","","Sir Ibreh bin Kassim","Expired Mana Tincture","Dynamic_1_aVMuY!",""
|
||||
"Neftet","","Sir Daeglan","Quality Coruscating Isparian Crossbow","Dynamic_1_n!",""
|
||||
"Neftet","","Bemeth the Gatherer","Lesser Koujia Breastplate of Acid","Dynamic_1_bda1WYoI!",""
|
||||
"Neftet","","Hammah al Rundik","Olthoi Greaves","Dynamic_1_9v^POv6ADt3r!",""
|
||||
"Neftet","22.2S 8.7E","Kaltus","Composite Bow with Handle","Dynamic_1_xWYS3fqIjPN!","22.2S 8.7E Not Dangerous run"
|
||||
"Frozen Valley","","Sir Donovan","Pickled Egg","Dynamic_1_ypu2L!",""
|
||||
"Frozen Valley","","Sir Learth","Royal Cabbage","Dynamic_1_xpAJDzm$!",""
|
||||
"Frozen Valley","","Lady Daenerah","Acid Spadone","Dynamic_1_$SDp1uWx8wq$!",""
|
||||
"Frozen Valley","","Gregoria, Gurog Destroyer","Chocolate Gromnie","Dynamic_1_!vr&1c1Ug1XI!",""
|
||||
"Frozen Valley","","Hunter","Hearty Healing Chicken Pie","Dynamic_1_Sy!9l0FAJFI!",""
|
||||
"Frozen Valley","","Leilah","Lightning Silifi","Dynamic_1_uyoL!",""
|
||||
"Frozen Valley","","Halvor","Noble Quarterstaff","Dynamic_1_LfLac!",""
|
||||
"Frozen Valley","","Kumiko","Expired Health Potion","Dynamic_1_TB!q!",""
|
||||
"Frozen Valley","","Archmage Ichihiri","Arbalest","Dynamic_1_HzvCs4B2!",""
|
||||
"Hoshino Tent","","Sergeant Trebuus","Soldier Pincer Metamorphi","Dynamic_1_GQIb1mF!",""
|
||||
"Hoshino Tent","","Sergeant Freng","Lightning War Axe","Dynamic_1_wVJm&#Lpz7AQ#F",""
|
||||
"Hoshino Tent","","Aun Kirtal","Arena Bow","Dynamic_1_V9ffGx!",""
|
||||
"Hoshino Tent","","Lieutenant Aurin","Enhanced Smoldering Atlan Sword","Dynamic_1_4qlVcAWbM!",""
|
||||
"Hoshino Tent","","Lord Eorlinde","Major Shadow Gauntlets","Dynamic_1_zkzTna!",""
|
||||
"Hoshino Tent","","Griffon","Mana Elixir","Dynamic_1_b4^F&M1^uG!",""
|
||||
"Hoshino Tent","","Hanamoto Aki'ko","Lightning Nekode","Dynamic_1_3Qlg!",""
|
||||
"Hoshino Tent","","Corporal Irashi","Lesser Koujia Shadow Leggings","Dynamic_1_2DBoreKEH!",""
|
||||
"Hoshino Tent","","Lieutenant Takamaki","Silifi of Crimson Stars","Dynamic_1_#hzL!",""
|
||||
"Hoshino Tent","","Lieutenant Roothe","Fried Rabbit","Dynamic_1_XuH!z7l!",""
|
||||
"Viridian Rise","","Brellegia","Greater Celdon Breastplate of Acid","Dynamic_1_mCyu9F!","Requires Viridian Rise Recall Gem"
|
||||
"Viridian Rise","","Summercrown","Tachi","Dynamic_1_R8H6nh!",""
|
||||
"Viridian Rise","","Aangesilus","Slashing Compound Bow","Dynamic_1_2LJyvGJL!",""
|
||||
"Viridian Rise","","Dridge","Greater Amuli Leggings of Flame","Dynamic_1_LP3Ee7tH!",""
|
||||
"Viridian Rise","","Kervim'telek","Ursuin Hide Coat","Dynamic_1_E5$S!",""
|
||||
"Viridian Rise","","Swift","Fried Chicken","Dynamic_1_hYVV!",""
|
||||
"Ayan","","Aludi al-Jaladh","Seasoned Explorer Gauntlets","Dynamic_1_7$I7bC!",""
|
||||
"Ayan","","Aun Javhalrea, the Game Warden","Frost Ono","Dynamic_1_UdRA9W!",""
|
||||
"Ayan","","Aun Khekierea","Rich Mocha","Dynamic_1_Yt1uiSkCgK!",""
|
||||
"Ayan","","Aun Aukherea","Chocolate Cookie","Dynamic_1_G$iqi763E!",""
|
||||
"Ayan","","Shuthoth","Silifi of Crimson Stars","Dynamic_1_CkuPj0IwP!",""
|
||||
"Ayan","","Yuan Hanzu","Acid Hatchet","Dynamic_1_t^CiJAt2TBz17!",""
|
||||
"Ayan","","Joku Shunja","Dho Life Apprentice Robe","Dynamic_1_&X4EDhy!",""
|
||||
"Ayan","","Aaminah","Upgraded Marksman's Robe","Dynamic_1_YlHC^cbS!",""
|
||||
"Ayan","","Anfram Mellow","Ulgrim's Bunny Slippers","Dynamic_1_$MJj0ytiSy0CKN!",""
|
||||
"Ayan","","Alishia bint Aldan","Lightning Hatchet","Dynamic_1_87z&&Ok2o&jo!",""
|
||||
"Ayan","","Vierana du Canamorra","Fine Shadow Atlan Mace","Dynamic_1_qtZdY0C!ae!",""
|
||||
"Ayan","","Qurakh al-Taal","Hearty Mana Beef Stew","Dynamic_1_Ug2snTqb44!",""
|
||||
"Ayan","","Laedron the Geomancer","Fine Stinging Atlan Spear","Dynamic_1_2lXQdqHWxPU!",""
|
||||
"Ayan","","Rohula bint Ludun","Arena Staff","Dynamic_1_SjjPqyCHNigY!",""
|
||||
"Ayan","","Guard Winterborn","Silifi of Crimson Stars","Dynamic_1_!fzudXFZV0Je3!",""
|
||||
"Ayan","","Ennio di Cinghalle","Perfect Chilling Isparian Claw","Dynamic_1_fYP!",""
|
||||
"Ayan","","Lydda","Pathwarden Scale Hauberk","Dynamic_1_neYBz15!",""
|
||||
"Ayan","","Gaston Shadowbound","Major Shadow Tassets","Dynamic_1_jdMT!",""
|
||||
"Ayan","","Harkwull the Discreet","Quality Flaming Isparian Crossbow","Dynamic_1_Bq7Brhg!",""
|
||||
"Ayan","","Tanami Kei","Souldrinker","Dynamic_1_en!",""
|
||||
"Ayan","","Lamorda Loschi","Major Shadow Sollerets","Dynamic_1_2xn4LwsUdh!",""
|
||||
"Ayan","","Soju Bo-Ki","Composite Crossbow with Handle","Dynamic_1_ADDKG!",""
|
||||
"Ayan","","Hoshar ibn Jalaq","High Balance Testing Coat","Dynamic_1_bZ4bc!",""
|
||||
"Ayan","","Guard Bey","Tasty Stout","Dynamic_1_&!4f5YlXZ!",""
|
||||
"Ayan","","Ishaq the Philosopher","Enhanced Skeletal Atlatl","Dynamic_1_H3UNETkRXTX!",""
|
||||
"Candeth Keep","","Morathe gives you","Superb Isparian Atlatl","Dynamic_1_g9M7bV3z3#S!",""
|
||||
"Candeth Keep","","Aun Autuorea gives you","Singularity Katar","Dynamic_1_5kEI0!",""
|
||||
"Candeth Keep","","Talira Dain","Composite Bow","Dynamic_1_5i1z1Mb!","No text about being given item, it just shows up in backpack"
|
||||
"Candeth Keep","","Dalius Kendmar gives you","Undead Guise","Dynamic_1_YFrw!",""
|
||||
"Candeth Keep","","Grania the Bold gives you","Composite Crossbow with Handle","Dynamic_1_DaevbVP!",""
|
||||
"Candeth Keep","","Yukara Miko the Collector","Acid Longbow","Dynamic_1_F1r^qTQ!",""
|
||||
"Candeth Keep","","Ryukai Hiro","Good Olthoi Pauldrons","Dynamic_1_HeucrAy6c!",""
|
||||
"Candeth Keep","","Garaena the Emissary","Seasoned Explorer Arbalest","Dynamic_1_es^0FY!","Aerlinthe Portal NPC"
|
||||
|
142
Plugins/RynthCore.Plugin.RynthOracle/Resources/equipmentsets.csv
Normal file
142
Plugins/RynthCore.Plugin.RynthOracle/Resources/equipmentsets.csv
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
Id,Name
|
||||
0,Invalid
|
||||
1,Test
|
||||
2,Test2
|
||||
3,Unknown3
|
||||
4,CarraidasBenediction
|
||||
5,NobleRelic
|
||||
6,AncientRelic
|
||||
7,AlduressaRelic
|
||||
8,Ninja
|
||||
9,EmpyreanRings
|
||||
10,ArmMindHeart
|
||||
11,ArmorPerfectLight
|
||||
12,ArmorPerfectLight2
|
||||
13,Soldiers
|
||||
14,Adepts
|
||||
15,Archers
|
||||
16,Defenders
|
||||
17,Tinkers
|
||||
18,Crafters
|
||||
19,Hearty
|
||||
20,Dexterous
|
||||
21,Wise
|
||||
22,Swift
|
||||
23,Hardened
|
||||
24,Reinforced
|
||||
25,Interlocking
|
||||
26,Flameproof
|
||||
27,Acidproof
|
||||
28,Coldproof
|
||||
29,Lightningproof
|
||||
30,SocietyArmor
|
||||
31,ColosseumClothing
|
||||
32,GraveyardClothing
|
||||
33,OlthoiClothing
|
||||
34,NoobieArmor
|
||||
35,AetheriaDefense
|
||||
36,AetheriaDestruction
|
||||
37,AetheriaFury
|
||||
38,AetheriaGrowth
|
||||
39,AetheriaVigor
|
||||
40,RareDamageResistance
|
||||
41,RareDamageBoost
|
||||
42,OlthoiArmorDRed
|
||||
43,OlthoiArmorCRat
|
||||
44,OlthoiArmorCRed
|
||||
45,OlthoiArmorDRat
|
||||
46,AlduressaRelicUpgrade
|
||||
47,AncientRelicUpgrade
|
||||
48,NobleRelicUpgrade
|
||||
49,CloakAlchemy
|
||||
50,CloakArcaneLore
|
||||
51,CloakArmorTinkering
|
||||
52,CloakAssessPerson
|
||||
53,CloakLightWeapons
|
||||
54,CloakMissileWeapons
|
||||
55,CloakCooking
|
||||
56,CloakCreatureEnchantment
|
||||
57,CloakCrossbow
|
||||
58,CloakFinesseWeapons
|
||||
59,CloakDeception
|
||||
60,CloakFletching
|
||||
61,CloakHealing
|
||||
62,CloakItemEnchantment
|
||||
63,CloakItemTinkering
|
||||
64,CloakLeadership
|
||||
65,CloakLifeMagic
|
||||
66,CloakLoyalty
|
||||
67,CloakMace
|
||||
68,CloakMagicDefense
|
||||
69,CloakMagicItemTinkering
|
||||
70,CloakManaConversion
|
||||
71,CloakMeleeDefense
|
||||
72,CloakMissileDefense
|
||||
73,CloakSalvaging
|
||||
74,CloakSpear
|
||||
75,CloakStaff
|
||||
76,CloakHeavyWeapons
|
||||
77,CloakThrownWeapon
|
||||
78,CloakTwoHandedCombat
|
||||
79,CloakUnarmedCombat
|
||||
80,CloakVoidMagic
|
||||
81,CloakWarMagic
|
||||
82,CloakWeaponTinkering
|
||||
83,CloakAssessCreature
|
||||
84,CloakDirtyFighting
|
||||
85,CloakDualWield
|
||||
86,CloakRecklessness
|
||||
87,CloakShield
|
||||
88,CloakSneakAttack
|
||||
89,Ninja_New
|
||||
90,CloakSummoning
|
||||
91,ShroudedSoul
|
||||
92,DarkenedMind
|
||||
93,CloudedSpirit
|
||||
94,MinorStingingShroudedSoul
|
||||
95,MinorSparkingShroudedSoul
|
||||
96,MinorSmolderingShroudedSoul
|
||||
97,MinorShiveringShroudedSoul
|
||||
98,MinorStingingDarkenedMind
|
||||
99,MinorSparkingDarkenedMind
|
||||
100,MinorSmolderingDarkenedMind
|
||||
101,MinorShiveringDarkenedMind
|
||||
102,MinorStingingCloudedSpirit
|
||||
103,MinorSparkingCloudedSpirit
|
||||
104,MinorSmolderingCloudedSpirit
|
||||
105,MinorShiveringCloudedSpirit
|
||||
106,MajorStingingShroudedSoul
|
||||
107,MajorSparkingShroudedSoul
|
||||
108,MajorSmolderingShroudedSoul
|
||||
109,MajorShiveringShroudedSoul
|
||||
110,MajorStingingDarkenedMind
|
||||
111,MajorSparkingDarkenedMind
|
||||
112,MajorSmolderingDarkenedMind
|
||||
113,MajorShiveringDarkenedMind
|
||||
114,MajorStingingCloudedSpirit
|
||||
115,MajorSparkingCloudedSpirit
|
||||
116,MajorSmolderingCloudedSpirit
|
||||
117,MajorShiveringCloudedSpirit
|
||||
118,BlackfireStingingShroudedSoul
|
||||
119,BlackfireSparkingShroudedSoul
|
||||
120,BlackfireSmolderingShroudedSoul
|
||||
121,BlackfireShiveringShroudedSoul
|
||||
122,BlackfireStingingDarkenedMind
|
||||
123,BlackfireSparkingDarkenedMind
|
||||
124,BlackfireSmolderingDarkenedMind
|
||||
125,BlackfireShiveringDarkenedMind
|
||||
126,BlackfireStingingCloudedSpirit
|
||||
127,BlackfireSparkingCloudedSpirit
|
||||
128,BlackfireSmolderingCloudedSpirit
|
||||
129,BlackfireShiveringCloudedSpirit
|
||||
130,ShimmeringShadowsSet
|
||||
131,BrownSocietyLocket
|
||||
132,YellowSocietyLocket
|
||||
133,RedSocietyBand
|
||||
134,GreenSocietyBand
|
||||
135,PurpleSocietyBand
|
||||
136,BlueSocietyBand
|
||||
137,GauntletGarb
|
||||
138,ParagonMissile
|
||||
139,ParagonCaster
|
||||
140,ParagonMelee
|
||||
|
14
Plugins/RynthCore.Plugin.RynthOracle/Resources/masteries.csv
Normal file
14
Plugins/RynthCore.Plugin.RynthOracle/Resources/masteries.csv
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Id,Name
|
||||
0,Undef
|
||||
1,Unarmed
|
||||
2,Sword
|
||||
3,Axe
|
||||
4,Mace
|
||||
5,Spear
|
||||
6,Dagger
|
||||
7,Staff
|
||||
8,Bow
|
||||
9,Crossbow
|
||||
10,Thrown
|
||||
11,TwoHanded
|
||||
12,Magic
|
||||
|
79
Plugins/RynthCore.Plugin.RynthOracle/Resources/materials.csv
Normal file
79
Plugins/RynthCore.Plugin.RynthOracle/Resources/materials.csv
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
Id,Name
|
||||
0,Unknown
|
||||
1,Ceramic
|
||||
2,Porcelain
|
||||
3,Cloth
|
||||
4,Linen
|
||||
5,Satin
|
||||
6,Silk
|
||||
7,Velvet
|
||||
8,Wool
|
||||
9,Gem
|
||||
10,Agate
|
||||
11,Amber
|
||||
12,Amethyst
|
||||
13,Aquamarine
|
||||
14,Azurite
|
||||
15,BlackGarnet
|
||||
16,BlackOpal
|
||||
17,Bloodstone
|
||||
18,Carnelian
|
||||
19,Citrine
|
||||
20,Diamond
|
||||
21,Emerald
|
||||
22,FireOpal
|
||||
23,GreenGarnet
|
||||
24,GreenJade
|
||||
25,Hematite
|
||||
26,ImperialTopaz
|
||||
27,Jet
|
||||
28,LapisLazuli
|
||||
29,LavenderJade
|
||||
30,Malachite
|
||||
31,Moonstone
|
||||
32,Onyx
|
||||
33,Opal
|
||||
34,Peridot
|
||||
35,RedGarnet
|
||||
36,RedJade
|
||||
37,RoseQuartz
|
||||
38,Ruby
|
||||
39,Sapphire
|
||||
40,SmokeyQuartz
|
||||
41,Sunstone
|
||||
42,TigerEye
|
||||
43,Tourmaline
|
||||
44,Turquoise
|
||||
45,WhiteJade
|
||||
46,WhiteQuartz
|
||||
47,WhiteSapphire
|
||||
48,YellowGarnet
|
||||
49,YellowTopaz
|
||||
50,Zircon
|
||||
51,Ivory
|
||||
52,Leather
|
||||
53,ArmoredilloHide
|
||||
54,GromnieHide
|
||||
55,ReedSharkHide
|
||||
56,Metal
|
||||
57,Brass
|
||||
58,Bronze
|
||||
59,Copper
|
||||
60,Gold
|
||||
61,Iron
|
||||
62,Pyreal
|
||||
63,Silver
|
||||
64,Steel
|
||||
65,Stone
|
||||
66,Alabaster
|
||||
67,Granite
|
||||
68,Marble
|
||||
69,Obsidian
|
||||
70,Sandstone
|
||||
71,Serpentine
|
||||
72,Wood
|
||||
73,Ebony
|
||||
74,Mahogany
|
||||
75,Oak
|
||||
76,Pine
|
||||
77,Teak
|
||||
|
56
Plugins/RynthCore.Plugin.RynthOracle/Resources/skills.csv
Normal file
56
Plugins/RynthCore.Plugin.RynthOracle/Resources/skills.csv
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
Id,Name
|
||||
0,None
|
||||
1,Axe
|
||||
2,Bow
|
||||
3,Crossbow
|
||||
4,Dagger
|
||||
5,Mace
|
||||
6,MeleeDefense
|
||||
7,MissileDefense
|
||||
8,Sling
|
||||
9,Spear
|
||||
10,Staff
|
||||
11,Sword
|
||||
12,ThrownWeapon
|
||||
13,UnarmedCombat
|
||||
14,ArcaneLore
|
||||
15,MagicDefense
|
||||
16,ManaConversion
|
||||
17,Spellcraft
|
||||
18,ItemTinkering
|
||||
19,AssessPerson
|
||||
20,Deception
|
||||
21,Healing
|
||||
22,Jump
|
||||
23,Lockpick
|
||||
24,Run
|
||||
25,Awareness
|
||||
26,ArmsAndArmorRepair
|
||||
27,AssessCreature
|
||||
28,WeaponTinkering
|
||||
29,ArmorTinkering
|
||||
30,MagicItemTinkering
|
||||
31,CreatureEnchantment
|
||||
32,ItemEnchantment
|
||||
33,LifeMagic
|
||||
34,WarMagic
|
||||
35,Leadership
|
||||
36,Loyalty
|
||||
37,Fletching
|
||||
38,Alchemy
|
||||
39,Cooking
|
||||
40,Salvaging
|
||||
41,TwoHandedCombat
|
||||
42,Gearcraft
|
||||
43,VoidMagic
|
||||
44,HeavyWeapons
|
||||
45,LightWeapons
|
||||
46,FinesseWeapons
|
||||
47,MissileWeapons
|
||||
48,Shield
|
||||
49,DualWield
|
||||
50,Recklessness
|
||||
51,SneakAttack
|
||||
52,DirtyFighting
|
||||
53,Challenge
|
||||
54,Summoning
|
||||
|
|
|
@ -0,0 +1,730 @@
|
|||
Id,Name
|
||||
0,Undef
|
||||
1,StrengthRaising
|
||||
2,StrengthLowering
|
||||
3,EnduranceRaising
|
||||
4,EnduranceLowering
|
||||
5,QuicknessRaising
|
||||
6,QuicknessLowering
|
||||
7,CoordinationRaising
|
||||
8,CoordinationLowering
|
||||
9,FocusRaising
|
||||
10,FocusLowering
|
||||
11,SelfRaising
|
||||
12,SelfLowering
|
||||
13,FocusConcentration
|
||||
14,FocusDisruption
|
||||
15,FocusBrilliance
|
||||
16,FocusDullness
|
||||
17,AxeRaising
|
||||
18,AxeLowering
|
||||
19,BowRaising
|
||||
20,BowLowering
|
||||
21,CrossbowRaising
|
||||
22,CrossbowLowering
|
||||
23,DaggerRaising
|
||||
24,DaggerLowering
|
||||
25,MaceRaising
|
||||
26,MaceLowering
|
||||
27,SpearRaising
|
||||
28,SpearLowering
|
||||
29,StaffRaising
|
||||
30,StaffLowering
|
||||
31,SwordRaising
|
||||
32,SwordLowering
|
||||
33,ThrownWeaponsRaising
|
||||
34,ThrownWeaponsLowering
|
||||
35,UnarmedCombatRaising
|
||||
36,UnarmedCombatLowering
|
||||
37,MeleeDefenseRaising
|
||||
38,MeleeDefenseLowering
|
||||
39,MissileDefenseRaising
|
||||
40,MissileDefenseLowering
|
||||
41,MagicDefenseRaising
|
||||
42,MagicDefenseLowering
|
||||
43,CreatureEnchantmentRaising
|
||||
44,CreatureEnchantmentLowering
|
||||
45,ItemEnchantmentRaising
|
||||
46,ItemEnchantmentLowering
|
||||
47,LifeMagicRaising
|
||||
48,LifeMagicLowering
|
||||
49,WarMagicRaising
|
||||
50,WarMagicLowering
|
||||
51,ManaConversionRaising
|
||||
52,ManaConversionLowering
|
||||
53,ArcaneLoreRaising
|
||||
54,ArcaneLoreLowering
|
||||
55,AppraiseArmorRaising
|
||||
56,AppraiseArmorLowering
|
||||
57,AppraiseItemRaising
|
||||
58,AppraiseItemLowering
|
||||
59,AppraiseMagicItemRaising
|
||||
60,AppraiseMagicItemLowering
|
||||
61,AppraiseWeaponRaising
|
||||
62,AppraiseWeaponLowering
|
||||
63,AssessMonsterRaising
|
||||
64,AssessMonsterLowering
|
||||
65,DeceptionRaising
|
||||
66,DeceptionLowering
|
||||
67,HealingRaising
|
||||
68,HealingLowering
|
||||
69,JumpRaising
|
||||
70,JumpLowering
|
||||
71,LeadershipRaising
|
||||
72,LeadershipLowering
|
||||
73,LockpickRaising
|
||||
74,LockpickLowering
|
||||
75,LoyaltyRaising
|
||||
76,LoyaltyLowering
|
||||
77,RunRaising
|
||||
78,RunLowering
|
||||
79,HealthRaising
|
||||
80,HealthLowering
|
||||
81,StaminaRaising
|
||||
82,StaminaLowering
|
||||
83,ManaRaising
|
||||
84,ManaLowering
|
||||
85,ManaRemedy
|
||||
86,ManaMalediction
|
||||
87,HealthTransfertocaster
|
||||
88,HealthTransferfromcaster
|
||||
89,StaminaTransfertocaster
|
||||
90,StaminaTransferfromcaster
|
||||
91,ManaTransfertocaster
|
||||
92,ManaTransferfromcaster
|
||||
93,HealthAccelerating
|
||||
94,HealthDecelerating
|
||||
95,StaminaAccelerating
|
||||
96,StaminaDecelerating
|
||||
97,ManaAccelerating
|
||||
98,ManaDecelerating
|
||||
99,VitaeRaising
|
||||
100,VitaeLowering
|
||||
101,AcidProtection
|
||||
102,AcidVulnerability
|
||||
103,BludgeonProtection
|
||||
104,BludgeonVulnerability
|
||||
105,ColdProtection
|
||||
106,ColdVulnerability
|
||||
107,ElectricProtection
|
||||
108,ElectricVulnerability
|
||||
109,FireProtection
|
||||
110,FireVulnerability
|
||||
111,PierceProtection
|
||||
112,PierceVulnerability
|
||||
113,SlashProtection
|
||||
114,SlashVulnerability
|
||||
115,ArmorRaising
|
||||
116,ArmorLowering
|
||||
117,AcidMissile
|
||||
118,BludgeoningMissile
|
||||
119,ColdMissile
|
||||
120,ElectricMissile
|
||||
121,FireMissile
|
||||
122,PiercingMissile
|
||||
123,SlashingMissile
|
||||
124,AcidSeeker
|
||||
125,BludgeoningSeeker
|
||||
126,ColdSeeker
|
||||
127,ElectricSeeker
|
||||
128,FireSeeker
|
||||
129,PiercingSeeker
|
||||
130,SlashingSeeker
|
||||
131,AcidBurst
|
||||
132,BludgeoningBurst
|
||||
133,ColdBurst
|
||||
134,ElectricBurst
|
||||
135,FireBurst
|
||||
136,PiercingBurst
|
||||
137,SlashingBurst
|
||||
138,AcidBlast
|
||||
139,BludgeoningBlast
|
||||
140,ColdBlast
|
||||
141,ElectricBlast
|
||||
142,FireBlast
|
||||
143,PiercingBlast
|
||||
144,SlashingBlast
|
||||
145,AcidScatter
|
||||
146,BludgeoningScatter
|
||||
147,ColdScatter
|
||||
148,ElectricScatter
|
||||
149,FireScatter
|
||||
150,PiercingScatter
|
||||
151,SlashingScatter
|
||||
152,AttackModRaising
|
||||
153,AttackModLowering
|
||||
154,DamageRaising
|
||||
155,DamageLowering
|
||||
156,DefenseModRaising
|
||||
157,DefenseModLowering
|
||||
158,WeaponTimeRaising
|
||||
159,WeaponTimeLowering
|
||||
160,ArmorValueRaising
|
||||
161,ArmorValueLowering
|
||||
162,AcidResistanceRaising
|
||||
163,AcidResistanceLowering
|
||||
164,BludgeonResistanceRaising
|
||||
165,BludgeonResistanceLowering
|
||||
166,ColdResistanceRaising
|
||||
167,ColdResistanceLowering
|
||||
168,ElectricResistanceRaising
|
||||
169,ElectricResistanceLowering
|
||||
170,FireResistanceRaising
|
||||
171,FireResistanceLowering
|
||||
172,PierceResistanceRaising
|
||||
173,PierceResistanceLowering
|
||||
174,SlashResistanceRaising
|
||||
175,SlashResistanceLowering
|
||||
176,BludgeoningResistanceRaising
|
||||
177,BludgeoningResistanceLowering
|
||||
178,SlashingResistanceRaising
|
||||
179,SlashingResistanceLowering
|
||||
180,PiercingResistanceRaising
|
||||
181,PiercingResistanceLowering
|
||||
182,ElectricalResistanceRaising
|
||||
183,ElectricalResistanceLowering
|
||||
184,FrostResistanceRaising
|
||||
185,FrostResistanceLowering
|
||||
186,FlameResistanceRaising
|
||||
187,FlameResistanceLowering
|
||||
188,AcidicResistanceRaising
|
||||
189,AcidicResistanceLowering
|
||||
190,ArmorLevelRaising
|
||||
191,ArmorLevelLowering
|
||||
192,LockpickResistanceRaising
|
||||
193,LockpickResistanceLowering
|
||||
194,ManaConversionModLowering
|
||||
195,ManaConversionModRaising
|
||||
196,VisionRaising
|
||||
197,VisionLowering
|
||||
198,TransparencyRaising
|
||||
199,TransparencyLowering
|
||||
200,PortalTie
|
||||
201,PortalRecall
|
||||
202,PortalCreation
|
||||
203,PortalItemCreation
|
||||
204,Vitae
|
||||
205,AssessPersonRaising
|
||||
206,AssessPersonLowering
|
||||
207,AcidVolley
|
||||
208,BludgeoningVolley
|
||||
209,FrostVolley
|
||||
210,LightningVolley
|
||||
211,FlameVolley
|
||||
212,ForceVolley
|
||||
213,BladeVolley
|
||||
214,PortalSending
|
||||
215,LifestoneSending
|
||||
216,CookingRaising
|
||||
217,CookingLowering
|
||||
218,FletchingRaising
|
||||
219,FletchingLowering
|
||||
220,AlchemyLowering
|
||||
221,AlchemyRaising
|
||||
222,AcidRing
|
||||
223,BludgeoningRing
|
||||
224,ColdRing
|
||||
225,ElectricRing
|
||||
226,FireRing
|
||||
227,PiercingRing
|
||||
228,SlashingRing
|
||||
229,AcidWall
|
||||
230,BludgeoningWall
|
||||
231,ColdWall
|
||||
232,ElectricWall
|
||||
233,FireWall
|
||||
234,PiercingWall
|
||||
235,SlashingWall
|
||||
236,AcidStrike
|
||||
237,BludgeoningStrike
|
||||
238,ColdStrike
|
||||
239,ElectricStrike
|
||||
240,FireStrike
|
||||
241,PiercingStrike
|
||||
242,SlashingStrike
|
||||
243,AcidStreak
|
||||
244,BludgeoningStreak
|
||||
245,ColdStreak
|
||||
246,ElectricStreak
|
||||
247,FireStreak
|
||||
248,PiercingStreak
|
||||
249,SlashingStreak
|
||||
250,Dispel
|
||||
251,CreatureMysticRaising
|
||||
252,CreatureMysticLowering
|
||||
253,ItemMysticRaising
|
||||
254,ItemMysticLowering
|
||||
255,WarMysticRaising
|
||||
256,WarMysticLowering
|
||||
257,HealthRestoring
|
||||
258,HealthDepleting
|
||||
259,ManaRestoring
|
||||
260,ManaDepleting
|
||||
261,StrengthIncrease
|
||||
262,StrengthDecrease
|
||||
263,EnduranceIncrease
|
||||
264,EnduranceDecrease
|
||||
265,QuicknessIncrease
|
||||
266,QuicknessDecrease
|
||||
267,CoordinationIncrease
|
||||
268,CoordinationDecrease
|
||||
269,FocusIncrease
|
||||
270,FocusDecrease
|
||||
271,SelfIncrease
|
||||
272,SelfDecrease
|
||||
273,GreatVitalityRaising
|
||||
274,PoorVitalityLowering
|
||||
275,GreatVigorRaising
|
||||
276,PoorVigorLowering
|
||||
277,GreaterIntellectRaising
|
||||
278,LessorIntellectLowering
|
||||
279,LifeGiverRaising
|
||||
280,LifeTakerLowering
|
||||
281,StaminaGiverRaising
|
||||
282,StaminaTakerLowering
|
||||
283,ManaGiverRaising
|
||||
284,ManaTakerLowering
|
||||
285,AcidWardProtection
|
||||
286,AcidWardVulnerability
|
||||
287,FireWardProtection
|
||||
288,FireWardVulnerability
|
||||
289,ColdWardProtection
|
||||
290,ColdWardVulnerability
|
||||
291,ElectricWardProtection
|
||||
292,ElectricWardVulnerability
|
||||
293,LeadershipObedienceRaising
|
||||
294,LeadershipObedienceLowering
|
||||
295,MeleeDefenseShelterRaising
|
||||
296,MeleeDefenseShelterLowering
|
||||
297,MissileDefenseShelterRaising
|
||||
298,MissileDefenseShelterLowering
|
||||
299,MagicDefenseShelterRaising
|
||||
300,MagicDefenseShelterLowering
|
||||
301,HuntersAcumenRaising
|
||||
302,HuntersAcumenLowering
|
||||
303,StillWaterRaising
|
||||
304,StillWaterLowering
|
||||
305,StrengthofEarthRaising
|
||||
306,StrengthofEarthLowering
|
||||
307,TorrentRaising
|
||||
308,TorrentLowering
|
||||
309,GrowthRaising
|
||||
310,GrowthLowering
|
||||
311,CascadeAxeRaising
|
||||
312,CascadeAxeLowering
|
||||
313,CascadeDaggerRaising
|
||||
314,CascadeDaggerLowering
|
||||
315,CascadeMaceRaising
|
||||
316,CascadeMaceLowering
|
||||
317,CascadeSpearRaising
|
||||
318,CascadeSpearLowering
|
||||
319,CascadeStaffRaising
|
||||
320,CascadeStaffLowering
|
||||
321,StoneCliffsRaising
|
||||
322,StoneCliffsLowering
|
||||
323,MaxDamageRaising
|
||||
324,MaxDamageLowering
|
||||
325,BowDamageRaising
|
||||
326,BowDamageLowering
|
||||
327,BowRangeRaising
|
||||
328,BowRangeLowering
|
||||
329,ExtraDefenseModRaising
|
||||
330,ExtraDefenseModLowering
|
||||
331,ExtraBowSkillRaising
|
||||
332,ExtraBowSkillLowering
|
||||
333,ExtraAlchemySkillRaising
|
||||
334,ExtraAlchemySkillLowering
|
||||
335,ExtraArcaneLoreSkillRaising
|
||||
336,ExtraArcaneLoreSkillLowering
|
||||
337,ExtraAppraiseArmorSkillRaising
|
||||
338,ExtraAppraiseArmorSkillLowering
|
||||
339,ExtraCookingSkillRaising
|
||||
340,ExtraCookingSkillLowering
|
||||
341,ExtraCrossbowSkillRaising
|
||||
342,ExtraCrossbowSkillLowering
|
||||
343,ExtraDeceptionSkillRaising
|
||||
344,ExtraDeceptionSkillLowering
|
||||
345,ExtraLoyaltySkillRaising
|
||||
346,ExtraLoyaltySkillLowering
|
||||
347,ExtraFletchingSkillRaising
|
||||
348,ExtraFletchingSkillLowering
|
||||
349,ExtraHealingSkillRaising
|
||||
350,ExtraHealingSkillLowering
|
||||
351,ExtraMeleeDefenseSkillRaising
|
||||
352,ExtraMeleeDefenseSkillLowering
|
||||
353,ExtraAppraiseItemSkillRaising
|
||||
354,ExtraAppraiseItemSkillLowering
|
||||
355,ExtraJumpingSkillRaising
|
||||
356,ExtraJumpingSkillLowering
|
||||
357,ExtraLifeMagicSkillRaising
|
||||
358,ExtraLifeMagicSkillLowering
|
||||
359,ExtraLockpickSkillRaising
|
||||
360,ExtraLockpickSkillLowering
|
||||
361,ExtraAppraiseMagicItemSkillRaising
|
||||
362,ExtraAppraiseMagicItemSkillLowering
|
||||
363,ExtraManaConversionSkillRaising
|
||||
364,ExtraManaConversionSkillLowering
|
||||
365,ExtraAssessCreatureSkillRaising
|
||||
366,ExtraAssessCreatureSkillLowering
|
||||
367,ExtraAssessPersonSkillRaising
|
||||
368,ExtraAssessPersonSkillLowering
|
||||
369,ExtraRunSkillRaising
|
||||
370,ExtraRunSkillLowering
|
||||
371,ExtraSwordSkillRaising
|
||||
372,ExtraSwordSkillLowering
|
||||
373,ExtraThrownWeaponsSkillRaising
|
||||
374,ExtraThrownWeaponsSkillLowering
|
||||
375,ExtraUnarmedCombatSkillRaising
|
||||
376,ExtraUnarmedCombatSkillLowering
|
||||
377,ExtraAppraiseWeaponSkillRaising
|
||||
378,ExtraAppraiseWeaponSkillLowering
|
||||
379,ArmorIncrease
|
||||
380,ArmorDecrease
|
||||
381,ExtraAcidResistanceRaising
|
||||
382,ExtraAcidResistanceLowering
|
||||
383,ExtraBludgeonResistanceRaising
|
||||
384,ExtraBludgeonResistanceLowering
|
||||
385,ExtraFireResistanceRaising
|
||||
386,ExtraFireResistanceLowering
|
||||
387,ExtraColdResistanceRaising
|
||||
388,ExtraColdResistanceLowering
|
||||
389,ExtraAttackModRaising
|
||||
390,ExtraAttackModLowering
|
||||
391,ExtraArmorValueRaising
|
||||
392,ExtraArmorValueLowering
|
||||
393,ExtraPierceResistanceRaising
|
||||
394,ExtraPierceResistanceLowering
|
||||
395,ExtraSlashResistanceRaising
|
||||
396,ExtraSlashResistanceLowering
|
||||
397,ExtraElectricResistanceRaising
|
||||
398,ExtraElectricResistanceLowering
|
||||
399,ExtraWeaponTimeRaising
|
||||
400,ExtraWeaponTimeLowering
|
||||
401,BludgeonWardProtection
|
||||
402,BludgeonWardVulnerability
|
||||
403,SlashWardProtection
|
||||
404,SlashWardVulnerability
|
||||
405,PierceWardProtection
|
||||
406,PierceWardVulnerability
|
||||
407,StaminaRestoring
|
||||
408,StaminaDepleting
|
||||
409,Fireworks
|
||||
410,HealthDivide
|
||||
411,StaminaDivide
|
||||
412,ManaDivide
|
||||
413,CoordinationIncrease2
|
||||
414,StrengthIncrease2
|
||||
415,FocusIncrease2
|
||||
416,EnduranceIncrease2
|
||||
417,SelfIncrease2
|
||||
418,MeleeDefenseMultiply
|
||||
419,MissileDefenseMultiply
|
||||
420,MagicDefenseMultiply
|
||||
421,AttributesDecrease
|
||||
422,LifeGiverRaising2
|
||||
423,ItemEnchantmentRaising2
|
||||
424,SkillsDecrease
|
||||
425,ExtraManaConversionBonus
|
||||
426,WarMysticRaising2
|
||||
427,WarMysticLowering2
|
||||
428,MagicDefenseShelterRaising2
|
||||
429,ExtraLifeMagicSkillRaising2
|
||||
430,CreatureMysticRaising2
|
||||
431,ItemMysticRaising2
|
||||
432,ManaRaising2
|
||||
433,SelfRaising2
|
||||
434,CreatureEnchantmentRaising2
|
||||
435,SalvagingRaising
|
||||
436,ExtraSalvagingRaising
|
||||
437,ExtraSalvagingRaising2
|
||||
438,CascadeAxeRaising2
|
||||
439,ExtraBowSkillRaising2
|
||||
440,ExtraThrownWeaponsSkillRaising2
|
||||
441,ExtraCrossbowSkillRaising2
|
||||
442,CascadeDaggerRaising2
|
||||
443,CascadeMaceRaising2
|
||||
444,ExtraUnarmedCombatSkillRaising2
|
||||
445,CascadeSpearRaising2
|
||||
446,CascadeStaffRaising2
|
||||
447,ExtraSwordSkillRaising2
|
||||
448,AcidProtectionRare
|
||||
449,AcidResistanceRaisingRare
|
||||
450,AlchemyRaisingRare
|
||||
451,AppraisalResistanceLoweringRare
|
||||
452,AppraiseArmorRaisingRare
|
||||
453,AppraiseItemRaisingRare
|
||||
454,AppraiseMagicItemRaisingRare
|
||||
455,AppraiseWeaponRaisingRare
|
||||
456,ArcaneLoreRaisingRare
|
||||
457,ArmorRaisingRare
|
||||
458,ArmorValueRaisingRare
|
||||
459,AssessMonsterRaisingRare
|
||||
460,AssessPersonRaisingRare
|
||||
461,AttackModRaisingRare
|
||||
462,AxeRaisingRare
|
||||
463,BludgeonProtectionRare
|
||||
464,BludgeonResistanceRaisingRare
|
||||
465,BowRaisingRare
|
||||
466,ColdProtectionRare
|
||||
467,ColdResistanceRaisingRare
|
||||
468,CookingRaisingRare
|
||||
469,CoordinationRaisingRare
|
||||
470,CreatureEnchantmentRaisingRare
|
||||
471,CrossbowRaisingRare
|
||||
472,DaggerRaisingRare
|
||||
473,DamageRaisingRare
|
||||
474,DeceptionRaisingRare
|
||||
475,DefenseModRaisingRare
|
||||
476,ElectricProtectionRare
|
||||
477,ElectricResistanceRaisingRare
|
||||
478,EnduranceRaisingRare
|
||||
479,FireProtectionRare
|
||||
480,FireResistanceRaisingRare
|
||||
481,FletchingRaisingRare
|
||||
482,FocusRaisingRare
|
||||
483,HealingRaisingRare
|
||||
484,HealthAcceleratingRare
|
||||
485,ItemEnchantmentRaisingRare
|
||||
486,JumpRaisingRare
|
||||
487,LeadershipRaisingRare
|
||||
488,LifeMagicRaisingRare
|
||||
489,LockpickRaisingRare
|
||||
490,LoyaltyRaisingRare
|
||||
491,MaceRaisingRare
|
||||
492,MagicDefenseRaisingRare
|
||||
493,ManaAcceleratingRare
|
||||
494,ManaConversionRaisingRare
|
||||
495,MeleeDefenseRaisingRare
|
||||
496,MissileDefenseRaisingRare
|
||||
497,PierceProtectionRare
|
||||
498,PierceResistanceRaisingRare
|
||||
499,QuicknessRaisingRare
|
||||
500,RunRaisingRare
|
||||
501,SelfRaisingRare
|
||||
502,SlashProtectionRare
|
||||
503,SlashResistanceRaisingRare
|
||||
504,SpearRaisingRare
|
||||
505,StaffRaisingRare
|
||||
506,StaminaAcceleratingRare
|
||||
507,StrengthRaisingRare
|
||||
508,SwordRaisingRare
|
||||
509,ThrownWeaponsRaisingRare
|
||||
510,UnarmedCombatRaisingRare
|
||||
511,WarMagicRaisingRare
|
||||
512,WeaponTimeRaisingRare
|
||||
513,ArmorIncreaseInkyArmor
|
||||
514,MagicDefenseShelterRaisingFiun
|
||||
515,ExtraRunSkillRaisingFiun
|
||||
516,ExtraManaConversionSkillRaisingFiun
|
||||
517,AttributesIncreaseCantrip1
|
||||
518,ExtraMeleeDefenseSkillRaising2
|
||||
519,ACTDPurchaseRewardSpell
|
||||
520,ACTDPurchaseRewardSpellHealth
|
||||
521,SaltAshAttackModRaising
|
||||
522,QuicknessIncrease2
|
||||
523,ExtraAlchemySkillRaising2
|
||||
524,ExtraCookingSkillRaising2
|
||||
525,ExtraFletchingSkillRaising2
|
||||
526,ExtraLockpickSkillRaising2
|
||||
527,MucorManaWell
|
||||
528,StaminaRestoring2
|
||||
529,AllegianceRaising
|
||||
530,HealthDoT
|
||||
531,HealthDoTSecondary
|
||||
532,HealthDoTTertiary
|
||||
533,HealthHoT
|
||||
534,HealthHoTSecondary
|
||||
535,HealthHoTTertiary
|
||||
536,HealthDivideSecondary
|
||||
537,HealthDivideTertiary
|
||||
538,SetSwordRaising
|
||||
539,SetAxeRaising
|
||||
540,SetDaggerRaising
|
||||
541,SetMaceRaising
|
||||
542,SetSpearRaising
|
||||
543,SetStaffRaising
|
||||
544,SetUnarmedRaising
|
||||
545,SetBowRaising
|
||||
546,SetCrossbowRaising
|
||||
547,SetThrownRaising
|
||||
548,SetItemEnchantmentRaising
|
||||
549,SetCreatureEnchantmentRaising
|
||||
550,SetWarMagicRaising
|
||||
551,SetLifeMagicRaising
|
||||
552,SetMeleeDefenseRaising
|
||||
553,SetMissileDefenseRaising
|
||||
554,SetMagicDefenseRaising
|
||||
555,SetStaminaAccelerating
|
||||
556,SetCookingRaising
|
||||
557,SetFletchingRaising
|
||||
558,SetLockpickRaising
|
||||
559,SetAlchemyRaising
|
||||
560,SetSalvagingRaising
|
||||
561,SetArmorExpertiseRaising
|
||||
562,SetWeaponExpertiseRaising
|
||||
563,SetItemTinkeringRaising
|
||||
564,SetMagicItemExpertiseRaising
|
||||
565,SetLoyaltyRaising
|
||||
566,SetStrengthRaising
|
||||
567,SetEnduranceRaising
|
||||
568,SetCoordinationRaising
|
||||
569,SetQuicknessRaising
|
||||
570,SetFocusRaising
|
||||
571,SetWillpowerRaising
|
||||
572,SetHealthRaising
|
||||
573,SetStaminaRaising
|
||||
574,SetManaRaising
|
||||
575,SetSprintRaising
|
||||
576,SetJumpingRaising
|
||||
577,SetSlashResistanceRaising
|
||||
578,SetBludgeonResistanceRaising
|
||||
579,SetPierceResistanceRaising
|
||||
580,SetFlameResistanceRaising
|
||||
581,SetAcidResistanceRaising
|
||||
582,SetFrostResistanceRaising
|
||||
583,SetLightningResistanceRaising
|
||||
584,CraftingLockPickRaising
|
||||
585,CraftingFletchingRaising
|
||||
586,CraftingCookingRaising
|
||||
587,CraftingAlchemyRaising
|
||||
588,CraftingArmorTinkeringRaising
|
||||
589,CraftingWeaponTinkeringRaising
|
||||
590,CraftingMagicTinkeringRaising
|
||||
591,CraftingItemTinkeringRaising
|
||||
592,SkillPercentAlchemyRaising
|
||||
593,TwoHandedRaising
|
||||
594,TwoHandedLowering
|
||||
595,ExtraTwoHandedSkillRaising
|
||||
596,ExtraTwoHandedSkillLowering
|
||||
597,ExtraTwoHandedSkillRaising2
|
||||
598,TwoHandedRaisingRare
|
||||
599,SetTwoHandedRaising
|
||||
600,GearCraftRaising
|
||||
601,GearCraftLowering
|
||||
602,ExtraGearCraftSkillRaising
|
||||
603,ExtraGearCraftSkillLowering
|
||||
604,ExtraGearCraftSkillRaising2
|
||||
605,GearCraftRaisingRare
|
||||
606,SetGearCraftRaising
|
||||
607,LoyaltyManaRaising
|
||||
608,LoyaltyStaminaRaising
|
||||
609,LeadershipHealthRaising
|
||||
610,TrinketDamageRaising
|
||||
611,TrinketDamageLowering
|
||||
612,TrinketHealthRaising
|
||||
613,TrinketStaminaRaising
|
||||
614,TrinketManaRaising
|
||||
615,TrinketXPRaising
|
||||
616,DeceptionArcaneLoreRaising
|
||||
617,HealOverTimeRaising
|
||||
618,DamageOverTimeRaising
|
||||
619,HealingResistRatingRaising
|
||||
620,AetheriaDamageRatingRaising
|
||||
621,AetheriaDamageReductionRaising
|
||||
623,AetheriaHealthRaising
|
||||
624,AetheriaStaminaRaising
|
||||
625,AetheriaManaRaising
|
||||
626,AetheriaCriticalDamageRaising
|
||||
627,AetheriaHealingAmplificationRaising
|
||||
628,AetheriaProcDamageRatingRaising
|
||||
629,AetheriaProcDamageReductionRaising
|
||||
630,AetheriaProcHealthOverTimeRaising
|
||||
631,AetheriaProcDamageOverTimeRaising
|
||||
632,AetheriaProcHealingReductionRaising
|
||||
633,RareDamageRatingRaising
|
||||
634,RareDamageReductionRatingRaising
|
||||
635,AetheriaEnduranceRaising
|
||||
636,NetherDamageOverTimeRaising
|
||||
637,NetherDamageOverTimeRaising2
|
||||
638,NetherDamageOverTimeRaising3
|
||||
639,NetherStreak
|
||||
640,NetherMissile
|
||||
641,NetherRing
|
||||
642,NetherDamageRatingLowering
|
||||
643,NetherDamageHealingReductionRaising
|
||||
644,VoidMagicLowering
|
||||
645,VoidMagicRaising
|
||||
646,VoidMysticRaising
|
||||
647,SetVoidMagicRaising
|
||||
648,VoidMagicRaisingRare
|
||||
649,VoidMysticRaising2
|
||||
650,LuminanceDamageRatingRaising
|
||||
651,LuminanceDamageReductionRaising
|
||||
652,LuminanceHealthRaising
|
||||
653,AetheriaCriticalReductionRaising
|
||||
654,ExtraMissileDefenseSkillRaising
|
||||
655,ExtraMissileDefenseSkillLowering
|
||||
656,ExtraMissileDefenseSkillRaising2
|
||||
657,AetheriaHealthResistanceRaising
|
||||
658,AetheriaDotResistanceRaising
|
||||
659,CloakSkillRaising
|
||||
660,CloakAllSkillRaising
|
||||
661,CloakMagicDefenseLowering
|
||||
662,CloakMeleeDefenseLowering
|
||||
663,CloakMissileDefenseLowering
|
||||
664,DirtyFightingLowering
|
||||
665,DirtyFightingRaising
|
||||
666,ExtraDirtyFightingRaising
|
||||
667,DualWieldLowering
|
||||
668,DualWieldRaising
|
||||
669,ExtraDualWieldRaising
|
||||
670,RecklessnessLowering
|
||||
671,RecklessnessRaising
|
||||
672,ExtraRecklessnessRaising
|
||||
673,ShieldLowering
|
||||
674,ShieldRaising
|
||||
675,ExtraShieldRaising
|
||||
676,SneakAttackLowering
|
||||
677,SneakAttackRaising
|
||||
678,ExtraSneakAttackRaising
|
||||
679,RareDirtyFightingRaising
|
||||
680,RareDualWieldRaising
|
||||
681,RareRecklessnessRaising
|
||||
682,RareShieldRaising
|
||||
683,RareSneakAttackRaising
|
||||
684,DFAttackSkillDebuff
|
||||
685,DFBleedDamage
|
||||
686,DFDefenseSkillDebuff
|
||||
687,DFHealingDebuff
|
||||
688,SetDirtyFightingRaising
|
||||
689,SetDualWieldRaising
|
||||
690,SetRecklessnessRaising
|
||||
691,SetShieldRaising
|
||||
692,SetSneakAttackRaising
|
||||
693,LifeGiverMhoire
|
||||
694,RareDamageRatingRaising2
|
||||
695,SpellDamageRaising
|
||||
696,SummoningRaising
|
||||
697,SummoningLowering
|
||||
698,ExtraSummoningSkillRaising
|
||||
699,SetSummoningRaising
|
||||
704,ParagonEnduranceRaising
|
||||
705,ParagonManaRaising
|
||||
706,ParagonStaminaRaising
|
||||
707,ParagonDirtyFightingRaising
|
||||
708,ParagonDualWieldRaising
|
||||
709,ParagonRecklessnessRaising
|
||||
710,ParagonSneakAttackRaising
|
||||
711,ParagonDamageRatingRaising
|
||||
712,ParagonDamageReductionRatingRaising
|
||||
713,ParagonCriticalDamageRatingRaising
|
||||
714,ParagonCriticalDamageReductionRatingRaising
|
||||
715,ParagonAxeRaising
|
||||
716,ParagonDaggerRaising
|
||||
717,ParagonSwordRaising
|
||||
718,ParagonWarMagicRaising
|
||||
719,ParagonLifeMagicRaising
|
||||
720,ParagonVoidMagicRaising
|
||||
721,ParagonBowRaising
|
||||
722,ParagonStrengthRaising
|
||||
723,ParagonCoordinationRaising
|
||||
724,ParagonQuicknessRaising
|
||||
725,ParagonFocusRaising
|
||||
726,ParagonWillpowerRaising
|
||||
727,ParagonTwoHandedRaising
|
||||
728,GauntletDamageReductionRatingRaising
|
||||
729,GauntletDamageRatingRaising
|
||||
730,GauntletHealingRatingRaising
|
||||
731,GauntletVitalityRaising
|
||||
732,GauntletCriticalDamageRatingRaising
|
||||
733,GauntletCriticalDamageReductionRatingRaising
|
||||
|
|
|
@ -23,12 +23,16 @@
|
|||
<!-- Plugin manifest (embedded in the DLL; Plugins\Directory.Build.targets). minEngineApi is the
|
||||
highest API use NOT behind a Has*/version check. Script windows (v71, HasUi) draw its window and titles/server info (v75) are guarded with fallbacks; below v71 it runs without a window (/ro status), as on an engine with ImGui off. -->
|
||||
<RynthPluginMinEngineApi>66</RynthPluginMinEngineApi>
|
||||
<!-- RynthServers (sibling repo): the RynthILT interfaces read for the Infinite Leaftide rows. -->
|
||||
<RynthServersRoot Condition="'$(RynthServersRoot)' == ''">$(MSBuildThisFileDirectory)..\..\..\RynthServers\</RynthServersRoot>
|
||||
<RynthPluginDescription>Quests (with the Legendary and exploration marker trackers, and the active server plugin's quest pack), character and titles.</RynthPluginDescription>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\RynthCore\src\RynthCore.PluginCore\RynthCore.PluginCore.csproj" />
|
||||
<ProjectReference Include="..\..\..\RynthCore\src\RynthCore.PluginSdk\RynthCore.PluginSdk.csproj" />
|
||||
<!-- The dat reader: the Gear tab reads the client's spell table (portal.dat 0x0E00000E). -->
|
||||
<ProjectReference Include="..\..\Shared\RynthCore.TerrainData\RynthCore.TerrainData.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -43,6 +47,13 @@
|
|||
<EmbeddedResource Include="Resources\markers.csv" LogicalName="RynthOracle.markers.csv" />
|
||||
<!-- Legendary Key quests, rows of the Quests tab (list and notes: the "Arwic John Route" sheet). -->
|
||||
<EmbeddedResource Include="Resources\legendary.csv" LogicalName="RynthOracle.legendary.csv" />
|
||||
<EmbeddedResource Include="Resources\dynstamps.csv" LogicalName="RynthOracle.dynstamps.csv" />
|
||||
<!-- The Gear tab's spell family and equipment set names (ACE's enums). -->
|
||||
<EmbeddedResource Include="Resources\spellcategories.csv" LogicalName="RynthOracle.spellcategories.csv" />
|
||||
<EmbeddedResource Include="Resources\equipmentsets.csv" LogicalName="RynthOracle.equipmentsets.csv" />
|
||||
<EmbeddedResource Include="Resources\materials.csv" LogicalName="RynthOracle.materials.csv" />
|
||||
<EmbeddedResource Include="Resources\masteries.csv" LogicalName="RynthOracle.masteries.csv" />
|
||||
<EmbeddedResource Include="Resources\skills.csv" LogicalName="RynthOracle.skills.csv" />
|
||||
<!-- Spell names and durations: RynthAi's spell table, shared rather than copied. -->
|
||||
<EmbeddedResource Include="..\RynthCore.Plugin.RynthAi\Combat\SpellData.txt" LogicalName="RynthOracle.SpellData.txt" Link="Shared\SpellData.txt" />
|
||||
</ItemGroup>
|
||||
|
|
@ -60,9 +71,13 @@
|
|||
("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" />
|
||||
<!-- Infinite Leaftide only (ServerIdentity.IsIlt): RynthILT's profile (/qb list) and data (Temple guardians). -->
|
||||
<Compile Include="$(RynthServersRoot)Plugins\Shared\RynthIltServerApi.cs" Link="Shared\RynthIltServerApi.cs" />
|
||||
<Compile Include="$(RynthServersRoot)Plugins\Shared\RynthIltDataApi.cs" Link="Shared\RynthIltDataApi.cs" />
|
||||
<Compile Include="..\Shared\ServerStateClient.cs" Link="Shared\ServerStateClient.cs" />
|
||||
<!-- "RynthServer.QuestPack": the active server plugin's quest pack, merged into the Quests list. -->
|
||||
<Compile Include="..\Shared\RynthServerQuestPackApi.cs" Link="Shared\RynthServerQuestPackApi.cs" />
|
||||
<Compile Include="..\Shared\RynthServerQuestGuideApi.cs" Link="Shared\RynthServerQuestGuideApi.cs" />
|
||||
<Compile Include="..\Shared\ServerQuestPackClient.cs" Link="Shared\ServerQuestPackClient.cs" />
|
||||
<!-- How a chat command answers (2026-10-28): the shared reply queue and colours. -->
|
||||
<Compile Include="..\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ internal static class UiFormat
|
|||
public const ushort EvInt = 3;
|
||||
public const ushort EvText = 5;
|
||||
public const ushort EvOpen = 6;
|
||||
/// <summary>The window's geometry changed: f32x8 pos, size, content avail, cursor (logical units), u32 flags.</summary>
|
||||
public const ushort EvGeometry = 7;
|
||||
public const ushort EvVisibility = 8;
|
||||
public const ushort EvError = 10;
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,17 @@ internal sealed class UiHost
|
|||
case UiFormat.EvOpen when w != null && p.Length >= 1:
|
||||
w.Dispatch(key, new UiEvent(type, b: p[0] != 0));
|
||||
break;
|
||||
case UiFormat.EvGeometry when w != null && p.Length >= 24:
|
||||
{
|
||||
// Only the width matters (column layouts); a pass when it moved by a pixel or more.
|
||||
float avail = BinaryPrimitives.ReadSingleLittleEndian(p[16..]);
|
||||
if (float.IsFinite(avail) && avail >= 0f && Math.Abs(avail - w.ContentWidth) >= 1f)
|
||||
{
|
||||
w.ContentWidth = avail;
|
||||
w.NeedsPass = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UiFormat.EvVisibility when w != null && p.Length >= 1:
|
||||
// The player closed it (X) or opened it (bar menu / command): theirs wins.
|
||||
w.Visible = p[0] != 0;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,13 @@ internal sealed class UiWindow
|
|||
|
||||
/// <summary>A pass is wanted at the next chance (input arrived, it was just shown, data changed).</summary>
|
||||
public bool NeedsPass = true;
|
||||
|
||||
/// <summary>
|
||||
/// The body's usable width (logical units at UI scale 1) from the engine's last Geometry event;
|
||||
/// 0 until one arrives (or on an engine that sends none). Layouts that follow the window's
|
||||
/// width (the Quests list's columns) read it.
|
||||
/// </summary>
|
||||
public float ContentWidth;
|
||||
public long NextPassMs;
|
||||
|
||||
// The list as recorded by the last pass, and what the engine last accepted.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ namespace RynthCore.Plugin.RynthOracle.Views;
|
|||
/// <summary>About: the credit to Oracle of Dereth's author, the settings and the quest list's source.</summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
// The labels for OracleSettings.QuestRefreshChoices, in the same order.
|
||||
private static readonly string[] QuestRefreshLabels = { "Off (login and Refresh only)", "5 minutes", "10 minutes", "15 minutes", "30 minutes" };
|
||||
|
||||
private void DrawAbout(UiWindow w)
|
||||
{
|
||||
w.TextColored(UiColors.Gold, "Based on Oracle of Dereth by Advis Eveldan - thank you!");
|
||||
|
|
@ -21,6 +24,11 @@ internal sealed partial class OracleView
|
|||
w.Tooltip("Sends /myquests after login so the quest pages have data, and again while quest timers are on screen "
|
||||
+ "and the flags are over 10 minutes old, or when the server turns a quest down as solved too recently "
|
||||
+ "(only with the replies hidden).");
|
||||
int refreshIndex = Math.Max(0, Array.IndexOf(OracleSettings.QuestRefreshChoices, s.QuestRefreshMinutes));
|
||||
w.Combo("Read quest flags again when older than", "o.refresh", refreshIndex, QuestRefreshLabels,
|
||||
i => { s.QuestRefreshMinutes = OracleSettings.QuestRefreshChoices[i]; s.Save(); });
|
||||
w.Tooltip("Keeps the quest pages current on a long session: /myquests again (its reply hidden) once nothing\n"
|
||||
+ "has read it for this long. Any reply resets the clock, RynthAi's meta polls too. The server allows one a minute.");
|
||||
w.Checkbox("Hide the replies to RynthOracle's own requests", "o.hide", s.HideOwnQuestReplies, v => { s.HideOwnQuestReplies = v; s.Save(); });
|
||||
w.Tooltip("/myquests. A command you type yourself always shows its reply.");
|
||||
w.Checkbox("Show the Void window for characters with Void Magic", "o.void", s.AutoShowVoidWindow, v => { s.AutoShowVoidWindow = v; s.Save(); });
|
||||
|
|
|
|||
269
Plugins/RynthCore.Plugin.RynthOracle/Views/DynamicStampsTab.cs
Normal file
269
Plugins/RynthCore.Plugin.RynthOracle/Views/DynamicStampsTab.cs
Normal file
|
|
@ -0,0 +1,269 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Dynamic Stamps (Infinite Leaftide only, ServerIdentity.IsIlt): the NPC hand-ins that put a "Dynamic_N_..." flag on
|
||||
/// the character, read from /myquests. Since 2026-10-18 they are rows of the Quests tab's merged
|
||||
/// list (QuestsTab.cs: DYN rows, the Show filter's area picker). What is left here is the opened
|
||||
/// stamp's box (RynthNav, the Parchment hand-in, chat), and the read after a hand-in. The list follows the players' "ExtraDyn" sheet (dynstamps.csv).
|
||||
/// Since 2026-11-08 (Silentkelpie: "for the dynamic quests, it should also auto hand in the parchment and if one does
|
||||
/// not have any it should buy one from a vendor") Go hands the Parchment in on arrival by itself, and with none in
|
||||
/// the packs RynthAi buys one from a vendor near you first ("questloot buy Parchment": before setting off, and
|
||||
/// again at the NPC's place when that failed).
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
// The stamp clicked last: the box below the list offers RynthNav's auto nav to it.
|
||||
private DynamicStamp? _dynNav;
|
||||
private bool _dynNavDone;
|
||||
private string _dynNavStatus = "";
|
||||
|
||||
/// <summary>
|
||||
/// The destination box (the click's pop-up): the stamp, where RynthNav will take you, and Go (plan
|
||||
/// and walk the route: portals, recalls and dungeon entrances included), Arrow, Chat and Close.
|
||||
/// </summary>
|
||||
private void DrawDynamicNavBox(UiWindow w)
|
||||
{
|
||||
DynamicStamp? s = _dynNav;
|
||||
if (s == null) return;
|
||||
List<string> targets = s.NavCandidates();
|
||||
w.SeparatorText("Navigate to " + Cut(s.Label, 40));
|
||||
w.TextDisabled(targets.Count == 0
|
||||
? "No place, coordinates or area to go to for this stamp."
|
||||
: "Where: " + Cut(string.Join(" or ", targets), 90));
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
w.Button(s.Npc.Length > 0 ? "Go and hand in" : "Go (auto nav)", "dy.nav.go", () => StartDynAuto(s));
|
||||
w.Tooltip(s.Npc.Length > 0
|
||||
? "RynthNav plans the route (walking, portals, recalls, the dungeon's entrance) and walks it; there, a Parchment\n"
|
||||
+ "from your packs is handed to " + s.Npc + ". With none, RynthAi buys one from a vendor near you first\n"
|
||||
+ "(a Scribe or a shop within 80 m), or at the NPC's place."
|
||||
: "RynthNav plans the route (walking, portals, recalls, the dungeon's entrance) and walks it.");
|
||||
w.SameLine();
|
||||
w.Button("Arrow", "dy.nav.arrow", () => SendNav("arrow", s));
|
||||
w.Tooltip("Only point RynthNav's arrow at it.");
|
||||
w.SameLine();
|
||||
}
|
||||
w.Button("Chat", "dy.nav.chat", () => PrintStamp(s, _dynNavDone));
|
||||
w.SameLine();
|
||||
w.Button("Close", "dy.nav.close", () => { _dynNav = null; _dynNavStatus = ""; _selKey = ""; });
|
||||
|
||||
// The hand-in: a Parchment from your packs to the stamp's NPC (RynthAi's /ub give).
|
||||
if (s.Npc.Length > 0)
|
||||
{
|
||||
string? parchment = CarriedParchment();
|
||||
if (parchment != null)
|
||||
{
|
||||
w.Button("Give " + Cut(parchment, 24), "dy.nav.give", () => GiveParchment(s, parchment));
|
||||
w.Tooltip($"Hands one {parchment} to {s.Npc}. Stand near them (or Go first): AC walks you the last bit.");
|
||||
}
|
||||
else
|
||||
{
|
||||
w.TextDisabled("No Parchment in your packs to give " + Cut(s.Npc, 30) + ".");
|
||||
w.SameLine();
|
||||
w.SmallButton("Buy one", "dy.nav.buy", () =>
|
||||
_dynNavStatus = _c.SendAi("questloot", "buy Parchment")
|
||||
? "RynthAi is looking for a Parchment at the vendors near you." : "RynthAi isn't loaded (it buys the Parchment).");
|
||||
w.Tooltip("RynthAi opens the vendors near you (a Scribe or a shop first, within 80 m) until one sells a Parchment, and buys one.");
|
||||
}
|
||||
}
|
||||
if (_dynNavStatus.Length > 0) w.TextDisabled(_dynNavStatus);
|
||||
}
|
||||
|
||||
// ── Go and hand in (2026-11-08) ──
|
||||
|
||||
private enum DynPhase { None, BuyFirst, Going, BuyThere, Settling }
|
||||
// After RynthNav's "goto: arrived" the hand-in waits this long, so the character has stopped: a give
|
||||
// sent while still running is cancelled by the server's own move-to ("Action cancelled!").
|
||||
private const long ArriveSettleMs = 1500;
|
||||
private long _dynGiveAt;
|
||||
private DynamicStamp? _dynAuto;
|
||||
private DynPhase _dynPhase;
|
||||
internal const string BoughtLine = "[RynthAi] Quest: bought Parchment";
|
||||
internal const string BuyFailLine = "[RynthAi] Quest: couldn't buy Parchment";
|
||||
|
||||
/// <summary>Go: the Parchment first when none is carried (bought near you), then RynthNav; the hand-in on arrival.</summary>
|
||||
private void StartDynAuto(DynamicStamp s)
|
||||
{
|
||||
_dynAuto = s;
|
||||
_dynPhase = DynPhase.None;
|
||||
if (!_c.InWorld) { _dynNavStatus = "Log in first."; return; }
|
||||
if (s.Npc.Length == 0) { SendNav("go", s); return; }
|
||||
_parchmentScanAt = 0;
|
||||
if (CarriedParchment() == null && _c.SendAi("questloot", "buy Parchment"))
|
||||
{
|
||||
_dynPhase = DynPhase.BuyFirst;
|
||||
_dynNavStatus = $"No Parchment: RynthAi is buying one near you first, then RynthNav goes to {s.Npc}.";
|
||||
return;
|
||||
}
|
||||
GoDyn(s, "");
|
||||
}
|
||||
|
||||
private void GoDyn(DynamicStamp s, string before)
|
||||
{
|
||||
SendNav("go", s);
|
||||
_dynPhase = _dynNavStatus.StartsWith("RynthNav is planning", StringComparison.Ordinal) ? DynPhase.Going : DynPhase.None;
|
||||
if (_dynPhase == DynPhase.Going) _dynNavStatus = before + $"RynthNav is walking to {s.Npc}; the Parchment is handed in when it gets there.";
|
||||
}
|
||||
|
||||
/// <summary>A chat line while Go and hand in runs: RynthAi's buy, RynthNav's arrival. Plugin calls it for every line.</summary>
|
||||
internal void OnDynChat(string line)
|
||||
{
|
||||
DynamicStamp? s = _dynAuto;
|
||||
if (s == null || _dynPhase == DynPhase.None) return;
|
||||
bool bought = line.Contains(BoughtLine, StringComparison.OrdinalIgnoreCase);
|
||||
bool noBuy = line.Contains(BuyFailLine, StringComparison.OrdinalIgnoreCase);
|
||||
switch (_dynPhase)
|
||||
{
|
||||
case DynPhase.BuyFirst:
|
||||
if (bought) GoDyn(s, "Bought a Parchment. ");
|
||||
else if (noBuy) GoDyn(s, "No Parchment to buy here (tried again there). ");
|
||||
break;
|
||||
case DynPhase.Going:
|
||||
if (!line.Contains("[RynthNav]", StringComparison.Ordinal)) break;
|
||||
if (line.Contains("goto: arrived", StringComparison.OrdinalIgnoreCase)) DynArrived(s);
|
||||
else if (line.Contains("goto:", StringComparison.OrdinalIgnoreCase) || line.Contains("on the map", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_dynPhase = DynPhase.None;
|
||||
_dynNavStatus = "RynthNav didn't get there (" + Cut(line.Trim(), 80) + "): Go again, or Give by hand.";
|
||||
}
|
||||
break;
|
||||
case DynPhase.BuyThere:
|
||||
if (bought)
|
||||
{
|
||||
_parchmentScanAt = 0;
|
||||
_dynPhase = DynPhase.None;
|
||||
if (CarriedParchment() is string p) GiveParchment(s, p);
|
||||
else _dynNavStatus = "Bought a Parchment, but it isn't in your packs yet: Give it by hand.";
|
||||
}
|
||||
else if (noBuy)
|
||||
{
|
||||
_dynPhase = DynPhase.None;
|
||||
_dynNavStatus = $"No Parchment, and no vendor near {s.Npc} sells one: buy one in a town (a Scribe), then Go again.";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DynArrived(DynamicStamp s)
|
||||
{
|
||||
_dynPhase = DynPhase.Settling;
|
||||
_dynGiveAt = _c.NowMs + ArriveSettleMs;
|
||||
_dynNavStatus = $"At {s.Npc}: handing in the Parchment in a moment.";
|
||||
}
|
||||
|
||||
/// <summary>Plugin tick: the hand-in once the character has settled after arriving.</summary>
|
||||
internal void TickDyn()
|
||||
{
|
||||
if (_dynPhase != DynPhase.Settling || _dynAuto is not DynamicStamp s) return;
|
||||
if (_c.NowMs < _dynGiveAt) return;
|
||||
HandInNow(s);
|
||||
}
|
||||
|
||||
private void HandInNow(DynamicStamp s)
|
||||
{
|
||||
_parchmentScanAt = 0;
|
||||
if (CarriedParchment() is string p) { _dynPhase = DynPhase.None; GiveParchment(s, p); return; }
|
||||
if (_c.SendAi("questloot", "buy Parchment"))
|
||||
{
|
||||
_dynPhase = DynPhase.BuyThere;
|
||||
_dynNavStatus = $"At {s.Npc}, no Parchment: RynthAi is buying one from a vendor here.";
|
||||
return;
|
||||
}
|
||||
_dynPhase = DynPhase.None;
|
||||
_dynNavStatus = $"At {s.Npc}, but no Parchment in your packs.";
|
||||
}
|
||||
|
||||
// A /myquests read this long after a Parchment hand-in (the walk there and the NPC's answer), so
|
||||
// the new stamp shows as had; 0 = none due.
|
||||
private const long HandInRefreshMs = 8000;
|
||||
private long _dynRefreshAt;
|
||||
|
||||
/// <summary>The read after a hand-in, when it is due: now, or when the server's once-a-minute wait ends.</summary>
|
||||
private void RefreshAfterHandIn(QuestFlagStore flags)
|
||||
{
|
||||
if (_dynRefreshAt == 0 || _c.NowMs < _dynRefreshAt) return;
|
||||
if (flags.Loading) return;
|
||||
int wait = flags.ThrottleSecondsLeft(_c.NowMs);
|
||||
if (wait > 0) { _dynRefreshAt = _c.NowMs + wait * 1000L; return; }
|
||||
_dynRefreshAt = 0;
|
||||
_c.RequestQuests();
|
||||
}
|
||||
|
||||
// Packs scanned for a Parchment at most this often (the box draws every frame).
|
||||
private const long ParchmentScanMs = 1500;
|
||||
private long _parchmentScanAt;
|
||||
private string? _parchmentName;
|
||||
|
||||
/// <summary>
|
||||
/// The name of a Parchment you carry (the main pack and its side packs), or null. Any item
|
||||
/// whose name has "Parchment" in it; read again every <see cref="ParchmentScanMs"/>.
|
||||
/// </summary>
|
||||
private string? CarriedParchment()
|
||||
{
|
||||
if (_c.NowMs - _parchmentScanAt < ParchmentScanMs && _parchmentScanAt != 0) return _parchmentName;
|
||||
_parchmentScanAt = _c.NowMs == 0 ? 1 : _c.NowMs;
|
||||
_parchmentName = null;
|
||||
RynthCore.PluginSdk.RynthCoreHost host = _c.Host;
|
||||
uint me = _c.Character.PlayerId;
|
||||
if (!_c.InWorld || me == 0 || !host.HasGetContainerContents) return null;
|
||||
var buf = new uint[512];
|
||||
var packs = new List<uint> { me };
|
||||
for (int p = 0; p < packs.Count && p < 16; p++)
|
||||
{
|
||||
int n = Math.Min(host.GetContainerContents(packs[p], buf), buf.Length);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
uint id = buf[i];
|
||||
if (!host.TryGetObjectName(id, out string name)) continue;
|
||||
if (name.IndexOf("Parchment", StringComparison.OrdinalIgnoreCase) >= 0) { _parchmentName = name; return name; }
|
||||
// A side pack in the main pack: look inside it too (only one level deep, as AC packs go).
|
||||
if (p == 0) packs.Add(id);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>"/ub give 1 <parchment> to <npc>": RynthAi finds the NPC by name and hands it over.</summary>
|
||||
private void GiveParchment(DynamicStamp s, string parchment)
|
||||
{
|
||||
if (!_c.InWorld) { _dynNavStatus = "Log in first."; return; }
|
||||
bool sent = _c.RunCommand($"/ub give 1 {parchment} to {s.Npc}");
|
||||
_parchmentScanAt = 0; // read the packs again after the give
|
||||
// The stamp is a quest flag: read /myquests again once the NPC has had time to answer.
|
||||
if (sent) _dynRefreshAt = _c.NowMs + HandInRefreshMs;
|
||||
_dynNavStatus = sent
|
||||
? $"Giving {parchment} to {s.Npc} (RynthAi does the give; it says so in chat if {s.Npc} isn't in sight)."
|
||||
: "Could not send the give.";
|
||||
}
|
||||
|
||||
/// <summary>Clicking a row: select it and ask RynthNav for the route (shown in chat and its overlay).</summary>
|
||||
private void SelectDynamicStamp(DynamicStamp s, bool done)
|
||||
{
|
||||
_dynNav = s;
|
||||
_dynNavDone = done;
|
||||
_dynNavStatus = "";
|
||||
if (s.NavCandidates().Count > 0) SendNav("route", s);
|
||||
}
|
||||
|
||||
/// <summary>"/rnav <verb> a || b || c" to RynthNav (it takes the first candidate on its map).</summary>
|
||||
private void SendNav(string verb, DynamicStamp s)
|
||||
{
|
||||
List<string> targets = s.NavCandidates();
|
||||
if (targets.Count == 0) return;
|
||||
_dynNavStatus = SendRynthNav(verb, targets);
|
||||
}
|
||||
|
||||
/// <summary>Chat: the NPC, its stamp and whether this character has it, where, the reward and
|
||||
/// any coordinates (RynthChat makes those a RynthNav arrow link).</summary>
|
||||
private void PrintStamp(DynamicStamp s, bool done)
|
||||
{
|
||||
string where = s.Place.Length > 0 ? $"{s.Area}, {s.Place}" : s.Area;
|
||||
string details = $"{where}" + (s.Reward.Length > 0 ? $" - gives {s.Reward}" : "") + (s.Note.Length > 0 ? $" - {s.Note}" : "");
|
||||
PrintEntry(s.Label, s.Stamp, done ? "have" : "missing", details, "");
|
||||
}
|
||||
}
|
||||
438
Plugins/RynthCore.Plugin.RynthOracle/Views/GearTab.cs
Normal file
438
Plugins/RynthCore.Plugin.RynthOracle/Views/GearTab.cs
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Gear: how the worn gear's spells fit together, for any server. Two views, as UB-ILT's
|
||||
/// Character tab had them:
|
||||
/// - Overlap: life wards and banes by element and tier, every spell on each worn piece (and the
|
||||
/// set bonuses, paragon spells and the character's buffs), and the families where spells
|
||||
/// compete (the highest power wins), repeat (the same spell on two pieces) or stack.
|
||||
/// - Ratings: items with a set, an item level or gear ratings (UB-ILT's Paragon gear), with the
|
||||
/// ratings summed over what is worn.
|
||||
/// The Check button reads it all again (GearScanner); nothing is read until it is pressed.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
public const string GearOverlap = "Overlap", GearRatings = "Ratings";
|
||||
|
||||
// Tier colours (UB-ILT's): Minor green, Major blue, Epic purple, Legendary orange; missing red.
|
||||
private static readonly uint TierMinor = UiFormat.Rgb(120, 220, 120), TierMajor = UiFormat.Rgb(140, 180, 255),
|
||||
TierEpic = UiFormat.Rgb(200, 140, 255), TierLegendary = UiFormat.Rgb(255, 180, 100), TierLower = UiFormat.Rgb(190, 190, 190);
|
||||
private static readonly uint HeaderBlue = UiFormat.Rgb(180, 200, 255), SetPurple = UiFormat.Rgb(200, 180, 255),
|
||||
ParagonTan = UiFormat.Rgb(220, 200, 140), WornGreen = UiFormat.Rgb(200, 235, 180), PackGrey = UiFormat.Rgb(210, 210, 210),
|
||||
T11Teal = UiFormat.Rgb(120, 220, 210);
|
||||
|
||||
private string GearView
|
||||
{
|
||||
get => _c.Settings.GearView == GearRatings ? GearRatings : GearOverlap;
|
||||
set { _c.Settings.GearView = value; _c.Settings.Save(); }
|
||||
}
|
||||
|
||||
private void DrawGear(UiWindow w)
|
||||
{
|
||||
string view = GearView;
|
||||
w.ToggleButton(GearOverlap, "g.v.o", view == GearOverlap, () => GearView = GearOverlap, small: true);
|
||||
w.Tooltip("Spell overlap and stacking on your worn gear, life wards and banes.");
|
||||
w.SameLine();
|
||||
w.ToggleButton(GearRatings, "g.v.r", view == GearRatings, () => GearView = GearRatings, small: true);
|
||||
w.Tooltip("Sets, item levels and gear ratings (paragon gear where the server has it).");
|
||||
w.SameLine();
|
||||
w.PushStyleColor(21, UiFormat.Rgb(150, 30, 30)); // ImGuiCol_Button: UB-ILT's red Check
|
||||
w.Button(view == GearOverlap ? "Check spell overlap" : "Check gear ratings", "g.check", StartGearCheck, small: true);
|
||||
w.PopStyleColor();
|
||||
w.Tooltip("Reads your worn gear again: asks the server to appraise items it hasn't yet, then rebuilds the lists.");
|
||||
DrawGearProgress(w);
|
||||
w.Separator();
|
||||
if (view == GearRatings) DrawGearRatings(w);
|
||||
else DrawGearOverlap(w);
|
||||
}
|
||||
|
||||
/// <summary>Starts a Check (the button, the Refresh row and a change of the pack option).</summary>
|
||||
private void StartGearCheck()
|
||||
{
|
||||
if (_c.Gear.Busy) return;
|
||||
if (!_c.Gear.Start(_c.Host, _c.NowMs, _c.Settings.GearIncludePack, msg => _c.Host.Log(msg)) && _c.Gear.Problem.Length > 0)
|
||||
_c.Print("Gear: " + _c.Gear.Problem);
|
||||
}
|
||||
|
||||
private RefreshResult RefreshGear()
|
||||
{
|
||||
if (_c.Gear.Busy) return new RefreshResult("A gear check is already running.", () => !_c.Gear.Busy);
|
||||
StartGearCheck();
|
||||
return _c.Gear.Problem.Length > 0
|
||||
? new RefreshResult(_c.Gear.Problem)
|
||||
: new RefreshResult("Checking your gear.", () => !_c.Gear.Busy);
|
||||
}
|
||||
|
||||
private void DrawGearProgress(UiWindow w)
|
||||
{
|
||||
GearScanner g = _c.Gear;
|
||||
switch (g.State)
|
||||
{
|
||||
case GearScanner.Phase.Identifying:
|
||||
w.TextColored(UiColors.Yellow, $"Appraising items: {g.IdsSent} of {g.IdsQueued} asked...");
|
||||
break;
|
||||
case GearScanner.Phase.Settling:
|
||||
w.TextColored(UiColors.Yellow, "Waiting for the appraisals...");
|
||||
break;
|
||||
case GearScanner.Phase.WaitingForSpells:
|
||||
w.TextColored(UiColors.Yellow, "Reading the client's spell table...");
|
||||
break;
|
||||
default:
|
||||
if (g.Problem.Length > 0) w.TextColored(UiColors.Red, g.Problem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Overlap ──────────────────────────────────────────────────────────────
|
||||
|
||||
private void DrawGearOverlap(UiWindow w)
|
||||
{
|
||||
GearReport? r = _c.Gear.Overlap;
|
||||
w.TextDisabled("Worn and wielded gear and your buffs: wards, banes, set bonuses and the spells that compete.");
|
||||
if (r == null)
|
||||
{
|
||||
w.TextDisabled("Press Check to scan your worn gear and active buffs.");
|
||||
return;
|
||||
}
|
||||
w.Text($"Checked {r.CheckedLocal:HH:mm:ss} | {r.Equipped} worn | {r.SpellSources} spells | "
|
||||
+ $"{r.Count(OverlapKind.Overlap)} overlap / {r.Count(OverlapKind.Duplicate)} duplicate / {r.Count(OverlapKind.Stacks)} stack");
|
||||
ProtSummary prot = r.Protection;
|
||||
string line2 = $"Life {prot.LifeLegendary}/7 Legendary | Crit {prot.CritLegendary}/7 Legendary";
|
||||
if (r.Sets.Count > 0) line2 += $" | Sets: {r.Sets.Count}";
|
||||
if (r.Paragon.Count > 0) line2 += $" | Paragon: {r.Paragon.Count}";
|
||||
if (r.Buffs.Count > 0) line2 += $" | Buffs: {r.Buffs.Count}";
|
||||
w.TextDisabled(line2);
|
||||
if (prot.LifeMissing.Length > 0) w.TextColored(UiColors.Red, "Life wards missing: " + prot.LifeMissing);
|
||||
if (prot.CritMissing.Length > 0) w.TextColored(UiColors.Red, "Banes missing: " + prot.CritMissing);
|
||||
if (r.NotAppraised > 0) w.TextColored(UiColors.Yellow, $"{r.NotAppraised} item(s) not appraised yet: Check again in a moment.");
|
||||
if (r.UnknownSpells > 0) w.TextDisabled($"{r.UnknownSpells} spell id(s) the client's spell table doesn't know.");
|
||||
if (!PortalSpellBook.Shared.HasDat && PortalSpellBook.Shared.Done)
|
||||
w.TextColored(UiColors.Yellow, "Spells from RynthOracle's own table (" + PortalSpellBook.Shared.Status + "): custom spells may show as unknown.");
|
||||
|
||||
if (w.CollapsingHeader("Life / Crit protection (Minor - Major - Epic - Legendary)", "g.prot", defaultOpen: true))
|
||||
{
|
||||
w.TextDisabled("Highest tier wins: Legendary > Epic > Major > Minor (red = missing element).");
|
||||
DrawProtSection(w, "Life prot (7 wards)", prot.Life, "g.pl");
|
||||
DrawProtSection(w, "Crit prot (7 banes)", prot.Crit, "g.pc");
|
||||
}
|
||||
|
||||
if (w.CollapsingHeader("Equipped gear spells", "g.gear", defaultOpen: true))
|
||||
DrawGearSpells(w, r);
|
||||
|
||||
if (w.CollapsingHeader("Overlap / stacking", "g.over", defaultOpen: true))
|
||||
{
|
||||
bool hide = _c.Settings.GearHideOverlap;
|
||||
w.Checkbox("Hide overlap", "g.hide", hide, v => { _c.Settings.GearHideOverlap = v; _c.Settings.Save(); });
|
||||
w.Tooltip("Hide the families where spells compete, to see what stacks.");
|
||||
DrawOverlapRows(w, r, hide);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawProtSection(UiWindow w, string title, List<ProtRow> rows, string id)
|
||||
{
|
||||
w.SeparatorText(title);
|
||||
w.TextColored(HeaderBlue, "Element");
|
||||
w.SameLine(90f); w.TextColored(HeaderBlue, "Tier");
|
||||
w.SameLine(175f); w.TextColored(HeaderBlue, "Active spell");
|
||||
w.SameLine(380f); w.TextColored(HeaderBlue, "Source");
|
||||
w.SameLine(540f); w.TextColored(HeaderBlue, "Beats");
|
||||
foreach (ProtRow row in rows)
|
||||
{
|
||||
w.TextColored(row.Missing ? UiColors.Red : ElementColor(row.Element), row.Element);
|
||||
w.SameLine(90f); w.TextColored(TierColor(row.Tier), GearAnalysis.TierLabel(row.Tier));
|
||||
if (row.Missing) continue;
|
||||
w.SameLine(175f); w.Text(Cut(row.Winner, 30));
|
||||
w.SameLine(380f); w.Text(Cut(row.Source, 22));
|
||||
if (row.Beaten.Length > 0) { w.SameLine(540f); w.TextDisabled(Cut(row.Beaten, 30)); }
|
||||
}
|
||||
}
|
||||
|
||||
private static void GearHeader(UiWindow w)
|
||||
{
|
||||
w.TextColored(HeaderBlue, "Item");
|
||||
w.SameLine(200f); w.TextColored(HeaderBlue, "Layer");
|
||||
w.SameLine(280f); w.TextColored(HeaderBlue, "Spell");
|
||||
w.SameLine(490f); w.TextColored(HeaderBlue, "Family");
|
||||
w.SameLine(640f); w.TextColored(HeaderBlue, "P");
|
||||
}
|
||||
|
||||
private static void GearSpellRow(UiWindow w, string item, SpellSource s, uint color)
|
||||
{
|
||||
w.TextColored(color, Cut(item, 26));
|
||||
w.SameLine(200f); w.TextColored(color, s.LayerLabel);
|
||||
w.SameLine(280f); w.TextColored(color, Cut(s.Spell.Name, 30));
|
||||
w.SameLine(490f); w.TextColored(color, Cut(GearNames.FamilyLabel(s.Spell.Category), 22));
|
||||
w.SameLine(640f); w.TextColored(color, s.Spell.Power.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
private void DrawGearSpells(UiWindow w, GearReport r)
|
||||
{
|
||||
if (r.Pieces.Count == 0)
|
||||
{
|
||||
w.TextDisabled("No equipped items found.");
|
||||
return;
|
||||
}
|
||||
GearHeader(w);
|
||||
if (r.Sets.Count > 0)
|
||||
{
|
||||
w.SeparatorText("Set bonuses");
|
||||
foreach (SetBonusGroup g in r.Sets)
|
||||
{
|
||||
bool first = true;
|
||||
foreach (SpellSource s in g.Spells)
|
||||
{
|
||||
GearSpellRow(w, first ? g.Label : "", s, SetPurple);
|
||||
if (first) w.Tooltip(g.PieceNames);
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r.Paragon.Count > 0)
|
||||
{
|
||||
w.SeparatorText($"Paragon spells ({r.Paragon.Count})");
|
||||
foreach (SpellSource s in r.Paragon) GearSpellRow(w, s.ItemName, s, ParagonTan);
|
||||
}
|
||||
|
||||
w.SeparatorText("Equipped gear");
|
||||
foreach (GearPiece p in r.Pieces)
|
||||
{
|
||||
string label = $"{p.Name} [{GearAnalysis.CategoryOf(p.ItemType)}{(p.Appraised ? "" : ", not appraised")}]";
|
||||
List<SpellSource> spells = r.PieceSpells.TryGetValue(p.Id, out var l) ? l : new List<SpellSource>();
|
||||
if (spells.Count == 0)
|
||||
{
|
||||
w.Text(Cut(label, 26));
|
||||
w.Tooltip(label);
|
||||
w.SameLine(200f);
|
||||
w.TextDisabled(p.Appraised ? "(no spells)" : "(appraisal pending)");
|
||||
continue;
|
||||
}
|
||||
bool first = true;
|
||||
foreach (SpellSource s in spells)
|
||||
{
|
||||
GearSpellRow(w, first ? label : "", s, UiFormat.Rgb(255, 255, 255));
|
||||
if (first) w.Tooltip(label);
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
// The character's buffs: often fifty or more rows, so they start folded.
|
||||
if (r.Buffs.Count > 0 && w.CollapsingHeader($"Character buffs ({r.Buffs.Count})", "g.buffs", defaultOpen: false))
|
||||
{
|
||||
GearHeader(w);
|
||||
foreach (SpellSource s in r.Buffs) GearSpellRow(w, s.ItemName, s, HeaderBlue);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawOverlapRows(UiWindow w, GearReport r, bool hideOverlap)
|
||||
{
|
||||
var rows = r.Rows.Where(x => x.Kind != OverlapKind.Ok && !(hideOverlap && x.Kind == OverlapKind.Overlap)).ToList();
|
||||
if (rows.Count == 0)
|
||||
{
|
||||
w.TextDisabled(r.Rows.Any(x => x.Kind == OverlapKind.Overlap) && hideOverlap
|
||||
? "Overlap rows hidden (uncheck Hide overlap)."
|
||||
: r.SpellSources > 0 ? "No competing families: every spell counts." : "No spells read yet: Check again once the appraisals are in.");
|
||||
return;
|
||||
}
|
||||
OverlapKind? last = null;
|
||||
foreach (OverlapRow row in rows)
|
||||
{
|
||||
if (row.Kind != last)
|
||||
{
|
||||
w.SeparatorText(row.Kind switch
|
||||
{
|
||||
OverlapKind.Overlap => "Overlap - highest power wins, the rest do nothing",
|
||||
OverlapKind.Duplicate => "Duplicate - the same spell on more than one item",
|
||||
_ => "Stacks - these combine",
|
||||
});
|
||||
w.TextColored(HeaderBlue, "Family");
|
||||
w.SameLine(170f); w.TextColored(HeaderBlue, "On");
|
||||
w.SameLine(300f); w.TextColored(HeaderBlue, "Winner");
|
||||
w.SameLine(490f); w.TextColored(HeaderBlue, "Sources");
|
||||
last = row.Kind;
|
||||
}
|
||||
uint color = row.Kind == OverlapKind.Stacks ? UiColors.Green : row.Kind == OverlapKind.Duplicate ? UiColors.Yellow : UiFormat.Rgb(255, 255, 255);
|
||||
w.TextColored(color, Cut(row.Family, 22));
|
||||
w.SameLine(170f); w.Text(row.Scope.Length > 0 ? Cut(row.Scope, 18) : "character");
|
||||
w.SameLine(300f); w.Text(Cut($"{row.Winner.Spell.Name} P{row.Winner.Spell.Power}", 28));
|
||||
w.SameLine(490f); w.TextWrapped(row.Summary);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Ratings ──────────────────────────────────────────────────────────────
|
||||
|
||||
private void DrawGearRatings(UiWindow w)
|
||||
{
|
||||
bool pack = _c.Settings.GearIncludePack;
|
||||
w.Checkbox("Include pack items", "g.pack", pack, v =>
|
||||
{
|
||||
_c.Settings.GearIncludePack = v;
|
||||
_c.Settings.Save();
|
||||
StartGearCheck();
|
||||
});
|
||||
w.Tooltip("Also list the sets, levels and ratings of the gear in your packs (each one is appraised once).");
|
||||
bool mag = _c.Settings.GearRatingsMag;
|
||||
w.SameLine();
|
||||
w.ToggleButton("Mag-style", "g.fmt.mag", mag, () => { _c.Settings.GearRatingsMag = true; _c.Settings.Save(); }, small: true);
|
||||
w.Tooltip("Each item as one Mag-Tools ItemInfo line (what Mag-Tools prints when you identify it).");
|
||||
w.SameLine();
|
||||
w.ToggleButton("Columns", "g.fmt.col", !mag, () => { _c.Settings.GearRatingsMag = false; _c.Settings.Save(); }, small: true);
|
||||
w.Tooltip("Rated items in columns: Loc, Item, Type, Set, Level, Ratings.");
|
||||
w.TextDisabled(mag
|
||||
? "Mag-Tools ItemInfo lines for your gear; [D, DR, C, CD, CR, CDR, HB, V ...] are its ratings, T11 [...] its modifiers."
|
||||
: "Loc | Item | Type | Set | Level | Ratings (T11 modifier lines under the item). Weapon rows are tinted by damage type.");
|
||||
|
||||
RatingsReport? r = _c.Gear.Ratings;
|
||||
if (r == null)
|
||||
{
|
||||
w.TextDisabled("Press Check to read your gear's sets, levels and ratings.");
|
||||
return;
|
||||
}
|
||||
int rated = r.RatedRows.Count();
|
||||
w.Text($"Checked {r.CheckedLocal:HH:mm:ss} | {(mag ? r.Rows.Count : rated)} item(s) | {rated} rated, {r.EquippedRows} of them worn | "
|
||||
+ (r.IncludePack ? "worn + packs" : "worn only"));
|
||||
if (r.IncludePack != pack) w.TextColored(UiColors.Yellow, "The pack option changed: Check again to apply it.");
|
||||
if (r.WornTotals.Count > 0)
|
||||
w.TextColored(UiColors.Gold, "Worn totals: " + string.Join(" ", r.WornTotals.Select(t => GearAnalysis.RatingShort(t.Prop) + " " + t.Value)));
|
||||
if (r.WornTotals.Count > 0 || r.T11Totals.Count > 0)
|
||||
w.Tooltip(string.Join("\n", r.WornTotals.Select(t => GearAnalysis.RatingLong(t.Prop) + " " + t.Value))
|
||||
+ (r.T11Rows > 0 ? "\nT11 modifier ratings are included (the appraisal lists them under Modifiers, not Ratings)." : ""));
|
||||
// The T11 modifiers (worn totals and each item's lines) are on the ILT Tracker bar window (Infinite Leaftide).
|
||||
if (r.T11Rows > 0 && _c.Server.IsIlt)
|
||||
w.TextColored(T11Teal, $"{r.T11Rows} T11 item(s): their modifiers are on the ILT Tracker bar button (/ro tracker).");
|
||||
else if (r.T11Totals.Count > 0)
|
||||
w.TextColored(T11Teal, "T11 worn: " + string.Join(" | ", r.T11Totals.Select(t => t.Name + " " + t.Value)));
|
||||
|
||||
if (mag)
|
||||
{
|
||||
DrawMagLines(w, r);
|
||||
return;
|
||||
}
|
||||
if (rated == 0)
|
||||
{
|
||||
w.TextDisabled("No gear with a set, an item level or ratings.");
|
||||
return;
|
||||
}
|
||||
w.TextColored(HeaderBlue, "Loc");
|
||||
w.SameLine(45f); w.TextColored(HeaderBlue, "Item");
|
||||
w.SameLine(230f); w.TextColored(HeaderBlue, "Type");
|
||||
w.SameLine(330f); w.TextColored(HeaderBlue, "Set");
|
||||
w.SameLine(480f); w.TextColored(HeaderBlue, "Level");
|
||||
w.SameLine(550f); w.TextColored(HeaderBlue, "Ratings");
|
||||
foreach (RatingRow row in r.RatedRows)
|
||||
{
|
||||
GearPiece p = row.Piece;
|
||||
uint baseColor = p.Equipped ? WornGreen : PackGrey;
|
||||
uint tint = RowTint(p, baseColor);
|
||||
w.TextColored(baseColor, p.Equipped ? "Worn" : "Pack");
|
||||
w.SameLine(45f); w.TextColored(tint, Cut(p.Name, 26));
|
||||
w.Tooltip(p.Name);
|
||||
w.SameLine(230f); w.TextColored(tint, row.TypeLabel);
|
||||
w.SameLine(330f); w.TextColored(row.Paragon ? ParagonTan : baseColor, Cut(row.SetName, 20));
|
||||
w.SameLine(480f); w.TextColored(baseColor, p.MaxLevel > 0 ? $"{p.Level}/{p.MaxLevel}" : "-");
|
||||
w.SameLine(550f);
|
||||
if (row.Stats.Length > 0) w.TextWrapped(row.Stats);
|
||||
else w.TextDisabled("-");
|
||||
// T11 gear's modifier lines: the T11 Tracking tab (their rating lines are in Ratings above). Off Infinite
|
||||
// Leaftide (no such tab) they stay here.
|
||||
if (row.T11.Length > 0 && !_c.Server.IsIlt)
|
||||
{
|
||||
w.Dummy(1f, 0f); // starts the line; the label then sits under the Item column
|
||||
w.SameLine(45f);
|
||||
w.TextColored(T11Teal, "T11:");
|
||||
w.SameLine(90f);
|
||||
w.TextWrapped(row.T11 + (p.ZoneLocked ? " (zone locked: power reduced outside its zone)" : ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A weapon's row in its damage type's colour, anything else in the worn / pack colour.</summary>
|
||||
private static uint RowTint(GearPiece p, uint baseColor) =>
|
||||
(p.ItemType & GearAnalysis.ItemWeapons) != 0 && p.DamageType != 0 ? ElementColorFlags(p.DamageType) : baseColor;
|
||||
|
||||
/// <summary>
|
||||
/// The Mag-style view: every item as its Mag-Tools ItemInfo line, worn first, weapons tinted by
|
||||
/// damage type, paragon pieces in tan; Print to chat writes the lines as Mag-Tools would.
|
||||
/// </summary>
|
||||
private void DrawMagLines(UiWindow w, RatingsReport r)
|
||||
{
|
||||
if (r.Rows.Count == 0)
|
||||
{
|
||||
w.TextDisabled("No gear found.");
|
||||
return;
|
||||
}
|
||||
RatingsReport report = r;
|
||||
w.SmallButton("Print to chat", "g.mag.print", () =>
|
||||
{
|
||||
foreach (RatingRow row in report.Rows) _c.Print((row.Piece.Equipped ? "" : "(pack) ") + row.Mag);
|
||||
});
|
||||
w.Tooltip("Writes every line below to your chat window (only you see it).");
|
||||
bool packHeader = false;
|
||||
foreach (RatingRow row in r.Rows)
|
||||
{
|
||||
GearPiece p = row.Piece;
|
||||
if (!p.Equipped && !packHeader)
|
||||
{
|
||||
w.SeparatorText("In your packs");
|
||||
packHeader = true;
|
||||
}
|
||||
uint baseColor = p.Equipped ? WornGreen : PackGrey;
|
||||
uint tint = row.Paragon ? ParagonTan : RowTint(p, baseColor);
|
||||
w.TextColored(baseColor, p.Equipped ? "Worn" : "Pack");
|
||||
w.SameLine(45f);
|
||||
w.PushStyleColor(0, tint); // ImGuiCol_Text: TextWrapped has no colour of its own
|
||||
w.TextWrapped(row.Mag);
|
||||
w.PopStyleColor();
|
||||
if (!p.Appraised) w.Tooltip("Not appraised yet: Check again in a moment for its full line.");
|
||||
}
|
||||
}
|
||||
|
||||
// ── Colours ──────────────────────────────────────────────────────────────
|
||||
|
||||
private static uint TierColor(ProtTier tier) => tier switch
|
||||
{
|
||||
ProtTier.Missing => UiColors.Red,
|
||||
ProtTier.Minor => TierMinor,
|
||||
ProtTier.Major => TierMajor,
|
||||
ProtTier.Epic => TierEpic,
|
||||
ProtTier.Legendary => TierLegendary,
|
||||
_ => TierLower,
|
||||
};
|
||||
|
||||
/// <summary>Damage-type colours (UB-ILT's Combat Tracker table) by the protection element's name.</summary>
|
||||
private static uint ElementColor(string element) => element switch
|
||||
{
|
||||
"Slashing" => ElementColorFlags(0x1),
|
||||
"Piercing" => ElementColorFlags(0x2),
|
||||
"Bludgeon" => ElementColorFlags(0x4),
|
||||
"Cold" => ElementColorFlags(0x8),
|
||||
"Fire" => ElementColorFlags(0x10),
|
||||
"Acid" => ElementColorFlags(0x20),
|
||||
"Storm" => ElementColorFlags(0x40),
|
||||
_ => UiFormat.Rgb(255, 255, 255),
|
||||
};
|
||||
|
||||
/// <summary>The same colours by DamageType flags (Nether wins where it is set).</summary>
|
||||
private static uint ElementColorFlags(int flags)
|
||||
{
|
||||
if ((flags & 0x400) != 0) return UiFormat.Rgb(200, 160, 255);
|
||||
return flags switch
|
||||
{
|
||||
0x1 => UiFormat.Rgb(255, 180, 120),
|
||||
0x2 => UiFormat.Rgb(240, 200, 140),
|
||||
0x3 => UiFormat.Rgb(255, 160, 100),
|
||||
0x4 => UiFormat.Rgb(220, 190, 140),
|
||||
0x8 => UiFormat.Rgb(160, 210, 255),
|
||||
0x10 => UiFormat.Rgb(255, 130, 70),
|
||||
0x20 => UiFormat.Rgb(160, 255, 140),
|
||||
0x40 => UiFormat.Rgb(255, 240, 120),
|
||||
_ => UiFormat.Rgb(200, 200, 200),
|
||||
};
|
||||
}
|
||||
}
|
||||
284
Plugins/RynthCore.Plugin.RynthOracle/Views/IltTrackerTab.cs
Normal file
284
Plugins/RynthCore.Plugin.RynthOracle/Views/IltTrackerTab.cs
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
// The ILT Tracker tab's quest bonus and wiki sections (Infinite Leaftide only, 2026-11-21, Silentkelpie: "look at
|
||||
// acecustom add in itl qb bonus levels and bonus tracker under t11 tab, change t11 tab to itl tracker, add in the itl wiki
|
||||
// how to to this tab as well"; the levels are ACECustom's QB Deeds: "should be called deeds based on total qb"). The T11
|
||||
// sections stay in T11Tab.cs. Data: Data/QbDeeds.cs and RynthILT's /deeds read (IltDeedsInfo), Data/QuestBonus.cs
|
||||
// (ACECustom's QB and /bonus), RynthILT's /qb list (IltQuestBonusList), Data/IltWikiGuide.cs.
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private string _qbFilter = "";
|
||||
private bool _qbShowStamps = true;
|
||||
private const int QbRowsShown = 200;
|
||||
private int _qbAskedSession = -1, _bonusAskedSession = -1;
|
||||
|
||||
// ── QB Deeds and the XP multipliers ──────────────────────────────────
|
||||
|
||||
private int _deedsAskedSession = -1;
|
||||
|
||||
private void DrawIltQuestBonus(UiWindow w)
|
||||
{
|
||||
IltQuestBonusList? ilt = _c.Ilt.QuestBonus;
|
||||
IltDeedsInfo? deeds = _c.Ilt.Deeds;
|
||||
QuestBonus qb = _c.QuestBonus;
|
||||
long count = qb.BestCount(ilt, out string from, deeds);
|
||||
int tier = deeds is { Loaded: true } ? deeds.Unlocked : count >= 0 ? QbDeeds.TierFor(count) : 0;
|
||||
string head = count >= 0
|
||||
? $"QB Deeds ({TimeText.Number(count)} QB, tier {tier} of {QbDeeds.MaxTier}"
|
||||
+ (deeds?.On == false ? ", OFF" : "") + ")"
|
||||
: "QB Deeds";
|
||||
if (!w.CollapsingHeader(head, "ilt.h.qb", defaultOpen: true)) return;
|
||||
|
||||
// Once a session: /bonus from the server, the /deeds list and the /qb list from RynthILT (the server allows /qb list
|
||||
// once a minute; RynthILT reads /deeds quietly).
|
||||
if (_c.InWorld && _bonusAskedSession != qb.Session) { _bonusAskedSession = qb.Session; _c.Send("/bonus"); }
|
||||
if (_c.InWorld && _deedsAskedSession != qb.Session && deeds != null && !deeds.Loaded && !deeds.Busy && !deeds.Unsupported)
|
||||
{
|
||||
_deedsAskedSession = qb.Session;
|
||||
_c.Send("/ilt deeds refresh");
|
||||
}
|
||||
if (_c.InWorld && _qbAskedSession != qb.Session && ilt != null && !ilt.Disabled && ilt.Generation == 0)
|
||||
{
|
||||
_qbAskedSession = qb.Session;
|
||||
_c.Send("/ilt qb");
|
||||
}
|
||||
|
||||
w.SmallButton(deeds?.Busy == true ? "Reading..." : "Read /deeds", "ilt.dd.read", () =>
|
||||
_t11Msg = _c.Send("/ilt deeds refresh") ? "RynthILT is reading your Deeds (/deeds list)." : "Log in first.");
|
||||
w.Tooltip("RynthILT reads /deeds list quietly: your QB, Deeds on or off, and every tier as the server tells it.");
|
||||
w.SameLine();
|
||||
if (deeds?.On == false)
|
||||
w.SmallButton("Deeds on", "ilt.dd.on", () => _c.Send("/ilt deeds on"));
|
||||
else
|
||||
w.SmallButton("Deeds off", "ilt.dd.off", () => _c.Send("/ilt deeds off"));
|
||||
w.Tooltip("/deeds on | off: the Deeds bonuses for this character (the server says which in chat).");
|
||||
w.SameLine();
|
||||
if (tier >= QbDeeds.RebuffTier)
|
||||
{
|
||||
w.SmallButton("/rebuff", "ilt.dd.rebuff", () => _c.Send("/ilt deeds rebuff"));
|
||||
w.Tooltip("Tier 10: casts all your known level 8 buffs at once.");
|
||||
w.SameLine();
|
||||
w.SmallButton("Writ", "ilt.dd.writ", () => _c.Send("/ilt deeds item"));
|
||||
w.Tooltip("/deeds item: a Deedkeeper's Writ that rebuffs you when used.");
|
||||
w.SameLine();
|
||||
}
|
||||
w.SmallButton("Deeds window", "ilt.dd.win", () => _t11Msg = _c.RunCommand("/ilt deeds show") || _c.Send("/ilt deeds show") ? "" : "RynthILT isn't loaded.");
|
||||
w.Tooltip("RynthILT's QB Deeds window (/ilt deeds).");
|
||||
|
||||
if (deeds?.Unsupported == true) w.TextDisabled("This server has no /deeds.");
|
||||
else if (deeds == null) w.TextDisabled("RynthILT isn't loaded (or is older): the tiers below are ACECustom's table, at the default settings.");
|
||||
else if (deeds.Status.Length > 0) w.TextDisabled(deeds.Status);
|
||||
|
||||
if (count < 0)
|
||||
w.TextDisabled("No QB yet: press Read /deeds or /bonus.");
|
||||
else
|
||||
{
|
||||
var (next, frac, toNext) = QbDeeds.Progress(count);
|
||||
if (next == 0) w.TextColored(UiColors.Green, $"Every Deeds tier is unlocked ({TimeText.Number(count)} QB).");
|
||||
else
|
||||
{
|
||||
long nextQb = deeds is { Loaded: true, NextAt: > 0 } ? deeds.NextAt : (long)next * QbDeeds.QbPerTier;
|
||||
w.TextColored(T11Gold, $"Tier {tier}");
|
||||
w.SameLine(70f);
|
||||
w.ProgressBar(frac, 220f, 0f, $"{TimeText.Number(count)} / {TimeText.Number(nextQb)} QB");
|
||||
w.SameLine();
|
||||
w.TextDisabled($"{TimeText.Number(Math.Max(0, nextQb - count))} QB to tier {next}");
|
||||
}
|
||||
w.Tooltip("Deeds: a tier every 1,000 account QB, 15 in all, each adding to the ones before (ACECustom QB Deeds).\n"
|
||||
+ $"QB from: {from}. Your QB also gives x{QuestBonus.Multiplier(count):0.000} kill XP (1 + QB x 0.005).");
|
||||
}
|
||||
DrawDeedTiers(w, deeds, tier);
|
||||
|
||||
BonusReading b = qb.Bonus;
|
||||
w.Spacing();
|
||||
if (!b.Seen)
|
||||
{
|
||||
w.TextDisabled("XP multipliers: press /bonus to read them.");
|
||||
w.SameLine();
|
||||
w.SmallButton("/bonus", "ilt.qb.bonus", () => _t11Msg = _c.Send("/bonus") ? "Asked the server for your XP multipliers (/bonus)." : "Log in first.");
|
||||
return;
|
||||
}
|
||||
w.TextColored(UiColors.Gold, "XP multipliers (/bonus " + b.AtUtc.ToLocalTime().ToString("HH:mm") + ")");
|
||||
w.SameLine();
|
||||
w.SmallButton("/bonus", "ilt.qb.bonus", () => _t11Msg = _c.Send("/bonus") ? "Asked the server for your XP multipliers (/bonus)." : "Log in first.");
|
||||
w.Tooltip("/bonus: the server prints your XP multipliers from quests, equipment and enlightenment, and the total.");
|
||||
w.SameLine();
|
||||
w.SmallButton("/top qb", "ilt.qb.top", () => _c.Send("/top qb"));
|
||||
w.Tooltip("The server's top 25 players by quest bonus, in chat.");
|
||||
BonusRow(w, "Quests", b.Quests, "1 + QB x 0.005" + (b.Quests > 0 ? $" (about {TimeText.Number(QuestBonus.QbFromMultiplier(b.Quests))} QB)" : ""));
|
||||
BonusRow(w, "Equipment", b.Equipment, "1 + your XP enchantments + 5% for each Bonus XP augmentation");
|
||||
BonusRow(w, "Enlightenment", b.Enlightenment, "1 + enlightenments x 0.1"
|
||||
+ (b.Enlightenment > 1 ? $" ({Math.Round((b.Enlightenment - 1) / QuestBonus.PerEnlightenment):0} ENL)" : ""));
|
||||
BonusRow(w, "Total", b.Total, "Quests x Equipment x Enlightenment (kill XP; the server's own XP rate comes on top)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The 15 Deeds tiers: unlocked ones green, the next one gold, the rest grey. Each tier's text is the server's own (RynthILT's
|
||||
/// /deeds list) when it is in, else ACECustom's table at the default settings.
|
||||
/// </summary>
|
||||
private void DrawDeedTiers(UiWindow w, IltDeedsInfo? deeds, int tier)
|
||||
{
|
||||
var live = new Dictionary<int, IltDeedTier>();
|
||||
if (deeds is { Loaded: true })
|
||||
foreach (IltDeedTier t in deeds.Tiers) live[t.Number] = t;
|
||||
foreach (QbDeedTier t in QbDeeds.Tiers)
|
||||
{
|
||||
bool have = live.TryGetValue(t.Number, out IltDeedTier? lt) ? lt.Unlocked : t.Number <= tier;
|
||||
bool next = !have && t.Number == tier + 1;
|
||||
uint color = have ? UiColors.Green : next ? T11Gold : UiColors.Grey;
|
||||
w.TextColored(color, $"T{t.Number}");
|
||||
w.SameLine(40f);
|
||||
w.TextColored(color, TimeText.Number(t.Qb) + " QB");
|
||||
w.SameLine(115f);
|
||||
if (lt != null && lt.Rewards.Count > 0)
|
||||
{
|
||||
string text = string.Join(", ", lt.Rewards);
|
||||
w.TextWrapped(text.Length > 260 ? text.Substring(0, 260) + "..." : text);
|
||||
if (text.Length > 260) w.Tooltip(string.Join("\n", lt.Rewards));
|
||||
}
|
||||
else w.TextWrapped(QbDeeds.Line(t));
|
||||
}
|
||||
if (deeds is not { Loaded: true })
|
||||
w.TextDisabled("The tier text is ACECustom's table at the server's default settings; Read /deeds shows the server's own.");
|
||||
}
|
||||
|
||||
private static void BonusRow(UiWindow w, string name, double value, string how)
|
||||
{
|
||||
w.Text(name);
|
||||
w.SameLine(120f);
|
||||
w.TextColored(name == "Total" ? UiColors.Green : UiFormat.Rgb(230, 230, 230), $"x{value:0.00}");
|
||||
w.SameLine(190f);
|
||||
w.TextDisabled(how);
|
||||
}
|
||||
|
||||
// ── Quest bonus tracker ──────────────────────────────────────────────
|
||||
|
||||
private void DrawIltBonusTracker(UiWindow w)
|
||||
{
|
||||
IltQuestBonusList? ilt = _c.Ilt.QuestBonus;
|
||||
bool loaded = ilt != null && ilt.Generation > 0;
|
||||
string head = loaded
|
||||
? $"Quest bonus tracker ({TimeText.Number(ilt!.Completed.Count)} done, {TimeText.Number(ilt.Incomplete.Count)} to finish)"
|
||||
: "Quest bonus tracker";
|
||||
if (!w.CollapsingHeader(head, "ilt.h.qbt", defaultOpen: true)) return;
|
||||
if (ilt == null)
|
||||
{
|
||||
w.TextDisabled("RynthILT isn't loaded: it reads the /qb list for this tracker.");
|
||||
return;
|
||||
}
|
||||
if (ilt.Disabled)
|
||||
{
|
||||
w.TextDisabled("/qb is turned off on this server.");
|
||||
return;
|
||||
}
|
||||
if (!loaded)
|
||||
{
|
||||
w.TextDisabled("The /qb list isn't read this session. " + ilt.Status);
|
||||
w.SameLine();
|
||||
w.SmallButton("Read /qb list", "ilt.qb.read", () => _t11Msg = _c.Send("/ilt qb") ? "RynthILT is reading your quest bonus list." : "Log in first.");
|
||||
w.Tooltip("RynthILT reads /qb list: every quest that counts towards your QB, done or not (the server allows it once a minute).");
|
||||
return;
|
||||
}
|
||||
|
||||
int doneStamps = ilt.Completed.Count(QuestBonus.IsStamp);
|
||||
long qbNow = ilt.Count >= 0 ? ilt.Count : ilt.Completed.Count;
|
||||
long qbAll = qbNow + ilt.Incomplete.Count;
|
||||
w.TextDisabled($"Per account: a quest is 1 QB once any of your characters starts it and 2 once one finishes it. "
|
||||
+ $"{TimeText.Number(doneStamps)} of the done ones are Dynamic stamps.");
|
||||
w.SameLine();
|
||||
w.SmallButton("Read /qb list", "ilt.qb.read", () => _t11Msg = _c.Send("/ilt qb") ? "RynthILT is reading your quest bonus list." : "Log in first.");
|
||||
w.Tooltip("RynthILT reads /qb list again (the server allows it once a minute).");
|
||||
if (ilt.Incomplete.Count > 0)
|
||||
w.TextColored(T11Gold, $"Finish the {TimeText.Number(ilt.Incomplete.Count)} started ones: {TimeText.Number(qbAll)} QB, "
|
||||
+ $"Deeds tier {QbDeeds.TierFor(qbAll)} of {QbDeeds.MaxTier}.");
|
||||
|
||||
w.InputText("Filter", "ilt.qbt.filter", _qbFilter, 64, s => _qbFilter = s);
|
||||
w.SameLine();
|
||||
w.Checkbox("Dynamic stamps", "ilt.qbt.stamps", _qbShowStamps, v => _qbShowStamps = v);
|
||||
w.Tooltip("List the Dynamic stamp flags too (the Quests tab's Dynamic Stamps rows track them by area).");
|
||||
|
||||
QbList(w, "To finish", "todo", ilt.Incomplete, UiColors.Yellow, defaultOpen: true,
|
||||
"Started on this account, not finished yet: finishing each is +1 QB (+0.5% XP, and towards the next Deeds tier).");
|
||||
QbList(w, "Done", "done", ilt.Completed, UiColors.Green, defaultOpen: false, "Counted in your QB.");
|
||||
}
|
||||
|
||||
private void QbList(UiWindow w, string label, string id, IReadOnlyList<string> flags, uint color, bool defaultOpen, string help)
|
||||
{
|
||||
string f = _qbFilter.Trim();
|
||||
List<string> rows = flags.Where(x => (_qbShowStamps || !QuestBonus.IsStamp(x))
|
||||
&& (f.Length == 0 || x.Contains(f, StringComparison.OrdinalIgnoreCase))).ToList();
|
||||
if (!w.CollapsingHeader($"{label} ({TimeText.Number(rows.Count)})", "ilt.qbt." + id, defaultOpen)) return;
|
||||
w.TextDisabled(help);
|
||||
for (int i = 0; i < rows.Count && i < QbRowsShown; i++)
|
||||
{
|
||||
string flag = rows[i];
|
||||
w.TextColored(QuestBonus.IsStamp(flag) ? UiColors.Grey : color, Cut(flag, 60));
|
||||
GuideQuest? q = _c.FindWiki(flag);
|
||||
if (q != null)
|
||||
{
|
||||
w.SameLine();
|
||||
w.TextDisabled("(wiki: " + Cut(q.Title, 30) + ")");
|
||||
}
|
||||
if (flag.Length > 60) w.Tooltip(flag);
|
||||
}
|
||||
if (rows.Count > QbRowsShown)
|
||||
w.TextDisabled($"... and {TimeText.Number(rows.Count - QbRowsShown)} more: narrow them with the filter.");
|
||||
}
|
||||
|
||||
// ── The ILT wiki: how to get its login ───────────────────────────────
|
||||
|
||||
private string _wikiGuideMsg = "";
|
||||
|
||||
private void DrawIltWikiGuide(UiWindow w)
|
||||
{
|
||||
QuestGuideClient g = _c.Guide;
|
||||
string state = !g.Available ? "RynthILT isn't serving it"
|
||||
: g.Running ? "reading..."
|
||||
: g.Guide.Quests.Count > 0 ? $"{TimeText.Number(g.Guide.Quests.Count)} quests read"
|
||||
: g.LoginSaved ? "login saved, not read yet" : "no login yet";
|
||||
bool open = !g.LoginSaved || g.Guide.Quests.Count == 0;
|
||||
if (!w.CollapsingHeader($"ILT wiki: how to get its login ({state})", "ilt.h.wiki", defaultOpen: open)) return;
|
||||
w.TextWrapped("Every page of leaftidewiki.com needs a login, so RynthILT reads the wiki with a bot password: a second, "
|
||||
+ "read-only password of your own wiki account. RynthOracle never sees it.");
|
||||
if (g.Status.Length > 0) w.TextDisabled("Wiki: " + g.Status);
|
||||
if (_wikiGuideMsg.Length > 0) w.TextColored(UiColors.Yellow, _wikiGuideMsg);
|
||||
|
||||
for (int i = 0; i < IltWikiGuide.Steps.Length; i++)
|
||||
{
|
||||
IltWikiGuide.Step st = IltWikiGuide.Steps[i];
|
||||
w.TextColored(UiColors.Gold, $"{i + 1}. {st.Title}");
|
||||
if (st.Url.Length > 0)
|
||||
{
|
||||
w.SameLine();
|
||||
string url = st.Url;
|
||||
string title = st.Title;
|
||||
w.SmallButton("Open page", "ilt.wiki.open." + i, () =>
|
||||
_wikiGuideMsg = IltWikiGuide.Open(url) ? "Opened in your browser: " + title + "." : "Couldn't open the browser: " + url);
|
||||
w.Tooltip(url);
|
||||
}
|
||||
w.TextWrapped(st.Text);
|
||||
}
|
||||
|
||||
w.Spacing();
|
||||
w.SmallButton("RynthILT settings", "ilt.wiki.settings", () =>
|
||||
_wikiGuideMsg = g.Command("settings") || _c.Send("/ilt settings") ? "" : "RynthILT isn't loaded.");
|
||||
w.Tooltip("Opens /ilt settings, where the login goes (Quest guide).");
|
||||
w.SameLine();
|
||||
w.SmallButton(g.Running ? "Reading..." : "Read the wiki now", "ilt.wiki.read", () =>
|
||||
{
|
||||
if (g.Running) return;
|
||||
_wikiGuideMsg = !g.LoginSaved ? "Save the login in RynthILT's settings first."
|
||||
: g.Command("refresh") ? "RynthILT is reading the wiki." : "RynthILT isn't loaded.";
|
||||
});
|
||||
w.Tooltip("RynthILT reads the wiki again (only the pages edited since).");
|
||||
w.SameLine();
|
||||
w.SmallButton("/ilt wiki help", "ilt.wiki.help", () => _c.Send("/ilt wiki help"));
|
||||
w.Tooltip("The same steps in chat.");
|
||||
}
|
||||
}
|
||||
277
Plugins/RynthCore.Plugin.RynthOracle/Views/KillTasksTab.cs
Normal file
277
Plugins/RynthCore.Plugin.RynthOracle/Views/KillTasksTab.cs
Normal file
|
|
@ -0,0 +1,277 @@
|
|||
// The Quests tab's Kill Tasks list (2026-11-21, Silentkelpie: "add a tab to track kill tasks ... you should be
|
||||
// able to track progress by looking at quests in the client"). Infinite Leaftide only. The list is the wiki's
|
||||
// kill tasks (the Quest Summary box's "Kill Task = Yes", 150 pages) with each one's progress:
|
||||
// - the kills: the task's counter flag in /myquests ("KillTaskDrudgeLurkers_0507: 37 of 100"), else this
|
||||
// session's kill line in chat ("You have killed 37 Drudge Lurkers! You must kill 100 ...");
|
||||
// - "Turn in" once the kills are all made, "Done 5h" while its timer runs, "Ready" when it can be had again;
|
||||
// - "1st" or "Again" (2026-11-22, Silentkelpie: "the kill task tab should flag if the kill task has been done before or
|
||||
// if it is the 1st time"): done before when a stamp or flag of the task other than its live kill counter is held
|
||||
// (/myquests, the account's /qb list, this session), the quest list's flag of its name is, or its timer runs;
|
||||
// and the kill counters /myquests holds that no wiki task names (so nothing the server counts is left out).
|
||||
// The opened task is the wiki quest view (its steps, Go, Run this quest) with the kill count on top.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
/// <summary>Where a kill task stands; the order the list shows them in.</summary>
|
||||
internal enum KillState { TurnIn, Counting, Ready, NotStarted, Waiting, Completed }
|
||||
|
||||
/// <summary>A kill task's progress: the kills and the goal, where the count came from, and its state.</summary>
|
||||
internal sealed class KillProgress
|
||||
{
|
||||
public KillState State;
|
||||
public int Kills;
|
||||
public int Goal;
|
||||
/// <summary>The /myquests counter flag, or null.</summary>
|
||||
public QuestFlag? Counter;
|
||||
/// <summary>The count came from this session's kill line in chat (newer than /myquests).</summary>
|
||||
public bool FromChat;
|
||||
public string Status = "";
|
||||
public uint Color = UiColors.Grey;
|
||||
/// <summary>The task was done before (else this is the first time).</summary>
|
||||
public bool DoneBefore;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Done before: a stamp of the task is held (any run: /myquests, the /qb list, this session) other than the ones a
|
||||
/// first run holds too (its live kill counter, a "start" flag, the first step's), a kill task timer flag naming its
|
||||
/// creature is in /myquests, or the quest list's flag of its name is.
|
||||
/// </summary>
|
||||
private bool KillDoneBefore(GuideQuest q, QuestFlag? counter)
|
||||
{
|
||||
// Not the stamps a first run holds too: the live counter, a "start" flag, the first step's (taking the task).
|
||||
string counterKey = counter != null ? GuideStamp.Key(counter.Key) : "";
|
||||
var first = new HashSet<string>(StringComparer.Ordinal);
|
||||
if (q.Steps.Count > 1)
|
||||
foreach (string st in q.Steps[0].Stamps) first.Add(GuideStamp.Key(st));
|
||||
foreach (string st in q.AllStamps())
|
||||
{
|
||||
string k = GuideStamp.Key(st);
|
||||
if (k == counterKey || first.Contains(k) || k.Contains("start", StringComparison.Ordinal)) continue;
|
||||
if (StateOf(q, st) != StampState.Missing) return true;
|
||||
// A flag of the task's on a redo timer: it was turned in.
|
||||
if (StampFlag(st) is QuestFlag tf && tf.RepeatTime > TimeSpan.Zero && tf.MaxSolves <= 1) return true;
|
||||
}
|
||||
string key = q.KillCreatureKey;
|
||||
if (key.Length >= 5)
|
||||
foreach (QuestFlag f in _c.Flags.Flags.Values)
|
||||
if (f.MaxSolves <= 1 && f.Solves > 0 && QuestTimer.IsKillTask(f) && GuideStamp.Key(f.Key).Contains(key, StringComparison.Ordinal))
|
||||
return true;
|
||||
return CatalogByName(q.Title) is Quest cq && cq.IsComplete(_c.Flags);
|
||||
}
|
||||
|
||||
/// <summary>The Kill Tasks list is on screen (the plugin reads /myquests again after kills while it is).</summary>
|
||||
public bool KillTasksShowing => Tab == TabQuests && _c.Settings.QuestGuideView && _gTab == GuideTab.KillTasks;
|
||||
|
||||
/// <summary>
|
||||
/// The task's counter flag: one of its stamps that /myquests holds with a solve limit over 1 (a kill
|
||||
/// counter, "KillTaskDrudgeLurkers_0507" 37 of 100); else, for the few pages that list no stamps, a kill
|
||||
/// counter flag that names the task's creature.
|
||||
/// </summary>
|
||||
internal QuestFlag? KillCounter(GuideQuest q)
|
||||
{
|
||||
foreach (string st in q.AllStamps())
|
||||
if (StampFlag(st) is QuestFlag f && f.MaxSolves > 1) return f;
|
||||
string key = q.KillCreatureKey;
|
||||
if (key.Length < 5) return null;
|
||||
foreach (QuestFlag f in _c.Flags.Flags.Values)
|
||||
if (QuestTimer.IsKillTask(f) && GuideStamp.Key(f.Key).Contains(key, StringComparison.Ordinal)) return f;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>A wiki kill task's progress (internal for the tests).</summary>
|
||||
internal KillProgress KillProgressOf(GuideQuest q)
|
||||
{
|
||||
var p = new KillProgress { Goal = q.KillTarget };
|
||||
GuideRow row = WikiRow(q);
|
||||
QuestFlag? counter = KillCounter(q);
|
||||
p.Counter = counter;
|
||||
if (counter != null)
|
||||
{
|
||||
p.Kills = counter.Solves;
|
||||
if (counter.MaxSolves > 1) p.Goal = counter.MaxSolves;
|
||||
}
|
||||
// A kill line newer than the last /myquests read wins (it moves with every kill).
|
||||
if (_c.Kills.For(q.KillCreatureKey) is KillCount k && k.AtUtc > _c.Flags.LastReadUtc && (k.Goal > 0 || k.Kills > 0))
|
||||
{
|
||||
p.Kills = k.Kills;
|
||||
if (k.Goal > 0) p.Goal = k.Goal;
|
||||
p.FromChat = true;
|
||||
}
|
||||
|
||||
TimeSpan wait = WikiWait(q);
|
||||
bool counting = (counter != null || p.FromChat) && p.Goal > 0 && p.Kills < p.Goal;
|
||||
bool allKilled = (counter != null || p.FromChat) && p.Goal > 0 && p.Kills >= p.Goal;
|
||||
if (counting && !(row.Done && wait > TimeSpan.Zero))
|
||||
{
|
||||
p.State = KillState.Counting;
|
||||
p.Status = $"{p.Kills} / {p.Goal}";
|
||||
p.Color = UiColors.Yellow;
|
||||
}
|
||||
else if (allKilled && wait <= TimeSpan.Zero && !row.Done)
|
||||
{
|
||||
p.State = KillState.TurnIn;
|
||||
p.Status = "Turn in";
|
||||
p.Color = UiColors.Gold;
|
||||
}
|
||||
else if (row.Done && wait > TimeSpan.Zero)
|
||||
{
|
||||
p.State = KillState.Waiting;
|
||||
p.Status = "Done " + Short(wait);
|
||||
p.Color = UiColors.Yellow;
|
||||
}
|
||||
else if (row.Done && q.RepeatSec == 0)
|
||||
{
|
||||
p.State = KillState.Completed;
|
||||
p.Status = "Completed";
|
||||
p.Color = UiColors.Green;
|
||||
}
|
||||
else if (row.State == GuideProgressState.Done || row.Done || counter != null)
|
||||
{
|
||||
p.State = KillState.Ready;
|
||||
p.Status = "Ready";
|
||||
p.Color = UiColors.Green;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.State = KillState.NotStarted;
|
||||
p.Status = p.Goal > 0 ? $"0 / {p.Goal}" : "Not started";
|
||||
p.Color = UiColors.Grey;
|
||||
}
|
||||
p.DoneBefore = p.State is KillState.Waiting or KillState.Completed || KillDoneBefore(q, counter);
|
||||
return p;
|
||||
}
|
||||
|
||||
/// <summary>The Kill Tasks list: the wiki's kill tasks, then the counters only /myquests knows. Each by state, then name.</summary>
|
||||
private void KillTaskRows(string[] terms, bool hide)
|
||||
{
|
||||
var order = new Dictionary<string, (int State, string Label)>(StringComparer.Ordinal);
|
||||
var named = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (GuideQuest q in _c.Wiki.Quests)
|
||||
{
|
||||
if (!_c.Wiki.IsKillTask(q)) continue;
|
||||
KillProgress p = KillProgressOf(q);
|
||||
if (p.Counter != null) named.Add(p.Counter.Key);
|
||||
foreach (string st in q.AllStamps()) named.Add(st);
|
||||
if (!MatchesAll(WikiHay(q), terms)) continue;
|
||||
bool done = p.State is KillState.Waiting or KillState.Completed;
|
||||
if (hide && done) continue;
|
||||
var r = new GuideRow { Key = "w:" + q.Title, Label = q.Title, W = q, Done = done, Status = p.Status, Color = p.Color };
|
||||
SetKillTag(r, p.DoneBefore);
|
||||
_gRows.Add(r);
|
||||
order[r.Key] = ((int)p.State, r.Label);
|
||||
}
|
||||
|
||||
// Counters the server keeps that no wiki kill task names.
|
||||
var namedKeys = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (string n in named) namedKeys.Add(GuideStamp.Key(n));
|
||||
foreach (QuestFlag f in _c.Flags.Flags.Values)
|
||||
{
|
||||
if (!QuestTimer.IsKillTask(f) || namedKeys.Contains(GuideStamp.Key(f.Key))) continue;
|
||||
if (!MatchesAll(f.Key + " " + f.Description, terms)) continue;
|
||||
QuestTimerState st = QuestTimer.State(f, true, _c.UtcNow, out string text);
|
||||
KillState ks = st switch
|
||||
{
|
||||
QuestTimerState.InProgress => KillState.Counting,
|
||||
QuestTimerState.Waiting => KillState.Waiting,
|
||||
QuestTimerState.Done => KillState.Completed,
|
||||
_ => KillState.Ready,
|
||||
};
|
||||
bool done = ks is KillState.Waiting or KillState.Completed;
|
||||
if (hide && done) continue;
|
||||
var r = new GuideRow
|
||||
{
|
||||
Key = "k:" + f.Key, Label = FlagLabel(f.Key), Flag = f, Done = done,
|
||||
Status = ks == KillState.Counting ? $"{f.Solves} / {f.MaxSolves}" : ks == KillState.Waiting ? "Done " + text : ks == KillState.Completed ? "Completed" : "Ready",
|
||||
Color = ks switch { KillState.Counting or KillState.Waiting => UiColors.Yellow, KillState.Completed or KillState.Ready => UiColors.Green, _ => UiColors.Grey },
|
||||
};
|
||||
// A counter alone: its timer running or up says it was turned in before.
|
||||
SetKillTag(r, ks is KillState.Waiting or KillState.Completed or KillState.Ready);
|
||||
_gRows.Add(r);
|
||||
order[r.Key] = ((int)ks, r.Label);
|
||||
}
|
||||
|
||||
_gRows.Sort((a, b) =>
|
||||
{
|
||||
(int sa, string la) = order[a.Key];
|
||||
(int sb, string lb) = order[b.Key];
|
||||
return sa != sb ? sa.CompareTo(sb) : string.Compare(la, lb, StringComparison.OrdinalIgnoreCase);
|
||||
});
|
||||
}
|
||||
|
||||
private static void SetKillTag(GuideRow r, bool doneBefore)
|
||||
{
|
||||
(r.Tag, r.TagTip) = GuideProgress.KillTag(doneBefore);
|
||||
r.TagColor = doneBefore ? UiColors.Green : UiColors.Gold;
|
||||
}
|
||||
|
||||
/// <summary>"KillTaskDrudgeLurkers_0507" -> "Kill Task Drudge Lurkers 0507".</summary>
|
||||
internal static string FlagLabel(string flag)
|
||||
{
|
||||
var sb = new System.Text.StringBuilder(flag.Length + 8);
|
||||
for (int i = 0; i < flag.Length; i++)
|
||||
{
|
||||
char c = flag[i];
|
||||
if (c == '_') { if (sb.Length > 0 && sb[^1] != ' ') sb.Append(' '); continue; }
|
||||
if (i > 0 && char.IsUpper(c) && (char.IsLower(flag[i - 1]) || char.IsDigit(flag[i - 1])) && sb.Length > 0 && sb[^1] != ' ') sb.Append(' ');
|
||||
else if (i > 0 && char.IsDigit(c) && char.IsLetter(flag[i - 1]) && sb.Length > 0 && sb[^1] != ' ') sb.Append(' ');
|
||||
sb.Append(c);
|
||||
}
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
|
||||
/// <summary>A line over the list: how many tasks are counting, to turn in and ready.</summary>
|
||||
private void DrawKillSummary(UiWindow w)
|
||||
{
|
||||
int counting = 0, turnIn = 0, ready = 0;
|
||||
foreach (GuideQuest q in _c.Wiki.Quests)
|
||||
{
|
||||
if (!_c.Wiki.IsKillTask(q)) continue;
|
||||
switch (KillProgressOf(q).State)
|
||||
{
|
||||
case KillState.Counting: counting++; break;
|
||||
case KillState.TurnIn: turnIn++; break;
|
||||
case KillState.Ready: ready++; break;
|
||||
}
|
||||
}
|
||||
string read = _c.Flags.LastReadUtc == DateTime.MinValue ? "not read yet" : "read " + Short(_c.UtcNow - _c.Flags.LastReadUtc) + " ago";
|
||||
w.TextDisabled($"Kill tasks: {counting} counting, {turnIn} to turn in, {ready} ready | /myquests {read}");
|
||||
w.Tooltip("The kills come from your quest flags (/myquests): each task's counter flag. A kill line in chat\n"
|
||||
+ "(\"You have killed 37 Drudge Lurkers! You must kill 100 ...\") shows at once, and with this list open\n"
|
||||
+ "the flags are read again after kills (at most once a minute: the server's limit). Refresh reads them now.");
|
||||
}
|
||||
|
||||
/// <summary>The kill count over an opened wiki kill task.</summary>
|
||||
private void DrawKillLine(UiWindow w, GuideQuest q)
|
||||
{
|
||||
KillProgress p = KillProgressOf(q);
|
||||
string count = p.Counter != null || p.FromChat
|
||||
? $"Kills: {p.Kills} / {(p.Goal > 0 ? p.Goal.ToString(System.Globalization.CultureInfo.InvariantCulture) : "?")}"
|
||||
+ (p.Goal > p.Kills ? $" ({p.Goal - p.Kills} left)" : "")
|
||||
: p.Goal > 0 ? $"Kills: not started (the task is {p.Goal} kills)" : "Kills: not started";
|
||||
w.TextColored(p.Color, count + " - " + p.Status);
|
||||
w.SameLine();
|
||||
w.TextColored(p.DoneBefore ? UiColors.Green : UiColors.Gold, p.DoneBefore ? "(done before)" : "(first time)");
|
||||
string from = p.FromChat ? "from the last kill line in chat"
|
||||
: p.Counter != null ? $"from /myquests: {p.Counter.Key} ({p.Counter.Solves} of {p.Counter.MaxSolves})"
|
||||
: "no counter flag in /myquests yet (talk to " + (q.StartsWith.Length > 0 ? q.StartsWith : "the task's NPC") + " to start it)";
|
||||
w.TextDisabled(from);
|
||||
}
|
||||
|
||||
/// <summary>A kill counter only /myquests knows.</summary>
|
||||
private void DrawKillFlag(UiWindow w, QuestFlag f)
|
||||
{
|
||||
w.TextColored(UiColors.Gold, FlagLabel(f.Key));
|
||||
QuestTimerState st = QuestTimer.State(f, true, _c.UtcNow, out string text);
|
||||
w.Text($"Kills: {f.Solves} / {f.MaxSolves}" + (f.Solves < f.MaxSolves ? $" ({f.MaxSolves - f.Solves} left)" : ""));
|
||||
w.TextDisabled("State: " + (st == QuestTimerState.Waiting ? "again in " + text : text));
|
||||
if (f.RepeatTime > TimeSpan.Zero) w.TextDisabled("Timer: " + Short(f.RepeatTime));
|
||||
if (f.Description.Length > 0) w.TextWrapped(f.Description);
|
||||
w.TextDisabled("Flag " + f.Key + " - no wiki kill task names this counter.");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
|
@ -9,7 +10,7 @@ namespace RynthCore.Plugin.RynthOracle.Views;
|
|||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
public const string TabQuests = "Quests", TabCharacter = "Character",
|
||||
public const string TabQuests = "Quests", TabCharacter = "Character", TabGear = "Gear",
|
||||
TabSkills = "Skills", TabAttributes = "Attributes", TabProgress = "Progress",
|
||||
TabAugs = "Augs", TabSociety = "Society",
|
||||
TabTitles = "Titles", TabVoid = "Void", TabFellowship = "Fellowship",
|
||||
|
|
@ -50,6 +51,9 @@ internal sealed partial class OracleView
|
|||
() => "RynthCore's skills panel: attributes and vitals."),
|
||||
new(TabProgress, DrawEmbedded, false, RefreshCharacter,
|
||||
() => "RynthCore's skills panel: progression planners (where the server has them)."),
|
||||
// Gear: every server's (the spells come from the client's own spell table).
|
||||
new(TabGear, DrawGear, false, RefreshGear,
|
||||
() => "Checks your gear again: worn items are appraised where needed, then the overlap and ratings lists are rebuilt."),
|
||||
new(TabAugs, DrawAugs, true, RefreshCharacterAndQuests,
|
||||
() => "Re-reads your character from the game and sends /myquests for the gem timers."),
|
||||
new(TabSociety, DrawSociety, true, RefreshCharacterAndQuests,
|
||||
|
|
@ -58,6 +62,8 @@ internal sealed partial class OracleView
|
|||
() => "Re-reads the titles you hold from the game."),
|
||||
new(TabVoid, DrawVoid, true, RefreshVoid,
|
||||
() => "Re-reads your buffs from the game and drops the spell timers that ran out."),
|
||||
// ILT Tracker left the Oracle tab strip 2026-11-22: its own bar window ("ILT Tracker", /ro tracker).
|
||||
// ILT Hub pages are RynthILT's "ILT Features" bar window (like Conquest).
|
||||
new(TabFellowship, DrawFellowship, false, RefreshFellowship,
|
||||
() => "Re-reads the fellowship and its members from the game."),
|
||||
new(TabAbout, DrawAbout, false, RefreshAbout,
|
||||
|
|
@ -66,15 +72,17 @@ internal sealed partial class OracleView
|
|||
}
|
||||
|
||||
/// <summary>Every tab shows on every server (a server's own pages are its server plugin's).</summary>
|
||||
private static bool Visible(TabDef t) => true;
|
||||
private bool Visible(TabDef t) => true;
|
||||
|
||||
/// <summary>The selected tab's name; a tab not available on this server falls back to Quests.</summary>
|
||||
/// <summary>The selected tab's name; an old saved ILT Tracker / T11 tab falls back to Quests.</summary>
|
||||
public string Tab
|
||||
{
|
||||
get
|
||||
{
|
||||
string saved = _c.Settings.TabName;
|
||||
if (saved == TabT11 || saved == TabT11Old) return TabQuests;
|
||||
foreach (TabDef t in _tabs)
|
||||
if (t.Name == _c.Settings.TabName && Visible(t)) return t.Name;
|
||||
if (t.Name == saved && Visible(t)) return t.Name;
|
||||
return TabQuests;
|
||||
}
|
||||
set
|
||||
|
|
@ -172,4 +180,14 @@ internal sealed partial class OracleView
|
|||
w.SmallButton(">", id + ".next", () => setPage(Math.Min(pages - 1, p + 1)));
|
||||
return page;
|
||||
}
|
||||
|
||||
/// <summary>Celestial Hand / Eldrytch Web / Radiant Blood from PropertyInt 287–289 (for society quest runs).</summary>
|
||||
private SocietyStanding Standing()
|
||||
{
|
||||
CharacterSnapshot c = _c.Character;
|
||||
return new SocietyStanding(
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyCelhan),
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyEldweb),
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyRadblo));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
899
Plugins/RynthCore.Plugin.RynthOracle/Views/QuestGuideTab.cs
Normal file
899
Plugins/RynthCore.Plugin.RynthOracle/Views/QuestGuideTab.cs
Normal file
|
|
@ -0,0 +1,899 @@
|
|||
// The Quests tab's guide view (2026-11-01, Silentkelpie's layout): the quests on the left with how many of
|
||||
// their stamps you hold, the opened quest on the right: its timer, where it starts, its steps with their
|
||||
// coordinates (Go) and the stamps each gives (ticked when you hold them), its loot and rewards, and "Run this
|
||||
// quest" (QuestRunner: RynthNav walks the steps, RynthAi picks up the quest's items). On Infinite Leaftide the
|
||||
// list holds the wiki's quests (RynthILT reads leaftidewiki.com: QuestGuideClient) with the master quest list's
|
||||
// own, and the Dynamic Stamps by area; elsewhere the master list's quests. Tabs: All / Story / Dailies /
|
||||
// Weekly, and on ILT QB / ILT Wiki / Stamps. "Flag list" switches back to the full flag list (QuestsTab.cs).
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>The guide view's tabs.</summary>
|
||||
internal enum GuideTab { All, Story, Dailies, Weekly, Qb, Wiki, Stamps, KillTasks, Society, Contracts }
|
||||
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private static readonly string[] GuideTabNames = { "All", "Story", "Dailies", "Weekly", "QB", "Wiki", "Stamps", "Kill Tasks", "Society", "Contracts" };
|
||||
private const int GuidePageSize = 60;
|
||||
private const int GuideLabelChars = 48;
|
||||
private const int ColText = 0; // ImGuiCol_Text
|
||||
|
||||
private GuideTab _gTab;
|
||||
private string _gSearch = "";
|
||||
private int _gPage;
|
||||
private string _gSel = "";
|
||||
private string _gMsg = "";
|
||||
private readonly List<GuideRow> _gRows = new();
|
||||
private string _gRowsKey = "";
|
||||
|
||||
// The stamps the character holds (GuideStamp keys): /myquests flags, the /qb list, this session's stamps.
|
||||
private HashSet<string> _held = new(StringComparer.Ordinal);
|
||||
private string _heldKey = "";
|
||||
|
||||
private sealed class GuideRow
|
||||
{
|
||||
public string Key = "";
|
||||
public string Label = "";
|
||||
public string Status = "";
|
||||
public uint Color = UiColors.Grey;
|
||||
public bool Done;
|
||||
public GuideQuest? W;
|
||||
public Quest? Q;
|
||||
public string Area = "";
|
||||
/// <summary>A kill counter only /myquests knows (the Kill Tasks list).</summary>
|
||||
public QuestFlag? Flag;
|
||||
/// <summary>A contract (the Contracts list).</summary>
|
||||
public GuideContract? C;
|
||||
/// <summary>The status's tooltip (the four states' sentence, 2026-11-22).</summary>
|
||||
public string Tip = "";
|
||||
/// <summary>The four states (a wiki or quest list row).</summary>
|
||||
public GuideProgressState State;
|
||||
/// <summary>A short tag before the status (a kill task's "1st" / "Again"), its colour and tooltip.</summary>
|
||||
public string Tag = "";
|
||||
public uint TagColor = UiColors.Grey;
|
||||
public string TagTip = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The tabs this server has (internal for the tests). Since 2026-11-21 the wiki tabs are on every server: Wiki
|
||||
/// (every wiki quest), Kill Tasks, Society and Contracts, from the AC Community Wiki (RynthILT's wiki on
|
||||
/// Infinite Leaftide). QB and Stamps stay Infinite Leaftide's.
|
||||
/// </summary>
|
||||
internal List<GuideTab> GuideTabs()
|
||||
{
|
||||
var tabs = new List<GuideTab> { GuideTab.All, GuideTab.Story, GuideTab.Dailies, GuideTab.Weekly, GuideTab.Wiki,
|
||||
GuideTab.KillTasks, GuideTab.Society, GuideTab.Contracts };
|
||||
if (_c.Server.IsIlt) { tabs.Add(GuideTab.Qb); tabs.Add(GuideTab.Stamps); }
|
||||
return tabs;
|
||||
}
|
||||
|
||||
/// <summary>The tabs on the second row: the wiki's lists.</summary>
|
||||
private static bool SecondRow(GuideTab t) => t is GuideTab.KillTasks or GuideTab.Society or GuideTab.Contracts or GuideTab.Qb or GuideTab.Stamps;
|
||||
|
||||
/// <summary>Opens a guide tab (and the guide view). Internal for the tests and /ro.</summary>
|
||||
internal void ShowGuide(GuideTab tab, string? select = null)
|
||||
{
|
||||
_c.Settings.QuestGuideView = true;
|
||||
_gTab = tab;
|
||||
_gPage = 0;
|
||||
if (select != null) _gSel = select;
|
||||
Tab = TabQuests;
|
||||
}
|
||||
|
||||
/// <summary>The Guide / Flag list switch at the top of the Quests tab.</summary>
|
||||
private void DrawQuestViewSwitch(UiWindow w)
|
||||
{
|
||||
bool guide = _c.Settings.QuestGuideView;
|
||||
w.ToggleButton("Guide", "q.view.guide", guide, () => SetGuideView(true), small: true);
|
||||
w.Tooltip("The quests with their steps: the list on the left, the opened quest on the right.");
|
||||
w.SameLine();
|
||||
w.ToggleButton("Flag list", "q.view.flags", !guide, () => SetGuideView(false), small: true);
|
||||
w.Tooltip("Every quest flag you hold, with the trackers, filters, timers and rewards.");
|
||||
}
|
||||
|
||||
private void SetGuideView(bool guide)
|
||||
{
|
||||
if (_c.Settings.QuestGuideView == guide) return;
|
||||
_c.Settings.QuestGuideView = guide;
|
||||
_c.Settings.Save();
|
||||
}
|
||||
|
||||
// ── Held stamps ─────────────────────────────────────────────────────────
|
||||
|
||||
private HashSet<string> HeldStamps()
|
||||
{
|
||||
string key = $"{_c.Flags.Revision}|{_c.Ilt.Revision}|{_c.SessionStampRevision}";
|
||||
if (key == _heldKey) return _held;
|
||||
_heldKey = key;
|
||||
var set = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (string f in _c.Flags.Flags.Keys) set.Add(GuideStamp.Key(f));
|
||||
if (_c.Server.IsIlt)
|
||||
foreach (string f in _c.Ilt.QbCompletedSet) set.Add(GuideStamp.Key(f));
|
||||
foreach (string s in _c.SessionStamps) set.Add(s);
|
||||
_held = set;
|
||||
return set;
|
||||
}
|
||||
|
||||
private bool StampHeld(string stamp) => HeldStamps().Contains(GuideStamp.Key(stamp));
|
||||
|
||||
/// <summary>Where a quest's stamp stands for this run of the quest (2026-11-01).</summary>
|
||||
internal enum StampState
|
||||
{
|
||||
/// <summary>Never stamped.</summary>
|
||||
Missing,
|
||||
/// <summary>Stamped, and it counts now: a one-time quest's, or a repeatable one's still inside its timer.</summary>
|
||||
Done,
|
||||
/// <summary>Stamped on an earlier run of a repeatable quest whose timer has run out: it can be had again.</summary>
|
||||
Earlier,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A stamp of <paramref name="q"/> for this run. Before 2026-11-01 any stamp ever held was ticked, so a
|
||||
/// daily done yesterday showed every step done though it was ready again. Now a repeatable quest's stamp
|
||||
/// counts while its flag's timer runs (or, with no timer on the flag, while the quest's repeat time since
|
||||
/// it was stamped hasn't passed); after that it is Earlier. A stamp seen in chat this session is Done.
|
||||
/// </summary>
|
||||
private StampState StateOf(GuideQuest q, string stamp)
|
||||
{
|
||||
if (_c.SessionStamps.Contains(GuideStamp.Key(stamp))) return StampState.Done;
|
||||
QuestFlag? f = StampFlag(stamp);
|
||||
bool repeats = q.RepeatSec != 0;
|
||||
if (f != null)
|
||||
{
|
||||
if (!repeats) return StampState.Done;
|
||||
if (f.RepeatTime > TimeSpan.Zero) return f.NextAvailableTime(_c.UtcNow) > TimeSpan.Zero ? StampState.Done : StampState.Earlier;
|
||||
if (q.RepeatSec > 0 && f.CompletedOnUtc != DateTime.MinValue)
|
||||
return f.CompletedOnUtc.AddSeconds(q.RepeatSec) > _c.UtcNow ? StampState.Done : StampState.Earlier;
|
||||
return StampState.Done;
|
||||
}
|
||||
// The /qb list (Infinite Leaftide) says only that it was ever stamped.
|
||||
if (StampHeld(stamp)) return repeats ? StampState.Earlier : StampState.Done;
|
||||
return StampState.Missing;
|
||||
}
|
||||
|
||||
/// <summary>A step is done when it has stamps and each one counts now.</summary>
|
||||
private bool StepDone(GuideQuest q, GuideStep s) => s.Stamps.Count > 0 && s.Stamps.TrueForAll(st => StateOf(q, st) == StampState.Done);
|
||||
|
||||
/// <summary>
|
||||
/// Each step's state: done (its stamps count now), done by the steps after it (no stamp of its own, but a
|
||||
/// later step is done: the quest went past it), or not done; and the first step not done (-1: none).
|
||||
/// </summary>
|
||||
private (bool[] Done, bool[] Implied, int Next) StepStates(GuideQuest q)
|
||||
{
|
||||
int n = q.Steps.Count;
|
||||
var done = new bool[n];
|
||||
var implied = new bool[n];
|
||||
int lastDone = -1;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
done[i] = StepDone(q, q.Steps[i]);
|
||||
if (done[i]) lastDone = i;
|
||||
}
|
||||
for (int i = 0; i < lastDone; i++)
|
||||
if (!done[i] && q.Steps[i].Stamps.Count == 0) implied[i] = true;
|
||||
int next = -1;
|
||||
for (int i = 0; i < n; i++)
|
||||
if (!done[i] && !implied[i]) { next = i; break; }
|
||||
return (done, implied, next);
|
||||
}
|
||||
|
||||
/// <summary>The flag a stamp is in /myquests (any spelling of it), or null.</summary>
|
||||
private QuestFlag? StampFlag(string stamp)
|
||||
{
|
||||
if (_c.Flags.TryGet(stamp, out QuestFlag f)) return f;
|
||||
string k = GuideStamp.Key(stamp);
|
||||
foreach (KeyValuePair<string, QuestFlag> kv in _c.Flags.Flags)
|
||||
if (GuideStamp.Key(kv.Key) == k) return kv.Value;
|
||||
return null;
|
||||
}
|
||||
|
||||
// ── The view ────────────────────────────────────────────────────────────
|
||||
|
||||
private void DrawGuide(UiWindow w)
|
||||
{
|
||||
List<GuideTab> tabs = GuideTabs();
|
||||
if (!tabs.Contains(_gTab)) _gTab = GuideTab.All;
|
||||
bool second = false;
|
||||
foreach (GuideTab t in tabs)
|
||||
{
|
||||
GuideTab tab = t;
|
||||
if (SecondRow(t) && !second)
|
||||
{
|
||||
second = true;
|
||||
w.Dummy(0f, 0f); // ends the first row (the SameLine before it)
|
||||
}
|
||||
string name = t == GuideTab.Wiki ? _c.WikiLabel : GuideTabNames[(int)t];
|
||||
w.ToggleButton(name, "g.tab." + (int)t, _gTab == t, () => { _gTab = tab; _gPage = 0; });
|
||||
w.SameLine();
|
||||
}
|
||||
w.Checkbox("Hide collected", "g.hide", _c.Settings.GuideHideCollected, v =>
|
||||
{
|
||||
_c.Settings.GuideHideCollected = v;
|
||||
_c.Settings.Save();
|
||||
_gPage = 0;
|
||||
});
|
||||
w.Tooltip("Leave out the quests whose stamps you all hold (and stamps you have).");
|
||||
w.SameLine();
|
||||
w.Button("Refresh", "g.refresh", () => _gMsg = GuideRefresh());
|
||||
w.Tooltip("Reads your quest flags again (/myquests), and the wiki's quests: the AC Community Wiki"
|
||||
+ (_c.Server.IsIlt ? " and RynthILT's." : "."));
|
||||
|
||||
w.InputText("##g.search", "g.search", _gSearch, 64, s => { _gSearch = s; _gPage = 0; });
|
||||
w.Tooltip("Words to find: a quest's name, NPC, place, items or stamps.");
|
||||
w.SameLine();
|
||||
DrawGuideSource(w);
|
||||
if (_gMsg.Length > 0) w.TextDisabled(_gMsg);
|
||||
if (_gTab == GuideTab.KillTasks) DrawKillSummary(w);
|
||||
if (_gTab == GuideTab.Contracts) w.TextDisabled($"Contracts: {_c.Fandom.Guide.Contracts.Count} on the AC Community Wiki; the quest each is for opens with Open, and Run this quest runs it.");
|
||||
if (_gTab == GuideTab.Stamps)
|
||||
w.TextDisabled(DynamicStampList.Source == "wiki"
|
||||
? $"Stamps: the wiki's Dynamic Stamps page ({DynamicStampList.All.Count} stamps in {DynamicStampList.Areas.Count} places)"
|
||||
: $"Stamps: the players' sheet ({DynamicStampList.All.Count}); the wiki's page once RynthILT has read it");
|
||||
|
||||
List<GuideRow> rows = GuideRows();
|
||||
float total = w.ContentWidth > 0f ? w.ContentWidth : 680f;
|
||||
// The list gets enough room for the names (2026-11-01: at 38% they were cut to ~15 letters).
|
||||
float leftW = Math.Clamp(total * 0.45f, 260f, 440f);
|
||||
|
||||
w.BeginChild("g.list", leftW, 0f, border: true);
|
||||
if (rows.Count > GuidePageSize)
|
||||
{
|
||||
_gPage = Pager(w, "g.page", _gPage, rows.Count, GuidePageSize, p => _gPage = p);
|
||||
}
|
||||
else _gPage = 0;
|
||||
int start = _gPage * GuidePageSize;
|
||||
// The status column holds the four states ("3/5 wait 5h 12m", 2026-11-22); a kill task's tag sits before it.
|
||||
float statusX = Math.Max(150f, leftW - 104f);
|
||||
bool tags = false;
|
||||
for (int i = start; i < rows.Count && i < start + GuidePageSize; i++) if (rows[i].Tag.Length > 0) { tags = true; break; }
|
||||
float tagX = statusX - 40f;
|
||||
float labelEnd = tags ? tagX : statusX;
|
||||
int chars = Math.Max(16, Math.Min(GuideLabelChars, (int)((labelEnd - 14f) / 6.2f)));
|
||||
for (int i = start; i < rows.Count && i < start + GuidePageSize; i++)
|
||||
{
|
||||
GuideRow r = rows[i];
|
||||
string key = r.Key;
|
||||
w.Selectable(Cut(r.Label, chars), "g.r." + key, key == _gSel, () => _gSel = key, labelEnd - 12f);
|
||||
if (r.Label.Length > chars) w.Tooltip(r.Label);
|
||||
if (r.Tag.Length > 0)
|
||||
{
|
||||
w.SameLine(tagX);
|
||||
w.TextColored(r.TagColor, r.Tag);
|
||||
if (r.TagTip.Length > 0) w.Tooltip(r.TagTip);
|
||||
}
|
||||
if (r.Status.Length > 0)
|
||||
{
|
||||
w.SameLine(statusX);
|
||||
w.TextColored(r.Color, r.Status);
|
||||
if (r.Tip.Length > 0) w.Tooltip(r.Tip);
|
||||
}
|
||||
}
|
||||
if (rows.Count == 0)
|
||||
w.TextDisabled(_gTab is GuideTab.Wiki or GuideTab.KillTasks or GuideTab.Society or GuideTab.Contracts && _c.Wiki.Quests.Count == 0
|
||||
? "No wiki quests yet (see above)." : "Nothing matches.");
|
||||
w.EndChild();
|
||||
|
||||
w.SameLine();
|
||||
w.BeginChild("g.detail", 0f, 0f, border: true);
|
||||
GuideRow? sel = rows.Find(r => r.Key == _gSel) ?? FindGuideRow(_gSel);
|
||||
if (sel == null) w.TextDisabled("Pick a quest on the left.");
|
||||
else if (sel.W != null) DrawWikiQuest(w, sel.W);
|
||||
else if (sel.Q != null) DrawGuideCatalogQuest(w, sel.Q);
|
||||
else if (sel.Area.Length > 0) DrawStampArea(w, sel.Area);
|
||||
else if (sel.Flag != null) DrawKillFlag(w, sel.Flag);
|
||||
else if (sel.C != null) DrawContract(w, sel.C);
|
||||
w.EndChild();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Where the wiki's quests come from, one line: the AC Community Wiki (every server, 2026-11-21), or on
|
||||
/// Infinite Leaftide RynthILT's wiki once it has quests.
|
||||
/// </summary>
|
||||
private void DrawGuideSource(UiWindow w)
|
||||
{
|
||||
if (!_c.Server.IsIlt && _c.ServerGuide.Client.Available)
|
||||
{
|
||||
QuestGuideClient sg = _c.ServerGuide.Client;
|
||||
string tag = sg.Tag.Length > 0 ? sg.Tag : "Server";
|
||||
string st = sg.Running ? $"{tag} Wiki: {sg.Status}" : sg.Guide.Quests.Count > 0 ? $"{tag} Wiki: {sg.Guide.Quests.Count} quests" : $"{tag} Wiki: {sg.Status}";
|
||||
w.TextDisabled(Cut(st, 50));
|
||||
w.Tooltip($"{tag}'s own wiki quests, from the server's plugin, first in the wiki tab; then the AC Community Wiki's. " + sg.Status);
|
||||
w.SameLine();
|
||||
}
|
||||
if (!_c.Server.IsIlt || _c.Guide.Guide.Quests.Count == 0 && !_c.Guide.Running)
|
||||
{
|
||||
FandomFeed f = _c.Fandom;
|
||||
string ft = f.Running ? "AC Wiki: " + f.Status
|
||||
: f.Guide.Quests.Count > 0 ? $"AC Wiki: {f.Guide.Quests.Count} quests, {f.Guide.Contracts.Count} contracts, read {f.Guide.UpdatedUtc.ToLocalTime():MM-dd HH:mm}"
|
||||
: "AC Wiki: " + f.Status;
|
||||
w.TextDisabled(Cut(ft, 70));
|
||||
w.Tooltip("The quests, kill tasks, society quests and contracts of the AC Community Wiki (asheron.fandom.com),\n"
|
||||
+ "read by RynthOracle at login once a day, and by Refresh. " + f.Status
|
||||
+ (_c.Server.IsIlt ? "\nOn this server, RynthILT's own wiki is used once it has been read." : ""));
|
||||
if (!_c.Server.IsIlt) return;
|
||||
w.SameLine();
|
||||
}
|
||||
QuestGuideClient g = _c.Guide;
|
||||
if (!g.Available)
|
||||
{
|
||||
w.TextDisabled("Wiki quests: RynthILT isn't serving them (update RynthILT).");
|
||||
return;
|
||||
}
|
||||
string text = g.Running ? "Wiki: reading... " + g.Status
|
||||
: g.Guide.Quests.Count > 0 ? $"Wiki: {g.Guide.Quests.Count} quests, read {g.Guide.UpdatedUtc.ToLocalTime():MM-dd HH:mm}"
|
||||
: g.LoginSaved ? "Wiki: " + g.Status : "Wiki: no login yet";
|
||||
w.TextDisabled(Cut(text, 70));
|
||||
w.Tooltip(g.Status + (g.LoginSaved ? "" : "\nThe wiki needs a login: make a bot password on leaftidewiki.com (Special:BotPasswords) and type it into RynthILT's settings > Quest guide. Or import a Special:Export file there."));
|
||||
if (!g.LoginSaved && g.Guide.Quests.Count == 0)
|
||||
{
|
||||
w.SameLine();
|
||||
w.SmallButton("Wiki login...", "g.wikilogin", () => _gMsg = g.Command("settings") ? "RynthILT's settings are open: Quest guide." : "RynthILT didn't answer.");
|
||||
}
|
||||
}
|
||||
|
||||
private string GuideRefresh()
|
||||
{
|
||||
string msg = _c.RequestQuests() ? "Reading your quest flags..." : "Quest flags: not now (the server allows one /myquests a minute).";
|
||||
if (_c.Server.IsIlt && _c.Guide.Available && _c.Guide.LoginSaved && !_c.Guide.Running)
|
||||
msg += _c.Guide.Command("refresh") ? " Reading the wiki too." : "";
|
||||
if (_c.Fandom.Start()) msg += " Reading the AC Community Wiki.";
|
||||
return msg;
|
||||
}
|
||||
|
||||
// ── Rows ────────────────────────────────────────────────────────────────
|
||||
|
||||
private GuideRow? FindGuideRow(string key)
|
||||
{
|
||||
if (key.StartsWith("w:", StringComparison.Ordinal) && _c.FindWiki(key.Substring(2)) is GuideQuest q) return WikiRow(q);
|
||||
if (key.StartsWith("c:", StringComparison.Ordinal) && _c.Fandom.Guide.Contracts.Find(x => x.Title == key.Substring(2)) is GuideContract gc) return ContractRow(gc);
|
||||
if (key.StartsWith("k:", StringComparison.Ordinal) && _c.Flags.TryGet(key.Substring(2), out QuestFlag kf))
|
||||
return new GuideRow { Key = key, Label = FlagLabel(kf.Key), Flag = kf };
|
||||
if (key.StartsWith("q:", StringComparison.Ordinal) && _c.Catalog.TryGet(key.Substring(2), out Quest cq)) return CatalogRow(cq);
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<GuideRow> GuideRows()
|
||||
{
|
||||
HeldStamps();
|
||||
string key = $"{_gTab}|{_gSearch}|{_c.Settings.GuideHideCollected}|{_c.Server.IsIlt}|{_c.WikiRevision}|{_c.Catalog.Revision}|{_heldKey}|{_c.Kills.Revision}|{DynamicStampList.Revision}|{_c.UtcNow:yyyyMMddHHmm}";
|
||||
if (key == _gRowsKey) return _gRows;
|
||||
_gRowsKey = key;
|
||||
_gRows.Clear();
|
||||
string[] terms = _gSearch.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
bool hide = _c.Settings.GuideHideCollected;
|
||||
|
||||
if (_gTab == GuideTab.Stamps)
|
||||
{
|
||||
foreach (string area in DynamicStampList.Areas)
|
||||
{
|
||||
int have = 0, all = 0;
|
||||
string hay = area;
|
||||
foreach (DynamicStamp s in DynamicStampList.All)
|
||||
{
|
||||
if (s.Area != area) continue;
|
||||
all++;
|
||||
if (s.Have(_c.Flags, _c.Ilt.QbStampSet)) have++;
|
||||
hay += " " + s.Npc + " " + s.Place + " " + s.Reward;
|
||||
}
|
||||
if (all == 0 || !MatchesAll(hay, terms)) continue;
|
||||
bool done = have == all;
|
||||
if (hide && done) continue;
|
||||
_gRows.Add(new GuideRow
|
||||
{
|
||||
Key = "a:" + area, Label = area, Area = area, Done = done,
|
||||
Status = done ? "Completed" : $"{have} / {all}", Color = done ? UiColors.Green : have > 0 ? UiColors.Yellow : UiColors.Grey,
|
||||
});
|
||||
}
|
||||
return _gRows;
|
||||
}
|
||||
|
||||
if (_gTab == GuideTab.KillTasks)
|
||||
{
|
||||
KillTaskRows(terms, hide);
|
||||
return _gRows;
|
||||
}
|
||||
if (_gTab == GuideTab.Society)
|
||||
{
|
||||
SocietyRows(terms, hide);
|
||||
return _gRows;
|
||||
}
|
||||
if (_gTab == GuideTab.Contracts)
|
||||
{
|
||||
ContractRows(terms, hide);
|
||||
return _gRows;
|
||||
}
|
||||
|
||||
var wikiNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (GuideQuest q in _c.Wiki.Quests)
|
||||
{
|
||||
wikiNames.Add(q.Title);
|
||||
if (!WikiInTab(q, _gTab)) continue;
|
||||
if (!MatchesAll(WikiHay(q), terms)) continue;
|
||||
GuideRow r = WikiRow(q);
|
||||
if (hide && r.Done) continue;
|
||||
_gRows.Add(r);
|
||||
}
|
||||
|
||||
if (_gTab is GuideTab.All or GuideTab.Story or GuideTab.Dailies or GuideTab.Weekly)
|
||||
foreach (Quest q in _c.Catalog.Quests)
|
||||
{
|
||||
if (q.IsNew || wikiNames.Contains(q.DisplayName)) continue;
|
||||
long rep = CatalogRepeatSec(q);
|
||||
bool inTab = _gTab switch
|
||||
{
|
||||
GuideTab.Story => rep == 0,
|
||||
GuideTab.Dailies => rep > 0 && rep <= 26 * 3600,
|
||||
GuideTab.Weekly => rep > 26 * 3600 && rep <= 31L * 86400,
|
||||
_ => true,
|
||||
};
|
||||
if (!inTab || !MatchesAll(q.Flag + " " + q.DisplayName, terms)) continue;
|
||||
GuideRow r = CatalogRow(q);
|
||||
if (hide && r.Done) continue;
|
||||
_gRows.Add(r);
|
||||
}
|
||||
|
||||
// The wiki's quests first (they have steps), then the quest list's; each by name.
|
||||
_gRows.Sort((a, b) => (a.W == null).CompareTo(b.W == null) is int k && k != 0 ? k
|
||||
: string.Compare(a.Label, b.Label, StringComparison.OrdinalIgnoreCase));
|
||||
return _gRows;
|
||||
}
|
||||
|
||||
private static bool WikiInTab(GuideQuest q, GuideTab tab) => tab switch
|
||||
{
|
||||
GuideTab.Story => q.IsOneTime,
|
||||
GuideTab.Dailies => q.IsDaily,
|
||||
GuideTab.Weekly => q.IsWeekly,
|
||||
GuideTab.Qb => q.Qb > 0,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
private static string WikiHay(GuideQuest q) =>
|
||||
$"{q.Title} {q.StartsWith} {q.StartsAt} {q.Type} {string.Join(" ", q.Loot)} {string.Join(" ", q.AllStamps())} {string.Join(" ", q.Categories)}";
|
||||
|
||||
/// <summary>A catalog quest's repeat timer: the server's (its flag's), else the list's; 0 one-time.</summary>
|
||||
private long CatalogRepeatSec(Quest q)
|
||||
{
|
||||
if (_c.Flags.TryGet(q.Flag, out QuestFlag f) && f.RepeatTime > TimeSpan.Zero) return (long)f.RepeatTime.TotalSeconds;
|
||||
if (q.MinDelta > 0) return q.MinDelta;
|
||||
return q.IsRepeatable(_c.Flags) ? 86400 : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A wiki quest's row in the four states (2026-11-22): Done (every stamp held), partly done with the redo timer
|
||||
/// running, partly done with the timer up, Not done. Held = in /myquests (any run), the /qb list, or stamped this
|
||||
/// session. A page with no stamps (the AC Community Wiki's) takes the quest list's flag of the same name: Done or
|
||||
/// Not done. <see cref="GuideRow.Done"/> (Hide collected) is Done with nothing to do now: one-time, or its timer
|
||||
/// running.
|
||||
/// </summary>
|
||||
private GuideRow WikiRow(GuideQuest q)
|
||||
{
|
||||
int held = 0, now = 0, all = 0;
|
||||
foreach (string st in q.AllStamps())
|
||||
{
|
||||
all++;
|
||||
StampState ss = StateOf(q, st);
|
||||
if (ss != StampState.Missing) held++;
|
||||
if (ss == StampState.Done) now++;
|
||||
}
|
||||
var r = new GuideRow { Key = "w:" + q.Title, Label = q.Title, W = q };
|
||||
if (all == 0)
|
||||
{
|
||||
if (CatalogByName(q.Title) is Quest cq)
|
||||
{
|
||||
GuideRow cr = CatalogRow(cq);
|
||||
r.Done = cr.Done;
|
||||
r.State = cr.State;
|
||||
r.Status = cr.Status;
|
||||
r.Color = cr.Color;
|
||||
r.Tip = cr.Tip;
|
||||
return r;
|
||||
}
|
||||
r.Status = "no stamps";
|
||||
r.Tip = "The wiki lists no stamps for this quest, and the quest list has no flag of its name: its state isn't known.";
|
||||
r.Color = UiColors.Grey;
|
||||
return r;
|
||||
}
|
||||
TimeSpan wait = HeldWait(q);
|
||||
bool repeats = q.RepeatSec != 0 || wait > TimeSpan.Zero;
|
||||
GuideProgressState state = GuideProgress.Of(held, all, wait);
|
||||
r.State = state;
|
||||
(r.Status, r.Tip) = GuideProgress.Text(state, held, all, wait, repeats);
|
||||
r.Color = ProgressColor(state);
|
||||
// Hide collected: done, with nothing to do now (one-time, its timer running, or every stamp counting this run).
|
||||
r.Done = state == GuideProgressState.Done && (!repeats || wait > TimeSpan.Zero || now == all);
|
||||
return r;
|
||||
}
|
||||
|
||||
/// <summary>The four states' colours: Done green, partly done waiting yellow, partly done ready gold, not done grey.</summary>
|
||||
internal static uint ProgressColor(GuideProgressState s) => s switch
|
||||
{
|
||||
GuideProgressState.Done => UiColors.Green,
|
||||
GuideProgressState.PartialWaiting => UiColors.Yellow,
|
||||
GuideProgressState.PartialReady => UiColors.Gold,
|
||||
_ => UiColors.Grey,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The redo timer on the stamps held: the longest wait left on any of them (the flag's own timer, else the quest's
|
||||
/// repeat time since the flag was stamped); zero when every timer is up or none runs.
|
||||
/// </summary>
|
||||
private TimeSpan HeldWait(GuideQuest q)
|
||||
{
|
||||
TimeSpan wait = TimeSpan.Zero;
|
||||
foreach (string st in q.AllStamps())
|
||||
{
|
||||
if (StampFlag(st) is not QuestFlag f) continue;
|
||||
TimeSpan left = TimeSpan.Zero;
|
||||
if (f.RepeatTime > TimeSpan.Zero) left = f.NextAvailableTime(_c.UtcNow);
|
||||
else if (q.RepeatSec > 0 && f.CompletedOnUtc != DateTime.MinValue) left = f.CompletedOnUtc.AddSeconds(q.RepeatSec) - _c.UtcNow;
|
||||
if (left > wait) wait = left;
|
||||
}
|
||||
return wait;
|
||||
}
|
||||
|
||||
/// <summary>How long until the quest's stamps can be had again (the longest wait on any of them), zero when ready.</summary>
|
||||
private TimeSpan WikiWait(GuideQuest q)
|
||||
{
|
||||
TimeSpan wait = TimeSpan.Zero;
|
||||
foreach (string st in q.AllStamps())
|
||||
if (StampFlag(st) is QuestFlag f && f.RepeatTime > TimeSpan.Zero)
|
||||
{
|
||||
TimeSpan left = f.NextAvailableTime(_c.UtcNow);
|
||||
if (left > wait) wait = left;
|
||||
}
|
||||
return wait;
|
||||
}
|
||||
|
||||
private Dictionary<string, Quest> _catalogByName = new(StringComparer.OrdinalIgnoreCase);
|
||||
private int _catalogByNameRev = -1;
|
||||
|
||||
/// <summary>The quest list's quest with this name (its display name), or null.</summary>
|
||||
private Quest? CatalogByName(string name)
|
||||
{
|
||||
if (_catalogByNameRev != _c.Catalog.Revision)
|
||||
{
|
||||
var map = new Dictionary<string, Quest>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (Quest q in _c.Catalog.Quests)
|
||||
if (!q.IsNew && q.DisplayName.Length > 0) map.TryAdd(q.DisplayName, q);
|
||||
_catalogByName = map;
|
||||
_catalogByNameRev = _c.Catalog.Revision;
|
||||
}
|
||||
return _catalogByName.TryGetValue(name, out Quest? found) ? found : null;
|
||||
}
|
||||
|
||||
private GuideRow CatalogRow(Quest q)
|
||||
{
|
||||
// One flag, so Done or Not done (no partial states, 2026-11-22).
|
||||
bool done = q.IsComplete(_c.Flags);
|
||||
var r = new GuideRow { Key = "q:" + q.Flag, Label = q.DisplayName, Q = q };
|
||||
TimeSpan left = TimeSpan.Zero;
|
||||
bool repeats = false;
|
||||
if (done && _c.Flags.TryGet(q.Flag, out QuestFlag f) && f.RepeatTime > TimeSpan.Zero)
|
||||
{
|
||||
repeats = true;
|
||||
left = f.NextAvailableTime(_c.UtcNow);
|
||||
}
|
||||
GuideProgressState state = done ? GuideProgressState.Done : GuideProgressState.NotDone;
|
||||
r.State = state;
|
||||
(r.Status, r.Tip) = GuideProgress.Text(state, done ? 1 : 0, 0, left, repeats);
|
||||
if (state == GuideProgressState.Done)
|
||||
r.Tip = left > TimeSpan.Zero ? $"Fully done: its flag is held. It can be done again in {GuideProgress.Short(left)}."
|
||||
: repeats ? "Fully done: its flag is held. Its timer is up: it can be done again now." : "Fully done: its flag is held.";
|
||||
else r.Tip = "Not done: its flag isn't held yet.";
|
||||
r.Color = ProgressColor(state);
|
||||
r.Done = done && (!repeats || left > TimeSpan.Zero);
|
||||
return r;
|
||||
}
|
||||
|
||||
/// <summary>"3d 4h", "5h 12m", "9m".</summary>
|
||||
internal static string Short(TimeSpan t)
|
||||
{
|
||||
if (t.TotalDays >= 1) return $"{(int)t.TotalDays}d {t.Hours}h";
|
||||
if (t.TotalHours >= 1) return $"{(int)t.TotalHours}h {t.Minutes:00}m";
|
||||
return $"{Math.Max(1, (int)Math.Ceiling(t.TotalMinutes))}m";
|
||||
}
|
||||
|
||||
/// <summary>"Daily (every 20h 00m)", "Weekly (every 7d 0h)", "One-time", or the wiki's own words.</summary>
|
||||
internal static string RepeatText(GuideQuest q)
|
||||
{
|
||||
if (q.RepeatSec == 0) return q.Repeat.Length > 0 ? "One-time (" + q.Repeat + ")" : "One-time";
|
||||
if (q.RepeatSec < 0) return "Repeats: " + q.Repeat;
|
||||
string every = Short(TimeSpan.FromSeconds(q.RepeatSec));
|
||||
return q.IsDaily ? $"Daily (every {every})" : q.IsWeekly ? $"Weekly (every {every})" : $"Repeats every {every}";
|
||||
}
|
||||
|
||||
// ── The opened wiki quest ───────────────────────────────────────────────
|
||||
|
||||
private void DrawWikiQuest(UiWindow w, GuideQuest q)
|
||||
{
|
||||
QuestRunner? run = _c.Runner;
|
||||
bool runningThis = run?.Quest?.Title == q.Title;
|
||||
w.TextColored(UiColors.Gold, q.Title);
|
||||
TimeSpan wait = WikiWait(q);
|
||||
w.TextDisabled(RepeatText(q) + (wait > TimeSpan.Zero ? " - again in " + Short(wait) : ""));
|
||||
// Where it stands, in the four states (the list's status, said in full; 2026-11-22).
|
||||
GuideRow state = WikiRow(q);
|
||||
if (state.Tip.Length > 0) w.TextColored(state.Color, state.Tip);
|
||||
var facts = new List<string>();
|
||||
if (q.Level.Length > 0) facts.Add("Level " + q.Level);
|
||||
if (q.RecommendedLevel.Length > 0) facts.Add("rec. " + q.RecommendedLevel);
|
||||
if (q.Type.Length > 0) facts.Add(q.Type);
|
||||
if (q.Qb > 0) facts.Add("QB " + q.Qb.ToString(CultureInfo.InvariantCulture));
|
||||
if (q.TimeToComplete.Length > 0) facts.Add(q.TimeToComplete);
|
||||
if (facts.Count > 0) w.TextDisabled(string.Join(" | ", facts));
|
||||
if (_c.Wiki.IsKillTask(q) || _c.Fandom.Guide.IsKillTask(q)) DrawKillLine(w, q);
|
||||
|
||||
// Run this quest / its controls.
|
||||
if (!runningThis)
|
||||
{
|
||||
w.Button("Run this quest", "g.run", () =>
|
||||
{
|
||||
_c.Runner?.Start(q, st => StateOf(q, st) == StampState.Done, loot: true, society: Standing());
|
||||
_gMsg = "";
|
||||
});
|
||||
w.Tooltip("RynthNav walks to each step you haven't been stamped for, in order; the step's instructions go to chat\n"
|
||||
+ "when you get there. A stamp moves it on (or Next). RynthAi picks up the quest's items meanwhile,\n"
|
||||
+ "with the quest's own loot profile (base-quest-dynamic and its items) until the run ends.\n"
|
||||
+ "A step without coordinates goes to the people and places it names; there, RynthAi talks to\n"
|
||||
+ "the person, or hands them the quest's items on a hand-in (\"Return the collar to Xsao\").\n"
|
||||
+ "Society quests use your Celestial Hand / Eldrytch Web / Radiant Blood membership for NPCs and portals.");
|
||||
if (q.Loot.Count > 0)
|
||||
{
|
||||
w.SameLine();
|
||||
w.Button($"Loot map ({q.Loot.Count})", "g.loot", () =>
|
||||
{
|
||||
int n = _c.Runner?.AddLoot(q) ?? 0;
|
||||
_gMsg = n > 0 ? $"RynthAi picks up {n} quest item(s) this session: {string.Join(", ", q.Loot)} (/ra questloot list)."
|
||||
: "RynthAi has them already, or isn't loaded.";
|
||||
});
|
||||
w.Tooltip("Have RynthAi pick up this quest's items (by name) on top of its loot profile, this session:\n" + string.Join("\n", q.Loot));
|
||||
w.SameLine();
|
||||
w.Button("Loot profile", "g.lootprofile", () =>
|
||||
{
|
||||
bool ok = _c.Runner?.BuildProfile(q) ?? false;
|
||||
_gMsg = ok ? $"RynthAi wrote LootProfiles\\Quests\\{q.Title}.utl: base-quest-dynamic and this quest's {q.Loot.Count} item(s). Run this quest uses it."
|
||||
: "RynthAi isn't loaded: it writes the loot profile.";
|
||||
});
|
||||
w.Tooltip("Write this quest's loot profile: your base-quest-dynamic.utl with a Keep rule per quest item in front\n"
|
||||
+ "(LootProfiles\\Quests). Run this quest switches to it while it runs, then back. /ro lootprofiles writes every quest's.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
w.Button("Stop", "g.stop", () => _c.Runner?.Stop());
|
||||
w.SameLine();
|
||||
w.Button("Next", "g.next", () => _c.Runner?.Next());
|
||||
w.Tooltip("This step is done (or skip it): on to the next place or step.");
|
||||
w.SameLine();
|
||||
w.Button("Back", "g.back", () => _c.Runner?.Back());
|
||||
w.SameLine();
|
||||
w.Button("Again", "g.again", () => _c.Runner?.Again());
|
||||
w.Tooltip("Ask RynthNav to go to this step's place again.");
|
||||
if (run!.Note.Length > 0) w.TextColored(UiColors.Yellow, run.Note);
|
||||
}
|
||||
w.SameLine();
|
||||
w.SmallButton("Wiki page", "g.url", () => _c.Print(q.Url));
|
||||
w.Tooltip("Prints the wiki page's address in chat.");
|
||||
DrawHandIn(w, q, "g.w", t => _gMsg = t);
|
||||
|
||||
if (q.StartsWith.Length > 0 || q.StartsAt.Length > 0)
|
||||
{
|
||||
w.Text("Starts" + (q.StartsWith.Length > 0 ? " with " + q.StartsWith : "") + (q.StartsAt.Length > 0 ? " at " + q.StartsAt : ""));
|
||||
if (q.StartsAt.Length > 0)
|
||||
{
|
||||
w.SameLine();
|
||||
string place = q.StartsAt;
|
||||
w.SmallButton("Go", "g.start.go", () => _gMsg = SendRynthNav("go", new[] { place }));
|
||||
w.Tooltip("RynthNav goes to " + place + " (a place on its Atlas).");
|
||||
}
|
||||
}
|
||||
if (q.KillTask.Length > 0) w.TextDisabled("Kill task: " + q.KillTask);
|
||||
if (q.Overview.Length > 0) w.TextWrapped(q.Overview);
|
||||
|
||||
DrawWikiProgress(w, q);
|
||||
var (stepDone, implied, next) = StepStates(q);
|
||||
w.SeparatorText(q.Steps.Count > 0 ? "Steps" : "Steps (the page has no walkthrough)");
|
||||
for (int i = 0; i < q.Steps.Count; i++) DrawWikiStep(w, q, i, runningThis ? run!.Step : -1, stepDone[i], implied[i], i == next);
|
||||
if (q.ExtraStamps.Count > 0)
|
||||
{
|
||||
w.TextDisabled("Also stamps (the wiki doesn't say which step):");
|
||||
foreach (string st in q.ExtraStamps) StampLine(w, q, st);
|
||||
}
|
||||
if (q.Loot.Count > 0)
|
||||
{
|
||||
w.SeparatorText("Loot");
|
||||
w.TextWrapped(string.Join(", ", q.Loot));
|
||||
}
|
||||
if (q.Rewards.Count > 0 && w.CollapsingHeader("Rewards", "g.rewards"))
|
||||
foreach (string r in q.Rewards)
|
||||
if (r.EndsWith(':')) w.Text(r); else w.BulletText(r);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the quest stands at, above the steps: how many stamps count now, and each one still to get with
|
||||
/// its step, so nothing missing has to be hunted for in the list (2026-11-01).
|
||||
/// </summary>
|
||||
private void DrawWikiProgress(UiWindow w, GuideQuest q)
|
||||
{
|
||||
var missing = new List<string>();
|
||||
int all = 0, done = 0, earlier = 0;
|
||||
var stepOf = new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
for (int i = 0; i < q.Steps.Count; i++)
|
||||
foreach (string st in q.Steps[i].Stamps) stepOf.TryAdd(GuideStamp.Key(st), i + 1);
|
||||
foreach (string st in q.AllStamps())
|
||||
{
|
||||
all++;
|
||||
StampState state = StateOf(q, st);
|
||||
if (state == StampState.Done) { done++; continue; }
|
||||
if (state == StampState.Earlier) earlier++;
|
||||
string where = stepOf.TryGetValue(GuideStamp.Key(st), out int n) ? $"step {n}" : "no step";
|
||||
missing.Add($"{st} ({where}{(state == StampState.Earlier ? ", done before: ready again" : "")})");
|
||||
}
|
||||
if (all == 0)
|
||||
{
|
||||
w.TextDisabled("The wiki lists no stamps for this quest, so its progress can't be read: the steps are only a guide.");
|
||||
return;
|
||||
}
|
||||
if (missing.Count == 0)
|
||||
{
|
||||
w.TextColored(UiColors.Green, $"All {all} stamps done{(q.RepeatSec != 0 ? " this run" : "")}.");
|
||||
return;
|
||||
}
|
||||
w.TextColored(done > 0 ? UiColors.Yellow : UiColors.Grey, $"{done} of {all} stamps done{(q.RepeatSec != 0 ? " this run" : "")}. Still to get:");
|
||||
foreach (string m in missing) w.TextColored(m.Contains("ready again", StringComparison.Ordinal) ? UiColors.Yellow : UiColors.Red, " - " + m);
|
||||
if (earlier > 0 && done == 0)
|
||||
w.TextDisabled(" (A repeatable quest: the stamps from your last run don't count once its timer is up.)");
|
||||
}
|
||||
|
||||
private void DrawWikiStep(UiWindow w, GuideQuest q, int i, int current, bool done, bool implied, bool isNext)
|
||||
{
|
||||
GuideStep s = q.Steps[i];
|
||||
// [x] done, [~] done by the steps after it (no stamp of its own), [>] the next one to do, [ ] still to do.
|
||||
string mark = done ? "[x]" : implied ? "[~]" : isNext ? "[>]" : "[ ]";
|
||||
uint color = i == current || (isNext && current < 0) ? UiColors.Yellow : done ? UiColors.Green : implied ? UiColors.Grey : 0;
|
||||
if (color != 0) w.PushStyleColor(ColText, color);
|
||||
w.TextWrapped($"{mark} {i + 1}. {s.Text}");
|
||||
if (color != 0) w.PopStyleColor();
|
||||
if (implied) w.Tooltip("No stamp of its own; a step after it is done, so the quest went past it.");
|
||||
else if (isNext) w.Tooltip("The next step to do.");
|
||||
for (int k = 0; k < s.Coords.Count; k++)
|
||||
{
|
||||
string c = s.Coords[k];
|
||||
if (k > 0) w.SameLine();
|
||||
w.SmallButton("Go " + c, $"g.s{i}.c{k}", () => _gMsg = SendRynthNav("go", new[] { c }));
|
||||
w.Tooltip("RynthNav plans the way to " + c + " and walks it.");
|
||||
}
|
||||
// A quest of several steps: any step can be the one to do (2026-11-08), not only by Next and Back.
|
||||
if (q.Steps.Count > 1 && i != current)
|
||||
{
|
||||
if (s.Coords.Count > 0) w.SameLine();
|
||||
int step = i;
|
||||
bool running = _c.Runner?.Quest?.Title == q.Title;
|
||||
w.SmallButton(running ? $"Do step {i + 1}" : $"Run from step {i + 1}", $"g.s{i}.from", () =>
|
||||
{
|
||||
if (_c.Runner == null) return;
|
||||
if (_c.Runner.Quest?.Title == q.Title) _c.Runner.GoTo(step);
|
||||
else _c.Runner.Start(q, st => StateOf(q, st) == StampState.Done, loot: true, fromStep: step, society: Standing());
|
||||
});
|
||||
w.Tooltip(running ? "The run goes to this step now (done or not): RynthNav goes to its place, RynthAi does its part there."
|
||||
: "Run this quest starting at this step (its loot list and loot profile as usual).");
|
||||
}
|
||||
foreach (string n in s.Notes)
|
||||
{
|
||||
w.PushStyleColor(ColText, UiColors.Grey);
|
||||
w.TextWrapped(" " + n);
|
||||
w.PopStyleColor();
|
||||
}
|
||||
foreach (string st in s.Stamps) StampLine(w, q, st);
|
||||
}
|
||||
|
||||
private void StampLine(UiWindow w, GuideQuest q, string stamp)
|
||||
{
|
||||
switch (StateOf(q, stamp))
|
||||
{
|
||||
case StampState.Done:
|
||||
w.TextColored(UiColors.Green, " [x] You've stamped " + stamp + "!");
|
||||
break;
|
||||
case StampState.Earlier:
|
||||
w.TextColored(UiColors.Yellow, " [ ] " + stamp + " - done on an earlier run; ready again");
|
||||
break;
|
||||
default:
|
||||
w.TextColored(UiColors.Red, " [ ] " + stamp + " - not stamped yet");
|
||||
break;
|
||||
}
|
||||
w.Tooltip(StampWhy(q, stamp));
|
||||
}
|
||||
|
||||
/// <summary>Why a stamp reads the way it does: the flag it matched and its times, or that none did.</summary>
|
||||
private string StampWhy(GuideQuest q, string stamp)
|
||||
{
|
||||
if (_c.SessionStamps.Contains(GuideStamp.Key(stamp))) return "Stamped this session (\"You've stamped " + stamp + "!\").";
|
||||
if (StampFlag(stamp) is QuestFlag f)
|
||||
{
|
||||
string when = f.CompletedOnUtc == DateTime.MinValue ? "" : $", last {f.CompletedOnUtc.ToLocalTime():yyyy-MM-dd HH:mm}";
|
||||
string timer = f.RepeatTime > TimeSpan.Zero
|
||||
? (f.NextAvailableTime(_c.UtcNow) > TimeSpan.Zero ? $"; again in {Short(f.NextAvailableTime(_c.UtcNow))}" : "; its timer is up")
|
||||
: "";
|
||||
return $"Your quest flag '{f.Key}': {f.Solves} solve(s){when}{timer}.";
|
||||
}
|
||||
if (StampHeld(stamp)) return "In your /qb list (the server's quest bonus list): stamped at some time.";
|
||||
return _c.Flags.LastReadUtc == DateTime.MinValue
|
||||
? "Your quest flags haven't been read yet (Refresh)."
|
||||
: $"No quest flag named like '{stamp}' in your /myquests ({_c.Flags.Flags.Count} flags, read {_c.Flags.LastReadUtc.ToLocalTime():HH:mm}).";
|
||||
}
|
||||
|
||||
// ── The opened master-list quest ────────────────────────────────────────
|
||||
|
||||
private void DrawGuideCatalogQuest(UiWindow w, Quest q)
|
||||
{
|
||||
w.TextColored(UiColors.Gold, q.DisplayName);
|
||||
w.TextDisabled(q.Flag + (q.Server.Length > 0 ? " (" + q.Server + ")" : ""));
|
||||
string status = q.Status(_c.Flags, _c.UtcNow);
|
||||
if (status.Length > 0) w.Text(status);
|
||||
long rep = CatalogRepeatSec(q);
|
||||
w.TextDisabled(rep == 0 ? "One-time" : "Repeats every " + Short(TimeSpan.FromSeconds(rep)));
|
||||
bool tracked = _c.Book.IsTracked(q.Flag);
|
||||
string flag = q.Flag;
|
||||
w.Button(tracked ? "Untrack" : "Track", "g.q.track", () => { if (_c.Book.Loaded) _c.Book.ToggleTracked(flag); });
|
||||
w.Tooltip("List it in the Quest Timers window.");
|
||||
w.SameLine();
|
||||
w.SmallButton("Details in chat", "g.q.print", () => _c.PrintQuest(q));
|
||||
if (q.Info.Length > 0) w.TextWrapped(q.Info);
|
||||
if (q.Hint.Length > 0) w.TextWrapped(q.Hint);
|
||||
List<NavTargets.Stop> stops = NavTargets.Stops(q.Info + " - " + q.Hint);
|
||||
if (stops.Count > 0)
|
||||
{
|
||||
w.SeparatorText("Places");
|
||||
for (int i = 0; i < stops.Count; i++)
|
||||
{
|
||||
NavTargets.Stop st = stops[i];
|
||||
w.SmallButton("Go", "g.q.go." + i, () => _gMsg = SendRynthNav("go", new[] { st.Target }));
|
||||
w.SameLine();
|
||||
w.Text(Cut(st.Display, 70));
|
||||
}
|
||||
}
|
||||
if (q.Url.Length > 0) w.SmallButton("Wiki page", "g.q.url", () => _c.Print(q.Url));
|
||||
DrawHandIn(w, GuideFor(q.Flag, q.Name), "g.q", t => _gMsg = t);
|
||||
}
|
||||
|
||||
// ── The opened Dynamic Stamps area ──────────────────────────────────────
|
||||
|
||||
private void DrawStampArea(UiWindow w, string area)
|
||||
{
|
||||
w.TextColored(UiColors.Gold, "Dynamic Stamps: " + area);
|
||||
int i = 0;
|
||||
bool hide = _c.Settings.GuideHideCollected;
|
||||
foreach (DynamicStamp s in DynamicStampList.All)
|
||||
{
|
||||
if (s.Area != area) continue;
|
||||
bool have = s.Have(_c.Flags, _c.Ilt.QbStampSet);
|
||||
int n = i++;
|
||||
if (hide && have) continue;
|
||||
w.TextColored(have ? UiColors.Green : UiColors.Grey, have ? "[x]" : "[ ]");
|
||||
w.SameLine();
|
||||
w.Text(Cut(s.Label + (s.Place.Length > 0 && s.Place != s.Label ? " - " + s.Place : ""), 70));
|
||||
string tip = s.Stamp + (s.Reward.Length > 0 ? "\nReward: " + s.Reward : "") + (s.Note.Length > 0 ? "\n" + s.Note : "");
|
||||
w.Tooltip(tip);
|
||||
List<string> nav = s.NavCandidates();
|
||||
if (nav.Count > 0)
|
||||
{
|
||||
w.SameLine();
|
||||
DynamicStamp stamp = s;
|
||||
// The same Go and hand in as the flag list's Dynamic Stamps (the Parchment, bought when none is carried).
|
||||
w.SmallButton(s.Npc.Length > 0 ? "Go and hand in" : "Go", "g.a.go." + n, () =>
|
||||
{
|
||||
StartDynAuto(stamp);
|
||||
_gMsg = _dynNavStatus;
|
||||
});
|
||||
if (s.Npc.Length > 0) w.Tooltip($"RynthNav goes to {s.Npc}; a Parchment from your packs is handed over there (bought from a vendor when you carry none).");
|
||||
}
|
||||
}
|
||||
// Go and hand in's progress (the buy, the walk, the give), as the flag list's stamp box shows it.
|
||||
if (_dynAuto != null && _dynAuto.Area == area && _dynNavStatus.Length > 0) w.TextColored(UiColors.Yellow, _dynNavStatus);
|
||||
}
|
||||
}
|
||||
90
Plugins/RynthCore.Plugin.RynthOracle/Views/QuestHandIn.cs
Normal file
90
Plugins/RynthCore.Plugin.RynthOracle/Views/QuestHandIn.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
// One hand-in for every view under Quests (2026-11-11, Silentkelpie: "make sure all tabs under quests support the
|
||||
// same function to hand the quest item in after quest completion step"). The wiki guide's quests (All, Story,
|
||||
// Dailies, Weekly, QB, ILT Wiki), the master list's quests in the guide and the flag list, and the Legendary
|
||||
// rows all get "Go and hand in": the quest run from its hand-in step (RynthNav to the person, then RynthAi's
|
||||
// "questloot handin" of the quest's items there, through the give queue), and "Hand in here" when you're
|
||||
// standing by them. A quest whose wiki page has no hand-in step but whose rewards are for handing something in
|
||||
// ("For Hand in Female Tusker Tusk:") hands it to the person it starts with. The Dynamic Stamps (the flag list
|
||||
// and the guide's Stamps tab) use Go and hand in's Parchment (DynamicStampsTab.cs); the Temple guardians,
|
||||
// RynthILT's hand-in; the markers have nothing to hand in.
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
/// <summary>The wiki quest a master-list quest or a Legendary row is: one of its stamps is the flag, or the same title.</summary>
|
||||
private GuideQuest? GuideFor(string flag, params string[] titles)
|
||||
{
|
||||
List<GuideQuest> quests = _c.Wiki.Quests;
|
||||
if (quests.Count == 0) return null;
|
||||
string key = flag.Length > 0 ? GuideStamp.Key(flag) : "";
|
||||
if (key.Length > 0)
|
||||
foreach (GuideQuest q in quests)
|
||||
foreach (string st in q.AllStamps())
|
||||
if (GuideStamp.Key(st) == key) return q;
|
||||
foreach (string t in titles)
|
||||
if (t.Length > 0 && _c.FindWiki(t) is GuideQuest byTitle) return byTitle;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What hands the quest in: the quest itself and its last hand-in step, or a one-step quest made from its
|
||||
/// rewards' items and the person it starts with. Null when neither is known. Internal for the tests.
|
||||
/// </summary>
|
||||
internal static (GuideQuest Quest, int Step)? HandInOf(GuideQuest q)
|
||||
{
|
||||
for (int i = q.Steps.Count - 1; i >= 0; i--)
|
||||
if (QuestNames.IsHandIn(q.Steps[i])) return (q, i);
|
||||
List<string> items = QuestNames.RewardItems(q);
|
||||
foreach (string it in q.Loot)
|
||||
if (!items.Exists(x => x.Equals(it, StringComparison.OrdinalIgnoreCase))) items.Add(it);
|
||||
string who = q.StartsWith.Trim();
|
||||
if (items.Count == 0 || who.Length == 0) return null;
|
||||
var hand = new GuideQuest { Title = q.Title, Url = q.Url, StartsWith = q.StartsWith, StartsAt = q.StartsAt };
|
||||
hand.Loot.AddRange(items);
|
||||
hand.Steps.Add(new GuideStep { Text = $"Return to {who} and hand in the {string.Join(", ", items)}." });
|
||||
return (hand, 0);
|
||||
}
|
||||
|
||||
/// <summary>"Go and hand in" and "Hand in here" for <paramref name="q"/> (nothing known: says so). <paramref name="id"/> keeps the ids apart.</summary>
|
||||
private void DrawHandIn(UiWindow w, GuideQuest? q, string id, Action<string> say)
|
||||
{
|
||||
if (q == null)
|
||||
{
|
||||
w.TextDisabled("Hand-in: no wiki guide for this quest, so who takes the items isn't known.");
|
||||
return;
|
||||
}
|
||||
if (HandInOf(q) is not { } h)
|
||||
{
|
||||
w.TextDisabled("Hand-in: the wiki's steps don't hand anything in.");
|
||||
return;
|
||||
}
|
||||
List<string> who = QuestNames.TargetsAt(h.Quest, h.Step);
|
||||
List<string> items = QuestNames.HandInItems(h.Quest, h.Step);
|
||||
string whoText = who.Count > 0 ? string.Join(" or ", who) : "the person of the step before";
|
||||
string itemText = items.Count > 0 ? string.Join(", ", items) : "the quest's items";
|
||||
QuestRunner? run = _c.Runner;
|
||||
bool runningThis = run?.Quest is GuideQuest rq && rq.Title == h.Quest.Title && rq.Steps.Count == h.Quest.Steps.Count;
|
||||
w.Button("Go and hand in", id + ".handin.go", () =>
|
||||
{
|
||||
if (_c.Runner == null) { say("The quest run isn't ready."); return; }
|
||||
if (!_c.InWorld) { say("Log in first."); return; }
|
||||
if (runningThis) _c.Runner.GoTo(h.Step);
|
||||
else _c.Runner.Start(h.Quest, st => StateOf(h.Quest, st) == StampState.Done, loot: false, fromStep: h.Step, society: Standing());
|
||||
say($"Handing {itemText} to {whoText}: RynthNav goes there, RynthAi gives them over (step {h.Step + 1}).");
|
||||
});
|
||||
w.Tooltip($"Step {h.Step + 1}: {h.Quest.Steps[h.Step].Text}\nRynthNav goes to {whoText} (outdoors, a dungeon or the Bur), then RynthAi hands over:\n{itemText}");
|
||||
w.SameLine();
|
||||
w.Button("Hand in here", id + ".handin.here", () =>
|
||||
{
|
||||
if (who.Count == 0) { say("The step doesn't name who takes them: use Go and hand in."); return; }
|
||||
string line = "handin " + string.Join(" || ", who) + (items.Count > 0 ? " | " + string.Join(" | ", items.ConvertAll(i => i.Replace('|', '/'))) : "");
|
||||
say(_c.SendAi("questloot", line) ? $"RynthAi hands {itemText} to {whoText} near you." : "RynthAi isn't loaded (it does the give).");
|
||||
});
|
||||
w.Tooltip($"You're standing by them: RynthAi gives {itemText} to {whoText} (within 60 m).");
|
||||
}
|
||||
}
|
||||
98
Plugins/RynthCore.Plugin.RynthOracle/Views/QuestOfferView.cs
Normal file
98
Plugins/RynthCore.Plugin.RynthOracle/Views/QuestOfferView.cs
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
// The quest offer (2026-11-08): an NPC who starts quests in the wiki guide talks to the character, and a small
|
||||
// window asks whether to run one (QuestOffers). Not for a quest being run, a one-time quest already done, one
|
||||
// still on its timer, or one turned down this session ("Not now"); the same NPC is asked about once in
|
||||
// OfferRepeatMs.
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private const long OfferRepeatMs = 10 * 60 * 1000;
|
||||
private readonly Dictionary<string, long> _offeredAt = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly HashSet<string> _offerDeclined = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly List<GuideQuest> _offer = new();
|
||||
private string _offerNpc = "", _offerText = "";
|
||||
|
||||
/// <summary>Asks the plugin to show or hide the offer window, and to open the main window.</summary>
|
||||
public Action<bool>? SetOfferWindow;
|
||||
public Action? ShowMainWindow;
|
||||
|
||||
/// <summary>
|
||||
/// An NPC's line: when it starts quests the character can do now, they are offered (true: show the window).
|
||||
/// </summary>
|
||||
internal bool OfferFor(string npc, string text, long now)
|
||||
{
|
||||
if (_offeredAt.TryGetValue(npc, out long at) && now - at < OfferRepeatMs) return false;
|
||||
var list = new List<GuideQuest>();
|
||||
foreach (GuideQuest q in QuestOffers.StartedBy(_c.Wiki.Quests, npc, text))
|
||||
{
|
||||
if (_c.Runner?.Quest?.Title == q.Title || _offerDeclined.Contains(q.Title)) continue;
|
||||
if (WikiWait(q) > TimeSpan.Zero) continue; // on its timer
|
||||
var stamps = new List<string>(q.AllStamps());
|
||||
if (q.RepeatSec == 0 && stamps.Count > 0 && stamps.TrueForAll(st => StateOf(q, st) == StampState.Done)) continue; // one-time, done
|
||||
list.Add(q);
|
||||
if (list.Count >= QuestOffers.MaxQuests) break;
|
||||
}
|
||||
if (list.Count == 0) return false;
|
||||
_offeredAt[npc] = now;
|
||||
_offer.Clear();
|
||||
_offer.AddRange(list);
|
||||
_offerNpc = npc;
|
||||
_offerText = text;
|
||||
_c.Print($"{npc} starts {string.Join(", ", list.ConvertAll(q => q.Title))}: the quest offer window asks whether to run it.");
|
||||
return true;
|
||||
}
|
||||
|
||||
internal IReadOnlyList<GuideQuest> Offered => _offer;
|
||||
|
||||
public void DrawOffer(UiWindow w)
|
||||
{
|
||||
if (_offer.Count == 0)
|
||||
{
|
||||
w.TextDisabled("No quest offered.");
|
||||
return;
|
||||
}
|
||||
w.TextColored(UiColors.Gold, _offer.Count == 1 ? $"{_offerNpc} starts a quest" : $"{_offerNpc} starts {_offer.Count} quests");
|
||||
if (_offerText.Length > 0) w.TextWrapped("\"" + Cut(_offerText, 160) + "\"");
|
||||
w.Separator();
|
||||
for (int i = 0; i < _offer.Count; i++)
|
||||
{
|
||||
GuideQuest q = _offer[i];
|
||||
w.TextColored(UiColors.Yellow, q.Title);
|
||||
var facts = new List<string> { RepeatText(q) };
|
||||
if (q.Level.Length > 0) facts.Add("Level " + q.Level);
|
||||
if (q.Steps.Count > 0) facts.Add($"{q.Steps.Count} step(s)");
|
||||
w.TextDisabled(string.Join(" | ", facts));
|
||||
w.Button("Run this quest", $"offer.run.{i}", () =>
|
||||
{
|
||||
_c.Runner?.Start(q, st => StateOf(q, st) == StampState.Done, loot: true, society: Standing());
|
||||
CloseOffer();
|
||||
});
|
||||
w.Tooltip("Yes: Run this quest (RynthNav walks its steps, RynthAi talks, loots and picks up its items).");
|
||||
w.SameLine();
|
||||
w.Button("Show", $"offer.show.{i}", () =>
|
||||
{
|
||||
ShowGuide(GuideTab.Wiki, "w:" + q.Title);
|
||||
ShowMainWindow?.Invoke();
|
||||
});
|
||||
w.Tooltip("Open it in the quest guide (its steps), without running it.");
|
||||
}
|
||||
w.Separator();
|
||||
w.Button("Not now", "offer.no", () =>
|
||||
{
|
||||
foreach (GuideQuest q in _offer) _offerDeclined.Add(q.Title);
|
||||
CloseOffer();
|
||||
});
|
||||
w.Tooltip("No: not asked about these quests again this session.");
|
||||
}
|
||||
|
||||
private void CloseOffer()
|
||||
{
|
||||
_offer.Clear();
|
||||
SetOfferWindow?.Invoke(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,9 @@
|
|||
// Stamps tabs and RynthILT's Temple guardians merged in as tracker rows (SilentKelpie's PR 12,
|
||||
// RynthOracle 0.6.0, ported by hand onto this lineage). The Dynamic Stamps, the Temple guardians and the
|
||||
// /qb list are one server's (Infinite Leaftide's) and moved to that server's plugin, RynthILT, on 2026-10-21.
|
||||
// The Dynamic Stamps and Temple guardian rows came back on 2026-10-25, shown only while RynthCore's
|
||||
// active server is Infinite Leaftide (ServerIdentity.IsIlt); the data still comes from RynthILT.
|
||||
// The list's columns follow the window's width (QuestColumns).
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
|
|
@ -14,9 +17,10 @@ namespace RynthCore.Plugin.RynthOracle.Views;
|
|||
|
||||
/// <summary>
|
||||
/// What a row of the merged Quests list is. Every kind but Quest is a tracker: the Legendary Key
|
||||
/// quests and the exploration markers (retail, every server).
|
||||
/// quests and the exploration markers (retail, every server), and the Dynamic Stamps and the
|
||||
/// Temple guardians (Infinite Leaftide only).
|
||||
/// </summary>
|
||||
internal enum QuestKind { Quest, Legendary, Marker }
|
||||
internal enum QuestKind { Quest, Legendary, Marker, Dynamic, Guardian }
|
||||
|
||||
/// <summary>
|
||||
/// Quests: every flag the character holds, cross-referenced with the master quest list (and the
|
||||
|
|
@ -33,7 +37,9 @@ internal sealed partial class OracleView
|
|||
private const float QuestListHeightWithPanel = 300f;
|
||||
private static readonly string[] QuestSorts = { "Flag", "Name", "Done first", "Not done first", "Ready soonest", "Most solves" };
|
||||
/// <summary>The kinds' names in <see cref="QuestKind"/> order (the Show filter).</summary>
|
||||
private static readonly string[] KindNames = { "Quests", "Legendary", "Markers" };
|
||||
private static readonly string[] KindNames = { "Quests", "Legendary", "Markers", "Dynamic Stamps", "Guardians" };
|
||||
/// <summary>The guardians' last answer is offered for this long (RynthILT's Mini Remote line does the same).</summary>
|
||||
private const long GuardianAnswerShownSec = 600;
|
||||
|
||||
// The reward editor's fields, in QuestReward order (two percentages, then counts).
|
||||
private static readonly string[] RewardLabels =
|
||||
|
|
@ -47,6 +53,9 @@ internal sealed partial class OracleView
|
|||
private QuestKind? _qKind;
|
||||
private int _questSort;
|
||||
private int _questPage;
|
||||
private int _dynArea; // 0 = all areas, else DynamicStampList.Areas[n - 1] (Show: Dynamic Stamps)
|
||||
// The list's column layout for the window's width (from the engine's Geometry events).
|
||||
private QuestColumns _cols = QuestColumns.For(0f);
|
||||
|
||||
private readonly List<QuestRow> _questRows = new();
|
||||
private string _questKey = "";
|
||||
|
|
@ -74,18 +83,32 @@ internal sealed partial class OracleView
|
|||
public Quest? Q;
|
||||
public LegendaryQuest? L;
|
||||
public Marker? M;
|
||||
public DynamicStamp? D;
|
||||
public IltGuardianRow? G;
|
||||
}
|
||||
|
||||
/// <summary>The kinds the list shows: quests, Legendary quests and markers, on every server. Internal for the tests.</summary>
|
||||
internal List<QuestKind> AvailableKinds() => new() { QuestKind.Quest, QuestKind.Legendary, QuestKind.Marker };
|
||||
/// <summary>
|
||||
/// The kinds the list shows: quests, Legendary quests and markers on every server; Dynamic Stamps
|
||||
/// and the Temple guardians only while the active server is Infinite Leaftide. Internal for the tests.
|
||||
/// </summary>
|
||||
internal List<QuestKind> AvailableKinds()
|
||||
{
|
||||
var kinds = new List<QuestKind> { QuestKind.Quest, QuestKind.Legendary, QuestKind.Marker };
|
||||
if (_c.Server.IsIlt)
|
||||
{
|
||||
kinds.Add(QuestKind.Dynamic);
|
||||
kinds.Add(QuestKind.Guardian);
|
||||
}
|
||||
return kinds;
|
||||
}
|
||||
|
||||
/// <summary>A kind is listed: this server has it, the Show filter allows it, and Trackers only doesn't hide it.</summary>
|
||||
private bool KindListed(QuestKind k, List<QuestKind> kinds)
|
||||
=> kinds.Contains(k) && (_qKind == null || _qKind == k) && !(_qTrackers && k == QuestKind.Quest);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the Quests tab on the trackers: one kind (/ro legendary, /ro markers) or all of them
|
||||
/// (null). The old tabs' commands land here.
|
||||
/// Opens the Quests tab on the trackers: one kind (/ro legendary, /ro markers, and on Infinite
|
||||
/// Leaftide /ro dynamic, /ro guardians) or all of them (null). The old tabs' commands land here.
|
||||
/// </summary>
|
||||
public void ShowTrackers(QuestKind? kind)
|
||||
{
|
||||
|
|
@ -97,7 +120,18 @@ internal sealed partial class OracleView
|
|||
|
||||
private void DrawQuests(UiWindow w)
|
||||
{
|
||||
// The guide (2026-11-01, QuestGuideTab.cs): two panes, the quests and the opened one's steps; or this flag list.
|
||||
DrawQuestViewSwitch(w);
|
||||
if (_c.Settings.QuestGuideView)
|
||||
{
|
||||
w.SameLine();
|
||||
DrawQuestFlagStatus(w);
|
||||
DrawGuide(w);
|
||||
return;
|
||||
}
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
_cols = QuestColumns.For(w.ContentWidth);
|
||||
if (_c.Server.IsIlt) RefreshAfterHandIn(flags);
|
||||
if (flags.ServerDisabled)
|
||||
w.TextColored(UiColors.Red, "This server has /myquests turned off, so quest flags can't be read.");
|
||||
else if (flags.Loading)
|
||||
|
|
@ -122,11 +156,14 @@ internal sealed partial class OracleView
|
|||
// A Show filter left on a kind the list doesn't have: all kinds.
|
||||
List<QuestKind> kinds = AvailableKinds();
|
||||
if (_qKind is QuestKind chosen && !kinds.Contains(chosen)) _qKind = null;
|
||||
bool ilt = kinds.Contains(QuestKind.Dynamic);
|
||||
|
||||
w.InputText("Search", "q.search", _questSearch, 64, s => { _questSearch = s; _questPage = 0; });
|
||||
w.Tooltip("Words to find in a row: a quest's flag or name; a tracker's place, area or notes.");
|
||||
w.Tooltip(ilt ? "Words to find in a row: a quest's flag or name; a tracker's NPC, place, area, reward or notes."
|
||||
: "Words to find in a row: a quest's flag or name; a tracker's place, area or notes.");
|
||||
w.Checkbox("Done", "q.done", _qDone, v => { _qDone = v; _questPage = 0; });
|
||||
w.Tooltip("Done quests; Legendary quests you have, markers found.");
|
||||
w.Tooltip(ilt ? "Done quests; Legendary quests and stamps you have, markers found, guardians on cooldown."
|
||||
: "Done quests; Legendary quests you have, markers found.");
|
||||
w.SameLine();
|
||||
w.Checkbox("Not done", "q.notdone", _qNotDone, v => { _qNotDone = v; _questPage = 0; });
|
||||
w.SameLine();
|
||||
|
|
@ -154,7 +191,8 @@ internal sealed partial class OracleView
|
|||
if (v && _qKind == QuestKind.Quest) _qKind = null;
|
||||
_questPage = 0;
|
||||
});
|
||||
w.Tooltip("Only the trackers, with their status above the list: Legendary Key quests and exploration markers.");
|
||||
w.Tooltip(ilt ? "Only the trackers, with their status above the list: Legendary Key quests, exploration markers, Dynamic Stamps and the Temple guardians."
|
||||
: "Only the trackers, with their status above the list: Legendary Key quests and exploration markers.");
|
||||
w.SameLine();
|
||||
var kindItems = new List<string>(kinds.Count + 1) { "Everything" };
|
||||
foreach (QuestKind k in kinds) kindItems.Add(KindNames[(int)k]);
|
||||
|
|
@ -166,6 +204,13 @@ internal sealed partial class OracleView
|
|||
_questPage = 0;
|
||||
});
|
||||
w.Tooltip("One kind of row, or everything.");
|
||||
if (_qKind == QuestKind.Dynamic)
|
||||
{
|
||||
w.SameLine();
|
||||
var areaItems = new List<string>(DynamicStampList.Areas.Count + 1) { "All areas" };
|
||||
areaItems.AddRange(DynamicStampList.Areas);
|
||||
w.Combo("##dyarea", "dy.area", Math.Clamp(_dynArea, 0, areaItems.Count - 1), areaItems, v => { _dynArea = v; _questPage = 0; });
|
||||
}
|
||||
w.Combo("Sort", "q.sort", _questSort, QuestSorts, i => { _questSort = Math.Clamp(i, 0, QuestSorts.Length - 1); _questPage = 0; });
|
||||
|
||||
if (_qTrackers || _qKind is QuestKind k2 && k2 != QuestKind.Quest) DrawTrackerSummary(w, kinds);
|
||||
|
|
@ -179,19 +224,21 @@ internal sealed partial class OracleView
|
|||
bool selected = HasSelection();
|
||||
w.BeginChild("q.list", 0f, selected ? QuestListHeightWithPanel : 0f, border: true);
|
||||
w.TextDisabled("*");
|
||||
w.Tooltip("Track: list the quest in the Quest Timers window. Trackers show their kind here instead (LEG, MRK).");
|
||||
w.SameLine(28f);
|
||||
w.Tooltip("Track: list the quest in the Quest Timers window. Trackers show their kind here instead (LEG, MRK"
|
||||
+ (ilt ? ", DYN, GRD)." : ")."));
|
||||
QuestColumns c = _cols;
|
||||
w.SameLine(c.Done);
|
||||
w.TextDisabled("Done");
|
||||
w.SameLine(72f);
|
||||
w.SameLine(c.Label);
|
||||
w.TextDisabled("Quest");
|
||||
w.SameLine(370f);
|
||||
w.SameLine(c.Ready);
|
||||
w.TextDisabled("Ready in");
|
||||
w.SameLine(470f);
|
||||
w.SameLine(c.Solves);
|
||||
w.TextDisabled("Solves");
|
||||
w.SameLine(530f);
|
||||
w.SameLine(c.Extra);
|
||||
w.TextDisabled("Rewards");
|
||||
w.Tooltip("What you recorded for a quest (click it to edit): %XP, %Lum, Coins, Trinkets, Medallions, Yellow/Red/Blue powder, MMDs (D), at Level.\n"
|
||||
+ "Trackers: a Legendary quest's luminance, a marker's location.");
|
||||
+ "Trackers: a Legendary quest's luminance, a marker's location" + (ilt ? ", a stamp's area, a guardian's next turn-in." : "."));
|
||||
|
||||
DateTime now = _c.UtcNow;
|
||||
bool canTrack = _c.Book.Loaded;
|
||||
|
|
@ -205,6 +252,16 @@ internal sealed partial class OracleView
|
|||
if (selected) DrawSelection(w);
|
||||
}
|
||||
|
||||
/// <summary>The flags' state in one short line (the guide view's top row).</summary>
|
||||
private void DrawQuestFlagStatus(UiWindow w)
|
||||
{
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
if (flags.ServerDisabled) w.TextColored(UiColors.Red, "/myquests is off on this server: no quest flags.");
|
||||
else if (flags.Loading) w.TextColored(UiColors.Yellow, "Reading your quest flags...");
|
||||
else if (flags.LastReadUtc == DateTime.MinValue) w.TextDisabled("Quest flags not read yet (Refresh).");
|
||||
else w.TextDisabled($"{flags.Flags.Count} flags, read {flags.LastReadUtc.ToLocalTime():HH:mm}");
|
||||
}
|
||||
|
||||
/// <summary>One list row: a quest (track, done, timer, solves, rewards) or a tracker (kind, status, its own columns).</summary>
|
||||
private void DrawQuestRow(UiWindow w, QuestRow r, QuestFlagStore flags, DateTime now, bool canTrack)
|
||||
{
|
||||
|
|
@ -213,36 +270,45 @@ internal sealed partial class OracleView
|
|||
Quest q = r.Q!;
|
||||
string flag = q.Flag;
|
||||
bool tracked = _c.Book.IsTracked(flag);
|
||||
QuestColumns c = _cols;
|
||||
w.ToggleButton("*", "q.t." + flag, tracked, () => { if (canTrack) _c.Book.ToggleTracked(flag); }, small: true);
|
||||
w.SameLine(28f);
|
||||
w.SameLine(c.Done);
|
||||
DoneMark(w, r.Done);
|
||||
w.SameLine(72f);
|
||||
w.Selectable(Cut(q.Label, 44), "q.r." + flag, IsSelected(r), () => SelectRow(r), 290f);
|
||||
w.Tooltip(flag + "\nClick: opens it below and prints its texts in chat.");
|
||||
w.SameLine(370f);
|
||||
w.SameLine(c.Label);
|
||||
w.Selectable(Cut(q.Label, c.LabelChars), "q.r." + flag, IsSelected(r), () => SelectRow(r), c.LabelWidth);
|
||||
w.Tooltip(q.Label.Length > c.LabelChars ? q.Label + "\n" + flag + "\nClick: opens it below and prints its texts in chat."
|
||||
: flag + "\nClick: opens it below and prints its texts in chat.");
|
||||
w.SameLine(c.Ready);
|
||||
TimerText(w, q, flags, now, r.Done);
|
||||
string solves = q.SolvesText(flags);
|
||||
if (solves.Length > 0)
|
||||
{
|
||||
w.SameLine(470f);
|
||||
w.SameLine(c.Solves);
|
||||
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);
|
||||
w.SameLine(c.Extra);
|
||||
w.Text(Cut(reward, c.ExtraChars));
|
||||
if (reward.Length > c.ExtraChars) w.Tooltip(reward);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// A tracker: its kind tag where the * is, then its mark, label and columns.
|
||||
w.TextColored(UiColors.Gold, r.Kind == QuestKind.Legendary ? "LEG" : "MRK");
|
||||
w.SameLine(28f);
|
||||
QuestColumns col = _cols;
|
||||
w.TextColored(UiColors.Gold, r.Kind switch
|
||||
{
|
||||
QuestKind.Legendary => "LEG",
|
||||
QuestKind.Marker => "MRK",
|
||||
QuestKind.Dynamic => "DYN",
|
||||
_ => "GRD",
|
||||
});
|
||||
w.SameLine(col.Done);
|
||||
TrackerMark(w, r);
|
||||
w.SameLine(72f);
|
||||
w.Selectable(Cut(r.Label, 44), "q.r." + r.Key, IsSelected(r), () => SelectRow(r), 290f);
|
||||
w.SameLine(col.Label);
|
||||
w.Selectable(Cut(r.Label, col.LabelChars), "q.r." + r.Key, IsSelected(r), () => SelectRow(r), col.LabelWidth);
|
||||
string tip = TrackerTooltip(r);
|
||||
if (tip.Length > 0) w.Tooltip(Cut(tip, 300));
|
||||
switch (r.Kind)
|
||||
|
|
@ -251,33 +317,58 @@ internal sealed partial class OracleView
|
|||
{
|
||||
LegendaryQuest l = r.L!;
|
||||
TimeSpan? left = l.TimeLeft(flags, now);
|
||||
w.SameLine(370f);
|
||||
w.SameLine(col.Ready);
|
||||
if (left == null) w.TextColored(UiColors.Grey, "not done");
|
||||
else if (left.Value <= TimeSpan.Zero) w.TextColored(UiColors.Green, "ready");
|
||||
else w.TextColored(UiColors.Yellow, TimeText.Friendly(left.Value));
|
||||
if (l.Luminance > 0)
|
||||
{
|
||||
w.SameLine(530f);
|
||||
w.SameLine(col.Extra);
|
||||
w.TextDisabled(TimeText.Number(l.Luminance) + " lum");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QuestKind.Guardian:
|
||||
{
|
||||
IltGuardianRow g = r.G!;
|
||||
w.SameLine(col.Ready);
|
||||
w.TextColored(g.Ready ? UiColors.Green : g.Status == "Unknown" ? UiColors.Grey : UiColors.Yellow, Cut(g.Status, col.ReadyChars));
|
||||
w.SameLine(col.Solves);
|
||||
w.Text("#" + g.Count);
|
||||
if (g.Eta.Length > 0)
|
||||
{
|
||||
w.SameLine(col.Extra);
|
||||
w.TextDisabled(Cut(g.Eta, col.ExtraChars));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Markers: where they are.
|
||||
// Markers and stamps: where they are.
|
||||
if (r.Group.Length > 0)
|
||||
{
|
||||
w.SameLine(530f);
|
||||
w.TextDisabled(Cut(r.Group, 18));
|
||||
w.SameLine(col.Extra);
|
||||
w.TextDisabled(Cut(r.Group, col.ExtraChars));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A tracker's done column: have / need (Legendary) or found / -- (markers).</summary>
|
||||
/// <summary>A tracker's done column: have / need, found / --, or a guardian's ready / wait.</summary>
|
||||
private static void TrackerMark(UiWindow w, QuestRow r)
|
||||
{
|
||||
if (r.Kind == QuestKind.Marker) DoneMark(w, r.Done);
|
||||
else w.TextColored(r.Done ? UiColors.Green : UiColors.Red, r.Done ? "have" : "need");
|
||||
switch (r.Kind)
|
||||
{
|
||||
case QuestKind.Marker:
|
||||
DoneMark(w, r.Done);
|
||||
break;
|
||||
case QuestKind.Guardian:
|
||||
// Done = turned in and on cooldown; not done = a turn-in is ready (or unknown).
|
||||
w.TextColored(r.Done ? UiColors.Yellow : UiColors.Green, r.Done ? "wait" : "ready");
|
||||
break;
|
||||
default:
|
||||
w.TextColored(r.Done ? UiColors.Green : UiColors.Red, r.Done ? "have" : "need");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A tracker row's hover text: its notes or hint.</summary>
|
||||
|
|
@ -285,9 +376,19 @@ internal sealed partial class OracleView
|
|||
{
|
||||
QuestKind.Legendary => r.L!.Note.Length > 0 ? $"{r.Group}: {r.L.Note}" : r.Group,
|
||||
QuestKind.Marker => r.M!.Hint,
|
||||
QuestKind.Dynamic => string.Join(" - ", Parts(r.D!.Area, r.D.Place, r.D.Reward.Length > 0 ? "gives " + r.D.Reward : "", r.D.Note)),
|
||||
QuestKind.Guardian => $"{r.G!.Npc}: {(r.G.Exact ? "from /myquests (exact)" : "from /qb wait stamps (count and timer are estimates)")}",
|
||||
_ => "",
|
||||
};
|
||||
|
||||
/// <summary>The non-empty strings, in order.</summary>
|
||||
private static List<string> Parts(params string[] items)
|
||||
{
|
||||
var list = new List<string>(items.Length);
|
||||
foreach (string s in items) if (!string.IsNullOrWhiteSpace(s)) list.Add(s);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
|
|
@ -305,7 +406,8 @@ internal sealed partial class OracleView
|
|||
|
||||
/// <summary>
|
||||
/// The trackers' status (what each old tab showed at its top), for the kinds the Show filter
|
||||
/// lists: John's Legendary counter, and the markers found and the next one.
|
||||
/// lists: John's Legendary counter, the markers found and the next one, and on Infinite Leaftide
|
||||
/// the stamps had and the Temple guardians' switches, last answer and hand-in.
|
||||
/// </summary>
|
||||
private void DrawTrackerSummary(UiWindow w, List<QuestKind> kinds)
|
||||
{
|
||||
|
|
@ -353,6 +455,100 @@ internal sealed partial class OracleView
|
|||
w.Tooltip("Opens it below the list (directions, RynthNav) and prints the directions in chat.");
|
||||
}
|
||||
}
|
||||
|
||||
if (Shows(QuestKind.Dynamic))
|
||||
{
|
||||
List<DynamicStamp> all = DynamicStampList.All;
|
||||
IReadOnlySet<string> qbStamps = _c.Ilt.QbStampSet;
|
||||
int have = 0;
|
||||
foreach (DynamicStamp s in all) if (s.Have(flags, qbStamps)) have++;
|
||||
int unlisted = DynamicStampList.Unlisted(flags, qbStamps).Count;
|
||||
w.ProgressBar(all.Count == 0 ? 0f : (float)have / all.Count, -1f, 0f,
|
||||
$"{have} / {all.Count} listed Dynamic stamps" + (unlisted > 0 ? $" (+{unlisted} not in the list)" : ""));
|
||||
w.Tooltip("Dynamic stamps are one-time quest flags (Dynamic_1_...) from handing items to NPCs on Infinite Leaftide.\n"
|
||||
+ "Done: in /myquests, or in the /qb list (/myquests leaves out flags the server has no quest text for).\n"
|
||||
+ (DynamicStampList.Source == "wiki" ? "List: the wiki's Dynamic Stamps page (RynthILT reads it)." : "List: the players' ExtraDyn sheet (the wiki's page once RynthILT has read it).")
|
||||
+ " Click a stamp for RynthNav's route to it and the Parchment hand-in."
|
||||
+ (unlisted > 0 ? "\nStamps not in the sheet show as quests with Not in list." : ""));
|
||||
DrawStampQbSource(w);
|
||||
}
|
||||
|
||||
if (Shows(QuestKind.Guardian)) DrawGuardianControls(w);
|
||||
}
|
||||
|
||||
// The /qb list was asked for this session on the stamps' behalf (once: the server allows one a minute).
|
||||
private bool _qbAskedForStamps;
|
||||
|
||||
/// <summary>
|
||||
/// Under the Dynamic stamps bar: whether the /qb list is in, which can mark stamps done that
|
||||
/// /myquests leaves out. Asks RynthILT for it once per session while it hasn't been read, and
|
||||
/// offers a button to read it again.
|
||||
/// </summary>
|
||||
private void DrawStampQbSource(UiWindow w)
|
||||
{
|
||||
if (!_c.InWorld) { _qbAskedForStamps = false; return; }
|
||||
IltQuestBonusList? qb = _c.Ilt.QuestBonus;
|
||||
if (qb == null || qb.Disabled) return; // no RynthILT, or /qb is off on this server
|
||||
bool loaded = qb.Generation > 0;
|
||||
if (!loaded && !_qbAskedForStamps)
|
||||
{
|
||||
_qbAskedForStamps = true;
|
||||
_c.Send("/ilt qb");
|
||||
}
|
||||
w.TextDisabled(loaded
|
||||
? $"Also counted from the /qb list ({TimeText.Number(_c.Ilt.QbStampSet.Count)} Dynamic flag(s) in it)."
|
||||
: "Reading the /qb list for stamps /myquests leaves out...");
|
||||
w.SameLine();
|
||||
w.SmallButton("Read /qb", "dy.qb", () => { if (!_c.Send("/ilt qb")) _c.Print("Log in first."); });
|
||||
w.Tooltip("RynthILT reads your quest bonus list (/qb list; the server allows once a minute).");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Temple guardians' controls (RynthILT's Guardian window): chat detection, auto hand-in and
|
||||
/// buy-if-missing, which run inside RynthILT; the last answer with Hand in / Stop; and a refresh.
|
||||
/// </summary>
|
||||
private void DrawGuardianControls(UiWindow w)
|
||||
{
|
||||
IltGuardianView g = _c.Guardian;
|
||||
if (!g.Loaded)
|
||||
{
|
||||
w.TextDisabled(_c.IltData.Connected
|
||||
? "Temple guardians: this RynthILT is older than 0.2.20 (no guardian data for Oracle)."
|
||||
: "Temple guardians: RynthILT isn't loaded (it runs the riddles, hand-ins and turn-in tracker).");
|
||||
return;
|
||||
}
|
||||
int ready = 0;
|
||||
foreach (IltGuardianRow r in g.Rows) if (r.Ready) ready++;
|
||||
w.TextColored(UiColors.Gold, "Temple guardians");
|
||||
w.SameLine();
|
||||
w.TextDisabled($"{ready} of {g.Rows.Count} attribute turn-ins ready"
|
||||
+ (g.SyncedUtc == DateTime.MinValue ? ", /qb not read this session" : $", /qb read {g.SyncedUtc.ToLocalTime():HH:mm}"));
|
||||
w.SameLine();
|
||||
w.SmallButton("Refresh", "gd.refresh", () => _c.GuardianCommand(IltGuardianView.RefreshVerb()));
|
||||
w.Tooltip("RynthILT re-reads /myquests and /qb list for the turn-ins (the server allows each once a minute).");
|
||||
|
||||
w.Checkbox("Detect from chat", "gd.chat", g.Chat, v => _c.GuardianCommand(IltGuardianView.SwitchVerb("chat", v)));
|
||||
w.Tooltip("Translate the guardians' tells as they arrive and show the answer here.");
|
||||
w.SameLine();
|
||||
w.Checkbox("Auto hand-in", "gd.auto", g.Auto, v => _c.GuardianCommand(IltGuardianView.SwitchVerb("auto", v)));
|
||||
w.Tooltip("After a chat answer, RynthILT gives one of the item to the guardian automatically.");
|
||||
w.SameLine();
|
||||
w.Checkbox("Buy if missing", "gd.buy", g.Buy, v => _c.GuardianCommand(IltGuardianView.SwitchVerb("buy", v)));
|
||||
w.Tooltip("Temple guardian: when you carry none, RynthILT buys one from the open or nearest vendor first.");
|
||||
|
||||
bool recent = g.Answer.Length > 0 && g.AnswerAgeSec >= 0 && g.AnswerAgeSec < GuardianAnswerShownSec;
|
||||
if (recent || g.Running)
|
||||
{
|
||||
w.TextColored(UiColors.Green, g.Answer);
|
||||
if (g.Heard.Length > 0) w.Tooltip("Heard: " + Cut(g.Heard, 300));
|
||||
w.SameLine();
|
||||
w.TextDisabled("-> " + g.Npc);
|
||||
w.SameLine();
|
||||
if (g.Running) w.SmallButton("Stop", "gd.stop", () => _c.GuardianCommand(IltGuardianView.StopVerb()));
|
||||
else w.SmallButton("Hand in", "gd.handin", () => _c.GuardianCommand(IltGuardianView.HandInVerb()));
|
||||
}
|
||||
else w.TextDisabled("No guardian answer yet.");
|
||||
w.TextDisabled("Hand-in: " + g.Status + (_c.GuardianMessage.Length > 0 ? " - " + _c.GuardianMessage : ""));
|
||||
}
|
||||
|
||||
// ── The opened row ──────────────────────────────────────────────────────
|
||||
|
|
@ -361,12 +557,14 @@ internal sealed partial class OracleView
|
|||
private bool HasSelection() => _selKind switch
|
||||
{
|
||||
QuestKind.Quest => _questSel.Length > 0,
|
||||
QuestKind.Dynamic => _dynNav != null,
|
||||
_ => _selKey.Length > 0,
|
||||
};
|
||||
|
||||
private bool IsSelected(QuestRow r) => r.Kind switch
|
||||
{
|
||||
QuestKind.Quest => _selKind == QuestKind.Quest && r.Q!.Flag == _questSel,
|
||||
QuestKind.Dynamic => _selKind == QuestKind.Dynamic && ReferenceEquals(r.D, _dynNav),
|
||||
_ => _selKind == r.Kind && _selKey == r.Key,
|
||||
};
|
||||
|
||||
|
|
@ -383,6 +581,7 @@ internal sealed partial class OracleView
|
|||
bool same = IsSelected(r);
|
||||
_questSel = "";
|
||||
_selKey = "";
|
||||
_dynNav = null;
|
||||
_questStopIdx = 0;
|
||||
_questNavStatus = "";
|
||||
if (same) return;
|
||||
|
|
@ -392,6 +591,11 @@ internal sealed partial class OracleView
|
|||
case QuestKind.Quest:
|
||||
OpenQuest(r.Q!);
|
||||
break;
|
||||
case QuestKind.Dynamic:
|
||||
// A stamp also asks RynthNav for the route at once, as its tab did.
|
||||
_selKey = r.Key;
|
||||
SelectDynamicStamp(r.D!, r.Done);
|
||||
break;
|
||||
default:
|
||||
_selKey = r.Key;
|
||||
break;
|
||||
|
|
@ -406,7 +610,7 @@ internal sealed partial class OracleView
|
|||
LoadRewardEdit(q.Flag);
|
||||
}
|
||||
|
||||
/// <summary>The opened row's panel: a quest, a Legendary quest or a marker.</summary>
|
||||
/// <summary>The opened row's panel: a quest, a Dynamic Stamp's nav box, a Legendary quest, a marker or a guardian.</summary>
|
||||
private void DrawSelection(UiWindow w)
|
||||
{
|
||||
switch (_selKind)
|
||||
|
|
@ -422,9 +626,44 @@ internal sealed partial class OracleView
|
|||
Marker? m = MarkerList.All.Find(x => "mk:" + x.Number == _selKey);
|
||||
if (m != null) DrawSelectedMarker(w, m);
|
||||
break;
|
||||
case QuestKind.Dynamic:
|
||||
DrawDynamicNavBox(w);
|
||||
break;
|
||||
case QuestKind.Guardian:
|
||||
IltGuardianRow? g = null;
|
||||
foreach (IltGuardianRow r in _c.Guardian.Rows)
|
||||
if ("gd:" + r.Attribute == _selKey) { g = r; break; }
|
||||
DrawSelectedGuardian(w, g);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSelectedGuardian(UiWindow w, IltGuardianRow? g)
|
||||
{
|
||||
if (g != null)
|
||||
{
|
||||
w.SeparatorText("Temple guardian: " + g.Attribute);
|
||||
w.TextDisabled("NPC");
|
||||
w.SameLine(90f);
|
||||
w.Text(g.Npc);
|
||||
w.TextDisabled("Turn-ins");
|
||||
w.SameLine(90f);
|
||||
w.Text(g.Count.ToString());
|
||||
w.TextDisabled("Status");
|
||||
w.SameLine(90f);
|
||||
w.TextColored(g.Ready ? UiColors.Green : g.Status == "Unknown" ? UiColors.Grey : UiColors.Yellow, g.Status);
|
||||
if (g.Eta.Length > 0)
|
||||
{
|
||||
w.SameLine(260f);
|
||||
w.TextDisabled("Next: " + g.Eta);
|
||||
}
|
||||
w.TextDisabled(g.Exact ? "From /myquests (exact)." : $"From /qb wait stamps: the count and timer are estimates (cooldown taken as {_c.Guardian.CooldownHours} h).");
|
||||
}
|
||||
else w.SeparatorText("Temple guardians");
|
||||
DrawGuardianControls(w);
|
||||
w.Button("Close", "gd.sel.close", () => _selKey = "");
|
||||
}
|
||||
|
||||
private void DrawSelectedLegendary(UiWindow w, LegendaryQuest l)
|
||||
{
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
|
|
@ -446,6 +685,7 @@ internal sealed partial class OracleView
|
|||
}
|
||||
if (l.Note.Length > 0) w.TextWrapped(Cut(l.Note, 600));
|
||||
DrawGoTo(w, StopsFor("lg:" + l.Name, () => NavTargets.Stops(l.Note)));
|
||||
DrawHandIn(w, GuideFor(l.Flags.Length > 0 ? l.Flags[0] : "", l.Name, l.CommonName), "lg.sel", t => _questNavStatus = t);
|
||||
w.Button("Print in chat", "lg.sel.print", () => PrintLegendary(l, status));
|
||||
w.Tooltip("The quest, its flags and status, the notes, wiki and video links.");
|
||||
w.SameLine();
|
||||
|
|
@ -575,6 +815,8 @@ internal sealed partial class OracleView
|
|||
string details = q.Details();
|
||||
if (details.Length > 0) w.TextWrapped(Cut(details, 600));
|
||||
DrawGoTo(w, StopsFor("q:" + q.Flag, () => NavTargets.Stops(q.Info + " - " + q.Hint)));
|
||||
DrawHandIn(w, GuideFor(q.Flag, q.Name), "q.sel", t => _questNavStatus = t);
|
||||
if (_questNavStatus.Length > 0 && NavTargets.Stops(q.Info + " - " + q.Hint).Count == 0) w.TextDisabled(_questNavStatus);
|
||||
|
||||
bool loaded = _c.Book.Loaded;
|
||||
bool tracked = _c.Book.IsTracked(q.Flag);
|
||||
|
|
@ -664,8 +906,10 @@ internal sealed partial class OracleView
|
|||
private List<QuestRow> QuestRows(List<QuestKind> kinds)
|
||||
{
|
||||
string key = $"{_questSearch}|{_qDone}{_qNotDone}{_qRepeatable}{_qOneTime}{_qNew}{_qServer}{_qTracked}{_qKill}|{_questSort}"
|
||||
+ $"|{_qTrackers}|{_qKind}|{string.Join(",", kinds)}"
|
||||
+ $"|{_qTrackers}|{_qKind}|{_dynArea}|{string.Join(",", kinds)}"
|
||||
+ $"|{_c.Flags.Revision}|{_c.Catalog.Revision}|{(_qTracked ? _c.Book.Revision : 0)}";
|
||||
// Infinite Leaftide: the guardians and a new /qb list (it can mark Dynamic stamps done).
|
||||
if (kinds.Contains(QuestKind.Dynamic)) key += $"|{_c.GuardianRevision}|{_c.Ilt.Revision}";
|
||||
bool timeSorted = _questSort == 4;
|
||||
if (key == _questKey && (!timeSorted || _c.NowMs - _questBuiltMs < 5000)) return _questRows;
|
||||
_questKey = key;
|
||||
|
|
@ -675,11 +919,25 @@ internal sealed partial class OracleView
|
|||
string[] terms = _questSearch.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
_questRows.Clear();
|
||||
|
||||
// The Dynamic stamps the list matched (Infinite Leaftide): shown as stamp rows, not again as unknown quest flags.
|
||||
bool stamps = kinds.Contains(QuestKind.Dynamic);
|
||||
IReadOnlySet<string>? qbStamps = stamps ? _c.Ilt.QbStampSet : null;
|
||||
var stampFlags = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
if (stamps)
|
||||
foreach (DynamicStamp s in DynamicStampList.All)
|
||||
if (s.MatchedFlag(flags, qbStamps) is string f)
|
||||
{
|
||||
// The errand's flag and its "_d" delivery flag are both this stamp's row.
|
||||
stampFlags.Add(f);
|
||||
stampFlags.Add(DynamicStampList.ErrandOf(f) + DynamicStampList.DeliverySuffix);
|
||||
}
|
||||
|
||||
if (KindListed(QuestKind.Quest, kinds))
|
||||
{
|
||||
foreach (Quest q in _c.Catalog.Quests)
|
||||
{
|
||||
if (_qNew && !q.IsNew) continue;
|
||||
if (q.IsNew && stampFlags.Contains(q.Flag)) 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;
|
||||
|
|
@ -709,6 +967,23 @@ internal sealed partial class OracleView
|
|||
QuestRow r = MarkerRow(MarkerList.All[i], flags, i);
|
||||
if (KeepTracker(r, repeatable: false, tracked: false, $"{r.Label} {r.M!.Location} {r.M.Hint}", terms)) _questRows.Add(r);
|
||||
}
|
||||
|
||||
if (KindListed(QuestKind.Dynamic, kinds))
|
||||
for (int i = 0; i < DynamicStampList.All.Count; i++)
|
||||
{
|
||||
DynamicStamp s = DynamicStampList.All[i];
|
||||
if (_dynArea > 0 && (_dynArea > DynamicStampList.Areas.Count || DynamicStampList.Areas[_dynArea - 1] != s.Area)) continue;
|
||||
var r = new QuestRow { Kind = QuestKind.Dynamic, Key = "dy:" + s.Stamp, Label = s.Label, Group = s.Area, Order = i, Done = s.Have(flags, qbStamps), D = s };
|
||||
if (KeepTracker(r, repeatable: false, tracked: false, $"{s.Npc} {s.Place} {s.Reward} {s.Area} {s.Stamp} {s.Note}", terms)) _questRows.Add(r);
|
||||
}
|
||||
|
||||
if (KindListed(QuestKind.Guardian, kinds))
|
||||
for (int i = 0; i < _c.Guardian.Rows.Count; i++)
|
||||
{
|
||||
IltGuardianRow g = _c.Guardian.Rows[i];
|
||||
var r = new QuestRow { Kind = QuestKind.Guardian, Key = "gd:" + g.Attribute, Label = g.Attribute + " (" + g.Npc + ")", Group = g.Npc, Order = i, Done = !g.Ready, G = g };
|
||||
if (KeepTracker(r, repeatable: true, tracked: false, $"{g.Attribute} {g.Npc} {g.Status}", terms)) _questRows.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
DateTime now = _c.UtcNow;
|
||||
|
|
@ -757,7 +1032,7 @@ internal sealed partial class OracleView
|
|||
return MatchesAll(hay, terms);
|
||||
}
|
||||
|
||||
/// <summary>Ready soonest: held repeatable quests and Legendary quests by time left; the rest after.</summary>
|
||||
/// <summary>Ready soonest: held repeatable quests and Legendary quests by time left, ready guardians first; the rest after.</summary>
|
||||
private static double RowReadyKey(QuestRow r, QuestFlagStore flags, DateTime now)
|
||||
{
|
||||
switch (r.Kind)
|
||||
|
|
@ -767,13 +1042,20 @@ internal sealed partial class OracleView
|
|||
case QuestKind.Legendary:
|
||||
TimeSpan? left = r.L!.TimeLeft(flags, now);
|
||||
return left == null ? double.MaxValue : Math.Max(0, left.Value.TotalSeconds);
|
||||
case QuestKind.Guardian:
|
||||
return r.G!.Ready ? 0 : double.MaxValue;
|
||||
default:
|
||||
return double.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Most solves: a repeatable quest's solves.</summary>
|
||||
private static int RowSolves(QuestRow r, QuestFlagStore flags) => r.Kind == QuestKind.Quest ? Solves(r.Q!, flags) : 0;
|
||||
/// <summary>Most solves: a repeatable quest's solves, a guardian's turn-ins.</summary>
|
||||
private static int RowSolves(QuestRow r, QuestFlagStore flags) => r.Kind switch
|
||||
{
|
||||
QuestKind.Quest => Solves(r.Q!, flags),
|
||||
QuestKind.Guardian => r.G!.Count,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
/// <summary>Held repeatables by time left (ready ones first); everything else after them.</summary>
|
||||
private static double ReadyKey(Quest q, QuestFlagStore flags, DateTime now) =>
|
||||
|
|
@ -784,3 +1066,54 @@ internal sealed partial class OracleView
|
|||
private static int Solves(Quest q, QuestFlagStore flags) =>
|
||||
flags.TryGet(q.Flag, out QuestFlag f) && q.IsRepeatable(flags) ? f.Solves : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Quests list's column positions for the window's width: the quest name takes what the
|
||||
/// fixed columns (Ready in, Solves) and the Rewards column leave, so a wide window shows whole
|
||||
/// names and rewards instead of a band of empty space. Without a width (an engine that sends no
|
||||
/// Geometry events, or before the first one) it is the old fixed layout. Logical units at UI
|
||||
/// scale 1, as SameLine takes them.
|
||||
/// </summary>
|
||||
internal readonly record struct QuestColumns(float Done, float Label, float LabelWidth, int LabelChars,
|
||||
float Ready, int ReadyChars, float Solves, float Extra, int ExtraChars)
|
||||
{
|
||||
/// <summary>The old fixed layout (the list as it was laid out for a 600-wide window).</summary>
|
||||
public static readonly QuestColumns Fixed = new(28f, 72f, 290f, 44, 370f, 14, 470f, 530f, 18);
|
||||
|
||||
// The child's border, padding and scrollbar take this much of the window's content width.
|
||||
private const float ListChrome = 34f;
|
||||
// A rough average glyph width of the default font, for cutting text to a column.
|
||||
private const float CharWidth = 7f;
|
||||
private const float ReadyWidth = 100f, SolvesWidth = 60f, Gap = 8f;
|
||||
|
||||
/// <summary>
|
||||
/// The layout for <paramref name="contentWidth"/>: scales all columns to fit the window's
|
||||
/// width. The label column gets at most half the available space so the gap between the
|
||||
/// quest name and the Ready column stays reasonable at any window width.
|
||||
/// </summary>
|
||||
public static QuestColumns For(float contentWidth)
|
||||
{
|
||||
float width = contentWidth - ListChrome;
|
||||
if (!(width > 0f) || !float.IsFinite(width)) return Fixed;
|
||||
// Right-side fixed minimums.
|
||||
const float MinReady = 80f, MinSolves = 50f, MinExtra = 100f;
|
||||
float rightMin = MinReady + MinSolves + MinExtra + Gap * 3;
|
||||
float available = width - Fixed.Label - Gap;
|
||||
if (available < rightMin + 80f) return Fixed; // too narrow to lay out dynamically
|
||||
// Label gets up to half, capped at 50% of the space after the left columns.
|
||||
float maxLabel = available * 0.50f;
|
||||
float labelWidth = Math.Min(maxLabel, Fixed.LabelWidth + (available - rightMin - Fixed.LabelWidth) * 0.35f);
|
||||
labelWidth = Math.Max(Fixed.LabelWidth, labelWidth);
|
||||
// Distribute the rest among right-side columns proportionally.
|
||||
float rightSpace = available - labelWidth;
|
||||
float readyX = Fixed.Label + labelWidth + Gap;
|
||||
float readyW = rightSpace * 0.35f;
|
||||
float solvesX = readyX + readyW;
|
||||
float solvesW = rightSpace * 0.20f;
|
||||
float extraX = solvesX + solvesW;
|
||||
float extraW = rightSpace - readyW - solvesW;
|
||||
return new QuestColumns(Fixed.Done, Fixed.Label, labelWidth, Math.Max(10, (int)(labelWidth / CharWidth)),
|
||||
readyX, Math.Max(8, (int)((readyW - Gap) / CharWidth)), solvesX, extraX,
|
||||
Math.Max(8, (int)((extraW - Gap) / CharWidth)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ internal sealed partial class OracleView
|
|||
private DateTime _refreshAtUtc, _refreshDoneUtc;
|
||||
private readonly Dictionary<string, long> _refreshSent = new();
|
||||
|
||||
/// <summary>The page a status line belongs to (each tab is one page).</summary>
|
||||
private static string RefreshScope(string tab) => tab;
|
||||
/// <summary>The page a status line belongs to (each tab is one page; the Gear tab, one per view).</summary>
|
||||
private string RefreshScope(string tab) => tab == TabGear ? tab + GearView : tab;
|
||||
|
||||
private void DrawRefreshRow(UiWindow w, TabDef def)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
// The Quests tab's Society and Contracts lists (2026-11-21, Silentkelpie: "lay out tabs for quests, kill task,
|
||||
// socity quests, contracts ... pull a dynamic feed from https://asheron.fandom.com/wiki/Category:Society_Quests
|
||||
// for socity quests, .../Category:Contracts for contracts"). On every server.
|
||||
// - Society: the wiki's society quests by rank (Joining, Initiate, Adept, Knight, Lord, Master), each the wiki
|
||||
// quest view with its steps, Run this quest and loot profile. The rank is the quest box's "Society Rank",
|
||||
// else the society category the page is in.
|
||||
// - Contracts: the AC Community Wiki's contract items: what each is, where it comes from (Go: RynthNav to the
|
||||
// person), and the quests it is for (Open; their state on the left). A contract's quest is looked up in the
|
||||
// wiki in use, then in the AC Community Wiki's.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
/// <summary>Society ranks in order (the wiki's names).</summary>
|
||||
internal static readonly string[] SocietyRanks = { "Joining", "Initiate", "Adept", "Knight", "Lord", "Master" };
|
||||
|
||||
/// <summary>A rank's place in <see cref="SocietyRanks"/>; past the end for any other.</summary>
|
||||
internal static int RankOrder(string rank)
|
||||
{
|
||||
for (int i = 0; i < SocietyRanks.Length; i++)
|
||||
if (string.Equals(SocietyRanks[i], rank, StringComparison.OrdinalIgnoreCase)) return i;
|
||||
return SocietyRanks.Length;
|
||||
}
|
||||
|
||||
/// <summary>A quest's society rank: the wiki in use, else the AC Community Wiki's categories.</summary>
|
||||
internal string SocietyRankOf(GuideQuest q)
|
||||
{
|
||||
string r = _c.Wiki.SocietyRankOf(q);
|
||||
if (r.Length == 0 && !_c.WikiIsFandom) r = _c.Fandom.Guide.SocietyRankOf(q);
|
||||
return r;
|
||||
}
|
||||
|
||||
private void SocietyRows(string[] terms, bool hide)
|
||||
{
|
||||
var order = new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
void Add(GuideQuest q)
|
||||
{
|
||||
if (!seen.Add(q.Title)) return;
|
||||
string rank = SocietyRankOf(q);
|
||||
if (rank.Length == 0) return;
|
||||
if (!MatchesAll(rank + " " + WikiHay(q), terms)) return;
|
||||
GuideRow r = WikiRow(q);
|
||||
if (hide && r.Done) return;
|
||||
r.Label = rank + ": " + q.Title;
|
||||
_gRows.Add(r);
|
||||
order[r.Key] = RankOrder(rank);
|
||||
}
|
||||
foreach (GuideQuest q in _c.Wiki.Quests) Add(q);
|
||||
if (!_c.WikiIsFandom)
|
||||
foreach (GuideQuest q in _c.Fandom.Guide.Quests) Add(q);
|
||||
_gRows.Sort((a, b) =>
|
||||
{
|
||||
int k = order[a.Key].CompareTo(order[b.Key]);
|
||||
return k != 0 ? k : string.Compare(a.Label, b.Label, StringComparison.OrdinalIgnoreCase);
|
||||
});
|
||||
}
|
||||
|
||||
private GuideRow ContractRow(GuideContract c)
|
||||
{
|
||||
var r = new GuideRow { Key = "c:" + c.Title, Label = c.Name, C = c };
|
||||
// The state of the quest it is for (the first the wiki knows).
|
||||
foreach (string t in c.Quests)
|
||||
if (_c.FindWiki(t) is GuideQuest q)
|
||||
{
|
||||
GuideRow qr = WikiRow(q);
|
||||
if (qr.Status.Length > 0 && qr.Status != "no stamps") { r.Status = qr.Status; r.Color = qr.Color; r.Done = qr.Done; return r; }
|
||||
break;
|
||||
}
|
||||
if (c.Level.Length > 0) { r.Status = "L" + c.Level; r.Color = UiColors.Grey; }
|
||||
return r;
|
||||
}
|
||||
|
||||
private void ContractRows(string[] terms, bool hide)
|
||||
{
|
||||
foreach (GuideContract c in _c.Fandom.Guide.Contracts)
|
||||
{
|
||||
if (!MatchesAll($"{c.Name} {c.Description} {c.Where} {string.Join(" ", c.Quests)}", terms)) continue;
|
||||
GuideRow r = ContractRow(c);
|
||||
if (hide && r.Done) continue;
|
||||
_gRows.Add(r);
|
||||
}
|
||||
_gRows.Sort((a, b) => string.Compare(a.Label, b.Label, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
private void DrawContract(UiWindow w, GuideContract c)
|
||||
{
|
||||
w.TextColored(UiColors.Gold, c.Name);
|
||||
if (c.Level.Length > 0) w.TextDisabled("Recommended level " + c.Level);
|
||||
if (c.Description.Length > 0) w.TextWrapped(c.Description);
|
||||
if (c.Where.Length > 0)
|
||||
{
|
||||
w.Text("Where: " + c.Where);
|
||||
if (c.Npc.Length > 0)
|
||||
{
|
||||
w.SmallButton("Go to " + Cut(c.Npc, 28), "g.c.go", () => _gMsg = SendRynthNav("go", new[] { c.Npc }));
|
||||
w.Tooltip("RynthNav goes to " + c.Npc + ".");
|
||||
}
|
||||
}
|
||||
if (c.Quests.Count > 0)
|
||||
{
|
||||
w.Spacing();
|
||||
w.Text(c.Quests.Count == 1 ? "The quest it is for:" : "The quests it is for:");
|
||||
for (int i = 0; i < c.Quests.Count; i++)
|
||||
{
|
||||
string t = c.Quests[i];
|
||||
GuideQuest? q = _c.FindWiki(t);
|
||||
if (q == null) { w.TextDisabled(" " + t + " (no quest page on the wiki)"); continue; }
|
||||
GuideRow qr = WikiRow(q);
|
||||
w.SmallButton("Open##g.c.q" + i, "g.c.q." + i, () => { _gTab = GuideTab.Wiki; _gPage = 0; _gSel = "w:" + q.Title; _gSearch = ""; });
|
||||
w.Tooltip("Opens the quest: its steps, Run this quest and its loot profile.");
|
||||
w.SameLine();
|
||||
w.Text(q.Title);
|
||||
if (qr.Status.Length > 0)
|
||||
{
|
||||
w.SameLine();
|
||||
w.TextColored(qr.Color, qr.Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
w.Spacing();
|
||||
w.TextDisabled("From the AC Community Wiki: " + c.Url);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,11 +10,7 @@ internal sealed partial class OracleView
|
|||
{
|
||||
private void DrawSociety(UiWindow w)
|
||||
{
|
||||
CharacterSnapshot c = _c.Character;
|
||||
var s = new SocietyStanding(
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyCelhan),
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyEldweb),
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyRadblo));
|
||||
SocietyStanding s = Standing();
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
DateTime now = _c.UtcNow;
|
||||
|
||||
|
|
|
|||
251
Plugins/RynthCore.Plugin.RynthOracle/Views/T11Tab.cs
Normal file
251
Plugins/RynthCore.Plugin.RynthOracle/Views/T11Tab.cs
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
// The ILT Tracker window (Infinite Leaftide only). Was the T11 Tracking Oracle tab (2026-11-11), renamed
|
||||
// ILT Tracker (2026-11-21), then moved off the Oracle tab strip onto its own RynthCore bar button
|
||||
// (2026-11-22, Silentkelpie: "turn it into its own icon on the bar like conquest"). Hub pages live in
|
||||
// RynthILT's "ILT Features" bar window. Item bounties, levelled charms / infusion, school gems, lum
|
||||
// tokens, T11 gear, quest bonus / QB Deeds and the wiki login how-to. Data: Data/T11Tracking.cs
|
||||
// (T11Scanner), read while this window is open; Views/IltTrackerTab.cs for QB + wiki.
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
/// <summary>Bar window title (also the old tab name; kept for /ro tracker and saved settings).</summary>
|
||||
public const string TabT11 = "ILT Tracker";
|
||||
/// <summary>The tab's name before 2026-11-21: a saved tab of that name opens the ILT Tracker window.</summary>
|
||||
public const string TabT11Old = "T11 Tracking";
|
||||
private static readonly uint T11Gold = UiFormat.Rgb(230, 190, 90);
|
||||
private string _t11Msg = "";
|
||||
|
||||
/// <summary>Help text for the ILT Tracker window's Refresh button.</summary>
|
||||
public string IltTrackerHelp =>
|
||||
"Asks for /bonus and the /qb list, re-reads your packs and bounty slots (/bounty sync), and checks your gear's T11 modifiers.";
|
||||
|
||||
private RefreshResult RefreshT11()
|
||||
{
|
||||
_c.T11.ForgetAsked();
|
||||
_c.RescanT11();
|
||||
bool sent = _c.Send("/bounty sync");
|
||||
if (sent)
|
||||
{
|
||||
_c.Send("/bonus");
|
||||
_c.Send("/ilt qb");
|
||||
}
|
||||
StartGearCheck();
|
||||
return new RefreshResult(sent
|
||||
? "Asked for your XP multipliers (/bonus), the /qb list and your bounty slots (/bounty sync), re-read your packs and checked your gear."
|
||||
: "Re-read your packs and checked your gear.");
|
||||
}
|
||||
|
||||
/// <summary>The standalone ILT Tracker bar window body (Refresh + the old ILT Tracker tab page).</summary>
|
||||
public void DrawIltTracker(UiWindow w)
|
||||
{
|
||||
w.Button("Refresh", "ilttracker.refresh", () =>
|
||||
{
|
||||
RefreshResult r = RefreshT11();
|
||||
_t11Msg = r.What;
|
||||
}, small: true);
|
||||
w.Tooltip(IltTrackerHelp);
|
||||
w.SameLine();
|
||||
w.TextDisabled("Hub pages (Banking, Gear, Charms, …): the ILT Features button on the bar.");
|
||||
w.Separator();
|
||||
DrawT11(w);
|
||||
}
|
||||
|
||||
private void DrawT11(UiWindow w)
|
||||
{
|
||||
T11Scanner t = _c.T11;
|
||||
if (_t11Msg.Length > 0) w.TextColored(UiColors.Yellow, _t11Msg);
|
||||
DrawIltQuestBonus(w);
|
||||
DrawIltBonusTracker(w);
|
||||
DrawT11Bounties(w, t);
|
||||
DrawT11Charms(w, t);
|
||||
DrawT11SchoolGems(w, t);
|
||||
DrawT11Tokens(w, t);
|
||||
DrawT11Gear(w);
|
||||
DrawIltWikiGuide(w);
|
||||
}
|
||||
|
||||
// ── Item bounties ────────────────────────────────────────────────────
|
||||
|
||||
private void DrawT11Bounties(UiWindow w, T11Scanner t)
|
||||
{
|
||||
int active = t.Slots.Count(s => !s.Empty);
|
||||
if (!w.CollapsingHeader($"Item bounties ({active} active, {t.Bounties.Count} carried)", "t11.h.bounty", defaultOpen: true)) return;
|
||||
w.SmallButton("Sync", "t11.b.sync", () => _t11Msg = _c.Send("/bounty sync") ? "Asked the server for your bounty slots." : "Log in first.");
|
||||
w.Tooltip("/bounty sync: the server sends your slots again (no chat).");
|
||||
w.SameLine();
|
||||
w.SmallButton("/bounty", "t11.b.list", () => _c.Send("/bounty"));
|
||||
w.Tooltip("The server's text view: the kill bounties where you stand, then your slots.");
|
||||
w.SameLine();
|
||||
w.SmallButton("Kill bounties", "t11.b.panel", () => _t11Msg = _c.RunCommand("/rc bounties show") ? "" : "RynthCore's Bounties panel isn't there (it needs RynthILT).");
|
||||
w.Tooltip("RynthCore's Bounties panel: every kill bounty on the server and your progress on each.");
|
||||
|
||||
if (t.Slots.Count == 0)
|
||||
w.TextDisabled(t.BountyText.Length == 0
|
||||
? "No bounty slots from the server yet (Sync asks for them; the server needs item bounties on)."
|
||||
: "The server's bounty format isn't one this RynthOracle reads (update RynthOracle).");
|
||||
foreach (ItemBountySlot s in t.Slots)
|
||||
{
|
||||
w.TextColored(UiColors.Gold, s.Key);
|
||||
w.SameLine(40f);
|
||||
if (s.Empty)
|
||||
{
|
||||
w.TextDisabled(s.Key.StartsWith("R", StringComparison.Ordinal) ? "empty: use a bounty on a ring to start it here" : "empty: use a bounty on a bracelet to start it here");
|
||||
continue;
|
||||
}
|
||||
w.Text(Cut(s.Name, 34));
|
||||
w.Tooltip(s.Name + "\n" + s.Task + (s.Reward.Length > 0 ? "\nReward: " + s.Reward : "") + (s.RewardUse.Length > 0 ? "\n" + s.RewardUse : ""));
|
||||
w.SameLine(300f);
|
||||
string count = s.Kills > 0
|
||||
? $"{s.Progress.ToString("0.##", CultureInfo.InvariantCulture)} / {s.Kills:N0}"
|
||||
: $"{s.Progress.ToString("0.##", CultureInfo.InvariantCulture)} / ?";
|
||||
w.ProgressBar(s.Fraction, 170f, 0f, count);
|
||||
w.SameLine();
|
||||
w.TextDisabled((s.Species && s.Target.Length > 0 ? s.Target + ", " : "") + (s.PlaceShort.Length > 0 ? s.PlaceShort : "T" + s.Tier));
|
||||
if (s.Reward.Length > 0)
|
||||
{
|
||||
w.Dummy(1f, 0f);
|
||||
w.SameLine(40f);
|
||||
w.TextDisabled("Reward: " + s.Reward + (s.Kills > 0 && s.Left > 0 ? $" | {s.Left.ToString("N0", CultureInfo.InvariantCulture)} kills to go" : ""));
|
||||
}
|
||||
}
|
||||
if (t.Bounties.Count > 0)
|
||||
{
|
||||
w.Spacing();
|
||||
w.TextColored(T11Gold, "Carried, not started (use one on a ring or bracelet):");
|
||||
foreach (T11Item b in t.Bounties)
|
||||
{
|
||||
w.BulletText(b.Stack > 1 ? $"{b.Name} x{b.Stack}" : b.Name);
|
||||
w.Tooltip(b.Desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Levelled charms and infusion ─────────────────────────────────────
|
||||
|
||||
private void DrawT11Charms(UiWindow w, T11Scanner t)
|
||||
{
|
||||
long coins = t.InfusionCoins;
|
||||
if (!w.CollapsingHeader($"Levelled charms and infusion ({t.Charms.Count} charms, {coins:N0} coins in gems)", "t11.h.charms", defaultOpen: true)) return;
|
||||
w.TextDisabled("Level 1-100, T11+ only (held to the zone's cap). A Charm Infusion Gem used on a charm puts its coins in.");
|
||||
if (t.Charms.Count == 0)
|
||||
w.TextDisabled("No levelled charm carried (Split Arrow, Chain, Pandemic, Improved Cleave, Armor Breaker, Shield Arc).");
|
||||
foreach (LevelledCharmRow c in t.Charms)
|
||||
{
|
||||
w.TextColored(c.Active ? UiColors.Green : UiColors.Grey, c.Active ? "ON " : "OFF");
|
||||
w.SameLine(40f);
|
||||
w.Text(c.Name);
|
||||
w.SameLine(170f);
|
||||
if (!c.Known)
|
||||
{
|
||||
w.TextDisabled("reading its level...");
|
||||
continue;
|
||||
}
|
||||
float frac = c.Level >= 100 ? 1f : c.PercentToNext / 100f;
|
||||
w.ProgressBar(frac, 150f, 0f, c.Level >= 100 ? "Level 100 (max)" : $"Level {c.Level} ({c.PercentToNext}%)");
|
||||
w.SameLine();
|
||||
w.TextDisabled($"{c.CoinsIn:N0} coins in" + (c.Level < 100 && c.CoinsToNext > 0 ? $", {c.CoinsToNext:N0} to level {c.Level + 1}" : ""));
|
||||
if (c.Level < 100 && c.CoinsToNext > 0 && coins > 0)
|
||||
w.Tooltip(coins >= c.CoinsToNext
|
||||
? $"Your gems hold {coins:N0} coins: enough for level {c.Level + 1}."
|
||||
: $"Your gems hold {coins:N0} coins: {c.CoinsToNext - coins:N0} short of level {c.Level + 1}.");
|
||||
uint id = c.Id;
|
||||
w.SameLine();
|
||||
w.SmallButton("Toggle", "t11.c.t." + id, () => _t11Msg = _c.IltData.ToggleCharm(_c.Host, _c.NowMs, id) ? "" : "RynthILT didn't toggle it (update RynthILT, or the charm moved).");
|
||||
}
|
||||
w.Spacing();
|
||||
if (t.Infusion.Count == 0)
|
||||
{
|
||||
w.TextDisabled("No Charm Infusion Gems carried (Enephior sells them 1:1 for Prestige Coins).");
|
||||
return;
|
||||
}
|
||||
w.TextColored(T11Gold, $"Charm Infusion Gems: {coins:N0} coins");
|
||||
w.Text(string.Join(" ", t.Infusion.Select(g =>
|
||||
$"({T11Tracking.InfusionGems[g.Wcid]:N0}) x{g.Stack}")));
|
||||
}
|
||||
|
||||
// ── School gems ──────────────────────────────────────────────────────
|
||||
|
||||
private void DrawT11SchoolGems(UiWindow w, T11Scanner t)
|
||||
{
|
||||
if (!w.CollapsingHeader($"School gems ({t.SchoolGems.Sum(g => g.Stack)} carried)", "t11.h.school", defaultOpen: true)) return;
|
||||
w.TextDisabled("T15-T25: +1 to a school past the 4,000 cap, up to the tier's ceiling (4,500 at T15 ... 9,500 at T25). Only the earner can use one.");
|
||||
foreach (var (wcid, school, kind) in T11Tracking.SchoolGems)
|
||||
{
|
||||
var mine = t.SchoolGems.Where(g => g.Wcid == wcid).ToList();
|
||||
w.TextColored(mine.Count > 0 ? UiColors.Gold : UiColors.Grey, $"{school} ({kind})");
|
||||
w.SameLine(220f);
|
||||
if (mine.Count == 0) { w.TextDisabled("none"); continue; }
|
||||
var byTier = mine.GroupBy(g => g.GemTier).OrderBy(g => g.Key)
|
||||
.Select(g => (g.Key > 0 ? "T" + g.Key : "tier ?") + " x" + g.Sum(x => x.Stack));
|
||||
w.Text(string.Join(" ", byTier));
|
||||
string earned = mine.Select(g => EarnedBy(g.Desc + "\n" + g.Use)).FirstOrDefault(s => s.Length > 0) ?? "";
|
||||
if (earned.Length > 0) w.Tooltip(earned);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"Earned by Silentkelpie at T16" out of a school gem's text, or "".</summary>
|
||||
private static string EarnedBy(string text)
|
||||
{
|
||||
int i = text.IndexOf("Earned by", StringComparison.OrdinalIgnoreCase);
|
||||
if (i < 0) return "";
|
||||
int end = text.IndexOfAny(new[] { '\n', '\r' }, i);
|
||||
return (end < 0 ? text.Substring(i) : text.Substring(i, end - i)).Trim();
|
||||
}
|
||||
|
||||
// ── Lum tokens ───────────────────────────────────────────────────────
|
||||
|
||||
private void DrawT11Tokens(UiWindow w, T11Scanner t)
|
||||
{
|
||||
int n = t.LumTokens.Sum(g => g.Stack);
|
||||
if (!w.CollapsingHeader($"Lum tokens ({n} carried)", "t11.h.tokens", defaultOpen: n > 0)) return;
|
||||
if (n == 0)
|
||||
{
|
||||
w.TextDisabled("No Bounty Reward Tokens or Event Lum Tokens carried.");
|
||||
return;
|
||||
}
|
||||
foreach (var g in t.LumTokens.GroupBy(x => x.Name).OrderBy(g => g.Key))
|
||||
w.BulletText($"{g.Key} x{g.Sum(x => x.Stack)}");
|
||||
w.SmallButton("Bank them", "t11.tok.bank", () => _t11Msg = _c.Send("/b lum") ? "Sent /b lum: the tokens go to your banked luminance." : "Log in first.");
|
||||
w.Tooltip("/b lum: every luminance token in your packs is banked as luminance (a double click banks one).");
|
||||
}
|
||||
|
||||
// ── T11 gear (moved from the Gear tab) ───────────────────────────────
|
||||
|
||||
private void DrawT11Gear(UiWindow w)
|
||||
{
|
||||
RatingsReport? r = _c.Gear.Ratings;
|
||||
var rows = r == null ? new List<RatingRow>() : r.Rows.Where(x => x.T11.Length > 0).ToList();
|
||||
if (!w.CollapsingHeader($"T11 gear ({rows.Count} item(s))", "t11.h.gear", defaultOpen: true)) return;
|
||||
w.SmallButton(_c.Gear.Busy ? "Checking..." : "Check gear", "t11.g.check", StartGearCheck);
|
||||
w.Tooltip("The Gear tab's Check: worn items (and packs, when its option is on) are appraised, then their T11 modifiers listed here.");
|
||||
if (r == null)
|
||||
{
|
||||
w.TextDisabled("Press Check gear to read your T11 gear's modifiers.");
|
||||
return;
|
||||
}
|
||||
if (r.T11Totals.Count > 0)
|
||||
w.TextColored(T11Teal, "T11 worn: " + string.Join(" | ", r.T11Totals.Select(x => x.Name + " " + x.Value)));
|
||||
if (rows.Count == 0)
|
||||
{
|
||||
w.TextDisabled("No T11 gear read (worn" + (r.IncludePack ? " or in your packs" : "; the Gear tab's \"Include pack items\" adds your packs") + ").");
|
||||
return;
|
||||
}
|
||||
foreach (RatingRow row in rows.OrderByDescending(x => x.Piece.Equipped))
|
||||
{
|
||||
GearPiece p = row.Piece;
|
||||
w.TextColored(p.Equipped ? WornGreen : PackGrey, p.Equipped ? "Worn" : "Pack");
|
||||
w.SameLine(45f);
|
||||
w.TextColored(p.ZoneLocked ? UiColors.Yellow : UiFormat.Rgb(230, 230, 230), Cut(p.Name, 30));
|
||||
w.Tooltip(p.Name + (p.ZoneLocked ? "\nZone locked: power reduced outside its zone." : ""));
|
||||
w.SameLine(260f);
|
||||
w.TextWrapped(row.T11);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue