Snapshot for release 2026.10.22.2 (internal 466f796)
This commit is contained in:
parent
c4efe5821d
commit
2be3668232
12 changed files with 666 additions and 27 deletions
24
tools/AtlasRecallsTests/AtlasRecallsTests.csproj
Normal file
24
tools/AtlasRecallsTests/AtlasRecallsTests.csproj
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the recall spells as Atlas places (2026-10-22, Skippy: RynthNav's Atlas found
|
||||
nothing for "neft"): src\RynthCore.Engine\UI\Data\RynthNavAtlasRecalls.cs (NavPlace and
|
||||
RynthNavAtlasRecalls.Read), compiled in. A sample "recalls" array: on-map and dungeon spots, a
|
||||
spell listed twice, unnamed and malformed entries, no "recalls" at all. Then the shipped
|
||||
C:\Games\RynthCore\NavData\locations.json, read only, when it is there: its recalls load, and
|
||||
"neft" now finds a place. No ImGui, no game. Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>AtlasRecallsTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\RynthNavAtlasRecalls.cs" Link="Engine\RynthNavAtlasRecalls.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
103
tools/AtlasRecallsTests/Program.cs
Normal file
103
tools/AtlasRecallsTests/Program.cs
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using RynthCore.Engine.UI.Data;
|
||||
|
||||
namespace AtlasRecallsTests;
|
||||
|
||||
// Offline tests for the recall spells as Atlas places. See the csproj.
|
||||
internal static class Program
|
||||
{
|
||||
private static int _fails, _asserts;
|
||||
private static void Check(bool cond, string msg)
|
||||
{
|
||||
_asserts++;
|
||||
if (!cond) { _fails++; Console.WriteLine($" [FAIL] {msg}"); }
|
||||
}
|
||||
private static void Eq<T>(T actual, T expected, string msg) =>
|
||||
Check(EqualityComparer<T>.Default.Equals(actual, expected), $"{msg}: expected '{expected}', got '{actual}'");
|
||||
|
||||
// Stands in for RynthNavStatus.Coord (the engine's "22.2S, 6.2E").
|
||||
private static string Coord(double ns, double ew) =>
|
||||
string.Format(CultureInfo.InvariantCulture, "{0:0.0}{1}, {2:0.0}{3}", Math.Abs(ns), ns < 0 ? "S" : "N", Math.Abs(ew), ew < 0 ? "W" : "E");
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
Sample();
|
||||
Malformed();
|
||||
ShippedAtlas();
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(_fails == 0 ? $"PASS ({_asserts} checks)" : $"FAIL ({_fails} of {_asserts} checks failed)");
|
||||
return _fails == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// Shaped like tools\navdata\gen_locations.py's "recalls" (spell, name, cell, place, ns/ew or in).
|
||||
private const string Json = """
|
||||
{"locations":[{"id":1,"name":"Holtburg","type":"Town","cell":"A9B40019","place":"outdoor","ns":42.1,"ew":33.6}],
|
||||
"recalls":[
|
||||
{"spell":5541,"name":"Lost City of Neftet Recall","cell":"8763000E","place":"outdoor","ns":-22.21,"ew":6.22},
|
||||
{"spell":2479,"name":"Advance Camp Recall","cell":"027B0200","place":"dungeon","in":"Vile-Smelling Refuse"},
|
||||
{"spell":1635,"name":"Ulgrim's Recall","cell":"01960118","place":"dungeon"},
|
||||
{"spell":1636,"name":"Ulgrim's Recall","cell":"01960118","place":"dungeon"},
|
||||
{"spell":2023,"name":"Recall the Sanctuary","cell":"F4180104","place":"building","ns":-82.55,"ew":93.4}
|
||||
]}
|
||||
""";
|
||||
|
||||
private static void Sample()
|
||||
{
|
||||
using var doc = JsonDocument.Parse(Json);
|
||||
List<NavPlace> places = RynthNavAtlasRecalls.Read(doc.RootElement, Coord);
|
||||
Eq(places.Count, 4, "four places (Ulgrim's Recall twice at one cell is one)");
|
||||
Check(places.All(p => p.Type == "Recall"), "all of type Recall");
|
||||
Check(places.All(p => p.Id < 0), "negative ids (locations have positive ones)");
|
||||
|
||||
NavPlace neftet = places.Single(p => p.Name == "Lost City of Neftet Recall");
|
||||
Check(neftet.OnMap, "Neftet's recall is on the map");
|
||||
Check(Math.Abs(neftet.Ns + 22.21) < 1e-9 && Math.Abs(neftet.Ew - 6.22) < 1e-9, "at 22.21S, 6.22E");
|
||||
Eq(neftet.CoordText, "22.2S, 6.2E", "its coordinates as the engine shows them");
|
||||
Eq(neftet.Id, -5541, "id = -spell");
|
||||
Eq(neftet.Lb, "8763", "landblock from the cell");
|
||||
Check(neftet.Name.Contains("neft", StringComparison.OrdinalIgnoreCase), "\"neft\" is in its name (Skippy's search)");
|
||||
|
||||
NavPlace camp = places.Single(p => p.Name == "Advance Camp Recall");
|
||||
Check(!camp.OnMap, "a dungeon recall is off the map");
|
||||
Eq(camp.CoordText, "in Vile-Smelling Refuse", "named for its dungeon");
|
||||
Check(camp.Desc.Contains("Vile-Smelling Refuse"), "and its description says so");
|
||||
|
||||
Eq(places.Single(p => p.Name == "Ulgrim's Recall").CoordText, "in a dungeon", "a dungeon recall without a name");
|
||||
Check(places.Single(p => p.Name == "Recall the Sanctuary").OnMap, "a building on the map is on the map");
|
||||
}
|
||||
|
||||
private static void Malformed()
|
||||
{
|
||||
using (var none = JsonDocument.Parse("""{"locations":[]}"""))
|
||||
Eq(RynthNavAtlasRecalls.Read(none.RootElement, Coord).Count, 0, "no \"recalls\": none");
|
||||
using (var wrong = JsonDocument.Parse("""{"recalls":{"name":"x"}}"""))
|
||||
Eq(RynthNavAtlasRecalls.Read(wrong.RootElement, Coord).Count, 0, "\"recalls\" not an array: none");
|
||||
using var bad = JsonDocument.Parse("""
|
||||
{"recalls":[ 7, null, {"spell":1}, {"name":" "}, {"spell":"x","name":"Odd Recall","ns":"north","ew":3},
|
||||
{"name":"No Spell Recall","ns":1.5,"ew":-2.5} ]}
|
||||
""");
|
||||
List<NavPlace> places = RynthNavAtlasRecalls.Read(bad.RootElement, Coord);
|
||||
Eq(places.Count, 2, "non-objects and unnamed entries left out");
|
||||
NavPlace odd = places.Single(p => p.Name == "Odd Recall");
|
||||
Check(!odd.OnMap, "a non-number coordinate: off the map");
|
||||
Eq(odd.Id, 0, "a non-number spell: id 0");
|
||||
Eq(places.Single(p => p.Name == "No Spell Recall").CoordText, "1.5N, 2.5W", "no spell, still placed");
|
||||
}
|
||||
|
||||
// The NavData the release ships (read only), when this PC has it.
|
||||
private static void ShippedAtlas()
|
||||
{
|
||||
string path = @"C:\Games\RynthCore\NavData\locations.json";
|
||||
if (!File.Exists(path)) { Console.WriteLine(" (skipped the shipped Atlas: no " + path + ")"); return; }
|
||||
using var doc = JsonDocument.Parse(File.ReadAllText(path));
|
||||
List<NavPlace> places = RynthNavAtlasRecalls.Read(doc.RootElement, Coord);
|
||||
Check(places.Count >= 20, $"the shipped Atlas has recall places ({places.Count})");
|
||||
Check(places.Any(p => p.OnMap && p.Name.Contains("neft", StringComparison.OrdinalIgnoreCase)),
|
||||
"\"neft\" finds a place on the map (Lost City of Neftet Recall)");
|
||||
var ids = new HashSet<int>();
|
||||
foreach (JsonElement e in doc.RootElement.GetProperty("locations").EnumerateArray())
|
||||
if (e.TryGetProperty("id", out JsonElement id) && id.TryGetInt32(out int n)) ids.Add(n);
|
||||
Check(places.All(p => !ids.Contains(p.Id)), "no recall id collides with a location's");
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,8 @@ internal static class Program
|
|||
catch (ArgumentException ex) { error = ex.Message; return null; }
|
||||
}
|
||||
|
||||
private static Regex? Now(ChatMatchMode mode, string pattern) => ChatRuleMatching.Compile(mode, pattern, 15, out _);
|
||||
// A long timeout: these check what a mode matches, not the engine's 15 ms limit (see SameAsBefore).
|
||||
private static Regex? Now(ChatMatchMode mode, string pattern) => ChatRuleMatching.Compile(mode, pattern, 5000, out _);
|
||||
|
||||
private static void SameAsBefore(string pattern, string why)
|
||||
{
|
||||
|
|
@ -99,9 +100,14 @@ internal static class Program
|
|||
Check(errBefore == errNow, $"{why}: same error ('{pattern}')");
|
||||
if (before == null || now == null) return;
|
||||
Check(before.ToString() == now.ToString() && before.Options == now.Options, $"{why}: same regex and options ('{pattern}')");
|
||||
Check(before.MatchTimeout == now.MatchTimeout, $"{why}: same match timeout ('{pattern}')");
|
||||
// The comparison matches get time to spare: the 15 ms limit itself is checked just above, and
|
||||
// on a busy PC (game clients, a release build) a first match can take longer (2026-10-22).
|
||||
Regex beforeSlow = new(before.ToString(), before.Options, TimeSpan.FromSeconds(5));
|
||||
Regex nowSlow = new(now.ToString(), now.Options, TimeSpan.FromSeconds(5));
|
||||
foreach (string line in Lines)
|
||||
{
|
||||
Match a = before.Match(line), b = now.Match(line);
|
||||
Match a = beforeSlow.Match(line), b = nowSlow.Match(line);
|
||||
Check(a.Success == b.Success && a.Index == b.Index && a.Length == b.Length, $"{why}: same match on '{line}' ('{pattern}')");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ internal static class Program
|
|||
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
string exe = FindExe(args.Length > 0 ? args[0] : @"C:\Turbine\Asheron's Call-ryn");
|
||||
// Without an argument (scripts\Run-AllTests.ps1): the launcher's own client, or the old
|
||||
// C:\Turbine\Asheron's Call-ryn, which the build PC no longer has (2026-10-22).
|
||||
string exe = FindExe(args.Length > 0 ? args[0]
|
||||
: new[] { @"C:\Games\RynthCore\AcClient", @"C:\Turbine\Asheron's Call-ryn" }
|
||||
.FirstOrDefault(d => File.Exists(Path.Combine(d, "acclient.exe"))) ?? @"C:\Games\RynthCore\AcClient");
|
||||
RealClient(exe);
|
||||
SyntheticPatterns();
|
||||
PaddingArithmetic();
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
<Compile Include="..\..\src\RynthCore.App.Avalonia\RynthUpdater.NavData.cs" Link="Linked\RynthUpdater.NavData.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\RynthUpdater.Available.cs" Link="Linked\RynthUpdater.Available.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\RynthUpdater.MapPacks.cs" Link="Linked\RynthUpdater.MapPacks.cs" />
|
||||
<!-- Roll back (2026-10-21): RynthUpdater.cs reads its held-release state. -->
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\RynthUpdater.Rollback.cs" Link="Linked\RynthUpdater.Rollback.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\DownloadProgress.cs" Link="Linked\DownloadProgress.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\UpdateTrust.cs" Link="Linked\UpdateTrust.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Plugins\PluginContractVersion.cs" Link="Linked\PluginContractVersion.cs" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue