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
2
BUILD.md
2
BUILD.md
|
|
@ -32,6 +32,8 @@ C:\Games\RynthSuite\<Plugin>\ ← each plugin as a managed assembly + its depend
|
|||
| Loader/Shim change, clients running | `scripts\Publish-EngineCoreClr.ps1` — the in-use copies are renamed aside; new launches get the new ones |
|
||||
| Installer | `installer\Build-Installer.ps1` (release plugins stay NativeAOT: the new engine loads them) |
|
||||
| Hot-reload test on a local server | `scripts\Test-ClrWorld.ps1 -Reloads 3` (see its header) |
|
||||
| Every offline test (RynthCore, RynthSuite, RynthServers) | `scripts\Run-AllTests.ps1` (`-Only <folder>` for one); `installer\Publish-Update.ps1` runs it and won't publish if one fails |
|
||||
| RynthAi in game (buffing, a kill, looting, missile crafting) | `scripts\Run-GameTest.ps1` (logs a test character in, runs RynthSuite's `GameTests\RynthSelfTest.af`, prints PASS / FAIL / SKIP; see its header) |
|
||||
| Why didn't a generation unload? | `tools\AlcRoots <pid>` (build it: `dotnet build tools\AlcRoots -c Release`) |
|
||||
|
||||
`-NativeAot` on `Deploy-RynthCore.ps1` and `Build-Installer.ps1` builds the old NativeAOT engine,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@
|
|||
if either repo has uncommitted changes, or if -Version isn't newer than the live feed;
|
||||
with -SkipNavData, also if the last published RynthNav map can't be found or isn't on
|
||||
the server as signed (a feed without it gives new RynthNav players no map).
|
||||
2. Builds the installer (Build-Installer.ps1 -Version; it includes the Decal bridge, so the
|
||||
2. Runs every offline test program in RynthCore, RynthSuite and RynthServers
|
||||
(scripts\Run-AllTests.ps1) and stops if any fails: nothing is built or uploaded.
|
||||
Then builds the installer (Build-Installer.ps1 -Version; it includes the Decal bridge, so the
|
||||
build machine needs Decal installed) and the RynthSuite plugins into
|
||||
installer\Releases\<release>\ — never into the live C:\Games folders.
|
||||
3. Writes the manifest (sizes + SHA-256 of every file), signs it with the DPAPI key
|
||||
|
|
@ -35,6 +37,9 @@ param(
|
|||
[string]$Notes = "",
|
||||
[switch]$DryRun, # build + sign + verify, upload nothing
|
||||
[switch]$AllowDirty, # publish with uncommitted changes (don't)
|
||||
# Publish without running the test programs first (step 2). For an emergency hotfix only; the
|
||||
# release log says the tests were skipped.
|
||||
[switch]$SkipTests,
|
||||
[string]$SshHost = "aelrynth-vps",
|
||||
[string]$RemoteDir = "/var/www/site/downloads/rynth",
|
||||
[string]$BaseUrl = "https://aelrynth.com/downloads/rynth",
|
||||
|
|
@ -275,6 +280,20 @@ $rel = Join-Path $ScriptDir "Releases\$release"
|
|||
if (Test-Path $rel) { Remove-Item $rel -Recurse -Force }
|
||||
New-Item -ItemType Directory -Force "$rel\plugins", "$rel\build" | Out-Null
|
||||
|
||||
# Every offline test program in the three repos, before anything is built (2026-10-22: tests only ran
|
||||
# when someone remembered to). One failure stops the release; the logs stay in Releases\<release>\tests.
|
||||
if ($SkipTests) {
|
||||
Step "Tests SKIPPED (-SkipTests)"
|
||||
Write-Warning "Publishing $Version without running the tests."
|
||||
} else {
|
||||
Step "Running the tests (scripts\Run-AllTests.ps1)"
|
||||
& (Join-Path $RepoRoot "scripts\Run-AllTests.ps1") -RynthCoreRoot $RepoRoot -RynthSuiteRoot $RynthSuiteRoot `
|
||||
-RynthServersRoot $RynthServersRoot -LogDir "$rel\tests"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Tests failed (summary above, logs in $rel\tests) - not publishing. Fix them, or pass -SkipTests for an emergency hotfix."
|
||||
}
|
||||
}
|
||||
|
||||
# Plugins: built MANAGED by default (collectible: a reload frees them; NativeAOT plugins can never be
|
||||
# unloaded, so every reload kept a copy of each one - 220-450 MB of address space per reload,
|
||||
# 2026-10-19). Each managed plugin still ships as one DLL in the feed: their common dependencies
|
||||
|
|
|
|||
155
scripts/Run-AllTests.ps1
Normal file
155
scripts/Run-AllTests.ps1
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
#Requires -Version 7
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Builds and runs every offline test program in RynthCore, RynthSuite and RynthServers. Exit 0 only
|
||||
when every one passes.
|
||||
|
||||
.DESCRIPTION
|
||||
The test programs are console apps: RynthCore tools\*Tests, RynthSuite and RynthServers Tools\*Tests,
|
||||
each run as `dotnet run -c Release` from its own folder (exit 0 = pass, anything else = fail), and the
|
||||
loader's C tests (a Run-Tests.ps1 beside test.c, built with MSVC). None needs a game client, a server
|
||||
or the network, and none writes to %APPDATA% or C:\Games (each project's header says what it reads).
|
||||
|
||||
Publish-Update.ps1 runs this before it builds a release and refuses to publish when a test fails
|
||||
(2026-10-22: tests only ran when someone remembered to; a release went out with Missile Crafting
|
||||
broken while the tests that existed passed).
|
||||
|
||||
Every folder whose name contains "Test" is run unless $Skip below names it with a reason; skipped ones
|
||||
are listed in the summary, never dropped silently. Each program's output goes to
|
||||
<LogDir>\<repo>.<name>.log, and the summary (also <LogDir>\summary.txt) shows each failure's last lines.
|
||||
|
||||
.EXAMPLE
|
||||
.\scripts\Run-AllTests.ps1 -RynthSuiteRoot C:\Projects\rel1002\RynthSuite
|
||||
.EXAMPLE
|
||||
.\scripts\Run-AllTests.ps1 -Only RynthCore.RynthAiHostTests, ChatFilterTests
|
||||
#>
|
||||
param(
|
||||
[string]$RynthCoreRoot = "", # defaults to this checkout
|
||||
[string]$RynthSuiteRoot = "", # defaults to ..\RynthSuite beside RynthCore
|
||||
[string]$RynthServersRoot = "", # defaults to ..\RynthServers beside RynthSuite
|
||||
[string[]]$Only = @(), # folder names (or repo.name) to run; empty = all
|
||||
[string]$LogDir = "", # defaults to %TEMP%\rynth-tests\<time>
|
||||
[int]$TimeoutMinutes = 10 # per program, build and run each
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
if (-not $RynthCoreRoot) { $RynthCoreRoot = Split-Path $PSScriptRoot -Parent }
|
||||
if (-not $RynthSuiteRoot) { $RynthSuiteRoot = Join-Path (Split-Path $RynthCoreRoot -Parent) "RynthSuite" }
|
||||
if (-not $RynthServersRoot) { $RynthServersRoot = Join-Path (Split-Path $RynthSuiteRoot -Parent) "RynthServers" }
|
||||
if (-not $LogDir) { $LogDir = Join-Path $env:TEMP ("rynth-tests\" + (Get-Date -Format "yyyyMMdd-HHmmss")) }
|
||||
New-Item -ItemType Directory -Force $LogDir | Out-Null
|
||||
$env:DOTNET_NOLOGO = "1"
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = "1"
|
||||
|
||||
# Folders with "Test" in the name that are not tests, and tests that can't run here. Each needs a reason.
|
||||
$Skip = @{
|
||||
"HookResolver.SmokeTest" = "prints the hooks it resolves in acclient.exe and checks nothing (always exits 0)"
|
||||
"TestClient" = "builds a stand-in acclient.exe for the reload scripts; not a test"
|
||||
}
|
||||
|
||||
$repos = @(
|
||||
@{ Name = "RynthCore"; Root = $RynthCoreRoot; Tools = "tools" },
|
||||
@{ Name = "RynthSuite"; Root = $RynthSuiteRoot; Tools = "Tools" },
|
||||
@{ Name = "RynthServers"; Root = $RynthServersRoot; Tools = "Tools" }
|
||||
)
|
||||
|
||||
$tests = [System.Collections.Generic.List[object]]::new()
|
||||
$skipped = [System.Collections.Generic.List[object]]::new()
|
||||
foreach ($r in $repos) {
|
||||
$dir = Join-Path $r.Root $r.Tools
|
||||
if (-not (Test-Path $dir)) { throw "No $($r.Tools) folder in $($r.Name) at $($r.Root)" }
|
||||
foreach ($d in Get-ChildItem $dir -Directory | Where-Object Name -like "*Test*" | Sort-Object Name) {
|
||||
$id = "$($r.Name).$($d.Name)"
|
||||
if ($Only.Count -gt 0 -and -not ($Only -contains $d.Name -or $Only -contains $id)) { continue }
|
||||
if ($Skip.ContainsKey($d.Name)) { $skipped.Add([pscustomobject]@{ Id = $id; Why = $Skip[$d.Name] }); continue }
|
||||
$proj = Get-ChildItem $d.FullName -Filter *.csproj | Select-Object -First 1
|
||||
$ps = Join-Path $d.FullName "Run-Tests.ps1"
|
||||
if ($proj) { $tests.Add([pscustomobject]@{ Id = $id; Dir = $d.FullName; Kind = "dotnet"; Path = $proj.FullName }) }
|
||||
elseif (Test-Path $ps) { $tests.Add([pscustomobject]@{ Id = $id; Dir = $d.FullName; Kind = "script"; Path = $ps }) }
|
||||
elseif (-not (Get-ChildItem $d.FullName -Force | Where-Object Name -notin "bin", "obj")) {
|
||||
# Git doesn't remove ignored build output, so a moved or deleted project leaves its bin\obj behind.
|
||||
$skipped.Add([pscustomobject]@{ Id = $id; Why = "only build output left (bin, obj): the project moved or was deleted" })
|
||||
}
|
||||
else { $tests.Add([pscustomobject]@{ Id = $id; Dir = $d.FullName; Kind = "none"; Path = "" }) }
|
||||
}
|
||||
}
|
||||
if ($Only.Count -gt 0 -and $tests.Count -eq 0 -and $skipped.Count -eq 0) { throw "-Only matched no test folder: $($Only -join ', ')" }
|
||||
|
||||
# Runs one program with its output captured; returns @{ Code; TimedOut; Output }.
|
||||
function Invoke-Captured([string]$file, [string[]]$argList, [string]$cwd) {
|
||||
$psi = [System.Diagnostics.ProcessStartInfo]::new($file)
|
||||
foreach ($a in $argList) { $psi.ArgumentList.Add($a) }
|
||||
$psi.WorkingDirectory = $cwd
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.RedirectStandardOutput = $true
|
||||
$psi.RedirectStandardError = $true
|
||||
$psi.RedirectStandardInput = $true # a program that waits for a key gets end-of-input, not a hang
|
||||
$p = [System.Diagnostics.Process]::Start($psi)
|
||||
$p.StandardInput.Close()
|
||||
$out = $p.StandardOutput.ReadToEndAsync()
|
||||
$err = $p.StandardError.ReadToEndAsync()
|
||||
$timedOut = -not $p.WaitForExit($TimeoutMinutes * 60 * 1000)
|
||||
if ($timedOut) { try { $p.Kill($true) } catch { } ; $p.WaitForExit() }
|
||||
$p.WaitForExit() # drains the readers
|
||||
$text = $out.Result
|
||||
if ($err.Result) { $text += "`n--- stderr ---`n" + $err.Result }
|
||||
return @{ Code = $p.ExitCode; TimedOut = $timedOut; Output = $text }
|
||||
}
|
||||
|
||||
$results = [System.Collections.Generic.List[object]]::new()
|
||||
$i = 0
|
||||
foreach ($t in $tests) {
|
||||
$i++
|
||||
$log = Join-Path $LogDir "$($t.Id).log"
|
||||
$sw = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
$status = "PASS"; $text = ""
|
||||
Write-Host ("[{0,2}/{1}] {2} ... " -f $i, $tests.Count, $t.Id) -NoNewline
|
||||
switch ($t.Kind) {
|
||||
"none" { $status = "FAIL"; $text = "no .csproj and no Run-Tests.ps1 in $($t.Dir) (add one, or list the folder in `$Skip with a reason)" }
|
||||
"script" {
|
||||
$r = Invoke-Captured "pwsh" @("-NoProfile", "-NonInteractive", "-File", $t.Path) $t.Dir
|
||||
$text = $r.Output
|
||||
if ($r.TimedOut) { $status = "TIMEOUT" } elseif ($r.Code -ne 0) { $status = "FAIL" }
|
||||
}
|
||||
"dotnet" {
|
||||
# The same as `dotnet run -c Release` from the project's folder, without dotnet run's
|
||||
# ~10 s of project evaluation per program: build, then start what was built. -t:Build is
|
||||
# needed: -getProperty alone only evaluates the project and builds nothing (an old build
|
||||
# would then be tested).
|
||||
$b = Invoke-Captured "dotnet" @("build", $t.Path, "-c", "Release", "-nologo", "-t:Build", "-getProperty:TargetPath") $t.Dir
|
||||
$text = "=== build ===`n" + $b.Output
|
||||
$dll = ($b.Output -split "`r?`n" | Where-Object { $_ -match '\.dll\s*$' } | Select-Object -Last 1)
|
||||
if ($b.TimedOut) { $status = "TIMEOUT (build)" }
|
||||
elseif ($b.Code -ne 0) { $status = "BUILD FAILED" }
|
||||
elseif (-not $dll -or -not (Test-Path $dll.Trim())) { $status = "BUILD FAILED"; $text += "`n(no built program found)" }
|
||||
else {
|
||||
$dll = $dll.Trim()
|
||||
$exe = [IO.Path]::ChangeExtension($dll, ".exe")
|
||||
$r = if (Test-Path $exe) { Invoke-Captured $exe @() $t.Dir } else { Invoke-Captured "dotnet" @($dll) $t.Dir }
|
||||
$text += "`n=== run ===`n" + $r.Output
|
||||
if ($r.TimedOut) { $status = "TIMEOUT" } elseif ($r.Code -ne 0) { $status = "FAIL (exit $($r.Code))" }
|
||||
}
|
||||
}
|
||||
}
|
||||
$sw.Stop()
|
||||
Set-Content $log $text
|
||||
$color = if ($status -eq "PASS") { "Green" } else { "Red" }
|
||||
Write-Host ("{0} ({1:0}s)" -f $status, $sw.Elapsed.TotalSeconds) -ForegroundColor $color
|
||||
$results.Add([pscustomobject]@{ Id = $t.Id; Status = $status; Seconds = [math]::Round($sw.Elapsed.TotalSeconds); Log = $log })
|
||||
}
|
||||
|
||||
$failed = @($results | Where-Object Status -ne "PASS")
|
||||
$summary = [System.Collections.Generic.List[string]]::new()
|
||||
$summary.Add("RynthCore $(git -C $RynthCoreRoot rev-parse --short HEAD) ($RynthCoreRoot), RynthSuite $(git -C $RynthSuiteRoot rev-parse --short HEAD) ($RynthSuiteRoot), RynthServers $(git -C $RynthServersRoot rev-parse --short HEAD) ($RynthServersRoot)")
|
||||
$summary.Add("$($results.Count - $failed.Count) of $($results.Count) test programs passed, $($failed.Count) failed, $($skipped.Count) skipped. Logs: $LogDir")
|
||||
foreach ($s in $skipped) { $summary.Add(" skipped $($s.Id): $($s.Why)") }
|
||||
foreach ($f in $failed) {
|
||||
$summary.Add("")
|
||||
$summary.Add("$($f.Status): $($f.Id) ($($f.Log))")
|
||||
$tail = @(Get-Content $f.Log -Tail 15)
|
||||
foreach ($line in $tail) { $summary.Add(" $line") }
|
||||
}
|
||||
Set-Content (Join-Path $LogDir "summary.txt") $summary
|
||||
Write-Host ""
|
||||
$summary | ForEach-Object { Write-Host $_ }
|
||||
exit [math]::Min($failed.Count, 1)
|
||||
234
scripts/Run-GameTest.ps1
Normal file
234
scripts/Run-GameTest.ps1
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
#Requires -Version 7
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Logs a test character in, has RynthAi run the self-test meta (RynthSuite GameTests\RynthSelfTest.af)
|
||||
and prints what passed. Exit 0 when nothing failed.
|
||||
|
||||
.DESCRIPTION
|
||||
The meta tests RynthAi in game, one check after another: a force rebuff, a kill, looting the corpse,
|
||||
and missile crafting from bundles with the ammo taken off. It saves rt_<check> = PASS / FAIL / SKIP
|
||||
and the reason in the character's RynthAi\pvars\<name>.txt, which this script reads. A check the
|
||||
character can't do (no bow, no monster in view) is a SKIP, not a FAIL.
|
||||
|
||||
The client is launched the way Test-ClrWorld.ps1 launches one: the injector's headless --launch with
|
||||
a saved account profile (the password stays in the launcher's settings), the test engine settings,
|
||||
its own panel layout, and its OWN dispatch file. Commands go only to that client; the shared
|
||||
%APPDATA%\RynthCore\dispatch.txt would reach every running client. Plugins are the installed ones
|
||||
(C:\Games\RynthSuite), so this tests what is deployed on this PC.
|
||||
|
||||
-ClientPid runs it in a client that is already in the world instead (logging the same account in
|
||||
again would drop that one). Commands then go through RynthRemote's per-client command files
|
||||
(C:\Games\RynthCore\Logs\status\commands\RynthCore.<pid>.*.cmd.json, the phone remote's path), which
|
||||
only that client reads, and the client is left running.
|
||||
|
||||
The meta switches Combat, Buffing, Looting and Nav on and off and puts them back when it finishes.
|
||||
At the end a client this script launched is closed normally (as the window's close button does)
|
||||
unless -Keep.
|
||||
|
||||
Only point it at a character that may fight and loot where it stands, on a server you run or
|
||||
may test on. The character should stand near easy monsters; for the crafting check it needs a
|
||||
bow, crossbow or atlatl and arrowhead and shaft bundles, and no finished ammo to test making it.
|
||||
|
||||
.EXAMPLE
|
||||
.\scripts\Run-GameTest.ps1 # +Buffi on the local ACEmulator server
|
||||
.EXAMPLE
|
||||
.\scripts\Run-GameTest.ps1 -Account <account> -Server Aelrynth -Character Freya -Keep
|
||||
.EXAMPLE
|
||||
.\scripts\Run-GameTest.ps1 -ClientPid 52000 # Freya, already logged in
|
||||
#>
|
||||
param(
|
||||
[string]$Account = "Buffi",
|
||||
[string]$Server = "ACEmulator",
|
||||
[string]$Character = "+Buffi",
|
||||
[string]$RynthSuiteRoot = "", # defaults to ..\RynthSuite beside this RynthCore
|
||||
[string]$Runtime = "C:\Games\RynthCore\Runtime",
|
||||
[string]$Settings = "C:\Games\RynthCore\Test\engine-plugins.json",
|
||||
[string]$SuiteDir = "C:\Games\RynthSuite",
|
||||
[int]$LoginTimeoutSeconds = 120,
|
||||
[int]$TimeoutMinutes = 15, # the meta itself gives up on each check well before this
|
||||
[int]$ClientPid = 0, # a client already in the world: test in it (no launch, left running)
|
||||
[switch]$Keep # leave the client running afterwards
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$repo = Split-Path $PSScriptRoot -Parent
|
||||
if (-not $RynthSuiteRoot) { $RynthSuiteRoot = Join-Path (Split-Path $repo -Parent) "RynthSuite" }
|
||||
$metaSource = Join-Path $RynthSuiteRoot "GameTests\RynthSelfTest.af"
|
||||
if (-not (Test-Path $metaSource)) { throw "No self-test meta at $metaSource (pass -RynthSuiteRoot)" }
|
||||
$metaDir = Join-Path $SuiteDir "RynthAi\MetaFiles"
|
||||
$pvarsDir = Join-Path $SuiteDir "RynthAi\pvars"
|
||||
if (-not (Test-Path $metaDir)) { throw "No RynthAi meta folder at $metaDir" }
|
||||
|
||||
if ($ClientPid) {
|
||||
# A running client: its character from the engine's status file, its commands through RynthRemote.
|
||||
if (-not (Get-Process -Id $ClientPid -ErrorAction SilentlyContinue)) { throw "no process $ClientPid" }
|
||||
$statusFile = "C:\Games\RynthCore\Logs\status\RynthCore.$ClientPid.status.json"
|
||||
if (-not (Test-Path $statusFile)) { throw "no engine status for client $ClientPid ($statusFile)" }
|
||||
$status = Get-Content $statusFile -Raw | ConvertFrom-Json
|
||||
if (-not $status.inWorld) { throw "client $ClientPid isn't in the world" }
|
||||
if (-not $PSBoundParameters.ContainsKey("Character")) { $Character = $status.character }
|
||||
elseif ($Character -ne $status.character) { throw "client $ClientPid is $($status.character), not $Character" }
|
||||
$log = "C:\Games\RynthCore\Logs\RynthCore.$ClientPid.log"
|
||||
if (-not (Select-String -Path $log -Pattern "loaded RynthCore\.Plugin\.RynthRemote\.dll" -Quiet)) {
|
||||
throw "client $ClientPid hasn't loaded RynthRemote, which takes the commands"
|
||||
}
|
||||
} else {
|
||||
$injector = "$repo\out\injector\RynthCore.Injector.exe"
|
||||
if (-not (Test-Path $injector)) {
|
||||
dotnet publish "$repo\src\RynthCore.Injector\RynthCore.Injector.csproj" -c Release -o "$repo\out\injector" -nologo -v q | Out-Null
|
||||
if (-not (Test-Path $injector)) { throw "could not build the injector" }
|
||||
}
|
||||
}
|
||||
|
||||
# The meta goes in as RynthSelfTest.af. /ra meta load of a name that isn't there would create and
|
||||
# load a BLANK meta, so the copy is checked first, and the run is checked to have started below.
|
||||
Copy-Item $metaSource (Join-Path $metaDir "RynthSelfTest.af") -Force
|
||||
if ((Get-FileHash $metaSource).Hash -ne (Get-FileHash (Join-Path $metaDir "RynthSelfTest.af")).Hash) { throw "the meta did not copy to $metaDir" }
|
||||
|
||||
# The character's pvars file: its name with the characters Windows won't take in a file name as '_'
|
||||
# (ExpressionEngine.SanitizeFileName).
|
||||
$invalid = [IO.Path]::GetInvalidFileNameChars()
|
||||
$fileName = -join ($Character.ToCharArray() | ForEach-Object { if ($invalid -contains $_) { '_' } else { $_ } })
|
||||
$pvars = Join-Path $pvarsDir "$fileName.txt"
|
||||
# True when the log has a heartbeat written since $since (by its time of day, past midnight too)
|
||||
# that says the character is in the world (login=1) with plugins ticking (plug=N/s, N > 0).
|
||||
function Test-ReadySince([string]$logPath, [datetime]$since) {
|
||||
if (-not (Test-Path $logPath)) { return $false }
|
||||
$window = ((Get-Date) - $since).TotalSeconds + 5
|
||||
foreach ($m in Select-String -Path $logPath -Pattern '^\[(\d\d):(\d\d):(\d\d)\.\d+\] .*hb #\d+ .*plug=([1-9]\d*)/s.*login=1') {
|
||||
$g = $m.Matches[0].Groups
|
||||
$at = New-TimeSpan -Hours ([int]$g[1].Value) -Minutes ([int]$g[2].Value) -Seconds ([int]$g[3].Value)
|
||||
$d = ($at - $since.TimeOfDay).TotalSeconds
|
||||
if ($d -lt -2) { $d += 86400 }
|
||||
if ($d -ge -2 -and $d -le $window) { return $true }
|
||||
}
|
||||
return $false
|
||||
}
|
||||
|
||||
function Read-Results {
|
||||
$r = @{}
|
||||
if (Test-Path $pvars) {
|
||||
foreach ($line in Get-Content $pvars) {
|
||||
$i = $line.IndexOf("`t")
|
||||
if ($i -gt 0 -and $line.StartsWith("rt_")) { $r[$line.Substring(0, $i)] = $line.Substring($i + 1) }
|
||||
}
|
||||
}
|
||||
return $r
|
||||
}
|
||||
|
||||
$started = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
|
||||
if ($ClientPid) {
|
||||
# $gamePid, not $clientPid: PowerShell names ignore case, so that would BE the -ClientPid parameter,
|
||||
# and a launch would then read as "already in the world" and skip the wait (2026-10-22).
|
||||
$gamePid = $ClientPid
|
||||
$commandDir = "C:\Games\RynthCore\Logs\status\commands"
|
||||
New-Item -ItemType Directory -Force $commandDir | Out-Null
|
||||
# The file the status agent writes for a phone command (LocalStatusServer.cs): RynthRemote in that
|
||||
# client takes RynthCore.<its pid>.*.cmd.json in name order and hands "sendchat" to RynthAi.
|
||||
function Send([string]$command) {
|
||||
$name = "RynthCore.$gamePid.$('{0:D19}' -f [DateTime]::UtcNow.Ticks)-$([Guid]::NewGuid().ToString('N')).cmd.json"
|
||||
$json = @{ pid = $gamePid; action = "sendchat"; value = $command; ts = [DateTimeOffset]::UtcNow.ToString("o") } | ConvertTo-Json -Compress
|
||||
Set-Content "$commandDir\$name.tmp" $json -NoNewline
|
||||
Move-Item "$commandDir\$name.tmp" "$commandDir\$name" -Force
|
||||
Start-Sleep 2
|
||||
}
|
||||
Write-Host "Testing in client $gamePid ($Character), log $log"
|
||||
} else {
|
||||
# The same isolation as Test-ClrWorld.ps1: test engine settings, its own panel layout, its own dispatch file.
|
||||
$env:RYNTHCORE_ENGINE_SETTINGS = $Settings
|
||||
$env:RYNTHCORE_TEST_CLIENT = "Run-GameTest"
|
||||
$env:LOCALAPPDATA = "C:\Games\RynthCore\Test\localappdata"
|
||||
New-Item -ItemType Directory -Force $env:LOCALAPPDATA | Out-Null
|
||||
$dispatch = "C:\Games\RynthCore\Test\dispatch-gametest.txt"
|
||||
$env:RYNTHCORE_DISPATCH_FILE = $dispatch
|
||||
Set-Content $dispatch "# Run-GameTest dispatch file"
|
||||
function Send([string]$command) { Set-Content $dispatch "force:$command"; Start-Sleep 2 }
|
||||
|
||||
Write-Host "Launching $Character ($Account on $Server)..."
|
||||
$launchedAt = Get-Date
|
||||
$out = & $injector --launch --account $Account --server $Server --engine "$Runtime\RynthCore.Loader.dll" --character $Character 2>&1
|
||||
$m = $out | Select-String "LAUNCHED_PID=(\d+)"
|
||||
if (-not $m) { $out | ForEach-Object { Write-Host " $_" }; throw "the injector didn't launch a client" }
|
||||
$gamePid = [int]$m.Matches[0].Groups[1].Value
|
||||
$log = "C:\Games\RynthCore\Logs\RynthCore.$gamePid.log"
|
||||
Write-Host "client $gamePid, log $log"
|
||||
}
|
||||
|
||||
$exit = 1
|
||||
try {
|
||||
if (-not $ClientPid) {
|
||||
# In the world with plugins running: a heartbeat written since the launch says login=1 and
|
||||
# plug=N/s with N > 0. Only lines since the launch count: pids are reused and logs kept, so
|
||||
# RynthCore.<pid>.log can hold an old client's "login=1" (2026-10-22: the commands went out
|
||||
# before RynthAi had loaded, and the run never started).
|
||||
$deadline = (Get-Date).AddSeconds($LoginTimeoutSeconds)
|
||||
while (-not (Test-ReadySince $log $launchedAt)) {
|
||||
if (-not (Get-Process -Id $gamePid -ErrorAction SilentlyContinue)) { throw "the client exited before logging in" }
|
||||
if ((Get-Date) -gt $deadline) { throw "not in the world with plugins running after $LoginTimeoutSeconds s" }
|
||||
Start-Sleep 3
|
||||
}
|
||||
Start-Sleep 10 # plugins settle (RynthAi loads its profile, the character's own meta may start)
|
||||
}
|
||||
|
||||
# A meta's rules run only with the macro on AND RynthAi's Meta switch on (Freya's was off on the
|
||||
# first run, 2026-10-22: the meta loaded and nothing happened). Put the switch back afterwards.
|
||||
$statusFile = "C:\Games\RynthCore\Logs\status\RynthCore.$gamePid.status.json"
|
||||
$metaWasOn = $true
|
||||
try { $metaWasOn = [bool](Get-Content $statusFile -Raw | ConvertFrom-Json).bot.metaEnabled } catch { }
|
||||
Send "/ra stop"
|
||||
Send "/ra meta load RynthSelfTest"
|
||||
Send "/vt opt set EnableMeta true"
|
||||
Send "/ra start"
|
||||
|
||||
# Started: the meta's Default state writes rt_status RUNNING and rt_started (unix seconds).
|
||||
$deadline = (Get-Date).AddSeconds(45)
|
||||
do {
|
||||
Start-Sleep 3
|
||||
$r = Read-Results
|
||||
$fresh = $r.ContainsKey("rt_started") -and [long]$r["rt_started"] -ge $started
|
||||
if ((Get-Date) -gt $deadline) { throw "the self-test meta didn't start within 45 s (no fresh rt_started in $pvars)" }
|
||||
} until ($fresh)
|
||||
Write-Host "the self-test meta is running"
|
||||
|
||||
$deadline = (Get-Date).AddMinutes($TimeoutMinutes)
|
||||
$shown = @{}
|
||||
do {
|
||||
Start-Sleep 5
|
||||
if (-not (Get-Process -Id $gamePid -ErrorAction SilentlyContinue)) { throw "the client exited during the test" }
|
||||
$r = Read-Results
|
||||
foreach ($k in "rt_buff", "rt_fight", "rt_loot", "rt_craft") {
|
||||
if ($r[$k] -and $r[$k] -ne "PENDING" -and -not $shown[$k]) {
|
||||
$shown[$k] = $true
|
||||
Write-Host (" {0,-6} {1}" -f $r[$k], $k.Substring(3))
|
||||
}
|
||||
}
|
||||
if ((Get-Date) -gt $deadline) { throw "the self-test meta didn't finish within $TimeoutMinutes minutes" }
|
||||
} until ($r["rt_status"] -eq "DONE" -and $r.ContainsKey("rt_finished") -and [long]$r["rt_finished"] -ge $started)
|
||||
|
||||
Write-Host ""
|
||||
$names = [ordered]@{ meta = "self-test meta"; buff = "buffing"; fight = "fight (a kill)"; loot = "looting"; craft = "missile crafting" }
|
||||
$fails = 0
|
||||
foreach ($k in $names.Keys) {
|
||||
$result = $r["rt_$k"]; $why = $r["rt_${k}_why"]
|
||||
if ($result -eq "FAIL" -or -not $result) { $fails++ }
|
||||
$color = switch ($result) { "PASS" { "Green" } "SKIP" { "Yellow" } default { "Red" } }
|
||||
Write-Host ("{0,-5} {1,-17} {2}" -f $result, $names[$k], $why) -ForegroundColor $color
|
||||
}
|
||||
Write-Host ""
|
||||
Write-Host $(if ($fails -eq 0) { "No failures." } else { "$fails check(s) failed." })
|
||||
$exit = [math]::Min($fails, 1)
|
||||
}
|
||||
finally {
|
||||
$p = Get-Process -Id $gamePid -ErrorAction SilentlyContinue
|
||||
if ($p -and (Get-Variable metaWasOn -ErrorAction SilentlyContinue) -and -not $metaWasOn) {
|
||||
Send "/ra stop" # the meta stops the macro when it finishes; this covers a run that didn't
|
||||
Send "/vt opt set EnableMeta false"
|
||||
}
|
||||
if ($p -and -not $Keep -and -not $ClientPid) {
|
||||
# The normal close path (plugins stopped, engine shut down, logged off), not a kill.
|
||||
[void]$p.CloseMainWindow()
|
||||
if (-not $p.WaitForExit(30000)) { Write-Warning "client $gamePid didn't close within 30 s; left running" }
|
||||
else { Write-Host "client closed" }
|
||||
}
|
||||
}
|
||||
exit $exit
|
||||
|
|
@ -4320,8 +4320,10 @@ internal partial class MainWindow : Window
|
|||
}
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool SetWindowTextW(IntPtr hWnd, string lpString);
|
||||
private static extern IntPtr SendMessageTimeoutW(IntPtr hWnd, uint msg, IntPtr wParam, string lParam, uint flags, uint timeoutMs, out IntPtr result);
|
||||
|
||||
private const uint WM_SETTEXT = 0x000C;
|
||||
private const uint SMTO_ABORTIFHUNG = 0x0002;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct WinRect { public int Left, Top, Right, Bottom; }
|
||||
|
|
@ -4347,6 +4349,11 @@ internal partial class MainWindow : Window
|
|||
|
||||
private const uint SWP_NOZORDER = 0x0004;
|
||||
private const uint SWP_NOACTIVATE = 0x0010;
|
||||
// Posts the move to the client's thread instead of waiting for it: a plain
|
||||
// SetWindowPos on a frozen client's window never returns, and this runs on
|
||||
// the launcher's UI thread (2026-10-22: a frozen +Buffy kept the launcher
|
||||
// from ever showing its window).
|
||||
private const uint SWP_ASYNCWINDOWPOS = 0x4000;
|
||||
private const int GWL_EXSTYLE = -20;
|
||||
private const int WS_EX_LAYERED = 0x00080000;
|
||||
|
||||
|
|
@ -4466,7 +4473,7 @@ internal partial class MainWindow : Window
|
|||
profile.WindowY!.Value,
|
||||
profile.WindowWidth!.Value,
|
||||
profile.WindowHeight!.Value,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS);
|
||||
LauncherDiag.Info($"WindowPos PID {process.Id} ({accountName}@{serverName}): restored to ({profile.WindowX},{profile.WindowY},{profile.WindowWidth}x{profile.WindowHeight}).");
|
||||
return;
|
||||
}
|
||||
|
|
@ -4593,7 +4600,17 @@ internal partial class MainWindow : Window
|
|||
if (hwnd == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
SetWindowTextW(hwnd, desired);
|
||||
// SetWindowText waits for the client's thread to take WM_SETTEXT, with no
|
||||
// time limit, and this runs on the launcher's UI thread every tick: one
|
||||
// frozen client froze the launcher (2026-10-22, +Buffy). Reading the title
|
||||
// never waits on another process, so skip the send when it already reads
|
||||
// right; otherwise give up on a hung or busy window and try next tick.
|
||||
string current;
|
||||
try { current = process.MainWindowTitle; } catch { current = string.Empty; }
|
||||
if (string.Equals(current, desired, StringComparison.Ordinal))
|
||||
return;
|
||||
|
||||
SendMessageTimeoutW(hwnd, WM_SETTEXT, IntPtr.Zero, desired, SMTO_ABORTIFHUNG, 250, out _);
|
||||
}
|
||||
|
||||
private static string ComputeDesiredWindowTitle(
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@
|
|||
// (RynthNav itself owns favorites, recent, the arrow and routing). The file's
|
||||
// path comes from RynthNav's status, so both read the same file.
|
||||
//
|
||||
// RynthNavAtlas the loaded places (a background load, UiBackgroundWriter),
|
||||
// and the player's map position from the pose snapshot.
|
||||
// RynthNavAtlas the loaded places (a background load, UiBackgroundWriter):
|
||||
// the locations, then the recall spells' landing spots as
|
||||
// places of type Recall (RynthNavAtlasRecalls.cs), and the
|
||||
// player's map position from the pose snapshot.
|
||||
// RynthNavAtlasSource the rows the face shows for its query (search by name
|
||||
// and type, typed coordinates as the first row, Nearby,
|
||||
// Favorites, Recent; Saved = favorites then recent, the Go
|
||||
|
|
@ -28,21 +30,6 @@ using RynthCore.Engine.Compatibility;
|
|||
|
||||
namespace RynthCore.Engine.UI.Data;
|
||||
|
||||
/// <summary>One place from locations.json, with its display strings.</summary>
|
||||
internal sealed class NavPlace
|
||||
{
|
||||
public int Id;
|
||||
public string Name = "", Type = "", Desc = "", Place = "", Lb = "", Cell = "";
|
||||
public bool OnMap;
|
||||
public double Ns, Ew;
|
||||
public bool HasDest, DestOnMap;
|
||||
public double DestNs, DestEw;
|
||||
public string DestName = "";
|
||||
public int MinLevel, MaxLevel;
|
||||
public bool Quest, Closed;
|
||||
public string CoordText = "", DestText = "", LevelText = "";
|
||||
}
|
||||
|
||||
/// <summary>Saved: favorites, then recent places (the Go tab's list while its box is empty).</summary>
|
||||
internal enum AtlasMode { Search, Nearby, Favorites, Recent, Saved }
|
||||
|
||||
|
|
@ -72,7 +59,7 @@ internal sealed class AtlasView
|
|||
internal static class RynthNavAtlas
|
||||
{
|
||||
public static readonly string[] Types =
|
||||
{ "All", "Town", "Dungeon", "Portal", "Lifestone", "Bindstone", "Vendor", "NPC", "Landmark" };
|
||||
{ "All", "Town", "Dungeon", "Portal", "Lifestone", "Bindstone", "Vendor", "NPC", "Landmark", RynthNavAtlasRecalls.Type };
|
||||
|
||||
private static readonly object Sync = new();
|
||||
private static string _requested = "";
|
||||
|
|
@ -140,6 +127,13 @@ internal static class RynthNavAtlas
|
|||
list.Add(p);
|
||||
}
|
||||
}
|
||||
// The recall spells' landing spots, as places of type Recall (RynthNavAtlasRecalls).
|
||||
foreach (NavPlace p in RynthNavAtlasRecalls.Read(doc.RootElement, RynthNavStatus.Coord))
|
||||
{
|
||||
if (p.OnMap && p.Cell.Length == 8 && uint.TryParse(p.Cell.AsSpan(0, 4), NumberStyles.HexNumber, null, out uint lb))
|
||||
lbs.Add(lb);
|
||||
list.Add(p);
|
||||
}
|
||||
_places = list.ToArray();
|
||||
_mapLandblocks = lbs;
|
||||
_dungeonNames = dungeons;
|
||||
|
|
@ -238,7 +232,7 @@ internal static class RynthNavAtlas
|
|||
|
||||
public static int TypeRank(string type) => type switch
|
||||
{
|
||||
"Town" => 0, "Dungeon" => 1, "Landmark" => 2, "Lifestone" => 3, "Bindstone" => 4,
|
||||
"Town" => 0, "Dungeon" => 1, "Landmark" => 2, RynthNavAtlasRecalls.Type => 2, "Lifestone" => 3, "Bindstone" => 4,
|
||||
"Portal" => 5, "Vendor" => 6, "NPC" => 7, _ => 8,
|
||||
};
|
||||
|
||||
|
|
|
|||
79
src/RynthCore.Engine/UI/Data/RynthNavAtlasRecalls.cs
Normal file
79
src/RynthCore.Engine/UI/Data/RynthNavAtlasRecalls.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// ============================================================================
|
||||
// RynthCore.Engine - UI/Data/RynthNavAtlasRecalls.cs
|
||||
// NavPlace (one Atlas place) and the recall spells as Atlas places.
|
||||
//
|
||||
// locations.json's "recalls" are the spells that land at a fixed spot. They are
|
||||
// searchable places of type "Recall" (2026-10-22): the world database names only
|
||||
// the /telepoi towns, so a place like Neftet had no entry and a search for "neft"
|
||||
// found nothing, while "Lost City of Neftet Recall" lands right there (22.2S, 6.2E).
|
||||
// The spell's name stays the place's name, so it reads as what it is.
|
||||
//
|
||||
// Pure (no engine state), so tools\AtlasRecallsTests compiles it on its own.
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace RynthCore.Engine.UI.Data;
|
||||
|
||||
/// <summary>One place from locations.json, with its display strings.</summary>
|
||||
internal sealed class NavPlace
|
||||
{
|
||||
public int Id;
|
||||
public string Name = "", Type = "", Desc = "", Place = "", Lb = "", Cell = "";
|
||||
public bool OnMap;
|
||||
public double Ns, Ew;
|
||||
public bool HasDest, DestOnMap;
|
||||
public double DestNs, DestEw;
|
||||
public string DestName = "";
|
||||
public int MinLevel, MaxLevel;
|
||||
public bool Quest, Closed;
|
||||
public string CoordText = "", DestText = "", LevelText = "";
|
||||
}
|
||||
|
||||
internal static class RynthNavAtlasRecalls
|
||||
{
|
||||
public const string Type = "Recall";
|
||||
|
||||
/// <summary>
|
||||
/// The places <paramref name="root"/>'s "recalls" array names: each spell's landing spot,
|
||||
/// on the map when it has coordinates, else "in" its dungeon. A spell listed twice at the
|
||||
/// same cell is one place; an entry with no name is left out. <paramref name="coord"/>
|
||||
/// formats map coordinates (RynthNavStatus.Coord).
|
||||
/// </summary>
|
||||
public static List<NavPlace> Read(JsonElement root, Func<double, double, string> coord)
|
||||
{
|
||||
var places = new List<NavPlace>();
|
||||
if (!root.TryGetProperty("recalls", out JsonElement arr) || arr.ValueKind != JsonValueKind.Array) return places;
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (JsonElement e in arr.EnumerateArray())
|
||||
{
|
||||
if (e.ValueKind != JsonValueKind.Object) continue;
|
||||
string name = Str(e, "name").Trim(), cell = Str(e, "cell"), dungeon = Str(e, "in");
|
||||
if (name.Length == 0 || !seen.Add(name + "|" + cell)) continue;
|
||||
// TryGetInt32 throws (not false) on a non-number: check the kind first.
|
||||
int spell = e.TryGetProperty("spell", out JsonElement s) && s.ValueKind == JsonValueKind.Number && s.TryGetInt32(out int id) ? id : 0;
|
||||
var p = new NavPlace
|
||||
{
|
||||
Id = -spell, // locations have positive ids
|
||||
Name = name, Type = Type, Place = Str(e, "place"), Cell = cell,
|
||||
Desc = "Where this recall spell lands" + (dungeon.Length > 0 ? ", in " + dungeon : "") + ".",
|
||||
};
|
||||
if (cell.Length >= 4) p.Lb = cell.Substring(0, 4);
|
||||
p.OnMap = Num(e, "ns", out p.Ns) & Num(e, "ew", out p.Ew);
|
||||
p.CoordText = p.OnMap ? coord(p.Ns, p.Ew) : dungeon.Length > 0 ? "in " + dungeon : "in a dungeon";
|
||||
places.Add(p);
|
||||
}
|
||||
return places;
|
||||
}
|
||||
|
||||
private static string Str(JsonElement e, string name) =>
|
||||
e.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.String ? v.GetString() ?? "" : "";
|
||||
|
||||
private static bool Num(JsonElement e, string name, out double value)
|
||||
{
|
||||
value = double.NaN;
|
||||
return e.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.Number && v.TryGetDouble(out value);
|
||||
}
|
||||
}
|
||||
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