Snapshot for release 2026.10.20.1 (internal 7116fab)
This commit is contained in:
parent
2a20c7acd6
commit
bfcd48950d
215 changed files with 16200 additions and 2838 deletions
872
Tools/RynthOracle.Tests/MergedQuestsTests.cs
Normal file
872
Tools/RynthOracle.Tests/MergedQuestsTests.cs
Normal file
|
|
@ -0,0 +1,872 @@
|
|||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RynthCore.Plugin.RynthOracle;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
using RynthCore.Plugin.RynthOracle.Views;
|
||||
using IltBreedingView = RynthCore.Plugin.Shared.IltBreedingView;
|
||||
using IltGuardianView = RynthCore.Plugin.Shared.IltGuardianView;
|
||||
|
||||
namespace RynthOracle.Tests
|
||||
{
|
||||
// The 0.3.0 port of SilentKelpie's RynthOracle 0.6.0 (RynthSuite PR 12): the merged Quests list
|
||||
// (Legendary, Markers, Dynamic Stamps and Temple guardians), Go to, the Give Parchment gate, the two
|
||||
// CSV loaders, the RynthILT profile and the Charms / Pet Breeding pieces. Ported from his tests where
|
||||
// they fit, adapted where our tree differs (the Refresh row, the Mini Remote keeping its tabs), and
|
||||
// added for what the merge must keep (favourites, click-to-print, the Markers tab's content).
|
||||
internal static partial class Program
|
||||
{
|
||||
// ── Helpers ──────────────────────────────────────────────────────────
|
||||
|
||||
private static uint _seq = 5000;
|
||||
|
||||
private static string Body(UiWindow w) => Encoding.UTF8.GetString(w.Body);
|
||||
|
||||
/// <summary>One draw of the main window, parsed by the engine's own parser (ops under the limit), body returned.</summary>
|
||||
private static string Frame(UiHost host, UiWindow main, OracleView view, string what, out int ops)
|
||||
{
|
||||
main.Begin(); view.Draw(main); main.End();
|
||||
ParseAll(host, what, out ops);
|
||||
string body = Body(main);
|
||||
main.MarkSubmitted(true);
|
||||
return body;
|
||||
}
|
||||
|
||||
private static string Frame(UiHost host, UiWindow main, OracleView view, string what) => Frame(host, main, view, what, out _);
|
||||
|
||||
private static void Click(UiHost host, UiWindow w, string id) => Apply(host, Event(1, ++_seq, w.Hash, w.KeyOf(id), new byte[] { 1, 0, 0 }));
|
||||
|
||||
private static void Tick(UiHost host, UiWindow w, string id, bool on) => Apply(host, Event(2, ++_seq, w.Hash, w.KeyOf(id), new byte[] { (byte)(on ? 1 : 0) }));
|
||||
|
||||
private static void Type(UiHost host, UiWindow w, string id, string text)
|
||||
{
|
||||
byte[] t = Encoding.UTF8.GetBytes(text);
|
||||
var payload = new byte[3 + t.Length];
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(payload.AsSpan(1), (ushort)t.Length);
|
||||
t.CopyTo(payload, 3);
|
||||
Apply(host, Event(5, ++_seq, w.Hash, w.KeyOf(id), payload));
|
||||
}
|
||||
|
||||
/// <summary>A context on a given server (a tag, or "" for retail) with the retail catalog loaded.</summary>
|
||||
private static OracleContext On(string tag)
|
||||
{
|
||||
OracleContext c = Context();
|
||||
c.Server.Force(tag, tag.Length > 0 ? tag : "Coldeve");
|
||||
c.Catalog.Load(tag, null);
|
||||
c.Catalog.SyncDiscoveries(c.Flags);
|
||||
return c;
|
||||
}
|
||||
|
||||
// ── The CSV lists ────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The Legendary list (legendary.csv) and its have / missing / timer rules.</summary>
|
||||
private static void Legendary()
|
||||
{
|
||||
Check(LegendaryList.All.Count == 40, $"legendary quests: {LegendaryList.All.Count} (40 expected)");
|
||||
Check(LegendaryList.Groups.SequenceEqual(new[] { "Graveyard", "Rynthid", "Hoshino", "Frozen Valley", "Neftet", "Random Locations" }),
|
||||
"legendary groups: " + string.Join(",", LegendaryList.Groups));
|
||||
Check(LegendaryList.All.All(q => q.Flags.Length > 0 && q.Luminance > 0), "every legendary quest has a flag and luminance");
|
||||
var catalog = new QuestCatalog();
|
||||
catalog.Load("", _ => { });
|
||||
var unknown = LegendaryList.All.SelectMany(q => q.Flags).Where(f => !catalog.TryGet(f, out _)).ToList();
|
||||
Check(unknown.Count == 0, "every legendary flag is a known quest flag: " + string.Join(",", unknown));
|
||||
LegendaryQuest rtw = LegendaryList.All.First(q => q.CommonName == "RTW");
|
||||
Check(rtw.Flags[0] == "rtwcompleted_1013" && rtw.Label == "Defeating the Curator of Torment (RTW)", "RTW row: " + rtw.Label);
|
||||
|
||||
var lf = new QuestFlagStore();
|
||||
long t = 900_000;
|
||||
long done = DateTimeOffset.UtcNow.AddHours(-2).ToUnixTimeSeconds();
|
||||
long old = DateTimeOffset.UtcNow.AddDays(-3).ToUnixTimeSeconds();
|
||||
// RTW done 2 h ago on a 20 h timer; End of Days done 3 days ago (ready); Lugian Assault never.
|
||||
lf.OnChatLine($"rtwcompleted_1013 - 4 solves ({done})\"RTW\" -1 72000", t);
|
||||
lf.OnChatLine($"eodcompleted_1013 - 1 solves ({old})\"EoD\" -1 72000", t + 1);
|
||||
lf.OnChatLine($"legendaryquestcounter_0913 - 12 solves ({old})\"John\" -1 0", t + 2);
|
||||
lf.Tick(t + 5_000);
|
||||
DateTime now = DateTime.UtcNow;
|
||||
TimeSpan? rtwLeft = rtw.TimeLeft(lf, now);
|
||||
Check(rtw.Have(lf) && rtwLeft is { } l && l.TotalHours > 17.9 && l.TotalHours < 18.1, $"RTW: done, ~18 h left ({rtwLeft})");
|
||||
LegendaryQuest eod = LegendaryList.All.First(q => q.CommonName == "EoD");
|
||||
Check(eod.Have(lf) && eod.Status(lf, now) == "ready", "EoD: done, timer up -> ready: " + eod.Status(lf, now));
|
||||
LegendaryQuest la = LegendaryList.All.First(q => q.CommonName == "LA");
|
||||
Check(!la.Have(lf) && la.TimeLeft(lf, now) == null && la.Status(lf, now) == "missing", "Lugian Assault: missing");
|
||||
Check(LegendaryList.JohnCount(lf) == 12, "John's counter read: " + LegendaryList.JohnCount(lf));
|
||||
Check(LegendaryList.JohnCount(new QuestFlagStore()) == null, "no counter on a fresh character");
|
||||
|
||||
// A quest with a second timer flag: the longest wait of the two counts.
|
||||
LegendaryQuest erq = LegendaryList.All.First(q => q.Name == "Empyrean Rescue Quest");
|
||||
var ef = new QuestFlagStore();
|
||||
ef.OnChatLine($"empyreanrescuecompleted_1010 - 1 solves ({old})\"ERQ\" -1 0", t);
|
||||
ef.OnChatLine($"erqlegkeypickuptimer - 1 solves ({done})\"key\" -1 36000", t + 1);
|
||||
ef.Tick(t + 5_000);
|
||||
TimeSpan? erqLeft = erq.TimeLeft(ef, now);
|
||||
Check(erqLeft is { } e && e.TotalHours > 7.9 && e.TotalHours < 8.1, $"ERQ: key pickup timer decides (~8 h): {erqLeft}");
|
||||
}
|
||||
|
||||
/// <summary>The Dynamic Stamps list (dynstamps.csv), its have / missing rules, RynthNav targets and the Go to parser.</summary>
|
||||
private static void DynamicStamps()
|
||||
{
|
||||
var all = DynamicStampList.All;
|
||||
Check(all.Count == 243, $"dynamic stamps: {all.Count} (243 expected from the ExtraDyn sheet)");
|
||||
Check(DynamicStampList.Areas.Count == 17 && DynamicStampList.Areas[0] == "Facility Hub" && DynamicStampList.Areas[^1] == "Candeth Keep",
|
||||
"dynamic areas: " + string.Join(",", DynamicStampList.Areas));
|
||||
Check(all.All(s => s.Stamp.StartsWith("dynamic_") && s.Stamp == s.Stamp.ToLowerInvariant()), "every stamp is a lower-case dynamic_ flag");
|
||||
Check(all.Select(s => s.Stamp).Distinct().Count() == all.Count, "no stamp listed twice");
|
||||
Check(all.All(s => s.Label.Length > 0), "every row names an NPC or a place");
|
||||
|
||||
DynamicStamp felscuda = all.First(s => s.Npc == "Felscuda");
|
||||
Check(felscuda.Stamp == "dynamic_1_&9jiytb!" && felscuda.Place == "Folthid Cellar" && felscuda.Reward == "Healing Rabbit Pie"
|
||||
&& felscuda.Note == "8.8S, 53.1E", $"Felscuda row: {felscuda.Place} / {felscuda.Reward} / {felscuda.Note}");
|
||||
|
||||
// /myquests keys flags as \S+ lower case, so the stamps' ! & # ^ $ survive.
|
||||
var f = new QuestFlagStore();
|
||||
long t = 900_000, at = DateTimeOffset.UtcNow.AddDays(-1).ToUnixTimeSeconds();
|
||||
f.OnChatLine($"Dynamic_1_&9jiyTB! - 1 solves ({at})\"Dynamic\" 1 0", t);
|
||||
f.OnChatLine($"Dynamic_1_ANND! - 1 solves ({at})\"Dynamic\" 1 0", t + 1); // the sheet lost the closing !
|
||||
f.OnChatLine($"Dynamic_1_ZZZnewNPC! - 1 solves ({at})\"Dynamic\" 1 0", t + 2); // not on the sheet
|
||||
f.OnChatLine($"rtwcompleted_1013 - 1 solves ({at})\"RTW\" -1 72000", t + 3);
|
||||
f.Tick(t + 5_000);
|
||||
Check(felscuda.Have(f), "Felscuda's stamp read from /myquests");
|
||||
DynamicStamp annd = all.First(s => s.Stamp == "dynamic_1_annd");
|
||||
Check(annd.Have(f) && annd.MatchedFlag(f) == "dynamic_1_annd!", "a stamp the sheet lost its ! on still matches");
|
||||
Check(!all.First(s => s.Npc == "Raxanza Folthid").Have(f), "an NPC not done is missing");
|
||||
List<string> extra = DynamicStampList.Unlisted(f);
|
||||
Check(extra.Count == 1 && extra[0] == "dynamic_1_zzznewnpc!", "unlisted: only the stamp the sheet doesn't have: " + string.Join(",", extra));
|
||||
DynamicStamp shortStamp = all.First(s => s.Stamp == "dynamic_1_s");
|
||||
var sf = new QuestFlagStore();
|
||||
sf.OnChatLine($"Dynamic_1_SomethingElse! - 1 solves ({at})\"Dynamic\" 1 0", t);
|
||||
sf.Tick(t + 5_000);
|
||||
Check(!shortStamp.Have(sf), "a cut-short stem under 14 characters isn't matched by prefix");
|
||||
|
||||
// RynthNav targets, best first (RynthNav takes the first on its map).
|
||||
Check(string.Join(" | ", felscuda.NavCandidates()) == "8.8S, 53.1E | Folthid Cellar | Felscuda | Facility Hub",
|
||||
"Felscuda nav: " + string.Join(" | ", felscuda.NavCandidates()));
|
||||
var gerent = new DynamicStamp { Area = "Graveyard", Place = "Gerent's Compound at 87.2S, 17.5W", Npc = "Gerent" };
|
||||
Check(string.Join(" | ", gerent.NavCandidates()) == "87.2S, 17.5W | Gerent's Compound | Gerent | Graveyard",
|
||||
"coordinates inside the place, 'at' dropped: " + string.Join(" | ", gerent.NavCandidates()));
|
||||
var lost = new DynamicStamp { Area = "Odd Stamps", Place = "Lost Wish Cottages (Arwic) 42.6n 62.4e", Npc = "Bob" };
|
||||
Check(string.Join(" | ", lost.NavCandidates()) == "42.6N, 62.4E | Lost Wish Cottages (Arwic) | Lost Wish Cottages | Arwic",
|
||||
"lower-case n/e, a bracketed town, no grouping area, a 3-letter NPC left out: " + string.Join(" | ", lost.NavCandidates()));
|
||||
var mhoire = new DynamicStamp { Area = "Looking Around", Place = "Mhoire Castle - Great Hall" };
|
||||
Check(string.Join(" | ", mhoire.NavCandidates()) == "Mhoire Castle - Great Hall | Mhoire Castle | Great Hall",
|
||||
"a place's parts: " + string.Join(" | ", mhoire.NavCandidates()));
|
||||
Check(all.Count(s => s.NavCandidates().Count > 0) >= 200, "most stamps have somewhere to go: " + all.Count(s => s.NavCandidates().Count > 0));
|
||||
}
|
||||
|
||||
/// <summary>Coordinates in a quest's notes become RynthNav targets (Go to).</summary>
|
||||
private static void GoToParsing()
|
||||
{
|
||||
var grael = NavTargets.Stops("Give Progenitor's Ichor to Hoshar. - Speak with Hoshar ibn Jalaq 59.6S 88.0W - Kill Mukkir Progenitor 86.5N 57.3E"
|
||||
+ " - Speak with Hoshar ibn Jalaq - Abyssal Totem Gateway 86.5N 57.3E - Abyssal Totem Temple 86.5N 57.3E");
|
||||
Check(string.Join(" | ", grael.ConvertAll(s => s.Display)) == "Speak with Hoshar ibn Jalaq - 59.6S, 88.0W | Kill Mukkir Progenitor - 86.5N, 57.3E",
|
||||
"Splitting Grael stops: " + string.Join(" | ", grael.ConvertAll(s => s.Display)));
|
||||
Check(grael[0].Target == "59.6S, 88.0W Speak with Hoshar ibn Jalaq", "a stop's RynthNav target is the coordinates, then its label");
|
||||
var shadow = NavTargets.Stops("Xarabydun 41.8S 15.8E - Speak with Ciandra Arcanum Alchemist - Empyrean Workshop 66.9N 15.9E - Cragstone 26.0N 47.0E Speak with Bretself the Translator - Xarabydun - Shade of Farelaith 74.3N 58.6E");
|
||||
Check(string.Join(" | ", shadow.ConvertAll(s => s.Label)) == "Xarabydun | Empyrean Workshop | Cragstone | Shade of Farelaith",
|
||||
"Shadowfire Stone labels: " + string.Join(" | ", shadow.ConvertAll(s => s.Label)));
|
||||
Check(NavTargets.Stops("Kill 20 drudges near Holtburg.").Count == 0, "no coordinates: no stops");
|
||||
Check(NavTargets.Stops(null).Count == 0 && NavTargets.Stops("").Count == 0, "no text: no stops");
|
||||
Check(NavTargets.Stops("Meet at 42.6n 62.4e").Count == 1 && NavTargets.Stops("Meet at 42.6n 62.4e")[0].Display == "Meet - 42.6N, 62.4E",
|
||||
"lower-case letters; 'at' dropped from the label");
|
||||
Check(NavTargets.FirstCoords("go to 8.8S, 53.1E now") == "8.8S, 53.1E" && NavTargets.FirstCoords("nowhere") == null, "the first coordinates in a text");
|
||||
Check(NavTargets.WithoutCoords("Hall 8.8S, 53.1E door").Contains("Hall") && !NavTargets.WithoutCoords("Hall 8.8S, 53.1E door").Contains("53.1"),
|
||||
"the text without its coordinates");
|
||||
Check(NavTargets.Place(" Holtburg ").Target == "Holtburg", "a named place is its own target");
|
||||
}
|
||||
|
||||
/// <summary>Both CSV loaders: counts from the shipped files, and a malformed file doesn't cost the good rows.</summary>
|
||||
private static void Loaders()
|
||||
{
|
||||
// The shipped files: counts, and they are embedded resources (the way the other lists are).
|
||||
Check(LegendaryList.All.Count == 40 && DynamicStampList.All.Count == 243, "the shipped lists load: 40 Legendary quests, 243 stamps");
|
||||
Check(MarkerList.All.Count == 100, "the shipped marker list still has its 100 markers");
|
||||
|
||||
var rows = LegendaryList.Parse(new StringReader(
|
||||
"Group,Quest,CommonName,Luminance,Flags,Url,Note,Video\n"
|
||||
+ "\"G\",\"Good\",\"GD\",5000,\"a_flag;B_Flag\",\"https://x\",\"a note, with a comma\",\"\"\n"
|
||||
+ "\"G\",\"\",\"\",1,\"x\",\"\",\"\",\"\"\n" // no quest name: skipped
|
||||
+ "\"G\",\"ShortRow\",\"\",abc\n" // short row, luminance isn't a number
|
||||
+ "\n"
|
||||
+ "just one field\n"
|
||||
+ "\"G\",\"After\",\"\",7,\"c_flag\"\n"));
|
||||
Check(rows.Count == 3 && rows[0].Name == "Good" && rows[1].Name == "ShortRow" && rows[2].Name == "After",
|
||||
"legendary: bad rows skipped, the rest kept: " + string.Join(",", rows.Select(r => r.Name)));
|
||||
Check(rows[0].Flags.SequenceEqual(new[] { "a_flag", "b_flag" }) && rows[0].Luminance == 5000 && rows[0].Note == "a note, with a comma"
|
||||
&& rows[0].Label == "Good (GD)", "legendary: flags lower-cased and split, quoted commas kept, the short name in the label");
|
||||
Check(rows[1].Luminance == 0 && rows[1].Flags.Length == 0 && rows[1].Url == "", "legendary: a short row reads as empty, luminance 0");
|
||||
Check(LegendaryList.Parse(new StringReader("")).Count == 0 && LegendaryList.Parse(new StringReader("Group,Quest\n")).Count == 0,
|
||||
"legendary: an empty file is an empty list");
|
||||
Check(LegendaryList.Parse(new StringReader("Quest\r\nCRLF Quest\r\n")).Single().Name == "CRLF Quest", "legendary: CRLF lines");
|
||||
|
||||
var stamps = DynamicStampList.Parse(new StringReader(
|
||||
"Area,Place,Npc,Reward,Stamp,Note\n"
|
||||
+ "\"A\",\"P\",\"Npc1\",\"R\",\"Dynamic_1_Abc!\",\"8.8S, 53.1E\"\n"
|
||||
+ "\"A\",\"P\",\"Dup\",\"R\",\"dynamic_1_abc!\",\"\"\n" // the same stamp again: skipped
|
||||
+ "\"A\",\"P\",\"NotDyn\",\"R\",\"something_else\",\"\"\n" // not a dynamic_ flag: skipped
|
||||
+ "\"A\",\"P\",\"Short\"\n" // no stamp column: skipped
|
||||
+ "\n"
|
||||
+ "\"B\",\"\",\"\",\"\",\"Dynamic_2_x\",\"\"\n"));
|
||||
Check(stamps.Count == 2 && stamps[0].Stamp == "dynamic_1_abc!" && stamps[1].Stamp == "dynamic_2_x",
|
||||
"dynamic: bad and repeated rows skipped, the rest kept: " + string.Join(",", stamps.Select(s => s.Stamp)));
|
||||
Check(stamps[0].Npc == "Npc1" && stamps[0].Note == "8.8S, 53.1E" && stamps[1].Label == "", "dynamic: fields read, a missing NPC and place leave an empty label");
|
||||
Check(DynamicStampList.Parse(new StringReader("")).Count == 0, "dynamic: an empty file is an empty list");
|
||||
|
||||
// The markers file is the existing loader; a marker row still parses to its flag bit.
|
||||
Marker m = MarkerList.All[0];
|
||||
Check(m.Number == 1 && m.Flag.StartsWith("explorationmarkersfoundingroup") && m.BitMask == 1, "marker 1 keeps its quest flag bit");
|
||||
}
|
||||
|
||||
// ── RynthILT's profile, charms and pet breeding ──────────────────────
|
||||
|
||||
private const string QbProfileJson = "{\"ilt\":true,\"world\":\"InfiniteLeaftide\",\"fellowship\":{\"maxMembers\":29},"
|
||||
+ "\"questBonus\":{\"disabled\":false,\"generation\":3,\"count\":41,\"status\":\"2 completed, 1 incomplete\","
|
||||
+ "\"completed\":[\"qbflagone\",\"qbflagtwo\"],\"incomplete\":[\"qbflagthree\"]}}";
|
||||
|
||||
/// <summary>RynthILT's "RynthILT.Server" profile JSON as the Quests, About and Pet Breeding pages read it.</summary>
|
||||
private static void IltProfile()
|
||||
{
|
||||
const string json = "{\"ilt\":true,\"world\":\"InfiniteLeaftide\",\"forced\":false,\"source\":\"probe\",\"checked\":\"2026-10-13T21:25:37Z\","
|
||||
+ "\"features\":[{\"key\":\"bank\",\"label\":\"Banking\",\"group\":\"Character\",\"state\":1,\"where\":\"Mini Remote > Banking tab\"},"
|
||||
+ "{\"key\":\"zone_share\",\"label\":\"Zone Share\",\"group\":\"Fellowship\",\"state\":1,\"where\":\"server\"},"
|
||||
+ "{\"key\":\"fellowship_blackjack\",\"label\":\"Fellowship Blackjack\",\"group\":\"Fellowship\",\"state\":0,\"where\":\"/fblackjack\"}],"
|
||||
+ "\"fellowship\":{\"maxMembers\":29,\"zoneShare\":1,\"blackjack\":0,\"luminanceShare\":-1},\"later\":{\"x\":1}}";
|
||||
IltServerProfile p = IltServerProfile.Parse(json);
|
||||
Check(p.Available && p.Ilt && p.World == "InfiniteLeaftide" && p.Source == "probe", "ILT profile header");
|
||||
Check(p.FellowshipMax == 29 && p.ZoneShare == 1 && p.Blackjack == 0 && p.LuminanceShare == -1, "ILT fellowship rules");
|
||||
Check(p.Features.Count == 3 && p.InGroup("Fellowship").Count() == 2, $"ILT features: {p.Features.Count}");
|
||||
Check(p.CheckedUtc == new DateTime(2026, 10, 13, 21, 25, 37, DateTimeKind.Utc), "checked time is UTC: " + p.CheckedUtc.ToString("o"));
|
||||
|
||||
IltServerProfile none = IltServerProfile.Parse("");
|
||||
Check(!none.Available && none.FellowshipMax == 9, "no RynthILT: a retail fellowship");
|
||||
Check(!IltServerProfile.Parse("not json").Available, "garbage is ignored");
|
||||
Check(IltServerProfile.Parse("{\"ilt\":false}").FellowshipMax == 9, "an older profile without fellowship rules: retail size");
|
||||
Check(IltServerProfile.Parse("{\"fellowship\":{\"maxMembers\":5000}}").FellowshipMax == 9, "an absurd size is not believed");
|
||||
Check(IltServerProfile.StateText(1) == "on" && IltServerProfile.StateText(0) == "off" && IltServerProfile.StateText(-1) == "checking", "state words");
|
||||
|
||||
Check(p.QuestBonus == null, "no questBonus object: no /qb list");
|
||||
IltServerProfile qb = IltServerProfile.Parse(QbProfileJson);
|
||||
Check(qb.QuestBonus is { Disabled: false, Generation: 3, Count: 41 } b && b.Completed.Count == 2 && b.Incomplete.Count == 1
|
||||
&& b.Incomplete[0] == "qbflagthree" && b.Status == "2 completed, 1 incomplete", "quest bonus list parsed");
|
||||
|
||||
// The identity: a Leaftide world name, RynthILT's own verdict, and RynthCore's "ilt" server all give the ILT tag.
|
||||
Check(ServerIdentity.TagForWorld("InfiniteLeaftide") == ServerTags.InfiniteLeaftide, "InfiniteLeaftide");
|
||||
Check(ServerIdentity.TagForWorld("Infinite Leaftide Staging") == ServerTags.InfiniteLeaftide, "a Leaftide staging world is ILT");
|
||||
Check(ServerIdentity.TagForEngineId("ilt") == ServerTags.InfiniteLeaftide && ServerIdentity.EngineIdForTag(ServerTags.InfiniteLeaftide) == "ilt",
|
||||
"RynthCore's ilt server <-> the ILT tag");
|
||||
}
|
||||
|
||||
/// <summary>The About page's "Server features" list comes from RynthILT's profile.</summary>
|
||||
private static void ServerFeatures()
|
||||
{
|
||||
OracleContext c = On(ServerTags.InfiniteLeaftide);
|
||||
c.Settings.TabName = OracleView.TabAbout;
|
||||
var view = new OracleView(c);
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
string body = Frame(host, main, view, "About, no RynthILT");
|
||||
Check(body.Contains("Load RynthILT to list the Infinite Leaftide features here."), "ILT without RynthILT: says to load it");
|
||||
c.Ilt.SetJson("{\"ilt\":true,\"world\":\"InfiniteLeaftide\",\"checked\":\"2026-10-13T21:25:37Z\","
|
||||
+ "\"features\":[{\"key\":\"bank\",\"label\":\"Banking\",\"group\":\"Character\",\"state\":1,\"where\":\"Mini Remote > Banking tab\"},"
|
||||
+ "{\"key\":\"pet_breeding\",\"label\":\"Pet breeding\",\"group\":\"Pets\",\"state\":0,\"where\":\"Pets\"}]}");
|
||||
body = Frame(host, main, view, "About, with RynthILT");
|
||||
Check(body.Contains("Server features") && body.Contains("1 of 2 on.") && body.Contains("Character") && body.Contains("###o.feat.h.Pets"),
|
||||
"the features RynthILT lists, grouped, with a count on");
|
||||
Check(body.Contains("o.alert") && body.Contains("o.alertall") && body.Contains("o.readlogin"), "the About settings (quest alerts too) are all still there");
|
||||
Check(body.Contains("/ro trackers") && body.Contains("/ro legendary") && body.Contains("/ro markers") && body.Contains("/ro guardians") && body.Contains("/ro breeding"),
|
||||
"the About page lists the new commands on ILT");
|
||||
}
|
||||
|
||||
private static string BreedingJson(int essences)
|
||||
{
|
||||
var sb = new StringBuilder("{\"available\":true,\"world\":\"InfiniteLeaftide\",\"enabled\":\"on\",\"maturity\":\"on\",\"bond\":\"on\","
|
||||
+ "\"room\":\"landblock 0x0106 variant 2\",\"freeSlots\":12,\"message\":\"\",\"essences\":[");
|
||||
for (int i = 0; i < essences; i++)
|
||||
{
|
||||
if (i > 0) sb.Append(',');
|
||||
bool male = i % 2 == 0, ready = i < 2;
|
||||
sb.Append("{\"id\":").Append(1000 + i).Append(",\"name\":\"Essence ").Append(i).Append("\",\"sex\":\"").Append(male ? 'M' : 'F')
|
||||
.Append("\",\"tier\":125,\"bond\":100,\"ready\":").Append(ready ? "true" : "false")
|
||||
.Append(",\"status\":\"").Append(ready ? "Ready" : "Rest 1h 05m").Append("\",\"readyIn\":").Append(ready ? 0 : 3900)
|
||||
.Append(",\"charges\":7,\"chargesMax\":10,\"juvenile\":false,\"stage\":\"\",\"kills\":0,\"killsRequired\":300,")
|
||||
.Append("\"mutations\":1,\"potencyMutations\":0,\"problems\":").Append(ready ? "[]" : "[\"resting after a breed\"]")
|
||||
.Append(",\"boosters\":").Append(i == 0 ? "[\"Incense +10%\"]" : "[]").Append('}');
|
||||
}
|
||||
sb.Append("],\"pairs\":[{\"stud\":\"Essence 0\",\"dam\":\"Essence 1\",\"chanceBest\":0.13636,\"chanceWorst\":0.05,\"inheritMin\":1,\"inheritMax\":2}],")
|
||||
.Append("\"supplies\":[{\"key\":\"incense1\",\"name\":\"Breeding Incense\",\"effect\":\"+10% mutation chance\",\"count\":2,\"price\":250000,\"apply\":true,\"targets\":[1000,1001]},")
|
||||
.Append("{\"key\":\"neuter\",\"name\":\"Neutering Kit\",\"effect\":\"Permanent\",\"count\":1,\"price\":0,\"apply\":false,\"targets\":[]}],")
|
||||
.Append("\"rules\":[{\"label\":\"Stud charges\",\"value\":\"10/day\",\"source\":\"seen on server\",\"help\":\"Breeds per refill.\"},")
|
||||
.Append("{\"label\":\"Mutation decay\",\"value\":\"0.1\",\"source\":\"ILT profile\",\"help\":\"\"}],")
|
||||
.Append("\"events\":[{\"when\":\"10-15 12:00\",\"kind\":\"birth\",\"text\":\"Congratulations! A baby pet has been born: Pup\"}],")
|
||||
.Append("\"debug\":{\"when\":\"10-15 12:01\",\"enabled\":\"on\",\"location\":\"0x0106 variant 2\",\"match\":\"valid\",\"pet\":\"Essence 0\",\"sex\":\"M\",\"partners\":1}}");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Pet Breeding tab: Infinite Leaftide only and only where the server has pet breeding; RynthILT's
|
||||
/// breeding JSON drawn within the op budget; Dance and supply uses asked first, then sent as RynthILT's verbs.
|
||||
/// </summary>
|
||||
private static void Breeding()
|
||||
{
|
||||
OracleContext c = Context();
|
||||
var view = new OracleView(c);
|
||||
Check(!view.VisibleTabs().Contains(OracleView.TabBreeding), "Aelrynth: no Pet Breeding tab");
|
||||
c.Server.Force("", "Coldeve");
|
||||
Check(!view.VisibleTabs().Contains(OracleView.TabBreeding), "other servers: no Pet Breeding tab");
|
||||
c.Server.Force(ServerTags.InfiniteLeaftide, "InfiniteLeaftide");
|
||||
Check(view.VisibleTabs().Contains(OracleView.TabBreeding), "Infinite Leaftide: the Pet Breeding tab");
|
||||
c.Ilt.SetJson("{\"ilt\":true,\"features\":[{\"key\":\"pet_breeding\",\"label\":\"Pet breeding\",\"group\":\"Pets\",\"state\":0,\"where\":\"\"}]}");
|
||||
Check(!view.VisibleTabs().Contains(OracleView.TabBreeding), "ILT with pet breeding off on the server: no Pet Breeding tab");
|
||||
c.Ilt.SetJson("{\"ilt\":true,\"features\":[{\"key\":\"pet_breeding\",\"label\":\"Pet breeding\",\"group\":\"Pets\",\"state\":1,\"where\":\"\"}]}");
|
||||
Check(view.VisibleTabs().Contains(OracleView.TabBreeding), "ILT with pet breeding on: the tab");
|
||||
c.Ilt.SetJson("{\"ilt\":true,\"features\":[{\"key\":\"pet_breeding\",\"label\":\"Pet breeding\",\"group\":\"Pets\",\"state\":-1,\"where\":\"\"}]}");
|
||||
Check(view.VisibleTabs().Contains(OracleView.TabBreeding), "ILT with pet breeding not known yet: the tab (it says what it is waiting for)");
|
||||
c.Ilt.SetJson("");
|
||||
|
||||
IltBreedingView v = IltBreedingView.Parse(BreedingJson(2));
|
||||
Check(v.Loaded && v.Available && v.Enabled == "on" && v.Room == "landblock 0x0106 variant 2" && v.FreeSlots == 12, "breeding JSON header");
|
||||
Check(v.Essences.Count == 2 && v.Essences[0].Male && !v.Essences[1].Male && v.Essences[0].Ready && v.Essences[0].Boosters.Count == 1,
|
||||
"breeding essences with sex, readiness and boosters");
|
||||
Check(v.Pairs.Count == 1 && Math.Abs(v.Pairs[0].ChanceBest - 0.13636) < 1e-9 && v.Pairs[0].InheritMax == 2, "breeding pair odds");
|
||||
Check(v.Supplies.Count == 2 && v.Supplies[0].Targets.Count == 2 && !v.Supplies[1].Apply, "breeding supplies and their targets");
|
||||
Check(v.Debug is { Match: "valid", Partners: 1 }, "breeding diagnostics");
|
||||
Check(!IltBreedingView.Parse("not json").Loaded && !IltBreedingView.Parse("").Loaded && !IltBreedingView.Parse("[1]").Loaded,
|
||||
"bad breeding JSON is not loaded");
|
||||
Check(IltBreedingView.ApplyVerb(" incense1 ", 1000) == "apply incense1 1000" && IltBreedingView.DanceVerb() == "dance", "breeding verbs");
|
||||
|
||||
// Nothing from RynthILT yet: the tab says to load it.
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
c.Settings.TabName = OracleView.TabBreeding;
|
||||
Check(Frame(host, main, view, "Pet Breeding empty").Contains("Load RynthILT (0.3.1 or later)"), "without RynthILT: says to load it");
|
||||
|
||||
// 50 essences with every section open: rows cut at 40, the page still fits.
|
||||
var sent = new List<string>();
|
||||
string ran = "";
|
||||
c.BreedingCommand = verb => { sent.Add(verb); return true; };
|
||||
c.RunCommand = cmd => { ran = cmd; return true; };
|
||||
c.Breeding = IltBreedingView.Parse(BreedingJson(50));
|
||||
Frame(host, main, view, "Pet Breeding opening");
|
||||
foreach (string header in new[] { "br.sup", "br.rules", "br.events" })
|
||||
Apply(host, Event(6, ++_seq, main.Hash, main.KeyOf(header), new byte[] { 1 }));
|
||||
string body = Frame(host, main, view, "Pet Breeding with 50 essences", out int ops);
|
||||
Check(ops > 5 && ops < 1400, $"Pet Breeding with 50 essences: {ops} ops");
|
||||
Console.WriteLine($" InfiniteLeaftide/Pet Breeding (50 essences, all open): {ops} ops, {body.Length} bytes");
|
||||
Check(body.Contains("Essences (2 ready of 50)") && body.Contains("... and 10 more"), "essence rows cut at 40 with a count");
|
||||
Check(body.Contains("Essence 0 x Essence 1") && body.Contains("5%-13.6%"), "the ready pair with its odds");
|
||||
Check(body.Contains("Supplies (3 carried)") && body.Contains("250,000 pyreals"), "supplies with Ivo's price");
|
||||
Check(body.Contains("Stud charges") && body.Contains("seen on server") && body.Contains("In the breeding room"), "rules and diagnostics");
|
||||
Check(body.Contains("A baby pet has been born"), "recent events");
|
||||
Check(body.Contains("###refresh.Pet Breeding"), "the page has the Refresh row every page has");
|
||||
|
||||
// Dance asks first; No drops it, Yes sends it.
|
||||
Click(host, main, "br.dance");
|
||||
Check(sent.Count == 0, "Dance asks before sending");
|
||||
body = Frame(host, main, view, "Pet Breeding asking");
|
||||
Check(body.Contains("Dance now?") && body.Contains("###br.yes") && body.Contains("###br.no"), "the question with Yes / No");
|
||||
Click(host, main, "br.no");
|
||||
body = Frame(host, main, view, "Pet Breeding no");
|
||||
Check(sent.Count == 0 && !body.Contains("###br.yes"), "No drops the question");
|
||||
Click(host, main, "br.dance");
|
||||
Frame(host, main, view, "Pet Breeding asking again");
|
||||
Click(host, main, "br.yes");
|
||||
Check(sent.Count == 1 && sent[0] == "dance", "Yes sends the dance verb");
|
||||
|
||||
// A supply use on the selected essence (the first) asks first as well.
|
||||
body = Frame(host, main, view, "Pet Breeding supplies");
|
||||
Check(body.Contains("###br.use.0") && !body.Contains("###br.use.1"), "only a usable, carried supply has Use");
|
||||
Click(host, main, "br.use.0");
|
||||
Check(sent.Count == 1, "a supply use asks before sending");
|
||||
Frame(host, main, view, "Pet Breeding supply question");
|
||||
Click(host, main, "br.yes");
|
||||
Check(sent.Count == 2 && sent[1] == "apply incense1 1000", "Use then Yes sends apply with the essence id: " + string.Join("|", sent));
|
||||
|
||||
Click(host, main, "br.debug");
|
||||
Check(sent.Count == 3 && sent[2] == "debug", "Diagnostics is sent straight away (it only reads)");
|
||||
Click(host, main, "br.remote");
|
||||
Check(ran == "/ra hub open breeding", "Mini Remote opens Pets > Breeding: " + ran);
|
||||
|
||||
// The page's Refresh row asks RynthILT to appraise again.
|
||||
Click(host, main, "refresh.Pet Breeding");
|
||||
Check(sent.Count == 4 && sent[3] == "refresh", "Refresh sends refresh: " + string.Join("|", sent));
|
||||
|
||||
// Breeding switched off on the server: said in red, page still drawn.
|
||||
c.Breeding = IltBreedingView.Parse("{\"available\":true,\"enabled\":\"off\",\"essences\":[]}");
|
||||
Check(Frame(host, main, view, "Pet Breeding off").Contains("Pet breeding is off on this server."), "breeding off is shown");
|
||||
}
|
||||
|
||||
/// <summary>The Character tab's Charms section (RynthILT's list, Toggle routed back to it).</summary>
|
||||
private static void Charms()
|
||||
{
|
||||
const string charmsJson = "{\"available\":true,\"world\":\"InfiniteLeaftide\",\"acquiredCount\":2,\"activeCount\":1,"
|
||||
+ "\"charms\":[{\"name\":\"Mana Barrier\",\"effect\":\"Absorbs damage\",\"acquired\":\"carried\",\"count\":1,\"tier\":3,\"maxTier\":5,"
|
||||
+ "\"active\":\"on\",\"server\":\"on\",\"toggleId\":5001},"
|
||||
+ "{\"name\":\"Swift Feet\",\"acquired\":\"seen\",\"lastSeen\":\"2026-10-12\",\"active\":\"unknown\",\"server\":\"off\"}],"
|
||||
+ "\"hands\":[{\"id\":7001,\"name\":\"Guardian Hand\",\"active\":\"off\",\"server\":\"on\"}]}";
|
||||
|
||||
OracleContext c = Context();
|
||||
c.Server.Force(ServerTags.InfiniteLeaftide, "InfiniteLeaftide");
|
||||
c.Settings.TabName = OracleView.TabCharacter;
|
||||
var view = new OracleView(c);
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
|
||||
string empty = Frame(host, main, view, "Character, no RynthILT");
|
||||
Check(empty.Contains("Load RynthILT to list your Infinite Leaftide charms"), "ILT without RynthILT: says to load it");
|
||||
|
||||
uint toggled = 0;
|
||||
c.ToggleCharm = id => { toggled = id; return true; };
|
||||
c.Charms = RynthCore.Plugin.Shared.IltCharmsView.Parse(charmsJson);
|
||||
string body = Frame(host, main, view, "Character with charms", out int ops);
|
||||
Check(ops > 5 && ops < 1400, $"Character with charms: {ops} ops");
|
||||
Check(body.Contains("Charms (2)") && body.Contains("Mana Barrier") && body.Contains("T3/5") && body.Contains("seen 2026-10-12"),
|
||||
"the charms RynthILT listed, with tier and acquired state");
|
||||
Check(body.Contains("server off"), "a charm the server switched off is marked");
|
||||
Check(body.Contains("Guardian Hands (1)"), "the Guardian Hands are listed");
|
||||
Check(body.Contains("###c.charm.0") && !body.Contains("###c.charm.1"), "an uncarried charm has no Toggle");
|
||||
Click(host, main, "c.charm.0");
|
||||
Check(toggled == 5001, "the carried charm's Toggle goes to RynthILT with its id");
|
||||
Click(host, main, "c.hand.0");
|
||||
Check(toggled == 7001, "the Guardian Hand's Toggle goes to RynthILT with its id");
|
||||
|
||||
// Another world: RynthILT answers "not available", so no charms section at all.
|
||||
c.Server.Force("", "");
|
||||
c.Charms = RynthCore.Plugin.Shared.IltCharmsView.Parse("{\"available\":false,\"charms\":[]}");
|
||||
Check(!Frame(host, main, view, "Character off ILT").Contains("Charms ("), "off ILT: no charms section");
|
||||
}
|
||||
|
||||
// ── The merged Quests list ───────────────────────────────────────────
|
||||
|
||||
private const string GuardianJson = "{\"available\":true,\"world\":\"InfiniteLeaftide\",\"chat\":true,\"auto\":false,\"buy\":true,"
|
||||
+ "\"cooldownHours\":20,\"answer\":\"Pyreal\",\"npc\":\"Guardian of Attribute Enlightenment\",\"answerAgeSec\":30,"
|
||||
+ "\"heard\":\"What is the coin of the realm?\",\"running\":false,\"status\":\"idle\",\"synced\":\"2026-10-18T19:05:00Z\","
|
||||
+ "\"rows\":[{\"attribute\":\"Strength\",\"npc\":\"Fiun Strongarm\",\"count\":3,\"status\":\"Ready\",\"eta\":\"\",\"ready\":true,\"exact\":true},"
|
||||
+ "{\"attribute\":\"Focus\",\"npc\":\"Fiun Thinker\",\"count\":1,\"status\":\"Cooldown\",\"eta\":\"in 5h 2m\",\"ready\":false,\"exact\":false}]}";
|
||||
|
||||
/// <summary>The "N shown" count in a page body.</summary>
|
||||
private static int Shown(string body)
|
||||
{
|
||||
int at = body.IndexOf(" shown", StringComparison.Ordinal);
|
||||
if (at < 0) return -1;
|
||||
int s = at;
|
||||
while (s > 0 && char.IsDigit(body[s - 1])) s--;
|
||||
return int.TryParse(body.AsSpan(s, at - s), out int n) ? n : -1;
|
||||
}
|
||||
|
||||
/// <summary>Each source appears in the one list, per server, with its filters; Trackers only and Show narrow it.</summary>
|
||||
private static void MergedList()
|
||||
{
|
||||
// Retail: quests, Legendary quests and markers; no stamps or guardians.
|
||||
OracleContext c = On("");
|
||||
var view = new OracleView(c);
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
c.Settings.TabName = OracleView.TabQuests;
|
||||
int quests = c.Catalog.Quests.Count;
|
||||
int leg = LegendaryList.All.Count, mrk = MarkerList.All.Count, dyn = DynamicStampList.All.Count;
|
||||
|
||||
Check(view.AvailableKinds().SequenceEqual(new[] { QuestKind.Quest, QuestKind.Legendary, QuestKind.Marker }), "retail kinds: quests, Legendary, markers");
|
||||
string body = Frame(host, main, view, "Quests, retail, everything");
|
||||
Check(Shown(body) == quests + leg + mrk, $"retail: quests + Legendary + markers in one list ({Shown(body)} shown, {quests + leg + mrk} expected)");
|
||||
Check(body.Contains("###q.trackers") && body.Contains("###q.kind") && body.Contains("###q.sort") && body.Contains("###q.timers"),
|
||||
"Trackers only, Show, Sort and the Quest Timers button are on the page");
|
||||
Check(body.Contains("###refresh.Quests"), "the Refresh row every page has is still on the Quests page");
|
||||
|
||||
// Trackers only: the quests drop out, the trackers' status shows above.
|
||||
Tick(host, main, "q.trackers", true);
|
||||
body = Frame(host, main, view, "Quests, trackers only");
|
||||
Check(Shown(body) == leg + mrk, $"Trackers only: Legendary + markers ({Shown(body)})");
|
||||
Check(body.Contains("toward John") && body.Contains("markers found") && body.Contains("LEG") && !body.Contains("###q.r.30minattributes"),
|
||||
"Trackers only: John's counter and the markers' progress above, no quests");
|
||||
Check(!body.Contains("###dy.area") && !body.Contains("Dynamic stamps"), "retail: no stamp status or area picker");
|
||||
Tick(host, main, "q.trackers", false);
|
||||
|
||||
// Show: one kind per source.
|
||||
foreach ((QuestKind kind, int want) in new[] { (QuestKind.Quest, quests), (QuestKind.Legendary, leg), (QuestKind.Marker, mrk) })
|
||||
{
|
||||
view.ShowTrackers(kind);
|
||||
body = Frame(host, main, view, "Quests, " + kind);
|
||||
Check(Shown(body) == want, $"Show {kind}: {Shown(body)} shown ({want} expected)");
|
||||
}
|
||||
|
||||
// Done / Not done on markers: the Markers tab's "only the ones still to find".
|
||||
long at = DateTimeOffset.UtcNow.AddDays(-1).ToUnixTimeSeconds();
|
||||
c.Flags.OnChatLine($"explorationmarkersfoundingroupa - 3 solves ({at})\"Markers\" 1023 0", c.NowMs);
|
||||
c.Flags.Tick(c.NowMs + 5_000);
|
||||
view.ShowTrackers(QuestKind.Marker);
|
||||
body = Frame(host, main, view, "Markers, none filtered");
|
||||
Check(Shown(body) == 100 && body.Contains("2 / 100 markers found"), "markers: bits 1 and 2 of group A found: " + (body.Contains("markers found") ? "status shown" : "no status"));
|
||||
Tick(host, main, "q.notdone", true);
|
||||
body = Frame(host, main, view, "Markers, not done");
|
||||
Check(Shown(body) == 98, $"markers, Not done: the ones still to find ({Shown(body)})");
|
||||
Tick(host, main, "q.notdone", false);
|
||||
Tick(host, main, "q.done", true);
|
||||
body = Frame(host, main, view, "Markers, done");
|
||||
Check(Shown(body) == 2, $"markers, Done: the two found ({Shown(body)})");
|
||||
Tick(host, main, "q.done", false);
|
||||
|
||||
// Repeatable / One-time: Legendary rows repeat, markers don't.
|
||||
view.ShowTrackers(null);
|
||||
Tick(host, main, "q.rep", true);
|
||||
body = Frame(host, main, view, "Trackers, repeatable");
|
||||
Check(Shown(body) == leg, $"Repeatable: the Legendary quests ({Shown(body)})");
|
||||
Tick(host, main, "q.rep", false);
|
||||
Tick(host, main, "q.one", true);
|
||||
body = Frame(host, main, view, "Trackers, one-time");
|
||||
Check(Shown(body) == mrk, $"One-time: the markers ({Shown(body)})");
|
||||
Tick(host, main, "q.one", false);
|
||||
|
||||
// The quest-only filters leave the trackers out.
|
||||
Tick(host, main, "q.new", true);
|
||||
body = Frame(host, main, view, "Trackers, Not in list");
|
||||
Check(Shown(body) == 0, "Not in list is a quests-only filter: no tracker rows");
|
||||
Tick(host, main, "q.new", false);
|
||||
|
||||
// Search reaches the trackers' text (the notes, places, flags).
|
||||
Type(host, main, "q.search", "mhoire");
|
||||
body = Frame(host, main, view, "Trackers, search");
|
||||
int wantSearch = LegendaryList.All.Count(l => $"{l.Label} {l.Group} {l.Note} {string.Join(" ", l.Flags)}".Contains("mhoire", StringComparison.OrdinalIgnoreCase))
|
||||
+ MarkerList.All.Count(m => $"#{m.Number} {m.Name} {m.Location} {m.Hint}".Contains("mhoire", StringComparison.OrdinalIgnoreCase));
|
||||
Check(Shown(body) == wantSearch && wantSearch > 0, $"Search \"mhoire\" over the trackers: {Shown(body)} shown ({wantSearch} expected)");
|
||||
Type(host, main, "q.search", "");
|
||||
|
||||
// Favourites: tracking a quest (the * list) also marks the Legendary row of the same flag.
|
||||
LegendaryQuest rtw = LegendaryList.All.First(q => q.CommonName == "RTW");
|
||||
c.Book.SetTracked(rtw.Flags[0], true);
|
||||
Tick(host, main, "q.tracked", true);
|
||||
body = Frame(host, main, view, "Trackers, tracked");
|
||||
Check(Shown(body) == 1 && body.Contains("###q.r.lg:" + rtw.Name), $"Tracked: the tracked quest's Legendary row ({Shown(body)})");
|
||||
view.ShowTrackers(QuestKind.Quest);
|
||||
body = Frame(host, main, view, "Quests, tracked");
|
||||
Check(Shown(body) == 3 && body.Contains("###q.t.30minattributes"), $"Tracked quests are still the favourites (the * list): {Shown(body)} shown");
|
||||
Tick(host, main, "q.tracked", false);
|
||||
c.Book.SetTracked(rtw.Flags[0], false);
|
||||
|
||||
// Sorts do not throw and keep every row.
|
||||
view.ShowTrackers(null);
|
||||
foreach (int sort in new[] { 1, 2, 3, 4, 5, 0 })
|
||||
{
|
||||
Apply(host, Event(3, ++_seq, main.Hash, main.KeyOf("q.sort"), BitConverter.GetBytes(sort)));
|
||||
body = Frame(host, main, view, "Trackers, sort " + sort);
|
||||
Check(Shown(body) == leg + mrk, $"sort {sort} keeps every row ({Shown(body)})");
|
||||
}
|
||||
|
||||
// Infinite Leaftide: stamps and guardians join; the area picker narrows the stamps.
|
||||
OracleContext ic = On(ServerTags.InfiniteLeaftide);
|
||||
var iv = new OracleView(ic);
|
||||
var ihost = new UiHost();
|
||||
UiWindow imain = ihost.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
ic.Settings.TabName = OracleView.TabQuests;
|
||||
ic.Guardian = IltGuardianView.Parse(GuardianJson);
|
||||
ic.GuardianRevision++;
|
||||
int iq = ic.Catalog.Quests.Count;
|
||||
body = Frame(ihost, imain, iv, "Quests, ILT, everything");
|
||||
Check(Shown(body) == iq + leg + mrk + dyn + 2, $"ILT: quests + Legendary + markers + {dyn} stamps + 2 guardians ({Shown(body)}, {iq + leg + mrk + dyn + 2} expected)");
|
||||
foreach ((QuestKind kind, int want, string tag) in new[] { (QuestKind.Dynamic, dyn, "DYN"), (QuestKind.Guardian, 2, "GRD") })
|
||||
{
|
||||
iv.ShowTrackers(kind);
|
||||
body = Frame(ihost, imain, iv, "Quests, ILT, " + kind);
|
||||
Check(Shown(body) == want && body.Contains(tag), $"ILT Show {kind}: {Shown(body)} shown ({want} expected)");
|
||||
}
|
||||
iv.ShowTrackers(QuestKind.Dynamic);
|
||||
Frame(ihost, imain, iv, "Quests, ILT, stamps");
|
||||
Apply(ihost, Event(3, ++_seq, imain.Hash, imain.KeyOf("dy.area"), BitConverter.GetBytes(1)));
|
||||
body = Frame(ihost, imain, iv, "Quests, ILT, one area");
|
||||
int areaCount = DynamicStampList.All.Count(s => s.Area == DynamicStampList.Areas[0]);
|
||||
Check(Shown(body) == areaCount, $"the area picker narrows the stamps to {DynamicStampList.Areas[0]}: {Shown(body)} ({areaCount} expected)");
|
||||
|
||||
// A saved tab name of an old tab opens Quests; the Markers / Legendary / Dynamic Stamps tabs are gone.
|
||||
ic.Settings.TabName = "Markers";
|
||||
Check(iv.Tab == OracleView.TabQuests, "a saved \"Markers\" tab opens Quests");
|
||||
ic.Settings.TabName = "Dynamic Stamps";
|
||||
Check(iv.Tab == OracleView.TabQuests, "a saved \"Dynamic Stamps\" tab opens Quests");
|
||||
string[] tabs = iv.VisibleTabs();
|
||||
Check(!tabs.Contains("Markers") && !tabs.Contains("Legendary") && !tabs.Contains("Dynamic Stamps"), "no separate tracker tabs: " + string.Join(",", tabs));
|
||||
}
|
||||
|
||||
/// <summary>Everything the old Markers tab showed is reachable from the Quests list.</summary>
|
||||
private static void MarkersReachable()
|
||||
{
|
||||
OracleContext c = On("");
|
||||
var printed = new List<string>();
|
||||
c.PrintSink = printed.Add;
|
||||
var navs = new List<string>();
|
||||
c.SendNav = line => { navs.Add(line); return true; };
|
||||
var view = new OracleView(c);
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
c.Settings.TabName = OracleView.TabQuests;
|
||||
long at = DateTimeOffset.UtcNow.AddDays(-1).ToUnixTimeSeconds();
|
||||
c.Flags.OnChatLine($"explorationmarkersfoundingroupa - 1 solves ({at})\"Markers\" 1023 0", c.NowMs);
|
||||
c.Flags.Tick(c.NowMs + 5_000);
|
||||
|
||||
view.ShowTrackers(QuestKind.Marker); // /ro markers
|
||||
string body = Frame(host, main, view, "Markers");
|
||||
Check(body.Contains("1 / 100 markers found"), "the progress bar: markers found of 100");
|
||||
Marker next = MarkerList.All[1];
|
||||
Check(body.Contains("Next marker:") && body.Contains($"#{next.Number} {next.Name} ({next.Location})"), "the next marker to run to");
|
||||
Check(body.Contains("###q.r.mk:1") && body.Contains("###q.r.mk:2"), "a row per marker");
|
||||
|
||||
// "Next marker" opens that marker, and a click prints the directions in chat (the old tab did).
|
||||
Click(host, main, "m.next");
|
||||
Check(printed.Count >= 2 && printed[0].StartsWith($"Marker {next.Number}: {next.Name}") && printed.Contains(next.Hint), "a click prints the marker and its directions: " + string.Join(" | ", printed.Take(3)));
|
||||
body = Frame(host, main, view, "Marker opened");
|
||||
Check(body.Contains("Marker 2") && body.Contains("not found yet") && body.Contains("###q.nav.go") && body.Contains("###m.sel.print") && body.Contains("###m.sel.close"),
|
||||
"the marker opens below the list: status, Go to, Print, Close");
|
||||
Click(host, main, "q.nav.go");
|
||||
Check(navs.Count == 1 && navs[0].StartsWith("go "), "Go to sends RynthNav a go: " + string.Join("|", navs));
|
||||
Click(host, main, "q.nav.route");
|
||||
Click(host, main, "q.nav.arrow");
|
||||
Check(navs.Count == 3 && navs[1].StartsWith("route ") && navs[2].StartsWith("arrow "), "Route and Arrow likewise");
|
||||
|
||||
// Print in chat from the panel; a second click on the row closes it (and prints again).
|
||||
printed.Clear();
|
||||
Click(host, main, "m.sel.print");
|
||||
Check(printed.Count >= 2, "Print in chat from the opened marker");
|
||||
printed.Clear();
|
||||
Click(host, main, "q.r.mk:2");
|
||||
body = Frame(host, main, view, "Marker closed");
|
||||
Check(printed.Count >= 2 && !body.Contains("###m.sel.close"), "a second click on the row prints again and closes it");
|
||||
}
|
||||
|
||||
/// <summary>Opening a Legendary quest, a marker or a quest with coordinates in its notes offers RynthNav's Go to.</summary>
|
||||
private static void GoToButtons()
|
||||
{
|
||||
OracleContext c = On("");
|
||||
var navs = new List<string>();
|
||||
c.SendNav = line => { navs.Add(line); return true; };
|
||||
var printed = new List<string>();
|
||||
c.PrintSink = printed.Add;
|
||||
var view = new OracleView(c);
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
c.Settings.TabName = OracleView.TabQuests;
|
||||
|
||||
// The shipped Legendary notes carry no coordinates, so a row with them is added for the test
|
||||
// (first in the list, taken out again): several places give a picker first, picking plans the route.
|
||||
var fake = new LegendaryQuest
|
||||
{
|
||||
Group = "Testing", Name = "Test Route Quest", Luminance = 1, Flags = new[] { "testroutequest" },
|
||||
Note = "Speak with Hoshar 59.6S 88.0W - Kill Mukkir 86.5N 57.3E",
|
||||
};
|
||||
var one = new LegendaryQuest
|
||||
{
|
||||
Group = "Testing", Name = "Test One Place", Luminance = 1, Flags = new[] { "testoneplace" },
|
||||
Note = "Speak with Hoshar 59.6S 88.0W",
|
||||
};
|
||||
LegendaryList.All.Insert(0, fake);
|
||||
try
|
||||
{
|
||||
view.ShowTrackers(QuestKind.Legendary);
|
||||
Frame(host, main, view, "Legendary");
|
||||
Click(host, main, "q.r.lg:" + fake.Name);
|
||||
string body = Frame(host, main, view, "Legendary opened");
|
||||
Check(body.Contains("Go to (2 places in these notes)") && body.Contains("###q.nav.pick") && body.Contains("###q.nav.go"),
|
||||
"a Legendary quest with 2 places in its notes: a picker and Go");
|
||||
Check(body.Contains("###lg.sel.print") && body.Contains("###lg.sel.close") && body.Contains("Testing"), "its area, Print and Close buttons");
|
||||
Apply(host, Event(3, ++_seq, main.Hash, main.KeyOf("q.nav.pick"), BitConverter.GetBytes(1)));
|
||||
Check(navs.Count == 1 && navs[0] == "route 86.5N, 57.3E Kill Mukkir", "picking the second place plans its route: " + string.Join("|", navs));
|
||||
Frame(host, main, view, "Legendary, second place picked");
|
||||
Click(host, main, "q.nav.go");
|
||||
Check(navs.Count == 2 && navs[1] == "go 86.5N, 57.3E Kill Mukkir", "Go walks the picked place: " + string.Join("|", navs));
|
||||
Click(host, main, "lg.sel.print");
|
||||
Check(printed.Count >= 1 && printed[0].Contains("Test Route Quest") && printed.Any(p => p.Contains("Speak with Hoshar")),
|
||||
"Print in chat prints the quest and its notes: " + string.Join(" | ", printed.Take(3)));
|
||||
|
||||
// One place: no picker.
|
||||
Click(host, main, "q.r.lg:" + fake.Name); // close
|
||||
LegendaryList.All.Insert(0, one);
|
||||
Type(host, main, "q.search", "Test One"); // the row list is cached per filter: a new search rebuilds it
|
||||
Frame(host, main, view, "Legendary, with the one-place row");
|
||||
Click(host, main, "q.r.lg:" + one.Name);
|
||||
body = Frame(host, main, view, "Legendary, one place");
|
||||
Check(body.Contains("Go to") && !body.Contains("###q.nav.pick") && body.Contains("###q.nav.go"), "one place: Go / Route / Arrow, no picker");
|
||||
|
||||
// A real Legendary quest (no coordinates in its notes): opens, no Go to.
|
||||
LegendaryQuest real = LegendaryList.All.First(q => q != fake && q != one);
|
||||
Click(host, main, "q.r.lg:" + one.Name); // close
|
||||
Type(host, main, "q.search", "");
|
||||
Frame(host, main, view, "Legendary, all rows again");
|
||||
Click(host, main, "q.r.lg:" + real.Name);
|
||||
body = Frame(host, main, view, "Legendary, no place");
|
||||
Check(!body.Contains("###q.nav.go") && body.Contains("###lg.sel.close") && body.Contains("Area"), "no coordinates in the notes: no Go to");
|
||||
}
|
||||
finally
|
||||
{
|
||||
LegendaryList.All.Remove(fake);
|
||||
LegendaryList.All.Remove(one);
|
||||
}
|
||||
|
||||
// A plain quest whose notes have coordinates: Go to under its texts, and the click still prints.
|
||||
Quest? withCoords = c.Catalog.Quests.FirstOrDefault(q => NavTargets.Stops(q.Info + " - " + q.Hint).Count > 0);
|
||||
Check(withCoords != null, "some quest in the list has coordinates in its notes");
|
||||
if (withCoords != null)
|
||||
{
|
||||
view.ShowTrackers(QuestKind.Quest);
|
||||
Type(host, main, "q.search", withCoords.Flag);
|
||||
Frame(host, main, view, "Quests, searched");
|
||||
printed.Clear();
|
||||
Click(host, main, "q.r." + withCoords.Flag);
|
||||
string body = Frame(host, main, view, "Quest with coordinates");
|
||||
Check(printed.Count >= 4, "a click on a quest still prints its texts in chat");
|
||||
Check(body.Contains("###q.nav.go") && body.Contains("Save rewards") && body.Contains("###q.sel.track"),
|
||||
"the quest opens with Go to, Track and the rewards editor");
|
||||
Type(host, main, "q.search", "");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The guardians as rows, their controls sending RynthILT's verbs, and the stamps' opened box.</summary>
|
||||
private static void Trackers()
|
||||
{
|
||||
var g = IltGuardianView.Parse(GuardianJson);
|
||||
Check(g.Loaded && g.Chat && !g.Auto && g.Buy && g.Answer == "Pyreal" && g.AnswerAgeSec == 30 && g.SyncedUtc.Year == 2026, "guardian JSON header");
|
||||
Check(g.Rows.Count == 2 && g.Rows[0].Ready && g.Rows[0].Exact && g.Rows[1].Eta == "in 5h 2m" && !g.Rows[1].Exact, "guardian rows");
|
||||
Check(!IltGuardianView.Parse("nope").Loaded && !IltGuardianView.Parse("").Loaded, "bad guardian JSON is not loaded");
|
||||
Check(IltGuardianView.SwitchVerb(" Auto ", true) == "auto on" && IltGuardianView.SwitchVerb("buy", false) == "buy off"
|
||||
&& IltGuardianView.HandInVerb() == "handin", "guardian verbs");
|
||||
|
||||
OracleContext c = On(ServerTags.InfiniteLeaftide);
|
||||
var view = new OracleView(c);
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
c.Settings.TabName = OracleView.TabQuests;
|
||||
|
||||
view.ShowTrackers(QuestKind.Guardian);
|
||||
string body = Frame(host, main, view, "Guardians without RynthILT");
|
||||
Check(body.Contains("RynthILT isn't loaded"), "guardians without RynthILT: says to load it");
|
||||
|
||||
var sent = new List<string>();
|
||||
c.GuardianCommand = verb => { sent.Add(verb); return true; };
|
||||
c.Guardian = g;
|
||||
c.GuardianRevision++;
|
||||
body = Frame(host, main, view, "Guardians");
|
||||
Check(body.Contains("Temple guardians") && body.Contains("1 of 2 attribute turn-ins ready") && body.Contains("Pyreal")
|
||||
&& body.Contains("###gd.handin") && body.Contains("GRD") && body.Contains("Strength (Fiun Strongarm)") && body.Contains("in 5h 2m"),
|
||||
"guardian controls, answer and rows");
|
||||
Click(host, main, "gd.handin");
|
||||
Tick(host, main, "gd.auto", true);
|
||||
Tick(host, main, "gd.buy", false);
|
||||
Click(host, main, "gd.refresh");
|
||||
Check(string.Join("|", sent) == "handin|auto on|buy off|refresh", "guardian controls send their verbs: " + string.Join("|", sent));
|
||||
|
||||
// Open a guardian row, then every kind at once under the engine's ops limit.
|
||||
Click(host, main, "q.r.gd:Strength");
|
||||
view.ShowTrackers(null);
|
||||
body = Frame(host, main, view, "ILT trackers, a guardian opened", out int ops);
|
||||
int rows = LegendaryList.All.Count + MarkerList.All.Count + DynamicStampList.All.Count + 2;
|
||||
Check(Shown(body) == rows && body.Contains("Temple guardian: Strength") && body.Contains("###gd.sel.close"), $"every ILT tracker listed ({Shown(body)}), a guardian opened below");
|
||||
Check(ops > 40 && ops < 1400, $"ILT Quests with every tracker and a guardian opened: {ops} ops");
|
||||
Console.WriteLine($" InfiniteLeaftide/Quests, trackers only ({rows} rows, guardian opened): {ops} ops, {body.Length} bytes");
|
||||
|
||||
// A stamp: the nav box with Go / Arrow / Chat, RynthNav asked for the route at once.
|
||||
var navs = new List<string>();
|
||||
c.SendNav = line => { navs.Add(line); return true; };
|
||||
var printed = new List<string>();
|
||||
c.PrintSink = printed.Add;
|
||||
view.ShowTrackers(QuestKind.Dynamic);
|
||||
DynamicStamp felscuda = DynamicStampList.All.First(s => s.Npc == "Felscuda");
|
||||
Frame(host, main, view, "Stamps");
|
||||
Click(host, main, "q.r.dy:" + felscuda.Stamp);
|
||||
Check(navs.Count == 1 && navs[0] == "route 8.8S, 53.1E || Folthid Cellar || Felscuda || Facility Hub", "clicking a stamp asks RynthNav for its route: " + string.Join("|", navs));
|
||||
body = Frame(host, main, view, "Stamp opened");
|
||||
Check(body.Contains("Navigate to Felscuda") && body.Contains("###dy.nav.go") && body.Contains("###dy.nav.arrow") && body.Contains("###dy.nav.chat"), "the stamp's box");
|
||||
Click(host, main, "dy.nav.go");
|
||||
Check(navs.Count == 2 && navs[1].StartsWith("go 8.8S, 53.1E || "), "Go sends a go with every candidate");
|
||||
Click(host, main, "dy.nav.chat");
|
||||
Check(printed.Count >= 1 && printed[0].Contains("Felscuda") && printed[0].Contains("missing"), "Chat prints the stamp: " + string.Join(" | ", printed.Take(2)));
|
||||
}
|
||||
|
||||
/// <summary>Give Parchment sends /ub give, and is disabled with a tooltip when RynthAi can't take it.</summary>
|
||||
private static void GiveParchment()
|
||||
{
|
||||
OracleContext c = On(ServerTags.InfiniteLeaftide);
|
||||
c.ParchmentFinder = () => "Parchment of Learning";
|
||||
var ran = new List<string>();
|
||||
c.RunCommand = cmd => { ran.Add(cmd); return true; };
|
||||
c.SendNav = _ => true;
|
||||
var view = new OracleView(c);
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
c.Settings.TabName = OracleView.TabQuests;
|
||||
DynamicStamp felscuda = DynamicStampList.All.First(s => s.Npc == "Felscuda");
|
||||
view.ShowTrackers(QuestKind.Dynamic);
|
||||
Frame(host, main, view, "Stamps");
|
||||
Click(host, main, "q.r.dy:" + felscuda.Stamp);
|
||||
|
||||
// RynthAi isn't there: no button, a greyed line and the reason.
|
||||
c.UbGiveAvailable = () => false;
|
||||
string body = Frame(host, main, view, "Give, no RynthAi");
|
||||
Check(!body.Contains("###dy.nav.give") && body.Contains("[Give Parchment of Learning]") && body.Contains("Needs RynthAi"),
|
||||
"no RynthAi: Give Parchment is disabled with a tooltip");
|
||||
Check(ran.Count == 0, "nothing was sent");
|
||||
|
||||
// RynthAi there: the button sends /ub give 1.
|
||||
c.UbGiveAvailable = () => true;
|
||||
body = Frame(host, main, view, "Give, RynthAi");
|
||||
Check(body.Contains("###dy.nav.give") && body.Contains("Hands one Parchment of Learning to Felscuda"), "RynthAi loaded: the Give button and its tooltip");
|
||||
c.NowMs = 50_000;
|
||||
Click(host, main, "dy.nav.give");
|
||||
Check(ran.Count == 0, "one click doesn't give anything away");
|
||||
body = Frame(host, main, view, "Give, asking");
|
||||
Check(body.Contains("Give one Parchment of Learning to Felscuda?") && body.Contains("###dy.nav.give.yes") && body.Contains("###dy.nav.give.no"),
|
||||
"it asks, naming the item and the NPC");
|
||||
Click(host, main, "dy.nav.give.no");
|
||||
body = Frame(host, main, view, "Give, cancelled");
|
||||
Check(ran.Count == 0 && body.Contains("###dy.nav.give") && !body.Contains("###dy.nav.give.yes"), "Cancel drops the question, nothing sent");
|
||||
Click(host, main, "dy.nav.give");
|
||||
Frame(host, main, view, "Give, asking again");
|
||||
Click(host, main, "dy.nav.give.yes");
|
||||
Check(ran.Count == 1 && ran[0] == "/ub give 1 Parchment of Learning to Felscuda", "Yes sends /ub give 1: " + string.Join("|", ran));
|
||||
Check(c.UbGiveSentMs == 50_000, "the send is stamped, so a rejection can be tied to it");
|
||||
|
||||
// The loaded RynthAi answers "Unrecognized /ub command": the button turns itself off.
|
||||
Check(!c.NoteChatLineForGive("[RynthAi] some other line", 52_000) && !c.UbGiveMissing, "an unrelated line changes nothing");
|
||||
Check(!c.NoteChatLineForGive("[RynthAi] Unrecognized /ub command.", 60_000) && !c.UbGiveMissing, "a rejection long after the send is not tied to it");
|
||||
Check(c.NoteChatLineForGive("[RynthAi] Unrecognized /ub command.", 52_000) && c.UbGiveMissing, "a rejection right after the send disables Give");
|
||||
body = Frame(host, main, view, "Give, rejected");
|
||||
Check(!body.Contains("###dy.nav.give") && body.Contains("[Give Parchment of Learning]") && body.Contains("Unrecognized /ub command"),
|
||||
"rejected: disabled, the tooltip says why");
|
||||
Click(host, main, "q.r.dy:" + felscuda.Stamp); // close
|
||||
Click(host, main, "q.r.dy:" + felscuda.Stamp); // open again
|
||||
ran.Clear();
|
||||
Frame(host, main, view, "Give, rejected again");
|
||||
Check(ran.Count == 0, "no further /ub give goes out");
|
||||
|
||||
// No Parchment carried: said, no button either way.
|
||||
c.UbGiveMissing = false;
|
||||
c.ParchmentFinder = () => null;
|
||||
body = Frame(host, main, view, "Give, none carried");
|
||||
Check(body.Contains("No Parchment in your packs") && !body.Contains("###dy.nav.give"), "no Parchment: no button, says so");
|
||||
|
||||
// A name with a control character can't smuggle a second command.
|
||||
c.ParchmentFinder = () => "Parchment\nof /quit";
|
||||
c.UbGiveAvailable = () => true;
|
||||
Frame(host, main, view, "Give, odd name");
|
||||
ran.Clear();
|
||||
Click(host, main, "dy.nav.give");
|
||||
Frame(host, main, view, "Give, odd name asking");
|
||||
Click(host, main, "dy.nav.give.yes");
|
||||
Check(ran.Count == 1 && !ran[0].Contains('\n') && ran[0].StartsWith("/ub give 1 "), "control characters are stripped from the command: " + (ran.Count > 0 ? ran[0].Replace("\n", "\\n") : ""));
|
||||
}
|
||||
|
||||
/// <summary>The throttle line, and the Refresh bar on the Quests page.</summary>
|
||||
private static void Throttle()
|
||||
{
|
||||
OracleContext c = On("");
|
||||
var view = new OracleView(c);
|
||||
var host = new UiHost();
|
||||
UiWindow main = host.Add(new UiWindow("RynthOracle/Oracle", "Oracle") { Visible = true });
|
||||
c.Settings.TabName = OracleView.TabQuests;
|
||||
c.Flags.Request(_ => true, c.NowMs);
|
||||
c.Flags.OnChatLine("[MyQuests] This command may only be run once every 60 seconds.", c.NowMs + 100);
|
||||
string body = Frame(host, main, view, "Quests, throttled");
|
||||
Check(body.Contains("The server answers one /myquests a minute: Refresh works again in 6"), "the throttle line says when Refresh works again");
|
||||
Click(host, main, "refresh.Quests");
|
||||
Check(Frame(host, main, view, "Quests, Refresh while throttled").Contains("try again in 6"), "Refresh while the server's minute runs says to wait, and sends nothing");
|
||||
c.NowMs += 61_000;
|
||||
Check(!Frame(host, main, view, "Quests, throttle over").Contains("Refresh works again in"), "the countdown line goes once the minute is up");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ namespace RynthCore.Engine.UI.ScriptWindows
|
|||
|
||||
namespace RynthOracle.Tests
|
||||
{
|
||||
internal static class Program
|
||||
internal static partial class Program
|
||||
{
|
||||
private static int _pass, _fail;
|
||||
|
||||
|
|
@ -39,22 +39,37 @@ namespace RynthOracle.Tests
|
|||
|
||||
private static int Main()
|
||||
{
|
||||
// Tab clicks save the settings: into a scratch file, never the player's %APPDATA% copy.
|
||||
OracleSettings.PathOverride = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "RynthOracleTests-" + Guid.NewGuid().ToString("N") + "-settings.json");
|
||||
Lists();
|
||||
QuestLines();
|
||||
Catalog();
|
||||
Servers();
|
||||
EngineServers();
|
||||
IltProfile();
|
||||
ServerFeatures();
|
||||
QuestNotes();
|
||||
ConquestReplies();
|
||||
AelrynthReplies();
|
||||
Void();
|
||||
TimerAlerts();
|
||||
Pages();
|
||||
CharacterExtras();
|
||||
Charms();
|
||||
Breeding();
|
||||
Legendary();
|
||||
DynamicStamps();
|
||||
GoToParsing();
|
||||
Loaders();
|
||||
MergedList();
|
||||
MarkersReachable();
|
||||
GoToButtons();
|
||||
Trackers();
|
||||
GiveParchment();
|
||||
Throttle();
|
||||
Events();
|
||||
QuestTexts();
|
||||
Refreshes();
|
||||
SkillsTabs();
|
||||
ServerMove();
|
||||
Console.WriteLine($"{_pass} passed, {_fail} failed");
|
||||
return _fail == 0 ? 0 : 1;
|
||||
}
|
||||
|
|
@ -156,6 +171,37 @@ namespace RynthOracle.Tests
|
|||
s2.NoteTypedCommand(); // the player typing it
|
||||
s2.Tick(51_200);
|
||||
Check(!s2.AwaitingOurs, "a typed /myquests shows its reply");
|
||||
|
||||
// A second reply that lost most of its lines on the way (the engine's chat queue dropped
|
||||
// the head of the burst) updates the flags instead of blanking them.
|
||||
var s3 = new QuestFlagStore();
|
||||
long t3 = 200_000;
|
||||
for (int i = 0; i < 100; i++)
|
||||
s3.OnChatLine($"flag{i:D3} - 1 solves (1719432000)\"Q{i}\" -1 0", t3 + i);
|
||||
s3.Tick(t3 + 5_000);
|
||||
Check(s3.Flags.Count == 100, "first full reply: 100 flags");
|
||||
long t4 = t3 + 120_000;
|
||||
for (int i = 90; i < 100; i++)
|
||||
s3.OnChatLine($"flag{i:D3} - 2 solves (1719500000)\"Q{i}\" -1 0", t4 + i);
|
||||
s3.Tick(t4 + 5_000);
|
||||
Check(s3.Flags.Count == 100 && s3.LastPartialReply is { Got: 10, Had: 100 },
|
||||
"a cut-short reply (10 of 100) is merged, not a replacement");
|
||||
Check(s3.TryGet("flag095", out QuestFlag f95) && f95.Solves == 2 && s3.TryGet("flag001", out _),
|
||||
"merged reply updates the lines it had and keeps the rest");
|
||||
long t5 = t4 + 120_000;
|
||||
for (int i = 0; i < 95; i++)
|
||||
s3.OnChatLine($"flag{i:D3} - 3 solves (1719600000)\"Q{i}\" -1 0", t5 + i);
|
||||
s3.Tick(t5 + 5_000);
|
||||
Check(s3.Flags.Count == 95 && !s3.TryGet("flag099", out _), "a near-full reply still replaces (a dropped flag goes away)");
|
||||
|
||||
// ACECustom's once-a-minute limit: the throttle line ends "Reading..." and keeps the flags.
|
||||
int had = s3.Flags.Count;
|
||||
long t6 = t5 + 30_000;
|
||||
Check(s3.Request(_ => true, t6) && s3.AwaitingOurs, "refresh sent");
|
||||
Check(s3.OnChatLine("[MyQuests] This command may only be run once every 60 seconds.", t6 + 200) == MyQuestsLine.Throttled
|
||||
&& !s3.AwaitingOurs && s3.Flags.Count == had, "throttle reply: not loading, flags kept");
|
||||
Check(s3.ThrottleSecondsLeft(t6 + 1_000) > 50 && !s3.Request(_ => true, t6 + 10_000), "no resend while the server's minute runs");
|
||||
Check(s3.ThrottleSecondsLeft(t6 + 61_000) == 0 && s3.Request(_ => true, t6 + 61_000), "refresh allowed again after the minute");
|
||||
}
|
||||
|
||||
private static void Catalog()
|
||||
|
|
@ -224,7 +270,7 @@ namespace RynthOracle.Tests
|
|||
|
||||
// Identity from it.
|
||||
ServerIdentity.FromEngine(st, "Launcher Profile", out string tag, out string world, out string source);
|
||||
Check(tag == "" && world == "InfiniteLeaftide" && source.Contains("no RynthOracle pages"), "engine: ILT active has no Oracle tag (its screens are RynthILT's): " + source);
|
||||
Check(tag == ServerTags.InfiniteLeaftide && world == "InfiniteLeaftide", "engine: ILT active is the ILT tag: " + source);
|
||||
Check(source.Contains("host matches"), "engine: the reason is shown: " + source);
|
||||
|
||||
var picked = RynthCore.Plugin.Shared.EngineServerState.Parse(EngineJson("conquest", "ConquestAC", "RynthConquest", "conquest", "",
|
||||
|
|
@ -273,7 +319,7 @@ namespace RynthOracle.Tests
|
|||
Check(ServerIdentity.TagForWorld("Conquest") == ServerTags.Conquest, "Conquest");
|
||||
Check(ServerIdentity.TagForWorld("Levistras") == ServerTags.Levistras, "Levistras");
|
||||
Check(ServerIdentity.TagForWorld("Coldeve") == "" && ServerIdentity.TagForWorld("") == "", "other servers have no tag");
|
||||
Check(ServerIdentity.TagForWorld("InfiniteLeaftide") == "", "Infinite Leaftide has no Oracle tag (RynthILT draws its screens)");
|
||||
Check(ServerIdentity.TagForWorld("InfiniteLeaftide") == ServerTags.InfiniteLeaftide, "Infinite Leaftide is the ILT tag (the Quests tab's stamps and guardians, Pet Breeding)");
|
||||
var id = new ServerIdentity();
|
||||
id.Force("", "Coldeve");
|
||||
Check(id.Allows(null) && id.Allows("") && !id.Allows(ServerTags.Conquest) && !id.Allows(ServerTags.Aelrynth), "untagged everywhere, tagged nowhere else");
|
||||
|
|
@ -285,16 +331,19 @@ namespace RynthOracle.Tests
|
|||
var view = new OracleView(c);
|
||||
c.Server.Force("", "Coldeve");
|
||||
string[] none = view.VisibleTabs();
|
||||
Check(!none.Contains(OracleView.TabBoards) && !none.Contains(OracleView.TabConquest), "no server tabs on other servers: " + string.Join(",", none));
|
||||
Check(!none.Contains("Leaderboards") && !none.Contains("Conquest"), "no server tabs on other servers: " + string.Join(",", none));
|
||||
// A server's own pages are its server plugin's since 2026-10-20 (RynthConquest, RynthAelrynth).
|
||||
c.Server.Force(ServerTags.Aelrynth, "Aeshnidae");
|
||||
string[] ael = view.VisibleTabs();
|
||||
Check(ael.Contains(OracleView.TabBoards) && !ael.Contains(OracleView.TabConquest), "Aelrynth: leaderboards, no Conquest tab");
|
||||
Check(!ael.Contains("Leaderboards") && !ael.Contains("Conquest"), "Aelrynth: no leaderboards in RynthOracle: " + string.Join(",", ael));
|
||||
c.Server.Force(ServerTags.Conquest, "Conquest");
|
||||
string[] cq = view.VisibleTabs();
|
||||
Check(cq.Contains(OracleView.TabBoards) && cq.Contains(OracleView.TabConquest), "ConquestAC: leaderboards and the Conquest tab");
|
||||
c.Settings.TabName = OracleView.TabConquest;
|
||||
c.Server.Force(ServerTags.Aelrynth, "Aeshnidae");
|
||||
Check(view.Tab == OracleView.TabQuests, "a Conquest tab left selected falls back to Quests elsewhere");
|
||||
Check(!cq.Contains("Leaderboards") && !cq.Contains("Conquest"), "Conquest: no Conquest tab and no leaderboards in RynthOracle: " + string.Join(",", cq));
|
||||
foreach (string old in new[] { "Conquest", "Leaderboards" })
|
||||
{
|
||||
c.Settings.TabName = old;
|
||||
Check(view.Tab == OracleView.TabQuests, $"a {old} tab saved by an older version falls back to Quests");
|
||||
}
|
||||
}
|
||||
|
||||
// Quest notes: tracking and rewards saved per character, UB's reward format and import, kill-task timers.
|
||||
|
|
@ -369,101 +418,6 @@ namespace RynthOracle.Tests
|
|||
}
|
||||
}
|
||||
|
||||
private static void ConquestReplies()
|
||||
{
|
||||
var d = new ConquestData();
|
||||
long now = 1_000_000;
|
||||
d.RequestBank(now);
|
||||
Check(d.OnChatLine("[BANK] Your balances:", now, out bool ours) && ours, "bank heading (ours)");
|
||||
d.OnChatLine("[BANK] Pyreals: 1,039,678,533", now, out _);
|
||||
d.OnChatLine("[BANK] Event Tokens [Dragon Coins] (x): 12", now, out _);
|
||||
Check(d.Bank.Any(b => b.Name == "Pyreals" && b.Value.Contains("4,158 MMDs")), "pyreals with MMDs");
|
||||
Check(d.Bank.Any(b => b.Name == "Dragon Coins (x)"), "event token name");
|
||||
Check(!d.OnChatLine("Bob says, \"[BANK] Pyreals: 999\"", now, out _), "a pasted balance is ignored");
|
||||
d.OnChatLine("[BANK] Pyreals: 5", now + 60_000, out bool late);
|
||||
Check(!late, "a reply long after the request isn't ours (shows in chat)");
|
||||
|
||||
d.RequestAugs(now);
|
||||
d.OnChatLine("Creature: 25", now, out _);
|
||||
d.OnChatLine("Duration: 3", now, out _);
|
||||
ConquestAug creature = d.Augs.First(a => a.Name == "Creature");
|
||||
Check(creature.Count == 25 && creature.NextLuminanceCost() == 6_229_500, $"Creature 25 next costs 6,229,500 ({creature.NextLuminanceCost()})");
|
||||
Check(d.DurationAugs == 3 && Math.Abs(d.VoidDurationMultiplier(5) - 2.15) < 1e-9, "void duration x(1 + 5*0.2 + 3*0.05)");
|
||||
|
||||
d.RequestEnl(now);
|
||||
d.OnChatLine("Enlightenment Augmentations:", now, out _);
|
||||
d.OnChatLine("Skill Credits: 2 (10 max)", now, out _);
|
||||
d.OnChatLine("Damage: 5 (25 max)", now, out _);
|
||||
Check(d.EnlAugs.Count == 2 && d.EnlAugs[0].Name == "Damage", "enlightenment augs in display order");
|
||||
|
||||
d.RequestBonus(now);
|
||||
d.OnChatLine("=== XP Bonuses ===", now, out _);
|
||||
d.OnChatLine("Quest Bonus: 14.18% (1,418 quests)", now, out _);
|
||||
d.OnChatLine("Total Bonus (Kills): 0.16%", now, out _);
|
||||
Check(d.Bonuses.First(b => b.Name == "Quest").Value == "14.18% (1,418 quests)" && d.Bonuses.First(b => b.Name == "Total (Kills)").Value == "0.16%", "bonuses");
|
||||
|
||||
d.RequestFships(now);
|
||||
d.OnChatLine("Fellowships looking for members:", now, out _);
|
||||
d.OnChatLine("- Heroes (Leader: Bob) [3/14] @ Bur", now, out _);
|
||||
d.OnChatLine("- Quiet (Leader: Ann) [1/14]", now, out _);
|
||||
Check(d.Fellowships.Count == 2 && d.Fellowships[0].Location == "Bur" && d.Fellowships[1].MemberCount == 1, "fellowship list");
|
||||
|
||||
ConquestBoard lvl = d.Boards.First(b => b.Key == "level");
|
||||
d.RequestBoard(lvl, now);
|
||||
d.OnChatLine("Top 2 Players by Level:", now, out _);
|
||||
d.OnChatLine("1: 300 - Alpha", now, out _);
|
||||
d.OnChatLine("2: 299 - Beta", now, out _);
|
||||
d.OnChatLine("57: 250 - Me (You)", now, out _);
|
||||
Check(lvl.Rows.Count == 2 && lvl.You != null && lvl.You.Rank == 57 && lvl.You.Name == "Me", "ConquestAC /top board");
|
||||
|
||||
Check(ConquestData.WithdrawCommand(ConquestData.Withdrawable[ConquestData.DefaultWithdraw], "10") == "/bank withdraw n 10", "withdraw MMDs");
|
||||
Check(ConquestData.WithdrawCommand(ConquestData.Withdrawable[0], "-3") == null, "withdraw refuses a bad amount");
|
||||
Check(ConquestData.TransferCommand(ConquestData.Transferable[2], "4", "Some One") == "/bank transfer p 1000000 \"Some One\"", "transfer MMD notes as pyreals");
|
||||
Check(ConquestData.TransferCommand(ConquestData.Transferable[2], "1001", "X") == null, "transfer cap");
|
||||
}
|
||||
|
||||
private static void AelrynthReplies()
|
||||
{
|
||||
var a = new AelrynthBoards();
|
||||
long now = 2_000_000;
|
||||
a.RequestTop("", now);
|
||||
Check(a.OnChatLine("Leaderboards - 37 characters, refreshed 4 min ago. /top <board> for the top ten, /top me for yourself.", now, out bool ours) && ours, "overview header");
|
||||
a.OnChatLine(" kills Creature kills: Buffy, 1,234,567", now, out _);
|
||||
a.OnChatLine(" pk PK kills: nobody yet", now, out _);
|
||||
Check(a.Overview.Count == 2 && a.Overview[0].Key == "kills" && a.Overview[0].Leader == "Buffy" && a.Overview[0].Value == "1,234,567"
|
||||
&& a.Overview[1].Leader == "nobody yet", "overview rows");
|
||||
|
||||
a.RequestTop("kills", now);
|
||||
a.OnChatLine("Creature kills - top 10 of 37:", now, out _);
|
||||
a.OnChatLine(" 1. Buffy 1,234,567 <- you", now, out _);
|
||||
a.OnChatLine(" 2. Dargoth 987,654", now, out _);
|
||||
a.OnChatLine(" 3. Sal 500 12 kills per death", now, out _);
|
||||
Check(a.BoardTitle == "Creature kills" && a.BoardRows.Count == 3 && a.BoardRows[0].IsYou && a.BoardRows[1].Value == "987,654"
|
||||
&& a.BoardRows[2].Extra == "12 kills per death", "board rows: " + string.Join(" | ", a.BoardRows.Select(r => $"{r.Rank} {r.Name} {r.Value} [{r.Extra}] {r.IsYou}")));
|
||||
|
||||
a.RequestTop("me", now);
|
||||
a.OnChatLine("Buffy on the boards:", now, out _);
|
||||
a.OnChatLine(" Creature kills #1 of 37, 1,234,567", now, out _);
|
||||
a.OnChatLine(" PK kills -", now, out _);
|
||||
Check(a.Standings.Count == 2 && a.Standings[0].Rank == 1 && a.Standings[1].Rank == 0, "/top me");
|
||||
|
||||
Check(!a.OnChatLine(" 9. Nobody 12", now + 30_000, out _), "an entry long after its header is ignored");
|
||||
|
||||
a.RequestTrial("", now);
|
||||
a.OnChatLine("Trials - a fresh personal copy of a listed dungeon, entered through its portal, is a timed course: ...", now, out _);
|
||||
a.OnChatLine(" The Citadel Below - Trial (02F0): tier 0 12:34 by Buffy | you: tier 0 12:34 | this week: Buffy 12:34 (tier 0)", now, out _);
|
||||
a.OnChatLine(" your next attempt here: in 12 min", now, out _);
|
||||
a.OnChatLine("Trophy: the week's fastest clear of each dungeon, any tier - a trophy and 1,000 experience, Sunday 20:00 (2026-W40). /trial <name> for the top 10 of one dungeon.", now, out _);
|
||||
Check(a.Trials.Count == 1 && a.Trials[0].Landblock == "02F0" && a.TrialLines.Count == 3, $"/trial overview ({a.Trials.Count} dungeons, {a.TrialLines.Count} lines)");
|
||||
|
||||
a.RequestTrial("citadel", now);
|
||||
a.OnChatLine("The Citadel Below - Trial (02F0) - top 10, best per character, any tier:", now, out _);
|
||||
a.OnChatLine(" 1. 12:34 Buffy (tier 0, 105 kills, 3 Oct)", now, out _);
|
||||
a.OnChatLine(" you: tier 0 12:34 (105 kills)", now, out _);
|
||||
Check(a.TrialRows.Count == 1 && a.TrialRows[0].Name == "Buffy" && a.TrialRows[0].Value == "12:34" && a.TrialNotes.Count == 1, "/trial dungeon top 10");
|
||||
Check(!a.OnChatLine("Bob tells you, \"hello\"", now, out _), "ordinary chat is never taken");
|
||||
}
|
||||
|
||||
private static void Void()
|
||||
{
|
||||
var v = new VoidTracker();
|
||||
|
|
@ -526,13 +480,9 @@ namespace RynthOracle.Tests
|
|||
Check(timersBody.Contains("Attribute and Skill Redistribution") && timersBody.Contains("ready"), "the Quest Timers window lists tracked quests with their timers");
|
||||
|
||||
// Every tab on each server, including the server-specific ones (with data in them).
|
||||
c.Conquest.RequestBank(c.NowMs);
|
||||
c.Conquest.OnChatLine("[BANK] Pyreals: 1,000", c.NowMs, out _);
|
||||
c.Boards.OnChatLine("Leaderboards - 3 characters, refreshed just now. /top <board> ...", c.NowMs, out _);
|
||||
c.Boards.OnChatLine(" kills Creature kills: Buffy, 12", c.NowMs, out _);
|
||||
c.EarnedTitles.Add(1);
|
||||
c.TitlesKnown = true;
|
||||
foreach (string server in new[] { ServerTags.Aelrynth, ServerTags.Conquest, "" })
|
||||
foreach (string server in new[] { ServerTags.Aelrynth, ServerTags.Conquest, ServerTags.InfiniteLeaftide, "" })
|
||||
{
|
||||
c.Server.Force(server, server);
|
||||
foreach (string tab in view.VisibleTabs())
|
||||
|
|
@ -543,7 +493,7 @@ namespace RynthOracle.Tests
|
|||
main.End();
|
||||
ParseAll(host, $"{server}/{tab}", out int ops);
|
||||
Check(ops > 5 && ops < 1400, $"{server}/{tab}: {ops} ops");
|
||||
if (server == ServerTags.Aelrynth || tab is OracleView.TabConquest) Console.WriteLine($" {(server.Length > 0 ? server : "other")}/{tab}: {ops} ops, {main.Body.Length} bytes");
|
||||
if (server == ServerTags.Aelrynth) Console.WriteLine($" {(server.Length > 0 ? server : "other")}/{tab}: {ops} ops, {main.Body.Length} bytes");
|
||||
main.MarkSubmitted(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -565,18 +515,6 @@ namespace RynthOracle.Tests
|
|||
Console.WriteLine($" Quests (opened): {openOps} ops, {main.Body.Length} bytes");
|
||||
main.MarkSubmitted(true);
|
||||
|
||||
// The Conquest tab's sub-pages and the Aelrynth board views.
|
||||
c.Server.Force(ServerTags.Conquest, "Conquest");
|
||||
c.Settings.TabName = OracleView.TabConquest;
|
||||
for (int v = 0; v < 6; v++)
|
||||
{
|
||||
main.Begin(); view.Draw(main); main.End();
|
||||
Apply(host, Event(1, (uint)(100 + v), main.Hash, main.KeyOf("cq.v." + ((v + 1) % 6)), new byte[] { 1, 0, 0 }));
|
||||
main.Begin(); view.Draw(main); main.End();
|
||||
ParseAll(host, $"conquest view {v}", out int ops);
|
||||
Check(ops > 5 && ops < 1400, $"conquest view {v}: {ops} ops");
|
||||
}
|
||||
|
||||
// A page that can't fit: everything in the catalog on one page is cut short, still valid.
|
||||
var big = new UiWindow("RynthOracle/Big", "Big") { Visible = true };
|
||||
var bigHost = new UiHost();
|
||||
|
|
@ -727,10 +665,10 @@ namespace RynthOracle.Tests
|
|||
{
|
||||
// The tabs: after Character, on every server; every earlier tab is still there.
|
||||
string[] earlier = { OracleView.TabQuests, OracleView.TabCharacter, OracleView.TabAugs, OracleView.TabSociety,
|
||||
OracleView.TabMarkers, OracleView.TabTitles, OracleView.TabVoid, OracleView.TabFellowship, OracleView.TabAbout };
|
||||
OracleView.TabTitles, OracleView.TabVoid, OracleView.TabFellowship, OracleView.TabAbout };
|
||||
OracleContext c = Context();
|
||||
var view = new OracleView(c);
|
||||
foreach (string server in new[] { ServerTags.Aelrynth, ServerTags.Conquest, "" })
|
||||
foreach (string server in new[] { ServerTags.Aelrynth, ServerTags.Conquest, ServerTags.InfiniteLeaftide, "" })
|
||||
{
|
||||
c.Server.Force(server, server);
|
||||
string[] tabs = view.VisibleTabs();
|
||||
|
|
@ -876,7 +814,7 @@ namespace RynthOracle.Tests
|
|||
void Press(string scope) => Click("refresh." + scope);
|
||||
|
||||
// A Refresh button on every tab, on every server.
|
||||
foreach (string server in new[] { ServerTags.Aelrynth, ServerTags.Conquest, "" })
|
||||
foreach (string server in new[] { ServerTags.Aelrynth, ServerTags.Conquest, ServerTags.InfiniteLeaftide, "" })
|
||||
{
|
||||
c.Server.Force(server, server);
|
||||
foreach (string tab in view.VisibleTabs())
|
||||
|
|
@ -908,7 +846,7 @@ namespace RynthOracle.Tests
|
|||
foreach ((string tab, int wantChars, int wantQuests) in new[]
|
||||
{
|
||||
(OracleView.TabCharacter, 1, 0), (OracleView.TabAugs, 1, 1), (OracleView.TabSociety, 1, 1),
|
||||
(OracleView.TabMarkers, 0, 1), (OracleView.TabVoid, 1, 0),
|
||||
(OracleView.TabVoid, 1, 0),
|
||||
})
|
||||
{
|
||||
chars = quests = 0;
|
||||
|
|
@ -936,45 +874,6 @@ namespace RynthOracle.Tests
|
|||
c.NowMs += 4000;
|
||||
Press("About");
|
||||
Check(lists == 2, "About: allowed again after the pause");
|
||||
|
||||
// ConquestAC: the sub-page's own command, once per pause; the line follows the reply.
|
||||
c.Server.Force(ServerTags.Conquest, "Conquest");
|
||||
c.Settings.TabName = OracleView.TabConquest;
|
||||
string[] want = { "/b", "/augs", "/enl augs", "/bonus", "/fship list" };
|
||||
for (int v = 0; v < 6; v++)
|
||||
{
|
||||
Click("cq.v." + v);
|
||||
sent.Clear();
|
||||
quests = 0;
|
||||
c.NowMs += 4000;
|
||||
Press("Conquest" + v);
|
||||
if (v < 5) Check(sent.Count == 1 && sent[0] == want[v], $"Conquest view {v}: Refresh sends {want[v]} (sent {string.Join(",", sent)})");
|
||||
else Check(sent.Count == 0 && quests == 1, "Conquest custom quests: Refresh asks for the quest flags");
|
||||
Press("Conquest" + v);
|
||||
Check(sent.Count == (v < 5 ? 1 : 0), $"Conquest view {v}: a second press at once sends nothing more");
|
||||
}
|
||||
Click("cq.v.0");
|
||||
c.NowMs += 4000;
|
||||
Press("Conquest0");
|
||||
System.Threading.Thread.Sleep(5);
|
||||
c.Conquest.OnChatLine("[BANK] Pyreals: 2,000", c.NowMs, out _);
|
||||
Check(Draw().Contains("Updated "), "Conquest bank: the line says Updated when the balances arrive");
|
||||
|
||||
// Boards: ConquestAC's board, then Aelrynth's three views.
|
||||
c.Settings.TabName = OracleView.TabBoards;
|
||||
sent.Clear();
|
||||
c.NowMs += 4000;
|
||||
Press(OracleView.TabBoards + "00");
|
||||
Check(sent.Count == 1 && sent[0].StartsWith("/top "), "ConquestAC boards: Refresh sends /top <board>: " + string.Join(",", sent));
|
||||
c.Server.Force(ServerTags.Aelrynth, "Aeshnidae");
|
||||
sent.Clear();
|
||||
foreach ((int viewNo, string cmd) in new[] { (0, "/top"), (1, "/top me"), (2, "/trial") })
|
||||
{
|
||||
Click("ab.v" + viewNo);
|
||||
c.NowMs += 4000;
|
||||
Press($"{OracleView.TabBoards}{viewNo}0");
|
||||
Check(sent.Count > 0 && sent[^1].TrimEnd() == cmd, $"Aelrynth boards view {viewNo}: Refresh sends {cmd} (sent {sent.LastOrDefault()})");
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] Event(ushort type, uint seq, uint window, uint key, byte[] payload)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthOracle\**\*.cs" Exclude="..\..\Plugins\RynthCore.Plugin.RynthOracle\obj\**;..\..\Plugins\RynthCore.Plugin.RynthOracle\bin\**" Link="RynthOracle\%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthAi\Combat\FellowshipTracker.cs" Link="RynthOracle\Shared\FellowshipTracker.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthIltServerApi.cs" Link="RynthOracle\Shared\RynthIltServerApi.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthIltDataApi.cs" Link="RynthOracle\Shared\RynthIltDataApi.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthAiHubApi.cs" Link="RynthOracle\Shared\RynthAiHubApi.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthAiSessionClient.cs" Link="RynthOracle\Shared\RynthAiSessionClient.cs" />
|
||||
<!-- RynthCore's server list and the owner plugin's profile (as in the plugin's csproj). -->
|
||||
|
|
@ -47,7 +49,8 @@
|
|||
<EmbeddedResource Include="..\..\Plugins\RynthCore.Plugin.RynthOracle\Resources\society.csv" LogicalName="RynthOracle.society.csv" />
|
||||
<EmbeddedResource Include="..\..\Plugins\RynthCore.Plugin.RynthOracle\Resources\titles.csv" LogicalName="RynthOracle.titles.csv" />
|
||||
<EmbeddedResource Include="..\..\Plugins\RynthCore.Plugin.RynthOracle\Resources\markers.csv" LogicalName="RynthOracle.markers.csv" />
|
||||
<EmbeddedResource Include="..\..\Plugins\RynthCore.Plugin.RynthOracle\Resources\customquests.csv" LogicalName="RynthOracle.customquests.csv" />
|
||||
<EmbeddedResource Include="..\..\Plugins\RynthCore.Plugin.RynthOracle\Resources\legendary.csv" LogicalName="RynthOracle.legendary.csv" />
|
||||
<EmbeddedResource Include="..\..\Plugins\RynthCore.Plugin.RynthOracle\Resources\dynstamps.csv" LogicalName="RynthOracle.dynstamps.csv" />
|
||||
<EmbeddedResource Include="..\..\Plugins\RynthCore.Plugin.RynthAi\Combat\SpellData.txt" LogicalName="RynthOracle.SpellData.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
112
Tools/RynthOracle.Tests/ServerMoveTests.cs
Normal file
112
Tools/RynthOracle.Tests/ServerMoveTests.cs
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using RynthCore.Plugin.RynthOracle;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
namespace RynthOracle.Tests
|
||||
{
|
||||
// RynthOracle without one server's features (2026-10-20: Conquest's went to RynthConquest,
|
||||
// Aelrynth's to RynthAelrynth): the settings file keeps what moved, so the server plugin can
|
||||
// take it over once, and nothing of those servers is left in RynthOracle itself.
|
||||
internal static partial class Program
|
||||
{
|
||||
private static void ServerMove()
|
||||
{
|
||||
SettingsKeepUnknown();
|
||||
ConquestGone();
|
||||
AelrynthGone();
|
||||
}
|
||||
|
||||
/// <summary>Aelrynth without RynthAelrynth: no leaderboards or Trials in RynthOracle (the quest pack stays, as data).</summary>
|
||||
private static void AelrynthGone()
|
||||
{
|
||||
Check(typeof(RynthOraclePlugin).Assembly.GetType("RynthCore.Plugin.RynthOracle.Data.AelrynthBoards") == null,
|
||||
"aelrynth: the /top and /trial parser is not in RynthOracle");
|
||||
Check(typeof(OracleContext).GetField("Boards") == null, "aelrynth: RynthOracle keeps no leaderboard data");
|
||||
var c = new OracleContext { InWorld = true };
|
||||
var view = new OracleView(c);
|
||||
c.Server.Force(ServerTags.Aelrynth, "Aeshnidae");
|
||||
string[] tabs = view.VisibleTabs();
|
||||
Check(Array.IndexOf(tabs, "Leaderboards") < 0, "aelrynth: no Leaderboards tab in RynthOracle on Aelrynth: " + string.Join(",", tabs));
|
||||
c.Catalog.Load(ServerTags.Aelrynth, null);
|
||||
Check(c.Catalog.PackServer == ServerTags.Aelrynth && c.Catalog.ServerCount > 0, "aelrynth: the quest pack is still RynthOracle's (data)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conquest without RynthConquest: no Conquest data, setting, auto-deposit or tab in RynthOracle,
|
||||
/// and the Void DoT rule comes only from the server plugin's profile.
|
||||
/// </summary>
|
||||
private static void ConquestGone()
|
||||
{
|
||||
const System.Reflection.BindingFlags All = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static
|
||||
| System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic;
|
||||
Check(typeof(OracleSettings).GetField("ConquestAutoDeposit", All) == null, "conquest: RynthOracle has no auto-deposit setting");
|
||||
Check(typeof(OracleContext).GetField("Conquest", All) == null, "conquest: RynthOracle keeps no Conquest data");
|
||||
Check(typeof(RynthOraclePlugin).GetMethod("TickConquest", All) == null, "conquest: RynthOracle's tick has no Conquest part (no auto-deposit, no /augs)");
|
||||
Check(typeof(RynthOraclePlugin).Assembly.GetType("RynthCore.Plugin.RynthOracle.Data.ConquestData") == null
|
||||
&& typeof(RynthOraclePlugin).Assembly.GetType("RynthCore.Plugin.RynthOracle.Data.CustomQuestList") == null,
|
||||
"conquest: the Conquest reply parser and custom quest list are not in RynthOracle");
|
||||
|
||||
// Conquest tagged by its world name (RynthConquest not installed): retail tabs only.
|
||||
var c = new OracleContext { InWorld = true };
|
||||
var view = new OracleView(c);
|
||||
c.Server.Force(ServerTags.Conquest, "Conquest");
|
||||
string[] tabs = view.VisibleTabs();
|
||||
Check(Array.IndexOf(tabs, "Conquest") < 0 && Array.IndexOf(tabs, "Leaderboards") < 0,
|
||||
"conquest: no Conquest pages in RynthOracle on Conquest: " + string.Join(",", tabs));
|
||||
|
||||
// The Void DoT rule: whatever the server plugin publishes (1 to 10), 1 without one.
|
||||
Check(RynthOraclePlugin.VoidScaleFrom(null) == 1.0 && RynthOraclePlugin.VoidScaleFrom("") == 1.0, "void scale: 1 without a profile");
|
||||
Check(RynthOraclePlugin.VoidScaleFrom("{\"id\":\"coldeve\",\"values\":{}}") == 1.0, "void scale: 1 for a server without the rule");
|
||||
Check(Math.Abs(RynthOraclePlugin.VoidScaleFrom("{\"id\":\"conquest\",\"values\":{\"voidDotDurationScale\":2.15}}") - 2.15) < 1e-12,
|
||||
"void scale: RynthConquest's value is applied");
|
||||
Check(RynthOraclePlugin.VoidScaleFrom("{\"values\":{\"voidDotDurationScale\":0.5}}") == 1.0
|
||||
&& RynthOraclePlugin.VoidScaleFrom("{\"values\":{\"voidDotDurationScale\":50}}") == 1.0,
|
||||
"void scale: a value out of 1..10 is ignored");
|
||||
var v = new VoidTracker();
|
||||
v.OnChatLine("You cast Corrosion VII on Drudge Slinker", 1_000_000, _ => 0x50000001u, () => false, 2.0);
|
||||
Check(v.Remaining(0x50000001u, "Drudge Slinker", VoidFamily.Corrosion, 1_001_000, out _) == 31,
|
||||
"void scale: a scaled Corrosion lasts 30 s (+2 s before the first tick)");
|
||||
}
|
||||
|
||||
/// <summary>A value this version doesn't use survives a load and a save, unchanged.</summary>
|
||||
private static void SettingsKeepUnknown()
|
||||
{
|
||||
string? saved = OracleSettings.PathOverride;
|
||||
string path = Path.Combine(Path.GetTempPath(), "RynthOracleTests-" + Guid.NewGuid().ToString("N") + "-keep.json");
|
||||
OracleSettings.PathOverride = path;
|
||||
try
|
||||
{
|
||||
File.WriteAllText(path, "{ \"hideOwnQuestReplies\": false, \"conquestAutoDeposit\": true, \"fromTheFuture\": {\"x\": [1, \"two\"]}, \"tabName\": \"Void\" }");
|
||||
var s = new OracleSettings();
|
||||
s.Load();
|
||||
Check(!s.HideOwnQuestReplies && s.TabName == "Void", "settings: known values read as before");
|
||||
s.MainWindowOpen = true;
|
||||
s.Save();
|
||||
using (JsonDocument doc = JsonDocument.Parse(File.ReadAllText(path)))
|
||||
{
|
||||
JsonElement r = doc.RootElement;
|
||||
Check(r.TryGetProperty("conquestAutoDeposit", out JsonElement cq) && cq.ValueKind == JsonValueKind.True,
|
||||
"settings: a moved setting (conquestAutoDeposit) is still in the file after a save");
|
||||
Check(r.TryGetProperty("fromTheFuture", out JsonElement f) && f.GetProperty("x").GetArrayLength() == 2,
|
||||
"settings: an unknown value is written back unchanged");
|
||||
Check(r.GetProperty("mainWindowOpen").GetBoolean(), "settings: the change was saved");
|
||||
}
|
||||
var again = new OracleSettings();
|
||||
again.Load();
|
||||
again.Save();
|
||||
again.Save();
|
||||
string text = File.ReadAllText(path);
|
||||
Check(text.IndexOf("fromTheFuture", StringComparison.Ordinal) == text.LastIndexOf("fromTheFuture", StringComparison.Ordinal),
|
||||
"settings: kept values aren't duplicated by repeated saves");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { File.Delete(path); } catch { }
|
||||
OracleSettings.PathOverride = saved;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue