RynthSuite as of 2026-11-26 (internal 1db112e): release 2026.11.26.1
This commit is contained in:
parent
90e76a6561
commit
25552fa794
175 changed files with 23428 additions and 494 deletions
|
|
@ -38,6 +38,7 @@ internal static partial class Program
|
|||
Run(nameof(RecallListFromSpellbookAndMemory), RecallListFromSpellbookAndMemory);
|
||||
Run(nameof(RecallListColdSpellbook), RecallListColdSpellbook);
|
||||
Run(nameof(RecallMemoryRoundTrip), RecallMemoryRoundTrip);
|
||||
Run(nameof(PortalRecallNoRecall), PortalRecallNoRecall);
|
||||
Run(nameof(RecallMessages), RecallMessages);
|
||||
Run(nameof(HandCastOnALifestone), HandCastOnALifestone);
|
||||
Run(nameof(HandCastPortalTie), HandCastPortalTie);
|
||||
|
|
@ -67,6 +68,7 @@ internal static partial class Program
|
|||
RunArrival();
|
||||
RunRealWalks();
|
||||
RunTripTimes();
|
||||
RunTargetSwitch();
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(_fails == 0 && _asserts > 0
|
||||
|
|
@ -228,6 +230,31 @@ internal static partial class Program
|
|||
Check(notes.Exists(n => n.Contains("Spellbook not read")), "says why");
|
||||
}
|
||||
|
||||
// R-20261126-024033-5d60 (Conquest): from the Dark Isle, which can't be recalled to, a goto cast Portal Recall and
|
||||
// landed in a dungeon visited earlier. ACE keeps a portal as the last portal only if it isn't NoRecall.
|
||||
private static void PortalRecallNoRecall()
|
||||
{
|
||||
Check(RecallPlanner.ForPortal(1) == RecallPlanner.LastPortalUpdate.Set, "an ordinary portal: Portal Recall goes there");
|
||||
Check(RecallPlanner.ForPortal(0x20) == RecallPlanner.LastPortalUpdate.Keep, "a no-recall portal: the last portal stays the one before");
|
||||
Check(RecallPlanner.ForPortal(0x20 | 0x2) == RecallPlanner.LastPortalUpdate.Keep, "no-recall among other rules");
|
||||
Check(RecallPlanner.ForPortal(null) == RecallPlanner.LastPortalUpdate.SetUnconfirmed, "a portal not in the list: unconfirmed");
|
||||
|
||||
Atlas atlas = Atlas.Parse(AtlasJson);
|
||||
var known = new HashSet<int> { RecallPlanner.PortalRecall };
|
||||
var mem = new RecallMemory();
|
||||
mem.Set("c", RecallSlot.LastPortal, new RecallSpot { OnMap = true, Ns = 10, Ew = 20, Label = "Somewhere", Unconfirmed = true });
|
||||
var notes = new List<string>();
|
||||
var list = RecallPlanner.Build(atlas, known, mem, "c", notes);
|
||||
Check(!list.Exists(o => o.Name == "Portal Recall"), "an unconfirmed landing isn't used for routes");
|
||||
Check(notes.Exists(n => n.StartsWith("Portal Recall") && n.Contains("cast Portal Recall once")), "...and says so");
|
||||
|
||||
var back = RecallMemory.Parse(mem.Serialize());
|
||||
Check(back.Get("c", RecallSlot.LastPortal)?.Unconfirmed == true, "unconfirmed survives a save");
|
||||
mem.Set("c", RecallSlot.LastPortal, new RecallSpot { OnMap = true, Ns = 10, Ew = 20, Label = "Somewhere" });
|
||||
Check(RecallPlanner.Build(atlas, known, mem, "c", null).Exists(o => o.Name == "Portal Recall"), "confirmed: used again");
|
||||
Check(RecallMemory.Parse(mem.Serialize()).Get("c", RecallSlot.LastPortal)?.Unconfirmed == false, "a confirmed spot reads back confirmed");
|
||||
}
|
||||
|
||||
private static void RecallMemoryRoundTrip()
|
||||
{
|
||||
var mem = new RecallMemory();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\AtlasStore.cs" Link="Linked\AtlasStore.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\NavReplies.cs" Link="Linked\NavReplies.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\ArrowGuide.cs" Link="Linked\ArrowGuide.cs" />
|
||||
<!-- One target at a time (TargetSwitchTests). -->
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\TargetSwitch.cs" Link="Linked\TargetSwitch.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\RecallMemory.cs" Link="Linked\RecallMemory.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\RecallPlanner.cs" Link="Linked\RecallPlanner.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\NavDataConfig.cs" Link="Linked\NavDataConfig.cs" />
|
||||
|
|
|
|||
90
Tools/RynthNav.RouteTests/TargetSwitchTests.cs
Normal file
90
Tools/RynthNav.RouteTests/TargetSwitchTests.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using RynthCore.Plugin.RynthNav;
|
||||
|
||||
namespace RynthNav.RouteTests;
|
||||
|
||||
// 11-24, a player, on clicking coordinates in chat: "It puts it into the top part of this arrow
|
||||
// window. The bottom part follows the rynthnav thing though." One target at a time, the newest wins
|
||||
// (TargetSwitch): what a new arrow, plan or clear does to the route shown and the trip walked.
|
||||
internal static partial class Program
|
||||
{
|
||||
private static void RunTargetSwitch()
|
||||
{
|
||||
Run(nameof(TargetSamePlace), TargetSamePlace);
|
||||
Run(nameof(TargetArrowOverAPlan), TargetArrowOverAPlan);
|
||||
Run(nameof(TargetArrowWhileWalking), TargetArrowWhileWalking);
|
||||
Run(nameof(TargetPlanWhileWalking), TargetPlanWhileWalking);
|
||||
Run(nameof(TargetClear), TargetClear);
|
||||
}
|
||||
|
||||
// Holtburg's lifestone-ish spot, and a place far from it.
|
||||
private const double HoltNs = 42.08, HoltEw = 33.60, FarNs = -12.3, FarEw = 45.6;
|
||||
|
||||
private static HeldTarget Nothing => new(false, "", double.NaN, double.NaN, false, "", double.NaN, double.NaN);
|
||||
private static HeldTarget PlanTo(double ns, double ew) => new(true, "Holtburg", ns, ew, false, "", double.NaN, double.NaN);
|
||||
private static HeldTarget WalkingTo(double ns, double ew) => new(true, "Holtburg", ns, ew, true, "Holtburg", ns, ew);
|
||||
|
||||
private static void TargetSamePlace()
|
||||
{
|
||||
Check(TargetSwitch.SamePlace(HoltNs, HoltEw, HoltNs, HoltEw), "a place is itself");
|
||||
// Chat coordinates have one decimal: 42.1N, 33.6E is Holtburg's 42.08N, 33.60E.
|
||||
Check(TargetSwitch.SamePlace(42.1, 33.6, HoltNs, HoltEw), "rounded chat coords are the same place");
|
||||
Check(!TargetSwitch.SamePlace(42.3, 33.6, HoltNs, HoltEw), "0.2 degrees away is another place (53 u)");
|
||||
Check(!TargetSwitch.SamePlace(FarNs, FarEw, HoltNs, HoltEw), "far away is another place");
|
||||
Check(!TargetSwitch.SamePlace(double.NaN, double.NaN, HoltNs, HoltEw), "an unknown spot is never the same place");
|
||||
Check(!TargetSwitch.SamePlace(HoltNs, HoltEw, double.NaN, 33.6), "nor is a route with no goal known");
|
||||
}
|
||||
|
||||
private static void TargetArrowOverAPlan()
|
||||
{
|
||||
// The report: a route was planned to one place, then chat coords elsewhere were clicked.
|
||||
TargetChange c = TargetSwitch.For(NewTarget.Arrow, PlanTo(HoltNs, HoltEw), FarNs, FarEw);
|
||||
Check(c.DropPlan, "an arrow elsewhere drops the old plan (no second target under it)");
|
||||
Check(!c.StopTrip && !c.KeepArrow, "nothing walking: nothing to stop, the arrow moves");
|
||||
|
||||
c = TargetSwitch.For(NewTarget.Arrow, PlanTo(HoltNs, HoltEw), 42.1, 33.6);
|
||||
Check(c == TargetChange.None, "an arrow at the planned place keeps the plan (it is the same target)");
|
||||
|
||||
c = TargetSwitch.For(NewTarget.Arrow, Nothing, FarNs, FarEw);
|
||||
Check(c == TargetChange.None, "an arrow with nothing before it changes nothing else");
|
||||
|
||||
// A plan whose goal isn't known (an older plan): another target can't be shown to match it.
|
||||
c = TargetSwitch.For(NewTarget.Arrow, PlanTo(double.NaN, double.NaN), HoltNs, HoltEw);
|
||||
Check(c.DropPlan, "a plan with no known goal goes when the arrow is set");
|
||||
|
||||
// A plan replaces the shown route by itself: nothing to drop first.
|
||||
c = TargetSwitch.For(NewTarget.Plan, PlanTo(HoltNs, HoltEw), FarNs, FarEw);
|
||||
Check(c == TargetChange.None, "a new plan over an old plan: the plan replaces it");
|
||||
}
|
||||
|
||||
private static void TargetArrowWhileWalking()
|
||||
{
|
||||
TargetChange c = TargetSwitch.For(NewTarget.Arrow, WalkingTo(HoltNs, HoltEw), FarNs, FarEw);
|
||||
Check(c.StopTrip, "an arrow elsewhere ends the walk (the newest target wins)");
|
||||
Check(c.DropPlan, "...and the walk's route goes with it");
|
||||
Check(!c.KeepArrow, "...and the arrow moves to the new place");
|
||||
|
||||
c = TargetSwitch.For(NewTarget.Arrow, WalkingTo(HoltNs, HoltEw), 42.1, 33.6);
|
||||
Check(!c.StopTrip && !c.DropPlan, "the arrow at the place being walked to keeps the walk");
|
||||
Check(c.KeepArrow, "...and keeps the trip's own arrow (along its portals)");
|
||||
}
|
||||
|
||||
private static void TargetPlanWhileWalking()
|
||||
{
|
||||
TargetChange c = TargetSwitch.For(NewTarget.Plan, WalkingTo(HoltNs, HoltEw), FarNs, FarEw);
|
||||
Check(c.StopTrip && !c.KeepArrow, "planning elsewhere ends the walk; the arrow follows the plan");
|
||||
Check(!c.DropPlan, "the plan replaces the walk's route itself");
|
||||
|
||||
c = TargetSwitch.For(NewTarget.Plan, WalkingTo(HoltNs, HoltEw), HoltNs, HoltEw);
|
||||
Check(!c.StopTrip && c.KeepArrow, "planning the place being walked to: the walk and its arrow go on");
|
||||
}
|
||||
|
||||
private static void TargetClear()
|
||||
{
|
||||
TargetChange c = TargetSwitch.For(NewTarget.Clear, WalkingTo(HoltNs, HoltEw));
|
||||
Check(c.StopTrip && c.DropPlan && !c.KeepArrow, "clear while walking: stop, drop the route, arrow off");
|
||||
c = TargetSwitch.For(NewTarget.Clear, PlanTo(HoltNs, HoltEw));
|
||||
Check(!c.StopTrip && c.DropPlan, "clear with a plan: the plan goes");
|
||||
Check(TargetSwitch.For(NewTarget.Clear, Nothing) == TargetChange.None, "clear with nothing: nothing to do");
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ internal static partial class Program
|
|||
Run(nameof(MarkersEmitNearTheCharacter), MarkersEmitNearTheCharacter);
|
||||
Run(nameof(MarkersNextWaypointAdvances), MarkersNextWaypointAdvances);
|
||||
Run(nameof(MarkersClearOffTheTrip), MarkersClearOffTheTrip);
|
||||
Run(nameof(PlanMarkersGoAtTheGoal), PlanMarkersGoAtTheGoal);
|
||||
}
|
||||
|
||||
// ── Helpers ──────────────────────────────────────────────────────────
|
||||
|
|
@ -386,4 +387,27 @@ internal static partial class Program
|
|||
Check(hubTrip.Covers(0x0007, null, net.Contains), "inside the Town Network on a trip that takes it");
|
||||
Check(!trip.Covers(0x0007, path, net.Contains), "...but not on one that doesn't");
|
||||
}
|
||||
|
||||
// 2026-11-26 (a player's report): a plan's markers (Route, an Oracle quest pick) stayed on the
|
||||
// ground after the character walked there; now they go at the goal, as a walked trip's do.
|
||||
private static void PlanMarkersGoAtTheGoal()
|
||||
{
|
||||
var (plan, _) = MarkerTrip();
|
||||
double arrive = ArrowGuide.DefaultArriveUnits;
|
||||
Check(PathMarkers.PlanReached(plan, true, 50.4, 50.3, arrive), "standing on a plan's goal: done");
|
||||
Check(PathMarkers.PlanReached(plan, true, 50.4 + 5 / 240.0, 50.3, arrive), "a few yards off it: done");
|
||||
Check(!PathMarkers.PlanReached(plan, true, 50.4 + 40 / 240.0, 50.3, arrive), "40 yd off: still shown");
|
||||
Check(!PathMarkers.PlanReached(plan, true, 10, 10, arrive), "where it starts: still shown");
|
||||
Check(!PathMarkers.PlanReached(plan, false, 50.4, 50.3, arrive), "no map position (a dungeon, portal space): still shown");
|
||||
|
||||
var steps = plan.Steps.ToList();
|
||||
WorldPt start = WorldPt.FromMap(10, 10, 5.0);
|
||||
var walked = new PlannedTrip(2, steps, "Far Goal", 50.4, 50.3, true, start, (start.Landblock << 16) | 1, null, live: true);
|
||||
Check(!PathMarkers.PlanReached(walked, true, 50.4, 50.3, arrive), "a walked trip reports its own arrival (FinishGoto)");
|
||||
|
||||
var entrance = new List<RouteStep> { new(50.4, 50.3, true, false, "Dungeon Portal", -1, 0, 0) };
|
||||
var intoDungeon = Trip(entrance, 10, 10, "A Dungeon", 50.4, 50.3, enterPortal: "Dungeon Portal", enterName: "A Dungeon");
|
||||
Check(intoDungeon.EndsInEntrance, "the test's plan ends in a dungeon's entrance");
|
||||
Check(!PathMarkers.PlanReached(intoDungeon, true, 50.4, 50.3, arrive), "a plan into a dungeon goes through its entrance (the landblock check), not at it");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue