RynthCore as of 2026-10-04 (internal 843c801): RynthNav auto-travel and the navigation map, plugin API v75 (server and titles), launcher with Available plugins, download progress and the update on the front page, opt-in usage statistics, NPC names, radar colours, title-bar text size, FPS limiter, client action unlocks, release 2026.10.4.6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9b5e2765b7
commit
a24ed6df7c
322 changed files with 83009 additions and 7504 deletions
24
tools/AelrynthTests/AelrynthTests.csproj
Normal file
24
tools/AelrynthTests/AelrynthTests.csproj
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the engine's Aelrynth detection and /mastery-data parser
|
||||
(src\RynthCore.Engine\Compatibility\AelrynthWire.cs, compiled in): server detection
|
||||
from launch command lines, hosts, world names and the Bank mod's properties, and
|
||||
mastery reply lines serialized the way the SkillMastery mod writes them
|
||||
(DataCommand.Describe + CompanionFeed.Send). Nothing native: no AC, no engine state.
|
||||
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>AelrynthTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\AelrynthWire.cs" Link="Engine\AelrynthWire.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
317
tools/AelrynthTests/Program.cs
Normal file
317
tools/AelrynthTests/Program.cs
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
using System.Text.Json;
|
||||
using RynthCore.Engine.Compatibility;
|
||||
|
||||
namespace AelrynthTests;
|
||||
|
||||
/// <summary>
|
||||
/// Server detection and the /mastery-data parser, offline. Reply lines are built the way
|
||||
/// the SkillMastery mod builds them (ServerFormat below mirrors DataCommand.Describe and
|
||||
/// CompanionFeed.Send in Mods/src/Aeshnidae.SkillMastery), then fed through the engine's
|
||||
/// parser; every value the Skills panel reads is checked.
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
private static string _case = "";
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
LaunchCommandLines();
|
||||
HostClassification();
|
||||
WorldNames();
|
||||
Decisions();
|
||||
TypicalReply();
|
||||
RefusalReply();
|
||||
HugeNumbersAndLongLine();
|
||||
PrefixPlacement();
|
||||
OtherDataLinesAndDamage();
|
||||
UnknownCommand();
|
||||
RaiseCommands();
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
|
||||
Console.WriteLine(_failed == 0 ? "ALL AELRYNTH TESTS PASSED." : $"{_failed} FAILED.");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// ── Server detection ────────────────────────────────────────────────────
|
||||
|
||||
private static void LaunchCommandLines()
|
||||
{
|
||||
Case("launch command lines");
|
||||
// The RynthCore launcher's ACE form: -h host:port (AcLaunchArgumentBuilder).
|
||||
Check(ServerDetect.TryParseLaunchHost(
|
||||
"\"C:\\Turbine\\Asheron's Call\\acclient.exe\" -a tom -v \"pa ss -h x\" -h aelrynth.com:9020 -rodat off",
|
||||
out string h, out int p) && h == "aelrynth.com" && p == 9020, $"ACE form: {h}:{p}");
|
||||
// GDLE form and other launchers: -h host -p port, account:password in -a.
|
||||
Check(ServerDetect.TryParseLaunchHost("acclient.exe -h 144.217.84.148 -p 9030 -a tom:secret -rodat on", out h, out p)
|
||||
&& h == "144.217.84.148" && p == 9030, $"GDLE form: {h}:{p}");
|
||||
Check(ServerDetect.TryParseLaunchHost("acclient.exe -H Play.Aelrynth.COM. -P 9021", out h, out p)
|
||||
&& h == "play.aelrynth.com" && p == 9021, $"case and trailing dot: {h}:{p}");
|
||||
Check(ServerDetect.TryParseLaunchHost("acclient.exe -h \"localhost:9000\"", out h, out p) && h == "localhost" && p == 9000,
|
||||
$"quoted host:port: {h}:{p}");
|
||||
Check(!ServerDetect.TryParseLaunchHost("acclient.exe -a tom -v pw", out h, out _) && h == "", "no -h");
|
||||
Check(!ServerDetect.TryParseLaunchHost("", out _, out _) && !ServerDetect.TryParseLaunchHost(null, out _, out _), "empty / null");
|
||||
Check(!ServerDetect.TryParseLaunchHost("acclient.exe -h", out _, out _), "-h with nothing after it");
|
||||
}
|
||||
|
||||
private static void HostClassification()
|
||||
{
|
||||
Case("host classification");
|
||||
Check(ServerDetect.ClassifyHost("aelrynth.com") == ServerHostKind.Aelrynth, "aelrynth.com");
|
||||
Check(ServerDetect.ClassifyHost("play.aelrynth.com") == ServerHostKind.Aelrynth, "subdomain");
|
||||
Check(ServerDetect.ClassifyHost("144.217.84.148") == ServerHostKind.Aelrynth, "the VPS address");
|
||||
Check(ServerDetect.ClassifyHost("notaelrynth.com") == ServerHostKind.Other, "a look-alike domain is not Aelrynth");
|
||||
Check(ServerDetect.ClassifyHost("aelrynth.com.evil.net") == ServerHostKind.Other, "aelrynth.com as a prefix is not Aelrynth");
|
||||
Check(ServerDetect.ClassifyHost("144.217.84.149") == ServerHostKind.Other, "the next address over");
|
||||
Check(ServerDetect.ClassifyHost("localhost") == ServerHostKind.Local, "localhost");
|
||||
Check(ServerDetect.ClassifyHost("127.0.0.1") == ServerHostKind.Local, "loopback");
|
||||
Check(ServerDetect.ClassifyHost("192.168.1.20") == ServerHostKind.Local, "192.168/16");
|
||||
Check(ServerDetect.ClassifyHost("10.0.0.5") == ServerHostKind.Local, "10/8");
|
||||
Check(ServerDetect.ClassifyHost("172.20.1.1") == ServerHostKind.Local, "172.16/12");
|
||||
Check(ServerDetect.ClassifyHost("172.32.1.1") == ServerHostKind.Other, "172.32 is public");
|
||||
Check(ServerDetect.ClassifyHost("play.coldeve.ac") == ServerHostKind.Other, "someone else's server");
|
||||
Check(ServerDetect.ClassifyHost("") == ServerHostKind.Unknown && ServerDetect.ClassifyHost(null) == ServerHostKind.Unknown, "nothing");
|
||||
}
|
||||
|
||||
private static void WorldNames()
|
||||
{
|
||||
Case("world names");
|
||||
Check(ServerDetect.IsAelrynthWorldName("Aelrynth"), "Aelrynth");
|
||||
Check(ServerDetect.IsAelrynthWorldName("Aeshnidae"), "Aeshnidae (the live config's name)");
|
||||
Check(ServerDetect.IsAelrynthWorldName("Aeshnidae Staging"), "Aeshnidae Staging (ops/staging.sh)");
|
||||
Check(!ServerDetect.IsAelrynthWorldName("ACEmulator"), "ACE's default name");
|
||||
Check(!ServerDetect.IsAelrynthWorldName("Coldeve") && !ServerDetect.IsAelrynthWorldName("") && !ServerDetect.IsAelrynthWorldName(null), "others");
|
||||
}
|
||||
|
||||
private static void Decisions()
|
||||
{
|
||||
Case("decisions");
|
||||
ServerVerdict v = ServerDetect.Decide(ServerHostKind.Aelrynth, "aelrynth.com", 9020, null, false);
|
||||
Check(v.IsAelrynth && !v.IsStaging, "live by host alone: " + v.Reason);
|
||||
v = ServerDetect.Decide(ServerHostKind.Aelrynth, "144.217.84.148", 9030, "Aeshnidae Staging", true);
|
||||
Check(v.IsAelrynth && v.IsStaging, "staging by port: " + v.Reason);
|
||||
v = ServerDetect.Decide(ServerHostKind.Aelrynth, "aelrynth.com", 0, "Aeshnidae Staging", false);
|
||||
Check(v.IsAelrynth && v.IsStaging, "staging by world name");
|
||||
v = ServerDetect.Decide(ServerHostKind.Other, "play.coldeve.ac", 9000, "Coldeve", false);
|
||||
Check(!v.IsAelrynth, "someone else's server: " + v.Reason);
|
||||
v = ServerDetect.Decide(ServerHostKind.Other, "1.2.3.4", 9000, "Aelrynth", false);
|
||||
Check(!v.IsAelrynth, "another host calling itself Aelrynth is not enough");
|
||||
v = ServerDetect.Decide(ServerHostKind.Other, "1.2.3.4", 9000, null, true);
|
||||
Check(!v.IsAelrynth, "another host with property 9101 alone is not enough");
|
||||
v = ServerDetect.Decide(ServerHostKind.Other, "1.2.3.4", 9000, "Aelrynth", true);
|
||||
Check(v.IsAelrynth, "a new address with both server-sent signals: " + v.Reason);
|
||||
v = ServerDetect.Decide(ServerHostKind.Local, "localhost", 9000, "Aeshnidae", false);
|
||||
Check(v.IsAelrynth && !v.IsStaging, "a dev copy on localhost by world name");
|
||||
v = ServerDetect.Decide(ServerHostKind.Local, "localhost", 9000, null, true);
|
||||
Check(v.IsAelrynth, "a dev copy by the Bank properties");
|
||||
v = ServerDetect.Decide(ServerHostKind.Local, "localhost", 9000, "ACEmulator", false);
|
||||
Check(!v.IsAelrynth, "a plain local ACE");
|
||||
v = ServerDetect.Decide(ServerHostKind.Unknown, "", 0, null, false);
|
||||
Check(!v.IsAelrynth && v.Reason.Length > 0, "unknown means not Aelrynth: " + v.Reason);
|
||||
Check(!ServerVerdict.Unknown.IsAelrynth, "the starting verdict is not Aelrynth");
|
||||
}
|
||||
|
||||
// ── /mastery-data ───────────────────────────────────────────────────────
|
||||
|
||||
private static void TypicalReply()
|
||||
{
|
||||
Case("typical reply (ten raises per point)");
|
||||
string line = ServerFormat.Reply(enabled: true, radiance: 5_600_000, perPoint: 10, ceiling: 0, requireCap: true,
|
||||
ServerFormat.Skill(6, "MeleeDefense", "Melee Defense", spec: true, @base: 433, cur: 520, ranks: 37, perPoint: 10,
|
||||
next: 1_234_567, afford: 4, atCeiling: false, locked: false),
|
||||
ServerFormat.Skill(34, "WarMagic", "War Magic", spec: false, @base: 300, cur: 300, ranks: 0, perPoint: 10,
|
||||
next: 900_000, afford: 6, atCeiling: false, locked: true),
|
||||
ServerFormat.Skill(15, "MagicDefense", "Magic Defense", spec: false, @base: 410, cur: 410, ranks: 120, perPoint: 10,
|
||||
next: 2_000_000, afford: 2, atCeiling: false, locked: false));
|
||||
Check(line.StartsWith("~ael1 {\"t\":\"mastery\",\"ok\":true,", StringComparison.Ordinal), "wire shape: " + line[..Math.Min(60, line.Length)]);
|
||||
Check(MasteryWire.IsDataLine(line) && MasteryWire.TypeOf(line) == "mastery", "recognised");
|
||||
Check(MasteryWire.TryParse(line, out MasteryData? d) && d != null, "parsed");
|
||||
if (d == null) return;
|
||||
Check(d.Ok && d.Enabled && d.Radiance == 5_600_000 && d.PerPoint == 10 && d.CeilingPoints == 0 && d.RequireCap, "header fields");
|
||||
Check(d.Skills.Count == 3, $"three skills ({d.Skills.Count})");
|
||||
MasterySkill md = d.Skills[6];
|
||||
Check(md.Key == "meleedefense" && md.Name == "Melee Defense" && md.Specialized, "melee defense: key, name, specialized");
|
||||
Check(md.Base == 433 && md.Current == 520 && md.Ranks == 37 && md.Points == "3.7" && md.Bonus == 3, "melee defense: numbers");
|
||||
Check(md.Next == 1_234_567 && md.Afford == 4 && !md.Ceiling && !md.Locked, "melee defense: price");
|
||||
MasterySkill war = d.Skills[34];
|
||||
Check(!war.Specialized && war.Locked && war.Ranks == 0 && war.Points == "0.0" && war.Bonus == 0, "war magic: locked, none yet");
|
||||
Check(d.Skills[15].Points == "12.0" && d.Skills[15].Bonus == 12, "magic defense: whole points");
|
||||
}
|
||||
|
||||
private static void RefusalReply()
|
||||
{
|
||||
Case("the mod's refusal and a disabled server");
|
||||
string refusal = ServerFormat.Send(new { t = "mastery", ok = false, why = "could not read your mastery" });
|
||||
Check(MasteryWire.TryParse(refusal, out MasteryData? d) && d != null && !d.Ok && d.Why == "could not read your mastery"
|
||||
&& d.Skills.Count == 0, "ok=false keeps the reason");
|
||||
string off = ServerFormat.Reply(enabled: false, radiance: 0, perPoint: 1, ceiling: 500, requireCap: false,
|
||||
ServerFormat.Skill(6, "MeleeDefense", "Melee Defense", spec: false, @base: 200, cur: 200, ranks: 500, perPoint: 1,
|
||||
next: 0, afford: 0, atCeiling: true, locked: false));
|
||||
Check(MasteryWire.TryParse(off, out d) && d != null && d.Ok && !d.Enabled && d.CeilingPoints == 500 && d.PerPoint == 1,
|
||||
"enabled=false, ceiling 500, one raise per point");
|
||||
Check(d != null && d.Skills[6].Ceiling && d.Skills[6].Next == 0 && d.Skills[6].Points == "500", "at the ceiling: next 0");
|
||||
}
|
||||
|
||||
private static void HugeNumbersAndLongLine()
|
||||
{
|
||||
Case("huge prices and a long line");
|
||||
const long priceCeiling = (long.MaxValue / 4) / 1024; // Mastery.PriceCeiling
|
||||
var skills = new List<object>();
|
||||
string[] names =
|
||||
{
|
||||
"Alchemy", "ArcaneLore", "ArmorTinkering", "AssessCreature", "AssessPerson", "Cooking", "CreatureEnchantment",
|
||||
"Deception", "DirtyFighting", "DualWield", "Fletching", "Healing", "HeavyWeapons", "ItemEnchantment",
|
||||
"ItemTinkering", "Jump", "Leadership", "LifeMagic", "LightWeapons", "Lockpick", "Loyalty", "MagicDefense",
|
||||
"MagicItemTinkering", "ManaConversion", "MeleeDefense", "MissileDefense", "MissileWeapons", "Recklessness",
|
||||
"Run", "Salvaging", "Shield", "SneakAttack", "Summoning", "TwoHandedCombat", "VoidMagic", "WarMagic",
|
||||
"WeaponTinkering", "FinesseWeapons",
|
||||
};
|
||||
for (int i = 0; i < names.Length; i++)
|
||||
skills.Add(ServerFormat.Skill(i + 1, names[i], names[i], spec: i % 3 == 0, @base: 500 + i, cur: 600 + i,
|
||||
ranks: 2400 + i, perPoint: 10, next: i == 0 ? priceCeiling : 1_000_000_000_000L + i, afford: i == 0 ? 0 : 999,
|
||||
atCeiling: false, locked: false));
|
||||
string line = ServerFormat.Reply(true, 70_000_000_000_000_000L, 10, 0, true, skills.ToArray());
|
||||
Check(line.Length > 6000, $"line is {line.Length} chars (the chat hook reads data lines past its 1024 cap)");
|
||||
Check(MasteryWire.TryParse(line, out MasteryData? d) && d != null && d.Skills.Count == names.Length, "all skills parsed");
|
||||
if (d == null) return;
|
||||
Check(d.Radiance == 70_000_000_000_000_000L, "7e16 Radiance (a test account)");
|
||||
Check(d.Skills[1].Next == priceCeiling && d.Skills[1].Afford == 0, "price at the ceiling: " + d.Skills[1].Next);
|
||||
Check(d.Skills[2].Afford == 999 && d.Skills[2].Points == "240.1", "afford capped at 999, points 240.1");
|
||||
}
|
||||
|
||||
private static void PrefixPlacement()
|
||||
{
|
||||
Case("where the prefix may sit");
|
||||
string body = "{\"t\":\"mastery\",\"ok\":true,\"enabled\":true,\"radiance\":5,\"perPoint\":1,\"ceiling\":0,\"requireCap\":false,\"skills\":[]}";
|
||||
Check(MasteryWire.TryParse("~ael1 " + body, out _), "at the start");
|
||||
Check(MasteryWire.TryParse("~ael1 " + body + "\n", out _), "trailing newline");
|
||||
Check(MasteryWire.TryParse("[System] ~ael1 " + body, out _), "after a short tag");
|
||||
Check(!MasteryWire.IsDataLine("Bob says, \"~ael1 " + body + "\""), "a player saying it is not a server line");
|
||||
Check(!MasteryWire.TryParse("Somebody tells you, \"~ael1 " + body + "\"", out _), "nor a tell");
|
||||
Check(!MasteryWire.IsDataLine(new string(' ', 40) + "~ael1 " + body), "too far into the line");
|
||||
Check(!MasteryWire.IsDataLine("~ael2 " + body), "another protocol version");
|
||||
Check(!MasteryWire.IsDataLine("~ael1") && !MasteryWire.IsDataLine(null) && !MasteryWire.IsDataLine(""), "short / null / empty");
|
||||
}
|
||||
|
||||
private static void OtherDataLinesAndDamage()
|
||||
{
|
||||
Case("other data lines and damage");
|
||||
string inspect = ServerFormat.Send(new { t = "inspect", guid = "0x80000201", ok = true });
|
||||
Check(MasteryWire.IsDataLine(inspect) && MasteryWire.TypeOf(inspect) == "inspect", "an /inspect-data line is a data line");
|
||||
Check(!MasteryWire.TryParse(inspect, out _), "but not a mastery reply");
|
||||
Check(!MasteryWire.TryParse("~ael1 {\"t\":\"mastery\",\"ok\":tr", out _), "cut off");
|
||||
Check(!MasteryWire.TryParse("~ael1 not json at all", out _), "not JSON");
|
||||
Check(!MasteryWire.TryParse("~ael1 [1,2,3]", out _), "an array, not an object");
|
||||
// Extra fields and type drift: ignored / tolerated.
|
||||
string drift = "~ael1 {\"t\":\"mastery\",\"ok\":true,\"enabled\":true,\"radiance\":\"42\",\"perPoint\":0,\"future\":{\"x\":1},"
|
||||
+ "\"skills\":[{\"id\":6,\"k\":\"meleedefense\",\"ranks\":3,\"next\":10.0,\"newField\":true},"
|
||||
+ "{\"id\":7,\"k\":\"Melee Defense\",\"ranks\":1},{\"id\":0,\"k\":\"run\"},\"junk\"]}";
|
||||
Check(MasteryWire.TryParse(drift, out MasteryData? d) && d != null, "parsed with extra fields");
|
||||
if (d == null) return;
|
||||
Check(d.Radiance == 42 && d.PerPoint == 1, "a number sent as a string; perPoint 0 read as 1");
|
||||
Check(d.Skills.Count == 1 && d.Skills[6].Ranks == 3 && d.Skills[6].Next == 10 && d.Skills[6].Points == "",
|
||||
"a bad key, id 0 and a non-object are skipped; missing points stay empty");
|
||||
}
|
||||
|
||||
private static void UnknownCommand()
|
||||
{
|
||||
Case("ACE's unknown-command refusal");
|
||||
Check(MasteryWire.IsUnknownCommand("Unknown command: mastery-data", "mastery-data"), "exact (GameActionTalk's text)");
|
||||
Check(MasteryWire.IsUnknownCommand("Unknown command: MASTERY-DATA ", "mastery-data"), "case and trailing space");
|
||||
Check(!MasteryWire.IsUnknownCommand("Unknown command: raise", "mastery-data"), "another command");
|
||||
Check(!MasteryWire.IsUnknownCommand("Bob says, \"Unknown command: mastery-data\"", "mastery-data"), "a player saying it");
|
||||
Check(!MasteryWire.IsUnknownCommand("You have 5 mastery points.", "mastery-data") && !MasteryWire.IsUnknownCommand(null, "mastery-data"),
|
||||
"ordinary lines");
|
||||
Check(MasteryWire.DataRequest == "@mastery-data", "the request is sent as @mastery-data");
|
||||
}
|
||||
|
||||
private static void RaiseCommands()
|
||||
{
|
||||
Case("/raise command text");
|
||||
// The mod's /raise: "/raise <skill> [points]"; the last word is the count when it is a number,
|
||||
// the rest is matched against the Skill enum with spaces removed (Commands.TryParseSkill).
|
||||
Check(MasteryWire.RaiseCommand("meleedefense", 1) == "@raise meleedefense 1", "one raise");
|
||||
Check(MasteryWire.RaiseCommand("warmagic", 25) == "@raise warmagic 25", "several");
|
||||
Check(MasteryWire.RaiseCommand("Melee Defense", 1) == null, "a display name is refused (not the enum key)");
|
||||
Check(MasteryWire.RaiseCommand("meleedefense", 0) == null && MasteryWire.RaiseCommand("meleedefense", -3) == null, "count below 1");
|
||||
Check(MasteryWire.RaiseCommand("meleedefense", 1000) == null, "count above 999");
|
||||
Check(MasteryWire.RaiseCommand("", 1) == null && MasteryWire.RaiseCommand(null, 1) == null, "no key");
|
||||
Check(MasteryWire.RaiseCommand("melee;defense", 1) == null, "punctuation");
|
||||
// Every key the mod sends round-trips: skill.ToString().ToLowerInvariant() is letters only.
|
||||
foreach (string k in new[] { "alchemy", "twohandedcombat", "missileweapons", "voidmagic" })
|
||||
Check(MasteryWire.IsSkillKey(k), "key " + k);
|
||||
}
|
||||
|
||||
// ── harness ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static void Case(string name)
|
||||
{
|
||||
_case = name;
|
||||
Console.WriteLine($"-- {name}");
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine($" FAIL [{_case}] {what}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The SkillMastery mod's wire format, mirrored: CompanionFeed.Send serializes an object with
|
||||
/// UnsafeRelaxedJsonEscaping and WhenWritingNull after the "~ael1 " prefix; DataCommand.Describe
|
||||
/// builds the object (field names and order as there; Mastery.Points for "points",
|
||||
/// Mastery.SkillPointsFor for "bonus").
|
||||
/// </summary>
|
||||
internal static class ServerFormat
|
||||
{
|
||||
private static readonly JsonSerializerOptions Json = new()
|
||||
{
|
||||
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
|
||||
};
|
||||
|
||||
public static string Send(object data) => "~ael1 " + JsonSerializer.Serialize(data, Json);
|
||||
|
||||
public static string Reply(bool enabled, long radiance, int perPoint, int ceiling, bool requireCap, params object[] skills) =>
|
||||
Send(new
|
||||
{
|
||||
t = "mastery",
|
||||
ok = true,
|
||||
enabled,
|
||||
radiance,
|
||||
perPoint,
|
||||
ceiling,
|
||||
requireCap,
|
||||
skills,
|
||||
});
|
||||
|
||||
public static object Skill(int id, string enumName, string name, bool spec, long @base, long cur, int ranks, int perPoint,
|
||||
long next, int afford, bool atCeiling, bool locked) =>
|
||||
new
|
||||
{
|
||||
id,
|
||||
k = enumName.ToLowerInvariant(),
|
||||
name,
|
||||
adv = spec ? "spec" : "trained",
|
||||
@base,
|
||||
cur,
|
||||
ranks,
|
||||
points = Points(ranks, perPoint),
|
||||
bonus = perPoint < 1 ? ranks : ranks / perPoint,
|
||||
next,
|
||||
afford,
|
||||
ceiling = atCeiling,
|
||||
locked,
|
||||
};
|
||||
|
||||
/// <summary>Mastery.Points: "N0" with one rank per point, else "{ranks/per:N0}.{ranks%per}".</summary>
|
||||
private static string Points(int ranks, int perPoint)
|
||||
{
|
||||
int per = Math.Max(1, perPoint);
|
||||
return per == 1 ? ranks.ToString("N0") : $"{ranks / per:N0}.{ranks % per}";
|
||||
}
|
||||
}
|
||||
15
tools/AlcRoots/AlcRoots.csproj
Normal file
15
tools/AlcRoots/AlcRoots.csproj
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- x86 because ClrMD must match the target's bitness (acclient is 32-bit). -->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
146
tools/AlcRoots/Program.cs
Normal file
146
tools/AlcRoots/Program.cs
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
// AlcRoots: why didn't an engine generation unload?
|
||||
//
|
||||
// Attaches (read-only snapshot) to a CoreCLR-hosted acclient and prints
|
||||
// 1. every managed thread with frames in collectible (engine) code, and
|
||||
// 2. the shortest reference path from each kind of GC root to the first object that
|
||||
// belongs to a collectible context (an object of a collectible type, a
|
||||
// LoaderAllocator, or the Shim's EngineLoadContext).
|
||||
// Anything on those lists keeps an unloaded generation alive.
|
||||
//
|
||||
// AlcRoots.exe <pid> [maxPaths]
|
||||
using Microsoft.Diagnostics.Runtime;
|
||||
|
||||
if (args.Length < 1 || !int.TryParse(args[0], out int pid))
|
||||
{
|
||||
Console.WriteLine("usage: AlcRoots <pid> [maxPaths]");
|
||||
return 1;
|
||||
}
|
||||
int maxPaths = args.Length > 1 && int.TryParse(args[1], out int mp) ? mp : 25;
|
||||
uint stackOfOsThread = args.Length > 2 && args[1] == "--stack" ? Convert.ToUInt32(args[2], 16) : 0;
|
||||
|
||||
using DataTarget dt = DataTarget.CreateSnapshotAndAttach(pid);
|
||||
// A client that also runs Decal has the desktop CLR (clr.dll) loaded too: take CoreCLR.
|
||||
foreach (ClrInfo c in dt.ClrVersions)
|
||||
Console.WriteLine($"runtime in process: {c.Flavor} {c.Version} ({c.ModuleInfo.FileName})");
|
||||
ClrInfo info = dt.ClrVersions.Single(c => c.Flavor == ClrFlavor.Core);
|
||||
string dac = Path.Combine(Path.GetDirectoryName(info.ModuleInfo.FileName)!, "mscordaccore.dll");
|
||||
using ClrRuntime runtime = File.Exists(dac) ? info.CreateRuntime(dac, ignoreMismatch: true) : info.CreateRuntime();
|
||||
ClrHeap heap = runtime.Heap;
|
||||
Console.WriteLine($"CLR {info.Version} in pid {pid}; heap {heap.Segments.Sum(s => (long)s.Length) / 1048576} MB in {heap.Segments.Length} segments");
|
||||
|
||||
if (stackOfOsThread != 0 || (args.Length > 1 && args[1] == "--stack"))
|
||||
{
|
||||
// AlcRoots <pid> --stack <osThreadIdHex>: managed stack of one thread.
|
||||
foreach (ClrThread th in runtime.Threads.Where(t => t.OSThreadId == stackOfOsThread))
|
||||
foreach (ClrStackFrame f in th.EnumerateStackTrace().Take(60))
|
||||
Console.WriteLine($" {f.InstructionPointer:x8} {(f.Method != null ? f.Method.Signature : f.FrameName)}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --- collectible contexts still alive -------------------------------------------------
|
||||
// The newest generation is the running one; every older context still alive is a leak
|
||||
// (with only one context, it is the target: useful before a reload).
|
||||
var allocators = heap.EnumerateObjects().Where(o => o.Type?.Name == "System.Reflection.LoaderAllocator").ToList();
|
||||
var contexts = heap.EnumerateObjects().Where(o => o.Type?.Name == "RynthCore.Shim.EngineLoadContext")
|
||||
.Select(o => (Obj: o, Name: o.ReadStringField("_name") ?? "?"))
|
||||
.OrderBy(c => GenOf(c.Name))
|
||||
.ToList();
|
||||
Console.WriteLine($"LoaderAllocators alive: {allocators.Count}; EngineLoadContexts alive: {contexts.Count}");
|
||||
var targetContexts = new HashSet<ulong>(
|
||||
(contexts.Count > 1 ? contexts.Take(contexts.Count - 1) : contexts).Select(c => c.Obj.Address));
|
||||
foreach (var (obj, name) in contexts)
|
||||
Console.WriteLine($" context 0x{obj.Address:x8} \"{name}\"{(targetContexts.Contains(obj.Address) ? " <- should be gone" : " (running)")}");
|
||||
|
||||
static int GenOf(string name) =>
|
||||
int.TryParse(System.Text.RegularExpressions.Regex.Match(name, @"gen(\d+)").Groups[1].Value, out int g) ? g : 0;
|
||||
|
||||
bool InTarget(ClrType? t) => t != null && t.IsCollectible && targetContexts.Contains(t.AssemblyLoadContextAddress);
|
||||
|
||||
// --- threads running code of the leaked generation(s) -----------------------------------
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Threads with frames in the leaked generation(s):");
|
||||
int engineThreads = 0;
|
||||
foreach (ClrThread thread in runtime.Threads)
|
||||
{
|
||||
if (!thread.IsAlive) continue;
|
||||
var frames = thread.EnumerateStackTrace().Take(200).ToList();
|
||||
if (!frames.Any(f => InTarget(f.Method?.Type))) continue;
|
||||
engineThreads++;
|
||||
Console.WriteLine($" thread managed={thread.ManagedThreadId} os=0x{thread.OSThreadId:x}");
|
||||
foreach (ClrStackFrame f in frames.Where(f => f.Method != null).Take(12))
|
||||
Console.WriteLine($" {(InTarget(f.Method!.Type) ? "*" : " ")} {f.Method.Signature ?? f.Method.Name}");
|
||||
}
|
||||
if (engineThreads == 0) Console.WriteLine(" (none)");
|
||||
|
||||
// --- reference paths from roots --------------------------------------------------------
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Root paths into the leaked generation(s):");
|
||||
var parent = new Dictionary<ulong, ulong>();
|
||||
var rootOf = new Dictionary<ulong, string>();
|
||||
var queue = new Queue<ClrObject>();
|
||||
foreach (ClrRoot root in heap.EnumerateRoots())
|
||||
{
|
||||
ClrObject o = root.Object;
|
||||
if (!o.IsValid || rootOf.ContainsKey(o.Address)) continue;
|
||||
string desc = root.RootKind.ToString();
|
||||
if (root is ClrStackRoot sr && sr.StackFrame != null)
|
||||
desc += $" thread os=0x{sr.StackFrame.Thread?.OSThreadId:x} in {sr.StackFrame.Method?.Signature ?? sr.StackFrame.FrameName}";
|
||||
rootOf[o.Address] = desc;
|
||||
queue.Enqueue(o);
|
||||
}
|
||||
|
||||
var hits = new List<ulong>();
|
||||
var visited = new HashSet<ulong>(rootOf.Keys);
|
||||
while (queue.Count > 0)
|
||||
{
|
||||
ClrObject o = queue.Dequeue();
|
||||
if (InTarget(o.Type)) { hits.Add(o.Address); continue; } // stop at the boundary
|
||||
if (o.Type?.IsCollectible == true) continue; // the running generation's own objects
|
||||
foreach (ClrObject r in o.EnumerateReferences(false, true))
|
||||
{
|
||||
if (!r.IsValid || !visited.Add(r.Address)) continue;
|
||||
parent[r.Address] = o.Address;
|
||||
queue.Enqueue(r);
|
||||
}
|
||||
}
|
||||
|
||||
// Group by root description + path shape so one leak doesn't print a thousand times.
|
||||
var seen = new HashSet<string>();
|
||||
int printed = 0;
|
||||
foreach (ulong hit in hits)
|
||||
{
|
||||
var chain = new List<ulong> { hit };
|
||||
ulong cur = hit;
|
||||
while (parent.TryGetValue(cur, out ulong p)) { chain.Add(p); cur = p; }
|
||||
chain.Reverse();
|
||||
string rootDesc = rootOf.TryGetValue(chain[0], out string? d) ? d : "?";
|
||||
var types = chain.Select(a => heap.GetObject(a).Type?.Name ?? "?").ToList();
|
||||
string key = rootDesc.Split(" thread")[0] + "|" + string.Join(">", types);
|
||||
if (!seen.Add(key)) continue;
|
||||
Console.WriteLine($" [{rootDesc}]");
|
||||
for (int i = 0; i < chain.Count; i++)
|
||||
{
|
||||
ClrObject o = heap.GetObject(chain[i]);
|
||||
string extra = o.Type?.IsString == true ? $" \"{Trim(o.AsString())}\"" : "";
|
||||
if (o.Type?.Name?.Contains("Delegate") == true || o.Type?.BaseType?.Name == "System.MulticastDelegate")
|
||||
extra = DescribeDelegate(runtime, o);
|
||||
Console.WriteLine($" {(i == chain.Count - 1 ? "=>" : "->")} {o.Type?.Name}{extra} @0x{o.Address:x8}");
|
||||
}
|
||||
if (++printed >= maxPaths) { Console.WriteLine($" ... ({hits.Count} hits, stopping at {maxPaths} distinct paths)"); break; }
|
||||
}
|
||||
if (printed == 0) Console.WriteLine(" (no strong path found: check the threads above and dependent handles)");
|
||||
return 0;
|
||||
|
||||
static string Trim(string? s) => s == null ? "" : s.Length > 80 ? s[..80] + "..." : s;
|
||||
|
||||
static string DescribeDelegate(ClrRuntime runtime, ClrObject del)
|
||||
{
|
||||
try
|
||||
{
|
||||
ulong methodPtr = del.ReadValueTypeField("_methodPtr").Address != 0 ? del.ReadField<ulong>("_methodPtr") : 0;
|
||||
ClrObject target = del.ReadObjectField("_target");
|
||||
ClrMethod? m = runtime.GetMethodByInstructionPointer(methodPtr);
|
||||
return $" (target {target.Type?.Name ?? "null"}, method {m?.Signature ?? "?"})";
|
||||
}
|
||||
catch { return ""; }
|
||||
}
|
||||
23
tools/CharacterTitlesTests/CharacterTitlesTests.csproj
Normal file
23
tools/CharacterTitlesTests/CharacterTitlesTests.csproj
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the character-title tracking behind plugin API v75 GetCharacterTitles
|
||||
(src\RynthCore.Engine\Compatibility\CharacterTitles.cs, compiled in): ACE's 0x0029 and
|
||||
0x002B game events, the owner rule and the hot-reload mirror. Nothing native: no AC.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>CharacterTitlesTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\CharacterTitles.cs" Link="Engine\CharacterTitles.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
98
tools/CharacterTitlesTests/Program.cs
Normal file
98
tools/CharacterTitlesTests/Program.cs
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
using System.Buffers.Binary;
|
||||
using System.Runtime.InteropServices;
|
||||
using RynthCore.Engine.Compatibility;
|
||||
|
||||
namespace CharacterTitlesTests;
|
||||
|
||||
/// <summary>CharacterTitles (plugin API v75) without AC: hand-built ACE title events.</summary>
|
||||
internal static unsafe class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
Environment.SetEnvironmentVariable("RYNTHCORE_CHAR_TITLES", null);
|
||||
|
||||
// Nothing received yet.
|
||||
Check(Copy(0x50000001, out _, out _) == -1, "unknown before any event");
|
||||
|
||||
// 0x0029 at login: [type][1][current][count][ids...], as ACE's GameEventCharacterTitle writes it.
|
||||
Send(TitleList(current: 9, 1, 9, 42, 42));
|
||||
Check(Copy(0x50000001, out uint[] ids, out uint cur) == 3 && cur == 9 && ids.SequenceEqual(new uint[] { 1, 9, 42 }),
|
||||
"title list (duplicate dropped)");
|
||||
|
||||
// Received before the player id was known (owner 0): adopted by the first reader, then kept.
|
||||
Check(Copy(0x50000002, out _, out _) == -1, "another character's list isn't served");
|
||||
|
||||
// 0x002B: a new title, then a display change.
|
||||
Send(Update(77, display: false));
|
||||
Check(Copy(0x50000001, out ids, out cur) == 4 && cur == 9 && ids.Contains(77u), "a new title is added");
|
||||
Send(Update(42, display: true));
|
||||
Check(Copy(0x50000001, out ids, out cur) == 4 && cur == 42, "a display change sets the current title");
|
||||
|
||||
// Malformed: a count past the end is ignored (the old list stays).
|
||||
byte[] bad = TitleList(current: 1, 5, 6);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(bad.AsSpan(12), 1000);
|
||||
Send(bad);
|
||||
Check(Copy(0x50000001, out ids, out _) == 4, "a count past the end is refused");
|
||||
Check(!CharacterTitles.TryParseUpdate(new byte[8], out _, out _), "a short update is refused");
|
||||
|
||||
// The hot-reload mirror round-trips.
|
||||
string? env = Environment.GetEnvironmentVariable("RYNTHCORE_CHAR_TITLES");
|
||||
Check(CharacterTitles.TryParseMirror(env, out uint owner, out uint mcur, out List<uint> mids)
|
||||
&& owner == 0x50000001 && mcur == 42 && mids.Count == 4, "mirror: " + env);
|
||||
Check(!CharacterTitles.TryParseMirror("garbage", out _, out _, out _), "a bad mirror is refused");
|
||||
|
||||
// Ids only: ask for the count first (ids null).
|
||||
uint c2 = 0;
|
||||
Check(CharacterTitles.Copy(0x50000001, null, 0, &c2) == 4 && c2 == 42, "count without ids");
|
||||
|
||||
Console.WriteLine($"{_checks - _failed} passed, {_failed} failed");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static int Copy(uint player, out uint[] ids, out uint current)
|
||||
{
|
||||
uint[] buf = new uint[64];
|
||||
uint cur = 0;
|
||||
int n;
|
||||
fixed (uint* p = buf) n = CharacterTitles.Copy(player, p, buf.Length, &cur);
|
||||
ids = n > 0 ? buf.Take(n).ToArray() : Array.Empty<uint>();
|
||||
current = cur;
|
||||
return n;
|
||||
}
|
||||
|
||||
private static void Send(byte[] msg)
|
||||
{
|
||||
uint type = BinaryPrimitives.ReadUInt32LittleEndian(msg);
|
||||
fixed (byte* p = msg) CharacterTitles.OnGameEvent(type, (IntPtr)p, (uint)msg.Length, playerId: 0);
|
||||
}
|
||||
|
||||
private static byte[] TitleList(uint current, params uint[] ids)
|
||||
{
|
||||
var b = new byte[16 + ids.Length * 4];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(b, CharacterTitles.EventCharacterTitle);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(b.AsSpan(4), 1);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(b.AsSpan(8), current);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(b.AsSpan(12), (uint)ids.Length);
|
||||
for (int i = 0; i < ids.Length; i++) BinaryPrimitives.WriteUInt32LittleEndian(b.AsSpan(16 + i * 4), ids[i]);
|
||||
return b;
|
||||
}
|
||||
|
||||
private static byte[] Update(uint title, bool display)
|
||||
{
|
||||
var b = new byte[12];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(b, CharacterTitles.EventUpdateTitle);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(b.AsSpan(4), title);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(b.AsSpan(8), display ? 1u : 0u);
|
||||
return b;
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine("FAIL: " + what);
|
||||
}
|
||||
}
|
||||
22
tools/ChatCoordTests/ChatCoordTests.csproj
Normal file
22
tools/ChatCoordTests/ChatCoordTests.csproj
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the chat window's coordinate finder (src\RynthCore.Engine\UI\Data\
|
||||
ChatCoords.cs, compiled in): which chat lines hold map coordinates, in which order and
|
||||
format, and which ordinary lines must not turn into coordinates.
|
||||
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>ChatCoordTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatCoords.cs" Link="Engine\ChatCoords.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
72
tools/ChatCoordTests/Program.cs
Normal file
72
tools/ChatCoordTests/Program.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
using RynthCore.Engine.UI.Data;
|
||||
|
||||
namespace ChatCoordTests;
|
||||
|
||||
/// <summary>
|
||||
/// The chat window's coordinate finder (ChatCoords): the forms players and the game write
|
||||
/// coordinates in, and ordinary chat that must not become coordinates.
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
One("Meet me at 42.1N, 33.6E", 42.1, 33.6, "42.1N, 33.6E");
|
||||
One("42.1N 33.6E", 42.1, 33.6, "42.1N, 33.6E");
|
||||
One("42.1N33.6E", 42.1, 33.6, "42.1N, 33.6E");
|
||||
One("loc 21.5S, 1.8W please", -21.5, -1.8, "21.5S, 1.8W");
|
||||
One("33.6E, 42.1N", 42.1, 33.6, "42.1N, 33.6E");
|
||||
One("at 42.1 N, 33.6 E now", 42.1, 33.6, "42.1N, 33.6E");
|
||||
One("(12.5n, 0.4w)", 12.5, -0.4, "12.5N, 0.4W");
|
||||
One("Your location is: 0xA9B40019 [84.000 7.100 42.005] 0.0 0.0 0.0 1.0 = 42.1N, 33.6E", 42.1, 33.6, "42.1N, 33.6E");
|
||||
One("drudges at 42N 33E", 42, 33, "42.0N, 33.0E");
|
||||
One("0.0N, 101.9W", 0, -101.9, "0.0N, 101.9W");
|
||||
|
||||
// Two in one line, in order.
|
||||
var two = ChatCoords.Find("from 42.1N, 33.6E to 21.5S, 1.8W");
|
||||
Check(two.Count == 2, "two pairs");
|
||||
Check(two.Count == 2 && two[0].Ns == 42.1 && two[1].Ns == -21.5, "in order");
|
||||
Check(two.Count == 2 && two[0].Start < two[1].Start, "start positions");
|
||||
var first = two.Count > 0 ? two[0] : default;
|
||||
Check(first.Start == 5 && "from 42.1N, 33.6E to".Substring(first.Start, first.Length) == "42.1N, 33.6E", "the span covers the pair");
|
||||
|
||||
// Not coordinates.
|
||||
None("give me 5 s, 2 e");
|
||||
None("lvl 120N 33E"); // off the map
|
||||
None("Holtburg is nice");
|
||||
None("brb 5 min");
|
||||
None("42.1N"); // half a pair
|
||||
None("42.1N 33.6N"); // two N/S
|
||||
None("v1.2.3n 4.5e"); // part of a word / version
|
||||
None("");
|
||||
None(null);
|
||||
|
||||
Console.WriteLine(_failed == 0 && _checks > 0 ? $"PASS ({_checks} checks)" : $"FAIL ({_failed} of {_checks})");
|
||||
return _failed == 0 && _checks > 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static void One(string text, double ns, double ew, string formatted)
|
||||
{
|
||||
var found = ChatCoords.Find(text);
|
||||
Check(found.Count == 1, $"one pair in \"{text}\" (found {found.Count})");
|
||||
if (found.Count != 1) return;
|
||||
Check(Math.Abs(found[0].Ns - ns) < 1e-9 && Math.Abs(found[0].Ew - ew) < 1e-9,
|
||||
$"\"{text}\" -> {ns}, {ew} (got {found[0].Ns}, {found[0].Ew})");
|
||||
Check(found[0].Text == formatted, $"\"{text}\" formats as {formatted} (got {found[0].Text})");
|
||||
}
|
||||
|
||||
private static void None(string? text)
|
||||
{
|
||||
var found = ChatCoords.Find(text);
|
||||
Check(found.Count == 0, $"no pair in \"{text}\" (found {found.Count}: {string.Join("; ", found.Select(f => f.Text))})");
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine(" [FAIL] " + what);
|
||||
}
|
||||
}
|
||||
23
tools/ChatHoldTests/ChatHoldTests.csproj
Normal file
23
tools/ChatHoldTests/ChatHoldTests.csproj
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the engine's incoming-chat hold (src\RynthCore.Engine\Compatibility\
|
||||
IncomingChatHold.cs, compiled in): when a line is held for the plugins' verdict, when it
|
||||
prints at once, the order held lines print in, eaten lines, the timeout, flushing, and the
|
||||
"a plugin threw, so the line shows" rule. Nothing native: no AC, no engine state.
|
||||
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>ChatHoldTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\IncomingChatHold.cs" Link="Engine\IncomingChatHold.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
269
tools/ChatHoldTests/Program.cs
Normal file
269
tools/ChatHoldTests/Program.cs
Normal file
|
|
@ -0,0 +1,269 @@
|
|||
using System.Collections.Concurrent;
|
||||
using RynthCore.Engine.Compatibility;
|
||||
|
||||
namespace ChatHoldTests;
|
||||
|
||||
/// <summary>
|
||||
/// The engine's incoming-chat hold (IncomingChatHold.cs) without AC: the hold decision, the
|
||||
/// release order, eaten lines, the timeout, flushing, and a two-thread run shaped like the
|
||||
/// real one (AC's main thread holds and prints, the plugin pump writes verdicts).
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
private static string _case = "";
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
DecideHoldsANormalLine();
|
||||
DecidePassThroughCases();
|
||||
DecideFlushCases();
|
||||
ReleaseKeepsOrder();
|
||||
ReleaseDropsEatenLines();
|
||||
ReleaseTimeout();
|
||||
ReleaseFlushAll();
|
||||
ReleasePrintThrows();
|
||||
FirstVerdictWins();
|
||||
PluginsAteItRule();
|
||||
MetaManagerPollShape();
|
||||
TwoThreads();
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
|
||||
Console.WriteLine(_failed == 0 ? "ALL CHAT HOLD TESTS PASSED." : $"{_failed} FAILED.");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// ── the hold decision ───────────────────────────────────────────────────
|
||||
|
||||
private const long Now = 100_000;
|
||||
|
||||
private static ChatHoldInputs Normal() => new(
|
||||
Enabled: true, Disarmed: false, OnMainThread: true, Replaying: false,
|
||||
HasText: true, Truncated: false, HasStringInfo: false,
|
||||
NowMs: Now, PumpBeatMs: Now - 10, DrainBeatMs: Now - 10, HeldCount: 0);
|
||||
|
||||
private static void DecideHoldsANormalLine()
|
||||
{
|
||||
Case("decide: a normal line is held");
|
||||
Check(HeldChatQueue.Decide(Normal()) == ChatHoldDecision.Hold, "normal line held");
|
||||
Check(HeldChatQueue.Decide(Normal() with { HeldCount = HeldChatQueue.MaxHeld - 1 }) == ChatHoldDecision.Hold, "held while under the cap");
|
||||
Check(HeldChatQueue.Decide(Normal() with { PumpBeatMs = Now - HeldChatQueue.PumpStaleMs }) == ChatHoldDecision.Hold, "pump beat exactly at the limit still holds");
|
||||
Check(HeldChatQueue.Decide(Normal() with { DrainBeatMs = Now - HeldChatQueue.DrainStaleMs }) == ChatHoldDecision.Hold, "drain beat exactly at the limit still holds");
|
||||
}
|
||||
|
||||
private static void DecidePassThroughCases()
|
||||
{
|
||||
Case("decide: lines that print at once, held lines untouched");
|
||||
Check(HeldChatQueue.Decide(Normal() with { Replaying = true }) == ChatHoldDecision.PassThrough, "inside our own print");
|
||||
Check(HeldChatQueue.Decide(Normal() with { Replaying = true, Enabled = false }) == ChatHoldDecision.PassThrough, "inside our own print, even when switched off (never flush mid-release)");
|
||||
Check(HeldChatQueue.Decide(Normal() with { OnMainThread = false }) == ChatHoldDecision.PassThrough, "off AC's main thread");
|
||||
Check(HeldChatQueue.Decide(Normal() with { OnMainThread = false, Enabled = false }) == ChatHoldDecision.PassThrough, "off the main thread never touches the held list");
|
||||
Check(HeldChatQueue.Decide(Normal() with { HasStringInfo = true }) == ChatHoldDecision.PassThrough, "caller passed a StringInfo");
|
||||
Check(HeldChatQueue.Decide(Normal() with { Truncated = true }) == ChatHoldDecision.PassThrough, "line longer than we read");
|
||||
Check(HeldChatQueue.Decide(Normal() with { HasText = false }) == ChatHoldDecision.PassThrough, "empty line");
|
||||
}
|
||||
|
||||
private static void DecideFlushCases()
|
||||
{
|
||||
Case("decide: holding off or unsafe flushes what is held");
|
||||
Check(HeldChatQueue.Decide(Normal() with { Enabled = false }) == ChatHoldDecision.FlushThenPassThrough, "/rc chathold off");
|
||||
Check(HeldChatQueue.Decide(Normal() with { Disarmed = true }) == ChatHoldDecision.FlushThenPassThrough, "engine teardown");
|
||||
Check(HeldChatQueue.Decide(Normal() with { PumpBeatMs = 0 }) == ChatHoldDecision.FlushThenPassThrough, "pump never ran");
|
||||
Check(HeldChatQueue.Decide(Normal() with { PumpBeatMs = Now - HeldChatQueue.PumpStaleMs - 1 }) == ChatHoldDecision.FlushThenPassThrough, "pump stalled");
|
||||
Check(HeldChatQueue.Decide(Normal() with { DrainBeatMs = 0 }) == ChatHoldDecision.FlushThenPassThrough, "drain never ran");
|
||||
Check(HeldChatQueue.Decide(Normal() with { DrainBeatMs = Now - HeldChatQueue.DrainStaleMs - 1 }) == ChatHoldDecision.FlushThenPassThrough, "drain stalled");
|
||||
Check(HeldChatQueue.Decide(Normal() with { HeldCount = HeldChatQueue.MaxHeld }) == ChatHoldDecision.FlushThenPassThrough, "too many held");
|
||||
Check(HeldChatQueue.Decide(Normal() with { Enabled = false, HasStringInfo = true }) == ChatHoldDecision.FlushThenPassThrough, "switched off wins over a StringInfo line (keeps the order)");
|
||||
}
|
||||
|
||||
// ── releasing ───────────────────────────────────────────────────────────
|
||||
|
||||
private static HeldChatLine Line(string text, long at = 0) => new(text + "\n", 0, 1, new IntPtr(0x1234), at);
|
||||
|
||||
private static void ReleaseKeepsOrder()
|
||||
{
|
||||
Case("release: oldest first, stops at the first line still waiting");
|
||||
var q = new HeldChatQueue();
|
||||
var printed = new List<string>();
|
||||
HeldChatLine a = Line("a"), b = Line("b"), c = Line("c");
|
||||
q.Add(a); q.Add(b); q.Add(c);
|
||||
a.Decide(eat: false);
|
||||
c.Decide(eat: false);
|
||||
int n = q.Release(10, false, l => printed.Add(l.Raw));
|
||||
Check(n == 1 && printed.SequenceEqual(new[] { "a\n" }), "only a prints while b waits");
|
||||
Check(q.Count == 2, "b and c still held");
|
||||
b.Decide(eat: false);
|
||||
q.Release(20, false, l => printed.Add(l.Raw));
|
||||
Check(printed.SequenceEqual(new[] { "a\n", "b\n", "c\n" }), "then b and c, in order");
|
||||
Check(q.Count == 0 && q.ShownTotal == 3 && q.HeldTotal == 3, "counters");
|
||||
Check(q.Release(30, false, l => printed.Add(l.Raw)) == 0, "empty release prints nothing");
|
||||
}
|
||||
|
||||
private static void ReleaseDropsEatenLines()
|
||||
{
|
||||
Case("release: eaten lines never print");
|
||||
var q = new HeldChatQueue();
|
||||
var printed = new List<string>();
|
||||
HeldChatLine a = Line("a"), b = Line("quest line"), c = Line("c");
|
||||
q.Add(a); q.Add(b); q.Add(c);
|
||||
a.Decide(false); b.Decide(true); c.Decide(false);
|
||||
q.Release(5, false, l => printed.Add(l.Raw));
|
||||
Check(printed.SequenceEqual(new[] { "a\n", "c\n" }), "a and c print, the eaten line doesn't");
|
||||
Check(q.EatenTotal == 1 && q.ShownTotal == 2 && q.Count == 0, "counters");
|
||||
}
|
||||
|
||||
private static void ReleaseTimeout()
|
||||
{
|
||||
Case("release: a line with no verdict prints after the timeout");
|
||||
var q = new HeldChatQueue();
|
||||
var printed = new List<string>();
|
||||
HeldChatLine a = Line("a", at: 1000), b = Line("b", at: 1100);
|
||||
q.Add(a); q.Add(b);
|
||||
q.Release(1000 + HeldChatQueue.HoldTimeoutMs - 1, false, l => printed.Add(l.Raw));
|
||||
Check(printed.Count == 0, "not yet");
|
||||
q.Release(1000 + HeldChatQueue.HoldTimeoutMs, false, l => printed.Add(l.Raw));
|
||||
Check(printed.SequenceEqual(new[] { "a\n" }) && q.TimedOutTotal == 1, "a prints late; b (held later) still waits");
|
||||
b.Decide(true);
|
||||
q.Release(1000 + HeldChatQueue.HoldTimeoutMs + 1, false, l => printed.Add(l.Raw));
|
||||
Check(printed.Count == 1 && q.EatenTotal == 1 && q.Count == 0, "b eaten in time");
|
||||
a.Decide(true); // a verdict after the line already printed does nothing
|
||||
Check(q.EatenTotal == 1 && q.Count == 0, "late verdict ignored");
|
||||
}
|
||||
|
||||
private static void ReleaseFlushAll()
|
||||
{
|
||||
Case("release: flushAll prints everything not eaten");
|
||||
var q = new HeldChatQueue();
|
||||
var printed = new List<string>();
|
||||
HeldChatLine a = Line("a"), b = Line("b"), c = Line("c");
|
||||
q.Add(a); q.Add(b); q.Add(c);
|
||||
b.Decide(true);
|
||||
q.Release(0, true, l => printed.Add(l.Raw));
|
||||
Check(printed.SequenceEqual(new[] { "a\n", "c\n" }), "a and c print without a verdict, eaten b still dropped");
|
||||
Check(q.TimedOutTotal == 2 && q.EatenTotal == 1 && q.Count == 0, "counters");
|
||||
}
|
||||
|
||||
private static void ReleasePrintThrows()
|
||||
{
|
||||
Case("release: a print that throws doesn't stop the rest");
|
||||
var q = new HeldChatQueue();
|
||||
var printed = new List<string>();
|
||||
HeldChatLine a = Line("bad"), b = Line("b");
|
||||
q.Add(a); q.Add(b);
|
||||
a.Decide(false); b.Decide(false);
|
||||
q.Release(0, false, l => { if (l.Raw.StartsWith("bad")) throw new InvalidOperationException(); printed.Add(l.Raw); });
|
||||
Check(printed.SequenceEqual(new[] { "b\n" }) && q.PrintFailedTotal == 1 && q.Count == 0, "b still prints");
|
||||
}
|
||||
|
||||
private static void FirstVerdictWins()
|
||||
{
|
||||
Case("verdict: the first one wins");
|
||||
HeldChatLine a = Line("a");
|
||||
Check(a.Verdict == HeldChatLine.Pending, "starts pending");
|
||||
a.Decide(true);
|
||||
a.Decide(false);
|
||||
Check(a.Verdict == HeldChatLine.Eat, "eat then show stays eat");
|
||||
HeldChatLine b = Line("b");
|
||||
b.Decide(false);
|
||||
b.Decide(true);
|
||||
Check(b.Verdict == HeldChatLine.Show, "show then eat stays show (an overflow drop can't be undone)");
|
||||
Check(a.Raw == "a\n" && a.Unknown == 1 && a.This == new IntPtr(0x1234), "fields kept for the reprint");
|
||||
}
|
||||
|
||||
private static void PluginsAteItRule()
|
||||
{
|
||||
Case("verdict: eat flag and plugin errors");
|
||||
Check(HeldChatQueue.PluginsAteIt(1, false), "eat set, no error: eaten");
|
||||
Check(HeldChatQueue.PluginsAteIt(-1, false), "any non-zero eat counts");
|
||||
Check(!HeldChatQueue.PluginsAteIt(0, false), "nobody ate it: shows");
|
||||
Check(!HeldChatQueue.PluginsAteIt(1, true), "a plugin threw: shows even if eaten");
|
||||
Check(!HeldChatQueue.PluginsAteIt(0, true), "a plugin threw, not eaten: shows");
|
||||
}
|
||||
|
||||
// ── shaped like the real thing ──────────────────────────────────────────
|
||||
|
||||
// A burst of chat with RynthAi's own /myquests reply in the middle: only the reply goes.
|
||||
private static void MetaManagerPollShape()
|
||||
{
|
||||
Case("shape: a /myquests reply in the middle of combat text");
|
||||
var q = new HeldChatQueue();
|
||||
var printed = new List<string>();
|
||||
string[] lines =
|
||||
{
|
||||
"You hit the Drudge Slinker for 42 points of slashing damage!",
|
||||
"blightlordlairwait1008 - 3 solves (1759190400)\"Blight Lord Lair\" -1 72000",
|
||||
"stipendtimer_monthly - 2 solves (1759276800)\"Monthly stipend\" -1 2592000",
|
||||
"Vessa tells you, \"hi\"",
|
||||
"The Drudge Slinker hits you for 7 points of bludgeoning damage!",
|
||||
};
|
||||
var held = lines.Select(t => Line(t)).ToArray();
|
||||
foreach (var h in held) q.Add(h);
|
||||
// The pump: RynthAi eats the lines that parse as /myquests while its poll is in flight.
|
||||
foreach (var h in held) h.Decide(eat: h.Raw.Contains(" solves ("));
|
||||
q.Release(1, false, l => printed.Add(l.Raw.TrimEnd('\n')));
|
||||
Check(printed.SequenceEqual(new[] { lines[0], lines[3], lines[4] }), "combat, tell, combat print in order; the two quest lines don't");
|
||||
}
|
||||
|
||||
// AC's main thread holds and releases while the pump decides on its own thread; with no
|
||||
// timeouts in play every line not eaten prints exactly once, in order.
|
||||
private static void TwoThreads()
|
||||
{
|
||||
Case("two threads: main holds/releases, pump decides");
|
||||
const int total = 20000;
|
||||
var q = new HeldChatQueue();
|
||||
var toPump = new ConcurrentQueue<HeldChatLine>();
|
||||
var printed = new List<int>();
|
||||
using var done = new ManualResetEventSlim(false);
|
||||
|
||||
var pump = new Thread(() =>
|
||||
{
|
||||
int seen = 0;
|
||||
while (seen < total)
|
||||
{
|
||||
if (toPump.TryDequeue(out var h))
|
||||
{
|
||||
int n = int.Parse(h.Raw.AsSpan(0, h.Raw.Length - 1));
|
||||
h.Decide(eat: n % 7 == 3);
|
||||
seen++;
|
||||
}
|
||||
else Thread.Yield();
|
||||
}
|
||||
done.Set();
|
||||
});
|
||||
pump.Start();
|
||||
|
||||
for (int i = 0; i < total; i++)
|
||||
{
|
||||
var h = new HeldChatLine(i + "\n", 0, 1, IntPtr.Zero, 0);
|
||||
q.Add(h);
|
||||
toPump.Enqueue(h);
|
||||
if ((i & 15) == 0)
|
||||
q.Release(0, false, l => printed.Add(int.Parse(l.Raw.AsSpan(0, l.Raw.Length - 1)))); // clock frozen: no timeouts
|
||||
}
|
||||
done.Wait();
|
||||
pump.Join();
|
||||
q.Release(0, false, l => printed.Add(int.Parse(l.Raw.AsSpan(0, l.Raw.Length - 1))));
|
||||
|
||||
var expected = Enumerable.Range(0, total).Where(n => n % 7 != 3).ToList();
|
||||
Check(q.Count == 0, "nothing left held");
|
||||
Check(printed.SequenceEqual(expected), "every line not eaten printed once, in order");
|
||||
Check(q.EatenTotal == total - expected.Count && q.TimedOutTotal == 0, "counters");
|
||||
}
|
||||
|
||||
// ── helpers ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static void Case(string name)
|
||||
{
|
||||
_case = name;
|
||||
Console.WriteLine($"-- {name}");
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine($" FAIL [{_case}] {what}");
|
||||
}
|
||||
}
|
||||
27
tools/DecalBridgeCheckTests/DecalBridgeCheckTests.csproj
Normal file
27
tools/DecalBridgeCheckTests/DecalBridgeCheckTests.csproj
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the "Check Decal bridge" logic (src\RynthCore.App\DecalBridgeCheck.cs,
|
||||
compiled in): which registry view a Decal client reads its filter list from (per-user
|
||||
VirtualStore copy vs machine-wide HKLM) for non-elevated / elevated / UAC-off /
|
||||
manifest / run-as-administrator clients, and every check line, against a fake registry.
|
||||
Never touches the real registry.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>DecalBridgeCheckTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.App\DecalBridgeCheck.cs" Link="App\DecalBridgeCheck.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App\RealDecalCheckHost.cs" Link="App\RealDecalCheckHost.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App\DecalBridgeRegistration.cs" Link="App\DecalBridgeRegistration.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App\DecalLocator.cs" Link="App\DecalLocator.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
440
tools/DecalBridgeCheckTests/Program.cs
Normal file
440
tools/DecalBridgeCheckTests/Program.cs
Normal file
|
|
@ -0,0 +1,440 @@
|
|||
using RynthCore.App;
|
||||
using static RynthCore.App.DecalBridgeCheck;
|
||||
|
||||
namespace DecalBridgeCheckTests;
|
||||
|
||||
/// <summary>
|
||||
/// The Decal bridge check against a fake machine. The scenario that broke on a player's PC
|
||||
/// (2026-10-03, release 2026.10.3.1) is "elevated client, per-user registration only":
|
||||
/// Decal reads HKLM, the per-user entry is invisible, the bridge never loads.
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
|
||||
private const string Agent = @"C:\Program Files (x86)\Decal 3.0\";
|
||||
private const string BridgeDir = @"C:\Games\RynthCore\DecalBridge";
|
||||
private const string AcClient = @"C:\Turbine\Asheron's Call\acclient.exe";
|
||||
private static readonly string Guid = DecalBridgeRegistration.FilterGuid;
|
||||
private static readonly string VsFilters = VirtualStoreDecalPath(true, "NetworkFilters");
|
||||
private static readonly string HkFilters = MachineDecalPath("NetworkFilters");
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
Scenario("Tom's PC: non-elevated, per-user copy with the bridge", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.User64, VsFilters, new());
|
||||
h.Set(RegRoot.User64, VsFilters + "\\" + Guid, BridgeEntry());
|
||||
MirrorStock(h, RegRoot.User64, VsFilters);
|
||||
h.OwnView = BridgeEntry();
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.ClientVirtualized, "client virtualized");
|
||||
Check(r.ReadsPerUserCopy, "Decal reads the per-user copy");
|
||||
Check(r.BridgeVisibleToDecal && !r.Blocking, "bridge visible, not blocking");
|
||||
Check(Has(r, Level.Ok, "Read back as AC will see it: bridge listed"), "live read-back agrees");
|
||||
Check(!Has(r, Level.Warn, "Hidden from AC"), "no hidden filters (all mirrored)");
|
||||
});
|
||||
|
||||
Scenario("THE PLAYER CASE: launcher (so AC) elevated, bridge only in the per-user copy", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.LauncherElevated = true;
|
||||
h.LauncherVirtualized = false;
|
||||
h.Set(RegRoot.User64, VsFilters, new());
|
||||
h.Set(RegRoot.User64, VsFilters + "\\" + Guid, BridgeEntry());
|
||||
h.OwnView = null; // the elevated view is the real HKLM: no bridge there
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(!r.ClientVirtualized, "client not virtualized");
|
||||
Check(r.ClientReason.Contains("administrator"), "reason names administrator");
|
||||
Check(!r.ReadsPerUserCopy, "Decal reads HKLM");
|
||||
Check(r.FiltersReadFrom.Contains(@"HKLM\SOFTWARE\WOW6432Node\Decal\NetworkFilters"), "describes the WOW6432Node key");
|
||||
Check(r.Blocking && !r.BridgeVisibleToDecal, "blocking");
|
||||
Check(r.NeedsMachineWideRegistration, "needs the machine-wide registration (admin)");
|
||||
Check(Has(r, Level.Info, "per-user registration exists, but this AC client doesn't read it"), "explains the invisible per-user entry");
|
||||
Check(Has(r, Level.Ok, "Read back as AC will see it: bridge not listed"), "live read-back agrees (not listed)");
|
||||
});
|
||||
|
||||
// ── after the installer / an update (installer\RynthCore.iss RegisterDecalBridge) ──
|
||||
|
||||
Scenario("installer plan: machine always; per-user only into an existing copy", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
Check(PlanInstall(h) == (true, false), "no copy: machine only (a copy is never created)");
|
||||
h.Set(RegRoot.User64, VsFilters, new());
|
||||
Check(PlanInstall(h) == (true, true), "copy exists: machine + per-user");
|
||||
h.Remove(RegRoot.Machine32, MachineDecalPath("Agent"));
|
||||
Check(PlanInstall(h) == (false, false), "no Decal: nothing");
|
||||
});
|
||||
|
||||
foreach (bool elevated in new[] { false, true })
|
||||
foreach (bool uacOff in new[] { false, true })
|
||||
{
|
||||
string who = (elevated ? "elevated" : "non-elevated") + (uacOff ? ", UAC off" : "");
|
||||
Scenario($"installer wrote both (per-user copy existed): {who} client loads the bridge", () =>
|
||||
{
|
||||
FakeHost h = InstalledBoth(withCopy: true, elevated, uacOff);
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.BridgeVisibleToDecal && !r.Blocking, "visible, not blocking");
|
||||
Check(r.ReadsPerUserCopy == (!elevated && !uacOff), "reads the copy only when virtualized");
|
||||
});
|
||||
Scenario($"installer wrote machine only (no per-user copy): {who} client loads the bridge", () =>
|
||||
{
|
||||
FakeHost h = InstalledBoth(withCopy: false, elevated, uacOff);
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.BridgeVisibleToDecal && !r.Blocking && !r.ReadsPerUserCopy, "visible through HKLM, not blocking");
|
||||
});
|
||||
}
|
||||
|
||||
Scenario("negative control: copy existed but the per-user half didn't run", () =>
|
||||
{
|
||||
FakeHost h = InstalledBoth(withCopy: true, elevated: false, uacOff: false);
|
||||
h.Remove(RegRoot.User64, VsFilters + "\\" + Guid);
|
||||
h.OwnView = null;
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.Blocking && r.ReadsPerUserCopy, "the copy hides the machine entry: why the per-user half is needed");
|
||||
});
|
||||
|
||||
Scenario("elevated, machine-wide entry present", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.LauncherElevated = true;
|
||||
h.LauncherVirtualized = false;
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
h.OwnView = BridgeEntry();
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(!r.Blocking && r.BridgeVisibleToDecal && !r.ReadsPerUserCopy, "OK through HKLM");
|
||||
});
|
||||
|
||||
Scenario("non-elevated, no per-user copy, nothing registered", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.OwnView = null;
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.ClientVirtualized && !r.ReadsPerUserCopy, "virtualized client reads HKLM when no copy exists");
|
||||
Check(r.Blocking && r.NeedsMachineWideRegistration, "blocking; the place read is HKLM");
|
||||
});
|
||||
|
||||
Scenario("non-elevated, per-user copy exists without the bridge, HKLM has it", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.User64, VsFilters, new());
|
||||
h.Set(RegRoot.User64, VsFilters + "\\{108ED493-48AD-42A6-AADC-EF773E4F185A}", new() { [""] = "Virindi AutomaticUpdatesFilter", ["Enabled"] = 1 });
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
h.OwnView = null;
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.ReadsPerUserCopy && r.Blocking && !r.NeedsMachineWideRegistration, "per-user copy hides the HKLM entry; fixable per-user");
|
||||
Check(Has(r, Level.Info, "machine-wide entry exists, but your per-user copy hides it"), "explains the hidden machine entry");
|
||||
Check(Has(r, Level.Warn, "World Object Filter"), "warns that World Object Filter is hidden");
|
||||
});
|
||||
|
||||
Scenario("UAC off", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.Machine64, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", new() { ["EnableLUA"] = 0, ["EnableVirtualization"] = 1 });
|
||||
h.LauncherVirtualized = false;
|
||||
h.Set(RegRoot.User64, VsFilters, new());
|
||||
h.Set(RegRoot.User64, VsFilters + "\\" + Guid, BridgeEntry());
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(!r.ClientVirtualized && r.ClientReason.Contains("UAC is turned off"), "UAC off: not virtualized");
|
||||
Check(r.Blocking && r.NeedsMachineWideRegistration, "per-user registration is not enough");
|
||||
});
|
||||
|
||||
Scenario("virtualization off by policy", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.Machine64, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", new() { ["EnableLUA"] = 1, ["EnableVirtualization"] = 0 });
|
||||
Check(!PredictClientVirtualized(h, AcClient, out string why) && why.Contains("EnableVirtualization=0"), "policy: not virtualized");
|
||||
});
|
||||
|
||||
Scenario("acclient.exe with a manifest", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Levels[AcClient] = "asInvoker";
|
||||
Check(!PredictClientVirtualized(h, AcClient, out string why) && why.Contains("asInvoker"), "manifest: not virtualized");
|
||||
Check(PredictClientVirtualized(h, @"C:\Other\acclient.exe", out _), "a different exe without manifest is virtualized");
|
||||
});
|
||||
|
||||
Scenario("acclient.exe set to Run as administrator, Decal's COM class only per-user", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.User64, @"Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", new() { [AcClient.ToUpperInvariant()] = "~ RUNASADMIN" });
|
||||
h.Remove(RegRoot.Machine32, @"SOFTWARE\Classes\CLSID\" + SurrogateClsid + @"\InprocServer32");
|
||||
h.Set(RegRoot.User32, @"Software\Classes\CLSID\" + SurrogateClsid + @"\InprocServer32", ComEntry());
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(!r.ClientVirtualized && r.ClientReason.Contains("RUNASADMIN"), "RUNASADMIN: not virtualized");
|
||||
Check(r.BridgeVisibleToDecal, "bridge visible in HKLM");
|
||||
Check(Has(r, Level.Fail, "ignores per-user COM classes"), "per-user-only COM class fails for an elevated client");
|
||||
});
|
||||
|
||||
Scenario("non-elevated client resolves a per-user COM class", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Remove(RegRoot.Machine32, @"SOFTWARE\Classes\CLSID\" + SurrogateClsid + @"\InprocServer32");
|
||||
h.Set(RegRoot.User32, @"Software\Classes\CLSID\" + SurrogateClsid + @"\InprocServer32", ComEntry());
|
||||
Check(SurrogateComProblem(h, clientElevated: false, out string where) == null && where == "per-user", "per-user COM class OK");
|
||||
});
|
||||
|
||||
Scenario("COM class missing / pointing at a missing file", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Remove(RegRoot.Machine32, @"SOFTWARE\Classes\CLSID\" + SurrogateClsid + @"\InprocServer32");
|
||||
Check(SurrogateComProblem(h, false, out _)?.Contains("not registered") == true, "missing COM class");
|
||||
var com = ComEntry();
|
||||
com["CodeBase"] = @"file:///D:\Gone\Decal.Adapter.dll";
|
||||
h.Set(RegRoot.Machine32, @"SOFTWARE\Classes\CLSID\" + SurrogateClsid + @"\InprocServer32", com);
|
||||
Check(SurrogateComProblem(h, false, out _)?.Contains("missing file") == true, "CodeBase to a missing file");
|
||||
});
|
||||
|
||||
Scenario("entry problems", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
var disabled = BridgeEntry(); disabled["Enabled"] = 0;
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, disabled);
|
||||
Check(EntryProblem(h, RegRoot.Machine32, HkFilters + "\\" + Guid, out _)?.Contains("disabled") == true, "disabled entry");
|
||||
var moved = BridgeEntry(); moved["Path"] = @"D:\Old\DecalBridge";
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, moved);
|
||||
Check(EntryProblem(h, RegRoot.Machine32, HkFilters + "\\" + Guid, out _)?.Contains("missing") == true, "DLL missing at the registered path");
|
||||
var foreign = BridgeEntry(); foreign["Object"] = "Someone.Else";
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, foreign);
|
||||
Check(EntryProblem(h, RegRoot.Machine32, HkFilters + "\\" + Guid, out _)?.Contains("another filter") == true, "foreign entry");
|
||||
var badSur = BridgeEntry(); badSur["Surrogate"] = "{00000000-0000-0000-0000-000000000000}";
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, badSur);
|
||||
Check(EntryProblem(h, RegRoot.Machine32, HkFilters + "\\" + Guid, out _)?.Contains("Surrogate") == true, "wrong surrogate");
|
||||
});
|
||||
|
||||
Scenario("Decal older than the bridge's reference", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.AssemblyVersions[Agent + "Decal.Adapter.dll"] = new Version(2, 9, 7, 5);
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.Blocking && Has(r, Level.Fail, "older than the 2.9.8.3"), "old Decal blocks");
|
||||
});
|
||||
|
||||
Scenario("Decal's surrogate disabled / not listed in the per-user Surrogates copy", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
h.Set(RegRoot.Machine32, MachineDecalPath("Surrogates") + "\\" + SurrogateClsid, new() { [""] = "Decal.Adapter Surrogate", ["Enabled"] = 0 });
|
||||
Check(Has(Run(h, BridgeDir, AcClient, null), Level.Fail, "disabled in Decal"), "disabled surrogate");
|
||||
h.Set(RegRoot.Machine32, MachineDecalPath("Surrogates") + "\\" + SurrogateClsid, new() { [""] = "Decal.Adapter Surrogate", ["Enabled"] = 1 });
|
||||
h.Set(RegRoot.User64, VirtualStoreDecalPath(true, "Surrogates"), new());
|
||||
Check(Has(Run(h, BridgeDir, AcClient, null), Level.Fail, "surrogate is not listed"), "a per-user Surrogates copy without it hides it");
|
||||
});
|
||||
|
||||
Scenario("engine.json DecalBridge Off", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
h.Files[@"C:\cfg\engine.json"] = "{ \"DecalBridge\": \"Off\", \"DecalInGameImGui\": false }";
|
||||
Result r = Run(h, BridgeDir, AcClient, @"C:\cfg\engine.json");
|
||||
Check(Has(r, Level.Fail, "\"DecalBridge\": Off"), "DecalBridge Off fails");
|
||||
Check(Has(r, Level.Warn, "DecalInGameImGui"), "DecalInGameImGui false warns");
|
||||
});
|
||||
|
||||
Scenario("live view disagrees with the predicted place", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.User64, VsFilters, new());
|
||||
h.Set(RegRoot.User64, VsFilters + "\\" + Guid, BridgeEntry());
|
||||
h.OwnView = null;
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.Blocking && Has(r, Level.Fail, "bridge NOT listed"), "disagreement fails");
|
||||
});
|
||||
|
||||
Scenario("launcher virtualized, client not: no live read-back", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Levels[AcClient] = "asInvoker";
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
h.OwnView = null;
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(!r.Blocking && Has(r, Level.Info, "Not read back live"), "skips the live read when views differ");
|
||||
});
|
||||
|
||||
Scenario("bridge DLL downloaded mark, .NET older than 4.8", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
h.Zoned.Add(BridgeDir + "\\" + DecalBridgeRegistration.AssemblyFile);
|
||||
h.OwnView = BridgeEntry();
|
||||
h.Set(RegRoot.Machine32, @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", new() { ["Release"] = 461814 });
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(Has(r, Level.Warn, "downloaded from the internet") && Has(r, Level.Warn, "4.8"), "both warn");
|
||||
Check(!r.Blocking, "warnings don't block");
|
||||
});
|
||||
|
||||
Scenario("Decal not installed", () =>
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Remove(RegRoot.Machine32, MachineDecalPath("Agent"));
|
||||
Result r = Run(h, BridgeDir, AcClient, null);
|
||||
Check(r.Blocking && !r.DecalInstalled && r.Lines.Count == 1, "stops at 'not installed'");
|
||||
});
|
||||
|
||||
Scenario("32-bit Windows paths", () =>
|
||||
{
|
||||
Check(VirtualStoreDecalPath(false, "NetworkFilters") == @"Software\Classes\VirtualStore\MACHINE\SOFTWARE\Decal\NetworkFilters", "no WOW6432Node in the copy's path");
|
||||
Check(Describe(false, RegRoot.Machine32, HkFilters) == @"HKLM\SOFTWARE\Decal\NetworkFilters", "no WOW6432Node in the HKLM description");
|
||||
});
|
||||
|
||||
Scenario("manifest level parsing", () =>
|
||||
{
|
||||
Check(RealDecalCheckHost.LevelIn("<requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"/>") == "asInvoker", "double quotes");
|
||||
Check(RealDecalCheckHost.LevelIn("<requestedExecutionLevel uiAccess='false' level='requireAdministrator' />") == "requireAdministrator", "single quotes, other order");
|
||||
Check(RealDecalCheckHost.LevelIn("<assembly><description>x</description></assembly>") == null, "no element");
|
||||
});
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(_failed == 0 ? $"PASS: {_checks} checks" : $"FAIL: {_failed} of {_checks} checks failed");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// ── machine ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static Dictionary<string, object> BridgeEntry() => new()
|
||||
{
|
||||
[""] = DecalBridgeRegistration.FilterName,
|
||||
["Enabled"] = 1,
|
||||
["Assembly"] = DecalBridgeRegistration.AssemblyFile,
|
||||
["Path"] = BridgeDir,
|
||||
["Object"] = DecalBridgeRegistration.FilterObject,
|
||||
["Surrogate"] = SurrogateClsid,
|
||||
};
|
||||
|
||||
private static Dictionary<string, object> ComEntry() => new()
|
||||
{
|
||||
[""] = "mscoree.dll",
|
||||
["Class"] = "Decal.Adapter.Surrogate",
|
||||
["Assembly"] = "Decal.Adapter, Version=2.9.8.3, Culture=neutral, PublicKeyToken=bd1c8ce002ce221e",
|
||||
["RuntimeVersion"] = "v4.0.30319",
|
||||
["CodeBase"] = @"file:///C:\Program Files (x86)\Decal 3.0\Decal.Adapter.dll",
|
||||
};
|
||||
|
||||
private static readonly (string Id, string Name)[] Stock =
|
||||
{
|
||||
("{53092D1B-F0B0-46FF-BF11-8F031EC9B137}", "World Object Filter"),
|
||||
("{34239EAD-6317-4c40-A405-193BA5232DD8}", "Echo Filter 2"),
|
||||
};
|
||||
|
||||
/// <summary>A healthy 64-bit machine with Decal 2.9.8.3, UAC on, a non-elevated launcher, nothing registered.</summary>
|
||||
private static FakeHost Baseline()
|
||||
{
|
||||
var h = new FakeHost();
|
||||
h.Set(RegRoot.Machine64, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", new() { ["EnableLUA"] = 1, ["EnableVirtualization"] = 1 });
|
||||
h.Set(RegRoot.Machine32, MachineDecalPath("Agent"), new() { ["AgentPath"] = Agent, ["PortalPath"] = @"C:\Turbine\Asheron's Call" });
|
||||
h.Set(RegRoot.Machine32, HkFilters, new());
|
||||
foreach (var f in Stock)
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + f.Id, new() { [""] = f.Name, ["Enabled"] = 1 });
|
||||
h.Set(RegRoot.Machine32, MachineDecalPath("Surrogates") + "\\" + SurrogateClsid, new() { [""] = "Decal.Adapter Surrogate", ["Enabled"] = 1 });
|
||||
h.Set(RegRoot.Machine32, @"SOFTWARE\Classes\CLSID\" + SurrogateClsid + @"\InprocServer32", ComEntry());
|
||||
h.Set(RegRoot.Machine32, @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", new() { ["Release"] = 533325 });
|
||||
h.Files[Agent + "Inject.dll"] = "";
|
||||
h.Files[Agent + "Decal.Adapter.dll"] = "";
|
||||
h.Files[@"C:\Program Files (x86)\Decal 3.0\Decal.Adapter.dll"] = "";
|
||||
h.Files[BridgeDir + "\\" + DecalBridgeRegistration.AssemblyFile] = "";
|
||||
h.Files[AcClient] = "";
|
||||
h.AssemblyVersions[Agent + "Decal.Adapter.dll"] = new Version(2, 9, 8, 3);
|
||||
h.ReferenceVersions[BridgeDir + "\\" + DecalBridgeRegistration.AssemblyFile] = new Version(2, 9, 8, 3);
|
||||
return h;
|
||||
}
|
||||
|
||||
/// <summary>The machine after the installer: HKLM entry, plus the per-user entry when a copy existed.</summary>
|
||||
private static FakeHost InstalledBoth(bool withCopy, bool elevated, bool uacOff)
|
||||
{
|
||||
FakeHost h = Baseline();
|
||||
h.Set(RegRoot.Machine32, HkFilters + "\\" + Guid, BridgeEntry());
|
||||
if (withCopy)
|
||||
{
|
||||
h.Set(RegRoot.User64, VsFilters, new());
|
||||
MirrorStock(h, RegRoot.User64, VsFilters);
|
||||
h.Set(RegRoot.User64, VsFilters + "\\" + Guid, BridgeEntry());
|
||||
}
|
||||
if (uacOff)
|
||||
h.Set(RegRoot.Machine64, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", new() { ["EnableLUA"] = 0, ["EnableVirtualization"] = 1 });
|
||||
h.LauncherElevated = elevated;
|
||||
h.LauncherVirtualized = !elevated && !uacOff;
|
||||
h.OwnView = BridgeEntry(); // both views list it
|
||||
return h;
|
||||
}
|
||||
|
||||
private static void MirrorStock(FakeHost h, RegRoot root, string path)
|
||||
{
|
||||
foreach (var f in Stock)
|
||||
h.Set(root, path + "\\" + f.Id, new() { [""] = f.Name, ["Enabled"] = 1 });
|
||||
}
|
||||
|
||||
// ── harness ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static bool Has(Result r, Level level, string text) =>
|
||||
r.Lines.Any(l => l.Level == level && l.Text.Contains(text, StringComparison.Ordinal));
|
||||
|
||||
private static void Scenario(string name, Action body)
|
||||
{
|
||||
Console.WriteLine($"-- {name}");
|
||||
try { body(); }
|
||||
catch (Exception ex) { _checks++; _failed++; Console.WriteLine($" FAIL threw {ex}"); }
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (!ok) _failed++;
|
||||
Console.WriteLine($" {(ok ? "ok " : "FAIL")} {what}");
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class FakeHost : IDecalCheckHost
|
||||
{
|
||||
private readonly Dictionary<(RegRoot, string), Dictionary<string, object>> _keys = new(new KeyComparer());
|
||||
public Dictionary<string, string> Files { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
public HashSet<string> Zoned { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
public Dictionary<string, string?> Levels { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
public Dictionary<string, Version> AssemblyVersions { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
public Dictionary<string, Version> ReferenceVersions { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
public Dictionary<string, object>? OwnView { get; set; }
|
||||
|
||||
public bool Is64BitOs { get; set; } = true;
|
||||
public bool LauncherElevated { get; set; }
|
||||
public bool LauncherVirtualized { get; set; } = true;
|
||||
|
||||
public void Set(RegRoot root, string path, Dictionary<string, object> values) => _keys[(root, path)] = values;
|
||||
public void Remove(RegRoot root, string path) => _keys.Remove((root, path));
|
||||
|
||||
public IRegKey? OpenReal(RegRoot root, string subKey)
|
||||
{
|
||||
bool exists = _keys.TryGetValue((root, subKey), out var values);
|
||||
var subs = _keys.Keys
|
||||
.Where(k => k.Item1 == root && k.Item2.StartsWith(subKey + "\\", StringComparison.OrdinalIgnoreCase))
|
||||
.Select(k => k.Item2.Substring(subKey.Length + 1).Split('\\')[0])
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
||||
if (!exists && subs.Count == 0) return null;
|
||||
return Snap(values, subs);
|
||||
}
|
||||
|
||||
public IRegKey? OpenOwnViewMachine32(string subKey) => OwnView == null ? null : Snap(OwnView, new List<string>());
|
||||
|
||||
private static RegSnapshot Snap(Dictionary<string, object>? values, List<string> subs)
|
||||
{
|
||||
var s = new RegSnapshot();
|
||||
if (values != null) foreach (var kv in values) s.Values[kv.Key] = kv.Value;
|
||||
s.SubKeys.AddRange(subs);
|
||||
return s;
|
||||
}
|
||||
|
||||
public bool FileExists(string path) => Files.ContainsKey(path);
|
||||
public bool HasZoneIdentifier(string path) => Zoned.Contains(path);
|
||||
public Version? AssemblyVersionOf(string path) => AssemblyVersions.TryGetValue(path, out var v) ? v : null;
|
||||
public Version? ReferenceVersionOf(string assemblyPath, string referenceName) =>
|
||||
referenceName == "Decal.Adapter" && ReferenceVersions.TryGetValue(assemblyPath, out var v) ? v : null;
|
||||
public string? ExecutionLevelOf(string exePath) => Levels.TryGetValue(exePath, out var l) ? l : null;
|
||||
public string? ReadTextFile(string path) => Files.TryGetValue(path, out var t) ? t : null;
|
||||
|
||||
private sealed class KeyComparer : IEqualityComparer<(RegRoot, string)>
|
||||
{
|
||||
public bool Equals((RegRoot, string) a, (RegRoot, string) b) => a.Item1 == b.Item1 && string.Equals(a.Item2, b.Item2, StringComparison.OrdinalIgnoreCase);
|
||||
public int GetHashCode((RegRoot, string) k) => HashCode.Combine(k.Item1, StringComparer.OrdinalIgnoreCase.GetHashCode(k.Item2));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the Decal bridge's shared-memory protocol (src\RynthCore.DecalBridge\
|
||||
BridgeProtocol.cs, compiled in - the same file the engine and the bridge link): both
|
||||
rings, wrap-around, full rings, the want mask, the version check and resync after a
|
||||
corrupt record. Two channels on a made-up pid play the bridge and the engine.
|
||||
Nothing native: no AC, no Decal. See docs\DECAL_BRIDGE_PLAN.md.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>DecalBridgeProtocolTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.DecalBridge\BridgeProtocol.cs" Link="Bridge\BridgeProtocol.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
272
tools/DecalBridgeProtocolTests/Program.cs
Normal file
272
tools/DecalBridgeProtocolTests/Program.cs
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
using RynthCore.DecalBridge;
|
||||
|
||||
namespace DecalBridgeProtocolTests;
|
||||
|
||||
/// <summary>
|
||||
/// The bridge (producer of events, consumer of commands) and the engine (the reverse) each
|
||||
/// open their own view of one mapping, as in a client; every record is checked on arrival.
|
||||
/// </summary>
|
||||
internal static unsafe class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
private static string _case = "";
|
||||
private static int _pid = 0x7F000000 + Environment.ProcessId % 0x10000; // not a real client's pid
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
Run("hello and the want mask", WantMask);
|
||||
Run("chat events in order", ChatInOrder);
|
||||
Run("event ring wrap-around", EventWrap);
|
||||
Run("event ring full, then recovers", EventFull);
|
||||
Run("command ring round trip + wrap", Commands);
|
||||
Run("oversized records are refused", Oversized);
|
||||
Run("another protocol version is not Valid", VersionMismatch);
|
||||
Run("corrupt record: reader resyncs at the writer", CorruptResync);
|
||||
Run("a second engine generation continues where the first stopped", GenerationHandOff);
|
||||
Run("v2 header fields (Decal device) fit and reach the engine", HeaderFields);
|
||||
Console.WriteLine(_failed == 0 ? $"PASS: {_checks} checks" : $"FAIL: {_failed} of {_checks} checks");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static void Run(string name, Action test)
|
||||
{
|
||||
_case = name;
|
||||
_pid++; // fresh mapping per case
|
||||
try { test(); }
|
||||
catch (Exception ex) { Check(false, $"threw {ex.GetType().Name}: {ex.Message}"); }
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine($" [{_case}] FAILED: {what}");
|
||||
}
|
||||
|
||||
private sealed record Rec(BridgeRecordKind Kind, uint A0, uint A1, byte[] Payload)
|
||||
{
|
||||
public string Text => System.Text.Encoding.Unicode.GetString(Payload);
|
||||
}
|
||||
|
||||
private static List<Rec> DrainAll(BridgeChannel ch, bool commands = false, int max = int.MaxValue)
|
||||
{
|
||||
var got = new List<Rec>();
|
||||
BridgeChannel.RecordHandler h = (k, a0, a1, p, n) =>
|
||||
{
|
||||
var b = new byte[n];
|
||||
for (int i = 0; i < n; i++) b[i] = p[i];
|
||||
got.Add(new Rec(k, a0, a1, b));
|
||||
};
|
||||
if (commands) ch.DrainCommands(h, max); else ch.Drain(h, max);
|
||||
return got;
|
||||
}
|
||||
|
||||
private static void Want(BridgeChannel engine, params BridgeRecordKind[] kinds)
|
||||
{
|
||||
uint m = 0;
|
||||
foreach (var k in kinds) m |= BridgeLayout.Bit(k);
|
||||
engine.WriteInt(BridgeLayout.OffWantMask, unchecked((int)m));
|
||||
}
|
||||
|
||||
private static void WantMask()
|
||||
{
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
using var engine = BridgeChannel.OpenOrCreate(_pid);
|
||||
Check(bridge.Valid && engine.Valid, "both views valid");
|
||||
Check(BridgeChannel.Exists(_pid), "Exists sees the mapping");
|
||||
Check(bridge.WriteString(BridgeRecordKind.Hello, BridgeLayout.Version, 0, "hi"), "hello always goes");
|
||||
Check(!bridge.WriteString(BridgeRecordKind.ChatText, 1, 0, "unwanted"), "chat refused with an empty mask");
|
||||
Check(!bridge.Write(BridgeRecordKind.ServerMessage, 0xF7B0, 0, null, 0), "server message refused with an empty mask");
|
||||
Want(engine, BridgeRecordKind.ChatText);
|
||||
Check(bridge.WriteString(BridgeRecordKind.ChatText, 1, 0, "wanted"), "chat accepted once wanted");
|
||||
Check(!bridge.Write(BridgeRecordKind.CreateObject, 5, 0, null, 0), "create still refused");
|
||||
var got = DrainAll(engine);
|
||||
Check(got.Count == 2 && got[0].Kind == BridgeRecordKind.Hello && got[1].Text == "wanted", $"drained hello + chat ({got.Count})");
|
||||
Check(engine.ReadLong(BridgeLayout.OffDropped) == 0, "refused-by-mask is not counted as dropped");
|
||||
}
|
||||
|
||||
private static void ChatInOrder()
|
||||
{
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
using var engine = BridgeChannel.OpenOrCreate(_pid);
|
||||
Want(engine, BridgeRecordKind.ChatText, BridgeRecordKind.ChatBarEnter);
|
||||
string[] lines = { "", "a", "ab", "abc", "Welcome to Asheron's Call\n", new string('x', 1000), "ünïcödé ✓" };
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
Check(bridge.WriteString(i % 2 == 0 ? BridgeRecordKind.ChatText : BridgeRecordKind.ChatBarEnter, (uint)i, 7, lines[i]), $"write {i}");
|
||||
var got = DrainAll(engine);
|
||||
Check(got.Count == lines.Length, $"count {got.Count}");
|
||||
for (int i = 0; i < Math.Min(got.Count, lines.Length); i++)
|
||||
Check(got[i].A0 == i && got[i].A1 == 7 && got[i].Text == lines[i], $"record {i} ('{got[i].Text}')");
|
||||
Check(DrainAll(engine).Count == 0, "nothing left");
|
||||
Check(bridge.ReadLong(BridgeLayout.OffRecords) == lines.Length, "records counter");
|
||||
}
|
||||
|
||||
private static void EventWrap()
|
||||
{
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
using var engine = BridgeChannel.OpenOrCreate(_pid);
|
||||
Want(engine, BridgeRecordKind.ServerMessage);
|
||||
var rnd = new Random(1234);
|
||||
uint next = 0, expect = 0;
|
||||
long total = 0;
|
||||
bool orderOk = true, contentOk = true;
|
||||
// ~3x the ring through it, drained in uneven bites so the writer wraps at odd offsets.
|
||||
while (total < 3L * BridgeLayout.EventRingSize)
|
||||
{
|
||||
int burst = rnd.Next(1, 60);
|
||||
for (int i = 0; i < burst; i++)
|
||||
{
|
||||
int len = rnd.Next(0, 9000);
|
||||
var data = new byte[len];
|
||||
for (int j = 0; j < len; j++) data[j] = (byte)(next + j);
|
||||
if (!bridge.WriteBytes(BridgeRecordKind.ServerMessage, next, (uint)len, data))
|
||||
break;
|
||||
next++;
|
||||
total += len + 16;
|
||||
}
|
||||
foreach (var r in DrainAll(engine, max: rnd.Next(1, 80)))
|
||||
{
|
||||
if (r.A0 != expect) orderOk = false;
|
||||
if (r.Payload.Length != r.A1) contentOk = false;
|
||||
for (int j = 0; j < r.Payload.Length && contentOk; j++)
|
||||
if (r.Payload[j] != (byte)(r.A0 + j)) contentOk = false;
|
||||
expect++;
|
||||
}
|
||||
}
|
||||
foreach (var r in DrainAll(engine)) { if (r.A0 != expect) orderOk = false; expect++; }
|
||||
Check(orderOk, "sequence in order across wraps");
|
||||
Check(contentOk, "payload bytes intact across wraps");
|
||||
Check(expect == next, $"every record arrived ({expect}/{next})");
|
||||
Check(bridge.ReadLong(BridgeLayout.OffDropped) == 0, "nothing dropped while drained");
|
||||
}
|
||||
|
||||
private static void EventFull()
|
||||
{
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
using var engine = BridgeChannel.OpenOrCreate(_pid);
|
||||
Want(engine, BridgeRecordKind.ServerMessage);
|
||||
var data = new byte[200 * 1024];
|
||||
int written = 0;
|
||||
while (bridge.WriteBytes(BridgeRecordKind.ServerMessage, (uint)written, 0, data)) written++;
|
||||
Check(written == BridgeLayout.EventRingSize / (data.Length + 16), $"filled with {written} records");
|
||||
Check(bridge.ReadLong(BridgeLayout.OffDropped) == 1, "one drop counted");
|
||||
var got = DrainAll(engine);
|
||||
Check(got.Count == written, $"all {written} drained ({got.Count})");
|
||||
Check(bridge.WriteBytes(BridgeRecordKind.ServerMessage, 999, 0, data), "writes again after the drain");
|
||||
got = DrainAll(engine);
|
||||
Check(got.Count == 1 && got[0].A0 == 999, "the new record arrives");
|
||||
}
|
||||
|
||||
private static void Commands()
|
||||
{
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
using var engine = BridgeChannel.OpenOrCreate(_pid);
|
||||
Check(!bridge.HasCommands, "empty at start");
|
||||
Check(engine.WriteCommand(BridgeRecordKind.CmdInvokeChatParser, 0, 0, "/loc"), "chat command");
|
||||
Check(engine.WriteCommand(BridgeRecordKind.CmdSalvagePanelAdd, 0x80000123, 0, null), "salvage add");
|
||||
Check(engine.WriteCommand(BridgeRecordKind.CmdSalvagePanelSalvage, 0, 0, null), "salvage go");
|
||||
Check(bridge.HasCommands, "bridge sees commands");
|
||||
var got = DrainAll(bridge, commands: true);
|
||||
Check(got.Count == 3 && got[0].Text == "/loc" && got[1].A0 == 0x80000123 && got[2].Kind == BridgeRecordKind.CmdSalvagePanelSalvage, "commands in order");
|
||||
Check(bridge.ReadLong(BridgeLayout.OffCmdDone) == 3, "done counter");
|
||||
Check(!bridge.HasCommands, "empty after drain");
|
||||
// The events ring is untouched by commands.
|
||||
Check(DrainAll(engine).Count == 0, "no command leaks into the event ring");
|
||||
// Wrap the 64 KB command ring many times.
|
||||
int sent = 0, seen = 0;
|
||||
bool ok = true;
|
||||
for (int round = 0; round < 400; round++)
|
||||
{
|
||||
for (int i = 0; i < 7; i++)
|
||||
if (engine.WriteCommand(BridgeRecordKind.CmdInvokeChatParser, (uint)sent, 0, "/tell Someone " + new string('z', (sent * 37) % 900))) sent++;
|
||||
foreach (var r in DrainAll(bridge, commands: true))
|
||||
{
|
||||
if (r.A0 != seen || !r.Text.StartsWith("/tell Someone ")) ok = false;
|
||||
seen++;
|
||||
}
|
||||
}
|
||||
Check(ok && seen == sent && sent == 2800, $"command wrap ({seen}/{sent})");
|
||||
// Full command ring: counted as dropped, never blocks.
|
||||
int n = 0;
|
||||
while (engine.WriteCommand(BridgeRecordKind.CmdInvokeChatParser, 0, 0, new string('q', 4000))) n++;
|
||||
Check(n > 0 && engine.ReadLong(BridgeLayout.OffCmdDropped) == 1, $"full command ring drops ({n} fit)");
|
||||
}
|
||||
|
||||
private static void Oversized()
|
||||
{
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
using var engine = BridgeChannel.OpenOrCreate(_pid);
|
||||
Want(engine, BridgeRecordKind.ServerMessage);
|
||||
Check(!bridge.WriteBytes(BridgeRecordKind.ServerMessage, 1, 0, new byte[BridgeLayout.MaxRecord + 1]), "event over MaxRecord refused");
|
||||
Check(!engine.WriteCommand(BridgeRecordKind.CmdInvokeChatParser, 0, 0, new string('x', BridgeLayout.CommandRingSize)), "command over a quarter of its ring refused");
|
||||
Check(bridge.WriteBytes(BridgeRecordKind.ServerMessage, 2, 0, new byte[10]), "a normal one still goes");
|
||||
var got = DrainAll(engine);
|
||||
Check(got.Count == 1 && got[0].A0 == 2, "only the normal one arrives");
|
||||
}
|
||||
|
||||
private static void VersionMismatch()
|
||||
{
|
||||
using var older = BridgeChannel.OpenOrCreate(_pid);
|
||||
older.WriteInt(BridgeLayout.OffVersion, 1); // a version-1 (spike) side created it
|
||||
using var newer = BridgeChannel.OpenOrCreate(_pid);
|
||||
Check(!newer.Valid, "version 1 mapping is not Valid for version 2");
|
||||
}
|
||||
|
||||
private static void CorruptResync()
|
||||
{
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
using var engine = BridgeChannel.OpenOrCreate(_pid);
|
||||
Want(engine, BridgeRecordKind.ChatText);
|
||||
bridge.WriteString(BridgeRecordKind.ChatText, 1, 0, "one");
|
||||
bridge.WriteString(BridgeRecordKind.ChatText, 2, 0, "two");
|
||||
// Stomp the second record's length field (header + command ring + first record of 24 bytes).
|
||||
byte* ring = engine.Header + BridgeLayout.HeaderSize + BridgeLayout.CommandRingSize;
|
||||
*(int*)(ring + 24) = 3;
|
||||
var got = DrainAll(engine);
|
||||
Check(got.Count == 1 && got[0].Text == "one", "first record read, corrupt one skipped");
|
||||
Check(engine.ReadLong(BridgeLayout.OffReadPos) == engine.ReadLong(BridgeLayout.OffWritePos), "reader at the writer");
|
||||
bridge.WriteString(BridgeRecordKind.ChatText, 3, 0, "three");
|
||||
got = DrainAll(engine);
|
||||
Check(got.Count == 1 && got[0].Text == "three", "later records flow again");
|
||||
}
|
||||
|
||||
private static void GenerationHandOff()
|
||||
{
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
var gen1 = BridgeChannel.OpenOrCreate(_pid);
|
||||
Want(gen1, BridgeRecordKind.ChatText);
|
||||
bridge.WriteString(BridgeRecordKind.ChatText, 1, 0, "before reload");
|
||||
Check(DrainAll(gen1).Count == 1, "gen 1 reads");
|
||||
bridge.WriteString(BridgeRecordKind.ChatText, 2, 0, "during reload");
|
||||
gen1.Dispose(); // generation unloads; the bridge keeps the mapping
|
||||
using var gen2 = BridgeChannel.OpenOrCreate(_pid);
|
||||
Check(gen2.Valid, "gen 2 attaches to the same mapping");
|
||||
var got = DrainAll(gen2);
|
||||
Check(got.Count == 1 && got[0].Text == "during reload", "gen 2 gets what arrived in between, nothing twice");
|
||||
}
|
||||
|
||||
// The header fields added to v2 (the device Decal renders with, for DecalInGameImGui):
|
||||
// inside the header, clear of every other field and of the prefix area, and a value the
|
||||
// bridge writes is what the engine reads.
|
||||
private static void HeaderFields()
|
||||
{
|
||||
int[] ints = { BridgeLayout.OffMagic, BridgeLayout.OffVersion, BridgeLayout.OffBridgeState, BridgeLayout.OffBridgeBeats,
|
||||
BridgeLayout.OffEngineAttached, BridgeLayout.OffEngineGeneration, BridgeLayout.OffBridgePid, BridgeLayout.OffReplayRequest,
|
||||
BridgeLayout.OffReplayDone, BridgeLayout.OffWantMask, BridgeLayout.OffD3DDevice, BridgeLayout.OffDecalHwnd };
|
||||
int[] longs = { BridgeLayout.OffWritePos, BridgeLayout.OffReadPos, BridgeLayout.OffDropped, BridgeLayout.OffRecords,
|
||||
BridgeLayout.OffCmdWritePos, BridgeLayout.OffCmdReadPos, BridgeLayout.OffCmdDropped, BridgeLayout.OffCmdDone };
|
||||
var used = new System.Collections.Generic.HashSet<int>();
|
||||
bool overlap = false;
|
||||
foreach (int o in ints) for (int b = 0; b < 4; b++) overlap |= !used.Add(o + b);
|
||||
foreach (int o in longs) for (int b = 0; b < 8; b++) overlap |= !used.Add(o + b);
|
||||
Check(!overlap, "header fields don't overlap");
|
||||
int max = 0;
|
||||
foreach (int b in used) max = Math.Max(max, b);
|
||||
Check(max < BridgeLayout.OffPrefixes, "header fields end before the prefix area");
|
||||
using var bridge = BridgeChannel.OpenOrCreate(_pid);
|
||||
bridge.WriteInt(BridgeLayout.OffD3DDevice, 0x12C1B300);
|
||||
using var engine = BridgeChannel.OpenOrCreate(_pid);
|
||||
Check(engine.ReadInt(BridgeLayout.OffD3DDevice) == 0x12C1B300, "device field reaches the engine");
|
||||
}
|
||||
}
|
||||
BIN
tools/DecalBridgeRepair/Add-RynthCoreDecalBridge-AllUsers.reg
Normal file
BIN
tools/DecalBridgeRepair/Add-RynthCoreDecalBridge-AllUsers.reg
Normal file
Binary file not shown.
BIN
tools/DecalBridgeRepair/Remove-RynthCoreDecalBridge-AllUsers.reg
Normal file
BIN
tools/DecalBridgeRepair/Remove-RynthCoreDecalBridge-AllUsers.reg
Normal file
Binary file not shown.
33
tools/FloodProbeBench/FloodProbeBench.csproj
Normal file
33
tools/FloodProbeBench/FloodProbeBench.csproj
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
The engine's memory probe (src\RynthCore.Engine\Compatibility\MemoryProbe.cs, compiled in)
|
||||
without AC: (1) it must answer exactly like the old VirtualQuery checks for committed,
|
||||
untouched, reserved, freed, guard, no-access, read-only and cross-page memory; (2) a
|
||||
benchmark of the main-thread snapshot walk's probes (CObjectMaint bucket walk + the
|
||||
per-object position/PWD probes) against a large committed heap like AC's in a crowded
|
||||
dungeon, old VirtualQuery probes vs MemoryProbe.
|
||||
|
||||
x86 on purpose: the cost that broke the client is VirtualQuery under WOW64 (a 32-bit
|
||||
process on 64-bit Windows). Needs the x86 .NET runtime (C:\Program Files (x86)\dotnet).
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
dotnet run -c Release, then heap sizes in MB after the usual separator (default 4 16 64)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>FloodProbeBench</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\MemoryProbe.cs" Link="Engine\MemoryProbe.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
343
tools/FloodProbeBench/Program.cs
Normal file
343
tools/FloodProbeBench/Program.cs
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using RynthCore.Engine.Compatibility;
|
||||
|
||||
namespace FloodProbeBench;
|
||||
|
||||
/// <summary>
|
||||
/// MemoryProbe (the engine's AV-safe memory check) without AC.
|
||||
///
|
||||
/// Part 1 checks it answers like the old VirtualQuery helpers on every kind of page.
|
||||
/// Part 2 times the probes of the engine's main-thread snapshot walks against a big committed
|
||||
/// heap, like AC's in a crowded dungeon (working set 1.0-1.4 GB on 2026-10-02):
|
||||
/// * the CObjectMaint weenie-table walk (EnumerateLiveWeenieObjectIds): old = one probe per
|
||||
/// hash bucket plus two per chain node; new = one probe over the bucket array plus one per
|
||||
/// node (id and next are adjacent);
|
||||
/// * PrefetchPositions' per-object probes (the PublicWeenieDesc copy and the CPhysicsObj
|
||||
/// head), 10 walks a second;
|
||||
/// * PrefetchObjectIdentity's per-object probes (qualities pointer, name string, two PWD
|
||||
/// ints: about 10), and PrefetchAttackable's walk, 2 walks a second each.
|
||||
/// The AC calls the walks also make (GetWeenieObject, GetObjectName, ObjectIsAttackable) are
|
||||
/// not modelled - they did not change. Objects are spread over the heap and the bucket array
|
||||
/// sits in the middle, so the committed run after a probed address averages half the heap.
|
||||
/// VirtualQuery's cost grows with that run (WOW64), MemoryProbe's does not.
|
||||
/// </summary>
|
||||
internal static unsafe class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
int[] heapSizesMb = args.Length > 0 ? args.Select(int.Parse).ToArray() : new[] { 4, 16, 64 };
|
||||
Console.WriteLine($"MemoryProbe: QueryWorkingSetEx fast path {(MemoryProbe.FastPathActive ? "available" : "MISSING")}, IntPtr.Size={IntPtr.Size}");
|
||||
|
||||
Correctness();
|
||||
Benchmark(heapSizesMb);
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(_failed == 0 ? $"PASS ({_checks} checks)" : $"FAIL ({_failed} of {_checks} checks)");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// ── Part 1: same answers as the old helpers ───────────────────────────────
|
||||
|
||||
private static void Correctness()
|
||||
{
|
||||
Console.WriteLine("\n=== Correctness: MemoryProbe vs the old VirtualQuery rule ===");
|
||||
const int Page = 4096;
|
||||
|
||||
IntPtr touched = Alloc(4 * Page, MemCommit | MemReserve, PageReadWrite);
|
||||
for (int i = 0; i < 4 * Page; i += Page) *((byte*)touched + i) = 1;
|
||||
Same("committed, touched (resident)", touched + 16, 1);
|
||||
Same("committed, touched, span over 3 pages", touched + 100, 3 * Page - 200);
|
||||
Expect("committed, touched: readable", MemoryProbe.IsReadable(touched, 64), true);
|
||||
Expect("committed, touched: writable", MemoryProbe.IsWritable(touched, 64), true);
|
||||
|
||||
IntPtr untouched = Alloc(2 * Page, MemCommit | MemReserve, PageReadWrite);
|
||||
Same("committed, never touched (not resident)", untouched + 8, 1);
|
||||
Same("committed, never touched, span", untouched, 2 * Page);
|
||||
|
||||
IntPtr reserved = Alloc(4 * Page, MemReserve, PageReadWrite);
|
||||
Same("reserved only", reserved, 1);
|
||||
Expect("reserved only: refused", MemoryProbe.IsAccessible(reserved), false);
|
||||
|
||||
IntPtr mixed = Alloc(4 * Page, MemReserve, PageReadWrite);
|
||||
Alloc(Page, MemCommit, PageReadWrite, mixed);
|
||||
*(byte*)mixed = 1;
|
||||
Expect("span from a committed page into a reserved one: refused",
|
||||
MemoryProbe.IsAccessible(mixed + Page - 8, 16), false);
|
||||
Same("span from a committed page into a reserved one", mixed + Page - 8, 16);
|
||||
|
||||
IntPtr freed = Alloc(Page, MemCommit | MemReserve, PageReadWrite);
|
||||
*(byte*)freed = 1;
|
||||
VirtualFree(freed, UIntPtr.Zero, MemRelease);
|
||||
Same("freed", freed, 1);
|
||||
Expect("freed: refused", MemoryProbe.IsAccessible(freed), false);
|
||||
|
||||
IntPtr guard = Alloc(Page, MemCommit | MemReserve, PageReadWrite | PageGuard);
|
||||
Same("guard page", guard, 1);
|
||||
Expect("guard page: refused", MemoryProbe.IsAccessible(guard), false);
|
||||
|
||||
IntPtr noAccess = Alloc(Page, MemCommit | MemReserve, PageReadWrite);
|
||||
*(byte*)noAccess = 1;
|
||||
VirtualProtect(noAccess, (UIntPtr)Page, PageNoAccess, out _);
|
||||
Same("no-access page (was resident)", noAccess, 1);
|
||||
Expect("no-access page: refused", MemoryProbe.IsAccessible(noAccess), false);
|
||||
|
||||
IntPtr readOnly = Alloc(Page, MemCommit | MemReserve, PageReadWrite);
|
||||
*(byte*)readOnly = 1;
|
||||
VirtualProtect(readOnly, (UIntPtr)Page, PageReadOnly, out _);
|
||||
Expect("read-only page: readable", MemoryProbe.IsReadable(readOnly, 32), true);
|
||||
Expect("read-only page: not writable", MemoryProbe.IsWritable(readOnly, 32), false);
|
||||
Expect("read-only page: same as old writable rule", MemoryProbe.IsWritable(readOnly), LegacyWritable(readOnly));
|
||||
|
||||
IntPtr code = NativeLibrary.GetExport(NativeLibrary.Load("kernel32.dll"), "VirtualQuery");
|
||||
Same("code page (kernel32!VirtualQuery)", code, 16);
|
||||
|
||||
Expect("null pointer refused", MemoryProbe.IsAccessible(IntPtr.Zero), false);
|
||||
Expect("zero length refused", MemoryProbe.IsAccessible(touched, 0), false);
|
||||
Expect("top of the address space refused", MemoryProbe.IsAccessible(new IntPtr(-16), 64), false);
|
||||
}
|
||||
|
||||
private static void Same(string what, IntPtr p, int len)
|
||||
{
|
||||
bool legacy = LegacyAccessible(p, len);
|
||||
bool probe = MemoryProbe.IsAccessible(p, len);
|
||||
bool legacyR = LegacyReadable(p, len);
|
||||
bool probeR = MemoryProbe.IsReadable(p, len);
|
||||
Expect($"{what}: accessible {probe} (old {legacy})", probe, legacy);
|
||||
Expect($"{what}: readable {probeR} (old {legacyR})", probeR, legacyR);
|
||||
}
|
||||
|
||||
private static void Expect(string what, bool got, bool want)
|
||||
{
|
||||
_checks++;
|
||||
if (got == want) Console.WriteLine($" [ok] {what}");
|
||||
else { _failed++; Console.WriteLine($" [FAIL] {what}: got {got}, want {want}"); }
|
||||
}
|
||||
|
||||
// ── Part 2: the snapshot walks ────────────────────────────────────────────
|
||||
|
||||
private const int TableSize = 4096; // weenie_object_table buckets (AC: 1k-8k)
|
||||
private const int ObjectSize = 0x400; // an ACCWeenieObject-sized block
|
||||
private const int PhysOffset = 0x80; // weenie -> CPhysicsObj* (the probed _phys_obj offset)
|
||||
private const int PwdSize = 0x120; // PwdLayout.Size-like copy
|
||||
private const int PhysSize = 0x200;
|
||||
private const int PhysProbe = 0xAC; // CPhysicsObj head through m_state
|
||||
|
||||
private static void Benchmark(int[] heapSizesMb)
|
||||
{
|
||||
foreach (int heapMb in heapSizesMb)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"=== Benchmark: snapshot-walk probes, {heapMb} MB committed heap, {TableSize} buckets ===");
|
||||
long size = (long)heapMb << 20;
|
||||
IntPtr heap = Alloc((int)size, MemCommit | MemReserve, PageReadWrite);
|
||||
if (heap == IntPtr.Zero) { Console.WriteLine(" could not reserve the heap - pass smaller sizes"); _failed++; continue; }
|
||||
for (long off = 0; off < size; off += 4096) *((byte*)heap + off) = 1;
|
||||
|
||||
foreach (int objects in new[] { 150, 750 })
|
||||
{
|
||||
var table = BuildTable(heap, size, objects, seed: objects);
|
||||
MemoryProbe.TakeStats();
|
||||
double oldPos = Time(() => WalkOld(table, identity: false), 1);
|
||||
double newPos = Time(() => WalkNew(table, identity: false), 20);
|
||||
double oldId = Time(() => WalkOld(table, identity: true), 1);
|
||||
double newId = Time(() => WalkNew(table, identity: true), 20);
|
||||
double oldAtk = Time(() => EnumerateOld(table, null), 1);
|
||||
double newAtk = Time(() => { using var scope = MemoryProbe.BeginWalk(); EnumerateNew(table, null); }, 20);
|
||||
|
||||
// Per second on AC's main thread: positions 10x, identity 2x, attackable 2x.
|
||||
double oldPerSec = oldPos * 10 + oldId * 2 + oldAtk * 2;
|
||||
double newPerSec = newPos * 10 + newId * 2 + newAtk * 2;
|
||||
Console.WriteLine($" {objects,4} objects:");
|
||||
Console.WriteLine($" position walk old {oldPos,10:0.00} ms new {newPos,7:0.000} ms");
|
||||
Console.WriteLine($" identity walk old {oldId,10:0.00} ms new {newId,7:0.000} ms");
|
||||
Console.WriteLine($" attackable walk old {oldAtk,10:0.00} ms new {newAtk,7:0.000} ms");
|
||||
Console.WriteLine($" AC main thread per second: old {oldPerSec,8:0} ms new {newPerSec,6:0.0} ms");
|
||||
var (fast, slow, slowMs) = MemoryProbe.TakeStats();
|
||||
Console.WriteLine($" MemoryProbe: {fast} pages answered by QueryWorkingSetEx, {slow} VirtualQuery fallbacks ({slowMs:0.0} ms)");
|
||||
_checks++;
|
||||
if (oldPerSec > 50 && newPerSec * 10 > oldPerSec) { _failed++; Console.WriteLine(" [FAIL] the new walk is not at least 10x cheaper"); }
|
||||
if (slow > 0) { _failed++; Console.WriteLine(" [FAIL] resident heap pages fell back to VirtualQuery"); }
|
||||
}
|
||||
VirtualFree(heap, UIntPtr.Zero, MemRelease);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class Table
|
||||
{
|
||||
public IntPtr Header; // HashBase: +12 buckets, +16 table_size
|
||||
public readonly Dictionary<uint, IntPtr> ById = new();
|
||||
}
|
||||
|
||||
private static Table BuildTable(IntPtr heap, long heapSize, int objects, int seed)
|
||||
{
|
||||
var rng = new Random(seed);
|
||||
var t = new Table { Header = heap + 0x1000 };
|
||||
IntPtr buckets = heap + (int)(heapSize / 2);
|
||||
new Span<byte>((void*)buckets, TableSize * 4).Clear();
|
||||
*(IntPtr*)(t.Header + 12) = buckets;
|
||||
*(int*)(t.Header + 16) = TableSize;
|
||||
for (int i = 0; i < objects; i++)
|
||||
{
|
||||
uint id = 0x80000000u + (uint)(0x2000 + i * 7);
|
||||
IntPtr obj = heap + (int)(0x10000 + (rng.NextInt64(heapSize / 2 - 0x20000) & ~0xFL));
|
||||
IntPtr phys = heap + (int)(heapSize / 2 + 0x10000 + (rng.NextInt64(heapSize / 2 - 0x20000) & ~0xFL));
|
||||
*(uint*)(obj + 8) = id;
|
||||
*(IntPtr*)(obj + PhysOffset) = phys;
|
||||
IntPtr slot = buckets + (int)((id & (TableSize - 1)) * 4);
|
||||
*(IntPtr*)(obj + 4) = *(IntPtr*)slot; // hash_next
|
||||
*(IntPtr*)slot = obj;
|
||||
t.ById[id] = obj;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
private static int _sink;
|
||||
|
||||
// The pre-2026-10-02 walk: SmartBoxLocator.IsMemoryReadable (VirtualQuery) per bucket and
|
||||
// twice per node, then CapturePositionForId's two IsReadableSpan probes per object; the
|
||||
// identity walk's ~10 probes per object.
|
||||
private static int EnumerateOld(Table t, Action<uint>? visit)
|
||||
{
|
||||
if (!LegacyReadable(t.Header + 12, 4)) return -1;
|
||||
IntPtr buckets = *(IntPtr*)(t.Header + 12);
|
||||
if (!LegacyReadable(t.Header + 16, 4)) return -1;
|
||||
int size = *(int*)(t.Header + 16);
|
||||
int count = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
IntPtr slot = buckets + i * 4;
|
||||
if (!LegacyReadable(slot, 4)) break;
|
||||
IntPtr node = *(IntPtr*)slot;
|
||||
while (node != IntPtr.Zero)
|
||||
{
|
||||
if (!LegacyReadable(node + 8, 4)) break;
|
||||
uint id = *(uint*)(node + 8);
|
||||
visit?.Invoke(id);
|
||||
count++;
|
||||
if (!LegacyReadable(node + 4, 4)) break;
|
||||
node = *(IntPtr*)(node + 4);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private static void WalkOld(Table t, bool identity)
|
||||
{
|
||||
EnumerateOld(t, id =>
|
||||
{
|
||||
IntPtr w = t.ById[id];
|
||||
if (identity)
|
||||
{
|
||||
for (int k = 0; k < 10; k++)
|
||||
if (LegacyAccessible(w + 0x10 + k * 0x20, 4)) _sink++;
|
||||
return;
|
||||
}
|
||||
if (LegacyAccessible(w + PhysOffset + 4, PwdSize)) _sink++;
|
||||
IntPtr phys = *(IntPtr*)(w + PhysOffset);
|
||||
if (LegacyAccessible(phys, PhysProbe + 4)) _sink += *(byte*)phys;
|
||||
});
|
||||
}
|
||||
|
||||
// The new walk: one probe over the bucket array, one per node, MemoryProbe everywhere, inside
|
||||
// a walk scope (each page queried once per walk), as the engine's PrefetchPositions /
|
||||
// PrefetchObjectIdentity / PrefetchAttackable.
|
||||
private static int EnumerateNew(Table t, Action<uint>? visit)
|
||||
{
|
||||
if (!MemoryProbe.IsReadable(t.Header + 12, 8)) return -1;
|
||||
IntPtr buckets = *(IntPtr*)(t.Header + 12);
|
||||
int size = *(int*)(t.Header + 16);
|
||||
if (!MemoryProbe.IsReadable(buckets, size * 4)) return -1;
|
||||
int count = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
IntPtr node = *(IntPtr*)(buckets + i * 4);
|
||||
while (node != IntPtr.Zero)
|
||||
{
|
||||
if (!MemoryProbe.IsReadable(node + 4, 8)) break;
|
||||
uint id = *(uint*)(node + 8);
|
||||
visit?.Invoke(id);
|
||||
count++;
|
||||
node = *(IntPtr*)(node + 4);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private static void WalkNew(Table t, bool identity)
|
||||
{
|
||||
using var scope = MemoryProbe.BeginWalk(); // as the engine's walks
|
||||
EnumerateNew(t, id =>
|
||||
{
|
||||
IntPtr w = t.ById[id];
|
||||
if (identity)
|
||||
{
|
||||
for (int k = 0; k < 10; k++)
|
||||
if (MemoryProbe.IsAccessible(w + 0x10 + k * 0x20, 4)) _sink++;
|
||||
return;
|
||||
}
|
||||
if (MemoryProbe.IsAccessible(w + PhysOffset + 4, PwdSize)) _sink++;
|
||||
IntPtr phys = *(IntPtr*)(w + PhysOffset);
|
||||
if (MemoryProbe.IsAccessible(phys, PhysProbe + 4)) _sink += *(byte*)phys;
|
||||
});
|
||||
}
|
||||
|
||||
private static double Time(Action a, int reps)
|
||||
{
|
||||
var sw = Stopwatch.StartNew();
|
||||
for (int i = 0; i < reps; i++) a();
|
||||
return sw.Elapsed.TotalMilliseconds / reps;
|
||||
}
|
||||
|
||||
// ── The old helpers, verbatim in behaviour ────────────────────────────────
|
||||
|
||||
// ClientObjectHooks.IsReadablePointer / IsReadableSpan before 2026-10-02.
|
||||
private static bool LegacyAccessible(IntPtr ptr, int length)
|
||||
{
|
||||
if (ptr == IntPtr.Zero || length <= 0) return false;
|
||||
if (VirtualQuery(ptr, out var mbi, Marshal.SizeOf<Mbi>()) == 0) return false;
|
||||
if (mbi.State != MemCommit) return false;
|
||||
if ((mbi.Protect & (PageNoAccess | PageGuard)) != 0) return false;
|
||||
if (length <= 1) return true;
|
||||
ulong regionEnd = (ulong)(nuint)mbi.BaseAddress + (ulong)(nuint)mbi.RegionSize;
|
||||
return (ulong)(nuint)ptr + (ulong)length <= regionEnd;
|
||||
}
|
||||
|
||||
// SmartBoxLocator.IsMemoryReadable before 2026-10-02.
|
||||
private static bool LegacyReadable(IntPtr ptr, int length)
|
||||
{
|
||||
if (ptr == IntPtr.Zero || length <= 0) return false;
|
||||
if (VirtualQuery(ptr, out var mbi, Marshal.SizeOf<Mbi>()) == 0) return false;
|
||||
if (mbi.State != MemCommit) return false;
|
||||
if ((mbi.Protect & PageNoAccess) != 0 || (mbi.Protect & PageGuard) != 0) return false;
|
||||
if ((mbi.Protect & MemoryProbe.ReadableMask) == 0) return false;
|
||||
long regionEnd = mbi.BaseAddress.ToInt64() + mbi.RegionSize.ToInt64();
|
||||
return ptr.ToInt64() + length <= regionEnd;
|
||||
}
|
||||
|
||||
// ClientObjectHooks.IsWritablePointer before 2026-10-02.
|
||||
private static bool LegacyWritable(IntPtr ptr)
|
||||
{
|
||||
if (ptr == IntPtr.Zero) return false;
|
||||
if (VirtualQuery(ptr, out var mbi, Marshal.SizeOf<Mbi>()) == 0) return false;
|
||||
if (mbi.State != MemCommit) return false;
|
||||
if ((mbi.Protect & (PageNoAccess | PageGuard)) != 0) return false;
|
||||
return (mbi.Protect & MemoryProbe.WritableMask) != 0;
|
||||
}
|
||||
|
||||
private const uint MemCommit = 0x1000, MemReserve = 0x2000, MemRelease = 0x8000;
|
||||
private const uint PageNoAccess = 0x01, PageReadOnly = 0x02, PageReadWrite = 0x04, PageGuard = 0x100;
|
||||
|
||||
private static IntPtr Alloc(int size, uint type, uint protect, IntPtr at = default)
|
||||
=> VirtualAlloc(at, (UIntPtr)(uint)size, type, protect);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct Mbi { public IntPtr BaseAddress, AllocationBase; public uint AllocationProtect; public IntPtr RegionSize; public uint State, Protect, Type; }
|
||||
|
||||
[DllImport("kernel32.dll")] private static extern int VirtualQuery(IntPtr a, out Mbi m, int len);
|
||||
[DllImport("kernel32.dll")] private static extern IntPtr VirtualAlloc(IntPtr a, UIntPtr size, uint type, uint protect);
|
||||
[DllImport("kernel32.dll")] private static extern bool VirtualFree(IntPtr a, UIntPtr size, uint type);
|
||||
[DllImport("kernel32.dll")] private static extern bool VirtualProtect(IntPtr a, UIntPtr size, uint protect, out uint old);
|
||||
}
|
||||
29
tools/LauncherSettingsTests/LauncherSettingsTests.csproj
Normal file
29
tools/LauncherSettingsTests/LauncherSettingsTests.csproj
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the launcher's shared settings with "Decal + RynthCore" accounts
|
||||
(src\RynthCore.App\AppSettingsStore.cs and DecalAccountModes.cs, compiled in): the choice
|
||||
lives in decal-accounts.json, appsettings.json never holds a value an older launcher can't
|
||||
read, migration of a file that does, and what happens when an older launcher edits the
|
||||
accounts. Works in a temp folder, never in %APPDATA%\RynthCore.
|
||||
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>LauncherSettingsTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.App\AppSettings.cs" Link="App\AppSettings.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App\AppSettingsStore.cs" Link="App\AppSettingsStore.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App\DecalAccountModes.cs" Link="App\DecalAccountModes.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App\InjectionMode.cs" Link="App\InjectionMode.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App\LaunchAccountProfile.cs" Link="App\LaunchAccountProfile.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App\LaunchServerProfile.cs" Link="App\LaunchServerProfile.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
257
tools/LauncherSettingsTests/Program.cs
Normal file
257
tools/LauncherSettingsTests/Program.cs
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
using RynthCore.App;
|
||||
|
||||
namespace LauncherSettingsTests;
|
||||
|
||||
/// <summary>
|
||||
/// The launcher's shared settings with "Decal + RynthCore" accounts, in a temp folder.
|
||||
/// "Old launcher" = a launcher released before the Decal bridge: its InjectionMode has only
|
||||
/// RynthCore and Decal, read with JsonStringEnumConverter, so "DecalBridge" makes the whole
|
||||
/// appsettings.json unreadable for it.
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
private static string _dir = "";
|
||||
|
||||
private static string Main_ => Path.Combine(_dir, "appsettings.json");
|
||||
private static string Bak => Main_ + ".bak";
|
||||
private static string Sidecar => Path.Combine(_dir, DecalAccountModes.FileName);
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
string root = Path.Combine(Path.GetTempPath(), "rc-launcher-settings-tests-" + Guid.NewGuid().ToString("N"));
|
||||
try
|
||||
{
|
||||
Scenario("negative control: the old launcher can't read DecalBridge", root, () =>
|
||||
{
|
||||
File.WriteAllText(Main_, """{ "AccountProfiles": [ { "Id": "b", "InjectionMode": "DecalBridge" } ] }""");
|
||||
Check(!OldLauncherCanRead(Main_), "old reader rejects \"DecalBridge\" (so the checks below mean something)");
|
||||
});
|
||||
|
||||
Scenario("save and load", root, () =>
|
||||
{
|
||||
AppSettings s = Sample();
|
||||
AppSettingsStore.Save(s);
|
||||
AppSettingsStore.Save(s); // second save: a .bak exists too
|
||||
CheckSharedFilesSafe();
|
||||
Check(SharedMode("a") == "RynthCore", "a is RynthCore in appsettings.json");
|
||||
Check(SharedMode("b") == "RynthCore", "b (Decal + RynthCore) is written as RynthCore");
|
||||
Check(SharedMode("c") == "Decal", "c is Decal in appsettings.json");
|
||||
Check(SidecarIds().SequenceEqual(new[] { "b" }), "decal-accounts.json lists only b");
|
||||
Check(s.AccountProfiles[1].InjectionMode == InjectionMode.DecalBridge, "save leaves the in-memory mode alone");
|
||||
|
||||
AppSettings loaded = AppSettingsStore.Load();
|
||||
Check(Mode(loaded, "a") == InjectionMode.RynthCore, "load: a RynthCore");
|
||||
Check(Mode(loaded, "b") == InjectionMode.DecalBridge, "load: b Decal + RynthCore");
|
||||
Check(Mode(loaded, "c") == InjectionMode.Decal, "load: c Decal");
|
||||
Check(AppSettingsStore.LastLoadDiagnostic == null && AppSettingsStore.LastMigrationNote == null, "load: no diagnostics");
|
||||
});
|
||||
|
||||
Scenario("switch back to RynthCore", root, () =>
|
||||
{
|
||||
AppSettings s = Sample();
|
||||
AppSettingsStore.Save(s);
|
||||
s.AccountProfiles[1].InjectionMode = InjectionMode.RynthCore;
|
||||
AppSettingsStore.Save(s);
|
||||
Check(!File.Exists(Sidecar), "decal-accounts.json removed when no account uses the mode");
|
||||
Check(Mode(AppSettingsStore.Load(), "b") == InjectionMode.RynthCore, "load: b RynthCore");
|
||||
});
|
||||
|
||||
Scenario("migrate a file written by a pre-release bridge build", root, () =>
|
||||
{
|
||||
string legacy = """
|
||||
{ "EnginePath": "X", "AccountProfiles": [
|
||||
{ "Id": "a", "AccountName": "A", "InjectionMode": "RynthCore" },
|
||||
{ "Id": "b", "AccountName": "B", "InjectionMode": "DecalBridge" },
|
||||
{ "Id": "d", "AccountName": "D", "InjectionMode": 2 } ] }
|
||||
""";
|
||||
File.WriteAllText(Main_, legacy);
|
||||
File.WriteAllText(Bak, legacy);
|
||||
AppSettings loaded = AppSettingsStore.Load();
|
||||
Check(Mode(loaded, "b") == InjectionMode.DecalBridge, "b kept as Decal + RynthCore");
|
||||
Check(Mode(loaded, "d") == InjectionMode.DecalBridge, "d (numeric 2) kept as Decal + RynthCore");
|
||||
Check(loaded.EnginePath == "X", "other settings kept");
|
||||
Check(AppSettingsStore.LastMigrationNote?.Contains("Moved 2") == true, "migration note: " + AppSettingsStore.LastMigrationNote);
|
||||
CheckSharedFilesSafe();
|
||||
Check(SidecarIds().SequenceEqual(new[] { "b", "d" }), "decal-accounts.json lists b and d");
|
||||
|
||||
AppSettingsStore.Load();
|
||||
Check(AppSettingsStore.LastMigrationNote == null, "second load: nothing left to migrate");
|
||||
});
|
||||
|
||||
Scenario("an old launcher switches the account to Decal", root, () =>
|
||||
{
|
||||
AppSettingsStore.Save(Sample());
|
||||
OldLauncherEdit(accounts => SetMode(accounts, "b", "Decal"));
|
||||
AppSettings loaded = AppSettingsStore.Load();
|
||||
Check(Mode(loaded, "b") == InjectionMode.Decal, "the old launcher's choice wins");
|
||||
AppSettingsStore.Save(loaded);
|
||||
Check(!File.Exists(Sidecar), "the stale entry is dropped at the next save");
|
||||
});
|
||||
|
||||
Scenario("an old launcher deletes the account", root, () =>
|
||||
{
|
||||
AppSettingsStore.Save(Sample());
|
||||
OldLauncherEdit(accounts =>
|
||||
{
|
||||
for (int i = accounts.Count - 1; i >= 0; i--)
|
||||
if ((string?)accounts[i]!["Id"] == "b") accounts.RemoveAt(i);
|
||||
});
|
||||
AppSettings loaded = AppSettingsStore.Load();
|
||||
Check(loaded.AccountProfiles.All(a => a.Id != "b"), "b is gone");
|
||||
AppSettingsStore.Save(loaded);
|
||||
Check(!File.Exists(Sidecar), "its entry is dropped at the next save");
|
||||
});
|
||||
|
||||
Scenario("an old launcher saves without changes", root, () =>
|
||||
{
|
||||
AppSettingsStore.Save(Sample());
|
||||
OldLauncherEdit(_ => { });
|
||||
Check(Mode(AppSettingsStore.Load(), "b") == InjectionMode.DecalBridge, "b is still Decal + RynthCore");
|
||||
});
|
||||
|
||||
Scenario("unreadable decal-accounts.json", root, () =>
|
||||
{
|
||||
AppSettingsStore.Save(Sample());
|
||||
File.WriteAllText(Sidecar, "{ not json");
|
||||
AppSettings loaded = AppSettingsStore.Load();
|
||||
Check(Mode(loaded, "b") == InjectionMode.RynthCore, "b runs as RynthCore");
|
||||
Check(Mode(loaded, "c") == InjectionMode.Decal, "other accounts unchanged");
|
||||
Check(AppSettingsStore.LastLoadDiagnostic == null, "appsettings.json not taken for corrupt");
|
||||
Check(AppSettingsStore.LastMigrationNote?.Contains("could not be read") == true, "note: " + AppSettingsStore.LastMigrationNote);
|
||||
loaded.AccountProfiles.First(a => a.Id == "b").InjectionMode = InjectionMode.DecalBridge;
|
||||
AppSettingsStore.Save(loaded);
|
||||
Check(SidecarIds().SequenceEqual(new[] { "b" }), "picking the mode again rewrites the file");
|
||||
});
|
||||
|
||||
Scenario("a mode name this build doesn't know", root, () =>
|
||||
{
|
||||
File.WriteAllText(Main_, """{ "EnginePath": "Y", "AccountProfiles": [ { "Id": "z", "InjectionMode": "SomethingNew" }, { "Id": "y", "InjectionMode": 9 } ] }""");
|
||||
AppSettings loaded = AppSettingsStore.Load();
|
||||
Check(AppSettingsStore.LastLoadDiagnostic == null && loaded.EnginePath == "Y", "file still loads (not quarantined)");
|
||||
Check(Mode(loaded, "z") == InjectionMode.RynthCore && Mode(loaded, "y") == InjectionMode.RynthCore, "unknown modes read as RynthCore");
|
||||
});
|
||||
|
||||
Scenario("unchanged list: decal-accounts.json is not rewritten", root, () =>
|
||||
{
|
||||
AppSettings s = Sample();
|
||||
AppSettingsStore.Save(s);
|
||||
DateTime old = new(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
File.SetLastWriteTimeUtc(Sidecar, old);
|
||||
AppSettingsStore.Save(s);
|
||||
Check(File.GetLastWriteTimeUtc(Sidecar) == old, "no rewrite when nothing changed");
|
||||
s.AccountProfiles[0].InjectionMode = InjectionMode.DecalBridge;
|
||||
AppSettingsStore.Save(s);
|
||||
Check(SidecarIds().SequenceEqual(new[] { "a", "b" }), "rewritten when the list changed");
|
||||
CheckSharedFilesSafe();
|
||||
});
|
||||
}
|
||||
finally
|
||||
{
|
||||
AppSettingsStore.DirectoryOverride = null;
|
||||
try { Directory.Delete(root, recursive: true); } catch { }
|
||||
}
|
||||
|
||||
Console.WriteLine(_failed == 0
|
||||
? $"PASS: {_checks} checks"
|
||||
: $"FAIL: {_failed} of {_checks} checks failed");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// ── helpers ──────────────────────────────────────────────────────────────
|
||||
|
||||
private static void Scenario(string name, string root, Action body)
|
||||
{
|
||||
Console.WriteLine($"-- {name}");
|
||||
_dir = Path.Combine(root, Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(_dir);
|
||||
AppSettingsStore.DirectoryOverride = _dir;
|
||||
try { body(); }
|
||||
catch (Exception ex) { Check(false, $"threw {ex.GetType().Name}: {ex.Message}"); }
|
||||
}
|
||||
|
||||
private static AppSettings Sample() => new()
|
||||
{
|
||||
EnginePath = @"C:\Games\RynthCore\Runtime\RynthCore.Loader.dll",
|
||||
AccountProfiles =
|
||||
[
|
||||
new LaunchAccountProfile { Id = "a", AccountName = "A", InjectionMode = InjectionMode.RynthCore },
|
||||
new LaunchAccountProfile { Id = "b", AccountName = "B", InjectionMode = InjectionMode.DecalBridge },
|
||||
new LaunchAccountProfile { Id = "c", AccountName = "C", InjectionMode = InjectionMode.Decal },
|
||||
],
|
||||
};
|
||||
|
||||
private static InjectionMode Mode(AppSettings s, string id) => s.AccountProfiles.First(a => a.Id == id).InjectionMode;
|
||||
|
||||
private static void CheckSharedFilesSafe()
|
||||
{
|
||||
foreach (string path in new[] { Main_, Bak })
|
||||
{
|
||||
if (!File.Exists(path)) continue;
|
||||
string name = Path.GetFileName(path);
|
||||
Check(!File.ReadAllText(path).Contains("DecalBridge"), $"{name} has no \"DecalBridge\"");
|
||||
Check(OldLauncherCanRead(path), $"the old launcher can read {name}");
|
||||
}
|
||||
}
|
||||
|
||||
private static string? SharedMode(string id)
|
||||
{
|
||||
JsonArray accounts = JsonNode.Parse(File.ReadAllText(Main_))!["AccountProfiles"]!.AsArray();
|
||||
return accounts.FirstOrDefault(a => (string?)a!["Id"] == id)?["InjectionMode"]?.ToString();
|
||||
}
|
||||
|
||||
private static List<string> SidecarIds()
|
||||
{
|
||||
if (!File.Exists(Sidecar)) return new();
|
||||
JsonNode node = JsonNode.Parse(File.ReadAllText(Sidecar))!;
|
||||
return node["DecalBridgeAccountIds"]!.AsArray().Select(n => (string)n!).ToList();
|
||||
}
|
||||
|
||||
/// <summary>An old launcher's save: the JSON round-trips with its edit applied.</summary>
|
||||
private static void OldLauncherEdit(Action<JsonArray> edit)
|
||||
{
|
||||
Check(OldLauncherCanRead(Main_), "old launcher loads the file before its edit");
|
||||
JsonNode root = JsonNode.Parse(File.ReadAllText(Main_))!;
|
||||
edit(root["AccountProfiles"]!.AsArray());
|
||||
File.Copy(Main_, Bak, overwrite: true);
|
||||
File.WriteAllText(Main_, root.ToJsonString(new JsonSerializerOptions { WriteIndented = true }));
|
||||
}
|
||||
|
||||
private static void SetMode(JsonArray accounts, string id, string mode)
|
||||
{
|
||||
foreach (JsonNode? a in accounts)
|
||||
if ((string?)a!["Id"] == id) a["InjectionMode"] = mode;
|
||||
}
|
||||
|
||||
private enum OldInjectionMode { RynthCore = 0, Decal = 1 }
|
||||
|
||||
private sealed class OldAccount
|
||||
{
|
||||
public string Id { get; set; } = "";
|
||||
public OldInjectionMode InjectionMode { get; set; }
|
||||
}
|
||||
|
||||
private sealed class OldSettings
|
||||
{
|
||||
public List<OldAccount> AccountProfiles { get; set; } = new();
|
||||
}
|
||||
|
||||
private static readonly JsonSerializerOptions OldOptions = new() { Converters = { new JsonStringEnumConverter() } };
|
||||
|
||||
private static bool OldLauncherCanRead(string path)
|
||||
{
|
||||
try { JsonSerializer.Deserialize<OldSettings>(File.ReadAllText(path), OldOptions); return true; }
|
||||
catch (JsonException) { return false; }
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine($" FAIL: {what}");
|
||||
}
|
||||
}
|
||||
28
tools/LauncherUpdateTests/LauncherUpdateTests.csproj
Normal file
28
tools/LauncherUpdateTests/LauncherUpdateTests.csproj
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline tests for the launcher's Available plugins list, plugin installs with download
|
||||
progress and Cancel (RynthUpdater.Available.cs, DownloadProgress.cs), and the front page's
|
||||
update card (UpdateCardModel.cs). A throwaway key signs a feed served by a local
|
||||
HttpListener; plugins install into temp folders. Never opens the launcher window, never
|
||||
reads or writes outside %TEMP%.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>LauncherUpdateTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\RynthUpdater.cs" Link="Linked\RynthUpdater.cs" />
|
||||
<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\DownloadProgress.cs" Link="Linked\DownloadProgress.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\UpdateCardModel.cs" Link="Linked\UpdateCardModel.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\UpdateTrust.cs" Link="Linked\UpdateTrust.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
605
tools/LauncherUpdateTests/Program.cs
Normal file
605
tools/LauncherUpdateTests/Program.cs
Normal file
|
|
@ -0,0 +1,605 @@
|
|||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using RynthCore.App.Avalonia;
|
||||
|
||||
// Tests for the launcher's Available plugins list, plugin installs (verified, with progress and
|
||||
// Cancel), Remove, old feeds without descriptions, the download meter, and the front page's
|
||||
// update card. A throwaway signing key signs feeds served by a local HttpListener.
|
||||
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 string _root = "";
|
||||
private static string _base = "";
|
||||
private static readonly Dictionary<string, byte[]> Served = new();
|
||||
private static readonly ECDsa Key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
private static readonly DateTime Published = new(2026, 10, 5, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
private static async Task<int> Main()
|
||||
{
|
||||
_root = Path.Combine(Path.GetTempPath(), "rlaunch-upd-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(_root);
|
||||
int port = FreePort();
|
||||
_base = $"http://localhost:{port}/rynth/";
|
||||
using var http = new HttpListener();
|
||||
http.Prefixes.Add(_base);
|
||||
http.Start();
|
||||
_ = Task.Run(() => Serve(http));
|
||||
try
|
||||
{
|
||||
await Run(nameof(AvailableIsFeedMinusInstalled), AvailableIsFeedMinusInstalled);
|
||||
await Run(nameof(OnlyRynthLuaIsAutomatic), OnlyRynthLuaIsAutomatic);
|
||||
await Run(nameof(OldManifestWithoutDescriptions), OldManifestWithoutDescriptions);
|
||||
await Run(nameof(DescriptionsAreOneShortLine), DescriptionsAreOneShortLine);
|
||||
await Run(nameof(NewBadgeAndOneAnnouncement), NewBadgeAndOneAnnouncement);
|
||||
await Run(nameof(NotNewForPlayersWhoHadThem), NotNewForPlayersWhoHadThem);
|
||||
await Run(nameof(InstallDownloadsVerifiesRegisters), InstallDownloadsVerifiesRegisters);
|
||||
await Run(nameof(InstallRefusesTamperedFile), InstallRefusesTamperedFile);
|
||||
await Run(nameof(InstallOnlyFromTheFeed), InstallOnlyFromTheFeed);
|
||||
await Run(nameof(InstallKeepsGoodCopyReplacesOldOne), InstallKeepsGoodCopyReplacesOldOne);
|
||||
await Run(nameof(CancelledInstallLeavesNoFile), CancelledInstallLeavesNoFile);
|
||||
await Run(nameof(RemoveReturnsPluginToAvailable), RemoveReturnsPluginToAvailable);
|
||||
await Run(nameof(SuiteFolderWithoutRynthAi), SuiteFolderWithoutRynthAi);
|
||||
await Run(nameof(UnsignedDescriptionBreaksSignature), UnsignedDescriptionBreaksSignature);
|
||||
await Run(nameof(UrlOutsideFeedStillRefused), UrlOutsideFeedStillRefused);
|
||||
await Run(nameof(MeterThrottlesAndFinishes), MeterThrottlesAndFinishes);
|
||||
await Run(nameof(ProgressTextFormats), ProgressTextFormats);
|
||||
await Run(nameof(UpdateCardStates), UpdateCardStates);
|
||||
await Run(nameof(UpdateCardDownloading), UpdateCardDownloading);
|
||||
await Run(nameof(UpdateCardWhatsNew), UpdateCardWhatsNew);
|
||||
}
|
||||
finally
|
||||
{
|
||||
http.Stop();
|
||||
try { Directory.Delete(_root, true); } catch { }
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(_fails == 0 && _asserts > 0 ? $"PASS ({_asserts} assertions)" : $"FAIL ({_fails} of {_asserts} assertions failed)");
|
||||
return _fails == 0 && _asserts > 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static async Task Run(string name, Func<Task> test)
|
||||
{
|
||||
int before = _fails;
|
||||
try { await test(); }
|
||||
catch (Exception ex) { _fails++; _asserts++; Console.WriteLine($" [FAIL] {name} threw {ex.GetType().Name}: {ex.Message}"); }
|
||||
Console.WriteLine($"{(_fails == before ? "ok " : "FAIL")} {name}");
|
||||
}
|
||||
|
||||
private static Task Run(string name, Action test) => Run(name, () => { test(); return Task.CompletedTask; });
|
||||
|
||||
// ── Fixtures ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static int FreePort()
|
||||
{
|
||||
var l = new TcpListener(IPAddress.Loopback, 0);
|
||||
l.Start();
|
||||
int p = ((IPEndPoint)l.LocalEndpoint).Port;
|
||||
l.Stop();
|
||||
return p;
|
||||
}
|
||||
|
||||
private static async Task Serve(HttpListener http)
|
||||
{
|
||||
while (http.IsListening)
|
||||
{
|
||||
HttpListenerContext ctx;
|
||||
try { ctx = await http.GetContextAsync(); } catch { return; }
|
||||
string name = ctx.Request.Url!.AbsolutePath.Replace("/rynth/", "");
|
||||
byte[]? body;
|
||||
lock (Served) Served.TryGetValue(name, out body);
|
||||
if (body == null) { ctx.Response.StatusCode = 404; ctx.Response.Close(); continue; }
|
||||
ctx.Response.StatusCode = 200;
|
||||
ctx.Response.ContentLength64 = body.Length;
|
||||
HttpListenerContext c = ctx;
|
||||
byte[] b = body;
|
||||
// Big files go out in pieces with a pause between them, so a download is still running
|
||||
// when progress is reported (and can be cancelled half way).
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int off = 0; off < b.Length; off += 64 * 1024)
|
||||
{
|
||||
await c.Response.OutputStream.WriteAsync(b.AsMemory(off, Math.Min(64 * 1024, b.Length - off)));
|
||||
if (b.Length > 512 * 1024) await Task.Delay(25);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
finally { try { c.Response.Close(); } catch { } }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static string Sha(byte[] b) => Convert.ToHexString(SHA256.HashData(b)).ToLowerInvariant();
|
||||
// Names that aren't plain folder names (a test of the folder check) get a plain file name.
|
||||
private static string FileOf(string name) =>
|
||||
name.All(char.IsLetterOrDigit) ? $"RynthCore.Plugin.{name}.dll" : $"RynthCore.Plugin.Weird{(uint)name.GetHashCode():x}.dll";
|
||||
|
||||
private static byte[] Body(string name, string version = "v2")
|
||||
{
|
||||
if (name == "RynthOracle")
|
||||
{
|
||||
// Big enough for several progress reports.
|
||||
var rnd = new Random(7);
|
||||
byte[] b = new byte[1_500_000];
|
||||
rnd.NextBytes(b);
|
||||
Encoding.ASCII.GetBytes($"dll {name} {version}").CopyTo(b, 0);
|
||||
return b;
|
||||
}
|
||||
return Encoding.UTF8.GetBytes($"dll {name} {version}");
|
||||
}
|
||||
|
||||
private static readonly string[] FeedPlugins = { "RynthAi", "RynthChat", "RynthNav", "RynthLua", "RynthOracle", "RynthInventory" };
|
||||
|
||||
private sealed record Feed(RynthUpdater Upd, string Dir, string Suite, string State, string RynthAiPath);
|
||||
|
||||
/// <summary>
|
||||
/// A signed feed in its own folder, a state folder, and RynthAi installed at
|
||||
/// <tag>\Games\RynthSuite\RynthAi (the installer's layout).
|
||||
/// </summary>
|
||||
private static Feed Setup(string tag, bool descriptions = true, IEnumerable<string>? extraPlugins = null,
|
||||
Dictionary<string, string>? descriptionOverride = null, bool signDescriptions = true, string? badUrlFor = null,
|
||||
string[]? changes = null)
|
||||
{
|
||||
string dir = Path.Combine(_root, tag);
|
||||
string state = Path.Combine(dir, "state"), app = Path.Combine(dir, "app"), suite = Path.Combine(dir, "Games", "RynthSuite");
|
||||
Directory.CreateDirectory(state); Directory.CreateDirectory(app);
|
||||
string ai = Path.Combine(suite, "RynthAi", FileOf("RynthAi"));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(ai)!);
|
||||
File.WriteAllBytes(ai, Body("RynthAi"));
|
||||
File.SetLastWriteTimeUtc(ai, Published);
|
||||
WriteFeed(tag, descriptions, extraPlugins, descriptionOverride, signDescriptions, badUrlFor, changes);
|
||||
var upd = new RynthUpdater(_base + $"{tag}/update.json", new[] { Convert.ToBase64String(Key.ExportSubjectPublicKeyInfo()) }, state, app);
|
||||
upd.SetDefaultSuiteDir(Path.Combine(dir, "DefaultSuite"));
|
||||
return new Feed(upd, dir, suite, state, ai);
|
||||
}
|
||||
|
||||
private static void WriteFeed(string tag, bool descriptions = true, IEnumerable<string>? extraPlugins = null,
|
||||
Dictionary<string, string>? descriptionOverride = null, bool signDescriptions = true, string? badUrlFor = null,
|
||||
string[]? changes = null)
|
||||
{
|
||||
var plugins = new List<Dictionary<string, object>>();
|
||||
foreach (string name in FeedPlugins.Concat(extraPlugins ?? Array.Empty<string>()))
|
||||
{
|
||||
byte[] body = Body(name);
|
||||
string rel = $"{tag}/releases/1/plugins/{FileOf(name)}";
|
||||
lock (Served) Served[rel] = body;
|
||||
var p = new Dictionary<string, object>
|
||||
{
|
||||
["name"] = name, ["file"] = FileOf(name),
|
||||
["url"] = name == badUrlFor ? "http://elsewhere.example/" + FileOf(name) : _base + rel,
|
||||
["size"] = body.Length, ["sha256"] = Sha(body),
|
||||
};
|
||||
if (descriptions) p["description"] = descriptionOverride != null && descriptionOverride.TryGetValue(name, out string? d) ? d : $"Feed line for {name}.";
|
||||
plugins.Add(p);
|
||||
}
|
||||
var manifest = new Dictionary<string, object?>
|
||||
{
|
||||
["schema"] = 1, ["release"] = 2026100501, ["version"] = "2026.10.5.1",
|
||||
["published"] = Published.ToString("yyyy-MM-ddTHH:mm:ssZ"), ["notes"] = "Release notes for players.",
|
||||
["core"] = new Dictionary<string, object> { ["release"] = 2026100501, ["version"] = "2026.10.5.1", ["url"] = _base + $"{tag}/releases/1/RynthCore-Setup.exe", ["size"] = 1, ["sha256"] = "00" },
|
||||
["plugins"] = plugins,
|
||||
};
|
||||
if (changes != null) manifest["changes"] = changes;
|
||||
byte[] signedPayload;
|
||||
if (!signDescriptions)
|
||||
{
|
||||
// What was signed had no descriptions; what is served does.
|
||||
var unsigned = plugins.Select(p => p.Where(kv => kv.Key != "description").ToDictionary(kv => kv.Key, kv => kv.Value)).ToList();
|
||||
var m2 = new Dictionary<string, object?>(manifest) { ["plugins"] = unsigned };
|
||||
signedPayload = JsonSerializer.SerializeToUtf8Bytes(m2);
|
||||
}
|
||||
else signedPayload = JsonSerializer.SerializeToUtf8Bytes(manifest);
|
||||
byte[] payload = JsonSerializer.SerializeToUtf8Bytes(manifest);
|
||||
byte[] sig = Key.SignData(signedPayload, HashAlgorithmName.SHA256, DSASignatureFormat.IeeeP1363FixedFieldConcatenation);
|
||||
string envelope = JsonSerializer.Serialize(new
|
||||
{
|
||||
payload = Convert.ToBase64String(payload),
|
||||
signatures = new[] { new { key = RynthUpdater.KeyId(Key.ExportSubjectPublicKeyInfo()), sig = Convert.ToBase64String(sig) } },
|
||||
});
|
||||
lock (Served) Served[$"{tag}/update.json"] = Encoding.UTF8.GetBytes(envelope);
|
||||
}
|
||||
|
||||
/// <summary>Installs a plugin by hand at the suite layout (as if from the zip or an earlier launcher).</summary>
|
||||
private static string Place(Feed f, string name)
|
||||
{
|
||||
string path = Path.Combine(f.Suite, name, FileOf(name));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
|
||||
File.WriteAllBytes(path, Body(name));
|
||||
File.SetLastWriteTimeUtc(path, Published);
|
||||
return path;
|
||||
}
|
||||
|
||||
private sealed class SyncProgress(Action<DownloadProgress> onReport) : IProgress<DownloadProgress>
|
||||
{
|
||||
public void Report(DownloadProgress value) => onReport(value);
|
||||
}
|
||||
|
||||
private static List<string> Names(IEnumerable<RynthUpdater.AvailablePlugin> a) => a.Select(x => x.Entry.Name).OrderBy(n => n).ToList();
|
||||
|
||||
// ── Available list ───────────────────────────────────────────────────────
|
||||
|
||||
private static async Task AvailableIsFeedMinusInstalled()
|
||||
{
|
||||
var f = Setup("avail");
|
||||
string chat = Place(f, "RynthChat");
|
||||
var paths = new List<string> { f.RynthAiPath, chat };
|
||||
var c = await f.Upd.CheckAsync(paths);
|
||||
Check(Names(c.Available).SequenceEqual(new[] { "RynthInventory", "RynthNav", "RynthOracle" }),
|
||||
"Available = feed minus installed, minus RynthLua (installed automatically): " + string.Join(",", Names(c.Available)));
|
||||
var oracle = c.Available.Single(a => a.Entry.Name == "RynthOracle");
|
||||
Check(oracle.Path == Path.Combine(f.Suite, "RynthOracle", FileOf("RynthOracle")), "goes beside RynthAi: " + oracle.Path);
|
||||
Check(oracle.Version == "2026.10.5.1" && oracle.Entry.Size == Body("RynthOracle").Length, "version and size from the feed");
|
||||
Check(oracle.Description == "Feed line for RynthOracle.", "description from the feed");
|
||||
Check(f.Upd.GetAvailable(c, paths).Count == c.Available.Count, "recomputed against the same list: the same");
|
||||
// Disabled (unticked) plugins are still in the list: not available.
|
||||
Check(!c.Available.Any(a => a.Entry.Name == "RynthChat"), "a listed plugin is never available");
|
||||
}
|
||||
|
||||
private static async Task OnlyRynthLuaIsAutomatic()
|
||||
{
|
||||
var f = Setup("companions");
|
||||
var c = await f.Upd.CheckAsync(new[] { f.RynthAiPath });
|
||||
Check(c.Companions.Count == 1 && c.Companions[0].Entry.Name == "RynthLua", "only RynthLua installs itself beside RynthAi");
|
||||
var done = await f.Upd.InstallCompanionsAsync(c);
|
||||
Check(done.Count == 1 && File.Exists(done[0].Path), "RynthLua installed");
|
||||
var c2 = await f.Upd.CheckAsync(new[] { f.RynthAiPath });
|
||||
Check(c2.Companions.Count == 0, "offered once: removed from the list, it stays removed");
|
||||
Check(c2.Available.Any(a => a.Entry.Name == "RynthLua"), "but it is under Available if the player wants it back");
|
||||
Check(c2.Available.Any(a => a.Entry.Name == "RynthOracle") && c2.Available.Any(a => a.Entry.Name == "RynthInventory"),
|
||||
"RynthOracle and RynthInventory are offered, not installed");
|
||||
}
|
||||
|
||||
private static async Task OldManifestWithoutDescriptions()
|
||||
{
|
||||
var f = Setup("olddesc", descriptions: false, extraPlugins: new[] { "RynthSomethingElse" });
|
||||
var c = await f.Upd.CheckAsync(new[] { f.RynthAiPath });
|
||||
Check(c.Manifest.Plugins.All(p => p.Description == ""), "an old feed parses with no descriptions");
|
||||
Check(c.Available.Single(a => a.Entry.Name == "RynthOracle").Description == "Quests, character, titles and leaderboards.",
|
||||
"a missing description falls back to the launcher's table");
|
||||
Check(c.Available.Single(a => a.Entry.Name == "RynthNav").Description.Contains("540 MB"), "RynthNav's says how big its map is");
|
||||
Check(c.Available.Single(a => a.Entry.Name == "RynthSomethingElse").Description == "", "a plugin the table doesn't know: no description, still listed");
|
||||
Check(c.Manifest.Changes.Count == 0 && c.Manifest.Notes.Length > 0, "no changes list: the notes are still there");
|
||||
}
|
||||
|
||||
private static async Task DescriptionsAreOneShortLine()
|
||||
{
|
||||
var f = Setup("longdesc", descriptionOverride: new()
|
||||
{
|
||||
["RynthOracle"] = "Line one\nline two\t\u0007 with spaces " + new string('x', 400),
|
||||
["RynthNav"] = " ",
|
||||
}, changes: new[] { "First change.", " Second\nchange. ", "" });
|
||||
var c = await f.Upd.CheckAsync(new[] { f.RynthAiPath });
|
||||
string d = c.Available.Single(a => a.Entry.Name == "RynthOracle").Description;
|
||||
Check(!d.Contains('\n') && !d.Contains('\t') && !d.Contains('\u0007') && d.StartsWith("Line one line two with spaces"), "one line, control characters gone: " + d[..40]);
|
||||
Check(d.Length <= 160 && d.EndsWith("…"), $"capped at 160 characters ({d.Length})");
|
||||
Check(c.Available.Single(a => a.Entry.Name == "RynthNav").Description.Contains("540 MB"), "a blank feed description falls back to the table");
|
||||
Check(c.Manifest.Changes.SequenceEqual(new[] { "First change.", "Second change." }), "changes: trimmed, one line each, blanks dropped");
|
||||
}
|
||||
|
||||
private static async Task NewBadgeAndOneAnnouncement()
|
||||
{
|
||||
var f = Setup("newbadge");
|
||||
DateTime now = new(2026, 10, 6, 12, 0, 0, DateTimeKind.Utc);
|
||||
f.Upd.UtcNow = () => now;
|
||||
var paths = new[] { f.RynthAiPath };
|
||||
var c = await f.Upd.CheckAsync(paths);
|
||||
Check(c.Available.Where(a => a.IsNew).Select(a => a.Entry.Name).OrderBy(n => n).SequenceEqual(new[] { "RynthInventory", "RynthOracle" }),
|
||||
"first run: the two recent plugins are New, the rest aren't");
|
||||
Check(Names(c.NewlyAnnounced).SequenceEqual(new[] { "RynthInventory", "RynthOracle" }), "and announced");
|
||||
Check(c.Available.First().IsNew, "New ones are listed first");
|
||||
c = await f.Upd.CheckAsync(paths);
|
||||
Check(c.NewlyAnnounced.Count == 0, "announced once only");
|
||||
Check(c.Available.Count(a => a.IsNew) == 2, "the badge stays");
|
||||
now = now.AddDays(31);
|
||||
c = await f.Upd.CheckAsync(paths);
|
||||
Check(c.Available.All(a => !a.IsNew), "after a month the badge goes");
|
||||
|
||||
// A plugin added to the feed later is New and announced, no table needed.
|
||||
WriteFeed("newbadge", extraPlugins: new[] { "RynthBrandNew" });
|
||||
c = await f.Upd.CheckAsync(paths);
|
||||
Check(c.Available.Single(a => a.Entry.Name == "RynthBrandNew").IsNew && Names(c.NewlyAnnounced).SequenceEqual(new[] { "RynthBrandNew" }),
|
||||
"a plugin that appears in the feed later is New and announced");
|
||||
}
|
||||
|
||||
private static async Task NotNewForPlayersWhoHadThem()
|
||||
{
|
||||
var f = Setup("hadthem");
|
||||
// 2026.10.4.3 auto-installed both; this player removed RynthInventory afterwards.
|
||||
File.WriteAllText(Path.Combine(f.State, "update-companions.json"), "[\"RynthInventory\", \"RynthLua\", \"RynthOracle\"]");
|
||||
string oracle = Place(f, "RynthOracle");
|
||||
var c = await f.Upd.CheckAsync(new[] { f.RynthAiPath, oracle });
|
||||
Check(!c.Available.Any(a => a.Entry.Name == "RynthOracle"), "the one they kept is installed, not offered");
|
||||
var inv = c.Available.SingleOrDefault(a => a.Entry.Name == "RynthInventory");
|
||||
Check(inv != null && !inv.IsNew && c.NewlyAnnounced.Count == 0, "the one they removed is available, without a New badge or an announcement");
|
||||
Check(c.Companions.Count == 0, "and nothing installs itself (RynthLua was offered already)");
|
||||
}
|
||||
|
||||
// ── Install ──────────────────────────────────────────────────────────────
|
||||
|
||||
private static async Task InstallDownloadsVerifiesRegisters()
|
||||
{
|
||||
var f = Setup("install");
|
||||
var paths = new List<string> { f.RynthAiPath };
|
||||
var c = await f.Upd.CheckAsync(paths);
|
||||
var reports = new List<DownloadProgress>();
|
||||
var r = await f.Upd.InstallPluginAsync(c, "RynthOracle", paths, new SyncProgress(p => { lock (reports) reports.Add(p); }));
|
||||
string expected = Path.Combine(f.Suite, "RynthOracle", FileOf("RynthOracle"));
|
||||
Check(r.Path == expected && r.Downloaded, "installed into the suite folder: " + r.Path);
|
||||
Check(File.Exists(expected) && Sha(File.ReadAllBytes(expected)) == Sha(Body("RynthOracle")), "the file is the signed one");
|
||||
Check(File.GetLastWriteTimeUtc(expected) == Published, "stamped with the release time (never taken for a local build)");
|
||||
var dl = reports.Where(p => p.Stage == DownloadStage.Downloading).ToList();
|
||||
Check(dl.Count >= 2 && dl.Last().Done == dl.Last().Total && dl.Last().Percent == 100, $"progress reaches 100% ({dl.Count} reports)");
|
||||
Check(dl.All(p => p.What == "RynthOracle"), "progress names the plugin");
|
||||
Check(reports.Any(p => p.Stage == DownloadStage.Verified) && reports.Last().Stage == DownloadStage.Installing, "verified, then installing");
|
||||
|
||||
Check(PluginListEdits.Add(paths, r.Path), "registered in the plugin list");
|
||||
Check(!PluginListEdits.Add(paths, r.Path.ToUpperInvariant()), "only once");
|
||||
Check(!f.Upd.GetAvailable(c, paths).Any(a => a.Entry.Name == "RynthOracle"), "no longer available");
|
||||
var c2 = await f.Upd.CheckAsync(paths);
|
||||
Check(c2.Plugins.Any(p => p.Entry.Name == "RynthOracle" && p.State == RynthUpdater.PluginState.UpToDate), "the next check sees it up to date");
|
||||
}
|
||||
|
||||
private static async Task InstallRefusesTamperedFile()
|
||||
{
|
||||
var f = Setup("tamper");
|
||||
var paths = new List<string> { f.RynthAiPath };
|
||||
var c = await f.Upd.CheckAsync(paths);
|
||||
byte[] bad = Body("RynthInventory"); bad[0] ^= 0xFF;
|
||||
lock (Served) Served[$"tamper/releases/1/plugins/{FileOf("RynthInventory")}"] = bad;
|
||||
var reports = new List<DownloadProgress>();
|
||||
bool threw = false;
|
||||
try { await f.Upd.InstallPluginAsync(c, "RynthInventory", paths, new SyncProgress(reports.Add)); }
|
||||
catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "a file that doesn't match the signed hash is refused");
|
||||
string target = Path.Combine(f.Suite, "RynthInventory", FileOf("RynthInventory"));
|
||||
Check(!File.Exists(target), "nothing installed");
|
||||
Check(!reports.Any(p => p.Stage is DownloadStage.Verified or DownloadStage.Installing), "never reported as verified");
|
||||
|
||||
// A bigger tampered file, refused at the end of a download with progress on.
|
||||
byte[] badBig = Body("RynthOracle"); badBig[badBig.Length - 1] ^= 0x01;
|
||||
lock (Served) Served[$"tamper/releases/1/plugins/{FileOf("RynthOracle")}"] = badBig;
|
||||
threw = false;
|
||||
try { await f.Upd.InstallPluginAsync(c, "RynthOracle", paths, new SyncProgress(_ => { })); }
|
||||
catch (InvalidDataException) { threw = true; }
|
||||
Check(threw && !File.Exists(Path.Combine(f.Suite, "RynthOracle", FileOf("RynthOracle"))), "with progress on, the hash is still checked");
|
||||
}
|
||||
|
||||
private static async Task InstallOnlyFromTheFeed()
|
||||
{
|
||||
var f = Setup("feedonly", extraPlugins: new[] { "..", "Bad Name" });
|
||||
var paths = new List<string> { f.RynthAiPath };
|
||||
var c = await f.Upd.CheckAsync(paths);
|
||||
Check(!c.Available.Any(a => a.Entry.Name is ".." or "Bad Name"), "a feed name that isn't a plain folder name is never listed");
|
||||
bool threw = false;
|
||||
try { await f.Upd.InstallPluginAsync(c, "..", paths); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "and can't be installed");
|
||||
threw = false;
|
||||
try { await f.Upd.InstallPluginAsync(c, "RynthNotInFeed", paths); } catch (InvalidOperationException) { threw = true; }
|
||||
Check(threw, "a plugin the feed doesn't have can't be installed");
|
||||
threw = false;
|
||||
try { await f.Upd.InstallPluginAsync(c, "RynthAi", paths); } catch (InvalidOperationException) { threw = true; }
|
||||
Check(threw, "one already in the list isn't installed again");
|
||||
}
|
||||
|
||||
private static async Task InstallKeepsGoodCopyReplacesOldOne()
|
||||
{
|
||||
var f = Setup("existing");
|
||||
var paths = new List<string> { f.RynthAiPath };
|
||||
var c = await f.Upd.CheckAsync(paths);
|
||||
string chat = Place(f, "RynthChat"); // the right file already there (from the zip)
|
||||
var r = await f.Upd.InstallPluginAsync(c, "RynthChat", paths);
|
||||
Check(r.Path == chat && !r.Downloaded, "a good copy at the target is kept, not downloaded again");
|
||||
|
||||
string nav = Path.Combine(f.Suite, "RynthNav", FileOf("RynthNav"));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(nav)!);
|
||||
File.WriteAllText(nav, "an old RynthNav");
|
||||
File.SetLastWriteTimeUtc(nav, Published.AddDays(-20));
|
||||
r = await f.Upd.InstallPluginAsync(c, "RynthNav", paths);
|
||||
Check(r.Downloaded && Sha(File.ReadAllBytes(nav)) == Sha(Body("RynthNav")), "an older copy is replaced by the release");
|
||||
Check(File.ReadAllText(nav + ".previous") == "an old RynthNav", "and kept beside it as .previous");
|
||||
|
||||
string inv = Path.Combine(f.Suite, "RynthInventory", FileOf("RynthInventory"));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(inv)!);
|
||||
File.WriteAllText(inv, "my own build");
|
||||
File.SetLastWriteTimeUtc(inv, Published.AddDays(2));
|
||||
r = await f.Upd.InstallPluginAsync(c, "RynthInventory", paths);
|
||||
Check(!r.Downloaded && File.ReadAllText(inv) == "my own build", "a newer local build is left alone");
|
||||
}
|
||||
|
||||
private static async Task CancelledInstallLeavesNoFile()
|
||||
{
|
||||
var f = Setup("cancel");
|
||||
var paths = new List<string> { f.RynthAiPath };
|
||||
var c = await f.Upd.CheckAsync(paths);
|
||||
using var cts = new CancellationTokenSource();
|
||||
bool halfWay = false, threw = false;
|
||||
string tempBefore = string.Join("|", Directory.GetFiles(Path.GetTempPath(), "rynth-*.dll").OrderBy(x => x));
|
||||
try
|
||||
{
|
||||
await f.Upd.InstallPluginAsync(c, "RynthOracle", paths, new SyncProgress(p =>
|
||||
{
|
||||
if (p.Stage == DownloadStage.Downloading && p.Done > 0 && p.Done < p.Total) { halfWay = true; cts.Cancel(); }
|
||||
}), cts.Token);
|
||||
}
|
||||
catch (OperationCanceledException) { threw = true; }
|
||||
Check(halfWay && threw, "cancelled half way");
|
||||
Check(!File.Exists(Path.Combine(f.Suite, "RynthOracle", FileOf("RynthOracle"))), "nothing installed");
|
||||
string tempAfter = string.Join("|", Directory.GetFiles(Path.GetTempPath(), "rynth-*.dll").OrderBy(x => x));
|
||||
Check(tempAfter == tempBefore, "the partial download is deleted");
|
||||
var r = await f.Upd.InstallPluginAsync(c, "RynthOracle", paths);
|
||||
Check(r.Downloaded && File.Exists(r.Path), "a later Install works");
|
||||
}
|
||||
|
||||
// ── Remove ───────────────────────────────────────────────────────────────
|
||||
|
||||
private static async Task RemoveReturnsPluginToAvailable()
|
||||
{
|
||||
var f = Setup("remove");
|
||||
string oracle = Place(f, "RynthOracle");
|
||||
var paths = new List<string> { f.RynthAiPath, oracle };
|
||||
var disabled = new List<string> { oracle.ToUpperInvariant() };
|
||||
var c = await f.Upd.CheckAsync(paths);
|
||||
Check(!c.Available.Any(a => a.Entry.Name == "RynthOracle"), "installed: not available");
|
||||
Check(PluginListEdits.Remove(paths, disabled, oracle), "removed from the list");
|
||||
Check(!paths.Contains(oracle) && disabled.Count == 0, "and from the disabled list (adding it back starts it ticked)");
|
||||
Check(File.Exists(oracle), "the files stay on disk");
|
||||
Check(f.Upd.GetAvailable(c, paths).Any(a => a.Entry.Name == "RynthOracle"), "back under Available");
|
||||
c = await f.Upd.CheckAsync(paths);
|
||||
Check(c.Available.Any(a => a.Entry.Name == "RynthOracle") && !c.Companions.Any(x => x.Entry.Name == "RynthOracle"), "the next check agrees, and doesn't reinstall it");
|
||||
var r = await f.Upd.InstallPluginAsync(c, "RynthOracle", paths);
|
||||
Check(!r.Downloaded && r.Path == oracle, "Install again reuses the file that stayed");
|
||||
Check(!PluginListEdits.Remove(paths, null, Path.Combine(f.Dir, "never-listed.dll")), "removing something not listed does nothing");
|
||||
}
|
||||
|
||||
private static async Task SuiteFolderWithoutRynthAi()
|
||||
{
|
||||
var f = Setup("suite");
|
||||
// RynthAi not in the list, RynthChat in a folder named after it: install beside that.
|
||||
string otherSuite = Path.Combine(f.Dir, "Elsewhere", "RynthSuite");
|
||||
string chat = Path.Combine(otherSuite, "RynthChat", FileOf("RynthChat"));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(chat)!);
|
||||
File.WriteAllBytes(chat, Body("RynthChat"));
|
||||
var c = await f.Upd.CheckAsync(new[] { chat });
|
||||
Check(c.Available.Single(a => a.Entry.Name == "RynthNav").Path.StartsWith(otherSuite), "beside another suite plugin");
|
||||
c = await f.Upd.CheckAsync(new[] { Path.Combine(f.Dir, "loose", "SomeOther.dll") });
|
||||
Check(c.Available.Single(a => a.Entry.Name == "RynthNav").Path.StartsWith(Path.Combine(f.Dir, "DefaultSuite")), "else the default folder");
|
||||
Check(c.Available.Any(a => a.Entry.Name == "RynthAi"), "RynthAi itself is available when it isn't listed");
|
||||
}
|
||||
|
||||
// ── The feed's rules are unchanged ───────────────────────────────────────
|
||||
|
||||
private static async Task UnsignedDescriptionBreaksSignature()
|
||||
{
|
||||
var f = Setup("unsigned", signDescriptions: false);
|
||||
bool threw = false;
|
||||
try { await f.Upd.CheckAsync(new[] { f.RynthAiPath }); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "descriptions are covered by the signature like everything else");
|
||||
}
|
||||
|
||||
private static async Task UrlOutsideFeedStillRefused()
|
||||
{
|
||||
var f = Setup("badurl", badUrlFor: "RynthOracle");
|
||||
bool threw = false;
|
||||
try { await f.Upd.CheckAsync(new[] { f.RynthAiPath }); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "a plugin URL outside the feed's folder is refused (so it can never be installed)");
|
||||
}
|
||||
|
||||
// ── Download meter and text ──────────────────────────────────────────────
|
||||
|
||||
private static void MeterThrottlesAndFinishes()
|
||||
{
|
||||
TimeSpan t = TimeSpan.Zero;
|
||||
var reports = new List<DownloadProgress>();
|
||||
long total = 100L << 20;
|
||||
var m = new DownloadMeter("RynthNav map", total, new SyncProgress(reports.Add), () => t);
|
||||
m.Report(0);
|
||||
for (int i = 1; i <= 9; i++) { t += TimeSpan.FromMilliseconds(20); m.Report(i * (1L << 20)); }
|
||||
Check(reports.Count == 1, $"reads 20 ms apart are throttled ({reports.Count} reports)");
|
||||
t = TimeSpan.FromSeconds(1); m.Report(10L << 20);
|
||||
Check(reports.Count == 2, "a read after the interval is reported");
|
||||
var r = reports.Last();
|
||||
Check(Math.Abs(r.BytesPerSecond - (10L << 20)) < (1L << 20), $"speed ~10 MB/s ({r.BytesPerSecond / (1 << 20):0.0})");
|
||||
Check(r.Remaining is { } rem && Math.Abs(rem.TotalSeconds - 9) < 1, $"time left ~9 s ({r.Remaining})");
|
||||
Check(r.Percent is { } pc && Math.Abs(pc - 10) < 0.01, "10%");
|
||||
t = TimeSpan.FromSeconds(1.01); m.Report(total);
|
||||
Check(reports.Last().Done == total && reports.Last().Percent == 100 && reports.Last().Remaining == TimeSpan.Zero, "the end is always reported, at 100%");
|
||||
t = TimeSpan.FromSeconds(130); m.Verified();
|
||||
Check(reports.Last().Stage == DownloadStage.Verified && reports.Last().Elapsed == TimeSpan.FromSeconds(130), "Verified carries the time taken");
|
||||
Check(new DownloadMeter("x", 10, null).Elapsed >= TimeSpan.Zero, "no progress wanted: no reports, no failure");
|
||||
}
|
||||
|
||||
private static void ProgressTextFormats()
|
||||
{
|
||||
var done = new DownloadProgress("RynthNav map", DownloadStage.Verified, 565_182_464, 565_182_464, Elapsed: TimeSpan.FromSeconds(130));
|
||||
Check(done.Summary == "RynthNav map: 539 MB in 2m10s, verified", "log line: " + done.Summary);
|
||||
var mid = new DownloadProgress("RynthNav map", DownloadStage.Downloading, 327_155_712, 565_182_464, 4.2 * 1024 * 1024, TimeSpan.FromSeconds(55));
|
||||
Check(mid.Detail == "312 of 539 MB · 4.2 MB/s · about 55s left", "detail: " + mid.Detail);
|
||||
var small = new DownloadProgress("RynthOracle", DownloadStage.Downloading, 524_288, 1_500_000);
|
||||
Check(small.Detail == "0.5 of 1.4 MB", "small file, no speed yet: " + small.Detail);
|
||||
var unpack = new DownloadProgress("RynthNav map", DownloadStage.Unpacking, 12345, 40112);
|
||||
Check(unpack.Detail == "Unpacking 12,345 of 40,112 files…" && unpack.Percent is > 30 and < 31, "unpacking: " + unpack.Detail);
|
||||
Check(new DownloadProgress("x", DownloadStage.Installing, 0, 0).Percent == null, "installing has no percentage (an indeterminate bar)");
|
||||
Check(DownloadProgress.FormatDuration(TimeSpan.FromMinutes(65)) == "1h05m" && DownloadProgress.FormatDuration(TimeSpan.FromSeconds(8.4)) == "8s", "durations");
|
||||
}
|
||||
|
||||
// ── Update card ──────────────────────────────────────────────────────────
|
||||
|
||||
private static void UpdateCardStates()
|
||||
{
|
||||
var notConfigured = UpdateCardModel.Build(new UpdateCardInput { Configured = false });
|
||||
Check(notConfigured.Kind == UpdateCardKind.NotConfigured && !notConfigured.ShowCheckButton, "no signing key: says so, no button");
|
||||
|
||||
var notChecked = UpdateCardModel.Build(new UpdateCardInput { InstalledVersion = "2026.10.4.3" });
|
||||
Check(notChecked.Kind == UpdateCardKind.NotChecked && notChecked.ShowCheckButton && notChecked.ActionButton == null, "before the first check: Check button only");
|
||||
|
||||
var checking = UpdateCardModel.Build(new UpdateCardInput { Checking = true, InstalledVersion = "2026.10.4.3" });
|
||||
Check(checking.Kind == UpdateCardKind.Checking && !checking.ShowCheckButton, "checking: no buttons");
|
||||
|
||||
DateTime at = DateTime.Now.Date.AddHours(14).AddMinutes(5);
|
||||
var upToDate = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, InstalledVersion = "2026.10.4.3", LastChecked = at });
|
||||
Check(upToDate.Kind == UpdateCardKind.UpToDate && upToDate.Title == "RynthCore 2026.10.4.3 - up to date", "up to date: " + upToDate.Title);
|
||||
Check(upToDate.Detail == "Last checked at 14:05." && upToDate.ShowCheckButton && upToDate.ActionButton == null, "with the last check time and Check: " + upToDate.Detail);
|
||||
Check(upToDate.NewPluginsLine == null, "no new plugins, no line");
|
||||
|
||||
var error = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, Error = "No such host is known.", LastChecked = at, InstalledVersion = "2026.10.4.3" });
|
||||
Check(error.Kind == UpdateCardKind.Error && error.ShowCheckButton && error.Detail == "No such host is known. Last good check: at 14:05.", "error: " + error.Detail);
|
||||
|
||||
var core = UpdateCardModel.Build(new UpdateCardInput
|
||||
{
|
||||
HasCheck = true, InstalledVersion = "2026.10.4.3", CoreUpdateAvailable = true, AvailableVersion = "2026.10.5.1",
|
||||
ClientsRunning = 2, PendingPluginUpdates = new[] { "RynthAi" }, LastChecked = at,
|
||||
});
|
||||
Check(core.Kind == UpdateCardKind.CoreUpdate && core.Title == "RynthCore 2026.10.5.1 is available" && core.ActionButton == UpdateCardModel.UpdateCoreButton, "RynthCore update: version and Update button");
|
||||
Check(core.Detail.Contains("You have 2026.10.4.3") && core.Detail.Contains("installs once every game client is closed"), "says it installs once the game clients are closed");
|
||||
Check(core.Detail.Contains("Close your 2 game clients running RynthCore first."), "and how many are still running: " + core.Detail);
|
||||
Check(core.Detail.Contains("Plugin updates ready too: RynthAi."), "mentions plugin updates as well");
|
||||
Check(core.Compact == "Update available: RynthCore 2026.10.5.1", "compact line: " + core.Compact);
|
||||
var oneClient = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, CoreUpdateAvailable = true, AvailableVersion = "2026.10.5.1", ClientsRunning = 1 });
|
||||
Check(oneClient.Detail.Contains("Close your 1 game client running"), "one client: singular");
|
||||
|
||||
var plugins = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, InstalledVersion = "2026.10.5.1", PendingPluginUpdates = new[] { "RynthAi", "RynthNav map (539 MB download)" } });
|
||||
Check(plugins.Kind == UpdateCardKind.PluginUpdates && plugins.ActionButton == UpdateCardModel.UpdatePluginsButton && plugins.Detail.StartsWith("RynthAi, RynthNav map (539 MB download)."), "plugin updates: " + plugins.Detail);
|
||||
|
||||
var withNew = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, InstalledVersion = "2026.10.5.1", NewPlugins = new[] { "RynthOracle", "RynthInventory" } });
|
||||
Check(withNew.Kind == UpdateCardKind.UpToDate && withNew.NewPluginsLine == "New plugins available: RynthOracle, RynthInventory. See Available plugins on the Plugins tab.", "new plugins line: " + withNew.NewPluginsLine);
|
||||
|
||||
Check(UpdateCardModel.FormatWhen(new DateTime(2026, 10, 3, 9, 7, 0), new DateTime(2026, 10, 4, 12, 0, 0)) == "Oct 3 at 09:07", "an earlier day shows the date");
|
||||
}
|
||||
|
||||
private static void UpdateCardDownloading()
|
||||
{
|
||||
var p = new DownloadProgress("RynthNav map", DownloadStage.Downloading, 100L << 20, 400L << 20, 5 << 20, TimeSpan.FromMinutes(1));
|
||||
var card = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, CoreUpdateAvailable = true, AvailableVersion = "x", Download = p, CanCancel = true });
|
||||
Check(card.Kind == UpdateCardKind.Downloading && card.Title == "Downloading RynthNav map", "a download takes over the card: " + card.Title);
|
||||
Check(card.ShowProgress && card.ProgressPercent == 25 && card.ShowCancel && card.ActionButton == null && !card.ShowCheckButton, "bar at 25%, Cancel, no other buttons");
|
||||
Check(card.Detail == "100 of 400 MB · 5.0 MB/s · about 1m00s left", "MB, speed, time left: " + card.Detail);
|
||||
var unpack = UpdateCardModel.Build(new UpdateCardInput { Download = p with { Stage = DownloadStage.Unpacking, Done = 10, Total = 40 } });
|
||||
Check(unpack.Title == "Unpacking RynthNav map" && unpack.ProgressPercent == 25, "the step after the download");
|
||||
var install = UpdateCardModel.Build(new UpdateCardInput { Download = p with { Stage = DownloadStage.Installing, Done = 0, Total = 0 }, CanCancel = true });
|
||||
Check(install.Title == "Installing RynthNav map" && install.ProgressPercent == null && !install.ShowCancel, "installing: indeterminate, no Cancel");
|
||||
var verified = UpdateCardModel.Build(new UpdateCardInput { Download = p with { Stage = DownloadStage.Verified } });
|
||||
Check(verified.Title == "RynthNav map: verified", "verified step shown");
|
||||
}
|
||||
|
||||
private static void UpdateCardWhatsNew()
|
||||
{
|
||||
var six = new[] { "One.", "Two.", "Three.", "Four.", "Five.", "Six." };
|
||||
var card = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, CoreUpdateAvailable = true, AvailableVersion = "2026.10.5.1", Changes = six, Notes = "All of it." });
|
||||
Check(card.WhatsNew.SequenceEqual(new[] { "One.", "Two.", "Three.", "Four.", "…and 2 more." }), "a few of the changes: " + string.Join(" | ", card.WhatsNew));
|
||||
var old = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, CoreUpdateAvailable = true, AvailableVersion = "2026.10.5.1", Notes = "Old feeds only have notes." });
|
||||
Check(old.WhatsNew.SequenceEqual(new[] { "Old feeds only have notes." }), "an old feed shows its notes");
|
||||
var upToDate = UpdateCardModel.Build(new UpdateCardInput { HasCheck = true, Changes = six });
|
||||
Check(upToDate.WhatsNew.Count == 0, "nothing to install: no what's new");
|
||||
Check(UpdateCardModel.WhatsNew(Array.Empty<string>(), new string('n', 500))[0].Length == 300, "long notes are cut");
|
||||
}
|
||||
}
|
||||
25
tools/NavDataUpdateTests/NavDataUpdateTests.csproj
Normal file
25
tools/NavDataUpdateTests/NavDataUpdateTests.csproj
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline tests for the launcher's RynthNav tile update (RynthUpdater.NavData.cs): a signed
|
||||
feed with a "navdata" archive, served from a local HttpListener, installed into temp folders.
|
||||
Nothing outside %TEMP% is read or written.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>NavDataUpdateTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\RynthUpdater.cs" Link="Linked\RynthUpdater.cs" />
|
||||
<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\DownloadProgress.cs" Link="Linked\DownloadProgress.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\UpdateTrust.cs" Link="Linked\UpdateTrust.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
404
tools/NavDataUpdateTests/Program.cs
Normal file
404
tools/NavDataUpdateTests/Program.cs
Normal file
|
|
@ -0,0 +1,404 @@
|
|||
using System.IO.Compression;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using RynthCore.App.Avalonia;
|
||||
|
||||
// Tests for the launcher's RynthNav tile update. A throwaway signing key signs a feed served by
|
||||
// a local HttpListener; the updater installs the archive into a temp NavData folder.
|
||||
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 string _root = "";
|
||||
private static string _base = "";
|
||||
private static readonly Dictionary<string, byte[]> Served = new();
|
||||
private static ECDsa _key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
|
||||
private static async Task<int> Main()
|
||||
{
|
||||
_root = Path.Combine(Path.GetTempPath(), "rnav-upd-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(_root);
|
||||
int port = FreePort();
|
||||
_base = $"http://localhost:{port}/rynth/";
|
||||
using var http = new HttpListener();
|
||||
http.Prefixes.Add(_base);
|
||||
http.Start();
|
||||
_ = Task.Run(() => Serve(http));
|
||||
try
|
||||
{
|
||||
await Run(nameof(NoNavDataInFeed), NoNavDataInFeed);
|
||||
await Run(nameof(NotInstalledWithoutRynthNav), NotInstalledWithoutRynthNav);
|
||||
await Run(nameof(InstallsAndKeepsPlayerFiles), InstallsAndKeepsPlayerFiles);
|
||||
await Run(nameof(LocalTilesLeftAlone), LocalTilesLeftAlone);
|
||||
await Run(nameof(SettingsFolderIsUsed), SettingsFolderIsUsed);
|
||||
await Run(nameof(RejectsBadArchive), RejectsBadArchive);
|
||||
await Run(nameof(RejectsTamperedArchive), RejectsTamperedArchive);
|
||||
await Run(nameof(RejectsUnsignedNavData), RejectsUnsignedNavData);
|
||||
await Run(nameof(ReportsProgressToTheEnd), ReportsProgressToTheEnd);
|
||||
await Run(nameof(CancelledDownloadLeavesNothing), CancelledDownloadLeavesNothing);
|
||||
await Run(nameof(CancelledUnpackLeavesTilesAsTheyWere), CancelledUnpackLeavesTilesAsTheyWere);
|
||||
await Run(nameof(TamperedArchiveRefusedWithProgress), TamperedArchiveRefusedWithProgress);
|
||||
}
|
||||
finally
|
||||
{
|
||||
http.Stop();
|
||||
try { Directory.Delete(_root, true); } catch { }
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(_fails == 0 && _asserts > 0 ? $"PASS ({_asserts} assertions)" : $"FAIL ({_fails} of {_asserts} assertions failed)");
|
||||
return _fails == 0 && _asserts > 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static async Task Run(string name, Func<Task> test)
|
||||
{
|
||||
int before = _fails;
|
||||
try { await test(); }
|
||||
catch (Exception ex) { _fails++; _asserts++; Console.WriteLine($" [FAIL] {name} threw {ex.GetType().Name}: {ex.Message}"); }
|
||||
Console.WriteLine($"{(_fails == before ? "ok " : "FAIL")} {name}");
|
||||
}
|
||||
|
||||
// ── Fixtures ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static int FreePort()
|
||||
{
|
||||
var l = new TcpListener(IPAddress.Loopback, 0);
|
||||
l.Start();
|
||||
int p = ((IPEndPoint)l.LocalEndpoint).Port;
|
||||
l.Stop();
|
||||
return p;
|
||||
}
|
||||
|
||||
private static async Task Serve(HttpListener http)
|
||||
{
|
||||
while (http.IsListening)
|
||||
{
|
||||
HttpListenerContext ctx;
|
||||
try { ctx = await http.GetContextAsync(); } catch { return; }
|
||||
string name = ctx.Request.Url!.AbsolutePath.Replace("/rynth/", "");
|
||||
byte[]? body;
|
||||
lock (Served) Served.TryGetValue(name, out body);
|
||||
if (body == null) { ctx.Response.StatusCode = 404; ctx.Response.Close(); continue; }
|
||||
ctx.Response.StatusCode = 200;
|
||||
ctx.Response.ContentLength64 = body.Length;
|
||||
HttpListenerContext c = ctx;
|
||||
byte[] b = body;
|
||||
// Big files go out in pieces with a pause between them, like a real connection, so a
|
||||
// download is still running when progress is reported (and can be cancelled half way).
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int off = 0; off < b.Length; off += 64 * 1024)
|
||||
{
|
||||
int n = Math.Min(64 * 1024, b.Length - off);
|
||||
await c.Response.OutputStream.WriteAsync(b.AsMemory(off, n));
|
||||
if (b.Length > 512 * 1024) await Task.Delay(25);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
finally { try { c.Response.Close(); } catch { } }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static string Sha(byte[] b) => Convert.ToHexString(SHA256.HashData(b)).ToLowerInvariant();
|
||||
|
||||
/// <summary>A zip of the given files (name -> content).</summary>
|
||||
private static byte[] Zip(Dictionary<string, string> files)
|
||||
{
|
||||
using var ms = new MemoryStream();
|
||||
using (var za = new ZipArchive(ms, ZipArchiveMode.Create, leaveOpen: true))
|
||||
foreach (var (n, c) in files)
|
||||
{
|
||||
using var s = za.CreateEntry(n).Open();
|
||||
s.Write(Encoding.UTF8.GetBytes(c));
|
||||
}
|
||||
return ms.ToArray();
|
||||
}
|
||||
|
||||
private static readonly Dictionary<string, string> TileSet = new()
|
||||
{
|
||||
["nav_A9B4.tile"] = "tile A9B4 v2",
|
||||
["nav_A9B5.tile"] = "tile A9B5 v2",
|
||||
["nav_AAB4.tile"] = "tile AAB4 v2",
|
||||
["portals.tsv"] = "1\t2\t3\t4\tportal",
|
||||
["locations.json"] = "{\"locations\":[]}",
|
||||
["navgraph.bin"] = "route graph",
|
||||
["townnet.json"] = "{\"version\":1}",
|
||||
};
|
||||
|
||||
// The feed's URLs must sit in the feed's folder: serve each test's archive under it.
|
||||
private static (RynthUpdater upd, string nav, string plugin, string state) SetupInFeedFolder(string tag, byte[]? zip, string id = "0123456789abcdef0123456789abcdef",
|
||||
int? files = null, bool signNavData = true, bool withNavData = true, string? overrideSha = null)
|
||||
{
|
||||
string zipName = $"{tag}/releases/1/RynthNav-NavData.zip";
|
||||
string dir = Path.Combine(_root, tag);
|
||||
string state = Path.Combine(dir, "state"), app = Path.Combine(dir, "app"), nav = Path.Combine(dir, "NavData"), cache = Path.Combine(dir, "cache");
|
||||
Directory.CreateDirectory(state); Directory.CreateDirectory(app);
|
||||
string plugin = Path.Combine(dir, "RynthNav", "RynthCore.Plugin.RynthNav.dll");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(plugin)!);
|
||||
File.WriteAllText(plugin, "not a real dll");
|
||||
if (zip != null) lock (Served) Served[zipName] = zip;
|
||||
var manifest = new Dictionary<string, object?>
|
||||
{
|
||||
["schema"] = 1, ["release"] = 2026100201, ["version"] = "2026.10.2.1",
|
||||
["published"] = "2026-10-02T00:00:00Z", ["notes"] = "test",
|
||||
["core"] = new Dictionary<string, object> { ["release"] = 2026100201, ["version"] = "2026.10.2.1", ["url"] = _base + $"{tag}/releases/1/RynthCore-Setup.exe", ["size"] = 1, ["sha256"] = "00" },
|
||||
["plugins"] = Array.Empty<object>(),
|
||||
};
|
||||
var nd = zip == null ? null : new Dictionary<string, object>
|
||||
{
|
||||
["id"] = id, ["release"] = 2026100201, ["url"] = _base + zipName, ["size"] = zip.Length,
|
||||
["sha256"] = overrideSha ?? Sha(zip), ["files"] = files ?? TileSet.Count, ["bytes"] = 1000,
|
||||
};
|
||||
if (withNavData && nd != null && signNavData) manifest["navdata"] = nd;
|
||||
byte[] signedPayload = JsonSerializer.SerializeToUtf8Bytes(manifest);
|
||||
if (withNavData && nd != null && !signNavData) manifest["navdata"] = nd; // served, but not what was signed
|
||||
byte[] payload = JsonSerializer.SerializeToUtf8Bytes(manifest);
|
||||
byte[] sig = _key.SignData(signedPayload, HashAlgorithmName.SHA256, DSASignatureFormat.IeeeP1363FixedFieldConcatenation);
|
||||
byte[] spki = _key.ExportSubjectPublicKeyInfo();
|
||||
string envelope = JsonSerializer.Serialize(new { payload = Convert.ToBase64String(payload), signatures = new[] { new { key = RynthUpdater.KeyId(spki), sig = Convert.ToBase64String(sig) } } });
|
||||
lock (Served) Served[$"{tag}/update.json"] = Encoding.UTF8.GetBytes(envelope);
|
||||
var upd = new RynthUpdater(_base + $"{tag}/update.json", new[] { Convert.ToBase64String(spki) }, state, app);
|
||||
upd.SetDefaultNavDataDir(nav);
|
||||
upd.NavDataCacheDir = cache;
|
||||
return (upd, nav, plugin, state);
|
||||
}
|
||||
|
||||
private static void OldNavData(string nav)
|
||||
{
|
||||
Directory.CreateDirectory(nav);
|
||||
File.WriteAllText(Path.Combine(nav, "nav_A9B4.tile"), "tile A9B4 June");
|
||||
File.WriteAllText(Path.Combine(nav, "nav_0101.tile"), "a stale June tile not in the new set");
|
||||
File.WriteAllText(Path.Combine(nav, "portals.tsv"), "old portals");
|
||||
File.WriteAllText(Path.Combine(nav, "atlas.txt"), "my favorites");
|
||||
File.WriteAllText(Path.Combine(nav, "recalls.txt"), "my recalls");
|
||||
}
|
||||
|
||||
// ── Tests ────────────────────────────────────────────────────────────────
|
||||
|
||||
private static async Task NoNavDataInFeed()
|
||||
{
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("none", Zip(TileSet), withNavData: false);
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
Check(c.Manifest.NavData == null && c.NavData == null && !c.NavDataUpdateAvailable, "a feed without navdata (every feed so far) still parses, nothing to do");
|
||||
}
|
||||
|
||||
private static async Task NotInstalledWithoutRynthNav()
|
||||
{
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("nonav", Zip(TileSet));
|
||||
var c = await upd.CheckAsync(new[] { Path.Combine(Path.GetDirectoryName(plugin)!, "RynthCore.Plugin.RynthAi.dll") });
|
||||
Check(c.Manifest.NavData != null, "the feed's navdata parses");
|
||||
Check(c.NavData == null, "no RynthNav in the plugin list: no tiles");
|
||||
}
|
||||
|
||||
private static async Task InstallsAndKeepsPlayerFiles()
|
||||
{
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("install", Zip(TileSet));
|
||||
OldNavData(nav);
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
Check(c.NavData is { State: RynthUpdater.NavDataState.NeedsUpdate }, "June tiles (no navdata.id): update needed");
|
||||
string line = await upd.UpdateNavDataAsync(c);
|
||||
Check(line.Contains($"{TileSet.Count} files"), "reports what it installed: " + line);
|
||||
Check(File.ReadAllText(Path.Combine(nav, "navgraph.bin")) == "route graph", "the route graph ships with the tiles");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "townnet.json")) == "{\"version\":1}", "the Town Network ships with the tiles");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "nav_A9B4.tile")) == "tile A9B4 v2", "the tile is the new one");
|
||||
Check(File.Exists(Path.Combine(nav, "nav_AAB4.tile")), "new tiles are there");
|
||||
Check(!File.Exists(Path.Combine(nav, "nav_0101.tile")), "a stale tile from the old set is gone (old and new don't link)");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "portals.tsv")).Contains("portal"), "portals.tsv replaced");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "atlas.txt")) == "my favorites", "atlas.txt kept");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "recalls.txt")) == "my recalls", "recalls.txt kept");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "navdata.id")) == "0123456789abcdef0123456789abcdef", "navdata.id written");
|
||||
Check(File.ReadAllText(Path.Combine(nav + ".previous", "nav_0101.tile")).Contains("June"), "the old folder is kept as NavData.previous");
|
||||
Check(!Directory.Exists(nav + ".new"), "no staging folder left behind");
|
||||
c = await upd.CheckAsync(new[] { plugin });
|
||||
Check(c.NavData is { State: RynthUpdater.NavDataState.UpToDate } && !c.NavDataUpdateAvailable, "a second check: up to date");
|
||||
Check(await upd.UpdateNavDataAsync(c) == "", "nothing to do when up to date");
|
||||
}
|
||||
|
||||
private static async Task LocalTilesLeftAlone()
|
||||
{
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("local", Zip(TileSet));
|
||||
OldNavData(nav);
|
||||
File.WriteAllText(Path.Combine(nav, "navdata.local"), "");
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
Check(c.NavData is { State: RynthUpdater.NavDataState.LocalTiles } && !c.NavDataUpdateAvailable, "navdata.local: left alone");
|
||||
await upd.UpdateNavDataAsync(c);
|
||||
Check(File.ReadAllText(Path.Combine(nav, "nav_A9B4.tile")) == "tile A9B4 June", "local tiles untouched");
|
||||
}
|
||||
|
||||
private static async Task SettingsFolderIsUsed()
|
||||
{
|
||||
var (upd, nav, plugin, state) = SetupInFeedFolder("settings", Zip(TileSet));
|
||||
string other = Path.Combine(_root, "settings", "Elsewhere", "NavData");
|
||||
File.WriteAllText(Path.Combine(state, "rynthnav.json"), JsonSerializer.Serialize(new { navDataDir = other }));
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
Check(c.NavData != null && c.NavData.Dir == other, "rynthnav.json's navDataDir is where the tiles go");
|
||||
await upd.UpdateNavDataAsync(c);
|
||||
Check(File.Exists(Path.Combine(other, "nav_A9B4.tile")) && !Directory.Exists(nav), "installed there, not in the default");
|
||||
}
|
||||
|
||||
private static async Task RejectsBadArchive()
|
||||
{
|
||||
var evil = new Dictionary<string, string>(TileSet) { ["../evil.txt"] = "x" };
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("evil", Zip(evil), files: evil.Count);
|
||||
OldNavData(nav);
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
bool threw = false;
|
||||
try { await upd.UpdateNavDataAsync(c); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "a path outside the folder is refused");
|
||||
Check(!File.Exists(Path.Combine(_root, "evil", "evil.txt")), "nothing written outside");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "nav_A9B4.tile")) == "tile A9B4 June" && !Directory.Exists(nav + ".new"), "the installed folder is as it was, no staging left");
|
||||
|
||||
var odd = new Dictionary<string, string>(TileSet) { ["run.exe"] = "x" };
|
||||
(upd, nav, plugin, _) = SetupInFeedFolder("odd", Zip(odd), files: odd.Count);
|
||||
c = await upd.CheckAsync(new[] { plugin });
|
||||
threw = false;
|
||||
try { await upd.UpdateNavDataAsync(c); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "a file RynthNav doesn't read is refused");
|
||||
|
||||
(upd, nav, plugin, _) = SetupInFeedFolder("count", Zip(TileSet), files: TileSet.Count + 1);
|
||||
c = await upd.CheckAsync(new[] { plugin });
|
||||
threw = false;
|
||||
try { await upd.UpdateNavDataAsync(c); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "a file count that doesn't match the feed is refused");
|
||||
}
|
||||
|
||||
private static async Task RejectsTamperedArchive()
|
||||
{
|
||||
byte[] zip = Zip(TileSet);
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("tamper", zip);
|
||||
OldNavData(nav);
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
byte[] bad = (byte[])zip.Clone(); bad[bad.Length / 2] ^= 0xFF;
|
||||
lock (Served) Served["tamper/releases/1/RynthNav-NavData.zip"] = bad;
|
||||
bool threw = false;
|
||||
try { await upd.UpdateNavDataAsync(c); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "an archive that doesn't match the signed hash is refused");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "nav_A9B4.tile")) == "tile A9B4 June", "and nothing changes");
|
||||
}
|
||||
|
||||
/// <summary>Calls back on the reporting thread (Progress<T> would post to the thread pool).</summary>
|
||||
private sealed class SyncProgress(Action<DownloadProgress> onReport) : IProgress<DownloadProgress>
|
||||
{
|
||||
public void Report(DownloadProgress value) => onReport(value);
|
||||
}
|
||||
|
||||
/// <summary>The tile set plus an incompressible file, so the archive takes many reads.</summary>
|
||||
private static Dictionary<string, string> BigTileSet()
|
||||
{
|
||||
var rnd = new Random(42);
|
||||
var sb = new StringBuilder();
|
||||
for (int i = 0; i < 1_500_000; i++) sb.Append((char)rnd.Next(0x21, 0x7E));
|
||||
return new Dictionary<string, string>(TileSet) { ["navgraph.bin"] = sb.ToString() };
|
||||
}
|
||||
|
||||
private static async Task ReportsProgressToTheEnd()
|
||||
{
|
||||
var big = BigTileSet();
|
||||
byte[] zip = Zip(big);
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("progress", zip);
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
var reports = new List<DownloadProgress>();
|
||||
await upd.UpdateNavDataAsync(c, new SyncProgress(p => { lock (reports) reports.Add(p); }));
|
||||
var dl = reports.Where(r => r.Stage == DownloadStage.Downloading).ToList();
|
||||
Check(dl.Count >= 2, $"download progress reported ({dl.Count} reports)");
|
||||
Check(dl.All(r => r.What == RynthUpdater.NavDataDisplayName && r.Total == zip.Length), "each names the map and the signed size");
|
||||
Check(dl.Zip(dl.Skip(1)).All(p => p.Second.Done >= p.First.Done), "bytes only go up");
|
||||
Check(dl.Last().Done == zip.Length && dl.Last().Percent == 100, "the download reaches 100%");
|
||||
var verified = reports.FirstOrDefault(r => r.Stage == DownloadStage.Verified);
|
||||
Check(verified != null && verified.Summary.StartsWith("RynthNav map: ") && verified.Summary.EndsWith(", verified"), "a Verified step with the log line: " + verified?.Summary);
|
||||
var unpack = reports.Where(r => r.Stage == DownloadStage.Unpacking).ToList();
|
||||
Check(unpack.Count >= 1 && unpack.Last().Done == big.Count && unpack.Last().Total == big.Count, "unpacking counts to every file");
|
||||
Check(reports.Last().Stage == DownloadStage.Installing, "installing is the last step");
|
||||
int vi = reports.IndexOf(verified!), ui = reports.FindIndex(r => r.Stage == DownloadStage.Unpacking);
|
||||
Check(vi > 0 && ui > vi, "steps in order: download, verify, unpack, install");
|
||||
Check(File.Exists(Path.Combine(nav, "navgraph.bin")), "and it is installed");
|
||||
}
|
||||
|
||||
private static async Task CancelledDownloadLeavesNothing()
|
||||
{
|
||||
byte[] zip = Zip(BigTileSet());
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("cancel", zip);
|
||||
OldNavData(nav);
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
using var cts = new CancellationTokenSource();
|
||||
bool threw = false, halfWay = false;
|
||||
string cachePart = Path.Combine(_root, "cancel", "cache", "navdata-0123456789abcdef0123456789abcdef.zip.part");
|
||||
bool partExisted = false;
|
||||
try
|
||||
{
|
||||
await upd.UpdateNavDataAsync(c, new SyncProgress(p =>
|
||||
{
|
||||
if (p.Stage == DownloadStage.Downloading && p.Done > 0 && p.Done < p.Total)
|
||||
{
|
||||
halfWay = true;
|
||||
partExisted = File.Exists(cachePart);
|
||||
cts.Cancel();
|
||||
}
|
||||
}), cts.Token);
|
||||
}
|
||||
catch (OperationCanceledException) { threw = true; }
|
||||
Check(halfWay && partExisted, "cancelled half way, with a partial file on disk at that moment");
|
||||
Check(threw, "Cancel during the download stops it");
|
||||
string cache = Path.Combine(_root, "cancel", "cache");
|
||||
Check(!Directory.Exists(cache) || Directory.GetFiles(cache).Length == 0, "no partial (or any) archive left in the cache");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "nav_A9B4.tile")) == "tile A9B4 June" && !Directory.Exists(nav + ".new"), "the installed tiles are as they were, no staging");
|
||||
|
||||
// The next try downloads and installs normally.
|
||||
c = await upd.CheckAsync(new[] { plugin });
|
||||
await upd.UpdateNavDataAsync(c);
|
||||
Check(File.ReadAllText(Path.Combine(nav, "nav_A9B4.tile")) == "tile A9B4 v2", "a later try installs");
|
||||
}
|
||||
|
||||
private static async Task CancelledUnpackLeavesTilesAsTheyWere()
|
||||
{
|
||||
byte[] zip = Zip(BigTileSet());
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("cancelunpack", zip);
|
||||
OldNavData(nav);
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
using var cts = new CancellationTokenSource();
|
||||
bool threw = false;
|
||||
try { await upd.UpdateNavDataAsync(c, new SyncProgress(p => { if (p.Stage == DownloadStage.Unpacking) cts.Cancel(); }), cts.Token); }
|
||||
catch (OperationCanceledException) { threw = true; }
|
||||
Check(threw, "Cancel while unpacking stops it");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "nav_A9B4.tile")) == "tile A9B4 June" && File.Exists(Path.Combine(nav, "nav_0101.tile")), "the installed tiles are as they were");
|
||||
Check(!Directory.Exists(nav + ".new") && !Directory.Exists(nav + ".previous"), "no staging folder, no swap");
|
||||
string cache = Path.Combine(_root, "cancelunpack", "cache");
|
||||
Check(Directory.GetFiles(cache, "*.part").Length == 0, "no partial file in the cache (the verified archive may stay for the next try)");
|
||||
}
|
||||
|
||||
private static async Task TamperedArchiveRefusedWithProgress()
|
||||
{
|
||||
byte[] zip = Zip(BigTileSet());
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("tamperprog", zip);
|
||||
OldNavData(nav);
|
||||
var c = await upd.CheckAsync(new[] { plugin });
|
||||
byte[] bad = (byte[])zip.Clone(); bad[bad.Length / 3] ^= 0x55;
|
||||
lock (Served) Served["tamperprog/releases/1/RynthNav-NavData.zip"] = bad;
|
||||
var reports = new List<DownloadProgress>();
|
||||
bool threw = false;
|
||||
try { await upd.UpdateNavDataAsync(c, new SyncProgress(reports.Add)); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "with progress on, a wrong hash is still refused");
|
||||
Check(!reports.Any(r => r.Stage is DownloadStage.Verified or DownloadStage.Unpacking), "never reported as verified, never unpacked");
|
||||
string cache = Path.Combine(_root, "tamperprog", "cache");
|
||||
Check(Directory.GetFiles(cache).Length == 0, "the bad download is deleted");
|
||||
Check(File.ReadAllText(Path.Combine(nav, "nav_A9B4.tile")) == "tile A9B4 June", "and nothing changes");
|
||||
}
|
||||
|
||||
private static async Task RejectsUnsignedNavData()
|
||||
{
|
||||
var (upd, nav, plugin, _) = SetupInFeedFolder("unsigned", Zip(TileSet), signNavData: false);
|
||||
bool threw = false;
|
||||
try { await upd.CheckAsync(new[] { plugin }); } catch (InvalidDataException) { threw = true; }
|
||||
Check(threw, "a navdata entry added after signing breaks the signature");
|
||||
}
|
||||
}
|
||||
395
tools/ProcPatchDiff.py
Normal file
395
tools/ProcPatchDiff.py
Normal file
|
|
@ -0,0 +1,395 @@
|
|||
"""ProcPatchDiff - which code in a running 32-bit process was patched, and by whom.
|
||||
|
||||
Read-only. For each module it compares the executable sections in memory with the
|
||||
on-disk image (relocated to the module's actual base) and lists every changed byte run.
|
||||
A run that starts with a jump (E9 rel32, EB rel8 -> E9, FF25 [abs], 68 imm32 C3) is
|
||||
followed - through simple jump stubs only - to the module that owns the destination,
|
||||
which names the patcher. It also checks acclient.exe's import table (IAT hooks) and the
|
||||
game window's WndProc. It never disassembles anything beyond reading one jump at a time.
|
||||
|
||||
Spike tool for the Decal-bridge analysis (docs: spikes/decal-bridge). Point it at TEST
|
||||
clients only.
|
||||
|
||||
python tools/ProcPatchDiff.py <pid> [--all] [--names <RynthCore.<pid>.log>] [--json out.json]
|
||||
|
||||
--all diff every module with a file on disk (default: acclient.exe + the system DLLs
|
||||
AC and its hookers use)
|
||||
--names annotate acclient.exe addresses with HookResolver names from an engine log
|
||||
"""
|
||||
import ctypes
|
||||
import ctypes.wintypes as wt
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import struct
|
||||
import sys
|
||||
|
||||
import pefile
|
||||
|
||||
PROCESS_QUERY_INFORMATION = 0x0400
|
||||
PROCESS_VM_READ = 0x0010
|
||||
LIST_MODULES_32BIT = 0x01
|
||||
IMAGE_SCN_MEM_EXECUTE = 0x20000000
|
||||
|
||||
k32 = ctypes.WinDLL("kernel32", use_last_error=True)
|
||||
psapi = ctypes.WinDLL("psapi", use_last_error=True)
|
||||
user32 = ctypes.WinDLL("user32", use_last_error=True)
|
||||
|
||||
k32.OpenProcess.restype = wt.HANDLE
|
||||
k32.OpenProcess.argtypes = [wt.DWORD, wt.BOOL, wt.DWORD]
|
||||
k32.ReadProcessMemory.argtypes = [wt.HANDLE, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t)]
|
||||
k32.VirtualQueryEx.restype = ctypes.c_size_t
|
||||
k32.VirtualQueryEx.argtypes = [wt.HANDLE, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t]
|
||||
psapi.EnumProcessModulesEx.argtypes = [wt.HANDLE, ctypes.POINTER(ctypes.c_void_p), wt.DWORD, ctypes.POINTER(wt.DWORD), wt.DWORD]
|
||||
psapi.GetModuleFileNameExW.argtypes = [wt.HANDLE, ctypes.c_void_p, wt.LPWSTR, wt.DWORD]
|
||||
|
||||
|
||||
class MODULEINFO(ctypes.Structure):
|
||||
_fields_ = [("lpBaseOfDll", ctypes.c_void_p), ("SizeOfImage", wt.DWORD), ("EntryPoint", ctypes.c_void_p)]
|
||||
|
||||
|
||||
class MBI(ctypes.Structure):
|
||||
_fields_ = [("BaseAddress", ctypes.c_ulonglong), ("AllocationBase", ctypes.c_ulonglong),
|
||||
("AllocationProtect", wt.DWORD), ("__a1", wt.DWORD), ("RegionSize", ctypes.c_ulonglong),
|
||||
("State", wt.DWORD), ("Protect", wt.DWORD), ("Type", wt.DWORD), ("__a2", wt.DWORD)]
|
||||
|
||||
|
||||
psapi.GetModuleInformation.argtypes = [wt.HANDLE, ctypes.c_void_p, ctypes.POINTER(MODULEINFO), wt.DWORD]
|
||||
|
||||
DEFAULT_MODULES = {
|
||||
"acclient.exe", "kernel32.dll", "kernelbase.dll", "ntdll.dll", "user32.dll", "win32u.dll",
|
||||
"gdi32.dll", "d3d9.dll", "dinput8.dll", "dinput.dll", "ws2_32.dll", "wsock32.dll",
|
||||
"mswsock.dll", "winmm.dll", "ole32.dll", "combase.dll", "imm32.dll", "dsound.dll",
|
||||
}
|
||||
|
||||
|
||||
class Proc:
|
||||
def __init__(self, pid):
|
||||
self.pid = pid
|
||||
self.h = k32.OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, False, pid)
|
||||
if not self.h:
|
||||
raise OSError(f"OpenProcess({pid}) failed: {ctypes.get_last_error()}")
|
||||
self.mods = self._modules()
|
||||
|
||||
def read(self, addr, size):
|
||||
buf = ctypes.create_string_buffer(size)
|
||||
got = ctypes.c_size_t(0)
|
||||
if not k32.ReadProcessMemory(self.h, ctypes.c_void_p(addr), buf, size, ctypes.byref(got)):
|
||||
return None
|
||||
return buf.raw[: got.value]
|
||||
|
||||
def dword(self, addr):
|
||||
b = self.read(addr, 4)
|
||||
return struct.unpack("<I", b)[0] if b and len(b) == 4 else None
|
||||
|
||||
def _modules(self):
|
||||
arr = (ctypes.c_void_p * 1024)()
|
||||
needed = wt.DWORD(0)
|
||||
if not psapi.EnumProcessModulesEx(self.h, arr, ctypes.sizeof(arr), ctypes.byref(needed), LIST_MODULES_32BIT):
|
||||
raise OSError(f"EnumProcessModulesEx failed: {ctypes.get_last_error()}")
|
||||
mods = []
|
||||
for i in range(needed.value // ctypes.sizeof(ctypes.c_void_p)):
|
||||
hm = arr[i]
|
||||
name = ctypes.create_unicode_buffer(520)
|
||||
psapi.GetModuleFileNameExW(self.h, hm, name, 520)
|
||||
mi = MODULEINFO()
|
||||
psapi.GetModuleInformation(self.h, hm, ctypes.byref(mi), ctypes.sizeof(mi))
|
||||
path = name.value
|
||||
# A 64-bit reader is told System32 for a WOW64 process's DLLs; the 32-bit
|
||||
# files it actually loaded live in SysWOW64.
|
||||
sys32 = os.path.join(os.environ.get("SystemRoot", r"C:\Windows"), "System32") + "\\"
|
||||
if path.lower().startswith(sys32.lower()) and (mi.lpBaseOfDll or 0) < 0x100000000:
|
||||
wow = os.path.join(os.environ.get("SystemRoot", r"C:\Windows"), "SysWOW64", path[len(sys32):])
|
||||
if os.path.exists(wow):
|
||||
path = wow
|
||||
mods.append({"base": mi.lpBaseOfDll or 0, "size": mi.SizeOfImage, "path": path,
|
||||
"name": os.path.basename(path)})
|
||||
return sorted(mods, key=lambda m: m["base"])
|
||||
|
||||
def module_at(self, addr):
|
||||
for m in self.mods:
|
||||
if m["base"] <= addr < m["base"] + m["size"]:
|
||||
return m
|
||||
return None
|
||||
|
||||
def alloc_base(self, addr):
|
||||
mbi = MBI()
|
||||
if k32.VirtualQueryEx(self.h, ctypes.c_void_p(addr), ctypes.byref(mbi), ctypes.sizeof(mbi)) == 0:
|
||||
return None
|
||||
return mbi.AllocationBase
|
||||
|
||||
|
||||
def decode_jump(p, addr):
|
||||
"""Destination of a simple jump at addr, or None. Reads only the jump itself."""
|
||||
b = p.read(addr, 8)
|
||||
if not b or len(b) < 6:
|
||||
return None
|
||||
if b[0] == 0xE9:
|
||||
return (addr + 5 + struct.unpack("<i", b[1:5])[0]) & 0xFFFFFFFF, "jmp rel32"
|
||||
if b[0] == 0xEB:
|
||||
return (addr + 2 + struct.unpack("<b", b[1:2])[0]) & 0xFFFFFFFF, "jmp rel8"
|
||||
if b[0] == 0xFF and b[1] == 0x25:
|
||||
slot = struct.unpack("<I", b[2:6])[0]
|
||||
dst = p.dword(slot)
|
||||
return (dst, f"jmp [0x{slot:08X}]") if dst is not None else None
|
||||
if b[0] == 0x68 and b[5] == 0xC3:
|
||||
return struct.unpack("<I", b[1:5])[0], "push/ret"
|
||||
return None
|
||||
|
||||
|
||||
def owner_of(p, addr, hops=5):
|
||||
"""Follow simple jump stubs from addr; return (owner description, chain)."""
|
||||
chain = []
|
||||
cur = addr
|
||||
for _ in range(hops):
|
||||
m = p.module_at(cur)
|
||||
if m is not None:
|
||||
chain.append(f"{m['name']}+0x{cur - m['base']:X}")
|
||||
return m["name"], chain
|
||||
j = decode_jump(p, cur)
|
||||
ab = p.alloc_base(cur)
|
||||
chain.append(f"private@0x{cur:08X}(alloc 0x{(ab or 0):08X})")
|
||||
head = p.read(cur, 10) or b""
|
||||
if len(head) == 10 and head[0] == 0xB8 and head[5] == 0xE9:
|
||||
# mov eax, <entry>; jmp <stub>: the .NET Framework reverse-P/Invoke thunk shape,
|
||||
# i.e. a delegate from managed code (a .NET extension) is the hook.
|
||||
return "managed thunk (.NET delegate)", chain
|
||||
if j is None:
|
||||
return f"private(alloc 0x{(ab or 0):08X})", chain
|
||||
dst, kind = j
|
||||
if kind.startswith("jmp [") :
|
||||
slot = int(re.search(r"0x([0-9A-Fa-f]+)", kind).group(1), 16)
|
||||
sm = p.module_at(slot)
|
||||
if sm is not None:
|
||||
# A stub whose slot lives in a module (e.g. the RynthCore loader's facade).
|
||||
chain.append(f"slot in {sm['name']}")
|
||||
dm = p.module_at(dst)
|
||||
return (f"{sm['name']} stub -> {dm['name'] if dm else 'private'}"), chain
|
||||
cur = dst
|
||||
return "unresolved", chain
|
||||
|
||||
|
||||
def export_names(pe, base):
|
||||
names = {}
|
||||
if hasattr(pe, "DIRECTORY_ENTRY_EXPORT"):
|
||||
for e in pe.DIRECTORY_ENTRY_EXPORT.symbols:
|
||||
if e.name:
|
||||
names[base + e.address] = e.name.decode(errors="replace")
|
||||
return names
|
||||
|
||||
|
||||
def nearest_name(addr, names):
|
||||
best = None
|
||||
for a, n in names.items():
|
||||
if a <= addr and (best is None or a > best[0]):
|
||||
best = (a, n)
|
||||
if best is None or addr - best[0] > 0x40:
|
||||
return None
|
||||
return best[1] if best[0] == addr else f"{best[1]}+0x{addr - best[0]:X}"
|
||||
|
||||
|
||||
def diff_module(p, m, names_extra=None):
|
||||
try:
|
||||
pe = pefile.PE(m["path"], fast_load=True)
|
||||
except Exception as ex:
|
||||
return {"module": m["name"], "error": str(ex)}
|
||||
pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_BASERELOC"],
|
||||
pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_EXPORT"],
|
||||
pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_IMPORT"]])
|
||||
# System DLLs keep their IAT inside .text: name the slots so an IAT hook reads as one.
|
||||
iat_names = {}
|
||||
for ent in getattr(pe, "DIRECTORY_ENTRY_IMPORT", []):
|
||||
for imp in ent.imports:
|
||||
nm = (imp.name or b"#" + str(imp.ordinal).encode()).decode(errors="replace")
|
||||
iat_names[imp.address - pe.OPTIONAL_HEADER.ImageBase + m["base"]] = f"{ent.dll.decode()}!{nm}"
|
||||
if pe.OPTIONAL_HEADER.ImageBase != m["base"]:
|
||||
pe.relocate_image(m["base"])
|
||||
names = export_names(pe, m["base"])
|
||||
if names_extra:
|
||||
names.update(names_extra)
|
||||
patches = []
|
||||
for s in pe.sections:
|
||||
if not (s.Characteristics & IMAGE_SCN_MEM_EXECUTE):
|
||||
continue
|
||||
size = min(s.Misc_VirtualSize or s.SizeOfRawData, s.SizeOfRawData)
|
||||
disk = pe.get_data(s.VirtualAddress, size)
|
||||
mem = p.read(m["base"] + s.VirtualAddress, size)
|
||||
if mem is None or len(mem) != len(disk):
|
||||
patches.append({"section": s.Name.rstrip(b"\0").decode(), "error": "unreadable"})
|
||||
continue
|
||||
runs = []
|
||||
CH = 4096
|
||||
for off in range(0, size, CH):
|
||||
if disk[off:off + CH] == mem[off:off + CH]:
|
||||
continue
|
||||
for i in range(off, min(off + CH, size)):
|
||||
if disk[i] != mem[i]:
|
||||
if runs and i - runs[-1][1] <= 4:
|
||||
runs[-1][1] = i + 1
|
||||
else:
|
||||
runs.append([i, i + 1])
|
||||
for a, b in runs:
|
||||
va = m["base"] + s.VirtualAddress + a
|
||||
# A MinHook-style patch can keep its first byte (rare); start the decode a byte early
|
||||
# when the run doesn't begin with a known jump opcode.
|
||||
start = va
|
||||
j = decode_jump(p, start)
|
||||
if j is None and a > 0:
|
||||
j2 = decode_jump(p, va - 1)
|
||||
if j2 is not None:
|
||||
start, j = va - 1, j2
|
||||
entry = {
|
||||
"va": f"0x{start:08X}", "rva": f"0x{start - m['base']:X}", "len": b - a,
|
||||
"name": nearest_name(start, names),
|
||||
"disk": disk[a:b][:16].hex(), "mem": mem[a:b][:16].hex(),
|
||||
}
|
||||
if j is not None:
|
||||
dst, kind = j
|
||||
own, chain = owner_of(p, dst)
|
||||
entry.update({"kind": kind, "dest": f"0x{dst:08X}", "owner": own, "chain": chain})
|
||||
elif b - a == 4 and a > 0 and mem[a - 1] in (0xE8, 0xE9) and disk[a - 1] == mem[a - 1]:
|
||||
# The rel32 of an existing call/jmp was re-pointed: a call-site hook.
|
||||
site = va - 1
|
||||
dst = (va + 4 + struct.unpack("<i", mem[a:b])[0]) & 0xFFFFFFFF
|
||||
orig = (va + 4 + struct.unpack("<i", disk[a:b])[0]) & 0xFFFFFFFF
|
||||
own, chain = owner_of(p, dst)
|
||||
entry.update({"va": f"0x{site:08X}", "kind": "call-site" if mem[a - 1] == 0xE8 else "jmp-site",
|
||||
"dest": f"0x{dst:08X}", "orig_dest": f"0x{orig:08X}",
|
||||
"orig_name": nearest_name(orig, names), "owner": own, "chain": chain})
|
||||
elif b - a == 4 and iat_names and va in iat_names:
|
||||
val = struct.unpack("<I", mem[a:b])[0]
|
||||
own, chain = owner_of(p, val)
|
||||
entry.update({"kind": f"IAT slot {iat_names[va]}", "dest": f"0x{val:08X}", "owner": own, "chain": chain})
|
||||
elif b - a == 4:
|
||||
val = struct.unpack("<I", mem[a:b])[0]
|
||||
own, chain = owner_of(p, val)
|
||||
entry.update({"kind": "pointer?", "dest": f"0x{val:08X}", "owner": own, "chain": chain})
|
||||
else:
|
||||
entry.update({"kind": "data/other", "owner": "?"})
|
||||
patches.append(entry)
|
||||
return {"module": m["name"], "base": f"0x{m['base']:08X}", "patches": patches}
|
||||
|
||||
|
||||
def check_iat(p, m):
|
||||
pe = pefile.PE(m["path"], fast_load=True)
|
||||
pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_IMPORT"]])
|
||||
delta = m["base"] - pe.OPTIONAL_HEADER.ImageBase
|
||||
out = []
|
||||
for entry in getattr(pe, "DIRECTORY_ENTRY_IMPORT", []):
|
||||
dll = entry.dll.decode().lower()
|
||||
for imp in entry.imports:
|
||||
slot = imp.address + delta
|
||||
val = p.dword(slot)
|
||||
if val is None:
|
||||
continue
|
||||
owner = p.module_at(val)
|
||||
oname = owner["name"].lower() if owner else "private"
|
||||
system = owner is not None and owner["path"].lower().startswith(r"c:\windows")
|
||||
if not system and oname != dll:
|
||||
own, chain = owner_of(p, val)
|
||||
out.append({"import": f"{dll}!{(imp.name or b'#'+str(imp.ordinal).encode()).decode()}",
|
||||
"slot": f"0x{slot:08X}", "value": f"0x{val:08X}", "owner": own, "chain": chain})
|
||||
return out
|
||||
|
||||
|
||||
def check_wndproc(p):
|
||||
out = []
|
||||
GWL_WNDPROC = -4
|
||||
EnumWindowsProc = ctypes.WINFUNCTYPE(wt.BOOL, wt.HWND, wt.LPARAM)
|
||||
hwnds = []
|
||||
|
||||
def cb(hwnd, _):
|
||||
pid = wt.DWORD()
|
||||
user32.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))
|
||||
if pid.value == p.pid:
|
||||
hwnds.append(hwnd)
|
||||
return True
|
||||
|
||||
user32.GetWindowThreadProcessId.argtypes = [ctypes.c_void_p, ctypes.POINTER(wt.DWORD)]
|
||||
user32.GetWindowTextW.argtypes = [ctypes.c_void_p, wt.LPWSTR, ctypes.c_int]
|
||||
user32.IsWindowVisible.argtypes = [ctypes.c_void_p]
|
||||
user32.EnumWindows(EnumWindowsProc(cb), 0)
|
||||
user32.GetClassNameW.argtypes = [ctypes.c_void_p, wt.LPWSTR, ctypes.c_int]
|
||||
for hw in hwnds:
|
||||
cls = ctypes.create_unicode_buffer(256)
|
||||
user32.GetClassNameW(hw, cls, 256)
|
||||
title = ctypes.create_unicode_buffer(256)
|
||||
user32.GetWindowTextW(hw, title, 256)
|
||||
wp = 0 # GWL_WNDPROC is not answered across processes; the engine logs its chain in-process
|
||||
own, chain = owner_of(p, wp) if wp else ("?", [])
|
||||
out.append({"hwnd": f"0x{hw:X}", "class": cls.value, "title": title.value,
|
||||
"wndproc": f"0x{wp:08X}", "owner": own, "chain": chain,
|
||||
"visible": bool(user32.IsWindowVisible(hw))})
|
||||
return out
|
||||
|
||||
|
||||
def names_from_log(path):
|
||||
names = {}
|
||||
if not path:
|
||||
return names
|
||||
rx = re.compile(r"HookResolver\[([^\]]+)\]: RESOLVED via [\w-]+ @ 0x([0-9A-Fa-f]{8})")
|
||||
rx2 = re.compile(r"(\w+Hooks?): .*?(?:hooked|target=|ready @) ?.*?0x([0-9A-Fa-f]{8})")
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
for line in f:
|
||||
mm = rx.search(line)
|
||||
if mm:
|
||||
names.setdefault(int(mm.group(2), 16), mm.group(1))
|
||||
return names
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
print(__doc__)
|
||||
return 1
|
||||
pid = int(sys.argv[1])
|
||||
args = sys.argv[2:]
|
||||
all_mods = "--all" in args
|
||||
log = args[args.index("--names") + 1] if "--names" in args else None
|
||||
js = args[args.index("--json") + 1] if "--json" in args else None
|
||||
p = Proc(pid)
|
||||
extra = names_from_log(log)
|
||||
result = {"pid": pid, "modules": [], "diffs": [], "iat": [], "wndproc": []}
|
||||
for m in p.mods:
|
||||
result["modules"].append({"name": m["name"], "base": f"0x{m['base']:08X}", "size": m["size"], "path": m["path"]})
|
||||
for m in p.mods:
|
||||
if not (all_mods or m["name"].lower() in DEFAULT_MODULES):
|
||||
continue
|
||||
if not os.path.exists(m["path"]):
|
||||
continue
|
||||
d = diff_module(p, m, extra if m["name"].lower() == "acclient.exe" else None)
|
||||
if d.get("patches") or d.get("error"):
|
||||
result["diffs"].append(d)
|
||||
for m in p.mods:
|
||||
if m["name"].lower() == "acclient.exe":
|
||||
result["iat"] = check_iat(p, m)
|
||||
result["wndproc"] = check_wndproc(p)
|
||||
|
||||
print(f"pid {pid}: {len(p.mods)} modules")
|
||||
interesting = [m["name"] for m in p.mods if not m["path"].lower().startswith(r"c:\windows")]
|
||||
print("non-system modules: " + ", ".join(interesting))
|
||||
for d in result["diffs"]:
|
||||
if d.get("error"):
|
||||
print(f"== {d['module']}: {d['error']}")
|
||||
continue
|
||||
print(f"== {d['module']} @ {d['base']}: {len(d['patches'])} patched run(s)")
|
||||
for e in d["patches"]:
|
||||
if "error" in e:
|
||||
print(f" {e}")
|
||||
continue
|
||||
od = f" (was -> {e['orig_dest']} {e.get('orig_name') or ''})" if e.get('orig_dest') else ''
|
||||
print(f" {e['va']} {e.get('name') or ''} len={e['len']} {e.get('kind','')} -> {e.get('dest','')}{od} "
|
||||
f"owner={e.get('owner')} [{' > '.join(e.get('chain', []))}] disk={e['disk']} mem={e['mem']}")
|
||||
print(f"== IAT (acclient.exe) entries pointing outside system DLLs: {len(result['iat'])}")
|
||||
for e in result["iat"]:
|
||||
print(f" {e['import']} slot={e['slot']} -> {e['value']} owner={e['owner']}")
|
||||
print("== windows")
|
||||
for w in result["wndproc"]:
|
||||
print(f" {w['hwnd']} class={w['class']!r} title={w['title']!r} visible={w['visible']} wndproc={w['wndproc']} owner={w['owner']} [{' > '.join(w['chain'])}]")
|
||||
if js:
|
||||
with open(js, "w", encoding="utf-8") as f:
|
||||
json.dump(result, f, indent=1)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
229
tools/PropertyWireTests/AceWire.cs
Normal file
229
tools/PropertyWireTests/AceWire.cs
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
using System.Text;
|
||||
|
||||
namespace PropertyWireTests;
|
||||
|
||||
/// <summary>
|
||||
/// Builds messages byte for byte the way ACE writes them, from the part the client's
|
||||
/// UIQueueManager::ProcessNetBlobData hands on: a game event from its event type (the 0xF7B0
|
||||
/// header - guid, sequence - is already stripped), a top-level message from its opcode.
|
||||
/// Each writer below mirrors the ACE.Server code named in its comment.
|
||||
/// </summary>
|
||||
internal sealed class AceMessage
|
||||
{
|
||||
private readonly MemoryStream _ms = new();
|
||||
public readonly BinaryWriter W;
|
||||
|
||||
private AceMessage(uint first)
|
||||
{
|
||||
W = new BinaryWriter(_ms);
|
||||
W.Write(first);
|
||||
}
|
||||
|
||||
/// <summary>GameEventMessage: [F7B0][guid][seq][event type] - the client sees the type on.</summary>
|
||||
public static AceMessage GameEvent(uint eventType) => new(eventType);
|
||||
|
||||
/// <summary>GameMessage: the opcode, then the body.</summary>
|
||||
public static AceMessage Message(uint opcode) => new(opcode);
|
||||
|
||||
public byte[] ToArray() => _ms.ToArray();
|
||||
|
||||
private static uint PadMultiple(uint length, uint multiple) => multiple * ((length + multiple - 1u) / multiple) - length;
|
||||
|
||||
/// <summary>ACE Extensions.WriteString16L: u16 length, cp1252 bytes, pad (2 + length) to 4.</summary>
|
||||
public void String16L(string data)
|
||||
{
|
||||
W.Write((ushort)data.Length);
|
||||
W.Write(Encoding.Latin1.GetBytes(data));
|
||||
W.Write(new byte[PadMultiple(2u + (uint)data.Length, 4u)]);
|
||||
}
|
||||
|
||||
/// <summary>ACE Extensions.Align: pad the stream to a multiple of 4.</summary>
|
||||
public void Align() => W.Write(new byte[PadMultiple((uint)_ms.Length, 4u)]);
|
||||
|
||||
/// <summary>ACE PackableHashTable.WriteHeader: u16 count, u16 bucket count.</summary>
|
||||
public void HashHeader(int count, int buckets)
|
||||
{
|
||||
W.Write((ushort)count);
|
||||
W.Write((ushort)buckets);
|
||||
}
|
||||
|
||||
public void IntTable(Dictionary<uint, int> t) { HashHeader(t.Count, 16); foreach (var kv in t) { W.Write(kv.Key); W.Write(kv.Value); } }
|
||||
public void Int64Table(Dictionary<uint, long> t) { HashHeader(t.Count, 8); foreach (var kv in t) { W.Write(kv.Key); W.Write(kv.Value); } }
|
||||
public void BoolTable(Dictionary<uint, bool> t) { HashHeader(t.Count, 8); foreach (var kv in t) { W.Write(kv.Key); W.Write(Convert.ToUInt32(kv.Value)); } }
|
||||
public void FloatTable(Dictionary<uint, double> t) { HashHeader(t.Count, 8); foreach (var kv in t) { W.Write(kv.Key); W.Write(kv.Value); } }
|
||||
public void StringTable(Dictionary<uint, string> t) { HashHeader(t.Count, 8); foreach (var kv in t) { W.Write(kv.Key); String16L(kv.Value); } }
|
||||
public void UIntTable(Dictionary<uint, uint> t) { HashHeader(t.Count, 8); foreach (var kv in t) { W.Write(kv.Key); W.Write(kv.Value); } }
|
||||
}
|
||||
|
||||
/// <summary>ACE ArmorProfile: slash, pierce, bludgeon, cold, fire, acid, nether, lightning.</summary>
|
||||
internal sealed record ArmorProfile(float Slash, float Pierce, float Bludgeon, float Cold, float Fire, float Acid, float Nether, float Lightning);
|
||||
|
||||
/// <summary>ACE CreatureProfile (Flags: HasBuffsDebuffs 0x1, ShowAttributes 0x8).</summary>
|
||||
internal sealed record CreatureProfile(uint Flags, uint Health, uint HealthMax, uint[]? Attributes = null, ushort Highlights = 0, ushort Colors = 0);
|
||||
|
||||
/// <summary>ACE WeaponProfile.</summary>
|
||||
internal sealed record WeaponProfile(uint DamageType, uint WeaponTime, uint WeaponSkill, uint Damage,
|
||||
double DamageVariance, double DamageMod, double WeaponLength, double MaxVelocity, double WeaponOffense, uint MaxVelocityEstimated = 0);
|
||||
|
||||
/// <summary>ACE HookProfile (Flags: Inscribable 1, IsHealer 2, IsFood 4, IsLockpick 8).</summary>
|
||||
internal sealed record HookProfile(uint Flags, uint ValidLocations, uint AmmoType);
|
||||
|
||||
/// <summary>ACE AppraiseInfo: what BuildProfile leaves in it; Write() below mirrors AppraiseInfoExtensions.Write.</summary>
|
||||
internal sealed class AppraiseInfo
|
||||
{
|
||||
public bool Success = true;
|
||||
public Dictionary<uint, int> Ints = new();
|
||||
public Dictionary<uint, long> Int64s = new();
|
||||
public Dictionary<uint, bool> Bools = new();
|
||||
public Dictionary<uint, double> Floats = new();
|
||||
public Dictionary<uint, string> Strings = new();
|
||||
public Dictionary<uint, uint> Dids = new();
|
||||
public List<uint> SpellBook = new();
|
||||
public ArmorProfile? Armor;
|
||||
public CreatureProfile? Creature;
|
||||
public WeaponProfile? Weapon;
|
||||
public HookProfile? Hook;
|
||||
public ushort ArmorHighlight, ArmorColor, WeaponHighlight, WeaponColor, ResistHighlight, ResistColor;
|
||||
public uint[]? ArmorLevels; // 9 values
|
||||
|
||||
// ACE IdentifyResponseFlags
|
||||
private const uint IntStatsTable = 0x0001, BoolStatsTable = 0x0002, FloatStatsTable = 0x0004, StringStatsTable = 0x0008,
|
||||
SpellBookF = 0x0010, WeaponProfileF = 0x0020, HookProfileF = 0x0040, ArmorProfileF = 0x0080, CreatureProfileF = 0x0100,
|
||||
ArmorEnchantmentBitfield = 0x0200, ResistEnchantmentBitfield = 0x0400, WeaponEnchantmentBitfield = 0x0800,
|
||||
DidStatsTable = 0x1000, Int64StatsTable = 0x2000, ArmorLevelsF = 0x4000;
|
||||
|
||||
/// <summary>ACE AppraiseInfo.BuildFlags.</summary>
|
||||
public uint Flags
|
||||
{
|
||||
get
|
||||
{
|
||||
uint f = 0;
|
||||
if (Ints.Count > 0) f |= IntStatsTable;
|
||||
if (Int64s.Count > 0) f |= Int64StatsTable;
|
||||
if (Bools.Count > 0) f |= BoolStatsTable;
|
||||
if (Floats.Count > 0) f |= FloatStatsTable;
|
||||
if (Strings.Count > 0) f |= StringStatsTable;
|
||||
if (Dids.Count > 0) f |= DidStatsTable;
|
||||
if (SpellBook.Count > 0) f |= SpellBookF;
|
||||
if (ResistHighlight != 0) f |= ResistEnchantmentBitfield;
|
||||
if (Armor != null) f |= ArmorProfileF;
|
||||
if (Creature != null) f |= CreatureProfileF;
|
||||
if (Weapon != null) f |= WeaponProfileF;
|
||||
if (Hook != null) f |= HookProfileF;
|
||||
if (ArmorHighlight != 0) f |= ArmorEnchantmentBitfield;
|
||||
if (WeaponHighlight != 0) f |= WeaponEnchantmentBitfield;
|
||||
if (ArmorLevels != null) f |= ArmorLevelsF;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>GameEventIdentifyObjectResponse: the object guid, then AppraiseInfoExtensions.Write.</summary>
|
||||
public byte[] ToIdentifyMessage(uint guid)
|
||||
{
|
||||
var m = AceMessage.GameEvent(0x00C9);
|
||||
var w = m.W;
|
||||
w.Write(guid);
|
||||
uint flags = Flags;
|
||||
w.Write(flags);
|
||||
w.Write(Convert.ToUInt32(Success));
|
||||
if ((flags & IntStatsTable) != 0) m.IntTable(Ints);
|
||||
if ((flags & Int64StatsTable) != 0) m.Int64Table(Int64s);
|
||||
if ((flags & BoolStatsTable) != 0) m.BoolTable(Bools);
|
||||
if ((flags & FloatStatsTable) != 0) m.FloatTable(Floats);
|
||||
if ((flags & StringStatsTable) != 0) m.StringTable(Strings);
|
||||
if ((flags & DidStatsTable) != 0) m.UIntTable(Dids);
|
||||
if ((flags & SpellBookF) != 0) { w.Write(SpellBook.Count); foreach (uint s in SpellBook) w.Write(s); } // PackableList
|
||||
if (Armor is { } a)
|
||||
{
|
||||
w.Write(a.Slash); w.Write(a.Pierce); w.Write(a.Bludgeon); w.Write(a.Cold);
|
||||
w.Write(a.Fire); w.Write(a.Acid); w.Write(a.Nether); w.Write(a.Lightning);
|
||||
}
|
||||
if (Creature is { } c)
|
||||
{
|
||||
w.Write(c.Flags); w.Write(c.Health); w.Write(c.HealthMax);
|
||||
if ((c.Flags & 0x8) != 0)
|
||||
foreach (uint v in c.Attributes ?? new uint[10]) w.Write(v);
|
||||
if ((c.Flags & 0x1) != 0) { w.Write(c.Highlights); w.Write(c.Colors); }
|
||||
}
|
||||
if (Weapon is { } p)
|
||||
{
|
||||
w.Write(p.DamageType); w.Write(p.WeaponTime); w.Write(p.WeaponSkill); w.Write(p.Damage);
|
||||
w.Write(p.DamageVariance); w.Write(p.DamageMod); w.Write(p.WeaponLength); w.Write(p.MaxVelocity);
|
||||
w.Write(p.WeaponOffense); w.Write(p.MaxVelocityEstimated);
|
||||
}
|
||||
if (Hook is { } h) { w.Write(h.Flags); w.Write(h.ValidLocations); w.Write(h.AmmoType); }
|
||||
if ((flags & ArmorEnchantmentBitfield) != 0) { w.Write(ArmorHighlight); w.Write(ArmorColor); }
|
||||
if ((flags & WeaponEnchantmentBitfield) != 0) { w.Write(WeaponHighlight); w.Write(WeaponColor); }
|
||||
if ((flags & ResistEnchantmentBitfield) != 0) { w.Write(ResistHighlight); w.Write(ResistColor); }
|
||||
if (ArmorLevels != null) foreach (uint v in ArmorLevels) w.Write(v);
|
||||
return m.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The property part of ACE GameEventPlayerDescription.WriteEventBody (and a tail after it).</summary>
|
||||
internal sealed class PlayerDescription
|
||||
{
|
||||
public Dictionary<uint, int> Ints = new();
|
||||
public Dictionary<uint, long> Int64s = new();
|
||||
public Dictionary<uint, bool> Bools = new();
|
||||
public Dictionary<uint, double> Floats = new();
|
||||
public Dictionary<uint, string> Strings = new();
|
||||
public Dictionary<uint, uint> Dids = new();
|
||||
public Dictionary<uint, uint> Iids = new();
|
||||
|
||||
public byte[] ToMessage()
|
||||
{
|
||||
var m = AceMessage.GameEvent(0x0013);
|
||||
var w = m.W;
|
||||
uint f = 0;
|
||||
if (Ints.Count > 0) f |= 0x0001;
|
||||
if (Int64s.Count > 0) f |= 0x0080;
|
||||
if (Bools.Count > 0) f |= 0x0002;
|
||||
if (Floats.Count > 0) f |= 0x0004;
|
||||
if (Strings.Count > 0) f |= 0x0010;
|
||||
if (Dids.Count > 0) f |= 0x0008;
|
||||
if (Iids.Count > 0) f |= 0x0040;
|
||||
f |= 0x0020; // Position (LastOutsideDeath): follows the tables, not read
|
||||
w.Write(f);
|
||||
w.Write(1u); // WeenieType.Creature... (Player = 43, the value is skipped)
|
||||
if (Ints.Count > 0) m.IntTable(Ints);
|
||||
if (Int64s.Count > 0) m.Int64Table(Int64s);
|
||||
if (Bools.Count > 0) m.BoolTable(Bools);
|
||||
if (Floats.Count > 0) m.FloatTable(Floats);
|
||||
if (Strings.Count > 0) m.StringTable(Strings);
|
||||
if (Dids.Count > 0) m.UIntTable(Dids);
|
||||
if (Iids.Count > 0) m.UIntTable(Iids);
|
||||
// Position table (1 entry, 16 buckets) + the vectors, options and inventory that follow.
|
||||
m.HashHeader(1, 16);
|
||||
w.Write(14u); // PositionType.LastOutsideDeath
|
||||
w.Write(0x7D640013u); w.Write(10f); w.Write(20f); w.Write(30f); w.Write(1f); w.Write(0f); w.Write(0f); w.Write(0f);
|
||||
w.Write(0x00000303u); // vector flags ... (garbage to the parser)
|
||||
return m.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>ACE GameMessage{Private,Public}UpdateProperty* / UpdateDataID / UpdateInstanceID.</summary>
|
||||
internal static class Updates
|
||||
{
|
||||
private const byte Seq = 0x5A;
|
||||
|
||||
public static byte[] PrivateInt(uint key, int v) { var m = AceMessage.Message(0x02CD); m.W.Write(Seq); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
public static byte[] PublicInt(uint guid, uint key, int v) { var m = AceMessage.Message(0x02CE); m.W.Write(Seq); m.W.Write(guid); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
public static byte[] PrivateInt64(uint key, long v) { var m = AceMessage.Message(0x02CF); m.W.Write(Seq); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
public static byte[] PublicInt64(uint guid, uint key, long v) { var m = AceMessage.Message(0x02D0); m.W.Write(Seq); m.W.Write(guid); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
public static byte[] PrivateBool(uint key, bool v) { var m = AceMessage.Message(0x02D1); m.W.Write(Seq); m.W.Write(key); m.W.Write(Convert.ToUInt32(v)); return m.ToArray(); }
|
||||
public static byte[] PublicBool(uint guid, uint key, bool v) { var m = AceMessage.Message(0x02D2); m.W.Write(Seq); m.W.Write(guid); m.W.Write(key); m.W.Write(Convert.ToUInt32(v)); return m.ToArray(); }
|
||||
public static byte[] PrivateFloat(uint key, double v) { var m = AceMessage.Message(0x02D3); m.W.Write(Seq); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
public static byte[] PublicFloat(uint guid, uint key, double v) { var m = AceMessage.Message(0x02D4); m.W.Write(Seq); m.W.Write(guid); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
|
||||
/// <summary>GameMessagePrivateUpdatePropertyString: seq, key, Align(), WriteString16L.</summary>
|
||||
public static byte[] PrivateString(uint key, string v) { var m = AceMessage.Message(0x02D5); m.W.Write(Seq); m.W.Write(key); m.Align(); m.String16L(v); return m.ToArray(); }
|
||||
|
||||
/// <summary>GameMessagePublicUpdatePropertyString: seq, key, THEN guid, Align(), WriteString16L.</summary>
|
||||
public static byte[] PublicString(uint guid, uint key, string v) { var m = AceMessage.Message(0x02D6); m.W.Write(Seq); m.W.Write(key); m.W.Write(guid); m.Align(); m.String16L(v); return m.ToArray(); }
|
||||
|
||||
public static byte[] PrivateDataId(uint key, uint v) { var m = AceMessage.Message(0x02D7); m.W.Write(Seq); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
public static byte[] PublicDataId(uint guid, uint key, uint v) { var m = AceMessage.Message(0x02D8); m.W.Write(Seq); m.W.Write(guid); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
public static byte[] PrivateInstanceId(uint key, uint v) { var m = AceMessage.Message(0x02D9); m.W.Write(Seq); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
public static byte[] PublicInstanceId(uint guid, uint key, uint v) { var m = AceMessage.Message(0x02DA); m.W.Write(Seq); m.W.Write(guid); m.W.Write(key); m.W.Write(v); return m.ToArray(); }
|
||||
}
|
||||
466
tools/PropertyWireTests/Program.cs
Normal file
466
tools/PropertyWireTests/Program.cs
Normal file
|
|
@ -0,0 +1,466 @@
|
|||
using System.Buffers.Binary;
|
||||
using RynthCore.Engine.Compatibility;
|
||||
|
||||
namespace PropertyWireTests;
|
||||
|
||||
/// <summary>
|
||||
/// One identify reply, update set or PublicWeenieDesc per kind of object, built the way ACE
|
||||
/// writes them, through the engine's parsers; every value the engine would cache is checked.
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
private static string _case = "";
|
||||
|
||||
private const uint Me = 0x50000001, Other = 0x50000002, Leggings = 0x80000101, Sword = 0x80000102,
|
||||
Scroll = 0x80000103, Drudge = 0x80000201, Door = 0x7A9B4001, Portal = 0x7A9B4002, Chest = 0x7A9B4003,
|
||||
Corpse = 0x80000301, HookObj = 0x7A9B4004;
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
PackItemIdentified();
|
||||
PackItemNotIdentified();
|
||||
WornWeapon();
|
||||
CreatureIdentified();
|
||||
CreatureFailedRoll();
|
||||
CreatureNotIdentified();
|
||||
OtherPlayer();
|
||||
LandscapeDoorPortalChest();
|
||||
CorpseIdentified();
|
||||
HouseHook();
|
||||
PlayerSelf();
|
||||
UpdatesEveryType();
|
||||
StringUpdateAlignment();
|
||||
TruncatedAndBadInput();
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
|
||||
Console.WriteLine(_failed == 0 ? "ALL PROPERTY WIRE TESTS PASSED." : $"{_failed} FAILED.");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// ── object kinds ────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Studded Leather Leggings: tables, spells, armour profile + armour highlights, armour levels.</summary>
|
||||
private static void PackItemIdentified()
|
||||
{
|
||||
Case("pack item, identified (armour)");
|
||||
var a = new AppraiseInfo
|
||||
{
|
||||
Ints = { [1] = 2, [5] = 900, [19] = 1200, [28] = 120, [105] = 6, [106] = 180, [109] = 210, [158] = 7, [159] = 0, [160] = 150, [131] = 42 },
|
||||
Bools = { [69] = true },
|
||||
Strings = { [16] = "Studded Leather Leggings of Acid Protection" },
|
||||
Dids = { [37] = 0x0000002C },
|
||||
SpellBook = { 1391, 2092 },
|
||||
Armor = new ArmorProfile(1.1f, 0.9f, 0.8f, 0.6f, 0.4f, 1.3f, 0.5f, 0.7f),
|
||||
ArmorHighlight = 0x0003, ArmorColor = 0x0001,
|
||||
ArmorLevels = new uint[] { 0, 0, 120, 0, 0, 0, 120, 120, 0 },
|
||||
};
|
||||
IdentifyRecord r = Identify(a, Leggings);
|
||||
Check(r.ObjectId == Leggings && r.Success && !r.Truncated, "header");
|
||||
Check(r.HasArmorProfile && !r.HasWeaponProfile && !r.HasCreatureProfile && !r.HasHookProfile, "profile flags");
|
||||
Eq(r.SpellCount, 2, "spell count");
|
||||
// Tables as sent, plus the eight ratings as ArmorModVs* (slash 13 .. acid 18, nether 165, electric 19).
|
||||
var floats = new Dictionary<uint, double>
|
||||
{
|
||||
[13] = 1.1f, [14] = 0.9f, [15] = 0.8f, [16] = 0.6f, [17] = 0.4f, [18] = 1.3f, [165] = 0.5f, [19] = 0.7f,
|
||||
};
|
||||
ExpectBag(r.Properties, ints: a.Ints, bools: a.Bools, floats: floats, strings: a.Strings, dids: a.Dids);
|
||||
}
|
||||
|
||||
/// <summary>An item never identified: the client knows only its CreateObject (PublicWeenieDesc).</summary>
|
||||
private static void PackItemNotIdentified()
|
||||
{
|
||||
Case("pack item, not identified (PublicWeenieDesc)");
|
||||
var pwd = new byte[PwdLayout.Size];
|
||||
void U32(int off, uint v) => BinaryPrimitives.WriteUInt32LittleEndian(pwd.AsSpan(off), v);
|
||||
U32(PwdLayout.Wcid, 20630); U32(PwdLayout.Icon, 0x06001F4A); U32(PwdLayout.IconOverlay, 0x06006C0A);
|
||||
U32(PwdLayout.Container, Me); U32(PwdLayout.Priority, 0x4000); U32(PwdLayout.ValidLocations, 0x2000);
|
||||
U32(PwdLayout.Type, 0x2000); U32(PwdLayout.Value, 250); U32(PwdLayout.Useability, 0x10008);
|
||||
BinaryPrimitives.WriteSingleLittleEndian(pwd.AsSpan(PwdLayout.UseRadius), 2.5f);
|
||||
U32(PwdLayout.TargetType, 0x10); U32(PwdLayout.Effects, 0x20); U32(PwdLayout.AmmoType, 0);
|
||||
U32(PwdLayout.CombatUse, 3); U32(PwdLayout.Structure, 50); U32(PwdLayout.MaxStructure, 100);
|
||||
U32(PwdLayout.StackSize, 10); U32(PwdLayout.MaxStackSize, 100); U32(PwdLayout.BlipColor, 8);
|
||||
U32(PwdLayout.RadarEnum, 4); U32(PwdLayout.Burden, 30); U32(PwdLayout.SpellId, 1234);
|
||||
U32(PwdLayout.HouseOwner, 0x50000009); U32(PwdLayout.HookType, 2); U32(PwdLayout.HookItemTypes, 0x80);
|
||||
U32(PwdLayout.Monarch, Other); U32(PwdLayout.MaterialType, 57);
|
||||
BinaryPrimitives.WriteSingleLittleEndian(pwd.AsSpan(PwdLayout.Workmanship), 6.5f);
|
||||
U32(PwdLayout.CooldownId, 5);
|
||||
BinaryPrimitives.WriteDoubleLittleEndian(pwd.AsSpan(PwdLayout.CooldownDuration), 15.0);
|
||||
U32(PwdLayout.PetOwner, Me);
|
||||
|
||||
var ints = new Dictionary<uint, int>
|
||||
{
|
||||
[1] = 0x2000, [4] = 0x4000, [5] = 30, [9] = 0x2000, [11] = 100, [12] = 10, [16] = 0x10008, [18] = 0x20,
|
||||
[19] = 250, [51] = 3, [91] = 100, [92] = 50, [94] = 0x10, [95] = 8, [131] = 57, [133] = 4, [151] = 2,
|
||||
[152] = 0x80, [280] = 5,
|
||||
};
|
||||
foreach (var kv in ints)
|
||||
Check(PwdLayout.TryGetInt(pwd, kv.Key, out int v) && v == kv.Value, $"PWD int {kv.Key} = {kv.Value}");
|
||||
foreach (uint absent in new uint[] { 6, 7, 10, 50, 25, 2 }) // zero (not sent) or not a PWD field
|
||||
Check(!PwdLayout.TryGetInt(pwd, absent, out _), $"PWD int {absent} absent");
|
||||
Check(PwdLayout.TryGetDataId(pwd, 8, out uint d) && d == 0x06001F4A, "PWD Icon");
|
||||
Check(PwdLayout.TryGetDataId(pwd, 50, out d) && d == 0x06006C0A, "PWD IconOverlay");
|
||||
Check(!PwdLayout.TryGetDataId(pwd, 52, out _), "PWD IconUnderlay absent");
|
||||
Check(PwdLayout.TryGetDataId(pwd, 28, out d) && d == 1234, "PWD Spell");
|
||||
Check(PwdLayout.TryGetInstanceId(pwd, 2, out uint i) && i == Me, "PWD Container");
|
||||
Check(!PwdLayout.TryGetInstanceId(pwd, 3, out _), "PWD Wielder absent");
|
||||
Check(PwdLayout.TryGetInstanceId(pwd, 26, out i) && i == Other, "PWD Monarch");
|
||||
Check(PwdLayout.TryGetInstanceId(pwd, 32, out i) && i == 0x50000009, "PWD HouseOwner");
|
||||
Check(PwdLayout.TryGetInstanceId(pwd, 44, out i) && i == Me, "PWD PetOwner");
|
||||
Check(PwdLayout.TryGetFloat(pwd, 54, out double f) && f == 2.5, "PWD UseRadius");
|
||||
Check(PwdLayout.TryGetFloat(pwd, 167, out f) && f == 15.0, "PWD CooldownDuration");
|
||||
Check(PwdLayout.TryGetFloat(pwd, 280, out f) && f == 6.5, "PWD workmanship (280)");
|
||||
Check(!PwdLayout.TryGetFloat(pwd, 22, out _), "PWD has no DamageVariance");
|
||||
}
|
||||
|
||||
/// <summary>A wielded sword: tables, weapon profile (buffed values), weapon highlights; then a public update.</summary>
|
||||
private static void WornWeapon()
|
||||
{
|
||||
Case("worn item, identified (weapon)");
|
||||
var a = new AppraiseInfo
|
||||
{
|
||||
// DamageType (45) is an assessment property: the table's value stays, the profile's doesn't replace it.
|
||||
Ints = { [1] = 1, [5] = 800, [19] = 5000, [45] = 1, [158] = 2, [159] = 44, [160] = 250, [105] = 8 },
|
||||
Int64s = { [4] = 12_000_000_000, [5] = 1_000_000_000 }, // ItemTotalXp, ItemBaseXp
|
||||
Bools = { [22] = true },
|
||||
Floats = { [29] = 1.15, [149] = 1.05, [150] = 1.02, [152] = 0.0 },
|
||||
Strings = { [16] = "Tachi", [7] = "Made for Tester", [8] = "Tester" },
|
||||
SpellBook = { 2083, 0x80000000u | 1616 },
|
||||
Weapon = new WeaponProfile(DamageType: 3, WeaponTime: 35, WeaponSkill: 44, Damage: 38,
|
||||
DamageVariance: 0.45, DamageMod: 1.1, WeaponLength: 1.5, MaxVelocity: 1.0, WeaponOffense: 1.08, MaxVelocityEstimated: 7),
|
||||
WeaponHighlight = 0x0005, WeaponColor = 0x0005,
|
||||
};
|
||||
IdentifyRecord r = Identify(a, Sword);
|
||||
Check(r.HasWeaponProfile && !r.HasArmorProfile && !r.Truncated, "weapon profile read");
|
||||
var ints = new Dictionary<uint, int>(a.Ints) { [49] = 35, [48] = 44, [44] = 38 }; // WeaponTime, WeaponSkill, Damage
|
||||
var floats = new Dictionary<uint, double>(a.Floats) { [22] = 0.45, [63] = 1.1, [21] = 1.5, [26] = 1.0, [62] = 1.08 };
|
||||
ExpectBag(r.Properties, ints: ints, int64s: a.Int64s, bools: a.Bools, floats: floats, strings: a.Strings);
|
||||
|
||||
// A caster: ACE sends no weapon profile for one, only the tables.
|
||||
var wand = new AppraiseInfo { Ints = { [1] = 0x8000 }, Floats = { [144] = 1.2, [152] = 1.1 } };
|
||||
IdentifyRecord w = Identify(wand, Sword + 1);
|
||||
Check(!w.HasWeaponProfile, "caster: no weapon profile");
|
||||
ExpectBag(w.Properties, ints: wand.Ints, floats: wand.Floats);
|
||||
|
||||
// Later: the sword's structure changes and its inscription is edited (public updates).
|
||||
PropertyUpdate u = Update(Updates.PublicInt(Sword, 92, 7));
|
||||
Check(u.Kind == PropertyKind.Int && !u.IsPrivate && u.ObjectId == Sword && u.Key == 92 && u.Integer == 7, "public Structure update");
|
||||
var bag = r.Properties;
|
||||
bag.Apply(u);
|
||||
bag.Apply(Update(Updates.PublicString(Sword, 7, "Made for someone else")));
|
||||
Eq(bag.Ints[92], 7, "update folded into the identify record (int)");
|
||||
Eq(bag.Strings[7], "Made for someone else", "update folded into the identify record (string)");
|
||||
}
|
||||
|
||||
/// <summary>A monster, successful assess: ints, strings, creature profile with attributes and buff highlights.</summary>
|
||||
private static void CreatureIdentified()
|
||||
{
|
||||
Case("creature, identified");
|
||||
var a = new AppraiseInfo
|
||||
{
|
||||
Ints = { [1] = 0x10, [2] = 3, [25] = 25, [307] = 10, [313] = 5 },
|
||||
Strings = { [16] = "A drudge skulker." },
|
||||
Creature = new CreatureProfile(0x8 | 0x1, 180, 200, new uint[] { 60, 70, 80, 90, 50, 40, 150, 100, 160, 110 }, 0x0003, 0x0001),
|
||||
ResistHighlight = 0x0010, ResistColor = 0x0010,
|
||||
};
|
||||
IdentifyRecord r = Identify(a, Drudge);
|
||||
Check(r.HasCreatureProfile && r.CreatureHealth == 180 && r.CreatureHealthMax == 200 && !r.Truncated, "creature profile read");
|
||||
ExpectBag(r.Properties, ints: a.Ints, strings: a.Strings);
|
||||
}
|
||||
|
||||
/// <summary>A failed assess: Success = 0, the creature profile carries health only; the tables still come.</summary>
|
||||
private static void CreatureFailedRoll()
|
||||
{
|
||||
Case("creature, failed assess");
|
||||
var a = new AppraiseInfo
|
||||
{
|
||||
Success = false,
|
||||
Ints = { [1] = 0x10, [2] = 3, [25] = 25 },
|
||||
Creature = new CreatureProfile(0x0, 200, 200),
|
||||
};
|
||||
IdentifyRecord r = Identify(a, Drudge);
|
||||
Check(!r.Success && r.HasCreatureProfile && r.CreatureHealthMax == 200 && !r.Truncated, "failed roll read");
|
||||
ExpectBag(r.Properties, ints: a.Ints);
|
||||
}
|
||||
|
||||
/// <summary>A monster never assessed: CreateObject fields only.</summary>
|
||||
private static void CreatureNotIdentified()
|
||||
{
|
||||
Case("creature, not identified (PublicWeenieDesc)");
|
||||
var pwd = new byte[PwdLayout.Size];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(pwd.AsSpan(PwdLayout.Type), 0x10);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(pwd.AsSpan(PwdLayout.Useability), 1);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(pwd.AsSpan(PwdLayout.BlipColor), 3);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(pwd.AsSpan(PwdLayout.RadarEnum), 1);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(pwd.AsSpan(PwdLayout.PetOwner), Me); // a summoned pet
|
||||
Check(PwdLayout.TryGetInt(pwd, 1, out int t) && t == 0x10, "ItemType Creature");
|
||||
Check(PwdLayout.TryGetInt(pwd, 16, out int use) && use == 1, "ItemUseable");
|
||||
Check(PwdLayout.TryGetInt(pwd, 95, out int blip) && blip == 3, "RadarBlipColor");
|
||||
Check(PwdLayout.TryGetInstanceId(pwd, 44, out uint owner) && owner == Me, "PetOwner");
|
||||
Check(!PwdLayout.TryGetInt(pwd, 19, out _), "no Value");
|
||||
}
|
||||
|
||||
/// <summary>Another player: allegiance strings, ratings, creature profile; then public updates about them.</summary>
|
||||
private static void OtherPlayer()
|
||||
{
|
||||
Case("another player");
|
||||
var a = new AppraiseInfo
|
||||
{
|
||||
Ints = { [1] = 0x10, [25] = 275, [113] = 1, [188] = 3, [307] = 12, [218] = 9 },
|
||||
Strings = { [1] = "Someone Else", [47] = "The Crew", [21] = "High King Boss", [35] = "Lord Patron", [10] = "Hunters" },
|
||||
Creature = new CreatureProfile(0x8, 400, 400, new uint[] { 100, 100, 100, 100, 100, 100, 300, 250, 300, 250 }),
|
||||
ArmorLevels = new uint[] { 300, 310, 320, 330, 340, 350, 360, 370, 380 },
|
||||
};
|
||||
IdentifyRecord r = Identify(a, Other);
|
||||
Check(r.HasCreatureProfile && !r.Truncated, "player profile read");
|
||||
ExpectBag(r.Properties, ints: a.Ints, strings: a.Strings);
|
||||
|
||||
PropertyUpdate u = Update(Updates.PublicInstanceId(Other, 26, Me));
|
||||
Check(u.Kind == PropertyKind.InstanceId && u.ObjectId == Other && u.Key == 26 && u.Integer == Me, "public Monarch update");
|
||||
u = Update(Updates.PublicBool(Other, 7, true));
|
||||
Check(u.Kind == PropertyKind.Bool && u.ObjectId == Other && u.Key == 7 && u.Integer == 1, "public PlayerKiller-style bool update");
|
||||
}
|
||||
|
||||
/// <summary>A locked door (lockpick numbers), a portal (level limits), a chest.</summary>
|
||||
private static void LandscapeDoorPortalChest()
|
||||
{
|
||||
Case("landscape: door, portal, chest");
|
||||
var door = new AppraiseInfo { Ints = { [1] = 0x80, [38] = 250, [173] = 67 }, Bools = { [3] = true, [2] = false } };
|
||||
IdentifyRecord r = Identify(door, Door);
|
||||
ExpectBag(r.Properties, ints: door.Ints, bools: door.Bools);
|
||||
|
||||
var portal = new AppraiseInfo
|
||||
{
|
||||
Ints = { [1] = 0x10000, [86] = 20, [87] = 80, [111] = 0x31 },
|
||||
Strings = { [14] = "Walk through to Town Network.", [16] = "A portal." },
|
||||
};
|
||||
r = Identify(portal, Portal);
|
||||
ExpectBag(r.Properties, ints: portal.Ints, strings: portal.Strings);
|
||||
|
||||
var chest = new AppraiseInfo { Ints = { [1] = 0x200, [19] = 0, [38] = 0 }, Bools = { [3] = false } };
|
||||
r = Identify(chest, Chest);
|
||||
ExpectBag(r.Properties, ints: chest.Ints, bools: chest.Bools);
|
||||
|
||||
// The door opens: public bool update for Open.
|
||||
PropertyUpdate u = Update(Updates.PublicBool(Door, 2, true));
|
||||
Check(u.ObjectId == Door && u.Key == 2 && u.Integer == 1, "door Open update");
|
||||
}
|
||||
|
||||
/// <summary>ACE strips a corpse to EncumbranceVal, Value = 0 and LongDesc.</summary>
|
||||
private static void CorpseIdentified()
|
||||
{
|
||||
Case("corpse");
|
||||
var a = new AppraiseInfo { Ints = { [5] = 2400, [19] = 0 }, Strings = { [16] = "Killed by Tester." } };
|
||||
IdentifyRecord r = Identify(a, Corpse);
|
||||
ExpectBag(r.Properties, ints: a.Ints, strings: a.Strings);
|
||||
}
|
||||
|
||||
/// <summary>A house hook holding an item: the item's tables, then the hook profile.</summary>
|
||||
private static void HouseHook()
|
||||
{
|
||||
Case("house hook");
|
||||
var a = new AppraiseInfo
|
||||
{
|
||||
Ints = { [1] = 0x100, [19] = 100 },
|
||||
Strings = { [16] = "This hook is owned by Tester. It contains: \nArrows" },
|
||||
Hook = new HookProfile(Flags: 0x1 | 0x8, ValidLocations: 0x800000, AmmoType: 1),
|
||||
};
|
||||
IdentifyRecord r = Identify(a, HookObj);
|
||||
Check(r.HasHookProfile && !r.Truncated, "hook profile read");
|
||||
var ints = new Dictionary<uint, int>(a.Ints) { [9] = 0x800000, [50] = 1 };
|
||||
ExpectBag(r.Properties, ints: ints, bools: new() { [22] = true }, strings: a.Strings);
|
||||
|
||||
// A hook with an item that isn't inscribable and has no ammo type: only its locations.
|
||||
var b = new AppraiseInfo { Ints = { [1] = 0x100 }, Hook = new HookProfile(0x2, 0x1, 0) };
|
||||
r = Identify(b, HookObj);
|
||||
ExpectBag(r.Properties, ints: new() { [1] = 0x100, [9] = 0x1 });
|
||||
}
|
||||
|
||||
/// <summary>The player: PlayerDescription's seven tables, then a private update of every type.</summary>
|
||||
private static void PlayerSelf()
|
||||
{
|
||||
Case("the player (PlayerDescription + private updates)");
|
||||
var pd = new PlayerDescription
|
||||
{
|
||||
Ints = { [25] = 275, [5] = 1500, [20] = 250000, [43] = 3, [96] = 4000, [307] = 10, [113] = 1 },
|
||||
Int64s = { [1] = 191_226_310_247, [2] = 1_000_000, [6] = 500_000, [7] = 1_500_000 },
|
||||
Bools = { [74] = true, [81] = false },
|
||||
Floats = { [64] = 1.0, [72] = 0.8, [98] = 1_727_000_000.5 },
|
||||
Strings = { [1] = "Tester", [5] = "Adventurer", [47] = "The Crew", [2] = "Sir" },
|
||||
Dids = { [1] = 0x02000001, [8] = 0x06001036, [23] = 0x0400007E },
|
||||
Iids = { [24] = 0x50000010, [25] = 0x50000011, [26] = 0x50000012 },
|
||||
};
|
||||
Check(PropertyWire.TryParsePlayerDescription(pd.ToMessage(), out PropertyBag bag, out bool truncated), "PlayerDescription parsed");
|
||||
Check(!truncated, "not truncated");
|
||||
ExpectBag(bag, ints: pd.Ints, int64s: pd.Int64s, bools: pd.Bools, floats: pd.Floats, strings: pd.Strings, dids: pd.Dids, iids: pd.Iids);
|
||||
|
||||
// Private updates carry no guid; the engine files them in the player's record.
|
||||
byte[][] msgs =
|
||||
{
|
||||
Updates.PrivateInt(5, 1650), Updates.PrivateInt64(1, 191_300_000_000), Updates.PrivateBool(81, true),
|
||||
Updates.PrivateFloat(72, 0.75), Updates.PrivateString(2, "Lord"), Updates.PrivateDataId(8, 0x06001037),
|
||||
Updates.PrivateInstanceId(25, 0x50000013),
|
||||
};
|
||||
foreach (byte[] m in msgs)
|
||||
{
|
||||
PropertyUpdate u = Update(m);
|
||||
Check(u.IsPrivate && u.ObjectId == 0, $"private {u.Kind} has no guid");
|
||||
bag.Apply(u);
|
||||
}
|
||||
Eq(bag.Ints[5], 1650, "EncumbranceVal after update");
|
||||
Eq(bag.Int64s[1], 191_300_000_000L, "TotalExperience after update");
|
||||
Eq(bag.Bools[81], true, "bool after update");
|
||||
Eq(bag.Floats[72], 0.75, "float after update");
|
||||
Eq(bag.Strings[2], "Lord", "Title after update");
|
||||
Eq(bag.DataIds[8], 0x06001037u, "Icon after update");
|
||||
Eq(bag.InstanceIds[25], 0x50000013u, "Patron after update");
|
||||
|
||||
// A description with no tables at all still parses.
|
||||
var empty = new PlayerDescription();
|
||||
Check(PropertyWire.TryParsePlayerDescription(empty.ToMessage(), out bag, out truncated) && bag.Count == 0 && !truncated, "empty description");
|
||||
}
|
||||
|
||||
/// <summary>Every opcode, public and private, round-trips kind, guid, key and value.</summary>
|
||||
private static void UpdatesEveryType()
|
||||
{
|
||||
Case("UpdateProperty* (every type)");
|
||||
const uint g = 0x80000555;
|
||||
Expect(Updates.PublicInt(g, 12, -3), PropertyKind.Int, false, g, 12, -3);
|
||||
Expect(Updates.PrivateInt(12, int.MaxValue), PropertyKind.Int, true, 0, 12, int.MaxValue);
|
||||
Expect(Updates.PublicInt64(g, 4, long.MaxValue), PropertyKind.Int64, false, g, 4, long.MaxValue);
|
||||
Expect(Updates.PrivateInt64(2, -5), PropertyKind.Int64, true, 0, 2, -5);
|
||||
Expect(Updates.PublicBool(g, 19, false), PropertyKind.Bool, false, g, 19, 0);
|
||||
Expect(Updates.PrivateBool(19, true), PropertyKind.Bool, true, 0, 19, 1);
|
||||
Expect(Updates.PublicDataId(g, 8, 0x06004D2A), PropertyKind.DataId, false, g, 8, 0x06004D2A);
|
||||
Expect(Updates.PrivateDataId(28, 0xFFFFFFFF), PropertyKind.DataId, true, 0, 28, 0xFFFFFFFF);
|
||||
Expect(Updates.PublicInstanceId(g, 3, Me), PropertyKind.InstanceId, false, g, 3, Me);
|
||||
Expect(Updates.PrivateInstanceId(26, Other), PropertyKind.InstanceId, true, 0, 26, Other);
|
||||
|
||||
PropertyUpdate f = Update(Updates.PublicFloat(g, 167, 12.25));
|
||||
Check(f.Kind == PropertyKind.Float && !f.IsPrivate && f.ObjectId == g && f.Key == 167 && f.Real == 12.25, "public float");
|
||||
f = Update(Updates.PrivateFloat(98, 1.5e9));
|
||||
Check(f.Kind == PropertyKind.Float && f.IsPrivate && f.Key == 98 && f.Real == 1.5e9, "private float");
|
||||
Check(!PropertyWire.TryParsePropertyUpdate(Updates.PrivateFloat(98, double.NaN), out _), "NaN float refused");
|
||||
|
||||
PropertyUpdate s = Update(Updates.PublicString(g, 16, "A long description."));
|
||||
Check(s.Kind == PropertyKind.String && s.ObjectId == g && s.Key == 16 && s.Text == "A long description.", "public string (key before guid)");
|
||||
s = Update(Updates.PrivateString(5, "Template"));
|
||||
Check(s.Kind == PropertyKind.String && s.IsPrivate && s.Key == 5 && s.Text == "Template", "private string");
|
||||
}
|
||||
|
||||
/// <summary>Strings of every length mod 4, and a code page 1252 character.</summary>
|
||||
private static void StringUpdateAlignment()
|
||||
{
|
||||
Case("string updates: alignment and padding");
|
||||
foreach (string text in new[] { "", "a", "ab", "abc", "abcd", "abcde", "Aelrynth Sword of Æsc" })
|
||||
{
|
||||
PropertyUpdate p = Update(Updates.PrivateString(7, text));
|
||||
Check(p.Text == text, $"private \"{text}\"");
|
||||
PropertyUpdate q = Update(Updates.PublicString(Sword, 7, text));
|
||||
Check(q.Text == text && q.ObjectId == Sword, $"public \"{text}\"");
|
||||
}
|
||||
// A string table in an identify with the same lengths.
|
||||
var a = new AppraiseInfo { Strings = { [1] = "", [2] = "a", [3] = "ab", [4] = "abc", [5] = "abcd" }, Ints = { [1] = 1 } };
|
||||
a.Dids[8] = 0x06001234; // after the string table: proves the padding was consumed
|
||||
IdentifyRecord r = Identify(a, Scroll);
|
||||
ExpectBag(r.Properties, ints: a.Ints, strings: a.Strings, dids: a.Dids);
|
||||
}
|
||||
|
||||
private static void TruncatedAndBadInput()
|
||||
{
|
||||
Case("truncated and bad messages");
|
||||
var a = new AppraiseInfo
|
||||
{
|
||||
Ints = { [1] = 2, [19] = 5 },
|
||||
Bools = { [69] = true },
|
||||
Floats = { [5] = -0.03, [29] = 1.1 },
|
||||
Strings = { [16] = "Cut short" },
|
||||
};
|
||||
byte[] full = a.ToIdentifyMessage(Scroll);
|
||||
// Cut inside the float table: ints and bools kept, the rest dropped, flagged truncated.
|
||||
int cut = 16 + 4 + 16 + 4 + 8 + 4 + 6;
|
||||
Check(PropertyWire.TryParseIdentify(full.AsSpan(0, cut), out IdentifyRecord r), "truncated identify still parsed");
|
||||
Check(r.Truncated, "flagged truncated");
|
||||
ExpectBag(r.Properties, ints: a.Ints, bools: a.Bools);
|
||||
|
||||
Check(!PropertyWire.TryParseIdentify(full.AsSpan(0, 12), out _), "no header, no record");
|
||||
byte[] wrongType = (byte[])full.Clone();
|
||||
wrongType[0] = 0xC8;
|
||||
Check(!PropertyWire.TryParseIdentify(wrongType, out _), "not an identify");
|
||||
Check(!PropertyWire.TryParsePlayerDescription(full, out _, out _), "an identify is not a PlayerDescription");
|
||||
|
||||
byte[] upd = Updates.PublicInt(Sword, 92, 1);
|
||||
Check(!PropertyWire.TryParsePropertyUpdate(upd.AsSpan(0, upd.Length - 1), out _), "short update refused");
|
||||
Check(!PropertyWire.TryParsePropertyUpdate(Updates.PrivateString(1, "x").AsSpan(0, 13), out _), "short string refused");
|
||||
byte[] other = (byte[])upd.Clone();
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(other, 0x02DB); // PrivateUpdatePosition
|
||||
Check(!PropertyWire.TryParsePropertyUpdate(other, out _), "position update is not a property update");
|
||||
Check(PropertyWire.IsPropertyUpdateOpcode(0x02CD) && PropertyWire.IsPropertyUpdateOpcode(0x02DA)
|
||||
&& !PropertyWire.IsPropertyUpdateOpcode(0x02CC) && !PropertyWire.IsPropertyUpdateOpcode(0x02DB), "opcode range");
|
||||
}
|
||||
|
||||
// ── helpers ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static IdentifyRecord Identify(AppraiseInfo a, uint guid)
|
||||
{
|
||||
bool ok = PropertyWire.TryParseIdentify(a.ToIdentifyMessage(guid), out IdentifyRecord r);
|
||||
Check(ok, "identify parsed");
|
||||
Check(r.ObjectId == guid && r.Flags == a.Flags && r.Success == a.Success, "identify header");
|
||||
return r;
|
||||
}
|
||||
|
||||
private static PropertyUpdate Update(byte[] msg)
|
||||
{
|
||||
bool ok = PropertyWire.TryParsePropertyUpdate(msg, out PropertyUpdate u);
|
||||
Check(ok, $"update 0x{BinaryPrimitives.ReadUInt32LittleEndian(msg):X4} parsed");
|
||||
return u;
|
||||
}
|
||||
|
||||
private static void Expect(byte[] msg, PropertyKind kind, bool isPrivate, uint guid, uint key, long value)
|
||||
{
|
||||
PropertyUpdate u = Update(msg);
|
||||
Check(u.Kind == kind && u.IsPrivate == isPrivate && u.ObjectId == guid && u.Key == key && u.Integer == value,
|
||||
$"{(isPrivate ? "private" : "public")} {kind} key {key} = {value} (got {u.Kind} {u.IsPrivate} 0x{u.ObjectId:X8} {u.Key} {u.Integer})");
|
||||
}
|
||||
|
||||
/// <summary>Every table of the bag must equal the expected one: same keys, same values.</summary>
|
||||
private static void ExpectBag(PropertyBag bag,
|
||||
Dictionary<uint, int>? ints = null, Dictionary<uint, long>? int64s = null, Dictionary<uint, bool>? bools = null,
|
||||
Dictionary<uint, double>? floats = null, Dictionary<uint, string>? strings = null, Dictionary<uint, uint>? dids = null,
|
||||
Dictionary<uint, uint>? iids = null)
|
||||
{
|
||||
Same("int", bag.Ints, ints ?? new());
|
||||
Same("int64", bag.Int64s, int64s ?? new());
|
||||
Same("bool", bag.Bools, bools ?? new());
|
||||
Same("float", bag.Floats, floats ?? new());
|
||||
Same("string", bag.Strings, strings ?? new());
|
||||
Same("did", bag.DataIds, dids ?? new());
|
||||
Same("iid", bag.InstanceIds, iids ?? new());
|
||||
}
|
||||
|
||||
private static void Same<T>(string what, Dictionary<uint, T> actual, Dictionary<uint, T> expected)
|
||||
{
|
||||
Check(actual.Count == expected.Count, $"{what}: {actual.Count} values, expected {expected.Count}");
|
||||
foreach (var kv in expected)
|
||||
Check(actual.TryGetValue(kv.Key, out T? v) && EqualityComparer<T>.Default.Equals(v, kv.Value),
|
||||
$"{what}[{kv.Key}] = {kv.Value} (got {(actual.TryGetValue(kv.Key, out T? g) ? g : "nothing")})");
|
||||
}
|
||||
|
||||
private static void Case(string name)
|
||||
{
|
||||
_case = name;
|
||||
Console.WriteLine($"- {name}");
|
||||
}
|
||||
|
||||
private static void Eq<T>(T actual, T expected, string what) =>
|
||||
Check(EqualityComparer<T>.Default.Equals(actual, expected), $"{what}: expected {expected}, got {actual}");
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine($" FAIL [{_case}] {what}");
|
||||
}
|
||||
}
|
||||
25
tools/PropertyWireTests/PropertyWireTests.csproj
Normal file
25
tools/PropertyWireTests/PropertyWireTests.csproj
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the engine's property parsers (src\RynthCore.Engine\Compatibility\
|
||||
PropertyWire.cs, compiled in): identify replies, PlayerDescription and every
|
||||
UpdateProperty* message, built byte for byte the way ACE writes them (AceWire.cs mirrors
|
||||
ACE.Server's writers), one per kind of object, plus the PublicWeenieDesc field map.
|
||||
Nothing native: no AC, no engine state.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>PropertyWireTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\PropertyWire.cs" Link="Engine\PropertyWire.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
19
tools/TestClient/Build-TestClient.ps1
Normal file
19
tools/TestClient/Build-TestClient.ps1
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Builds tools\TestClient\bin\TestClient.exe (x86).
|
||||
$ErrorActionPreference = "Stop"
|
||||
$vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" `
|
||||
-latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
||||
$vcVer = (Get-ChildItem "$vsPath\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name
|
||||
$vcBase = "$vsPath\VC\Tools\MSVC\$vcVer"
|
||||
$sdkVer = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Include" | Sort-Object Name -Descending | Select-Object -First 1).Name
|
||||
$sdkInc = "C:\Program Files (x86)\Windows Kits\10\Include\$sdkVer"
|
||||
$sdkLib = "C:\Program Files (x86)\Windows Kits\10\Lib\$sdkVer"
|
||||
$env:INCLUDE = "$vcBase\include;$sdkInc\ucrt;$sdkInc\um;$sdkInc\shared"
|
||||
$env:LIB = "$vcBase\lib\x86;$sdkLib\ucrt\x86;$sdkLib\um\x86"
|
||||
$out = Join-Path $PSScriptRoot "bin"
|
||||
New-Item -ItemType Directory -Force -Path "$out\obj" | Out-Null
|
||||
Push-Location "$out\obj"
|
||||
try {
|
||||
& "$vcBase\bin\Hostx86\x86\cl.exe" /nologo /O2 /MT /W3 "$PSScriptRoot\TestClient.c" /link /MACHINE:X86 /OUT:"$out\TestClient.exe"
|
||||
if ($LASTEXITCODE -ne 0) { throw "TestClient build failed" }
|
||||
} finally { Pop-Location }
|
||||
Write-Host "Built $out\TestClient.exe"
|
||||
120
tools/TestClient/TestClient.c
Normal file
120
tools/TestClient/TestClient.c
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
// TestClient: starts acclient.exe suspended, injects a DLL, optionally calls one of its
|
||||
// exports on a remote thread (like RynthCore.Injector does with RynthCoreInit), resumes
|
||||
// the client, then waits and (optionally) terminates it. For loader/engine tests that must
|
||||
// not touch a real account: point the client at a closed port and no login happens.
|
||||
//
|
||||
// TestClient.exe <acclient.exe> <dll> <export|-> <seconds> [acclient args...]
|
||||
// seconds > 0: terminate the client after that many seconds
|
||||
// seconds = 0: leave it running and exit (prints TEST_PID=<pid>)
|
||||
//
|
||||
// Environment variables set here are inherited by the client (e.g. RYNTH_SPIKE_AUTORUN).
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static DWORD RemoteCall(HANDLE process, void* fn, void* arg, DWORD timeoutMs, DWORD* exitCode)
|
||||
{
|
||||
HANDLE t = CreateRemoteThread(process, NULL, 0, (LPTHREAD_START_ROUTINE)fn, arg, 0, NULL);
|
||||
if (!t) return GetLastError();
|
||||
DWORD r = WaitForSingleObject(t, timeoutMs);
|
||||
GetExitCodeThread(t, exitCode);
|
||||
CloseHandle(t);
|
||||
return r == WAIT_OBJECT_0 ? 0 : WAIT_TIMEOUT;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 5) {
|
||||
printf("usage: TestClient <acclient.exe> <dll> <export|-> <seconds> [acclient args...]\n");
|
||||
return 1;
|
||||
}
|
||||
const char* exe = argv[1];
|
||||
const char* dll = argv[2];
|
||||
const char* exportName = argv[3];
|
||||
int seconds = atoi(argv[4]);
|
||||
|
||||
char cmd[4096];
|
||||
_snprintf_s(cmd, sizeof cmd, _TRUNCATE, "\"%s\"", exe);
|
||||
for (int i = 5; i < argc; i++) { strcat_s(cmd, sizeof cmd, " "); strcat_s(cmd, sizeof cmd, argv[i]); }
|
||||
char dir[MAX_PATH];
|
||||
strcpy_s(dir, sizeof dir, exe);
|
||||
*strrchr(dir, '\\') = 0;
|
||||
|
||||
// The export's RVA, from a local image-only mapping of the DLL.
|
||||
DWORD exportRva = 0;
|
||||
if (strcmp(exportName, "-") != 0) {
|
||||
HMODULE local = LoadLibraryExA(dll, NULL, DONT_RESOLVE_DLL_REFERENCES);
|
||||
if (!local) { printf("cannot map %s locally (%lu)\n", dll, GetLastError()); return 2; }
|
||||
FARPROC p = GetProcAddress(local, exportName);
|
||||
if (!p) { printf("%s has no export %s\n", dll, exportName); return 2; }
|
||||
exportRva = (DWORD)((char*)p - (char*)local);
|
||||
FreeLibrary(local);
|
||||
}
|
||||
|
||||
// Marks the client as a test client in its log (the loader logs "TestClient: ...").
|
||||
if (GetEnvironmentVariableA("RYNTHCORE_TEST_CLIENT", NULL, 0) == 0)
|
||||
SetEnvironmentVariableA("RYNTHCORE_TEST_CLIENT", "tools\\TestClient (no login)");
|
||||
STARTUPINFOA si = { sizeof si };
|
||||
PROCESS_INFORMATION pi;
|
||||
if (!CreateProcessA(exe, cmd, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, dir, &si, &pi)) {
|
||||
printf("CreateProcess failed %lu\n", GetLastError());
|
||||
return 3;
|
||||
}
|
||||
printf("TEST_PID=%lu\n", pi.dwProcessId);
|
||||
fflush(stdout);
|
||||
|
||||
// Its own launch context, naming a dummy account and NO character. Without one the engine
|
||||
// falls back to the shared %APPDATA%\RynthCore\launch_context.json - whatever the launcher
|
||||
// last launched (a real character) - and arms auto-login for it (2026-09-29).
|
||||
char ctxPath[MAX_PATH] = "";
|
||||
{
|
||||
char appdata[MAX_PATH];
|
||||
if (GetEnvironmentVariableA("APPDATA", appdata, sizeof appdata) > 0) {
|
||||
char dir[MAX_PATH];
|
||||
_snprintf_s(dir, sizeof dir, _TRUNCATE, "%s\\RynthCore\\launch_contexts", appdata);
|
||||
CreateDirectoryA(dir, NULL);
|
||||
_snprintf_s(ctxPath, sizeof ctxPath, _TRUNCATE, "%s\\launch_context_%lu.json", dir, pi.dwProcessId);
|
||||
FILE* f = NULL;
|
||||
if (fopen_s(&f, ctxPath, "w") == 0 && f) {
|
||||
fprintf(f, "{\"ProcessId\":%lu,\"AccountName\":\"test-client\",\"ServerName\":\"test-client\","
|
||||
"\"TargetCharacter\":\"\",\"SkipLoginLogos\":false,\"OnLoginCommands\":null,\"OnLoginWaitMs\":0}",
|
||||
pi.dwProcessId);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t len = strlen(dll) + 1;
|
||||
void* remote = VirtualAllocEx(pi.hProcess, NULL, len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
WriteProcessMemory(pi.hProcess, remote, dll, len, NULL);
|
||||
DWORD base = 0;
|
||||
DWORD err = RemoteCall(pi.hProcess, (void*)GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA"),
|
||||
remote, 30000, &base);
|
||||
if (err || !base) {
|
||||
printf("LoadLibrary in the client failed (err %lu, base 0x%08lx)\n", err, base);
|
||||
TerminateProcess(pi.hProcess, 1);
|
||||
return 4;
|
||||
}
|
||||
printf("loaded at 0x%08lx\n", base);
|
||||
|
||||
if (exportRva) {
|
||||
DWORD rc = 0;
|
||||
err = RemoteCall(pi.hProcess, (void*)(ULONG_PTR)(base + exportRva), NULL, 60000, &rc);
|
||||
printf("%s -> %s rc=%lu\n", exportName, err ? "TIMEOUT" : "returned", rc);
|
||||
}
|
||||
ResumeThread(pi.hThread);
|
||||
fflush(stdout);
|
||||
|
||||
if (seconds <= 0) return 0;
|
||||
DWORD r = WaitForSingleObject(pi.hProcess, seconds * 1000);
|
||||
if (r == WAIT_OBJECT_0) {
|
||||
DWORD code = 0;
|
||||
GetExitCodeProcess(pi.hProcess, &code);
|
||||
printf("client exited by itself, code 0x%08lx\n", code);
|
||||
} else {
|
||||
TerminateProcess(pi.hProcess, 0);
|
||||
printf("client terminated after %d s\n", seconds);
|
||||
}
|
||||
if (ctxPath[0]) DeleteFileA(ctxPath);
|
||||
return 0;
|
||||
}
|
||||
65
tools/TestClient/ThreadPeek.c
Normal file
65
tools/TestClient/ThreadPeek.c
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
// ThreadPeek: where is a (32-bit) thread right now? Suspends it a few times and prints EIP,
|
||||
// the module+offset it falls in, and the return-address-looking values on its stack.
|
||||
// ThreadPeek.exe <pid> <tid> [samples]
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static HMODULE g_mods[1024];
|
||||
static MODULEINFO g_info[1024];
|
||||
static char g_names[1024][64];
|
||||
static int g_nmods;
|
||||
|
||||
static void LoadModules(HANDLE p)
|
||||
{
|
||||
DWORD needed = 0;
|
||||
EnumProcessModulesEx(p, g_mods, sizeof g_mods, &needed, LIST_MODULES_ALL);
|
||||
g_nmods = (int)(needed / sizeof(HMODULE));
|
||||
for (int i = 0; i < g_nmods; i++) {
|
||||
GetModuleInformation(p, g_mods[i], &g_info[i], sizeof g_info[i]);
|
||||
GetModuleBaseNameA(p, g_mods[i], g_names[i], sizeof g_names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static const char* Where(DWORD a, char* buf, size_t cap)
|
||||
{
|
||||
for (int i = 0; i < g_nmods; i++) {
|
||||
DWORD b = (DWORD)(ULONG_PTR)g_info[i].lpBaseOfDll;
|
||||
if (a >= b && a < b + g_info[i].SizeOfImage) {
|
||||
_snprintf_s(buf, cap, _TRUNCATE, "%s+0x%lx", g_names[i], a - b);
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 3) { printf("usage: ThreadPeek <pid> <tid> [samples]\n"); return 1; }
|
||||
DWORD pid = strtoul(argv[1], NULL, 0), tid = strtoul(argv[2], NULL, 0);
|
||||
int samples = argc > 3 ? atoi(argv[3]) : 5;
|
||||
HANDLE p = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
|
||||
HANDLE t = OpenThread(THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT, FALSE, tid);
|
||||
if (!p || !t) { printf("open failed %lu\n", GetLastError()); return 2; }
|
||||
LoadModules(p);
|
||||
for (int s = 0; s < samples; s++) {
|
||||
SuspendThread(t);
|
||||
CONTEXT c = { 0 };
|
||||
c.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
|
||||
GetThreadContext(t, &c);
|
||||
DWORD stack[256] = { 0 };
|
||||
SIZE_T got = 0;
|
||||
ReadProcessMemory(p, (void*)(ULONG_PTR)c.Esp, stack, sizeof stack, &got);
|
||||
ResumeThread(t);
|
||||
char buf[128];
|
||||
const char* w = Where(c.Eip, buf, sizeof buf);
|
||||
printf("sample %d: eip=0x%08lx %s esp=0x%08lx eax=%08lx ecx=%08lx\n", s, c.Eip, w ? w : "(not in a module)", c.Esp, c.Eax, c.Ecx);
|
||||
int shown = 0;
|
||||
for (int i = 0; i < (int)(got / 4) && shown < 16; i++) {
|
||||
const char* m = Where(stack[i], buf, sizeof buf);
|
||||
if (m) { printf(" [esp+%03x] %s\n", i * 4, m); shown++; }
|
||||
}
|
||||
Sleep(200);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
327
tools/UsageStatsTests/Program.cs
Normal file
327
tools/UsageStatsTests/Program.cs
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using RynthCore.App.Avalonia;
|
||||
|
||||
namespace UsageStatsTests;
|
||||
|
||||
/// <summary>
|
||||
/// Checks for UsageStats.cs (the launcher's opt-in usage statistics).
|
||||
/// dotnet run -c Release offline checks, in a temp folder against a local test server
|
||||
/// dotnet run -c Release -- live then ONE real report to https://aelrynth.com/rynth/ping, built from
|
||||
/// this PC's enabled plugins (engine.json, read only) and the live
|
||||
/// update feed's plugin names, with a throwaway install ID (printed)
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
|
||||
private static readonly HashSet<string> AllowedKeys = new() { "schema", "install", "version", "windows", "crashes", "plugins", "otherPlugins" };
|
||||
|
||||
private static async Task<int> Main(string[] args)
|
||||
{
|
||||
string root = Path.Combine(Path.GetTempPath(), "rc-usage-stats-tests-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(root);
|
||||
try
|
||||
{
|
||||
Versions();
|
||||
Payload();
|
||||
Plugins(root);
|
||||
Crashes(root);
|
||||
OptInOut(root);
|
||||
await Sending(root);
|
||||
await FailuresAreSilent(root);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { Directory.Delete(root, true); } catch { }
|
||||
}
|
||||
|
||||
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed");
|
||||
if (_failed > 0) return 1;
|
||||
|
||||
if (args.Any(a => a.Equals("live", StringComparison.OrdinalIgnoreCase)))
|
||||
return await Live();
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void Versions()
|
||||
{
|
||||
Check(UsageStats.ShortVersion("2026.10.2.1+abcdef0123") == "2026.10.2.1", "release version keeps the number, drops the commit");
|
||||
Check(UsageStats.ShortVersion("1.0.0+abc") == "dev", "unversioned build is dev");
|
||||
Check(UsageStats.ShortVersion("2026.9.28.10 (4e4c4b7)") == "2026.9.28.10", "formatted version");
|
||||
Check(UsageStats.ShortVersion(@"C:\Users\Tom\x.dll") == "unknown", "anything else is unknown (no free text)");
|
||||
Check(UsageStats.ShortVersion(null) == "unknown", "null is unknown");
|
||||
string w = UsageStats.WindowsMajor();
|
||||
Check(w is "10" or "11" or "other", $"windows major is 10/11/other (got {w})");
|
||||
}
|
||||
|
||||
private static void Payload()
|
||||
{
|
||||
var plugins = new List<UsageStats.PluginInfo>
|
||||
{
|
||||
new("RynthAi", "2026.10.2.1+abc"),
|
||||
new("RynthAi", "2026.10.2.1+abc"), // duplicate copy: reported once
|
||||
new(@"C:\secret\Name", "1.0.0"), // not a safe name: dropped
|
||||
new("RynthNav", "1.0.0+dev"),
|
||||
};
|
||||
string json = UsageStats.BuildPayload(Guid.NewGuid().ToString("D"), "2026.10.3.1+abc", plugins, 3, 2, "10");
|
||||
using var doc = JsonDocument.Parse(json);
|
||||
var keys = doc.RootElement.EnumerateObject().Select(p => p.Name).ToList();
|
||||
Check(keys.All(AllowedKeys.Contains) && keys.Count == AllowedKeys.Count, "payload has exactly the approved keys: " + string.Join(",", keys));
|
||||
Check(doc.RootElement.GetProperty("plugins").GetArrayLength() == 2, "plugins deduplicated, unsafe names dropped");
|
||||
Check(doc.RootElement.GetProperty("plugins")[0].EnumerateObject().Select(p => p.Name).SequenceEqual(new[] { "name", "version" }), "plugin entries are name+version only");
|
||||
Check(!json.Contains('\\') && !json.Contains("C:"), "no file paths in the payload");
|
||||
Check(Encoding.UTF8.GetByteCount(json) < 2048, $"payload is small ({Encoding.UTF8.GetByteCount(json)} bytes)");
|
||||
string clamped = UsageStats.BuildPayload(Guid.NewGuid().ToString("D"), "dev", Array.Empty<UsageStats.PluginInfo>(), 5000, 99999, "11");
|
||||
using var c = JsonDocument.Parse(clamped);
|
||||
Check(c.RootElement.GetProperty("crashes").GetInt32() == 1000 && c.RootElement.GetProperty("otherPlugins").GetInt32() == 100, "counts are clamped");
|
||||
}
|
||||
|
||||
private static void Plugins(string root)
|
||||
{
|
||||
string dir = Path.Combine(root, "plugins");
|
||||
Directory.CreateDirectory(dir);
|
||||
string ai = Path.Combine(dir, "RynthCore.Plugin.RynthAi.dll");
|
||||
string mine = Path.Combine(dir, "MyPrivatePlugin.dll");
|
||||
File.Copy(typeof(Program).Assembly.Location, ai);
|
||||
File.Copy(typeof(Program).Assembly.Location, mine);
|
||||
var feed = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { ["RynthCore.Plugin.RynthAi.dll"] = "RynthAi" };
|
||||
var (known, other) = UsageStats.DescribePlugins(new[] { ai, mine, ai.ToUpperInvariant(), Path.Combine(dir, "Missing.dll") }, feed);
|
||||
Check(known.Count == 1 && known[0].Name == "RynthAi", "a feed plugin is reported by its feed name");
|
||||
Check(other == 2, $"other plugins (incl. a missing file) only counted (got {other})");
|
||||
}
|
||||
|
||||
private static void Crashes(string root)
|
||||
{
|
||||
string dumps = Path.Combine(root, "dumps");
|
||||
Directory.CreateDirectory(dumps);
|
||||
DateTime now = DateTime.UtcNow;
|
||||
void Make(string name, DateTime t) { string p = Path.Combine(dumps, name); File.WriteAllText(p, "x"); File.SetLastWriteTimeUtc(p, t); }
|
||||
Make("crash_1_old.dmp", now.AddDays(-2));
|
||||
Make("crash_2_new.dmp", now.AddMinutes(-10));
|
||||
Make("crash_3_new.dmp", now.AddMinutes(-5));
|
||||
Make("hang_4_new.dmp", now.AddMinutes(-5));
|
||||
Check(UsageStats.CountCrashDumps(dumps, now.AddDays(-1), now) == 2, "only crash_*.dmp newer than the last report count (hangs don't)");
|
||||
Check(UsageStats.CountCrashDumps(Path.Combine(root, "nope"), now.AddDays(-1), now) == 0, "missing dump folder = 0");
|
||||
}
|
||||
|
||||
private static void OptInOut(string root)
|
||||
{
|
||||
string state = Path.Combine(root, "state-optin");
|
||||
var s = new UsageStats("http://127.0.0.1:9/", state, Path.Combine(root, "dumps"));
|
||||
Check(s.InstallId == null, "no install ID before opting in");
|
||||
s.OptIn(DateTime.UtcNow);
|
||||
string? id = s.InstallId;
|
||||
Check(id != null && Guid.TryParseExact(id, "D", out _), "opting in makes a random GUID");
|
||||
s.OptIn(DateTime.UtcNow);
|
||||
Check(s.InstallId == id, "opting in again keeps the same ID");
|
||||
string text = File.ReadAllText(s.StatePath);
|
||||
Check(!text.Contains(Environment.UserName, StringComparison.OrdinalIgnoreCase) && !text.Contains(Environment.MachineName, StringComparison.OrdinalIgnoreCase),
|
||||
"the state file holds no user or machine name");
|
||||
s.OptOut();
|
||||
Check(!File.Exists(s.StatePath) && s.InstallId == null, "opting out deletes the file and the ID");
|
||||
s.OptIn(DateTime.UtcNow);
|
||||
Check(s.InstallId != null && s.InstallId != id, "opting in again later makes a NEW ID");
|
||||
}
|
||||
|
||||
private static async Task Sending(string root)
|
||||
{
|
||||
using var server = new TestServer();
|
||||
string state = Path.Combine(root, "state-send");
|
||||
string dumps = Path.Combine(root, "dumps");
|
||||
var s = new UsageStats(server.Url, state, dumps);
|
||||
var plugins = new List<UsageStats.PluginInfo> { new("RynthAi", "2026.10.3.1") };
|
||||
DateTime day1 = DateTime.UtcNow;
|
||||
|
||||
bool enabled = false;
|
||||
Check(!await s.MaybeSendAsync(() => enabled, "2026.10.3.1", plugins, 0, day1) && server.Count == 0, "off: nothing is sent");
|
||||
|
||||
enabled = true;
|
||||
s.OptIn(day1.AddDays(-1)); // so the two "new" crash dumps from Crashes() count
|
||||
Check(await s.MaybeSendAsync(() => enabled, "2026.10.3.1", plugins, 1, day1) && server.Count == 1, "on: one report is sent");
|
||||
using (var doc = JsonDocument.Parse(server.LastBody!))
|
||||
{
|
||||
Check(doc.RootElement.GetProperty("install").GetString() == s.InstallId, "the report carries the install ID");
|
||||
Check(doc.RootElement.GetProperty("crashes").GetInt32() == 2, "crashes since opting in are counted");
|
||||
}
|
||||
Check(server.LastContentType?.StartsWith("application/json") == true, "sent as application/json");
|
||||
Check(server.LastUserAgent == "RynthCore-Launcher", "user agent is the launcher's, nothing more");
|
||||
|
||||
Check(!await s.MaybeSendAsync(() => enabled, "2026.10.3.1", plugins, 1, day1.AddHours(1)) && server.Count == 1, "a second check the same day sends nothing");
|
||||
|
||||
DateTime day2 = day1.Date.AddDays(1).AddHours(1);
|
||||
Check(await s.MaybeSendAsync(() => enabled, "2026.10.3.1", plugins, 1, day2) && server.Count == 2, "next day: one more");
|
||||
using (var doc = JsonDocument.Parse(server.LastBody!))
|
||||
Check(doc.RootElement.GetProperty("crashes").GetInt32() == 0, "crashes reset after a report");
|
||||
|
||||
s.OptOut();
|
||||
enabled = false;
|
||||
Check(!await s.MaybeSendAsync(() => enabled, "2026.10.3.1", plugins, 1, day2.AddDays(1)) && server.Count == 2, "after opting out nothing is sent");
|
||||
Check(!File.Exists(s.StatePath), "and no ID comes back");
|
||||
|
||||
// Turned off between building the report and sending it.
|
||||
enabled = true;
|
||||
s.OptIn(day2);
|
||||
int calls = 0;
|
||||
Check(!await s.MaybeSendAsync(() => ++calls < 2, "2026.10.3.1", plugins, 0, day2.AddDays(2)) && server.Count == 2, "switched off mid-way: not sent");
|
||||
|
||||
// Server refuses: nothing recorded, so a later check tries again.
|
||||
server.Status = 400;
|
||||
DateTime day4 = day2.AddDays(3);
|
||||
Check(!await s.MaybeSendAsync(() => true, "2026.10.3.1", plugins, 0, day4), "a refused report returns false");
|
||||
server.Status = 204;
|
||||
Check(await s.MaybeSendAsync(() => true, "2026.10.3.1", plugins, 0, day4.AddHours(6)), "and is retried at the next check");
|
||||
}
|
||||
|
||||
private static async Task FailuresAreSilent(string root)
|
||||
{
|
||||
// A port nothing listens on, and a server that never answers.
|
||||
var s = new UsageStats("http://127.0.0.1:1/ping", Path.Combine(root, "state-fail"), Path.Combine(root, "dumps"));
|
||||
s.OptIn(DateTime.UtcNow);
|
||||
bool threw = false;
|
||||
try { await s.MaybeSendAsync(() => true, "dev", Array.Empty<UsageStats.PluginInfo>(), 0, DateTime.UtcNow); }
|
||||
catch { threw = true; }
|
||||
Check(!threw, "connection refused: no exception");
|
||||
|
||||
var tcp = new TcpListener(IPAddress.Loopback, 0);
|
||||
tcp.Start();
|
||||
int port = ((IPEndPoint)tcp.LocalEndpoint).Port;
|
||||
var s2 = new UsageStats($"http://127.0.0.1:{port}/ping", Path.Combine(root, "state-hang"), Path.Combine(root, "dumps"));
|
||||
s2.OptIn(DateTime.UtcNow);
|
||||
var sw = Stopwatch.StartNew();
|
||||
bool ok = await s2.MaybeSendAsync(() => true, "dev", Array.Empty<UsageStats.PluginInfo>(), 0, DateTime.UtcNow);
|
||||
sw.Stop();
|
||||
tcp.Stop();
|
||||
Check(!ok && sw.Elapsed < TimeSpan.FromSeconds(15), $"a server that never answers gives up quietly ({sw.Elapsed.TotalSeconds:0.0} s)");
|
||||
}
|
||||
|
||||
// ── Live ──────────────────────────────────────────────────────────────────
|
||||
|
||||
private static async Task<int> Live()
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("LIVE: one report to https://aelrynth.com/rynth/ping");
|
||||
|
||||
var names = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
byte[] env = await http.GetByteArrayAsync("https://aelrynth.com/downloads/rynth/update.json");
|
||||
using var e = JsonDocument.Parse(env);
|
||||
byte[] payload = Convert.FromBase64String(e.RootElement.GetProperty("payload").GetString()!);
|
||||
using var m = JsonDocument.Parse(payload);
|
||||
foreach (JsonElement p in m.RootElement.GetProperty("plugins").EnumerateArray())
|
||||
names.TryAdd(p.GetProperty("file").GetString()!, p.GetProperty("name").GetString()!);
|
||||
}
|
||||
|
||||
var enabled = new List<string>();
|
||||
string engineJson = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RynthCore", "engine.json");
|
||||
if (File.Exists(engineJson))
|
||||
{
|
||||
using var doc = JsonDocument.Parse(File.ReadAllText(engineJson));
|
||||
if (doc.RootElement.TryGetProperty("PluginPaths", out JsonElement paths))
|
||||
foreach (JsonElement p in paths.EnumerateArray())
|
||||
if (p.GetString() is { Length: > 0 } s) enabled.Add(s);
|
||||
}
|
||||
var (known, other) = UsageStats.DescribePlugins(enabled, names);
|
||||
|
||||
// The launcher build in this checkout (dotnet build -c Release of RynthCore.App.Avalonia).
|
||||
string bin = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "..", "src", "RynthCore.App.Avalonia", "bin", "Release"));
|
||||
string? launcher = Directory.Exists(bin)
|
||||
? Directory.EnumerateFiles(bin, "RynthCore.App.Avalonia.dll", SearchOption.AllDirectories).FirstOrDefault()
|
||||
: null;
|
||||
string version = launcher != null ? FileVersionInfo.GetVersionInfo(launcher).ProductVersion ?? "" : "";
|
||||
Console.WriteLine($"Launcher build: {(launcher ?? "not found")} ({version})");
|
||||
|
||||
string state = Path.Combine(Path.GetTempPath(), "rc-usage-stats-live-" + Guid.NewGuid().ToString("N"));
|
||||
try
|
||||
{
|
||||
var s = new UsageStats(UsageStats.DefaultEndpoint, state);
|
||||
s.OptIn(DateTime.UtcNow);
|
||||
Console.WriteLine("Test install ID: " + s.InstallId);
|
||||
Console.WriteLine(s.Preview(version, known, other, DateTime.UtcNow));
|
||||
bool sent = await s.MaybeSendAsync(() => true, version, known, other, DateTime.UtcNow);
|
||||
Console.WriteLine(sent ? "LIVE: accepted" : "LIVE: NOT accepted");
|
||||
return sent ? 0 : 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { Directory.Delete(state, true); } catch { }
|
||||
}
|
||||
}
|
||||
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (!ok) _failed++;
|
||||
Console.WriteLine($" {(ok ? "ok " : "FAIL")} {what}");
|
||||
}
|
||||
|
||||
/// <summary>A one-route HTTP server on 127.0.0.1 that records each request and answers Status.</summary>
|
||||
private sealed class TestServer : IDisposable
|
||||
{
|
||||
private readonly TcpListener _tcp = new(IPAddress.Loopback, 0);
|
||||
private readonly CancellationTokenSource _cts = new();
|
||||
public int Count;
|
||||
public int Status = 204;
|
||||
public string? LastBody, LastContentType, LastUserAgent;
|
||||
|
||||
public TestServer()
|
||||
{
|
||||
_tcp.Start();
|
||||
_ = Task.Run(Loop);
|
||||
}
|
||||
|
||||
public string Url => $"http://127.0.0.1:{((IPEndPoint)_tcp.LocalEndpoint).Port}/rynth/ping";
|
||||
|
||||
private async Task Loop()
|
||||
{
|
||||
while (!_cts.IsCancellationRequested)
|
||||
{
|
||||
TcpClient c;
|
||||
try { c = await _tcp.AcceptTcpClientAsync(_cts.Token); } catch { return; }
|
||||
using (c)
|
||||
{
|
||||
var stream = c.GetStream();
|
||||
var buf = new List<byte>();
|
||||
var one = new byte[4096];
|
||||
int headerEnd = -1, length = 0;
|
||||
while (true)
|
||||
{
|
||||
int n = await stream.ReadAsync(one);
|
||||
if (n <= 0) break;
|
||||
buf.AddRange(one.AsSpan(0, n).ToArray());
|
||||
string sofar = Encoding.ASCII.GetString(buf.ToArray());
|
||||
if (headerEnd < 0 && (headerEnd = sofar.IndexOf("\r\n\r\n", StringComparison.Ordinal)) >= 0)
|
||||
{
|
||||
foreach (string line in sofar[..headerEnd].Split("\r\n"))
|
||||
{
|
||||
int colon = line.IndexOf(':');
|
||||
if (colon < 0) continue;
|
||||
string k = line[..colon].Trim(), v = line[(colon + 1)..].Trim();
|
||||
if (k.Equals("Content-Length", StringComparison.OrdinalIgnoreCase)) length = int.Parse(v);
|
||||
if (k.Equals("Content-Type", StringComparison.OrdinalIgnoreCase)) LastContentType = v;
|
||||
if (k.Equals("User-Agent", StringComparison.OrdinalIgnoreCase)) LastUserAgent = v;
|
||||
}
|
||||
}
|
||||
if (headerEnd >= 0 && buf.Count >= headerEnd + 4 + length) break;
|
||||
}
|
||||
LastBody = Encoding.UTF8.GetString(buf.ToArray(), headerEnd + 4, length);
|
||||
if (Status < 300) Interlocked.Increment(ref Count);
|
||||
string reason = Status < 300 ? "No Content" : "Bad Request";
|
||||
await stream.WriteAsync(Encoding.ASCII.GetBytes($"HTTP/1.1 {Status} {reason}\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_cts.Cancel();
|
||||
_tcp.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
tools/UsageStatsTests/UsageStatsTests.csproj
Normal file
26
tools/UsageStatsTests/UsageStatsTests.csproj
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Checks for the launcher's opt-in usage statistics (src\RynthCore.App.Avalonia\UsageStats.cs,
|
||||
compiled in): the payload holds only the approved fields, opting out deletes the install ID,
|
||||
one report a day, crash counting, silent failures. Works in a temp folder against a local
|
||||
test server, never in %APPDATA%\RynthCore.
|
||||
dotnet run -c Release offline checks (exit 0 = pass, 1 = fail)
|
||||
with the argument "live" (see Program.cs) it also sends ONE real report to aelrynth.com/rynth/ping
|
||||
with a throwaway install ID (printed, so the test row
|
||||
can be deleted on the server afterwards)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>UsageStatsTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.App.Avalonia\UsageStats.cs" Link="App\UsageStats.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
81
tools/VTankWatchTests/Program.cs
Normal file
81
tools/VTankWatchTests/Program.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using RynthCore.Engine.Compatibility;
|
||||
|
||||
namespace VTankWatchTests;
|
||||
|
||||
/// <summary>VTankSignal (the Decal bridge's VTank signal) without AC, Decal or VTank.</summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
// VTank's documented commands, in the shapes a chat bar or a meta sends them.
|
||||
Parse("/vt start", VTankSignal.Start);
|
||||
Parse("/vt stop", VTankSignal.Stop);
|
||||
Parse("/VT START", VTankSignal.Start);
|
||||
Parse("/Vt Stop", VTankSignal.Stop);
|
||||
Parse(" /vt start ", VTankSignal.Start);
|
||||
Parse("/vt\tstop", VTankSignal.Stop);
|
||||
Parse("/vt start\r\n", VTankSignal.Start);
|
||||
Parse("/vt stop now", VTankSignal.Stop); // VTank's own parser decides; the verb matches
|
||||
|
||||
// Not VTank start/stop.
|
||||
Parse(null, VTankSignal.None);
|
||||
Parse("", VTankSignal.None);
|
||||
Parse("/vt", VTankSignal.None);
|
||||
Parse("/vt ", VTankSignal.None);
|
||||
Parse("/vt startx", VTankSignal.None);
|
||||
Parse("/vt starting", VTankSignal.None);
|
||||
Parse("/vt stopped", VTankSignal.None);
|
||||
Parse("/vt opt set enablecombat true", VTankSignal.None);
|
||||
Parse("/vt forcebuff", VTankSignal.None);
|
||||
Parse("/vt cancelforcebuff", VTankSignal.None);
|
||||
Parse("/vt meta load start", VTankSignal.None);
|
||||
Parse("/vt nav load stop", VTankSignal.None);
|
||||
Parse("/vtank start", VTankSignal.None);
|
||||
Parse("/vtstart", VTankSignal.None);
|
||||
Parse("vt start", VTankSignal.None);
|
||||
Parse("/ra start", VTankSignal.None);
|
||||
Parse("/ra stop", VTankSignal.None);
|
||||
Parse("/ub vt start", VTankSignal.None);
|
||||
Parse("/tell Someone, /vt start", VTankSignal.None);
|
||||
Parse("/f type /vt stop to stop", VTankSignal.None);
|
||||
Parse("hello /vt start", VTankSignal.None);
|
||||
|
||||
// Diagnostic chat filter: VTank-looking lines yes, other players' lines no.
|
||||
Chat("[VTank] Something VTank printed", true);
|
||||
Chat("Virindi Tank v.1.0.0.0 loaded", true);
|
||||
Chat("You have entered the General channel.", false);
|
||||
Chat("Bob tells you, \"is VTank on?\"", false);
|
||||
Chat("Bob says, \"VTank\"", false);
|
||||
Chat("[RynthAi] Macro STARTED.", false);
|
||||
Chat(null, false);
|
||||
|
||||
Console.WriteLine(_failed == 0 ? $"PASS ({_checks} checks)" : $"FAIL ({_failed} of {_checks} checks)");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static void Parse(string? line, int expected)
|
||||
{
|
||||
_checks++;
|
||||
int got = VTankSignal.ParseCommand(line);
|
||||
if (got != expected)
|
||||
{
|
||||
_failed++;
|
||||
Console.WriteLine($"FAIL ParseCommand({Show(line)}) = {got}, expected {expected}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void Chat(string? text, bool expected)
|
||||
{
|
||||
_checks++;
|
||||
bool got = VTankSignal.LooksLikeVTankChat(text);
|
||||
if (got != expected)
|
||||
{
|
||||
_failed++;
|
||||
Console.WriteLine($"FAIL LooksLikeVTankChat({Show(text)}) = {got}, expected {expected}");
|
||||
}
|
||||
}
|
||||
|
||||
private static string Show(string? s) => s == null ? "null" : "\"" + s.Replace("\r", "\\r").Replace("\n", "\\n").Replace("\t", "\\t") + "\"";
|
||||
}
|
||||
23
tools/VTankWatchTests/VTankWatchTests.csproj
Normal file
23
tools/VTankWatchTests/VTankWatchTests.csproj
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the VTank signal the Decal bridge uses (src\RynthCore.Engine\
|
||||
Compatibility\VTankSignal.cs, compiled in): which chat-parser lines count as VTank's
|
||||
documented /vt start and /vt stop, and which chat lines are logged for reference.
|
||||
Nothing native: no AC, no Decal, no VTank.
|
||||
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>VTankWatchTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\VTankSignal.cs" Link="Engine\VTankSignal.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
45
tools/WatchPatch.py
Normal file
45
tools/WatchPatch.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"""WatchPatch - timeline of who owns the first bytes of some functions in a running process.
|
||||
|
||||
Polls the addresses every few ms and prints a line whenever the bytes change, with the
|
||||
owner of the jump (see ProcPatchDiff.owner_of). Read-only. Spike tool (Decal bridge).
|
||||
|
||||
python tools/WatchPatch.py <pid> <seconds> 0x005649F0 0x004CBF70 ...
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
import ProcPatchDiff as P # noqa: E402
|
||||
|
||||
|
||||
def main():
|
||||
pid, secs = int(sys.argv[1]), float(sys.argv[2])
|
||||
addrs = [int(a, 16) for a in sys.argv[3:]]
|
||||
p = P.Proc(pid)
|
||||
last = {}
|
||||
t0 = time.time()
|
||||
refresh = 0.0
|
||||
while time.time() - t0 < secs:
|
||||
now = time.time()
|
||||
if now - refresh > 1.0: # modules come and go (Decal loads late)
|
||||
try:
|
||||
p.mods = p._modules()
|
||||
except OSError:
|
||||
break
|
||||
refresh = now
|
||||
for a in addrs:
|
||||
b = p.read(a, 6)
|
||||
if b is None:
|
||||
continue
|
||||
if last.get(a) != b:
|
||||
j = P.decode_jump(p, a)
|
||||
own = P.owner_of(p, j[0])[0] if j else "original bytes" if a not in last else "?"
|
||||
stamp = time.strftime("%H:%M:%S", time.localtime(now)) + f".{int(now * 1000) % 1000:03d}"
|
||||
print(f"{stamp} 0x{a:08X} {b.hex()} -> {own}", flush=True)
|
||||
last[a] = b
|
||||
time.sleep(0.005)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
93
tools/check_imgui_calls.py
Normal file
93
tools/check_imgui_calls.py
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
"""Check that every Dear ImGui function the engine calls exists in our cimgui.dll.
|
||||
|
||||
ImGui.NET binds native functions by name and lazily, so a call to a function
|
||||
the DLL doesn't export (our build compiles out obsolete APIs, e.g.
|
||||
GetContentRegionMax in 1.91) compiles fine and only fails - on AC's render
|
||||
thread - the first time that line runs. Run after adding ImGui code:
|
||||
|
||||
python tools/check_imgui_calls.py
|
||||
|
||||
Exit code 1 lists the calls with no matching export.
|
||||
"""
|
||||
import re
|
||||
import struct
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
DLL = ROOT / "src" / "RynthCore.Engine" / "Native" / "cimgui.dll"
|
||||
SOURCES = ROOT / "src" / "RynthCore.Engine" / "ImGui"
|
||||
# Old diagnostic shell, FORCE-gated and never run: not held to this check.
|
||||
SKIP = {"RynthCoreShell.cs"}
|
||||
|
||||
# Wrapper-object calls: variable/field name -> cimgui prefix.
|
||||
MEMBER_PREFIX = {
|
||||
"dl": "ImDrawList_",
|
||||
"clipper": "ImGuiListClipper_",
|
||||
"io.Fonts": "ImFontAtlas_",
|
||||
"style": "ImGuiStyle_",
|
||||
}
|
||||
|
||||
|
||||
def pe_exports(path: Path) -> set[str]:
|
||||
data = path.read_bytes()
|
||||
pe = struct.unpack_from("<I", data, 0x3C)[0]
|
||||
nsec = struct.unpack_from("<H", data, pe + 6)[0]
|
||||
opt = pe + 24
|
||||
magic = struct.unpack_from("<H", data, opt)[0]
|
||||
dd = opt + (96 if magic == 0x10B else 112)
|
||||
exp_rva = struct.unpack_from("<I", data, dd)[0]
|
||||
sections = []
|
||||
sec = opt + struct.unpack_from("<H", data, pe + 20)[0]
|
||||
for i in range(nsec):
|
||||
vsize, va, raw_size, raw_ptr = struct.unpack_from("<IIII", data, sec + i * 40 + 8)
|
||||
sections.append((va, max(vsize, raw_size), raw_ptr))
|
||||
|
||||
def off(rva: int) -> int:
|
||||
for va, size, raw in sections:
|
||||
if va <= rva < va + size:
|
||||
return rva - va + raw
|
||||
raise ValueError(hex(rva))
|
||||
|
||||
e = off(exp_rva)
|
||||
count, names_rva = struct.unpack_from("<I", data, e + 24)[0], struct.unpack_from("<I", data, e + 32)[0]
|
||||
names = set()
|
||||
for i in range(count):
|
||||
n = off(struct.unpack_from("<I", data, off(names_rva) + i * 4)[0])
|
||||
names.add(data[n:data.index(b"\0", n)].decode())
|
||||
return names
|
||||
|
||||
|
||||
def main() -> int:
|
||||
exports = pe_exports(DLL)
|
||||
|
||||
def found(prefix: str, name: str) -> bool:
|
||||
full = prefix + name
|
||||
return full in exports or any(x.startswith(full + "_") for x in exports)
|
||||
|
||||
missing = []
|
||||
for f in sorted(SOURCES.rglob("*.cs")):
|
||||
if f.name in SKIP:
|
||||
continue
|
||||
text = f.read_text(encoding="utf-8")
|
||||
for m in re.finditer(r"ImGui(?:NET\.ImGui)?\.(\w+)\(", text):
|
||||
if not found("ig", m.group(1)):
|
||||
missing.append(f"{f.relative_to(ROOT)}:{text.count(chr(10), 0, m.start()) + 1}: ImGui.{m.group(1)}")
|
||||
# Direct native calls name the exact export (overload suffix included).
|
||||
for m in re.finditer(r"\bImGuiNative\.(\w+)\(", text):
|
||||
if m.group(1) not in exports:
|
||||
missing.append(f"{f.relative_to(ROOT)}:{text.count(chr(10), 0, m.start()) + 1}: ImGuiNative.{m.group(1)}")
|
||||
for m in re.finditer(r"\b(dl|clipper|io\.Fonts|style)\.(\w+)\(", text):
|
||||
if not found(MEMBER_PREFIX[m.group(1)], m.group(2)):
|
||||
missing.append(f"{f.relative_to(ROOT)}:{text.count(chr(10), 0, m.start()) + 1}: {m.group(1)}.{m.group(2)}")
|
||||
|
||||
if missing:
|
||||
print("ImGui calls with no export in cimgui.dll:")
|
||||
print("\n".join(" " + m for m in missing))
|
||||
return 1
|
||||
print(f"OK: every ImGui call resolves ({len(exports)} exports).")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
|
@ -31,6 +31,12 @@ This tool checks it statically (read-only, stdlib-only, out-of-process):
|
|||
construction). Catches a NEW mutator added with no marshal at all (the
|
||||
SelectItem-before-74f6d8c situation).
|
||||
|
||||
CHECK C (raw writes): every method that stores into memory with
|
||||
`Marshal.Write*(...)` or the `WriteFloat(...)` helper must contain the gate,
|
||||
or sit in an allow-listed context, or be on RAW_WRITE_ALLOW. CHECK B only
|
||||
sees native delegate calls, so a raw store into a live AC object (the
|
||||
SetPlayerHeadingDirect quaternion write, 2026-09-29) slipped past it.
|
||||
|
||||
Exit 0 = invariant holds, 1 = a violation (an AC mutator reachable off-thread),
|
||||
2 = could not read the source tree. Wire into CI next to the golden tests /
|
||||
pe_pattern gate.
|
||||
|
|
@ -54,9 +60,26 @@ MUTATOR_DELEGATES = {
|
|||
"_setSelectedObject", "_useObject", "_useObjectOn", "_useWithTargetEvent",
|
||||
"_useEquippedItem", "_moveItemExternal", "_moveItemInternal",
|
||||
"_eventStackableMerge", "_addTextToScroll",
|
||||
# CM_Inventory sends (inventory game actions): give, wield, drop (Inventory panel)
|
||||
"_eventGiveObjectRequest", "_eventGetAndWieldItem", "_eventDropItem",
|
||||
"_setAutoRun", "_turnToHeading", "_stopCompletely", "_setMotion",
|
||||
"_changeCombatMode",
|
||||
"_sendShopEvent", # VendorTrade: gmVendorUI::SendShopEvent (vendor buy/sell + busy count)
|
||||
# PlayerTrade (v72): CM_Trade trade actions + ClientTradeSystem accept/decline (Trade object)
|
||||
"_eventOpenTradeNegotiations", "_eventAddToTrade", "_eventResetTrade",
|
||||
"_eventCloseTradeNegotiations", "_tradeSystemAcceptTrade", "_tradeSystemDeclineTrade",
|
||||
# Salvage panel: open notice + gmSalvageUI AddNewItem/Salvage (UIElement tree)
|
||||
"_sendNoticeOpenSalvagePanel", "_gmSalvageUIAddNewItem", "_gmSalvageUISalvage",
|
||||
# CombatActionHooks game-action sends (AC heap alloc + send queue; 0xC8 also bumps busy count)
|
||||
"_requestId", "_queryHealth", "_cancelAttack",
|
||||
# MovementActionHooks: CM_Movement::Event_AutonomyLevel (0xF752 game-action send)
|
||||
"_autonomyLevel",
|
||||
# CharacterManagementHooks: CPlayerSystem::LogOnCharacter (login state + login send);
|
||||
# the auto-login poll threads marshal it through MainThreadTick's request slot
|
||||
"_logOnCharacter",
|
||||
# PlayerTraining: CM_Train raise senders (RaiseAttribute / RaiseVital / RaiseSkill game actions)
|
||||
"_eventTrainAttribute", "_eventTrainAttribute2nd", "_eventTrainSkill",
|
||||
"_eventTrainSkillAdvancementClass", # 0x0047 TrainSkill (untrained -> trained with credits)
|
||||
}
|
||||
GATE = "MainThreadGuard.IsOnMainThread"
|
||||
ENQUEUE = "AcMainThreadQueue.Enqueue"
|
||||
|
|
@ -67,6 +90,18 @@ ENQUEUE = "AcMainThreadQueue.Enqueue"
|
|||
# (file, method) pairs, each verified to do no off-thread AC mutation.
|
||||
ENQUEUE_PRODUCER_ALLOW = {
|
||||
("AutoIdService.cs", "DrainTick"), # appraisal: enqueues 0xC8, sent on main thread in DrainRequestIds
|
||||
("RynthCoreChatCommands.cs", "Reply"), # /rc and /rv plates replies: only EnqueueWriteToChat
|
||||
}
|
||||
|
||||
# CHECK C sinks: raw stores into memory. Comments are stripped before matching.
|
||||
RAW_WRITE = re.compile(r"\bMarshal\.Write(?:Byte|Int16|Int32|Int64|IntPtr)\s*\(|(?<![\w.])WriteFloat\s*\(")
|
||||
|
||||
# Raw writers that do NOT touch live AC object state, so they need no gate.
|
||||
# (file, method) pairs, each verified by reading the body.
|
||||
RAW_WRITE_ALLOW = {
|
||||
("PlayerPhysicsHooks.cs", "WriteFloat"), # the helper itself; its callers are checked
|
||||
("ThreadStackSampler.cs", "SampleAll"), # writes ContextFlags into its OWN CONTEXT buffer
|
||||
("DatFileShareHooks.cs", "WriteIatPointer"), # IAT slot patch under VirtualProtect (hook plumbing, no callers today)
|
||||
}
|
||||
|
||||
# Methods that run on AC's main thread BY CONSTRUCTION and may call mutators
|
||||
|
|
@ -128,7 +163,7 @@ def main():
|
|||
return 2
|
||||
|
||||
violations = []
|
||||
checked_a = checked_b = 0
|
||||
checked_a = checked_b = checked_c = 0
|
||||
|
||||
deleg_call = re.compile(r"(" + "|".join(re.escape(d) for d in MUTATOR_DELEGATES) + r")\s*\(")
|
||||
|
||||
|
|
@ -156,6 +191,14 @@ def main():
|
|||
checked_b += 1
|
||||
violations.append((fn, line, name, f"invokes AC-mutator delegate {hit}() without a MainThreadGuard gate"))
|
||||
|
||||
# CHECK C: raw memory store without the gate.
|
||||
if not allowed and not gated and (fn, name) not in RAW_WRITE_ALLOW:
|
||||
code = "\n".join(l.split("//", 1)[0] for l in body.splitlines())
|
||||
m = RAW_WRITE.search(code)
|
||||
if m:
|
||||
checked_c += 1
|
||||
violations.append((fn, line, name, f"raw memory write {m.group(0).rstrip('( ')}() without a MainThreadGuard gate"))
|
||||
|
||||
if violations:
|
||||
for fn, line, name, why in violations:
|
||||
print(f" [VIOLATION] {fn}:{line} {name}() - {why}")
|
||||
|
|
@ -165,7 +208,7 @@ def main():
|
|||
return 1
|
||||
|
||||
print(f"PASS: every marshalled helper is gated and every curated AC-mutator "
|
||||
f"delegate is invoked behind the main-thread gate.")
|
||||
f"delegate is invoked and every raw memory write sits behind the main-thread gate.")
|
||||
return 0
|
||||
|
||||
|
||||
|
|
|
|||
94
tools/check_phosphor_icons.py
Normal file
94
tools/check_phosphor_icons.py
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
"""Checks src/RynthCore.Engine/ImGui/PhosphorIcons.cs against the Phosphor font.
|
||||
|
||||
- every constant's code point is in the font's cmap;
|
||||
- its name matches the font's own name for that code point (the font's
|
||||
ligature table spells each icon's kebab-case name; single-letter names
|
||||
such as "x" have no ligature and are only checked by code point);
|
||||
- Baked holds every constant the ImGui code uses (PhosphorIcons.Name), so
|
||||
no icon draws as nothing because it isn't in the atlas.
|
||||
|
||||
Needs fontTools (pip install fonttools). Exit code 1 on any problem.
|
||||
Usage: python tools/check_phosphor_icons.py
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
from fontTools.ttLib import TTFont
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
ENGINE = os.path.join(ROOT, 'src', 'RynthCore.Engine')
|
||||
FONT = os.path.join(ENGINE, 'Assets', 'Fonts', 'Phosphor.ttf')
|
||||
ICONS = os.path.join(ENGINE, 'ImGui', 'PhosphorIcons.cs')
|
||||
IMGUI = os.path.join(ENGINE, 'ImGui')
|
||||
|
||||
|
||||
def ligature_names(font):
|
||||
"""{kebab-name: code point} from the font's GSUB ligatures."""
|
||||
cmap = font.getBestCmap()
|
||||
by_glyph = {}
|
||||
for cp, glyph in cmap.items():
|
||||
by_glyph.setdefault(glyph, cp)
|
||||
letters = {g: chr(cp) for g, cp in by_glyph.items() if cp < 0x80}
|
||||
names = {}
|
||||
for lookup in font['GSUB'].table.LookupList.Lookup:
|
||||
for sub in lookup.SubTable:
|
||||
if sub.LookupType == 7:
|
||||
sub = sub.ExtSubTable
|
||||
for first, ligs in getattr(sub, 'ligatures', {}).items():
|
||||
for lig in ligs:
|
||||
name = ''.join(letters.get(g, '?') for g in [first] + list(lig.Component))
|
||||
if lig.LigGlyph in by_glyph:
|
||||
names[name] = by_glyph[lig.LigGlyph]
|
||||
return names
|
||||
|
||||
|
||||
def kebab(pascal):
|
||||
return re.sub(r'(?<!^)(?=[A-Z])', '-', pascal).lower()
|
||||
|
||||
|
||||
def main():
|
||||
font = TTFont(FONT)
|
||||
cmap = font.getBestCmap()
|
||||
names = ligature_names(font)
|
||||
src = open(ICONS, encoding='utf-8-sig').read()
|
||||
consts = {m.group(1): int(m.group(2), 16)
|
||||
for m in re.finditer(r'public const string (\w+) = "\\u([0-9A-Fa-f]{4})";', src)}
|
||||
baked_expr = re.search(r'public const string Baked =(.*?);', src, re.S).group(1)
|
||||
baked = set(re.findall(r'\b([A-Z]\w*)\b', baked_expr))
|
||||
|
||||
problems = []
|
||||
for name, cp in sorted(consts.items()):
|
||||
if cp not in cmap:
|
||||
problems.append(f'{name}: U+{cp:04X} is not in the font')
|
||||
k = kebab(name)
|
||||
if k in names and names[k] != cp:
|
||||
problems.append(f'{name}: U+{cp:04X}, but the font has {k} at U+{names[k]:04X}')
|
||||
elif k not in names:
|
||||
print(f'note: {name} ({k}) has no ligature name in the font; checked by code point only')
|
||||
for name in sorted(baked - consts.keys()):
|
||||
problems.append(f'Baked names {name}, which is not a constant')
|
||||
|
||||
used = set()
|
||||
for dirpath, _, files in os.walk(IMGUI):
|
||||
for f in files:
|
||||
if f.endswith('.cs') and f != 'PhosphorIcons.cs':
|
||||
text = open(os.path.join(dirpath, f), encoding='utf-8-sig').read()
|
||||
used |= set(re.findall(r'PhosphorIcons\.(\w+)', text))
|
||||
used -= {'Baked', 'DrawCentered'}
|
||||
for name in sorted(used - consts.keys()):
|
||||
problems.append(f'PhosphorIcons.{name} is used but not declared')
|
||||
for name in sorted((used & consts.keys()) - baked):
|
||||
problems.append(f'PhosphorIcons.{name} is used but not in Baked (it would draw as nothing)')
|
||||
unused = sorted(baked - used)
|
||||
if unused:
|
||||
print('note: in Baked but not used by the ImGui code: ' + ', '.join(unused))
|
||||
|
||||
print(f'{len(consts)} constants, {len(baked)} baked, {len(used)} used.')
|
||||
for p in problems:
|
||||
print('PROBLEM: ' + p)
|
||||
return 1 if problems else 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
47
tools/navdata/Build-TownNet.ps1
Normal file
47
tools/navdata/Build-TownNet.ps1
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Rebuilds townnet.json: the Town Network's portals (world database) and the walks inside (dats).
|
||||
|
||||
.DESCRIPTION
|
||||
1. gen_townnet.py reads the portals from the world database (SELECT only, over ssh; or from a
|
||||
dump with -FromDump) and writes townnet.json.
|
||||
2. RynthSuite's Tools\RynthNav.TownNet adds a checked walk from every arrival point to every
|
||||
exit portal, from the retail dats (read only), then checks the file again.
|
||||
|
||||
The live NavData folder is refused unless -ForceLive: copy the result there when it ships.
|
||||
|
||||
.EXAMPLE
|
||||
tools\navdata\Build-TownNet.ps1
|
||||
tools\navdata\Build-TownNet.ps1 -FromDump C:\Temp\tndump -Map C:\Temp\townnet.svg
|
||||
#>
|
||||
param(
|
||||
[string]$Out = (Join-Path $PSScriptRoot "NavData"),
|
||||
[string]$RynthSuite = (Join-Path $PSScriptRoot "..\..\..\RynthSuite"),
|
||||
[string]$Ac = "C:\Games\ACE\Dats",
|
||||
[string]$FromDump,
|
||||
[string]$Dump,
|
||||
[string]$Map, # also draw the floor plan with the walks (SVG)
|
||||
[switch]$ForceLive
|
||||
)
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$outFull = [IO.Path]::GetFullPath($Out).TrimEnd('\')
|
||||
if (-not $ForceLive -and $outFull -ieq "C:\Games\RynthCore\NavData") {
|
||||
throw "$outFull is the live NavData folder; pass -ForceLive to write there."
|
||||
}
|
||||
$tool = Join-Path $RynthSuite "Tools\RynthNav.TownNet\RynthNav.TownNet.csproj"
|
||||
if (-not (Test-Path $tool)) { throw "RynthNav.TownNet not found at $tool (pass -RynthSuite <checkout>)" }
|
||||
|
||||
$py = @("$PSScriptRoot\gen_townnet.py", "--out", $outFull)
|
||||
if ($FromDump) { $py += @("--from-dump", $FromDump) }
|
||||
if ($Dump) { $py += @("--dump", $Dump) }
|
||||
python @py
|
||||
if ($LASTEXITCODE -ne 0) { throw "gen_townnet.py failed" }
|
||||
|
||||
$json = Join-Path $outFull "townnet.json"
|
||||
dotnet run -c Release --project $tool -- build --in $json --ac $Ac
|
||||
if ($LASTEXITCODE -ne 0) { throw "RynthNav.TownNet build: some walks failed (see above)" }
|
||||
dotnet run -c Release --no-build --project $tool -- check --in $json --ac $Ac
|
||||
if ($LASTEXITCODE -ne 0) { throw "RynthNav.TownNet check failed" }
|
||||
if ($Map) { dotnet run -c Release --no-build --project $tool -- map --in $json --ac $Ac --out $Map }
|
||||
Write-Host "townnet.json ready: $json"
|
||||
10770
tools/navdata/NavData/locations.json
Normal file
10770
tools/navdata/NavData/locations.json
Normal file
File diff suppressed because it is too large
Load diff
648
tools/navdata/NavData/portals.tsv
Normal file
648
tools/navdata/NavData/portals.tsv
Normal file
|
|
@ -0,0 +1,648 @@
|
|||
45.4 -42.3 57.5 -52.8 Adams' Beach Portal
|
||||
66.5 14.1 28.8 -36.8 Adept's Domain Portal
|
||||
-0.9 19.0 1.6 36.1 Adventurer's Haven Cottages Portal
|
||||
42.1 33.6 84.1 47.2 Aerlinthe Island (Instance)
|
||||
42.1 33.6 84.1 47.2 Aerlinthe Island (Player Killer)
|
||||
-33.5 12.9 -21.7 18.4 Ahr-Zona Portal
|
||||
-31.3 72.6 -28.2 75.1 Aimaru Plains Cottages Portal
|
||||
5.8 4.3 -12.1 -2.7 Al-Arqis Cottages Portal
|
||||
-33.5 13.2 -34.5 18.1 Al-Hatar Settlement Portal
|
||||
-33.6 13.1 -33.2 9.8 Al-Kasan Settlement Portal
|
||||
-49.2 26.0 -47.1 16.9 Al-Mar Oasis Portal
|
||||
-33.4 13.1 -12.1 14.4 Al-Nosaj Portal
|
||||
5.8 4.3 20.0 10.4 Alfreth Ridge Cottages Portal
|
||||
45.5 -42.4 50.3 -26.4 Aloria Portal
|
||||
32.9 59.5 68.2 40.7 Alvador Portal
|
||||
27.8 29.4 38.7 -9.6 Amarand Villas Portal
|
||||
66.5 14.1 69.5 -4.0 Anadil Portal
|
||||
-22.5 0.2 -7.1 -2.7 Aqalah Portal
|
||||
-49.5 25.9 -39.9 33.0 Ardent Realm Portal
|
||||
-30.5 94.5 -16.7 77.1 Ariake Portal
|
||||
-24.9 29.8 -23.0 37.2 Arida Butte Portal
|
||||
-33.5 13.2 -24.7 15.2 Arqasanti Portal
|
||||
-24.8 29.6 -9.6 4.6 Arrak Portal
|
||||
-41.4 82.1 64.8 72.1 Arrowdale Cottages Portal
|
||||
32.9 59.6 -84.7 12.8 Artifice Cottages Portal
|
||||
17.5 61.6 56.9 -27.1 Asandra Cottages Portal
|
||||
2.1 50.5 -0.9 39.9 Asbel Domain Portal
|
||||
16.2 69.3 21.3 69.2 Asheron's Castle
|
||||
17.9 64.3 16.1 69.3 Asheron's Island
|
||||
45.3 -42.3 51.9 -45.6 Auralla Settlement Portal
|
||||
27.9 29.6 23.3 26.5 Auroch Pasture Estates Portal
|
||||
-49.3 25.9 -56.9 20.6 Avatania Cottages Portal
|
||||
-74.9 17.6 30.5 -40.7 Axefall Glen Portal
|
||||
-27.1 59.9 -39.0 55.4 Ayn Tayan Portal
|
||||
-74.8 17.9 84.1 -31.1 Azaroth Cottages Portal
|
||||
-76.0 -67.1 65.0 49.3 Bandit Castle
|
||||
42.5 60.5 65.0 49.3 Bandit Castle Portal
|
||||
45.8 -8.0 65.0 49.3 Bandit Castle Portal
|
||||
66.2 14.3 71.1 43.7 Bandit Road Villas Portal
|
||||
33.1 59.5 64.9 37.6 Baron's Domain Portal
|
||||
19.5 17.5 19.6 17.0 Base of Mt. Alphus
|
||||
20.2 15.0 19.6 17.0 Base of Mt. Alphus
|
||||
11.2 12.2 11.6 12.3 Base of Mt. Syliph
|
||||
42.3 -77.9 42.0 -77.8 Base of the Cliffs Portal
|
||||
44.1 -77.8 43.9 -77.7 Base of the Timaru Plateau Portal
|
||||
5.7 4.3 1.7 -5.1 Bay of Sands Portal
|
||||
17.6 61.4 47.4 69.6 Beach Pass Villas Portal
|
||||
-9.4 -71.9 23.6 63.5 Beachside
|
||||
71.7 -61.0 79.2 -68.0 Beacon Tower
|
||||
79.2 -68.0 71.7 -61.0 Beacon Tower Exit
|
||||
80.2 -68.2 71.7 -61.0 Beacon Tower Exit
|
||||
80.2 -67.8 71.7 -61.0 Beacon Tower Exit
|
||||
80.4 -68.0 71.7 -61.0 Beacon Tower Exit
|
||||
28.0 29.5 14.7 19.4 Bellig Mesa Cottages Portal
|
||||
-49.4 25.9 -41.2 26.8 Bhah Dhah Villas Portal
|
||||
-62.2 -50.5 -62.4 -52.3 Black Hill
|
||||
-27.2 60.0 -27.8 46.8 Blackmire Edge Cottages Portal
|
||||
-10.4 45.6 27.9 -3.8 Blazing Wand Villas Portal
|
||||
-33.5 13.0 -14.5 9.6 Bleached Skull Wastes Settlement Portal
|
||||
33.0 59.5 53.5 41.7 Bleak Valley Portal
|
||||
-41.5 82.2 -20.3 78.5 Bluewater Cottages Portal
|
||||
-83.0 48.1 73.6 -42.3 Brazenn Domain Portal
|
||||
66.2 14.3 68.1 36.7 Bretslef Cottages Portal
|
||||
-49.3 26.0 -60.9 24.9 Brigand Sands Cottages Portal
|
||||
-74.8 17.8 -89.5 31.0 Brigands Bay Settlement Portal
|
||||
12.8 -1.7 25.7 -0.8 Bright Blade Cottages Portal
|
||||
-10.4 45.7 -12.1 63.5 Broadacre Cottages Portal
|
||||
33.1 59.5 72.1 55.2 Broken Haft Vale Portal
|
||||
-24.8 29.8 -16.9 37.2 Broken Sword Bethel Settlement Portal
|
||||
5.8 4.3 41.3 15.6 Bucolic Villas Portal
|
||||
-1.0 18.9 -9.0 24.8 Cactus Acres Portal
|
||||
45.5 -42.3 55.2 -49.6 Caerlin Cottages Portal
|
||||
32.9 59.4 30.1 65.8 Cape Feirgard Cottages Portal
|
||||
75.9 -61.3 82.1 -74.2 Cataracts of Sabella
|
||||
66.5 14.2 92.2 9.9 Celcynd Cottages Portal
|
||||
66.4 14.3 86.7 29.4 Celdiseth's Beach Settlement Portal
|
||||
23.9 -28.0 56.1 -75.2 Central Tuatara Plains Portal
|
||||
-25.0 29.8 -0.2 30.4 Charbone Ridge Portal
|
||||
-0.8 19.1 39.3 4.0 Charnhold Portal
|
||||
-31.3 72.6 -29.3 70.0 Chi Zou Cottages Portal
|
||||
26.3 46.3 59.3 40.9 Colier View Hill Portal
|
||||
26.2 46.3 20.1 43.6 Cragstone Farms Portal
|
||||
-39.4 81.3 25.9 48.4 Cragstone Portal
|
||||
22.2 51.9 25.3 50.0 Cragstone Portal
|
||||
-10.4 45.8 -14.6 66.4 Crescent Lane Cottages Portal
|
||||
32.9 59.6 83.3 28.8 Dagger Vale Portal
|
||||
-30.4 94.5 42.5 -26.3 Dame Tolani Villas Portal
|
||||
16.6 -1.6 23.2 -29.9 Danby's Outpost
|
||||
-0.9 19.1 35.3 -8.7 Darasa Villas Portal
|
||||
2.2 50.5 9.5 40.7 Darawyll Village Portal
|
||||
12.6 -1.6 36.0 -24.1 Deepvale Cottages Portal
|
||||
32.8 59.4 57.8 2.4 Defiant Prey Cottages Portal
|
||||
-24.9 29.5 8.9 32.0 Demonsbane Cottages Portal
|
||||
17.4 61.6 7.1 -9.1 Desert Boundary Cottages Portal
|
||||
-33.4 13.1 -15.2 13.7 Desert Mirage Cottages Portal
|
||||
-72.2 90.6 17.6 19.6 Desert Northern Edge Portal
|
||||
-78.1 -48.6 -5.6 40.0 Desert Ridge Border
|
||||
-72.7 14.0 -5.6 40.0 Desert Ridge Border
|
||||
-11.2 37.4 -5.6 40.0 Desert Ridge Border
|
||||
54.3 -4.2 -5.6 40.0 Desert Ridge Border
|
||||
-49.3 25.9 -43.9 11.8 Desert Vanguard Cottages Portal
|
||||
69.7 -20.2 82.4 -43.5 Desolation Beach Portal
|
||||
40.1 -76.1 46.1 -89.8 Destroyed Ahurenga Portal
|
||||
68.6 -20.7 46.1 -89.8 Destroyed Ahurenga Portal
|
||||
-48.1 24.6 7.2 5.0 Destroyed Al-Jalima Portal
|
||||
33.6 57.2 7.2 5.0 Destroyed Al-Jalima Portal
|
||||
-82.6 63.8 -49.3 62.9 Destroyed Baishi Portal
|
||||
-61.5 52.7 -49.3 62.9 Destroyed Baishi Portal
|
||||
-58.8 -88.4 -49.3 62.9 Destroyed Baishi Portal
|
||||
-34.4 64.7 16.9 63.5 Destroyed Eastham Portal
|
||||
-82.6 -70.2 29.8 26.4 Destroyed Glenden Wood Portal
|
||||
21.5 -51.6 29.8 26.4 Destroyed Glenden Wood Portal
|
||||
36.7 29.1 29.8 26.4 Destroyed Glenden Wood Portal
|
||||
-47.7 25.0 -53.9 74.3 Destroyed Lin Portal
|
||||
9.5 60.0 1.1 51.7 Destroyed Lytelthorpe Portal
|
||||
-86.2 -0.7 -61.9 82.5 Destroyed Mayoi Portal
|
||||
-83.6 -34.6 -61.9 82.5 Destroyed Mayoi Portal
|
||||
-66.4 60.1 -61.9 82.5 Destroyed Mayoi Portal
|
||||
54.4 -4.1 -61.9 82.5 Destroyed Mayoi Portal
|
||||
29.3 -52.0 44.5 -43.1 Destroyed Plateau Portal
|
||||
26.2 63.9 33.3 56.6 Destroyed Portal to Arwic
|
||||
40.9 55.8 33.3 56.6 Destroyed Portal to Arwic
|
||||
-52.7 79.8 39.5 -75.3 Destroyed Portal to Bluespire
|
||||
-28.3 13.6 39.5 -75.3 Destroyed Portal to Bluespire
|
||||
1.2 54.0 39.5 -75.3 Destroyed Portal to Bluespire
|
||||
47.4 -88.9 39.5 -75.3 Destroyed Portal to Bluespire
|
||||
14.8 0.7 25.9 48.4 Destroyed Portal to Cragstone
|
||||
52.2 3.0 25.9 48.4 Destroyed Portal to Cragstone
|
||||
70.4 -34.5 25.9 48.4 Destroyed Portal to Cragstone
|
||||
71.2 -61.3 90.3 -43.3 Destroyed Portal to Eastwatch
|
||||
-33.6 72.4 43.2 -66.8 Destroyed Portal to Greenspire
|
||||
-21.7 -1.8 43.2 -66.8 Destroyed Portal to Greenspire
|
||||
11.1 59.6 43.2 -66.8 Destroyed Portal to Greenspire
|
||||
40.6 -82.4 43.2 -66.8 Destroyed Portal to Greenspire
|
||||
-88.2 -64.6 -38.9 82.6 Destroyed Portal to Hebian-To
|
||||
23.6 -7.7 -38.9 82.6 Destroyed Portal to Hebian-To
|
||||
25.4 47.8 -38.9 82.6 Destroyed Portal to Hebian-To
|
||||
-1.6 18.4 42.1 33.6 Destroyed Portal to Holtburg
|
||||
1.7 49.9 42.1 33.6 Destroyed Portal to Holtburg
|
||||
10.1 57.4 42.1 33.6 Destroyed Portal to Holtburg
|
||||
38.3 -75.5 42.1 33.6 Destroyed Portal to Holtburg
|
||||
54.2 -4.1 42.1 33.6 Destroyed Portal to Holtburg
|
||||
57.6 37.6 42.1 33.6 Destroyed Portal to Holtburg
|
||||
70.5 -8.1 42.1 33.6 Destroyed Portal to Holtburg
|
||||
72.3 -60.7 42.1 33.6 Destroyed Portal to Holtburg
|
||||
-54.9 73.1 -47.5 25.6 Destroyed Portal to Khayyaban
|
||||
7.5 5.1 -47.5 25.6 Destroyed Portal to Khayyaban
|
||||
-70.2 84.6 -74.6 84.2 Destroyed Portal to Kryst
|
||||
40.5 -83.7 -52.2 82.5 Destroyed Portal to Nanto
|
||||
-15.9 46.7 40.6 -83.0 Destroyed Portal to Redspire
|
||||
-3.5 22.4 40.6 -83.0 Destroyed Portal to Redspire
|
||||
42.6 33.4 40.6 -83.0 Destroyed Portal to Redspire
|
||||
43.3 -68.2 40.6 -83.0 Destroyed Portal to Redspire
|
||||
70.1 -61.9 40.6 -83.0 Destroyed Portal to Redspire
|
||||
2.3 52.0 10.8 59.3 Destroyed Portal to Rithwic
|
||||
-32.6 14.4 -3.2 19.0 Destroyed Portal to Samsur
|
||||
-34.3 73.4 72.1 -60.9 Destroyed Portal to Sanamar
|
||||
-22.1 -1.5 72.1 -60.9 Destroyed Portal to Sanamar
|
||||
40.8 -83.1 72.1 -60.9 Destroyed Portal to Sanamar
|
||||
41.0 35.5 72.1 -60.9 Destroyed Portal to Sanamar
|
||||
72.9 -73.2 72.1 -60.9 Destroyed Portal to Sanamar
|
||||
90.3 -43.2 72.1 -60.9 Destroyed Portal to Sanamar
|
||||
-14.7 46.5 -33.5 72.8 Destroyed Portal to Shoushi
|
||||
11.0 59.3 -33.5 72.8 Destroyed Portal to Shoushi
|
||||
72.3 -60.7 -33.5 72.8 Destroyed Portal to Shoushi
|
||||
-54.0 73.9 -30.4 94.7 Destroyed Portal to Tou-Tou
|
||||
7.1 4.5 -30.4 94.7 Destroyed Portal to Tou-Tou
|
||||
33.8 56.4 -30.4 94.7 Destroyed Portal to Tou-Tou
|
||||
71.2 -61.3 72.8 -73.4 Destroyed Portal to Westwatch
|
||||
-52.7 80.3 -10.7 46.5 Destroyed Portal to Yanshi
|
||||
91.3 49.7 -10.7 46.5 Destroyed Portal to Yanshi
|
||||
-71.0 52.3 -21.5 -1.8 Destroyed Portal to Yaraq
|
||||
-12.1 46.3 -21.5 -1.8 Destroyed Portal to Yaraq
|
||||
-3.8 18.6 -21.5 -1.8 Destroyed Portal to Yaraq
|
||||
42.5 -67.5 -21.5 -1.8 Destroyed Portal to Yaraq
|
||||
72.3 -60.7 -21.5 -1.8 Destroyed Portal to Yaraq
|
||||
23.4 -7.8 13.5 0.7 Destroyed Portal to Zaikhal
|
||||
26.4 48.6 13.5 0.7 Destroyed Portal to Zaikhal
|
||||
82.2 -50.2 13.5 0.7 Destroyed Portal to Zaikhal
|
||||
83.1 -51.4 13.5 0.7 Destroyed Portal to Zaikhal
|
||||
83.4 -49.3 13.5 0.7 Destroyed Portal to Zaikhal
|
||||
84.1 -50.4 13.5 0.7 Destroyed Portal to Zaikhal
|
||||
-82.2 -36.5 -74.7 19.6 Destroyed Qalaba'r Portal
|
||||
14.7 -0.8 -74.7 19.6 Destroyed Qalaba'r Portal
|
||||
-82.5 63.8 -29.1 58.9 Destroyed Sawato Portal
|
||||
-73.5 -36.2 -29.1 58.9 Destroyed Sawato Portal
|
||||
85.8 -27.6 68.7 -21.8 Destroyed Stonehold Portal
|
||||
-60.6 -88.1 -24.8 28.4 Destroyed Uziz Portal
|
||||
2.2 50.3 -1.7 33.6 Devana Portal
|
||||
5.7 4.2 11.1 23.5 Dillo Butte Settlement Portal
|
||||
45.5 -42.3 23.1 -54.2 Dire's Edge Portal
|
||||
72.2 -35.6 -88.3 -64.5 Direlands Midland Portal
|
||||
-74.0 -52.4 5.8 -91.0 Direlands Northwest Shore Portal
|
||||
-74.2 -52.4 -42.9 -63.5 Direlands Valleys Portal
|
||||
69.7 -20.2 78.1 -16.9 Dires' Door Estates Portal
|
||||
-83.0 48.1 33.0 -22.2 Direvale Villas Portal
|
||||
-25.0 29.8 -16.1 21.4 Djebel al-Nar Cottages Portal
|
||||
-33.4 13.2 -22.3 11.1 Djinaya Wind Cottages Portal
|
||||
-1.1 18.9 24.2 10.5 Dovetail Valley Villas Portal
|
||||
-65.3 -43.3 -65.3 -43.4 Down to Surface
|
||||
-33.6 13.2 -29.5 18.8 Dry Bone Manors Portal
|
||||
-30.5 94.6 -12.8 77.2 Dryreach Beach Cottages Portal
|
||||
17.4 61.5 -3.9 76.3 Dryreach Beach Manors Portal
|
||||
-25.1 29.8 -8.8 28.0 Drytree Settlement Portal
|
||||
-49.5 26.0 -47.5 19.9 Dunes End Cottages Portal
|
||||
69.7 -20.3 42.5 4.7 Durglen Portal
|
||||
5.7 4.4 7.7 17.7 East Al-Jalima Villas Portal
|
||||
12.6 -1.7 24.9 -23.9 East Danby Portal
|
||||
-8.1 74.5 -39.8 -54.1 East Direlands Swamp
|
||||
66.3 14.3 72.5 28.0 East Esper Valley Portal
|
||||
2.2 50.4 0.2 57.9 East Lytelthorpe Settlement Portal
|
||||
69.7 -20.1 35.2 -15.1 East Morntide Settlement Portal
|
||||
45.4 -42.4 38.5 -12.7 East Morntide Villas Portal
|
||||
8.7 60.9 10.4 66.3 East Rithwic Estates Portal
|
||||
-27.2 59.9 -27.6 63.9 East Sawato Settlement Portal
|
||||
32.9 59.4 32.9 48.4 East Span Way Settlement Portal
|
||||
-72.4 82.2 18.5 65.8 Eastham Beach Portal
|
||||
27.8 29.5 32.5 18.5 Eaves of Tiofor Settlement Portal
|
||||
-74.8 17.7 -61.7 14.5 Ebbing Tide Villas Portal
|
||||
12.7 -1.6 27.0 -18.2 Embara Portal
|
||||
-27.1 59.9 -38.2 43.3 Empyrean Fields Cottages Portal
|
||||
69.7 -20.2 83.4 -40.3 Empyrean Shore Villas Portal
|
||||
2.1 50.4 5.7 36.9 Enchanter's Meadow Portal
|
||||
32.9 59.5 41.0 60.7 Eotensfang Cottages Portal
|
||||
65.0 49.3 42.3 60.5 Eotensfang Portal
|
||||
-49.3 26.0 -56.9 35.3 Erevana Villas Portal
|
||||
40.2 35.1 41.6 40.7 Evensong Settlement Portal
|
||||
-35.1 33.7 -34.0 33.5 Exit
|
||||
-29.6 91.3 -29.0 91.7 Exit
|
||||
12.1 2.3 12.4 2.1 Exit
|
||||
88.9 -67.8 89.2 -67.8 Exit Karlun's Fort
|
||||
-2.8 -82.8 -4.5 -84.4 Exit Portal
|
||||
-2.8 -82.8 -4.5 -81.2 Exit Portal
|
||||
-27.1 60.0 61.5 65.7 Explorer's Villas Portal
|
||||
45.3 -42.4 48.8 -43.9 Fadsahil Settlement Portal
|
||||
32.9 59.4 54.4 59.5 Far Claw Villas Portal
|
||||
26.1 46.3 92.9 -2.4 Far Horizon Cottages Portal
|
||||
-10.2 45.6 -15.2 41.0 Faranar Foothills Portal
|
||||
5.7 4.2 24.1 -19.1 Fearnot Valley Cottages Portal
|
||||
17.5 61.4 13.4 63.4 Filos' Font Cottages Portal
|
||||
27.8 29.6 46.5 10.6 Firedew Portal
|
||||
-10.4 45.7 38.4 -26.3 Firesong Cottages Portal
|
||||
76.6 -58.6 95.9 -56.8 Fiun Outpost
|
||||
-60.8 80.2 -62.3 68.9 Font Alpa Portal
|
||||
26.2 46.3 14.1 37.8 Forgotten Hills Portal
|
||||
12.4 2.3 12.2 2.4 Four Towers Entrance
|
||||
5.7 4.3 12.4 5.6 Four Towers Settlement Portal
|
||||
-63.9 97.2 -64.1 97.5 Freebooter Keep
|
||||
66.4 14.3 77.6 6.4 Frosty Dale Cottages Portal
|
||||
8.7 60.8 6.3 62.9 Gaerwel Edge Settlement Portal
|
||||
28.0 29.5 34.4 -11.9 Genem Causland Portal
|
||||
12.6 -1.6 17.6 -12.7 Gharu'n Victory Villas Portal
|
||||
27.9 29.5 32.2 31.0 Glenden Hills East Settlement Portal
|
||||
27.9 29.5 35.0 26.8 Glenden Hills North Settlement Portal
|
||||
8.8 60.9 64.1 29.5 Glystaene Cottages Portal
|
||||
-74.9 17.7 -60.1 32.1 Gredaline Villas Portal
|
||||
-1.0 18.9 7.4 24.6 Greenswath Portal
|
||||
66.5 14.2 80.0 11.3 Greenvale Settlement Portal
|
||||
-87.5 -67.2 -87.6 -67.1 Ground Portal
|
||||
26.2 46.3 73.1 61.0 Haliana Portal
|
||||
-33.6 13.0 -21.6 15.2 Hamud Cottages Portal
|
||||
32.8 59.3 50.4 69.7 Hand-on-Sword Cottages Portal
|
||||
-83.0 48.0 28.1 -22.4 Harmonious Blade Cottages Portal
|
||||
-61.8 40.0 22.6 37.2 Heartland
|
||||
-57.1 -68.9 22.6 37.2 Heartland
|
||||
-31.4 37.0 22.6 37.2 Heartland
|
||||
-2.5 -85.7 22.6 37.2 Heartland
|
||||
68.9 -21.3 22.6 37.2 Heartland
|
||||
-73.2 18.1 -38.9 82.6 Hebian-to Portal
|
||||
12.7 -1.7 22.1 0.7 Helms Villas Portal
|
||||
17.5 61.6 14.6 30.5 Hermit Hill Cottages Portal
|
||||
45.6 -42.4 30.6 -45.4 Hero's Vale Portal
|
||||
69.6 -20.3 59.3 -19.1 Hidden Valley Portal
|
||||
-61.9 40.0 -65.2 60.3 High Mountain Valley
|
||||
26.4 63.9 -65.2 60.3 High Mountain Valley
|
||||
28.0 29.5 63.2 16.9 Highland Manors Portal
|
||||
-72.6 13.8 32.8 34.7 Hilltop
|
||||
1.7 -71.5 32.8 34.7 Hilltop
|
||||
59.7 -4.0 32.8 34.7 Hilltop
|
||||
64.8 13.5 32.8 34.7 Hilltop
|
||||
40.2 35.1 40.7 47.2 Holtburg Wilderness Settlement Portal
|
||||
-24.9 29.5 32.8 -34.3 Hopevale Portal
|
||||
28.0 29.4 28.6 17.7 Howling Wolf Villas Portal
|
||||
66.5 14.2 52.4 5.4 Ianna Portal
|
||||
69.7 -20.3 64.0 -16.7 Ice's Edge Cottages Portal
|
||||
27.9 29.4 25.8 30.0 Iceea Hills Estates Portal
|
||||
-22.4 0.3 -33.0 4.5 Ijaniya Portal
|
||||
-82.9 48.2 -59.9 35.2 Ikama Cottages Portal
|
||||
-10.4 45.6 -15.9 60.7 Imuth Maer Cottages Portal
|
||||
-60.9 80.3 26.4 -33.6 Inquisitor's Dale Cottages Portal
|
||||
-82.9 48.2 -81.5 51.6 Ishilai Inlet Settlement Portal
|
||||
-82.9 48.0 -84.7 51.5 Ishilai Inlet Villas Portal
|
||||
-85.0 -47.8 22.6 51.9 Isle of Tears Portal
|
||||
25.2 49.9 22.6 51.9 Isle of Tears Portal
|
||||
26.2 46.3 52.6 28.0 Ispan Hill Portal
|
||||
8.7 60.8 65.0 65.7 Isparian Flame Estates Portal
|
||||
-63.1 96.0 -82.6 88.8 Ithaenc Archipelago
|
||||
5.7 4.3 -0.1 8.5 Jackcat Canyon Portal
|
||||
-50.1 63.5 -45.6 59.2 Jai-Tan Dale Portal
|
||||
-0.9 19.0 -7.0 22.3 Janaa Ridge Settlement Portal
|
||||
-50.2 63.4 -44.7 49.6 Jasmine Meadow Portal
|
||||
-10.2 45.6 -4.7 44.6 Jenshi Cottages Portal
|
||||
32.9 59.3 53.7 70.4 Jeweled Thorn Estates Portal
|
||||
2.1 50.4 -7.2 60.5 Jin-Lai Stronghold Portal
|
||||
-27.2 60.0 -27.6 43.3 Jinianshi Portal
|
||||
-49.4 26.0 -51.1 36.2 Kanasa Portal
|
||||
55.9 -75.0 38.1 -77.7 Karab Delta Portal
|
||||
89.0 -67.6 88.8 -67.9 Karlun's Fort
|
||||
-50.0 63.5 -46.6 41.5 Kelnen Village Portal
|
||||
8.7 61.0 9.6 36.9 King Pwyll Square Portal
|
||||
-27.2 60.0 -35.9 40.8 Kuyiza Portal
|
||||
-60.9 80.3 74.4 -46.3 Lady Maila Estates Portal
|
||||
69.7 -20.3 67.5 -16.8 Laiti's Villa Portal
|
||||
17.5 61.4 16.7 57.3 Lake Blessed Cottages Portal
|
||||
69.6 -20.2 62.8 0.1 Lake NemuelSettlement Portal
|
||||
-82.9 48.0 -72.0 42.4 Lake Thrasyl Cottages Portal
|
||||
27.8 29.5 37.8 0.7 Lanadryll Cottages Portal
|
||||
-74.9 17.9 -87.2 3.5 Land Bridge Villas Portal
|
||||
45.5 -42.4 23.2 -46.2 Last-Stop-Before-Dires Villas Portal
|
||||
8.7 60.9 12.9 52.9 Leafdawning Settlement Portal
|
||||
-10.4 45.6 -31.8 46.5 Li-Po Cottages Portal
|
||||
-10.4 45.7 -9.0 41.8 Liang Chi Settlement Portal
|
||||
69.7 -20.3 81.8 -17.7 Lightbringer Dale Cottages Portal
|
||||
40.2 35.1 48.0 29.2 Lilyglen Cottages Portal
|
||||
-50.1 63.5 -48.8 69.7 Lin Kiln Park Portal
|
||||
-74.9 17.8 -82.4 31.4 Linvak Tukal Foothills Settlement Portal
|
||||
45.4 -42.3 53.2 -36.2 Lithaenean Cottages Portal
|
||||
-27.3 59.9 -34.3 52.7 Lo-Han Portal
|
||||
69.6 -20.3 81.0 -11.2 Lord Cambarth Villas Portal
|
||||
12.7 -1.6 9.3 -12.7 Loredane Villas Portal
|
||||
26.2 46.4 19.3 26.4 Lost Realm Cottages Portal
|
||||
33.1 59.5 40.0 63.2 Lost Wish Cottages Portal
|
||||
-60.8 80.3 -74.5 65.9 Lugian Meadows Settlement Portal
|
||||
2.2 50.3 -8.9 64.5 Maedew Portal
|
||||
-50.1 63.4 -52.8 52.9 Mage's Pass Portal
|
||||
5.6 4.3 -54.4 15.4 Mahara Cottages Portal
|
||||
12.7 -1.7 25.5 6.7 Maitland Portal
|
||||
12.7 -1.7 30.9 9.0 Majestic Hill Cottages Portal
|
||||
-41.6 82.2 39.5 -22.5 Majestic Saddle Cottages Portal
|
||||
-74.9 17.7 -68.8 30.6 Mattekar Slopes Cottages Portal
|
||||
-79.2 96.9 -60.8 82.8 Mayoi Beach Portal
|
||||
-1.0 18.9 15.3 26.3 Maythen Geroyu Villas Portal
|
||||
-60.8 80.3 -49.4 84.8 Meditation Meadow Portal
|
||||
26.3 46.3 19.8 39.1 Meerthus Square Portal
|
||||
66.5 14.2 26.5 -36.7 Merak Portal
|
||||
8.7 60.9 6.7 54.7 Meridian Cottages Portal
|
||||
17.6 61.4 84.9 1.6 Midhill Cottages Portal
|
||||
5.7 4.3 -0.6 -1.2 Midsong Cottages Portal
|
||||
5.6 4.3 25.0 -3.9 Mimiana Villas Portal
|
||||
-27.3 60.0 -21.6 60.9 Mire Hill Portal
|
||||
5.7 4.4 23.2 -42.3 Mirthless Dale Portal
|
||||
27.8 29.5 30.6 14.6 Mistdweller Villas Portal
|
||||
-33.6 13.1 -37.9 16.0 Monument Sands Settlement Portal
|
||||
-25.1 29.8 32.0 -15.1 Morntide Ascent Cottages Portal
|
||||
-31.3 72.6 -22.2 73.5 Mosswart Place Cottages Portal
|
||||
20.8 18.5 19.7 17.8 Mount Alphus
|
||||
40.2 35.1 50.3 35.4 Mountain Keep Cottages Portal
|
||||
66.2 14.1 58.5 -0.7 Mountain Retreat Cottages Portal
|
||||
28.0 29.5 34.5 22.5 Mountain Ridge Abodes Portal
|
||||
34.9 56.0 41.0 56.0 Mountain Shortcut
|
||||
19.5 16.9 20.2 15.8 Mt. Alphus Valley
|
||||
11.6 12.3 11.2 12.2 Mt. Syliph Plain
|
||||
5.7 4.3 4.3 12.3 Musansayn Portal
|
||||
-1.0 19.0 4.6 20.7 Nal Wadi Cottages Portal
|
||||
12.8 -1.6 31.3 -25.5 Nalib Cavana Settlement Portal
|
||||
-30.5 94.5 -48.9 88.5 Nan-Zari Portal
|
||||
-0.9 19.0 -9.4 11.4 Naqut Dreams Villas Portal
|
||||
-27.1 59.9 -15.8 72.9 Narsys Portal
|
||||
-24.8 29.7 -19.5 32.9 Narziz Cottages Portal
|
||||
2.1 50.4 -7.1 56.9 Neu Gerz Villas Portal
|
||||
8.8 60.9 66.5 57.6 New Cannthalo Portal
|
||||
40.2 35.1 61.1 31.2 New Colier Portal
|
||||
66.2 14.2 53.6 10.4 New Nesortania Portal
|
||||
12.7 -1.6 18.8 4.2 New Suntik Portal
|
||||
66.3 14.3 70.9 23.0 Neydisa Village Portal
|
||||
5.6 4.3 15.3 -17.5 Nidal-Taraq Villas Portal
|
||||
-82.9 48.2 75.6 52.2 Norstead Portal
|
||||
-82.8 48.1 -76.0 53.6 North Adjamaer Cottages Portal
|
||||
-50.1 63.5 -45.0 63.3 North Baishi Cottages Portal
|
||||
15.7 14.2 14.6 13.2 North Dalt
|
||||
-72.7 -43.2 -4.7 -3.1 North Desert Edge
|
||||
-11.4 37.5 -4.7 -3.1 North Desert Edge
|
||||
19.8 -3.3 -4.7 -3.1 North Desert Edge
|
||||
61.6 -10.2 -4.7 -3.1 North Desert Edge
|
||||
-80.2 -42.3 24.4 -53.9 North Direlands Portal
|
||||
20.9 25.9 24.4 -53.9 North Direlands Portal
|
||||
61.4 -10.2 24.4 -53.9 North Direlands Portal
|
||||
17.4 61.5 22.9 60.3 North Eastham Meadow Portal
|
||||
17.3 16.0 16.3 14.7 North Gemm
|
||||
2.2 50.5 6.4 49.0 North Lytelthorpe Villas Portal
|
||||
66.4 14.3 55.2 4.8 North Pass Hollow Cottages Portal
|
||||
-27.3 59.9 -19.8 55.9 North Sawato Villas Portal
|
||||
14.1 12.7 12.7 11.8 North Syliph
|
||||
-24.8 29.7 -21.9 29.9 North Uziz Settlement Portal
|
||||
2.2 50.3 -4.4 48.0 North Yanshi Plains Settlement Portal
|
||||
-22.3 0.2 -15.0 -2.7 North Yaraq Villas Portal
|
||||
41.0 -83.6 52.1 -86.2 Northern Ahurenga Plains Portal
|
||||
40.0 -74.5 50.5 -68.2 Northern Manumet Plains Portal
|
||||
44.5 -41.8 50.5 -68.2 Northern Manumet Plains Portal
|
||||
-45.9 90.8 93.5 7.7 Northern Point
|
||||
69.7 -20.2 83.1 -27.9 Northfire Estates Portal
|
||||
-74.8 17.9 83.2 35.4 Northreach Portal
|
||||
-10.4 45.8 93.9 -5.9 Northwater Cottages Portal
|
||||
-49.4 -70.8 5.5 -87.5 Northwest Direlands Portal
|
||||
79.9 -15.2 5.5 -87.5 Northwest Direlands Portal
|
||||
84.1 47.2 5.5 -87.5 Northwest Direlands Portal
|
||||
33.0 59.4 72.0 52.1 Norvale Portal
|
||||
-50.2 63.5 -49.7 40.2 Oboro Portal
|
||||
-98.0 -94.7 -48.0 -65.0 Obsidian Rim Portal
|
||||
5.5 -87.5 -48.0 -65.0 Obsidian Rim Portal
|
||||
-87.7 -65.1 68.5 79.7 Olthoi Tunnel
|
||||
-62.8 96.2 64.1 80.6 Olthoi Tunnel
|
||||
12.5 -0.0 67.4 80.3 Olthoi Tunnel
|
||||
63.5 81.9 32.4 56.3 Olthoi Tunnel
|
||||
64.1 82.5 69.8 18.8 Olthoi Tunnel
|
||||
64.1 80.6 -62.8 96.2 Olthoi Tunnel
|
||||
65.2 82.0 -14.2 43.1 Olthoi Tunnel
|
||||
65.2 80.7 42.0 -82.7 Olthoi Tunnel
|
||||
65.4 83.6 -75.2 21.5 Olthoi Tunnel
|
||||
65.7 80.3 86.1 -52.3 Olthoi Tunnel
|
||||
66.5 80.2 -93.3 -50.4 Olthoi Tunnel
|
||||
67.4 80.3 12.4 0.0 Olthoi Tunnel
|
||||
67.5 79.8 -26.9 94.9 Olthoi Tunnel
|
||||
68.5 79.7 -87.8 -65.1 Olthoi Tunnel
|
||||
-30.4 94.6 -46.3 87.3 Ong-Hau Village Portal
|
||||
2.2 50.5 5.5 40.8 Osric Cottages Portal
|
||||
-21.6 -74.5 -24.0 -57.8 Outside Accursed Halls Portal
|
||||
-77.4 28.0 -75.7 28.2 Outside Linvak Tukal
|
||||
17.7 61.5 69.6 60.9 P'rnelle Acres Portal
|
||||
-0.8 19.0 11.0 26.4 Palm-of-Stone Villas Portal
|
||||
63.1 76.4 66.3 84.2 Passage to Olthoi Island
|
||||
63.7 75.6 69.6 80.7 Passage to Olthoi Island
|
||||
17.6 63.5 58.5 -10.3 Patriarch's Valley
|
||||
66.2 14.2 75.3 27.2 Patron's Honor Cottages Portal
|
||||
66.4 14.3 87.6 14.5 Pavanne Vale Freehold Portal
|
||||
-82.9 48.0 23.3 -49.6 Peril's Edge Cottages Portal
|
||||
-33.6 13.0 -44.0 8.7 Pillars-on-the-Sea Cottages Portal
|
||||
-41.4 82.2 58.6 -41.6 Pine Deep Portal
|
||||
27.9 29.6 45.7 14.6 Pine Hillock Settlement Portal
|
||||
87.6 -69.7 90.6 -51.3 Plains of Ruin
|
||||
-49.4 25.9 -56.9 32.2 Plainsview Cottages Portal
|
||||
44.4 -43.5 45.3 -44.3 Plateau Base
|
||||
45.4 -42.3 35.8 -39.1 Plateau Hollow Settlement Portal
|
||||
43.2 -43.3 44.4 -43.5 Plateau Top
|
||||
45.3 -44.2 44.4 -43.5 Plateau Top
|
||||
-60.9 80.3 96.3 7.1 Point Tremblant Portal
|
||||
79.8 57.4 33.3 56.6 Portal to Arwic
|
||||
21.0 69.1 25.9 48.4 Portal to Cragstone
|
||||
21.0 69.3 -38.9 82.6 Portal to Hebian-To
|
||||
3.9 -72.5 4.0 -73.7 Portal to Lighthouse
|
||||
-75.7 28.2 -77.8 28.0 Portal to Linvak Tukal
|
||||
-75.0 19.5 87.3 -70.8 Portal to Silyun
|
||||
76.6 -58.7 87.3 -70.9 Portal to Silyun
|
||||
90.6 -51.1 87.3 -70.9 Portal to Silyun
|
||||
95.6 -56.2 87.3 -70.9 Portal to Silyun
|
||||
-38.1 -60.3 2.3 -0.8 Precarious Sojourn Exit Portal
|
||||
66.3 14.3 56.7 20.2 Prosper River Headwaters Portal
|
||||
-40.8 81.9 -74.7 19.6 Qalaba'r Portal
|
||||
-74.8 17.9 -67.6 14.6 Qalaba'r Seaside Villas Portal
|
||||
-74.8 17.8 -66.4 21.8 Qalabar Oasis Settlement Portal
|
||||
66.3 80.4 67.8 81.6 Queen's Burrow
|
||||
67.6 80.2 68.0 81.8 Queen's Burrow
|
||||
45.3 -42.3 52.1 -39.9 Rahvard Square Portal
|
||||
28.0 29.6 18.2 22.7 Redrock Cottages Portal
|
||||
69.7 -20.2 54.5 -19.9 Regina Cottages Portal
|
||||
-49.5 26.0 39.3 -29.6 Rending Talon Cottages Portal
|
||||
-49.3 26.0 30.4 -18.2 Rethux Vale Portal
|
||||
-1.1 18.9 -6.4 4.2 Return of Mumiyah Cottages Portal
|
||||
5.7 4.2 34.4 0.7 Reviled Maw Cottages Portal
|
||||
45.4 -42.4 47.1 -39.3 Rhynntal Cottages Portal
|
||||
-21.5 -74.7 -53.0 61.1 Ridge Tower
|
||||
-50.1 63.4 -47.9 51.1 Ring of Crystals Estates Portal
|
||||
27.2 47.3 28.6 48.0 River Bridge Portal
|
||||
28.5 48.0 27.1 47.4 River Bridge Portal
|
||||
28.8 6.7 55.9 -52.2 River Mouth
|
||||
-11.4 37.6 -2.3 63.3 Riverbend
|
||||
2.2 50.5 -3.5 64.7 Riverbend Cottages Portal
|
||||
45.5 -42.3 51.6 -50.2 Rivermouth Villas Portal
|
||||
-74.8 17.9 -63.1 35.4 Ro-Nan Portal
|
||||
45.5 -42.5 45.6 -36.0 Rytheran Dale Portal
|
||||
-41.5 82.1 -44.6 75.3 Sai-Nan Portal
|
||||
-0.9 19.0 -6.5 15.5 Samsur Butte Cottages Portal
|
||||
-41.5 82.1 -22.4 68.7 San-Chin Portal
|
||||
12.7 -1.7 19.2 -18.3 Sanai Portal
|
||||
-74.8 17.6 31.2 -11.9 Sanam Batal Villas Portal
|
||||
-24.9 29.8 -13.7 17.3 Sand Kings Cottages Portal
|
||||
-74.8 17.9 -12.7 0.9 Sand Shallow Cottages Portal
|
||||
-1.0 19.0 5.7 30.8 Sand's Edge Portal
|
||||
-49.3 25.9 -39.9 23.2 Sands-of-the-Skull Cottages Portal
|
||||
-27.2 59.9 -31.7 63.3 Sawato Foothills Settlement Portal
|
||||
-74.8 17.9 -86.4 37.7 Scimitar Lake Cottages Portal
|
||||
-27.2 60.0 -21.9 65.6 Sclavavania Portal
|
||||
69.5 -20.2 88.2 -13.4 Seaview Ridge Cottages Portal
|
||||
32.9 59.3 51.9 67.2 Secluded Valley Cottages Portal
|
||||
32.9 59.4 52.0 64.0 Sennon Valley Retreat Portal
|
||||
-49.4 26.0 -50.5 11.7 Serpent Hills Settlement Portal
|
||||
66.4 14.3 62.5 8.3 Shaky Ledge Cottages Portal
|
||||
-50.2 63.4 -54.4 43.1 Shara Portal
|
||||
12.7 -1.8 15.0 -6.4 Sharvale Portal
|
||||
-41.5 82.2 -40.8 76.7 Shian-To Cottages Portal
|
||||
-49.4 25.9 -40.0 36.1 Shield of Ispar Villas Portal
|
||||
-61.0 80.3 29.5 -33.5 Shield of Valor Cottages Portal
|
||||
-83.5 47.1 -27.9 68.4 Sho Roadside
|
||||
-62.6 -50.2 -27.9 68.4 Sho Roadside
|
||||
64.9 13.6 -27.9 68.4 Sho Roadside
|
||||
80.6 -44.4 -27.9 68.4 Sho Roadside
|
||||
-60.8 80.2 12.0 -15.9 Shore Vista Cottages Portal
|
||||
-31.3 72.6 -36.7 68.5 Shou-Zin Portal
|
||||
8.7 60.8 -0.4 68.2 Siege Road Settlement Portal
|
||||
8.8 60.8 3.0 65.7 Siege Road Villas Portal
|
||||
-74.8 17.7 -81.9 17.1 Simda'r Villas Portal
|
||||
-80.6 -37.4 0.4 -80.1 Slaughterhouse
|
||||
8.8 60.8 3.2 60.1 Slinker Meadows Portal
|
||||
17.5 61.6 34.7 -49.0 Sliver-of-BlueCottages Portal
|
||||
-62.1 -52.3 -62.1 -50.5 Small Black Hill
|
||||
-62.0 -50.0 -62.1 -50.5 Small Black Hill
|
||||
-62.1 -50.4 -62.0 -50.0 Small Hill Base
|
||||
-29.1 91.7 -29.6 91.3 Smugglers Fort
|
||||
-10.2 45.7 -15.1 55.6 Snakehead Portal
|
||||
-30.5 94.6 85.3 -8.8 Snowy Valley Portal
|
||||
26.3 46.3 20.1 33.6 Solstice Hill Portal
|
||||
27.8 29.5 24.8 15.3 Soltan Villas Portal
|
||||
69.6 -20.2 76.7 -36.1 Sonel Portal
|
||||
-60.8 80.2 60.8 19.3 Songview Portal
|
||||
-49.2 25.9 -43.9 35.2 Sonpay Portal
|
||||
-82.8 48.1 -80.6 56.0 South Adjamaer Cottages Portal
|
||||
33.0 59.4 35.6 65.5 South Beach Pass Villas Portal
|
||||
16.3 14.7 17.3 16.0 South Bellig
|
||||
12.7 11.8 14.1 12.7 South Dalt
|
||||
-80.1 -42.4 -84.2 -34.4 South Direlands Portal
|
||||
-78.0 -48.7 -84.2 -34.4 South Direlands Portal
|
||||
-72.7 -43.1 -84.2 -34.4 South Direlands Portal
|
||||
-62.2 77.1 -84.2 -34.4 South Direlands Portal
|
||||
14.6 13.2 15.7 14.2 South Gemm
|
||||
-41.5 82.2 -44.0 80.4 South Hebian-To Cottages Portal
|
||||
-41.5 82.2 -45.4 83.1 South Hebian-To Estates Portal
|
||||
-49.4 25.9 -52.6 27.7 South Khayyaban Cottages Portal
|
||||
2.3 50.4 -2.3 53.9 South Lytelthorpe Portal
|
||||
-52.8 67.3 -52.3 67.9 South Osteth Peak
|
||||
-54.6 62.7 -86.2 39.6 South Shore Heights
|
||||
-41.5 82.1 -40.6 69.3 South Shoushi Villas Portal
|
||||
-27.3 60.0 -12.7 72.8 South Siege Villas Portal
|
||||
-24.8 29.6 -34.3 29.3 South Uzis Villas Portal
|
||||
26.2 46.3 17.4 48.7 South Victory Harbor Portal
|
||||
-22.3 0.2 -26.6 1.5 South Yaraq Cottages Portal
|
||||
19.7 17.8 20.8 18.5 South Zabool
|
||||
32.9 59.4 28.7 59.7 Southeast Arwic Settlement Portal
|
||||
-18.7 6.8 56.8 12.9 Southern Mt. Esper
|
||||
-74.9 17.8 -75.8 37.0 Southern Park Portal
|
||||
-41.5 82.2 -43.1 87.2 Southwest Hebian-To Settlement Portal
|
||||
-49.5 26.0 -54.7 40.2 Spire Hills Settlement Portal
|
||||
-0.9 19.1 1.6 21.7 Stone Face Oasis Villas Portal
|
||||
-1.0 19.0 5.0 16.2 Stone Scar Settlement Portal
|
||||
-49.5 26.0 35.7 -32.7 Stone Scythe Stronghold Portal
|
||||
66.2 14.3 78.3 1.0 Stone Triad Dell Portal
|
||||
12.6 -1.8 14.6 22.7 Stonebend Cottages Portal
|
||||
-41.4 82.2 -25.7 79.4 Stoneport Villas Portal
|
||||
66.3 14.4 59.0 7.9 Stonerune Cottages Portal
|
||||
-74.8 17.7 -85.7 17.0 Stormbrow Portal
|
||||
45.5 -42.5 56.0 -35.1 Stormtree Villas Portal
|
||||
17.5 61.5 19.9 57.3 Strathelar's Watch Cottages Portal
|
||||
51.6 -73.1 52.0 -73.0 Surface
|
||||
51.8 -73.3 52.0 -73.0 Surface
|
||||
82.5 -6.5 82.8 -6.4 Surface
|
||||
83.0 -6.7 82.8 -6.4 Surface
|
||||
-10.3 45.6 -23.9 44.4 Swamp Temple Place Portal
|
||||
66.5 14.1 80.8 -35.1 Sweet Maple Cottages Portal
|
||||
-49.4 26.0 -38.7 39.3 Taklihuan Settlement Portal
|
||||
-50.2 63.5 -45.8 67.2 Tanshi Portal
|
||||
-10.3 45.6 31.3 36.2 Taralla Portal
|
||||
-33.4 13.2 28.2 -25.4 Tarn Vinara Villas Portal
|
||||
-50.2 63.4 -60.0 44.4 Tattered Ridge Portal
|
||||
80.3 54.4 70.4 50.5 Temple Exit
|
||||
70.4 50.5 79.7 54.4 Temple of N'cthail
|
||||
-1.1 18.9 91.3 5.4 Tharesun Portal
|
||||
-25.0 29.8 -28.8 21.1 Thasali Cottages Portal
|
||||
-52.4 68.6 -51.5 68.8 The Lee Side of The Mountain
|
||||
-52.8 69.1 -52.3 68.6 The Old Keep
|
||||
69.7 -20.1 81.6 -20.7 Thyrinn Cant Cottages Portal
|
||||
-41.4 82.1 27.9 -28.8 Tia-Leh Homestead Portal
|
||||
26.2 46.4 17.3 36.1 Tinkelo Hold Villas Portal
|
||||
12.6 -1.7 40.7 -5.5 Tiofor Deeps Portal
|
||||
-30.5 94.5 -38.4 92.1 Tou-Tou Penninsula Cottages Portal
|
||||
-30.5 94.5 -42.2 90.9 Tou-Tou Road Villas Portal
|
||||
-39.8 -54.6 -8.1 74.0 Town of Dryreach
|
||||
-12.2 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-12.2 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.2 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.1 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-12.0 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.0 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-12.0 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-12.0 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-11.9 41.7 -12.8 41.7 Trap Floor Portal
|
||||
-11.9 41.8 -12.8 41.7 Trap Floor Portal
|
||||
-11.9 41.8 -12.8 41.7 Trap Floor Portal
|
||||
5.6 4.2 36.0 4.1 Tusker Notch Portal
|
||||
45.6 -42.4 39.2 -32.6 Two Hills Cottages Portal
|
||||
45.5 -42.5 42.5 -29.5 Tyrrin Cottages Portal
|
||||
5.6 4.2 13.6 16.2 Unified Heart Villas Portal
|
||||
69.6 -20.3 60.2 -23.9 Verena Portal
|
||||
-60.8 80.3 -68.0 78.0 Vesayan Overlook Portal
|
||||
-65.7 84.9 -72.5 81.3 Vesayen Isles Portal
|
||||
-43.3 -49.0 -72.5 81.3 Vesayen Isles Portal
|
||||
61.7 48.6 -72.5 81.3 Vesayen Isles Portal
|
||||
-27.3 59.9 -18.2 63.3 Village Quan Portal
|
||||
-74.9 17.8 -60.5 18.5 Villalabar Portal
|
||||
-24.8 29.6 -13.8 26.5 Vulture's Eye Villas Portal
|
||||
-24.1 -57.7 -21.6 -74.6 Walled Portals
|
||||
-50.1 63.4 -49.8 56.8 West Baishi Settlement Portal
|
||||
40.2 35.1 46.5 40.5 West Holtburg Villas Portal
|
||||
-60.8 80.4 -61.1 73.7 West Mayoi Mountain Villas Portal
|
||||
27.9 29.4 75.4 40.1 West Norstead Portal
|
||||
8.7 61.0 11.9 48.1 West Rithwic Estates Portal
|
||||
-27.1 60.0 -30.8 53.5 West Sawato Cottages Portal
|
||||
-24.9 29.8 -25.9 22.7 West Uziz Settlement Portal
|
||||
-10.2 45.7 -21.9 41.0 West Yanshi Namoon Portal
|
||||
12.6 -1.8 16.9 -9.5 West Zaikhal Freehold Portal
|
||||
-30.4 94.5 61.5 -52.3 Westshore Cottages Portal
|
||||
68.6 -23.3 71.6 -29.8 Westward Portal
|
||||
27.8 29.5 34.1 13.5 Whispering Pines Cottages Portal
|
||||
-22.4 0.3 -25.4 10.4 Wi Badlands Settlement Portal
|
||||
45.5 -42.5 37.6 -49.0 Wilomine Villas Portal
|
||||
66.2 14.1 62.6 3.2 Windrune Cottages Portal
|
||||
69.5 -20.2 84.0 -1.6 Wisp Lake Cottages Portal
|
||||
45.6 -42.4 31.1 -28.8 Wolfenvale Portal
|
||||
40.2 35.1 43.9 18.4 Woodsbane Cottages Portal
|
||||
69.6 -20.2 77.8 -44.2 Woodshore Cottages Portal
|
||||
-60.8 80.4 -78.4 60.2 Xinh Portal
|
||||
-10.3 45.6 -19.0 44.4 Yanshi Namoon North Portal
|
||||
45.4 -42.4 35.2 -36.1 Yee Villas Portal
|
||||
-0.9 18.9 -9.5 33.3 Yinar Portal
|
||||
-82.8 48.1 -71.8 47.3 Yukikaze Portal
|
||||
-0.9 19.0 -12.0 23.6 Yushad Ridge Cottages Portal
|
||||
27.9 29.5 22.7 22.7 Zabool Overlook Settlement Portal
|
||||
-77.2 19.8 13.5 0.7 Zaikhal Portal
|
||||
45.3 -42.3 76.0 35.3 Zatara Portal
|
||||
-27.2 59.8 -35.2 46.6 Zin-Dai Portal
|
||||
|
334
tools/navdata/NavData/townnet.json
Normal file
334
tools/navdata/NavData/townnet.json
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
{
|
||||
"version": 1,
|
||||
"setId": "d03cd2b18f461392",
|
||||
"generated": "2026-10-01T19:19:40Z",
|
||||
"source": "aeshnidae_world",
|
||||
"landblocks": ["0007"],
|
||||
"counts": {"arrivals": 4, "entries": 53, "exits": 49, "npcs": 12},
|
||||
"notes": [],
|
||||
"walkInfo": {"tool": "RynthNav.TownNet build", "dats": ["client_cell_1.dat 348127232 bytes 2026-04-19", "client_portal.dat 926941184 bytes 2026-04-19"], "grid": 0.25, "walkerRadius": 0.48, "clearance": 0.48, "portalClearance": 0.73, "cells": 205, "walks": 196, "walkable": 196, "lengthMin": 31.83, "lengthMax": 120.69, "lengthAvg": 67.46},
|
||||
"arrivals": [
|
||||
{"id":"A1","cell":"00070133","x":60.0,"y":-70.0,"z":0.005,"entries":10},
|
||||
{"id":"A2","cell":"00070143","x":70.0,"y":-60.0,"z":0.005,"entries":11},
|
||||
{"id":"A3","cell":"00070145","x":70.0,"y":-80.0,"z":0.005,"entries":20},
|
||||
{"id":"A4","cell":"00070156","x":80.0,"y":-70.0,"z":0.005,"entries":12}
|
||||
],
|
||||
"entries": [
|
||||
{"guid":"701AC00F","wcid":42852,"name":"Portal to Town Network","cell":"01AC0104","x":-1.612,"y":-21.362,"z":0.198,"place":"dungeon","noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"70EBA013","wcid":42852,"name":"Portal to Town Network","cell":"0EBA0023","x":118.522,"y":52.621,"z":2.198,"place":"outdoor","ns":47.07,"ew":-90.26,"town":{"name":"Ahurenga","dist":1.1},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"7113406D","wcid":42852,"name":"Portal to Town Network","cell":"11340026","x":105.754,"y":133.537,"z":42.198,"place":"outdoor","ns":-59.79,"ew":-87.91,"town":{"name":"Ayan Baqur","dist":0.67},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"717B201B","wcid":42852,"name":"Portal to Town Network","cell":"17B2001B","x":77.595,"y":58.692,"z":45.165,"place":"outdoor","ns":40.69,"ew":-83.23,"town":{"name":"Redspire","dist":0.27},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"71DB6034","wcid":42852,"name":"Portal to Town Network","cell":"1DB6003C","x":181.401,"y":93.589,"z":120.198,"place":"outdoor","ns":44.04,"ew":-77.99,"town":{"name":"Timaru","dist":0.49},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"721B0025","wcid":42852,"name":"Portal to Town Network","cell":"21B0000D","x":34.702,"y":118.221,"z":0.198,"place":"outdoor","ns":39.34,"ew":-75.41,"town":{"name":"Bluespire","dist":0.21},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"723DA018","wcid":42852,"name":"Portal to Town Network","cell":"23DA0034","x":149.813,"y":78.94,"z":2.198,"place":"outdoor","ns":72.78,"ew":-73.33,"town":{"name":"Westwatch","dist":0.04},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"7258104B","wcid":43065,"name":"Portal to Town Network","cell":"2581002C","x":138.929,"y":72.689,"z":220.198,"place":"outdoor","ns":1.55,"ew":-71.77,"town":{"name":"Fort Tethana","dist":0.56},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"727EC037","wcid":42852,"name":"Portal to Town Network","cell":"27EC000C","x":36.813,"y":95.737,"z":80.198,"place":"outdoor","ns":87.25,"ew":-70.6,"town":{"name":"Silyun","dist":0.23},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"72B1104C","wcid":42852,"name":"Portal to Town Network","cell":"2B110027","x":114.677,"y":160.92,"z":48.198,"place":"outdoor","ns":-87.68,"ew":-67.07,"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"72CB5012","wcid":42852,"name":"Portal to Town Network","cell":"2CB50003","x":21.117,"y":63.188,"z":0.198,"place":"outdoor","ns":43.11,"ew":-66.66,"town":{"name":"Greenspire","dist":0.18},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"732D9057","wcid":42852,"name":"Portal to Town Network","cell":"32D90034","x":155.562,"y":83.545,"z":52.198,"place":"outdoor","ns":72.0,"ew":-61.3,"town":{"name":"Sanamar","dist":0.4},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"738F7012","wcid":42852,"name":"Portal to Town Network","cell":"38F70019","x":82.741,"y":15.578,"z":2.198,"place":"outdoor","ns":95.71,"ew":-56.81,"town":{"name":"Fiun","dist":0.17},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"73F3101D","wcid":42852,"name":"Portal to Town Network","cell":"3F310017","x":59.639,"y":165.407,"z":0.098,"place":"outdoor","ns":-62.06,"ew":-51.3,"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"749B6043","wcid":43065,"name":"Portal to Town Network","cell":"49B60007","x":20.637,"y":147.066,"z":240.198,"place":"outdoor","ns":44.26,"ew":-43.46,"town":{"name":"Plateau","dist":0.43},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"749F0019","wcid":42852,"name":"Portal to Town Network","cell":"49F0001C","x":87.531,"y":74.792,"z":170.198,"place":"outdoor","ns":90.36,"ew":-43.19,"town":{"name":"Eastwatch","dist":0.07},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"75B9C011","wcid":42852,"name":"Portal to Town Network","cell":"5B9C002E","x":123.944,"y":124.93,"z":14.198,"place":"outdoor","ns":23.37,"ew":-28.63,"town":{"name":"Outpost","dist":1.24},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"764D504A","wcid":43065,"name":"Portal to Town Network","cell":"64D50013","x":71.74,"y":62.396,"z":78.198,"place":"outdoor","ns":68.71,"ew":-21.65,"town":{"name":"Stonehold","dist":0.18},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"77D6406A","wcid":43066,"name":"Portal to Town Network","cell":"7D640025","x":102.999,"y":106.787,"z":12.198,"place":"outdoor","ns":-21.51,"ew":-1.52,"town":{"name":"Yaraq","dist":0.3},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"78090080","wcid":43066,"name":"Portal to Town Network","cell":"8090000C","x":37.543,"y":83.632,"z":124.198,"place":"outdoor","ns":13.6,"ew":0.61,"town":{"name":"Zaikhal","dist":0.16},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"78588050","wcid":43066,"name":"Portal to Town Network","cell":"8588001E","x":91.613,"y":141.56,"z":86.198,"place":"outdoor","ns":7.44,"ew":4.83,"town":{"name":"Al-Jalima","dist":0.23},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"7866C023","wcid":43066,"name":"Portal to Town Network","cell":"866C002F","x":139.232,"y":162.06,"z":10.198,"place":"outdoor","ns":-14.87,"ew":5.83,"town":{"name":"Tufa","dist":0.25},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"79058035","wcid":43066,"name":"Portal to Town Network","cell":"90580034","x":156.021,"y":92.105,"z":0.198,"place":"outdoor","ns":-31.17,"ew":13.9,"town":{"name":"Al-Arqas","dist":0.7},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"790D000D","wcid":42852,"name":"Portal to Town Network","cell":"90D00014","x":69.171,"y":82.679,"z":282.198,"place":"outdoor","ns":64.79,"ew":13.54,"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"7934B07B","wcid":43066,"name":"Portal to Town Network","cell":"934B0009","x":38.723,"y":18.452,"z":14.198,"place":"outdoor","ns":-41.87,"ew":15.81,"town":{"name":"Xarabydun","dist":0.3},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"795D6014","wcid":42852,"name":"Portal to Town Network","cell":"95D6001C","x":73.934,"y":74.993,"z":100.198,"place":"outdoor","ns":69.56,"ew":17.56,"town":{"name":"Neydisa","dist":0.3},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"79722051","wcid":43066,"name":"Portal to Town Network","cell":"9722001D","x":74.298,"y":99.234,"z":102.198,"place":"outdoor","ns":-74.34,"ew":19.16,"town":{"name":"Qalabar","dist":0.5},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"7977B04E","wcid":43066,"name":"Portal to Town Network","cell":"977B002F","x":140.431,"y":149.259,"z":0.198,"place":"outdoor","ns":-2.93,"ew":19.44,"town":{"name":"Samsur","dist":0.57},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"79E43035","wcid":43066,"name":"Portal to Town Network","cell":"9E430018","x":62.332,"y":191.224,"z":46.198,"place":"outdoor","ns":-47.55,"ew":24.71,"town":{"name":"Khayyaban","dist":0.92},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"7A1A408B","wcid":43065,"name":"Portal to Town Network","cell":"A1A40035","x":146.419,"y":118.794,"z":50.198,"place":"outdoor","ns":29.74,"ew":27.46,"town":{"name":"Glenden Wood","dist":1.01},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"7A21E011","wcid":42852,"name":"Portal to Town Network","cell":"A21E0024","x":111.676,"y":84.065,"z":590.198,"place":"outdoor","ns":-77.6,"ew":28.12,"town":{"name":"Linvak Tukal","dist":0.23},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"7A260022","wcid":43066,"name":"Portal to Town Network","cell":"A2600029","x":129.741,"y":1.408,"z":20.198,"place":"outdoor","ns":-25.14,"ew":28.19,"town":{"name":"Uziz","dist":0.42},"noOlthoi":true,"arrival":"A1"},
|
||||
{"guid":"7A9B4080","wcid":43065,"name":"Portal to Town Network","cell":"A9B40003","x":14.393,"y":55.612,"z":78.198,"place":"outdoor","ns":42.28,"ew":33.31,"town":{"name":"Holtburg","dist":0.35},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"7B470038","wcid":43067,"name":"Portal to Town Network","cell":"B470002B","x":127.436,"y":51.658,"z":42.198,"place":"outdoor","ns":-12.13,"ew":42.58,"town":{"name":"Yanshi","dist":0.55},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7BA17033","wcid":43067,"name":"Portal to Town Network","cell":"BA170013","x":49.324,"y":62.227,"z":132.198,"place":"outdoor","ns":-83.29,"ew":47.06,"town":{"name":"Kara","dist":0.6},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7BC9F075","guids":["7BC9F075","7BC9F435"],"wcid":43065,"name":"Portal to Town Network","cell":"BC9F003C","x":178.418,"y":78.801,"z":32.198,"place":"outdoor","ns":25.58,"ew":49.19,"town":{"name":"Cragstone","dist":0.91},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"7BDD2016","wcid":42852,"name":"Portal to Town Network","cell":"BDD20033","x":164.757,"y":58.764,"z":186.198,"place":"outdoor","ns":66.29,"ew":49.94,"town":{"name":"Bandit Castle","dist":1.47},"noOlthoi":true,"arrival":"A3"},
|
||||
{"guid":"7BF8005C","wcid":43065,"name":"Portal to Town Network","cell":"BF80002B","x":139.167,"y":70.662,"z":34.198,"place":"outdoor","ns":0.74,"ew":51.43,"town":{"name":"Lytelthorpe","dist":0.45},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"7C6A9074","wcid":43065,"name":"Portal to Town Network","cell":"C6A9001B","x":78.341,"y":58.225,"z":42.198,"place":"outdoor","ns":33.49,"ew":56.78,"town":{"name":"Arwic","dist":0.26},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"7C88C066","wcid":43065,"name":"Portal to Town Network","cell":"C88C0016","x":52.266,"y":120.75,"z":22.198,"place":"outdoor","ns":10.55,"ew":58.27,"town":{"name":"Rithwic","dist":1.09},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"7C95B06B","wcid":43067,"name":"Portal to Town Network","cell":"C95B002D","x":130.475,"y":101.854,"z":12.198,"place":"outdoor","ns":-28.73,"ew":59.39,"town":{"name":"Sawato","dist":0.64},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7CD4106C","wcid":43067,"name":"Portal to Town Network","cell":"CD410026","x":108.321,"y":125.145,"z":54.198,"place":"outdoor","ns":-49.43,"ew":62.5,"town":{"name":"Baishi","dist":0.42},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7CE95089","wcid":43065,"name":"Portal to Town Network","cell":"CE95002D","x":123.797,"y":114.757,"z":20.198,"place":"outdoor","ns":17.73,"ew":63.37,"town":{"name":"Eastham","dist":0.82},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"7DA3B039","wcid":43067,"name":"Portal to Town Network","cell":"DA3B003B","x":181.605,"y":52.809,"z":0.198,"place":"outdoor","ns":-54.53,"ew":73.21,"town":{"name":"Lin","dist":1.26},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7DA55094","wcid":43067,"name":"Portal to Town Network","cell":"DA550014","x":66.182,"y":92.269,"z":20.198,"place":"outdoor","ns":-33.57,"ew":72.73,"town":{"name":"Shoushi","dist":0.08},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7DA75040","wcid":43065,"name":"Portal to Town Network","cell":"DA75002D","x":125.225,"y":108.214,"z":18.198,"place":"outdoor","ns":-7.9,"ew":72.97,"town":{"name":"Dryreach","dist":0.2},"noOlthoi":true,"arrival":"A2"},
|
||||
{"guid":"7E63201F","wcid":43067,"name":"Portal to Town Network","cell":"E6320002","x":10.424,"y":36.066,"z":28.198,"place":"outdoor","ns":-61.8,"ew":82.09,"town":{"name":"Mayoi","dist":0.42},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7E63D043","wcid":43067,"name":"Portal to Town Network","cell":"E63D0015","x":53.19,"y":113.003,"z":86.198,"place":"outdoor","ns":-52.68,"ew":82.27,"town":{"name":"Nanto","dist":0.52},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7E74E0EF","wcid":43067,"name":"Portal to Town Network","cell":"E74E0014","x":68.302,"y":92.186,"z":32.198,"place":"outdoor","ns":-39.17,"ew":83.13,"town":{"name":"Hebian-to","dist":0.58},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7E82200F","wcid":43067,"name":"Portal to Town Network","cell":"E822003D","x":181.692,"y":104.404,"z":0.198,"place":"outdoor","ns":-74.31,"ew":84.41,"town":{"name":"Kryst","dist":0.35},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7F222022","wcid":43067,"name":"Portal to Town Network","cell":"F2220030","x":129.227,"y":190.397,"z":18.198,"place":"outdoor","ns":-73.96,"ew":92.19,"town":{"name":"Freehold","dist":0.97},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7F559011","wcid":43067,"name":"Portal to Town Network","cell":"F559003D","x":171.6,"y":113.397,"z":20.198,"place":"outdoor","ns":-30.28,"ew":94.77,"town":{"name":"Tou-Tou","dist":0.16},"noOlthoi":true,"arrival":"A4"},
|
||||
{"guid":"7F682018","wcid":42852,"name":"Portal to Town Network","cell":"F6820033","x":145.337,"y":63.357,"z":58.198,"place":"outdoor","ns":2.31,"ew":95.46,"town":{"name":"Refuge","dist":0.05},"noOlthoi":true,"arrival":"A3"}
|
||||
],
|
||||
"exits": [
|
||||
{"guid":"70007000","wcid":42830,"name":"Al-Jalima Portal","label":"Al-Jalima","cell":"0007010A","x":3.993,"y":-60.0,"z":-0.063,"heading":270.0,"dest":{"cell":"8588002C","x":120.359,"y":95.47,"z":90.049,"place":"outdoor","ns":7.25,"ew":4.95,"town":{"name":"Al-Jalima","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007001","wcid":42829,"name":"Tufa Portal","label":"Tufa","cell":"0007010C","x":4.089,"y":-80.0,"z":-0.063,"heading":270.0,"dest":{"cell":"876C0008","x":2.0,"y":186.9,"z":18.0,"place":"outdoor","ns":-14.77,"ew":6.06,"town":{"name":"Tufa","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007002","wcid":42831,"name":"Portal to Zaikhal","label":"Zaikhal","cell":"0007010D","x":9.939,"y":-53.813,"z":-0.063,"heading":0.0,"dest":{"cell":"80900013","x":64.863,"y":55.687,"z":124.005,"place":"outdoor","ns":13.48,"ew":0.72,"town":{"name":"Zaikhal","dist":0.0}},"into":false,"setup":"020005D3"},
|
||||
{"guid":"7000700A","wcid":42821,"name":"Uziz Portal","label":"Uziz","cell":"00070111","x":9.864,"y":-86.531,"z":-0.063,"heading":180.0,"dest":{"cell":"A260003C","x":182.919,"y":87.934,"z":20.005,"place":"outdoor","ns":-24.78,"ew":28.41,"town":{"name":"Uziz","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000700B","wcid":42832,"name":"Portal to Xarabydun","label":"Xarabydun","cell":"00070112","x":20.071,"y":-53.861,"z":-0.063,"heading":0.0,"dest":{"cell":"934B0021","x":108.3,"y":6.1,"z":18.1,"place":"outdoor","ns":-41.92,"ew":16.1,"town":{"name":"Xarabydun","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007013","wcid":42822,"name":"Portal to Khayyaban","label":"Khayyaban","cell":"00070116","x":19.982,"y":-86.444,"z":-0.063,"heading":180.0,"dest":{"cell":"9F440012","x":90.0,"y":24.553,"z":31.885,"place":"outdoor","ns":-47.45,"ew":25.62,"town":{"name":"Khayyaban","dist":0.01}},"into":false,"setup":"020005D3"},
|
||||
{"guid":"70007014","wcid":42833,"name":"Qalaba'r Portal","label":"Qalaba'r","cell":"00070117","x":30.011,"y":-53.7,"z":-0.063,"heading":0.0,"dest":{"cell":"9722003A","x":168.354,"y":24.618,"z":102.005,"place":"outdoor","ns":-74.65,"ew":19.55,"town":{"name":"Qalabar","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007018","wcid":42823,"name":"Portal to Al-Arqas","label":"Al-Arqas","cell":"0007011B","x":29.943,"y":-86.341,"z":-0.063,"heading":180.0,"dest":{"cell":"8F58003B","x":183.851,"y":60.183,"z":9.326,"place":"outdoor","ns":-31.3,"ew":13.22,"town":{"name":"Al-Arqas","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007019","wcid":42834,"name":"Portal to Samsur","label":"Samsur","cell":"0007011C","x":39.967,"y":-53.6,"z":-0.063,"heading":0.0,"dest":{"cell":"977B000C","x":25.811,"y":73.853,"z":0.005,"place":"outdoor","ns":-3.24,"ew":18.96,"town":{"name":"Samsur","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007024","wcid":42824,"name":"Portal to Yaraq","label":"Yaraq","cell":"00070120","x":39.996,"y":-86.178,"z":-0.063,"heading":180.0,"dest":{"cell":"7D64000D","x":31.9,"y":104.6,"z":11.9,"place":"outdoor","ns":-21.51,"ew":-1.82,"town":{"name":"Yaraq","dist":0.01}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007025","wcid":42814,"name":"Glenden Wood Portal","label":"Glenden Wood","cell":"00070121","x":53.5,"y":-10.0,"z":-0.063,"heading":270.0,"dest":{"cell":"A0A40025","x":96.302,"y":119.847,"z":59.955,"place":"outdoor","ns":29.75,"ew":26.45,"town":{"name":"Glenden Wood","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007026","wcid":42816,"name":"Lytelthorpe Portal","label":"Lytelthorpe","cell":"00070122","x":53.404,"y":-20.0,"z":-0.063,"heading":270.0,"dest":{"cell":"C0800007","x":11.723,"y":155.56,"z":33.028,"place":"outdoor","ns":1.1,"ew":51.7,"town":{"name":"Lytelthorpe","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007027","wcid":42818,"name":"Portal to Cragstone","label":"Cragstone","cell":"00070123","x":53.436,"y":-30.01,"z":-0.063,"heading":270.0,"dest":{"cell":"BB9F0040","x":169.358,"y":168.251,"z":54.005,"place":"outdoor","ns":25.95,"ew":48.36,"town":{"name":"Cragstone","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007028","wcid":42820,"name":"Portal to Holtburg","label":"Holtburg","cell":"00070124","x":53.906,"y":-39.953,"z":-0.063,"heading":270.0,"dest":{"cell":"A9B40019","x":84.0,"y":7.1,"z":94.0,"place":"outdoor","ns":42.08,"ew":33.6,"town":{"name":"Holtburg","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007029","wcid":42851,"name":"Portal to Facility Hub","label":"Facility Hub","cell":"00070126","x":53.554,"y":-99.995,"z":-0.063,"heading":270.0,"dest":{"cell":"8A020212","x":58.639,"y":-89.923,"z":6.005,"place":"dungeon"},"into":false,"setup":"020001B3","minLevel":10},
|
||||
{"guid":"7000702A","wcid":42825,"name":"Portal to Bluespire","label":"Bluespire","cell":"00070127","x":53.501,"y":-120.015,"z":-0.063,"heading":270.0,"dest":{"cell":"21B00017","x":48.19,"y":165.89,"z":0.005,"place":"outdoor","ns":39.54,"ew":-75.35,"town":{"name":"Bluespire","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000702B","wcid":42826,"name":"Portal to Greenspire","label":"Greenspire","cell":"00070128","x":53.545,"y":-129.945,"z":-0.063,"heading":270.0,"dest":{"cell":"2BB5003C","x":178.958,"y":86.57,"z":0.005,"place":"outdoor","ns":43.21,"ew":-66.8,"town":{"name":"Greenspire","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000702C","wcid":42827,"name":"Ahurenga Portal","label":"Ahurenga","cell":"00070129","x":53.807,"y":-139.943,"z":-0.063,"heading":270.0,"dest":{"cell":"0FB90009","x":43.0,"y":8.6,"z":0.005,"place":"outdoor","ns":46.09,"ew":-89.77,"town":{"name":"Ahurenga","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000702D","wcid":42828,"name":"Portal to Neydisa Castle","label":"Neydisa Castle","cell":"0007012A","x":54.052,"y":-149.981,"z":-0.063,"heading":270.0,"dest":{"cell":"95D60033","x":146.9,"y":71.3,"z":99.8,"place":"outdoor","ns":69.55,"ew":17.86,"town":{"name":"Neydisa","dist":0.0}},"into":false,"setup":"020005D6"},
|
||||
{"guid":"7000702E","wcid":42998,"name":"Portal to Silyun","label":"Silyun","cell":"0007012B","x":53.599,"y":-159.971,"z":-0.063,"heading":270.0,"dest":{"cell":"26EC003D","x":175.927,"y":110.334,"z":80.005,"place":"outdoor","ns":87.31,"ew":-70.82,"town":{"name":"Silyun","dist":0.0}},"into":false,"setup":"020001B3","accountRequirements":1},
|
||||
{"guid":"7000702F","wcid":42999,"name":"Fiun Outpost","label":"Fiun Outpost","cell":"0007012C","x":53.8,"y":-170.018,"z":-0.063,"heading":270.0,"dest":{"cell":"38F7001B","x":91.0,"y":54.0,"z":-0.095,"place":"outdoor","ns":95.88,"ew":-56.77,"town":{"name":"Fiun","dist":0.01}},"into":false,"setup":"020005D4"},
|
||||
{"guid":"70007030","wcid":42812,"name":"Plateau Portal","label":"Plateau","cell":"0007012D","x":60.0,"y":-3.482,"z":-0.063,"heading":0.0,"dest":{"cell":"49B70021","x":100.1,"y":20.8,"z":238.6,"place":"outdoor","ns":44.54,"ew":-43.13,"town":{"name":"Plateau","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000704D","wcid":43000,"name":"Base of the Timaru Plateau Portal","label":"Base of the Timaru Plateau","cell":"0007013C","x":60.019,"y":-176.447,"z":-0.063,"heading":180.0,"dest":{"cell":"1DB60016","x":71.387,"y":134.291,"z":90.005,"place":"outdoor","ns":44.21,"ew":-78.45,"town":{"name":"Timaru","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000704E","wcid":43001,"name":"Fort Tethana Portal","label":"Fort Tethana","cell":"0007013D","x":69.989,"y":-3.562,"z":-0.063,"heading":0.0,"dest":{"cell":"2681001D","x":77.7,"y":108.1,"z":240.0,"place":"outdoor","ns":1.7,"ew":-71.23,"town":{"name":"Fort Tethana","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000705A","wcid":42811,"name":"Stonehold Portal","label":"Stonehold","cell":"00070150","x":79.939,"y":-3.349,"z":-0.063,"heading":0.0,"dest":{"cell":"64D5000B","x":30.0,"y":50.0,"z":78.0,"place":"outdoor","ns":68.66,"ew":-21.82,"town":{"name":"Stonehold","dist":0.01}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007079","wcid":43002,"name":"Oolutanga's Refuge","label":"Oolutanga's Refuge","cell":"0007015F","x":79.991,"y":-176.283,"z":-0.05,"heading":180.0,"dest":{"cell":"F6820033","x":145.7,"y":49.855,"z":58.005,"place":"outdoor","ns":2.26,"ew":95.46,"town":{"name":"Refuge","dist":0.0}},"into":false,"setup":"020001B3","scale":0.8,"minLevel":10},
|
||||
{"guid":"7000707A","wcid":42813,"name":"Portal to Dryreach","label":"Dryreach","cell":"00070160","x":86.415,"y":-10.0,"z":-0.063,"heading":90.0,"dest":{"cell":"DA75002B","x":132.0,"y":60.0,"z":18.005,"place":"outdoor","ns":-8.1,"ew":73.0,"town":{"name":"Dryreach","dist":0.0}},"into":false,"setup":"020005D6"},
|
||||
{"guid":"7000707B","wcid":42815,"name":"Eastham Portal","label":"Eastham","cell":"00070161","x":86.491,"y":-20.03,"z":-0.063,"heading":90.0,"dest":{"cell":"CE940035","x":151.053,"y":112.61,"z":17.417,"place":"outdoor","ns":16.92,"ew":63.48,"town":{"name":"Eastham","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000707C","wcid":42817,"name":"Portal to Rithwic","label":"Rithwic","cell":"00070162","x":86.241,"y":-30.0,"z":-0.063,"heading":90.0,"dest":{"cell":"C98C0028","x":113.666,"y":190.259,"z":22.005,"place":"outdoor","ns":10.84,"ew":59.32,"town":{"name":"Rithwic","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000707D","wcid":42819,"name":"Portal to Arwic","label":"Arwic","cell":"00070163","x":86.856,"y":-39.997,"z":-0.063,"heading":90.0,"dest":{"cell":"C6A90009","x":46.805,"y":4.219,"z":42.005,"place":"outdoor","ns":33.27,"ew":56.65,"town":{"name":"Arwic","dist":0.01}},"into":false,"setup":"020005D3"},
|
||||
{"guid":"7000707E","wcid":23032,"name":"The Marketplace of Dereth","label":"The Marketplace of Dereth","cell":"00070165","x":86.129,"y":-99.982,"z":-0.063,"heading":89.2,"dest":{"cell":"016C01BC","x":49.206,"y":-31.935,"z":0.005,"place":"dungeon"},"into":false,"setup":"020001B3","noOlthoi":true},
|
||||
{"guid":"7000707F","wcid":42835,"name":"Portal to Sanamar","label":"Sanamar","cell":"00070166","x":86.184,"y":-120.035,"z":-0.063,"heading":90.0,"dest":{"cell":"33D90015","x":59.1,"y":100.3,"z":52.005,"place":"outdoor","ns":72.07,"ew":-60.9,"town":{"name":"Sanamar","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007080","wcid":42836,"name":"Portal to Redspire","label":"Redspire","cell":"00070167","x":86.613,"y":-130.036,"z":-0.063,"heading":90.0,"dest":{"cell":"17B2002A","x":132.623,"y":25.809,"z":44.005,"place":"outdoor","ns":40.56,"ew":-83.0,"town":{"name":"Redspire","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007081","wcid":42837,"name":"Portal to Westwatch","label":"Westwatch","cell":"00070168","x":86.277,"y":-139.953,"z":-0.063,"heading":90.0,"dest":{"cell":"23DA002C","x":140.9,"y":86.0,"z":2.005,"place":"outdoor","ns":72.81,"ew":-73.36,"town":{"name":"Westwatch","dist":0.0}},"into":false,"setup":"020005D3"},
|
||||
{"guid":"70007082","wcid":42838,"name":"Portal to Linvak Tukal","label":"Linvak Tukal","cell":"00070169","x":86.243,"y":-149.991,"z":-0.063,"heading":90.0,"dest":{"cell":"A21E001A","x":83.0,"y":38.0,"z":560.4,"place":"outdoor","ns":-77.79,"ew":28.0,"town":{"name":"Linvak Tukal","dist":0.0}},"into":false,"setup":"020005D6"},
|
||||
{"guid":"70007083","wcid":43003,"name":"Danby's Outpost","label":"Danby's Outpost","cell":"0007016A","x":86.419,"y":-160.001,"z":-0.063,"heading":90.0,"dest":{"cell":"5A9C0004","x":23.5,"y":77.1,"z":6.0,"place":"outdoor","ns":23.17,"ew":-29.85,"town":{"name":"Outpost","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007084","wcid":42839,"name":"Portal to Eastwatch","label":"Eastwatch","cell":"0007016B","x":86.513,"y":-170.055,"z":-0.063,"heading":90.0,"dest":{"cell":"49F00013","x":70.0,"y":70.0,"z":170.005,"place":"outdoor","ns":90.34,"ew":-43.26,"town":{"name":"Eastwatch","dist":0.0}},"into":false,"setup":"020005D5","minLevel":80},
|
||||
{"guid":"70007085","wcid":42840,"name":"Portal to Shoushi","label":"Shoushi","cell":"0007016C","x":100.0,"y":-53.624,"z":-0.063,"heading":0.0,"dest":{"cell":"DA55001D","x":84.8,"y":99.0,"z":20.0,"place":"outdoor","ns":-33.54,"ew":72.8,"town":{"name":"Shoushi","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000708F","wcid":42841,"name":"Portal to Tou-Tou","label":"Tou-Tou","cell":"00070170","x":99.979,"y":-86.304,"z":-0.063,"heading":180.0,"dest":{"cell":"F5590034","x":152.59,"y":80.8,"z":20.005,"place":"outdoor","ns":-30.41,"ew":94.69,"town":{"name":"Tou-Tou","dist":0.01}},"into":false,"setup":"020005D3"},
|
||||
{"guid":"70007090","wcid":42842,"name":"Mayoi Portal","label":"Mayoi","cell":"00070171","x":110.0,"y":-53.369,"z":-0.063,"heading":0.0,"dest":{"cell":"E6320021","x":107.417,"y":10.763,"z":29.908,"place":"outdoor","ns":-61.91,"ew":82.5,"town":{"name":"Mayoi","dist":0.01}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007095","wcid":42843,"name":"Portal to Nanto","label":"Nanto","cell":"00070175","x":109.982,"y":-86.004,"z":-0.063,"heading":180.0,"dest":{"cell":"E63E0022","x":96.96,"y":37.722,"z":74.542,"place":"outdoor","ns":-52.19,"ew":82.45,"town":{"name":"Nanto","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"70007096","wcid":42844,"name":"Lin Portal","label":"Lin","cell":"00070176","x":120.0,"y":-53.43,"z":-0.063,"heading":0.0,"dest":{"cell":"DC3C0011","x":59.72,"y":10.774,"z":18.958,"place":"outdoor","ns":-53.91,"ew":74.3,"town":{"name":"Lin","dist":0.01}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000709E","wcid":42845,"name":"Baishi Portal","label":"Baishi","cell":"0007017A","x":119.974,"y":-86.439,"z":-0.063,"heading":180.0,"dest":{"cell":"CE410007","x":12.6,"y":152.8,"z":55.1,"place":"outdoor","ns":-49.31,"ew":62.9,"town":{"name":"Baishi","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"7000709F","wcid":42846,"name":"Portal to Hebian-To","label":"Hebian-To","cell":"0007017B","x":130.0,"y":-53.623,"z":-0.063,"heading":0.0,"dest":{"cell":"E64E002F","x":138.304,"y":161.905,"z":20.04,"place":"outdoor","ns":-38.88,"ew":82.63,"town":{"name":"Hebian-to","dist":0.01}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"700070A4","wcid":42847,"name":"Portal to Yanshi","label":"Yanshi","cell":"0007017F","x":129.947,"y":-86.357,"z":-0.063,"heading":180.0,"dest":{"cell":"B46F001E","x":75.2,"y":124.1,"z":34.69,"place":"outdoor","ns":-12.63,"ew":42.36,"town":{"name":"Yanshi","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"700070A5","wcid":42848,"name":"Portal to Kara","label":"Kara","cell":"00070180","x":140.044,"y":-53.796,"z":-0.063,"heading":0.0,"dest":{"cell":"BA170039","x":181.2,"y":3.2,"z":167.7,"place":"outdoor","ns":-83.54,"ew":47.6,"town":{"name":"Kara","dist":0.01}},"into":false,"setup":"020005D6"},
|
||||
{"guid":"700070AD","wcid":42849,"name":"Sawato Portal","label":"Sawato","cell":"00070184","x":139.937,"y":-86.358,"z":-0.063,"heading":180.0,"dest":{"cell":"C95B0001","x":14.8,"y":0.3,"z":12.0,"place":"outdoor","ns":-29.15,"ew":58.91,"town":{"name":"Sawato","dist":0.0}},"into":false,"setup":"020001B3"},
|
||||
{"guid":"700070AE","wcid":42850,"name":"Portal to Kryst","label":"Kryst","cell":"00070185","x":146.522,"y":-59.965,"z":-0.063,"heading":90.0,"dest":{"cell":"E822002A","x":132.7,"y":37.9,"z":20.1,"place":"outdoor","ns":-74.59,"ew":84.2,"town":{"name":"Kryst","dist":0.0}},"into":false,"setup":"020005D3"},
|
||||
{"guid":"700070AF","wcid":43004,"name":"Freehold Portal","label":"Freehold","cell":"00070187","x":146.565,"y":-80.047,"z":-0.063,"heading":90.0,"dest":{"cell":"F224001A","x":81.8,"y":33.0,"z":0.0,"place":"outdoor","ns":-73.01,"ew":91.99,"town":{"name":"Freehold","dist":0.0}},"into":false,"setup":"020001B3"}
|
||||
],
|
||||
"npcs": [
|
||||
{"guid":"7000700E","wcid":42802,"name":"Barkeep Hosaam","cell":"00070114","x":17.572,"y":-69.471,"z":0.005,"setup":"02000001"},
|
||||
{"guid":"7000700F","wcid":42803,"name":"Barkeep Devra","cell":"00070114","x":16.873,"y":-70.612,"z":0.005,"setup":"0200004E"},
|
||||
{"guid":"70007010","wcid":42804,"name":"Barkeep Jauhar","cell":"00070114","x":15.186,"y":-69.912,"z":0.005,"setup":"02000001"},
|
||||
{"guid":"70007051","wcid":42799,"name":"Barkeeper AmberJill","cell":"0007013F","x":70.514,"y":-17.596,"z":0.005,"setup":"0200004E"},
|
||||
{"guid":"70007052","wcid":42800,"name":"Barkeeper Edsel","cell":"0007013F","x":69.457,"y":-16.815,"z":0.005,"setup":"0200004E"},
|
||||
{"guid":"70007053","wcid":42801,"name":"Barkeeper Creighton","cell":"0007013F","x":70.085,"y":-15.466,"z":0.005,"setup":"02000001"},
|
||||
{"guid":"70007057","wcid":42805,"name":"Barkeeper Lazzaro","cell":"0007014B","x":69.447,"y":-142.381,"z":0.005,"setup":"02000001"},
|
||||
{"guid":"70007058","wcid":42806,"name":"Barkeeper Benedetta","cell":"0007014B","x":70.602,"y":-143.072,"z":0.005,"setup":"0200004E"},
|
||||
{"guid":"70007059","wcid":42807,"name":"Barkeeper Rafaele","cell":"0007014B","x":69.925,"y":-144.73,"z":0.005,"setup":"02000001"},
|
||||
{"guid":"70007099","wcid":42808,"name":"Hanadi the Barkeeper","cell":"00070178","x":122.302,"y":-70.52,"z":0.005,"setup":"0200004E"},
|
||||
{"guid":"7000709A","wcid":42809,"name":"Junjie the Barkeeper","cell":"00070178","x":123.057,"y":-69.343,"z":0.005,"setup":"02000001"},
|
||||
{"guid":"7000709B","wcid":42810,"name":"Xiao Hong the Barkeeper","cell":"00070178","x":124.867,"y":-70.095,"z":0.005,"setup":"0200004E"}
|
||||
],
|
||||
"walks": [
|
||||
{"from":"A1","to":"70007000","exit":"Al-Jalima Portal","length":57.59,"minClear":0.64,"cells":8,"points":[["00070133",60,-70,0],["00070114",21.62,-67.38,0],["0007010E",12.88,-63.38,0],["0007010A",3.99,-60,0]]},
|
||||
{"from":"A1","to":"70007001","exit":"Tufa Portal","length":57.52,"minClear":0.65,"cells":8,"points":[["00070133",60,-70,0],["00070114",21.38,-72.62,0],["00070110",12.88,-76.62,0],["0007010C",4.09,-80,0]]},
|
||||
{"from":"A1","to":"70007002","exit":"Portal to Zaikhal","length":56.07,"minClear":0.64,"cells":8,"points":[["00070133",60,-70,0],["00070114",23.12,-67.62,0],["0007010E",12.12,-56.62,0],["0007010D",9.94,-53.81,0]]},
|
||||
{"from":"A1","to":"7000700A","exit":"Uziz Portal","length":56.49,"minClear":0.66,"cells":8,"points":[["00070133",60,-70,0],["00070114",22.88,-72.38,0],["00070110",12.12,-83.12,0],["00070111",9.86,-86.53,0]]},
|
||||
{"from":"A1","to":"7000700B","exit":"Portal to Xarabydun","length":47.43,"minClear":0.71,"cells":7,"points":[["00070133",60,-70,0],["00070119",30.38,-68.12,0],["00070113",22.38,-58.88,0],["00070112",20.07,-53.86,0]]},
|
||||
{"from":"A1","to":"70007013","exit":"Portal to Khayyaban","length":46.28,"minClear":0.64,"cells":7,"points":[["00070133",60,-70,0],["0007011E",43.62,-71.12,0],["0007011F",39.38,-75.12,0],["0007011F",35.62,-77.38,0],["0007011A",33.88,-80.62,0],["00070115",22.12,-83.12,0],["00070116",19.98,-86.44,0]]},
|
||||
{"from":"A1","to":"70007014","exit":"Qalaba'r Portal","length":37.71,"minClear":0.64,"cells":6,"points":[["00070133",60,-70,0],["0007011E",43.62,-68.88,0],["0007011D",38.38,-59.62,0],["00070118",32.12,-56.88,0],["00070117",30.01,-53.7,0]]},
|
||||
{"from":"A1","to":"70007018","exit":"Portal to Al-Arqas","length":37.25,"minClear":0.64,"cells":6,"points":[["00070133",60,-70,0],["0007011E",43.62,-71.12,0],["0007011F",39.38,-75.12,0],["0007011F",35.62,-77.38,0],["0007011A",32.88,-82.12,0],["0007011B",29.94,-86.34,0]]},
|
||||
{"from":"A1","to":"70007019","exit":"Portal to Samsur","length":32.13,"minClear":0.64,"cells":5,"points":[["00070133",60,-70,0],["0007011E",43.62,-68.88,0],["0007011C",39.97,-53.6,0]]},
|
||||
{"from":"A1","to":"70007024","exit":"Portal to Yaraq","length":31.91,"minClear":0.64,"cells":5,"points":[["00070133",60,-70,0],["0007011E",43.62,-71.12,0],["00070120",40,-86.18,0]]},
|
||||
{"from":"A1","to":"70007025","exit":"Glenden Wood Portal","length":68.95,"minClear":0.65,"cells":10,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["0007013F",66.88,-22.12,0],["0007012E",56.62,-11.88,0],["00070121",53.5,-10,0]]},
|
||||
{"from":"A1","to":"70007026","exit":"Lytelthorpe Portal","length":59.15,"minClear":0.63,"cells":9,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["00070141",68.88,-43.62,0],["00070131",64.88,-39.38,0],["00070131",62.62,-35.62,0],["00070130",59.38,-33.88,0],["0007012F",56.62,-21.88,0],["00070122",53.4,-20,0]]},
|
||||
{"from":"A1","to":"70007027","exit":"Portal to Cragstone","length":50.21,"minClear":0.64,"cells":8,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["00070141",68.88,-43.62,0],["00070131",64.88,-39.38,0],["00070131",62.62,-35.62,0],["00070130",57.62,-32.62,0],["00070130",57.12,-32.12,0],["00070123",53.44,-30.01,0]]},
|
||||
{"from":"A1","to":"70007028","exit":"Portal to Holtburg","length":44.63,"minClear":0.68,"cells":7,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["00070141",68.88,-43.62,0],["00070124",53.91,-39.95,0]]},
|
||||
{"from":"A1","to":"70007029","exit":"Portal to Facility Hub","length":44.97,"minClear":0.68,"cells":7,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["00070147",68.88,-96.38,0],["00070126",53.55,-100,0]]},
|
||||
{"from":"A1","to":"7000702A","exit":"Portal to Bluespire","length":65.02,"minClear":0.73,"cells":9,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["00070149",69.12,-116.12,0],["00070127",53.5,-120.02,0]]},
|
||||
{"from":"A1","to":"7000702B","exit":"Portal to Greenspire","length":70.64,"minClear":0.64,"cells":10,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["00070149",69.12,-116.12,0],["00070136",59.62,-121.62,0],["00070137",56.62,-128.12,0],["00070128",53.54,-129.95,0]]},
|
||||
{"from":"A1","to":"7000702C","exit":"Ahurenga Portal","length":80.35,"minClear":0.7,"cells":11,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014A",68.62,-128.88,0],["00070138",58.88,-137.62,0],["00070129",53.81,-139.94,0]]},
|
||||
{"from":"A1","to":"7000702D","exit":"Portal to Neydisa Castle","length":88.88,"minClear":0.63,"cells":12,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014B",68.38,-136.12,0],["00070139",57.38,-147.12,0],["0007012A",54.05,-149.98,0]]},
|
||||
{"from":"A1","to":"7000702E","exit":"Portal to Silyun","length":97.58,"minClear":0.66,"cells":13,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013A",56.62,-158.12,0],["0007012B",53.6,-159.97,0]]},
|
||||
{"from":"A1","to":"7000702F","exit":"Fiun Outpost","length":106.49,"minClear":0.65,"cells":14,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013B",56.38,-168.12,0],["0007012C",53.8,-170.02,0]]},
|
||||
{"from":"A1","to":"70007030","exit":"Plateau Portal","length":70.72,"minClear":0.67,"cells":10,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["0007013F",66.62,-20.62,0],["0007012E",63.38,-13.38,0],["0007012D",60,-3.48,0]]},
|
||||
{"from":"A1","to":"7000704D","exit":"Base of the Timaru Plateau Portal","length":110.68,"minClear":0.7,"cells":14,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013C",60.02,-176.45,0]]},
|
||||
{"from":"A1","to":"7000704E","exit":"Fort Tethana Portal","length":70.09,"minClear":0.67,"cells":9,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["0007013F",66.62,-20.62,0],["0007013E",67.12,-9.12,0],["0007013D",69.99,-3.56,0]]},
|
||||
{"from":"A1","to":"7000705A","exit":"Stonehold Portal","length":70.75,"minClear":0.67,"cells":10,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["0007013F",74.38,-17.88,0],["00070151",76.62,-12.62,0],["00070150",79.94,-3.35,0]]},
|
||||
{"from":"A1","to":"70007079","exit":"Oolutanga's Refuge","length":110.47,"minClear":0.67,"cells":14,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014B",71.88,-137.88,0],["0007015C",76.62,-146.88,0],["0007015F",79.99,-176.28,0]]},
|
||||
{"from":"A1","to":"7000707A","exit":"Portal to Dryreach","length":68.59,"minClear":0.63,"cells":10,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["0007013F",74.12,-21.12,0],["00070151",83.12,-12.12,0],["00070160",86.42,-10,0]]},
|
||||
{"from":"A1","to":"7000707B","exit":"Eastham Portal","length":60.14,"minClear":0.68,"cells":9,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["00070140",72.88,-29.62,0],["00070152",81.38,-22.38,0],["00070161",86.49,-20.03,0]]},
|
||||
{"from":"A1","to":"7000707C","exit":"Portal to Rithwic","length":50.37,"minClear":0.63,"cells":8,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["00070141",71.12,-43.62,0],["00070154",80.38,-38.38,0],["00070153",83.62,-31.88,0],["00070162",86.24,-30,0]]},
|
||||
{"from":"A1","to":"7000707D","exit":"Portal to Arwic","length":45.39,"minClear":0.71,"cells":7,"points":[["00070133",60,-70,0],["00070142",69.88,-53.88,0],["00070141",71.12,-43.62,0],["00070163",86.86,-40,0]]},
|
||||
{"from":"A1","to":"7000707E","exit":"The Marketplace of Dereth","length":44.68,"minClear":0.71,"cells":7,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["00070147",71.12,-96.38,0],["00070165",86.13,-99.98,0]]},
|
||||
{"from":"A1","to":"7000707F","exit":"Portal to Sanamar","length":64.72,"minClear":0.73,"cells":9,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["00070149",70.88,-116.12,0],["00070166",86.18,-120.04,0]]},
|
||||
{"from":"A1","to":"70007080","exit":"Portal to Redspire","length":70.54,"minClear":0.67,"cells":10,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["00070149",70.88,-116.12,0],["00070159",75.12,-120.62,0],["00070159",77.38,-124.38,0],["0007015A",80.12,-125.12,0],["0007015A",82.88,-127.88,0],["00070167",86.61,-130.04,0]]},
|
||||
{"from":"A1","to":"70007081","exit":"Portal to Westwatch","length":79.22,"minClear":0.65,"cells":11,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["00070149",70.88,-116.12,0],["00070159",75.12,-120.62,0],["00070159",77.38,-124.38,0],["0007015A",80.12,-125.12,0],["0007015B",83.12,-137.88,0],["00070168",86.28,-139.95,0]]},
|
||||
{"from":"A1","to":"70007082","exit":"Portal to Linvak Tukal","length":89.11,"minClear":0.64,"cells":12,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014B",71.88,-136.62,0],["0007015C",82.88,-147.62,0],["00070169",86.24,-149.99,0]]},
|
||||
{"from":"A1","to":"70007083","exit":"Danby's Outpost","length":97.58,"minClear":0.63,"cells":13,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014B",71.88,-137.88,0],["0007015C",76.62,-146.88,0],["0007015D",83.12,-157.88,0],["0007016A",86.42,-160,0]]},
|
||||
{"from":"A1","to":"70007084","exit":"Portal to Eastwatch","length":106.89,"minClear":0.64,"cells":14,"points":[["00070133",60,-70,0],["00070146",69.88,-86.12,0],["0007014B",71.88,-137.88,0],["0007015C",76.62,-146.88,0],["0007015E",83.12,-167.88,0],["0007016B",86.51,-170.06,0]]},
|
||||
{"from":"A1","to":"70007085","exit":"Portal to Shoushi","length":55.67,"minClear":0.67,"cells":9,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070157",79.38,-75.12,0],["00070164",85.88,-70.12,0],["0007016E",96.38,-68.88,0],["0007016C",100,-53.62,0]]},
|
||||
{"from":"A1","to":"7000708F","exit":"Portal to Tou-Tou","length":55.56,"minClear":0.67,"cells":9,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070157",79.38,-75.12,0],["00070164",85.88,-70.12,0],["0007016E",96.38,-71.12,0],["00070170",99.98,-86.3,0]]},
|
||||
{"from":"A1","to":"70007090","exit":"Mayoi Portal","length":61.25,"minClear":0.65,"cells":10,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070157",79.38,-75.12,0],["00070164",85.88,-70.12,0],["0007016E",96.38,-68.88,0],["0007016D",100.62,-64.88,0],["0007016D",104.38,-62.62,0],["00070172",105.12,-59.88,0],["00070172",107.88,-57.12,0],["00070171",110,-53.37,0]]},
|
||||
{"from":"A1","to":"70007095","exit":"Portal to Nanto","length":60.92,"minClear":0.64,"cells":10,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070157",79.38,-75.12,0],["00070164",85.88,-70.12,0],["0007016E",96.38,-71.12,0],["0007016F",101.62,-80.38,0],["00070174",107.62,-83.12,0],["00070175",109.98,-86,0]]},
|
||||
{"from":"A1","to":"70007096","exit":"Lin Portal","length":70.15,"minClear":0.64,"cells":11,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070157",79.38,-75.12,0],["00070164",85.88,-70.12,0],["0007016E",96.38,-68.88,0],["0007016D",100.62,-64.88,0],["0007016D",104.38,-62.62,0],["00070172",105.12,-59.88,0],["00070177",118.12,-56.62,0],["00070176",120,-53.43,0]]},
|
||||
{"from":"A1","to":"7000709E","exit":"Baishi Portal","length":70.97,"minClear":0.67,"cells":11,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070157",79.38,-75.12,0],["00070164",85.88,-70.12,0],["00070173",109.88,-72.38,0],["00070179",117.62,-81.38,0],["0007017A",119.97,-86.44,0]]},
|
||||
{"from":"A1","to":"7000709F","exit":"Portal to Hebian-To","length":78.84,"minClear":0.63,"cells":11,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070164",85.88,-70.12,0],["00070178",118.12,-66.62,0],["0007017C",127.88,-56.88,0],["0007017B",130,-53.62,0]]},
|
||||
{"from":"A1","to":"700070A4","exit":"Portal to Yanshi","length":78.87,"minClear":0.67,"cells":11,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070164",85.88,-70.12,0],["00070178",117.88,-73.12,0],["0007017E",128.12,-83.38,0],["0007017F",129.95,-86.36,0]]},
|
||||
{"from":"A1","to":"700070A5","exit":"Portal to Kara","length":87,"minClear":0.63,"cells":12,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070164",87.62,-70.12,0],["00070178",119.62,-66.38,0],["0007017C",127.88,-63.38,0],["00070181",138.12,-56.38,0],["00070180",140.04,-53.8,0]]},
|
||||
{"from":"A1","to":"700070AD","exit":"Sawato Portal","length":87.08,"minClear":0.64,"cells":12,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070164",87.62,-70.12,0],["00070178",121.88,-74.12,0],["0007017E",127.12,-76.62,0],["00070183",138.12,-83.38,0],["00070184",139.94,-86.36,0]]},
|
||||
{"from":"A1","to":"700070AE","exit":"Portal to Kryst","length":91.22,"minClear":0.67,"cells":13,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070157",79.38,-75.12,0],["00070164",85.88,-70.12,0],["00070178",119.38,-66.62,0],["0007017C",126.62,-63.38,0],["00070185",146.52,-59.96,0]]},
|
||||
{"from":"A1","to":"700070AF","exit":"Freehold Portal","length":91.24,"minClear":0.66,"cells":13,"points":[["00070133",60,-70,0],["00070145",69.62,-76.12,0],["00070157",79.38,-75.12,0],["00070164",85.88,-70.12,0],["00070178",119.38,-73.38,0],["0007017E",126.62,-76.62,0],["00070187",146.56,-80.05,0]]},
|
||||
{"from":"A2","to":"70007000","exit":"Al-Jalima Portal","length":70.23,"minClear":0.67,"cells":10,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["00070114",20.62,-66.62,0],["0007010A",3.99,-60,0]]},
|
||||
{"from":"A2","to":"70007001","exit":"Tufa Portal","length":70.16,"minClear":0.73,"cells":10,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["00070114",20.62,-73.38,0],["0007010C",4.09,-80,0]]},
|
||||
{"from":"A2","to":"70007002","exit":"Portal to Zaikhal","length":68.62,"minClear":0.64,"cells":10,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["00070114",22.38,-66.88,0],["0007010E",12.12,-56.62,0],["0007010D",9.94,-53.81,0]]},
|
||||
{"from":"A2","to":"7000700A","exit":"Uziz Portal","length":68.98,"minClear":0.64,"cells":10,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["00070114",21.88,-73.38,0],["00070110",12.12,-83.12,0],["00070111",9.86,-86.53,0]]},
|
||||
{"from":"A2","to":"7000700B","exit":"Portal to Xarabydun","length":59.91,"minClear":0.64,"cells":9,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["00070119",29.88,-67.62,0],["00070112",20.07,-53.86,0]]},
|
||||
{"from":"A2","to":"70007013","exit":"Portal to Khayyaban","length":59.11,"minClear":0.64,"cells":9,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["0007011E",43.62,-71.12,0],["0007011F",39.38,-75.12,0],["0007011F",35.62,-77.38,0],["0007011A",33.88,-80.62,0],["00070115",22.12,-83.12,0],["00070116",19.98,-86.44,0]]},
|
||||
{"from":"A2","to":"70007014","exit":"Qalaba'r Portal","length":50.5,"minClear":0.66,"cells":8,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["0007011E",43.62,-68.88,0],["0007011D",38.38,-59.62,0],["00070118",32.12,-56.88,0],["00070117",30.01,-53.7,0]]},
|
||||
{"from":"A2","to":"70007018","exit":"Portal to Al-Arqas","length":50.08,"minClear":0.65,"cells":8,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["0007011E",43.62,-71.12,0],["0007011F",39.38,-75.12,0],["0007011F",35.62,-77.38,0],["0007011A",32.88,-82.12,0],["0007011B",29.94,-86.34,0]]},
|
||||
{"from":"A2","to":"70007019","exit":"Portal to Samsur","length":44.93,"minClear":0.68,"cells":7,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["0007011E",43.62,-68.88,0],["0007011C",39.97,-53.6,0]]},
|
||||
{"from":"A2","to":"70007024","exit":"Portal to Yaraq","length":44.73,"minClear":0.71,"cells":7,"points":[["00070143",70,-60,0],["00070125",53.88,-69.88,0],["0007011E",43.62,-71.12,0],["00070120",40,-86.18,0]]},
|
||||
{"from":"A2","to":"70007025","exit":"Glenden Wood Portal","length":56.4,"minClear":0.65,"cells":8,"points":[["00070143",70,-60,0],["0007013F",67.62,-22.88,0],["0007012E",56.62,-11.88,0],["00070121",53.5,-10,0]]},
|
||||
{"from":"A2","to":"70007026","exit":"Lytelthorpe Portal","length":46.35,"minClear":0.63,"cells":7,"points":[["00070143",70,-60,0],["00070141",68.88,-43.62,0],["00070131",64.88,-39.38,0],["00070131",62.62,-35.62,0],["00070130",59.38,-33.88,0],["0007012F",56.62,-21.88,0],["00070122",53.4,-20,0]]},
|
||||
{"from":"A2","to":"70007027","exit":"Portal to Cragstone","length":37.41,"minClear":0.64,"cells":6,"points":[["00070143",70,-60,0],["00070141",68.88,-43.62,0],["00070131",64.88,-39.38,0],["00070131",62.62,-35.62,0],["00070130",57.62,-32.62,0],["00070130",57.12,-32.12,0],["00070123",53.44,-30.01,0]]},
|
||||
{"from":"A2","to":"70007028","exit":"Portal to Holtburg","length":31.83,"minClear":0.64,"cells":5,"points":[["00070143",70,-60,0],["00070141",68.88,-43.62,0],["00070124",53.91,-39.95,0]]},
|
||||
{"from":"A2","to":"70007029","exit":"Portal to Facility Hub","length":55.71,"minClear":0.68,"cells":9,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["00070147",68.88,-96.38,0],["00070126",53.55,-100,0]]},
|
||||
{"from":"A2","to":"7000702A","exit":"Portal to Bluespire","length":75.08,"minClear":0.68,"cells":10,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070146",69.88,-85.88,0],["00070149",69.12,-116.12,0],["00070127",53.5,-120.02,0]]},
|
||||
{"from":"A2","to":"7000702B","exit":"Portal to Greenspire","length":80.7,"minClear":0.64,"cells":11,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070146",69.88,-85.88,0],["00070149",69.12,-116.12,0],["00070136",59.62,-121.62,0],["00070137",56.62,-128.12,0],["00070128",53.54,-129.95,0]]},
|
||||
{"from":"A2","to":"7000702C","exit":"Ahurenga Portal","length":90.32,"minClear":0.64,"cells":12,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070146",69.88,-87.62,0],["0007014A",68.62,-128.88,0],["00070138",58.88,-137.62,0],["00070129",53.81,-139.94,0]]},
|
||||
{"from":"A2","to":"7000702D","exit":"Portal to Neydisa Castle","length":99.62,"minClear":0.63,"cells":14,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["0007014B",68.38,-136.12,0],["00070139",57.38,-147.12,0],["0007012A",54.05,-149.98,0]]},
|
||||
{"from":"A2","to":"7000702E","exit":"Portal to Silyun","length":108.33,"minClear":0.66,"cells":15,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013A",56.62,-158.12,0],["0007012B",53.6,-159.97,0]]},
|
||||
{"from":"A2","to":"7000702F","exit":"Fiun Outpost","length":117.24,"minClear":0.65,"cells":16,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013B",56.38,-168.12,0],["0007012C",53.8,-170.02,0]]},
|
||||
{"from":"A2","to":"70007030","exit":"Plateau Portal","length":58.09,"minClear":0.65,"cells":8,"points":[["00070143",70,-60,0],["0007013F",67.38,-21.38,0],["0007012E",63.38,-12.88,0],["0007012D",60,-3.48,0]]},
|
||||
{"from":"A2","to":"7000704D","exit":"Base of the Timaru Plateau Portal","length":120.69,"minClear":0.67,"cells":15,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070145",68.12,-82.62,0],["00070146",69.88,-87.12,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013C",60.02,-176.45,0]]},
|
||||
{"from":"A2","to":"7000704E","exit":"Fort Tethana Portal","length":57.3,"minClear":0.64,"cells":7,"points":[["00070143",70,-60,0],["0007013F",67.38,-21.38,0],["0007013E",66.12,-14.62,0],["0007013D",69.99,-3.56,0]]},
|
||||
{"from":"A2","to":"7000705A","exit":"Stonehold Portal","length":58.17,"minClear":0.64,"cells":8,"points":[["00070143",70,-60,0],["0007013F",72.62,-21.62,0],["00070151",76.62,-12.88,0],["00070150",79.94,-3.35,0]]},
|
||||
{"from":"A2","to":"70007079","exit":"Oolutanga's Refuge","length":120.47,"minClear":0.67,"cells":15,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070145",68.12,-82.62,0],["00070146",69.88,-87.12,0],["0007014B",71.88,-137.88,0],["0007015C",76.62,-146.88,0],["0007015F",79.99,-176.28,0]]},
|
||||
{"from":"A2","to":"7000707A","exit":"Portal to Dryreach","length":56.32,"minClear":0.63,"cells":8,"points":[["00070143",70,-60,0],["0007013F",72.38,-22.88,0],["00070151",83.12,-12.12,0],["00070160",86.42,-10,0]]},
|
||||
{"from":"A2","to":"7000707B","exit":"Eastham Portal","length":47.64,"minClear":0.71,"cells":7,"points":[["00070143",70,-60,0],["00070140",71.88,-30.62,0],["00070152",81.38,-22.38,0],["00070161",86.49,-20.03,0]]},
|
||||
{"from":"A2","to":"7000707C","exit":"Portal to Rithwic","length":37.55,"minClear":0.63,"cells":6,"points":[["00070143",70,-60,0],["00070141",71.12,-43.62,0],["00070154",80.38,-38.38,0],["00070153",83.62,-31.88,0],["00070162",86.24,-30,0]]},
|
||||
{"from":"A2","to":"7000707D","exit":"Portal to Arwic","length":32.57,"minClear":0.64,"cells":5,"points":[["00070143",70,-60,0],["00070141",71.12,-43.62,0],["00070163",86.86,-40,0]]},
|
||||
{"from":"A2","to":"7000707E","exit":"The Marketplace of Dereth","length":55.42,"minClear":0.68,"cells":9,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["00070147",71.12,-96.38,0],["00070165",86.13,-99.98,0]]},
|
||||
{"from":"A2","to":"7000707F","exit":"Portal to Sanamar","length":74.78,"minClear":0.68,"cells":10,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070146",69.88,-85.88,0],["00070149",70.88,-116.12,0],["00070166",86.18,-120.04,0]]},
|
||||
{"from":"A2","to":"70007080","exit":"Portal to Redspire","length":80.61,"minClear":0.67,"cells":11,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070146",69.88,-85.88,0],["00070149",70.88,-116.12,0],["00070159",75.12,-120.62,0],["00070159",77.38,-124.38,0],["0007015A",80.12,-125.12,0],["0007015A",82.88,-127.88,0],["00070167",86.61,-130.04,0]]},
|
||||
{"from":"A2","to":"70007081","exit":"Portal to Westwatch","length":89.96,"minClear":0.65,"cells":13,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["00070149",70.88,-116.12,0],["00070159",75.12,-120.62,0],["00070159",77.38,-124.38,0],["0007015A",80.12,-125.12,0],["0007015B",83.12,-137.88,0],["00070168",86.28,-139.95,0]]},
|
||||
{"from":"A2","to":"70007082","exit":"Portal to Linvak Tukal","length":99.86,"minClear":0.64,"cells":14,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["0007014B",71.88,-136.62,0],["0007015C",82.88,-147.62,0],["00070169",86.24,-149.99,0]]},
|
||||
{"from":"A2","to":"70007083","exit":"Danby's Outpost","length":108.32,"minClear":0.63,"cells":15,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["0007014B",71.88,-137.88,0],["0007015C",76.62,-146.88,0],["0007015D",83.12,-157.88,0],["0007016A",86.42,-160,0]]},
|
||||
{"from":"A2","to":"70007084","exit":"Portal to Eastwatch","length":117.64,"minClear":0.64,"cells":16,"points":[["00070143",70,-60,0],["00070133",63.88,-69.62,0],["00070134",64.88,-79.38,0],["00070146",69.88,-85.88,0],["0007014B",71.88,-137.88,0],["0007015C",76.62,-146.88,0],["0007015E",83.12,-167.88,0],["0007016B",86.51,-170.06,0]]},
|
||||
{"from":"A2","to":"70007085","exit":"Portal to Shoushi","length":44.9,"minClear":0.68,"cells":7,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["0007016E",96.38,-68.88,0],["0007016C",100,-53.62,0]]},
|
||||
{"from":"A2","to":"7000708F","exit":"Portal to Tou-Tou","length":44.84,"minClear":0.71,"cells":7,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["0007016E",96.38,-71.12,0],["00070170",99.98,-86.3,0]]},
|
||||
{"from":"A2","to":"70007090","exit":"Mayoi Portal","length":50.48,"minClear":0.65,"cells":8,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["0007016E",96.38,-68.88,0],["0007016D",100.62,-64.88,0],["0007016D",104.38,-62.62,0],["00070172",105.12,-59.88,0],["00070172",107.88,-57.12,0],["00070171",110,-53.37,0]]},
|
||||
{"from":"A2","to":"70007095","exit":"Portal to Nanto","length":50.2,"minClear":0.64,"cells":8,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["0007016E",96.38,-71.12,0],["0007016F",101.62,-80.38,0],["00070174",107.62,-83.12,0],["00070175",109.98,-86,0]]},
|
||||
{"from":"A2","to":"70007096","exit":"Lin Portal","length":59.37,"minClear":0.64,"cells":9,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["0007016E",96.38,-68.88,0],["0007016D",100.62,-64.88,0],["0007016D",104.38,-62.62,0],["00070172",105.12,-59.88,0],["00070177",118.12,-56.62,0],["00070176",120,-53.43,0]]},
|
||||
{"from":"A2","to":"7000709E","exit":"Baishi Portal","length":60.1,"minClear":0.68,"cells":9,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["00070173",110.38,-72.88,0],["00070179",117.62,-81.38,0],["0007017A",119.97,-86.44,0]]},
|
||||
{"from":"A2","to":"7000709F","exit":"Portal to Hebian-To","length":68.84,"minClear":0.65,"cells":10,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["00070178",117.88,-66.88,0],["0007017C",127.88,-56.88,0],["0007017B",130,-53.62,0]]},
|
||||
{"from":"A2","to":"700070A4","exit":"Portal to Yanshi","length":68.52,"minClear":0.63,"cells":10,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["00070178",118.88,-74.12,0],["0007017E",128.12,-83.38,0],["0007017F",129.95,-86.36,0]]},
|
||||
{"from":"A2","to":"700070A5","exit":"Portal to Kara","length":76.94,"minClear":0.65,"cells":11,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["00070178",119.38,-66.62,0],["0007017C",126.62,-63.38,0],["00070181",138.12,-56.38,0],["00070180",140.04,-53.8,0]]},
|
||||
{"from":"A2","to":"700070AD","exit":"Sawato Portal","length":77.07,"minClear":0.66,"cells":11,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["00070178",122.12,-74.38,0],["0007017E",127.12,-76.62,0],["00070183",138.12,-83.38,0],["00070184",139.94,-86.36,0]]},
|
||||
{"from":"A2","to":"700070AE","exit":"Portal to Kryst","length":80.45,"minClear":0.67,"cells":11,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["00070178",119.38,-66.62,0],["0007017C",126.62,-63.38,0],["00070185",146.52,-59.96,0]]},
|
||||
{"from":"A2","to":"700070AF","exit":"Freehold Portal","length":80.41,"minClear":0.67,"cells":11,"points":[["00070143",70,-60,0],["00070164",86.12,-69.88,0],["00070178",122.12,-74.38,0],["0007017E",127.12,-76.62,0],["00070187",146.56,-80.05,0]]},
|
||||
{"from":"A3","to":"70007000","exit":"Al-Jalima Portal","length":70.17,"minClear":0.67,"cells":10,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["00070114",17.88,-65.62,0],["0007010E",12.62,-63.38,0],["0007010A",3.99,-60,0]]},
|
||||
{"from":"A3","to":"70007001","exit":"Tufa Portal","length":70.13,"minClear":0.67,"cells":10,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["00070114",20.62,-73.38,0],["0007010C",4.09,-80,0]]},
|
||||
{"from":"A3","to":"70007002","exit":"Portal to Zaikhal","length":68.41,"minClear":0.64,"cells":10,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["00070114",21.62,-66.12,0],["0007010E",12.12,-56.62,0],["0007010D",9.94,-53.81,0]]},
|
||||
{"from":"A3","to":"7000700A","exit":"Uziz Portal","length":69.04,"minClear":0.66,"cells":10,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["00070114",22.12,-73.12,0],["00070110",12.12,-83.12,0],["00070111",9.86,-86.53,0]]},
|
||||
{"from":"A3","to":"7000700B","exit":"Portal to Xarabydun","length":59.79,"minClear":0.65,"cells":9,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["00070119",29.38,-67.12,0],["00070112",20.07,-53.86,0]]},
|
||||
{"from":"A3","to":"70007013","exit":"Portal to Khayyaban","length":59.08,"minClear":0.64,"cells":9,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["0007011E",43.62,-71.12,0],["0007011F",39.38,-75.12,0],["0007011F",35.62,-77.38,0],["0007011A",33.88,-80.62,0],["00070115",22.12,-83.12,0],["00070116",19.98,-86.44,0]]},
|
||||
{"from":"A3","to":"70007014","exit":"Qalaba'r Portal","length":50.53,"minClear":0.66,"cells":8,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["0007011E",43.62,-68.88,0],["0007011D",38.38,-59.62,0],["00070118",32.12,-56.88,0],["00070117",30.01,-53.7,0]]},
|
||||
{"from":"A3","to":"70007018","exit":"Portal to Al-Arqas","length":50.05,"minClear":0.65,"cells":8,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["0007011E",43.62,-71.12,0],["0007011F",39.38,-75.12,0],["0007011F",35.62,-77.38,0],["0007011A",32.88,-82.12,0],["0007011B",29.94,-86.34,0]]},
|
||||
{"from":"A3","to":"70007019","exit":"Portal to Samsur","length":44.95,"minClear":0.71,"cells":7,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["0007011E",43.62,-68.88,0],["0007011C",39.97,-53.6,0]]},
|
||||
{"from":"A3","to":"70007024","exit":"Portal to Yaraq","length":44.7,"minClear":0.68,"cells":7,"points":[["00070145",70,-80,0],["00070125",53.88,-70.12,0],["0007011E",43.62,-71.12,0],["00070120",40,-86.18,0]]},
|
||||
{"from":"A3","to":"70007025","exit":"Glenden Wood Portal","length":78.81,"minClear":0.65,"cells":11,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070133",64.88,-66.88,0],["00070143",66.62,-62.38,0],["00070142",69.88,-52.38,0],["0007013F",66.88,-22.12,0],["0007012E",56.62,-11.88,0],["00070121",53.5,-10,0]]},
|
||||
{"from":"A3","to":"70007026","exit":"Lytelthorpe Portal","length":69.07,"minClear":0.63,"cells":10,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070133",64.88,-66.88,0],["00070142",69.88,-53.38,0],["00070141",68.88,-43.62,0],["00070131",64.88,-39.38,0],["00070131",62.62,-35.62,0],["00070130",59.38,-33.88,0],["0007012F",56.62,-21.88,0],["00070122",53.4,-20,0]]},
|
||||
{"from":"A3","to":"70007027","exit":"Portal to Cragstone","length":60.08,"minClear":0.64,"cells":9,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070133",64.88,-66.88,0],["00070143",66.62,-62.38,0],["00070142",69.88,-52.38,0],["00070141",68.88,-43.62,0],["00070131",64.88,-39.38,0],["00070131",62.62,-35.62,0],["00070130",57.62,-32.62,0],["00070130",57.12,-32.12,0],["00070123",53.44,-30.01,0]]},
|
||||
{"from":"A3","to":"70007028","exit":"Portal to Holtburg","length":54.56,"minClear":0.67,"cells":8,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070143",66.62,-60.62,0],["00070142",69.88,-53.12,0],["00070141",68.88,-43.62,0],["00070124",53.91,-39.95,0]]},
|
||||
{"from":"A3","to":"70007029","exit":"Portal to Facility Hub","length":32.17,"minClear":0.64,"cells":5,"points":[["00070145",70,-80,0],["00070147",68.88,-96.38,0],["00070126",53.55,-100,0]]},
|
||||
{"from":"A3","to":"7000702A","exit":"Portal to Bluespire","length":52.23,"minClear":0.81,"cells":7,"points":[["00070145",70,-80,0],["00070149",69.12,-116.12,0],["00070127",53.5,-120.02,0]]},
|
||||
{"from":"A3","to":"7000702B","exit":"Portal to Greenspire","length":57.85,"minClear":0.64,"cells":8,"points":[["00070145",70,-80,0],["00070149",69.12,-116.12,0],["00070136",59.62,-121.62,0],["00070137",56.62,-128.12,0],["00070128",53.54,-129.95,0]]},
|
||||
{"from":"A3","to":"7000702C","exit":"Ahurenga Portal","length":67.56,"minClear":0.68,"cells":9,"points":[["00070145",70,-80,0],["0007014A",68.62,-128.88,0],["00070138",58.88,-137.62,0],["00070129",53.81,-139.94,0]]},
|
||||
{"from":"A3","to":"7000702D","exit":"Portal to Neydisa Castle","length":76.09,"minClear":0.63,"cells":10,"points":[["00070145",70,-80,0],["0007014B",68.38,-136.12,0],["00070139",57.38,-147.12,0],["0007012A",54.05,-149.98,0]]},
|
||||
{"from":"A3","to":"7000702E","exit":"Portal to Silyun","length":84.8,"minClear":0.66,"cells":11,"points":[["00070145",70,-80,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013A",56.62,-158.12,0],["0007012B",53.6,-159.97,0]]},
|
||||
{"from":"A3","to":"7000702F","exit":"Fiun Outpost","length":93.71,"minClear":0.65,"cells":12,"points":[["00070145",70,-80,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013B",56.38,-168.12,0],["0007012C",53.8,-170.02,0]]},
|
||||
{"from":"A3","to":"70007030","exit":"Plateau Portal","length":80.59,"minClear":0.66,"cells":11,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070133",64.88,-66.88,0],["00070143",66.62,-62.38,0],["00070142",69.88,-52.38,0],["0007013F",66.62,-20.62,0],["0007012E",63.38,-13.38,0],["0007012D",60,-3.48,0]]},
|
||||
{"from":"A3","to":"7000704D","exit":"Base of the Timaru Plateau Portal","length":97.9,"minClear":0.68,"cells":12,"points":[["00070145",70,-80,0],["0007014B",68.38,-137.38,0],["00070139",63.38,-146.88,0],["0007013C",60.02,-176.45,0]]},
|
||||
{"from":"A3","to":"7000704E","exit":"Fort Tethana Portal","length":79.96,"minClear":0.66,"cells":10,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070133",64.88,-66.88,0],["00070143",66.62,-62.38,0],["00070142",69.88,-52.38,0],["0007013F",66.62,-20.62,0],["0007013E",67.12,-9.12,0],["0007013D",69.99,-3.56,0]]},
|
||||
{"from":"A3","to":"7000705A","exit":"Stonehold Portal","length":80.47,"minClear":0.64,"cells":11,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070133",64.88,-66.88,0],["00070143",66.62,-62.38,0],["00070142",69.88,-52.38,0],["00070152",75.38,-16.88,0],["00070150",79.94,-3.35,0]]},
|
||||
{"from":"A3","to":"70007079","exit":"Oolutanga's Refuge","length":97.79,"minClear":0.68,"cells":12,"points":[["00070145",70,-80,0],["0007014B",71.62,-137.62,0],["0007015C",76.62,-146.62,0],["0007015F",79.99,-176.28,0]]},
|
||||
{"from":"A3","to":"7000707A","exit":"Portal to Dryreach","length":78.24,"minClear":0.63,"cells":11,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070133",64.88,-66.88,0],["00070143",66.62,-62.38,0],["00070142",69.88,-52.38,0],["0007013F",74.88,-20.38,0],["00070151",83.12,-12.12,0],["00070160",86.42,-10,0]]},
|
||||
{"from":"A3","to":"7000707B","exit":"Eastham Portal","length":69.97,"minClear":0.65,"cells":10,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070143",67.88,-57.62,0],["00070142",69.88,-53.12,0],["00070140",73.12,-29.38,0],["00070152",81.38,-22.38,0],["00070161",86.49,-20.03,0]]},
|
||||
{"from":"A3","to":"7000707C","exit":"Portal to Rithwic","length":60.28,"minClear":0.63,"cells":9,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070133",64.88,-66.88,0],["00070142",69.88,-53.38,0],["00070141",71.12,-43.62,0],["00070154",80.38,-38.38,0],["00070153",83.62,-31.88,0],["00070162",86.24,-30,0]]},
|
||||
{"from":"A3","to":"7000707D","exit":"Portal to Arwic","length":55.32,"minClear":0.67,"cells":8,"points":[["00070145",70,-80,0],["00070133",64.12,-70.88,0],["00070143",66.62,-60.62,0],["00070142",69.88,-53.12,0],["00070141",71.12,-43.62,0],["00070163",86.86,-40,0]]},
|
||||
{"from":"A3","to":"7000707E","exit":"The Marketplace of Dereth","length":31.85,"minClear":0.64,"cells":5,"points":[["00070145",70,-80,0],["00070147",71.12,-96.38,0],["00070165",86.13,-99.98,0]]},
|
||||
{"from":"A3","to":"7000707F","exit":"Portal to Sanamar","length":51.92,"minClear":0.81,"cells":7,"points":[["00070145",70,-80,0],["00070149",70.88,-116.12,0],["00070166",86.18,-120.04,0]]},
|
||||
{"from":"A3","to":"70007080","exit":"Portal to Redspire","length":57.75,"minClear":0.67,"cells":8,"points":[["00070145",70,-80,0],["00070149",70.88,-116.12,0],["00070159",75.12,-120.62,0],["00070159",77.38,-124.38,0],["0007015A",80.12,-125.12,0],["0007015A",82.88,-127.88,0],["00070167",86.61,-130.04,0]]},
|
||||
{"from":"A3","to":"70007081","exit":"Portal to Westwatch","length":66.42,"minClear":0.65,"cells":9,"points":[["00070145",70,-80,0],["00070149",70.88,-116.12,0],["00070159",75.12,-120.62,0],["00070159",77.38,-124.38,0],["0007015A",80.12,-125.12,0],["0007015B",83.12,-137.88,0],["00070168",86.28,-139.95,0]]},
|
||||
{"from":"A3","to":"70007082","exit":"Portal to Linvak Tukal","length":76.42,"minClear":0.64,"cells":10,"points":[["00070145",70,-80,0],["0007014B",71.62,-136.38,0],["0007015C",82.88,-147.62,0],["00070169",86.24,-149.99,0]]},
|
||||
{"from":"A3","to":"70007083","exit":"Danby's Outpost","length":84.86,"minClear":0.63,"cells":11,"points":[["00070145",70,-80,0],["0007014B",71.62,-137.62,0],["0007015C",76.62,-146.62,0],["0007015D",83.12,-157.88,0],["0007016A",86.42,-160,0]]},
|
||||
{"from":"A3","to":"70007084","exit":"Portal to Eastwatch","length":94.2,"minClear":0.64,"cells":12,"points":[["00070145",70,-80,0],["0007014B",71.62,-137.62,0],["0007015C",76.62,-146.62,0],["0007015E",83.12,-167.88,0],["0007016B",86.51,-170.06,0]]},
|
||||
{"from":"A3","to":"70007085","exit":"Portal to Shoushi","length":44.92,"minClear":0.71,"cells":7,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["0007016E",96.38,-68.88,0],["0007016C",100,-53.62,0]]},
|
||||
{"from":"A3","to":"7000708F","exit":"Portal to Tou-Tou","length":44.82,"minClear":0.68,"cells":7,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["0007016E",96.38,-71.12,0],["00070170",99.98,-86.3,0]]},
|
||||
{"from":"A3","to":"70007090","exit":"Mayoi Portal","length":50.51,"minClear":0.65,"cells":8,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["0007016E",96.38,-68.88,0],["0007016D",100.62,-64.88,0],["0007016D",104.38,-62.62,0],["00070172",105.12,-59.88,0],["00070172",107.88,-57.12,0],["00070171",110,-53.37,0]]},
|
||||
{"from":"A3","to":"70007095","exit":"Portal to Nanto","length":50.17,"minClear":0.64,"cells":8,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["0007016E",96.38,-71.12,0],["0007016F",101.62,-80.38,0],["00070174",107.62,-83.12,0],["00070175",109.98,-86,0]]},
|
||||
{"from":"A3","to":"70007096","exit":"Lin Portal","length":59.4,"minClear":0.64,"cells":9,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["0007016E",96.38,-68.88,0],["0007016D",100.62,-64.88,0],["0007016D",104.38,-62.62,0],["00070172",105.12,-59.88,0],["00070177",118.12,-56.62,0],["00070176",120,-53.43,0]]},
|
||||
{"from":"A3","to":"7000709E","exit":"Baishi Portal","length":60.22,"minClear":0.7,"cells":9,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["00070173",109.88,-72.38,0],["00070179",117.62,-81.38,0],["0007017A",119.97,-86.44,0]]},
|
||||
{"from":"A3","to":"7000709F","exit":"Portal to Hebian-To","length":68.77,"minClear":0.64,"cells":10,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["00070178",118.12,-66.62,0],["0007017C",127.88,-56.88,0],["0007017B",130,-53.62,0]]},
|
||||
{"from":"A3","to":"700070A4","exit":"Portal to Yanshi","length":68.71,"minClear":0.64,"cells":10,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["00070178",118.12,-73.38,0],["0007017E",128.12,-83.38,0],["0007017F",129.95,-86.36,0]]},
|
||||
{"from":"A3","to":"700070A5","exit":"Portal to Kara","length":76.96,"minClear":0.65,"cells":11,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["00070178",119.38,-66.62,0],["0007017C",126.62,-63.38,0],["00070181",138.12,-56.38,0],["00070180",140.04,-53.8,0]]},
|
||||
{"from":"A3","to":"700070AD","exit":"Sawato Portal","length":77.09,"minClear":0.66,"cells":11,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["00070178",119.38,-73.38,0],["0007017E",126.62,-76.62,0],["00070183",138.12,-83.38,0],["00070184",139.94,-86.36,0]]},
|
||||
{"from":"A3","to":"700070AE","exit":"Portal to Kryst","length":80.47,"minClear":0.73,"cells":11,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["00070178",119.38,-66.62,0],["0007017C",126.62,-63.38,0],["00070185",146.52,-59.96,0]]},
|
||||
{"from":"A3","to":"700070AF","exit":"Freehold Portal","length":80.49,"minClear":0.67,"cells":11,"points":[["00070145",70,-80,0],["00070164",86.12,-70.12,0],["00070178",119.38,-73.38,0],["0007017E",126.62,-76.62,0],["00070187",146.56,-80.05,0]]},
|
||||
{"from":"A4","to":"70007000","exit":"Al-Jalima Portal","length":79.88,"minClear":0.64,"cells":11,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070145",66.88,-75.12,0],["00070133",62.38,-73.38,0],["00070125",52.38,-70.12,0],["00070113",16.88,-64.62,0],["0007010A",3.99,-60,0]]},
|
||||
{"from":"A4","to":"70007001","exit":"Tufa Portal","length":80,"minClear":0.65,"cells":11,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070145",66.88,-75.12,0],["00070133",62.38,-73.38,0],["00070125",52.38,-70.12,0],["00070114",20.62,-73.38,0],["0007010C",4.09,-80,0]]},
|
||||
{"from":"A4","to":"70007002","exit":"Portal to Zaikhal","length":78.07,"minClear":0.64,"cells":11,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070145",66.88,-75.12,0],["00070133",62.38,-73.38,0],["00070125",52.38,-70.12,0],["00070114",20.88,-65.38,0],["0007010E",12.12,-56.62,0],["0007010D",9.94,-53.81,0]]},
|
||||
{"from":"A4","to":"7000700A","exit":"Uziz Portal","length":78.91,"minClear":0.65,"cells":11,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070145",66.88,-75.12,0],["00070133",62.38,-73.38,0],["00070125",52.38,-70.12,0],["00070114",22.12,-73.12,0],["00070110",12.12,-83.12,0],["00070111",9.86,-86.53,0]]},
|
||||
{"from":"A4","to":"7000700B","exit":"Portal to Xarabydun","length":69.52,"minClear":0.63,"cells":10,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070133",57.38,-71.88,0],["00070125",52.88,-70.12,0],["00070119",28.88,-66.62,0],["00070112",20.07,-53.86,0]]},
|
||||
{"from":"A4","to":"70007013","exit":"Portal to Khayyaban","length":68.94,"minClear":0.64,"cells":10,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070133",57.38,-71.88,0],["00070125",52.88,-70.12,0],["0007011E",43.62,-71.12,0],["0007011F",39.38,-75.12,0],["0007011F",35.62,-77.38,0],["0007011A",33.88,-80.62,0],["00070115",22.12,-83.12,0],["00070116",19.98,-86.44,0]]},
|
||||
{"from":"A4","to":"70007014","exit":"Qalaba'r Portal","length":60.45,"minClear":0.65,"cells":9,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070145",66.88,-75.12,0],["00070125",53.38,-70.12,0],["0007011E",43.62,-68.88,0],["0007011D",38.38,-59.62,0],["00070118",32.12,-56.88,0],["00070117",30.01,-53.7,0]]},
|
||||
{"from":"A4","to":"70007018","exit":"Portal to Al-Arqas","length":59.92,"minClear":0.65,"cells":9,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070145",66.88,-75.12,0],["00070133",62.38,-73.38,0],["00070125",52.38,-70.12,0],["0007011E",43.62,-71.12,0],["0007011F",39.38,-75.12,0],["0007011F",35.62,-77.38,0],["0007011A",32.88,-82.12,0],["0007011B",29.94,-86.34,0]]},
|
||||
{"from":"A4","to":"70007019","exit":"Portal to Samsur","length":54.88,"minClear":0.65,"cells":8,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070133",60.62,-73.38,0],["00070125",53.12,-70.12,0],["0007011E",43.62,-68.88,0],["0007011C",39.97,-53.6,0]]},
|
||||
{"from":"A4","to":"70007024","exit":"Portal to Yaraq","length":54.63,"minClear":0.65,"cells":8,"points":[["00070156",80,-70,0],["00070145",70.88,-75.88,0],["00070133",60.62,-73.38,0],["00070125",53.12,-70.12,0],["0007011E",43.62,-71.12,0],["00070120",40,-86.18,0]]},
|
||||
{"from":"A4","to":"70007025","exit":"Glenden Wood Portal","length":68.88,"minClear":0.64,"cells":10,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["0007013F",66.62,-21.88,0],["0007012E",56.62,-11.88,0],["00070121",53.5,-10,0]]},
|
||||
{"from":"A4","to":"70007026","exit":"Lytelthorpe Portal","length":59.18,"minClear":0.63,"cells":9,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["00070141",68.88,-43.62,0],["00070131",64.88,-39.38,0],["00070131",62.62,-35.62,0],["00070130",59.38,-33.88,0],["0007012F",56.62,-21.88,0],["00070122",53.4,-20,0]]},
|
||||
{"from":"A4","to":"70007027","exit":"Portal to Cragstone","length":50.24,"minClear":0.64,"cells":8,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["00070141",68.88,-43.62,0],["00070131",64.88,-39.38,0],["00070131",62.62,-35.62,0],["00070130",57.62,-32.62,0],["00070130",57.12,-32.12,0],["00070123",53.44,-30.01,0]]},
|
||||
{"from":"A4","to":"70007028","exit":"Portal to Holtburg","length":44.65,"minClear":0.71,"cells":7,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["00070141",68.88,-43.62,0],["00070124",53.91,-39.95,0]]},
|
||||
{"from":"A4","to":"70007029","exit":"Portal to Facility Hub","length":44.99,"minClear":0.71,"cells":7,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["00070147",68.88,-96.38,0],["00070126",53.55,-100,0]]},
|
||||
{"from":"A4","to":"7000702A","exit":"Portal to Bluespire","length":65.02,"minClear":0.73,"cells":9,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["00070149",69.12,-116.12,0],["00070127",53.5,-120.02,0]]},
|
||||
{"from":"A4","to":"7000702B","exit":"Portal to Greenspire","length":70.64,"minClear":0.64,"cells":10,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["00070149",69.12,-116.12,0],["00070136",59.62,-121.62,0],["00070137",56.62,-128.12,0],["00070128",53.54,-129.95,0]]},
|
||||
{"from":"A4","to":"7000702C","exit":"Ahurenga Portal","length":80.36,"minClear":0.73,"cells":11,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014A",68.62,-128.88,0],["00070138",58.88,-137.62,0],["00070129",53.81,-139.94,0]]},
|
||||
{"from":"A4","to":"7000702D","exit":"Portal to Neydisa Castle","length":88.78,"minClear":0.63,"cells":12,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014B",68.12,-136.38,0],["00070139",57.38,-147.12,0],["0007012A",54.05,-149.98,0]]},
|
||||
{"from":"A4","to":"7000702E","exit":"Portal to Silyun","length":97.51,"minClear":0.66,"cells":13,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014B",68.12,-137.62,0],["00070139",63.38,-146.88,0],["0007013A",56.62,-158.12,0],["0007012B",53.6,-159.97,0]]},
|
||||
{"from":"A4","to":"7000702F","exit":"Fiun Outpost","length":106.42,"minClear":0.65,"cells":14,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014B",68.12,-137.62,0],["00070139",63.38,-146.88,0],["0007013B",56.38,-168.12,0],["0007012C",53.8,-170.02,0]]},
|
||||
{"from":"A4","to":"70007030","exit":"Plateau Portal","length":70.74,"minClear":0.73,"cells":10,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["0007013F",66.62,-20.62,0],["0007012E",63.38,-13.38,0],["0007012D",60,-3.48,0]]},
|
||||
{"from":"A4","to":"7000704D","exit":"Base of the Timaru Plateau Portal","length":110.61,"minClear":0.66,"cells":14,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014B",68.12,-137.62,0],["00070139",63.38,-146.88,0],["0007013C",60.02,-176.45,0]]},
|
||||
{"from":"A4","to":"7000704E","exit":"Fort Tethana Portal","length":70.12,"minClear":0.71,"cells":9,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["0007013F",66.62,-20.62,0],["0007013E",67.12,-9.12,0],["0007013D",69.99,-3.56,0]]},
|
||||
{"from":"A4","to":"7000705A","exit":"Stonehold Portal","length":70.82,"minClear":0.67,"cells":10,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["0007013F",73.38,-20.62,0],["00070151",76.62,-13.38,0],["00070150",79.94,-3.35,0]]},
|
||||
{"from":"A4","to":"70007079","exit":"Oolutanga's Refuge","length":110.58,"minClear":0.71,"cells":14,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014B",71.62,-137.62,0],["0007015C",76.62,-146.62,0],["0007015F",79.99,-176.28,0]]},
|
||||
{"from":"A4","to":"7000707A","exit":"Portal to Dryreach","length":68.78,"minClear":0.63,"cells":10,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["0007013F",73.38,-21.88,0],["00070151",83.12,-12.12,0],["00070160",86.42,-10,0]]},
|
||||
{"from":"A4","to":"7000707B","exit":"Eastham Portal","length":60.27,"minClear":0.7,"cells":9,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["00070140",72.38,-30.12,0],["00070152",81.38,-22.38,0],["00070161",86.49,-20.03,0]]},
|
||||
{"from":"A4","to":"7000707C","exit":"Portal to Rithwic","length":50.34,"minClear":0.63,"cells":8,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["00070141",71.12,-43.62,0],["00070154",80.38,-38.38,0],["00070153",83.62,-31.88,0],["00070162",86.24,-30,0]]},
|
||||
{"from":"A4","to":"7000707D","exit":"Portal to Arwic","length":45.37,"minClear":0.68,"cells":7,"points":[["00070156",80,-70,0],["00070142",70.12,-53.88,0],["00070141",71.12,-43.62,0],["00070163",86.86,-40,0]]},
|
||||
{"from":"A4","to":"7000707E","exit":"The Marketplace of Dereth","length":44.65,"minClear":0.68,"cells":7,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["00070147",71.12,-96.38,0],["00070165",86.13,-99.98,0]]},
|
||||
{"from":"A4","to":"7000707F","exit":"Portal to Sanamar","length":64.71,"minClear":0.73,"cells":9,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["00070149",70.88,-116.12,0],["00070166",86.18,-120.04,0]]},
|
||||
{"from":"A4","to":"70007080","exit":"Portal to Redspire","length":70.54,"minClear":0.67,"cells":10,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["00070149",70.88,-116.12,0],["00070159",75.12,-120.62,0],["00070159",77.38,-124.38,0],["0007015A",80.12,-125.12,0],["0007015A",82.88,-127.88,0],["00070167",86.61,-130.04,0]]},
|
||||
{"from":"A4","to":"70007081","exit":"Portal to Westwatch","length":79.21,"minClear":0.65,"cells":11,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["00070149",70.88,-116.12,0],["00070159",75.12,-120.62,0],["00070159",77.38,-124.38,0],["0007015A",80.12,-125.12,0],["0007015B",83.12,-137.88,0],["00070168",86.28,-139.95,0]]},
|
||||
{"from":"A4","to":"70007082","exit":"Portal to Linvak Tukal","length":89.21,"minClear":0.64,"cells":12,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014B",71.62,-136.38,0],["0007015C",82.88,-147.62,0],["00070169",86.24,-149.99,0]]},
|
||||
{"from":"A4","to":"70007083","exit":"Danby's Outpost","length":97.65,"minClear":0.63,"cells":13,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014B",71.62,-137.62,0],["0007015C",76.62,-146.62,0],["0007015D",83.12,-157.88,0],["0007016A",86.42,-160,0]]},
|
||||
{"from":"A4","to":"70007084","exit":"Portal to Eastwatch","length":106.99,"minClear":0.64,"cells":14,"points":[["00070156",80,-70,0],["00070146",70.12,-86.12,0],["0007014B",71.62,-137.62,0],["0007015C",76.62,-146.62,0],["0007015E",83.12,-167.88,0],["0007016B",86.51,-170.06,0]]},
|
||||
{"from":"A4","to":"70007085","exit":"Portal to Shoushi","length":32.1,"minClear":0.64,"cells":5,"points":[["00070156",80,-70,0],["0007016E",96.38,-68.88,0],["0007016C",100,-53.62,0]]},
|
||||
{"from":"A4","to":"7000708F","exit":"Portal to Tou-Tou","length":32.02,"minClear":0.64,"cells":5,"points":[["00070156",80,-70,0],["0007016E",96.38,-71.12,0],["00070170",99.98,-86.3,0]]},
|
||||
{"from":"A4","to":"70007090","exit":"Mayoi Portal","length":37.68,"minClear":0.64,"cells":6,"points":[["00070156",80,-70,0],["0007016E",96.38,-68.88,0],["0007016D",100.62,-64.88,0],["0007016D",104.38,-62.62,0],["00070172",105.12,-59.88,0],["00070172",107.88,-57.12,0],["00070171",110,-53.37,0]]},
|
||||
{"from":"A4","to":"70007095","exit":"Portal to Nanto","length":37.38,"minClear":0.64,"cells":6,"points":[["00070156",80,-70,0],["0007016E",96.38,-71.12,0],["0007016F",101.62,-80.38,0],["00070174",107.62,-83.12,0],["00070175",109.98,-86,0]]},
|
||||
{"from":"A4","to":"70007096","exit":"Lin Portal","length":46.58,"minClear":0.64,"cells":7,"points":[["00070156",80,-70,0],["0007016E",96.38,-68.88,0],["0007016D",100.62,-64.88,0],["0007016D",104.38,-62.62,0],["00070172",105.12,-59.88,0],["00070177",118.12,-56.62,0],["00070176",120,-53.43,0]]},
|
||||
{"from":"A4","to":"7000709E","exit":"Baishi Portal","length":47.59,"minClear":0.71,"cells":7,"points":[["00070156",80,-70,0],["00070173",109.38,-71.88,0],["00070179",117.62,-81.38,0],["0007017A",119.97,-86.44,0]]},
|
||||
{"from":"A4","to":"7000709F","exit":"Portal to Hebian-To","length":56.29,"minClear":0.65,"cells":8,"points":[["00070156",80,-70,0],["00070178",117.12,-67.62,0],["0007017C",127.88,-56.88,0],["0007017B",130,-53.62,0]]},
|
||||
{"from":"A4","to":"700070A4","exit":"Portal to Yanshi","length":56.25,"minClear":0.67,"cells":8,"points":[["00070156",80,-70,0],["00070178",117.12,-72.38,0],["0007017E",128.12,-83.38,0],["0007017F",129.95,-86.36,0]]},
|
||||
{"from":"A4","to":"700070A5","exit":"Portal to Kara","length":64.36,"minClear":0.65,"cells":9,"points":[["00070156",80,-70,0],["00070178",118.62,-67.38,0],["0007017C",127.12,-63.38,0],["00070181",138.12,-56.38,0],["00070180",140.04,-53.8,0]]},
|
||||
{"from":"A4","to":"700070AD","exit":"Sawato Portal","length":64.48,"minClear":0.64,"cells":9,"points":[["00070156",80,-70,0],["00070178",118.38,-72.62,0],["0007017E",127.12,-76.62,0],["00070183",138.12,-83.38,0],["00070184",139.94,-86.36,0]]},
|
||||
{"from":"A4","to":"700070AE","exit":"Portal to Kryst","length":67.58,"minClear":0.65,"cells":9,"points":[["00070156",80,-70,0],["00070178",118.62,-67.38,0],["00070185",146.52,-59.96,0]]},
|
||||
{"from":"A4","to":"700070AF","exit":"Freehold Portal","length":67.61,"minClear":0.64,"cells":9,"points":[["00070156",80,-70,0],["00070178",118.38,-72.62,0],["00070187",146.56,-80.05,0]]}
|
||||
]
|
||||
}
|
||||
354
tools/navdata/gen_townnet.py
Normal file
354
tools/navdata/gen_townnet.py
Normal file
|
|
@ -0,0 +1,354 @@
|
|||
"""Builds townnet.json: the Town Network's portals, for RynthNav's route planner.
|
||||
|
||||
The Town Network is the indoor hub (landblock 0x0007 on retail data) with a
|
||||
"Portal to Town Network" in many towns and, inside, an exit portal to each town.
|
||||
This script writes what the world database knows about it:
|
||||
|
||||
arrivals each place an entry portal lands you, inside the network
|
||||
entries every placed portal (outdoors, in a building, or in a dungeon) whose
|
||||
destination is inside the network: where it stands on the map, the
|
||||
nearest town, and which arrival it lands at
|
||||
exits every placed portal inside the network: where it stands, where it
|
||||
goes (cell, position, map coordinates, nearest town)
|
||||
npcs the vendors and other creatures standing inside, as obstacles
|
||||
|
||||
Every portal carries the restrictions the server checks before it lets a
|
||||
character through (ACE Portal.CheckUseRequirements): minLevel, maxLevel, quest
|
||||
(the QuestRestriction flag name), closed (PortalBitmask 0: nobody may use it),
|
||||
noPk / noPkLite / noNpk / onlyOlthoi / noOlthoi / noVitae / noNewAccounts (the
|
||||
PortalBitmask bits) and accountRequirements (a SubscriptionStatus; ACE gives
|
||||
every player 1, so 1 restricts nobody).
|
||||
|
||||
The walking paths inside (from every arrival to every exit portal) need the
|
||||
dats; RynthSuite's Tools/RynthNav.TownNet adds them to the same file:
|
||||
dotnet run -c Release --project <RynthSuite>/Tools/RynthNav.TownNet -- build --in townnet.json
|
||||
Build-TownNet.ps1 (next to this script) runs both steps.
|
||||
|
||||
Usage (same options as gen_locations.py; SELECT only, the password stays on the server):
|
||||
python tools/navdata/gen_townnet.py --out <dir> [--dump <dir> | --from-dump <dir>]
|
||||
--lb 0007,... the network's landblocks, instead of finding them from the
|
||||
"Town Network" portals' destinations
|
||||
|
||||
Only our own world database is read; no GoArrow or Crossroads of Dereth data.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import gen_locations as g # noqa: E402
|
||||
|
||||
FORMAT_VERSION = 1
|
||||
|
||||
# Portal weenies named like this lead into the network; their destinations name its landblocks.
|
||||
TOWN_NETWORK_NAME = re.compile(r'town\s*network', re.I)
|
||||
|
||||
# A portal counts as "in" (or going to) the nearest town within this many map units (0.1 = 24 yd).
|
||||
TOWN_RADIUS = 3.0
|
||||
|
||||
# PortalBitmask (ACE.Entity.Enum.PortalBitmask) bits a planner must respect.
|
||||
PORTAL_BITS = [(0x02, 'noPk'), (0x04, 'noPkLite'), (0x08, 'noNpk'), (0x40, 'onlyOlthoi'),
|
||||
(0x80, 'noOlthoi'), (0x100, 'noVitae'), (0x200, 'noNewAccounts')]
|
||||
|
||||
_PORTAL_FIELDS = """
|
||||
li.guid, li.weenie_Class_Id, li.obj_Cell_Id, li.origin_X, li.origin_Y, li.origin_Z,
|
||||
li.angles_W, li.angles_X, li.angles_Y, li.angles_Z,
|
||||
(select s.value from weenie_properties_string s where s.object_Id=li.weenie_Class_Id and s.type=1 limit 1),
|
||||
pp.obj_Cell_Id, pp.origin_X, pp.origin_Y, pp.origin_Z,
|
||||
(select i.value from weenie_properties_int i where i.object_Id=li.weenie_Class_Id and i.type=86 limit 1),
|
||||
(select i.value from weenie_properties_int i where i.object_Id=li.weenie_Class_Id and i.type=87 limit 1),
|
||||
(select s.value from weenie_properties_string s where s.object_Id=li.weenie_Class_Id and s.type=37 limit 1),
|
||||
(select i.value from weenie_properties_int i where i.object_Id=li.weenie_Class_Id and i.type=111 limit 1),
|
||||
(select i.value from weenie_properties_int i where i.object_Id=li.weenie_Class_Id and i.type=26 limit 1),
|
||||
(select b.value+0 from weenie_properties_bool b where b.object_Id=li.weenie_Class_Id and b.type=43 limit 1),
|
||||
(select d.value from weenie_properties_d_i_d d where d.object_Id=li.weenie_Class_Id and d.type=1 limit 1),
|
||||
(select f.value from weenie_properties_float f where f.object_Id=li.weenie_Class_Id and f.type=39 limit 1)
|
||||
from landblock_instance li
|
||||
join weenie w on w.class_Id=li.weenie_Class_Id and w.type=7
|
||||
left join weenie_properties_position pp on pp.object_Id=li.weenie_Class_Id and pp.position_Type=2"""
|
||||
|
||||
QUERIES = {
|
||||
# Portal weenies whose name says Town Network, and where they go.
|
||||
'tn_weenies': """
|
||||
select s.object_Id, s.value, pp.obj_Cell_Id
|
||||
from weenie_properties_string s
|
||||
join weenie w on w.class_Id=s.object_Id and w.type=7
|
||||
join weenie_properties_position pp on pp.object_Id=s.object_Id and pp.position_Type=2
|
||||
where s.type=1 and s.value like '%Town Network%'
|
||||
order by s.object_Id""",
|
||||
# Every placed portal with a destination: filtered to the network here, so the query
|
||||
# does not depend on the landblock list (and one dump serves any --lb).
|
||||
'tn_portals': 'select' + _PORTAL_FIELDS + """
|
||||
where pp.obj_Cell_Id is not null
|
||||
order by li.guid""",
|
||||
# Vendors and other creatures standing in the network (obstacles for the walks).
|
||||
'tn_npcs': """
|
||||
select li.guid, li.weenie_Class_Id, w.type, li.obj_Cell_Id, li.origin_X, li.origin_Y, li.origin_Z,
|
||||
(select s.value from weenie_properties_string s where s.object_Id=li.weenie_Class_Id and s.type=1 limit 1),
|
||||
(select d.value from weenie_properties_d_i_d d where d.object_Id=li.weenie_Class_Id and d.type=1 limit 1)
|
||||
from landblock_instance li
|
||||
join weenie w on w.class_Id=li.weenie_Class_Id and w.type in (10,12)
|
||||
where (li.obj_Cell_Id & 65535) >= 256
|
||||
order by li.guid""",
|
||||
'poi': g.QUERIES['poi'],
|
||||
'surface': g.QUERIES['surface'],
|
||||
}
|
||||
|
||||
|
||||
def fetch(args):
|
||||
raw = {}
|
||||
for name, sql in QUERIES.items():
|
||||
if args.from_dump:
|
||||
with open(os.path.join(args.from_dump, name + '.tsv'), encoding='utf-8') as f:
|
||||
raw[name] = f.read()
|
||||
else:
|
||||
raw[name] = g.run_query(args.host, args.db, sql)
|
||||
if args.dump:
|
||||
os.makedirs(args.dump, exist_ok=True)
|
||||
with open(os.path.join(args.dump, name + '.tsv'), 'w', encoding='utf-8', newline='\n') as f:
|
||||
f.write(raw[name])
|
||||
return {k: g.parse_rows(v) for k, v in raw.items()}
|
||||
|
||||
|
||||
def r3(v):
|
||||
return round(v, 3)
|
||||
|
||||
|
||||
def lb_of(cell):
|
||||
return (cell >> 16) & 0xFFFF
|
||||
|
||||
|
||||
def restrictions(minlvl, maxlvl, quest, bitmask, acct, advocate):
|
||||
"""The fields a planner checks before it routes a character through a portal."""
|
||||
out = {}
|
||||
if minlvl is not None and int(minlvl) > 0:
|
||||
out['minLevel'] = int(minlvl)
|
||||
if maxlvl is not None and int(maxlvl) > 0:
|
||||
out['maxLevel'] = int(maxlvl)
|
||||
if quest:
|
||||
out['quest'] = quest.strip()
|
||||
if bitmask is not None:
|
||||
b = int(bitmask)
|
||||
if b == 0:
|
||||
out['closed'] = True
|
||||
for bit, name in PORTAL_BITS:
|
||||
if b & bit:
|
||||
out[name] = True
|
||||
if acct is not None and int(acct) > 0:
|
||||
out['accountRequirements'] = int(acct)
|
||||
if advocate == '1':
|
||||
out['advocateOnly'] = True
|
||||
return out
|
||||
|
||||
|
||||
def build(rows, lbs_override=None):
|
||||
world = g.World([(int(a), float(b), float(c), int(d)) for a, b, c, d in rows['surface']])
|
||||
|
||||
# The network's landblocks: where the "Town Network" portals lead.
|
||||
named = [(int(w), n, int(c)) for w, n, c in rows['tn_weenies'] if TOWN_NETWORK_NAME.search(n or '')]
|
||||
found = sorted({lb_of(c) for _, _, c in named})
|
||||
lbs = sorted(lbs_override) if lbs_override else found
|
||||
|
||||
# Towns (as gen_locations names them), for "which town is this portal in / does it go to".
|
||||
towns = []
|
||||
by_wcid = defaultdict(list)
|
||||
for name, wcid, cell, x, y, z in rows['poi']:
|
||||
if cell is not None:
|
||||
by_wcid[int(wcid)].append((name, int(cell), float(x), float(y), float(z)))
|
||||
for _wcid, names in by_wcid.items():
|
||||
name, cell, x, y, z = max(names, key=lambda n: (n[0].count(' '), len(n[0])))
|
||||
if world.place(cell, z) in ('outdoor', 'building'):
|
||||
ns, ew = g.cell_to_map(cell, x, y)
|
||||
towns.append((name, ns, ew))
|
||||
|
||||
def nearest_town(ns, ew):
|
||||
if not towns:
|
||||
return None
|
||||
name, tns, tew = min(towns, key=lambda t: (t[1] - ns) ** 2 + (t[2] - ew) ** 2)
|
||||
dist = ((tns - ns) ** 2 + (tew - ew) ** 2) ** 0.5
|
||||
return {'name': name, 'dist': round(dist, 2)} if dist <= TOWN_RADIUS else None
|
||||
|
||||
def position(cell, x, y, z):
|
||||
place = world.place(cell, z)
|
||||
out = {'cell': '%08X' % cell, 'x': r3(x), 'y': r3(y), 'z': r3(z), 'place': place}
|
||||
if place != 'dungeon':
|
||||
ns, ew = g.cell_to_map(cell, x, y)
|
||||
out['ns'], out['ew'] = round(ns, 2), round(ew, 2)
|
||||
return out
|
||||
|
||||
entries, exits = [], []
|
||||
arrivals = {} # (cell, x, y, z) -> arrival dict
|
||||
seen_entries = {}
|
||||
for (guid, wcid, cell, x, y, z, aw, ax, ay, az, name, dcell, dx, dy, dz,
|
||||
minlvl, maxlvl, quest, bitmask, acct, advocate, setup, scale) in rows['tn_portals']:
|
||||
cell, dcell = int(cell), int(dcell)
|
||||
x, y, z, dx, dy, dz = float(x), float(y), float(z), float(dx), float(dy), float(dz)
|
||||
name = (name or 'Portal').strip()
|
||||
rest = restrictions(minlvl, maxlvl, quest, bitmask, acct, advocate)
|
||||
inside, into = lb_of(cell) in lbs, lb_of(dcell) in lbs
|
||||
if inside:
|
||||
dest = position(dcell, dx, dy, dz)
|
||||
town = nearest_town(dest['ns'], dest['ew']) if 'ns' in dest else None
|
||||
if town:
|
||||
dest['town'] = town
|
||||
ex = {'guid': '%08X' % int(guid), 'wcid': int(wcid), 'name': name, 'label': g.dungeon_name(name),
|
||||
'cell': '%08X' % cell, 'x': r3(x), 'y': r3(y), 'z': r3(z),
|
||||
'heading': heading(aw, az), 'dest': dest, 'into': into}
|
||||
if setup is not None:
|
||||
ex['setup'] = '%08X' % int(setup)
|
||||
if scale is not None:
|
||||
ex['scale'] = float(scale)
|
||||
ex.update(rest)
|
||||
exits.append(ex)
|
||||
elif into:
|
||||
key = (dcell, r3(dx), r3(dy), r3(dz))
|
||||
if key not in arrivals:
|
||||
arrivals[key] = {'cell': '%08X' % dcell, 'x': r3(dx), 'y': r3(dy), 'z': r3(dz)}
|
||||
pos = position(cell, x, y, z)
|
||||
dedupe = (int(wcid), pos['cell'], pos['x'], pos['y'], pos['z'])
|
||||
if dedupe in seen_entries: # two placements of one portal at one spot
|
||||
seen_entries[dedupe]['guids'].append('%08X' % int(guid))
|
||||
continue
|
||||
en = {'guid': '%08X' % int(guid), 'guids': ['%08X' % int(guid)], 'wcid': int(wcid), 'name': name, **pos,
|
||||
'arrivalKey': key}
|
||||
town = nearest_town(pos['ns'], pos['ew']) if 'ns' in pos else None
|
||||
if town:
|
||||
en['town'] = town
|
||||
en.update(rest)
|
||||
seen_entries[dedupe] = en
|
||||
entries.append(en)
|
||||
|
||||
# Arrival ids in a stable order (by cell, then position).
|
||||
arr_list = sorted(arrivals.items(), key=lambda kv: kv[0])
|
||||
arr_ids = {}
|
||||
out_arrivals = []
|
||||
for i, (key, a) in enumerate(arr_list, 1):
|
||||
a = dict(id='A%d' % i, **a)
|
||||
a['entries'] = sum(1 for e in entries if e['arrivalKey'] == key)
|
||||
arr_ids[key] = a['id']
|
||||
out_arrivals.append(a)
|
||||
for e in entries:
|
||||
e['arrival'] = arr_ids[e.pop('arrivalKey')]
|
||||
if len(e['guids']) == 1:
|
||||
del e['guids']
|
||||
entries.sort(key=lambda e: (e['name'].lower(), e['cell'], e['x'], e['y']))
|
||||
exits.sort(key=lambda e: (e['cell'], e['name'].lower()))
|
||||
|
||||
npcs = []
|
||||
for guid, wcid, wtype, cell, x, y, z, name, setup in rows['tn_npcs']:
|
||||
cell = int(cell)
|
||||
if lb_of(cell) not in lbs:
|
||||
continue
|
||||
n = {'guid': '%08X' % int(guid), 'wcid': int(wcid), 'name': (name or '').strip(), 'cell': '%08X' % cell,
|
||||
'x': r3(float(x)), 'y': r3(float(y)), 'z': r3(float(z))}
|
||||
if setup is not None:
|
||||
n['setup'] = '%08X' % int(setup)
|
||||
npcs.append(n)
|
||||
|
||||
notes = []
|
||||
if found != lbs:
|
||||
notes.append('landblocks given with --lb (%s); the Town Network portals lead to %s'
|
||||
% (', '.join('%04X' % l for l in lbs), ', '.join('%04X' % l for l in found) or 'none'))
|
||||
for a in out_arrivals:
|
||||
if a['entries'] == 0:
|
||||
notes.append('arrival %s has no entry portal' % a['id'])
|
||||
return {'landblocks': ['%04X' % l for l in lbs], 'arrivals': out_arrivals, 'entries': entries,
|
||||
'exits': exits, 'npcs': npcs, 'notes': notes, 'townNetworkWeenies': [w for w, _, _ in named]}
|
||||
|
||||
|
||||
def heading(w, z):
|
||||
"""Compass heading (degrees, 0 = north, clockwise) of a yaw-only rotation, or None."""
|
||||
if w is None or z is None:
|
||||
return None
|
||||
import math
|
||||
yaw = 2.0 * math.atan2(float(z), float(w)) # counter-clockwise from +y (north) in AC
|
||||
return round((-math.degrees(yaw)) % 360.0, 1)
|
||||
|
||||
|
||||
def set_id(text):
|
||||
"""The set id: SHA-256 of the file text without its "setId" and "generated" lines (and without
|
||||
carriage returns, so a CRLF checkout gives the same id), first 16 hex digits. RynthNav.TownNet
|
||||
computes it the same way. Equal ids mean equal data."""
|
||||
kept = [l.rstrip('\r') for l in text.split('\n') if not l.startswith(' "setId":') and not l.startswith(' "generated":')]
|
||||
return hashlib.sha256('\n'.join(kept).encode('utf-8')).hexdigest()[:16]
|
||||
|
||||
|
||||
def serialize(doc):
|
||||
"""One item per line (small diffs when the world changes); RynthNav.TownNet writes the same layout."""
|
||||
keys = ['version', 'setId', 'generated', 'source', 'landblocks', 'counts', 'notes', 'walkInfo']
|
||||
lists = ['arrivals', 'entries', 'exits', 'npcs', 'walks']
|
||||
items = [k for k in keys if k in doc] + [k for k in lists if k in doc] + \
|
||||
[k for k in doc if k not in keys and k not in lists]
|
||||
out = ['{\n']
|
||||
for i, k in enumerate(items):
|
||||
last = i == len(items) - 1
|
||||
v = doc[k]
|
||||
if k in lists:
|
||||
out.append(' %s: [\n' % json.dumps(k))
|
||||
for j, item in enumerate(v):
|
||||
out.append(' ' + json.dumps(item, ensure_ascii=False, separators=(',', ':')) +
|
||||
(',' if j < len(v) - 1 else '') + '\n')
|
||||
out.append(' ]%s\n' % ('' if last else ','))
|
||||
else:
|
||||
out.append(' %s: %s%s\n' % (json.dumps(k), json.dumps(v, ensure_ascii=False), '' if last else ','))
|
||||
out.append('}\n')
|
||||
return ''.join(out)
|
||||
|
||||
|
||||
def write(path, doc):
|
||||
doc['setId'] = ''
|
||||
doc['setId'] = set_id(serialize(doc))
|
||||
with open(path, 'w', encoding='utf-8', newline='\n') as f:
|
||||
f.write(serialize(doc))
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument('--out', required=True, help='output folder for townnet.json')
|
||||
ap.add_argument('--host', default='aelrynth-vps')
|
||||
ap.add_argument('--db', default='aeshnidae_world')
|
||||
ap.add_argument('--dump', help='also save the raw query results here')
|
||||
ap.add_argument('--from-dump', help='read the raw query results from here instead of the server')
|
||||
ap.add_argument('--lb', help='the network landblocks, hex, comma separated (default: found from the portals)')
|
||||
args = ap.parse_args(argv)
|
||||
|
||||
rows = fetch(args)
|
||||
lbs = [int(s, 16) for s in args.lb.split(',')] if args.lb else None
|
||||
net = build(rows, lbs)
|
||||
doc = {
|
||||
'version': FORMAT_VERSION,
|
||||
'setId': '',
|
||||
'generated': datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'),
|
||||
'source': args.db,
|
||||
'landblocks': net['landblocks'],
|
||||
'counts': {'arrivals': len(net['arrivals']), 'entries': len(net['entries']), 'exits': len(net['exits']),
|
||||
'npcs': len(net['npcs'])},
|
||||
'notes': net['notes'],
|
||||
'arrivals': net['arrivals'], 'entries': net['entries'], 'exits': net['exits'], 'npcs': net['npcs'],
|
||||
}
|
||||
os.makedirs(args.out, exist_ok=True)
|
||||
path = os.path.join(args.out, 'townnet.json')
|
||||
write(path, doc)
|
||||
print('Town Network landblocks: %s (portals named Town Network: weenies %s)'
|
||||
% (', '.join(net['landblocks']), ', '.join(map(str, net['townNetworkWeenies']))))
|
||||
print('arrivals %d, entry portals %d, exit portals %d, npcs %d'
|
||||
% (len(net['arrivals']), len(net['entries']), len(net['exits']), len(net['npcs'])))
|
||||
restricted = [e for e in net['entries'] + net['exits']
|
||||
if any(k in e for k in ('minLevel', 'maxLevel', 'quest', 'closed', 'onlyOlthoi', 'noPk', 'noNpk'))]
|
||||
for e in restricted:
|
||||
print(' restricted: %s (%s)' % (e['name'], ', '.join('%s=%s' % (k, e[k]) for k in
|
||||
('minLevel', 'maxLevel', 'quest', 'closed', 'onlyOlthoi', 'noPk', 'noNpk') if k in e)))
|
||||
for n in net['notes']:
|
||||
print(' note: ' + n)
|
||||
print('wrote %s (set %s); the walks inside come from RynthNav.TownNet build' % (path, doc['setId']))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
191
tools/navdata/test_gen_locations.py
Normal file
191
tools/navdata/test_gen_locations.py
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
"""Offline tests for gen_locations.py: the coordinate conversion (checked with
|
||||
towns whose map coordinates every player knows), the place classification,
|
||||
and a small fake world through build(). No server needed.
|
||||
|
||||
Run: python tools/navdata/test_gen_locations.py
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import gen_locations as g # noqa: E402
|
||||
|
||||
|
||||
class CoordinateTests(unittest.TestCase):
|
||||
def check(self, cell, x, y, ns, ew):
|
||||
got_ns, got_ew = g.cell_to_map(cell, x, y)
|
||||
self.assertAlmostEqual(got_ns, ns, delta=0.051, msg='NS of %08X' % cell)
|
||||
self.assertAlmostEqual(got_ew, ew, delta=0.051, msg='EW of %08X' % cell)
|
||||
|
||||
def test_known_towns(self):
|
||||
# The towns' drop points (the server's points_of_interest) against their
|
||||
# well-known map coordinates.
|
||||
self.check(0xA9B40019, 84.0, 7.1, 42.1, 33.6) # Holtburg 42.1N 33.6E
|
||||
self.check(0x7D64000D, 31.9, 104.6, -21.5, -1.8) # Yaraq 21.5S 1.8W
|
||||
self.check(0xDA55001D, 84.8, 99.0, -33.5, 72.8) # Shoushi 33.5S 72.8E
|
||||
|
||||
def test_landblock_corners(self):
|
||||
# The map's centre line: landblock 0x7F7F at x = y = 84 is 0.0, 0.0 ... 0x7F*8 = 1016,
|
||||
# 1016 + 84/24 = 1019.5.
|
||||
self.check(0x7F7F0001, 84.0, 84.0, 0.0, 0.0)
|
||||
# The south-west corner of the world.
|
||||
self.check(0x00000001, 0.0, 0.0, -101.95, -101.95)
|
||||
|
||||
def test_format(self):
|
||||
self.assertEqual(g.fmt_coord(42.08, 33.6), '42.1N, 33.6E')
|
||||
self.assertEqual(g.fmt_coord(-21.51, -1.82), '21.5S, 1.8W')
|
||||
|
||||
def test_outdoor_cell(self):
|
||||
self.assertTrue(g.is_outdoor_cell(0xA9B40019))
|
||||
self.assertTrue(g.is_outdoor_cell(0x828E0000))
|
||||
self.assertFalse(g.is_outdoor_cell(0xA9B40100))
|
||||
self.assertFalse(g.is_outdoor_cell(0x016C01BC))
|
||||
|
||||
|
||||
class PlaceTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
# Landblock A9B4 has outdoor objects whose lowest stands at z 40.
|
||||
self.world = g.World([(0xA9B4, 40.0, 60.0, 12)])
|
||||
|
||||
def test_places(self):
|
||||
w = self.world
|
||||
self.assertEqual(w.place(0xA9B40019, 42.0), 'outdoor')
|
||||
self.assertEqual(w.place(0xA9B40105, 41.0), 'building')
|
||||
self.assertEqual(w.place(0xA9B40105, 10.0), 'underground')
|
||||
self.assertEqual(w.place(0x016C01BC, 0.0), 'dungeon')
|
||||
self.assertTrue(w.is_surface(0xA9B40105, 41.0))
|
||||
self.assertFalse(w.is_surface(0x016C01BC, 0.0))
|
||||
|
||||
def test_dungeon_names(self):
|
||||
self.assertEqual(g.dungeon_name('Portal to Mines of Despair'), 'Mines of Despair')
|
||||
self.assertEqual(g.dungeon_name('Mines of Despair Portal'), 'Mines of Despair')
|
||||
self.assertEqual(g.dungeon_name('Four Towers Entrance'), 'Four Towers')
|
||||
self.assertEqual(g.dungeon_name('Portal'), 'Portal')
|
||||
|
||||
def test_unescape(self):
|
||||
self.assertIsNone(g.unescape('NULL'))
|
||||
self.assertEqual(g.unescape('a\\tb\\nc\\\\d'), 'a\tb\nc\\d')
|
||||
|
||||
|
||||
def fake_rows():
|
||||
"""A tiny world: Holtburg and Yaraq with portals both ways, a dungeon under
|
||||
a portal near Holtburg, a lifestone, a vendor, an NPC and a monster."""
|
||||
def t(*v):
|
||||
return [None if x is None else str(x) for x in v]
|
||||
return {
|
||||
'surface': [t(0xA9B4, 40.0, 60.0, 10), t(0x7D64, 5.0, 9.0, 10), t(0xA9B3, 30.0, 50.0, 3)],
|
||||
'poi': [t('Holtburg', 42820, 0xA9B40019, 84.0, 7.1, 42.0), t('Yaraq', 42824, 0x7D64000D, 31.9, 104.6, 6.0),
|
||||
t('Marketplace', 23032, 0x016C01BC, 49.2, -31.9, 0.0)],
|
||||
'portals': [
|
||||
# guid wcid cell x y z name dcell dx dy dz minlvl maxlvl quest desc bitmask
|
||||
t(1, 100, 0xA9B40020, 90.0, 20.0, 42.0, 'Yaraq Portal', 0x7D64000D, 31.9, 104.6, 6.0, None, None, None, None, 1),
|
||||
t(2, 101, 0x7D640010, 40.0, 100.0, 6.0, 'Holtburg Portal', 0xA9B40019, 84.0, 7.1, 42.0, None, None, None, None, 1),
|
||||
t(3, 102, 0xA9B30005, 30.0, 30.0, 31.0, 'Portal to Glimmering Cave', 0x01AB0100, 10.0, -10.0, 0.0, 12, None, None,
|
||||
'A cave.', 1),
|
||||
t(4, 103, 0x01AB0105, 12.0, -12.0, 0.0, 'Holtburg', 0xA9B40019, 84.0, 7.1, 42.0, None, None, None, None, 1),
|
||||
t(5, 104, 0xA9B40021, 95.0, 25.0, 42.0, 'Quest Portal', 0x7D64000D, 31.9, 104.6, 6.0, None, None, 'flag', None, 1),
|
||||
t(6, 105, 0xA9B40022, 96.0, 26.0, 42.0, 'Sealed Portal', 0x7D64000D, 31.9, 104.6, 6.0, None, None, None, None, 0),
|
||||
t(7, 100, 0xA9B40020, 90.0, 20.0, 42.0, 'Yaraq Portal', 0x7D64000D, 31.9, 104.6, 6.0, None, None, None, None, 1),
|
||||
],
|
||||
'places': [
|
||||
# guid wcid wtype cell x y z name template attackable
|
||||
t(10, 509, 25, 0xA9B40018, 80.0, 10.0, 42.0, 'Life Stone', None, None),
|
||||
t(11, 600, 12, 0xA9B40150, 70.0, 30.0, 44.0, 'Shopkeeper Renald', 'Shopkeeper', None),
|
||||
t(12, 601, 10, 0xA9B4001A, 60.0, 40.0, 42.0, 'Town Crier', 'Herald', 0),
|
||||
t(13, 602, 10, 0xA9B4001B, 61.0, 41.0, 42.0, 'Drudge Skulker', None, 1),
|
||||
t(14, 603, 10, 0xA9B4001C, 62.0, 42.0, 42.0, 'Invisible Event Controller', None, 0),
|
||||
t(15, 604, 10, 0x01AB0110, 20.0, -20.0, 0.0, 'Cave Hermit', None, 0),
|
||||
],
|
||||
'recalls': [
|
||||
t(2041, 'Aerlinthe Recall', 0xBAE8001D, 84.0, 105.0, 26.0),
|
||||
t(4907, 'Celestial Hand Stronghold Recall', 0x016002A5, 80.0, -160.0, 0.0),
|
||||
t(4213, 'Colosseum Recall', 0x00AF0118, 40.0, -13.2, 0.0),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
class BuildTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.locs, self.recalls, self.route = g.build(fake_rows())
|
||||
self.by_name = {}
|
||||
for l in self.locs:
|
||||
self.by_name.setdefault((l['type'], l['name']), l)
|
||||
|
||||
def test_towns(self):
|
||||
h = self.by_name[('Town', 'Holtburg')]
|
||||
self.assertAlmostEqual(h['ns'], 42.08, delta=0.01)
|
||||
self.assertAlmostEqual(h['ew'], 33.6, delta=0.01)
|
||||
m = self.by_name[('Landmark', 'Marketplace')]
|
||||
self.assertNotIn('ns', m) # a dungeon: no map position
|
||||
|
||||
def test_portals_and_dungeons(self):
|
||||
p = self.by_name[('Portal', 'Yaraq Portal')]
|
||||
self.assertEqual(p['dest']['place'], 'outdoor')
|
||||
self.assertEqual(sum(1 for l in self.locs if l['name'] == 'Yaraq Portal'), 1) # duplicate dropped
|
||||
d = self.by_name[('Dungeon', 'Glimmering Cave')]
|
||||
self.assertEqual(d['lb'], '01AB')
|
||||
self.assertEqual(d['minLevel'], 12)
|
||||
cave = self.by_name[('Portal', 'Portal to Glimmering Cave')]
|
||||
self.assertEqual(cave['dest']['name'], 'Glimmering Cave')
|
||||
exit_ = self.by_name[('Portal', 'Holtburg')]
|
||||
self.assertNotIn('ns', exit_)
|
||||
self.assertIn('Glimmering Cave', exit_['desc'])
|
||||
self.assertTrue(self.by_name[('Portal', 'Quest Portal')]['quest'])
|
||||
self.assertTrue(self.by_name[('Portal', 'Sealed Portal')]['closed'])
|
||||
|
||||
def test_places(self):
|
||||
self.assertIn(('Lifestone', 'Life Stone'), self.by_name)
|
||||
v = self.by_name[('Vendor', 'Shopkeeper Renald')]
|
||||
self.assertEqual(v['place'], 'building')
|
||||
self.assertNotIn(('NPC', 'Drudge Skulker'), self.by_name) # attackable: a monster
|
||||
self.assertNotIn(('NPC', 'Invisible Event Controller'), self.by_name) # not a person
|
||||
self.assertEqual(self.by_name[('NPC', 'Town Crier')]['desc'], 'Herald.')
|
||||
self.assertIn('Glimmering Cave', self.by_name[('NPC', 'Cave Hermit')]['desc'])
|
||||
|
||||
def test_recalls(self):
|
||||
spells = {r['spell']: r for r in self.recalls}
|
||||
self.assertIn(2041, spells)
|
||||
self.assertNotIn(4907, spells) # placeholder destination
|
||||
self.assertEqual(spells[4213]['place'], 'dungeon')
|
||||
self.assertAlmostEqual(spells[2041]['ns'], 84.09, delta=0.01)
|
||||
|
||||
def test_routing_list(self):
|
||||
names = [r[4] for r in self.route]
|
||||
# Surface to surface only; no quest-locked, closed, dungeon or duplicate portals.
|
||||
self.assertEqual(sorted(names), ['Holtburg Portal', 'Yaraq Portal'])
|
||||
y = [r for r in self.route if r[4] == 'Yaraq Portal'][0]
|
||||
self.assertAlmostEqual(y[2], -21.51, delta=0.01)
|
||||
self.assertAlmostEqual(y[3], -1.82, delta=0.01)
|
||||
|
||||
def test_outputs(self):
|
||||
import tempfile
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
g.write_outputs(d, self.locs, self.recalls, self.route, 'test')
|
||||
doc = json.load(open(os.path.join(d, 'locations.json'), encoding='utf-8'))
|
||||
self.assertEqual(doc['version'], 1)
|
||||
self.assertEqual(len(doc['locations']), len(self.locs))
|
||||
lines = open(os.path.join(d, 'portals.tsv'), encoding='utf-8').read().splitlines()
|
||||
self.assertEqual(len(lines), 2)
|
||||
self.assertEqual(len(lines[0].split('\t')), 5)
|
||||
|
||||
|
||||
class GeneratedDataTests(unittest.TestCase):
|
||||
"""Checks the committed output (tools/navdata/NavData), when it is there."""
|
||||
PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'NavData', 'locations.json')
|
||||
|
||||
def test_known_towns_in_data(self):
|
||||
if not os.path.exists(self.PATH):
|
||||
self.skipTest('no generated locations.json')
|
||||
doc = json.load(open(self.PATH, encoding='utf-8'))
|
||||
towns = {l['name']: l for l in doc['locations'] if l['type'] == 'Town'}
|
||||
for name, ns, ew in (('Holtburg', 42.1, 33.6), ('Yaraq', -21.5, -1.8), ('Shoushi', -33.5, 72.8)):
|
||||
self.assertIn(name, towns)
|
||||
self.assertAlmostEqual(towns[name]['ns'], ns, delta=0.1, msg=name)
|
||||
self.assertAlmostEqual(towns[name]['ew'], ew, delta=0.1, msg=name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=1)
|
||||
139
tools/navdata/test_gen_townnet.py
Normal file
139
tools/navdata/test_gen_townnet.py
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
"""Offline tests for gen_townnet.py: a small made-up world through build(), the
|
||||
restriction fields, and the file's set id. No server needed.
|
||||
|
||||
Run: python tools/navdata/test_gen_townnet.py
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import gen_townnet as t # noqa: E402
|
||||
|
||||
TN = 0x0007
|
||||
HOLT = 0xA9B4
|
||||
|
||||
|
||||
def portal(guid, wcid, cell, x, y, z, name, dcell, dx, dy, dz, minlvl=None, maxlvl=None, quest=None,
|
||||
bitmask='1', acct=None, advocate=None, setup='33554867', scale=None):
|
||||
"""A row of the tn_portals query, as parse_rows returns it (strings, None for NULL)."""
|
||||
s = lambda v: None if v is None else str(v) # noqa: E731
|
||||
return [str(guid), str(wcid), str(cell), s(x), s(y), s(z), '1', '0', '0', '0', name,
|
||||
str(dcell), s(dx), s(dy), s(dz), s(minlvl), s(maxlvl), quest, s(bitmask), s(acct), s(advocate), setup, s(scale)]
|
||||
|
||||
|
||||
def world_rows():
|
||||
return {
|
||||
'tn_weenies': [['42852', 'Portal to Town Network', str((TN << 16) | 0x0145)],
|
||||
['30000', 'Some Other Portal', str((0x0123 << 16) | 0x0100)]],
|
||||
'tn_portals': [
|
||||
# Two entries outdoors in Holtburg landing at one arrival point, one placed twice.
|
||||
portal(0x7A9B4001, 42852, (HOLT << 16) | 0x0019, 84.0, 9.0, 94.2, 'Portal to Town Network',
|
||||
(TN << 16) | 0x0145, 70.0, -80.0, 0.005, bitmask='129'),
|
||||
portal(0x7A9B4002, 42852, (HOLT << 16) | 0x0019, 84.0, 9.0, 94.2, 'Portal to Town Network',
|
||||
(TN << 16) | 0x0145, 70.0, -80.0, 0.005, bitmask='129'),
|
||||
# A custom entry with a different name, landing elsewhere inside.
|
||||
portal(0x7A9B4003, 99001, (HOLT << 16) | 0x0020, 90.0, 20.0, 94.2, 'Aelrynth Gate',
|
||||
(TN << 16) | 0x0143, 70.0, -60.0, 0.005),
|
||||
# Exits inside: an open one, a level-gated one, a quest one, a closed one.
|
||||
portal(0x70007028, 42820, (TN << 16) | 0x0124, 53.91, -39.95, -0.063, 'Portal to Holtburg',
|
||||
(HOLT << 16) | 0x0019, 84.0, 7.1, 94.0),
|
||||
portal(0x70007084, 42839, (TN << 16) | 0x016B, 86.51, -170.05, -0.063, 'Portal to Eastwatch',
|
||||
(0x49F0 << 16) | 0x0013, 70.0, 70.0, 170.0, minlvl=80),
|
||||
portal(0x70007090, 50001, (TN << 16) | 0x0171, 110.0, -53.37, -0.063, 'Secret Portal',
|
||||
(HOLT << 16) | 0x0019, 84.0, 7.1, 94.0, quest='SecretFlag', acct=1),
|
||||
portal(0x70007091, 50002, (TN << 16) | 0x0172, 110.0, -60.0, -0.063, 'Shut Portal',
|
||||
(HOLT << 16) | 0x0019, 84.0, 7.1, 94.0, bitmask='0'),
|
||||
# A portal elsewhere that has nothing to do with the network.
|
||||
portal(0x7A9B4009, 30001, (HOLT << 16) | 0x0021, 10.0, 10.0, 94.0, 'Portal to Somewhere',
|
||||
(0x0123 << 16) | 0x0100, 1.0, 1.0, 0.0),
|
||||
],
|
||||
'tn_npcs': [['1879076865', '42799', '12', str((TN << 16) | 0x0200), '10.0', '-20.0', '12.0', 'Barkeeper', '33554510'],
|
||||
['1879076866', '1', '10', str((HOLT << 16) | 0x0100), '1.0', '1.0', '1.0', 'Elsewhere', None]],
|
||||
'poi': [['Holtburg', '42820', str((HOLT << 16) | 0x0019), '84.0', '7.1', '94.0']],
|
||||
'surface': [[str(HOLT), '90.0', '100.0', '40']],
|
||||
}
|
||||
|
||||
|
||||
class BuildTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.net = t.build(world_rows())
|
||||
|
||||
def test_landblocks_from_portal_names(self):
|
||||
self.assertEqual(self.net['landblocks'], ['0007'])
|
||||
|
||||
def test_arrivals(self):
|
||||
arr = self.net['arrivals']
|
||||
self.assertEqual([a['id'] for a in arr], ['A1', 'A2'])
|
||||
self.assertEqual(arr[0]['cell'], '00070143') # sorted by cell
|
||||
self.assertEqual(arr[1]['entries'], 1) # the doubled portal counts once
|
||||
|
||||
def test_entries(self):
|
||||
en = self.net['entries']
|
||||
self.assertEqual(len(en), 2)
|
||||
holt = [e for e in en if e['name'] == 'Portal to Town Network'][0]
|
||||
self.assertEqual(holt['guids'], ['7A9B4001', '7A9B4002'])
|
||||
self.assertEqual(holt['arrival'], 'A2')
|
||||
self.assertEqual(holt['place'], 'outdoor')
|
||||
self.assertEqual(holt['town']['name'], 'Holtburg')
|
||||
self.assertTrue(holt['noOlthoi'])
|
||||
custom = [e for e in en if e['name'] == 'Aelrynth Gate'][0]
|
||||
self.assertEqual(custom['arrival'], 'A1')
|
||||
self.assertNotIn('guids', custom)
|
||||
|
||||
def test_exits_and_restrictions(self):
|
||||
ex = {e['name']: e for e in self.net['exits']}
|
||||
self.assertEqual(len(ex), 4)
|
||||
self.assertEqual(ex['Portal to Holtburg']['label'], 'Holtburg')
|
||||
self.assertEqual(ex['Portal to Holtburg']['dest']['town']['name'], 'Holtburg')
|
||||
self.assertNotIn('minLevel', ex['Portal to Holtburg'])
|
||||
self.assertEqual(ex['Portal to Eastwatch']['minLevel'], 80)
|
||||
self.assertNotIn('town', ex['Portal to Eastwatch']['dest']) # no town that close
|
||||
self.assertEqual(ex['Secret Portal']['quest'], 'SecretFlag')
|
||||
self.assertEqual(ex['Secret Portal']['accountRequirements'], 1)
|
||||
self.assertTrue(ex['Shut Portal']['closed'])
|
||||
self.assertEqual(ex['Portal to Holtburg']['setup'], '020001B3')
|
||||
|
||||
def test_npcs_inside_only(self):
|
||||
self.assertEqual([n['name'] for n in self.net['npcs']], ['Barkeeper'])
|
||||
|
||||
def test_lb_override_is_noted(self):
|
||||
net = t.build(world_rows(), [0x0007, 0x0008])
|
||||
self.assertEqual(net['landblocks'], ['0007', '0008'])
|
||||
self.assertTrue(any('--lb' in n for n in net['notes']))
|
||||
|
||||
|
||||
def read(path):
|
||||
with open(path, encoding='utf-8') as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
class FileTests(unittest.TestCase):
|
||||
def test_set_id_ignores_timestamp(self):
|
||||
doc = {'version': 1, 'setId': '', 'generated': 'a', 'arrivals': [{'id': 'A1'}]}
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
p = os.path.join(d, 'townnet.json')
|
||||
t.write(p, dict(doc))
|
||||
first = json.loads(read(p))['setId']
|
||||
t.write(p, dict(doc, generated='b'))
|
||||
second = json.loads(read(p))['setId']
|
||||
t.write(p, dict(doc, arrivals=[{'id': 'A2'}]))
|
||||
third = json.loads(read(p))['setId']
|
||||
text = read(p)
|
||||
self.assertEqual(first, second)
|
||||
self.assertNotEqual(first, third)
|
||||
self.assertEqual(len(first), 16)
|
||||
self.assertIn(' {"id":"A2"}\n', text)
|
||||
self.assertEqual(t.set_id(text), json.loads(text)['setId'])
|
||||
self.assertEqual(t.set_id(text.replace('\n', '\r\n')), json.loads(text)['setId']) # a CRLF checkout
|
||||
|
||||
def test_heading(self):
|
||||
self.assertEqual(t.heading('1', '0'), 0.0)
|
||||
self.assertEqual(t.heading('0.70710678', '-0.70710678'), 90.0) # yaw -90 = facing east
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
@ -165,6 +165,11 @@ GROUPS = {
|
|||
"TimeSyncHooks": [
|
||||
("ClientNet_HandleTimeSynch", 0x005448F0),
|
||||
],
|
||||
"PlayerTrade": [
|
||||
("Event_OpenTradeNegotiations", 0x006AE260), ("Event_AddToTrade", 0x006AE030),
|
||||
("Event_ResetTrade", 0x006AE330), ("Event_CloseTradeNegotiations", 0x006AE140),
|
||||
("ClientTradeSystem_AcceptTrade", 0x0056E7A0), ("ClientTradeSystem_DeclineTrade", 0x0056E7C0),
|
||||
],
|
||||
}
|
||||
|
||||
def best_pattern(text_b, text_base, va, off):
|
||||
|
|
@ -188,6 +193,7 @@ GROUPS_DATA = [
|
|||
("s_selected_id", 0x00871E54), ("s_previous_selected_id", 0x00871E58),
|
||||
("split_amount", 0x0081D7EC), ("total_stack", 0x0081D7F0),
|
||||
("PStringChar_s_NullBuffer", 0x008EF11C), ("PStringWide_s_NullBuffer", 0x00818340),
|
||||
("ClientTradeSystem_s_pTradeSystem", 0x0087174C),
|
||||
("RecvFrom_slot", 0x007935AC),
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue