diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiCommands.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiCommands.cs
index 8becd87..0bcec58 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiCommands.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiCommands.cs
@@ -2805,6 +2805,28 @@ public sealed partial class RynthAiPlugin
private void HandleDungeonNavPatrolCommand(string[] parts) => HandleDungeonNavPatrol();
+ /// Takes the auto-generated patrol off the character: no patrol route, navigation off.
+ private void StopPatrolForServer()
+ {
+ _dunPatrolActive = false;
+ var s = _dashboard?.Settings;
+ if (s == null) return;
+ s.EnableNavigation = false;
+ s.CurrentRoute = new NavRouteParser();
+ _navigationEngine?.Stop();
+ }
+
+ /// DreamWeave's Thread lines in chat ("The Thread Gem opens a way into ...", "[REALM] ... eph=1"):
+ /// where the character is, for ServerPolicy. Logged when it changes.
+ private void NoteServerPolicyChat(string text)
+ {
+ bool was = ServerPolicy.Run != null;
+ uint cell = Host.HasGetPlayerPose && Host.TryGetPlayerPose(out uint c, out _, out _, out _, out _, out _, out _, out _) ? c : 0;
+ if (!ServerPolicy.NoteChat(text, cell)) return;
+ bool now = ServerPolicy.Run != null;
+ if (now != was) Host.Log(now ? "[RynthAi] ServerPolicy: in a Thread (the server says so)." : "[RynthAi] ServerPolicy: out of the Thread.");
+ }
+
///
/// Builds a Circular hunt patrol covering every cell in the current dungeon landblock.
/// Called from both /ra dunnav-patrol and the NavPanel "Dungeon Patrol" button.
@@ -2851,6 +2873,14 @@ public sealed partial class RynthAiPlugin
private void BuildDunPatrol(bool isRebuild, bool settingsChanged = false)
{
+ // The one way into the dungeon patrol (the command, the dashboard button, a meta's "Patrol", the hazard
+ // reroute): where a server's owners asked for it to be off (a Thread on DreamWeave) nothing is built (ServerPolicy).
+ if (ServerPolicy.PatrolOff(Host))
+ {
+ if (_dunPatrolActive) StopPatrolForServer();
+ if (!isRebuild) ChatLine(ServerPolicy.PatrolOffMessage);
+ return;
+ }
var settings = _dashboard?.Settings;
if (settings == null) { if (!isRebuild) ChatLine("[RynthAi] Settings not ready."); return; }
var patrolOptions = PatrolOptionsFrom(settings);
@@ -3033,6 +3063,9 @@ public sealed partial class RynthAiPlugin
private void TickDunPatrolHazardReroute()
{
if (!_dunPatrolActive) return;
+ // A patrol running when the character enters a Thread on DreamWeave (or one that began before the world name
+ // was known): stopped the moment it is (ServerPolicy).
+ if (ServerPolicy.PatrolOff(Host)) { StopPatrolForServer(); ChatLine(ServerPolicy.PatrolOffMessage); return; }
if (_objectCache == null) return;
var settings = _dashboard?.Settings;
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs
index cb3c181..d8d496f 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs
@@ -297,6 +297,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
Loot.T11ItemSupport.Reset();
// A real logout: the next OnLoginComplete is a fresh login, not a hot reload.
ClearInGameMarker();
+ ServerPolicy.Forget(); // the next login's [REALM] line says whether the character is in a Thread
TeardownSession();
}
@@ -2285,6 +2286,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
public override void OnChatWindowText(string? text, int chatType, ref int eat)
{
if (string.IsNullOrEmpty(text)) return;
+ try { NoteServerPolicyChat(text); } catch { } // DreamWeave's Thread lines (ServerPolicy)
try { NoteDoorServerText(text); } catch { } // "The door is locked!" (the door logic)
try { _sessionStats?.OnChatWindowText(text); } catch (Exception ex) { RynthLog.Exception(LogCat.Huds, ex, "session stats chat"); }
// The Meta Manager eats the reply to its own /myquests poll (only that).
diff --git a/Plugins/RynthCore.Plugin.RynthAi/ServerPolicy.cs b/Plugins/RynthCore.Plugin.RynthAi/ServerPolicy.cs
new file mode 100644
index 0000000..f1fd14e
--- /dev/null
+++ b/Plugins/RynthCore.Plugin.RynthAi/ServerPolicy.cs
@@ -0,0 +1,161 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Text.RegularExpressions;
+using RynthCore.PluginSdk;
+
+namespace RynthCore.Plugin.RynthAi;
+
+///
+/// Features a server's owners have asked us to keep off in part of their server (and only there). The server is
+/// told apart by its world name, as RynthThreads tells DreamWeave: a world-name substring, any case, so
+/// "DreamWeave PvE" counts too. Every other server is untouched.
+///
+/// DreamWeave's owner asked (2026-10-15) for the dungeon patrol (/ra dunnav-patrol, the dashboard's Patrol
+/// button, a meta's Embedded Nav Route "Patrol") to be off in Threads. A Thread is DreamWeave's private,
+/// single-use copy of a retail dungeon, opened by using a Thread Gem (made at the Fragment Press in the Drift
+/// Network hall; wiki.acdreamweave.com/index.php/Threads). 24 retail dungeons are in its rotation and the same
+/// dungeons can still be walked outside a Thread, so the rule follows the Thread run, not a landblock list.
+/// Everywhere else on DreamWeave the patrol works as before, and nothing else changes in a Thread: recorded nav
+/// routes, going to a dungeon cell (dunnav) and the rest work as they always did. The patrol is built in one
+/// place (BuildDunPatrol), which asks here first.
+///
+/// How a client knows it is in a Thread, from DreamWeave's own chat (our clients' logs, 2026-10-07..10-15):
+/// "The Thread Gem opens a way into Watery Grotto. It will bring you back 5 more time(s) ..."
+/// just before the teleport into the Thread: a run starts; its landblock is the first one the character
+/// stands in after leaving the one the gem was used in.
+/// "[REALM] id=0 inst=7841 eph=1 name=Base World"
+/// after every login and every teleport. eph=1 is an ephemeral instance: it came after every Thread entry
+/// (20 entries into 14 dungeons) and nowhere else, so it counts as being in a Thread; eph=0 is the shared
+/// world (the hub, the Marketplace, a retail dungeon outside a Thread) and ends the run.
+/// Leaving the run's landblock also ends it, so a run stays scoped to its dungeon even if the [REALM] line is
+/// missing. The state is kept in a process-wide environment variable, so a plugin reloaded inside a Thread
+/// still knows; a logout forgets it (the next login's [REALM] line says where the character is).
+///
+/// A world name the client can't give yet counts as "not listed": the check is repeated while a patrol
+/// runs, so one that is running when the character enters a Thread is stood down at once.
+///
+internal static class ServerPolicy
+{
+ /// World-name fragments of the servers whose owners asked for the dungeon patrol to be off in Threads.
+ private static readonly string[] PatrolOffInThreadsServers = { "DreamWeave" };
+
+ /// DreamWeave's line just before the teleport into a Thread (a server line starts with it).
+ private const string ThreadGemOpensLine = "The Thread Gem opens a way into ";
+
+ /// DreamWeave's line after each login and teleport: "[REALM] id=0 inst=7841 eph=1 name=Base World".
+ private static readonly Regex RealmLine = new(@"^\s*\[REALM\][^\r\n]*?\beph=([01])\b", RegexOptions.CultureInvariant);
+
+ private const string ThreadVar = "RYNTHAI_THREAD_RUN";
+
+ public const string PatrolOffMessage = "[RynthAi] The dungeon patrol is turned off in Threads on DreamWeave (its owners asked for that).";
+
+ /// A Thread run: the dungeon landblock it is in (0 = not known yet) and the landblock the gem was
+ /// used in (0 = none: the run was learned from a [REALM] line).
+ internal readonly record struct ThreadRun(uint Landblock, uint FromLandblock);
+
+ /// True when (the server's world name) keeps the dungeon patrol off in Threads.
+ internal static bool PatrolOffInThreadsOn(string? world) =>
+ !string.IsNullOrWhiteSpace(world)
+ && PatrolOffInThreadsServers.Any(s => world.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0);
+
+ // ── The run, kept across a plugin reload ─────────────────────────────────────────────────
+
+ private static string Pid => Environment.ProcessId.ToString(CultureInfo.InvariantCulture);
+
+ /// The Thread run the character is in, or null.
+ internal static ThreadRun? Run
+ {
+ get
+ {
+ try
+ {
+ string? v = Environment.GetEnvironmentVariable(ThreadVar);
+ if (string.IsNullOrEmpty(v)) return null;
+ string[] p = v.Split(':');
+ if (p.Length != 3 || p[0] != Pid) return null;
+ return new ThreadRun(uint.Parse(p[1], NumberStyles.HexNumber, CultureInfo.InvariantCulture),
+ uint.Parse(p[2], NumberStyles.HexNumber, CultureInfo.InvariantCulture));
+ }
+ catch { return null; }
+ }
+ private set
+ {
+ try
+ {
+ Environment.SetEnvironmentVariable(ThreadVar,
+ value is { } r ? $"{Pid}:{r.Landblock:X4}:{r.FromLandblock:X4}" : null);
+ }
+ catch { }
+ }
+ }
+
+ /// The dungeon landblock of , or 0 outdoors / unknown.
+ private static uint DungeonLandblock(uint cell) => cell != 0 && (cell & 0xFFFF) >= 0x0100 ? cell >> 16 : 0;
+
+ ///
+ /// Reads one chat message for DreamWeave's Thread lines; is the character's cell now
+ /// (0 = unknown). Returns true when it was one. Any server's chat may come here; only DreamWeave sends these
+ /// lines, and asks the world name as well.
+ ///
+ internal static bool NoteChat(string? text, uint cell)
+ {
+ if (string.IsNullOrEmpty(text)) return false;
+ string t = text.TrimStart();
+ if (t.StartsWith(ThreadGemOpensLine, StringComparison.Ordinal))
+ {
+ // The teleport follows: the run's landblock is the next one the character stands in.
+ uint from = cell != 0 ? cell >> 16 : 0;
+ Run = new ThreadRun(0, from == 0 ? 0xFFFFFFFFu : from);
+ return true;
+ }
+ if (!t.StartsWith("[REALM]", StringComparison.Ordinal)) return false;
+ var m = RealmLine.Match(t);
+ if (!m.Success) return false;
+ if (m.Groups[1].Value == "1")
+ {
+ // After the teleport's LoginComplete: the character stands in the Thread's landblock already.
+ Run = new ThreadRun(DungeonLandblock(cell), 0);
+ }
+ else Run = null;
+ return true;
+ }
+
+ ///
+ /// Follows the character's cell: the run learns its landblock, and ends when the character leaves it.
+ /// Returns true while the character is in a Thread.
+ ///
+ internal static bool InThread(uint cell)
+ {
+ if (Run is not { } r) return false;
+ if (cell == 0) return true; // position not known: keep what the server said
+ uint lb = cell >> 16;
+ if (r.Landblock == 0)
+ {
+ uint dungeon = DungeonLandblock(cell);
+ // Still where the gem was used, or not inside a dungeon yet: wait for the teleport.
+ if (dungeon == 0 || lb == r.FromLandblock) return true;
+ Run = r with { Landblock = dungeon };
+ return true;
+ }
+ if (lb == r.Landblock) return true;
+ Run = null; // left the Thread's dungeon
+ return false;
+ }
+
+ /// A logout: the next login's [REALM] line says where the character is.
+ internal static void Forget() => Run = null;
+
+ /// True when the dungeon patrol is off where this character is now (a Thread on DreamWeave).
+ internal static bool PatrolOff(RynthCoreHost host)
+ {
+ try
+ {
+ if (Run == null) return false;
+ if (!host.HasGetWorldName || !host.TryGetWorldName(out string world) || !PatrolOffInThreadsOn(world)) return false;
+ uint cell = host.HasGetPlayerPose && host.TryGetPlayerPose(out uint c, out _, out _, out _, out _, out _, out _, out _) ? c : 0;
+ return InThread(cell);
+ }
+ catch { return false; }
+ }
+}
diff --git a/Tools/RynthCore.RynthAiHostTests/Program.cs b/Tools/RynthCore.RynthAiHostTests/Program.cs
index 4a224f8..4a45e12 100644
--- a/Tools/RynthCore.RynthAiHostTests/Program.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Program.cs
@@ -128,6 +128,7 @@ internal static class Program
VTankHotkeyTests.Register(runner);
SaveFailureTests.Register(runner);
DoorTests.Register(runner);
+ ServerPolicyTests.Register(runner);
BlankLoadTests.Register(runner);
GiveProfileTests.Register(runner);
TinkerTests.Register(runner);
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/ServerPolicyTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/ServerPolicyTests.cs
new file mode 100644
index 0000000..923b0a4
--- /dev/null
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/ServerPolicyTests.cs
@@ -0,0 +1,227 @@
+using System;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using RynthCore.Plugin.RynthAi;
+using RynthCore.Plugin.RynthAi.LegacyUi;
+using RynthCore.PluginCore;
+using RynthCore.PluginSdk;
+using RynthCore.RynthAiHostTests.Fakes;
+using RynthCore.RynthAiTests.Harness;
+
+namespace RynthCore.RynthAiHostTests.Tests;
+
+// The dungeon patrol is off in Threads on DreamWeave (its owner asked, 2026-10-15) and only there: ServerPolicy,
+// asked by BuildDunPatrol, the one way into the patrol (command, dashboard Patrol button, a meta's "Patrol", the
+// hazard reroute). A Thread is known from DreamWeave's chat: "The Thread Gem opens a way into ..." and the
+// "[REALM] ... eph=1" line after each teleport; leaving the run's landblock or an eph=0 line ends it.
+internal static class ServerPolicyTests
+{
+ private const uint Player = 0x50000D01;
+ private const BindingFlags Any = BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;
+
+ // DreamWeave's lines, as our clients logged them (2026-10-12).
+ private const string GemLine = "The Thread Gem opens a way into Watery Grotto. It will bring you back 5 more time(s) while the dungeon holds.";
+ private const string RealmThread = "[REALM] id=0 inst=7841 eph=1 name=Base World";
+ private const string RealmWorld = "[REALM] id=0 inst=0 eph=0 name=Base World";
+ private const string RealmHub = "[REALM] id=1 inst=0 eph=0 name=Weave Content 1";
+
+ private const uint HubCell = 0x00070154; // where the gem is used (a made-up indoor hub cell)
+ private const uint ThreadCell = 0x017B0154; // Watery Grotto, as the logged teleport landed
+ private const uint OtherDungeonCell = 0x01CD0102;
+
+ public static void Register(Runner r)
+ {
+ r.Add("server policy: which world names keep the dungeon patrol off in Threads", WorldNames);
+ r.Add("server policy: DreamWeave's Thread lines start a run and the eph=0 line or another landblock ends it", ThreadLines);
+ r.Add("server policy: in a Thread on DreamWeave the patrol is refused with a message", RefusedInAThread);
+ r.Add("server policy: outside a Thread on DreamWeave, and on any other server, the patrol isn't refused", AllowedElsewhere);
+ r.Add("server policy: a patrol running when the character enters a Thread is stood down", StopsARunningPatrol);
+ r.Add("server policy: only the patrol is off (the dunnav-to-a-cell command still runs in a Thread)", OnlyThePatrol);
+ }
+
+ private sealed class Rig
+ {
+ public readonly RynthAiPlugin P = new();
+ public readonly LegacyUiSettings S = new() { IsMacroRunning = true };
+ public readonly RynthCoreHost Host;
+
+ public Rig(string world)
+ {
+ FakeHost.Reset();
+ ServerPolicy.Forget();
+ FakeHost.WorldName = world;
+ FakeHost.Names[Player] = "Mage";
+ FakeHost.SetNavPosition(42.1, 33.6); // outdoors: a patrol that gets past the gate says "inside a dungeon"
+ Host = FakeHost.Create(Player);
+ typeof(RynthPluginBase).GetMethod("Attach", Any)!.Invoke(P, new object[] { FakeHost.LastApi });
+ var dash = (LegacyDashboardRenderer)RuntimeHelpers.GetUninitializedObject(typeof(LegacyDashboardRenderer));
+ typeof(LegacyDashboardRenderer).GetField("_settings", Any)!.SetValue(dash, S);
+ typeof(RynthAiPlugin).GetField("_dashboard", Any)!.SetValue(P, dash);
+ }
+
+ public bool Active { get => (bool)typeof(RynthAiPlugin).GetField("_dunPatrolActive", Any)!.GetValue(P)!; set => typeof(RynthAiPlugin).GetField("_dunPatrolActive", Any)!.SetValue(P, value); }
+ public void Patrol() => P.HandleDungeonNavPatrol();
+ public void Tick() => typeof(RynthAiPlugin).GetMethod("TickDunPatrolHazardReroute", Any)!.Invoke(P, null);
+ public void Chat(string text) => typeof(RynthAiPlugin).GetMethod("NoteServerPolicyChat", Any)!.Invoke(P, new object[] { text });
+ public void At(uint cell) => FakeHost.PlayerPose = (cell, 70f, -80f, 0f);
+
+ /// Uses a Thread Gem in the hub and lands in Watery Grotto, as the logs show it.
+ public void EnterThread()
+ {
+ At(HubCell);
+ Chat(GemLine);
+ At(ThreadCell);
+ Chat(RealmThread);
+ }
+
+ public void RunningPatrol()
+ {
+ Active = true;
+ S.EnableNavigation = true;
+ S.CurrentRoute = new NavRouteParser { RouteType = NavRouteType.Circular };
+ S.CurrentRoute.Points.Add(new NavPoint { NS = 42.0, EW = 33.0 });
+ }
+ }
+
+ private static bool Said(string text) => FakeHost.Chat.Exists(l => l.Contains(text, StringComparison.Ordinal));
+
+ private static void WorldNames()
+ {
+ Check.True(ServerPolicy.PatrolOffInThreadsOn("DreamWeave"), "DreamWeave");
+ Check.True(ServerPolicy.PatrolOffInThreadsOn("dreamweave"), "any case");
+ Check.True(ServerPolicy.PatrolOffInThreadsOn("DreamWeave PvE"), "decorated");
+ Check.False(ServerPolicy.PatrolOffInThreadsOn("Aelrynth"), "Aelrynth");
+ Check.False(ServerPolicy.PatrolOffInThreadsOn("Aeshnidae"), "Aeshnidae");
+ Check.False(ServerPolicy.PatrolOffInThreadsOn("Dream"), "only part of the name");
+ Check.False(ServerPolicy.PatrolOffInThreadsOn(""), "empty");
+ Check.False(ServerPolicy.PatrolOffInThreadsOn(null), "null");
+ }
+
+ private static void ThreadLines()
+ {
+ ServerPolicy.Forget();
+ Check.False(ServerPolicy.InThread(ThreadCell), "nothing said yet: not in a Thread");
+
+ // The gem line in the hub: a run that learns its landblock after the teleport.
+ Check.True(ServerPolicy.NoteChat(GemLine, HubCell), "the gem line is a Thread line");
+ Check.True(ServerPolicy.InThread(HubCell), "still in the hub, waiting for the teleport");
+ Check.True(ServerPolicy.InThread(ThreadCell), "landed in the Thread");
+ Check.Eq(ServerPolicy.Run!.Value.Landblock, ThreadCell >> 16, "the run is Watery Grotto's landblock");
+ Check.True(ServerPolicy.InThread(ThreadCell + 3), "another cell of the same dungeon");
+ Check.False(ServerPolicy.InThread(OtherDungeonCell), "another landblock: out of the Thread");
+ Check.True(ServerPolicy.Run == null, "and the run is over");
+
+ // The [REALM] line alone (a login or re-entry inside a Thread).
+ Check.True(ServerPolicy.NoteChat(RealmThread, ThreadCell), "eph=1 is a Thread line");
+ Check.True(ServerPolicy.InThread(ThreadCell), "eph=1: in a Thread");
+ Check.True(ServerPolicy.NoteChat(RealmHub, HubCell), "eph=0 is a Thread line too");
+ Check.False(ServerPolicy.InThread(HubCell), "eph=0: out");
+ ServerPolicy.NoteChat(RealmThread, ThreadCell);
+ Check.True(ServerPolicy.NoteChat(RealmWorld, ThreadCell), "Base World eph=0");
+ Check.False(ServerPolicy.InThread(ThreadCell), "the same dungeon outside a Thread is not a Thread");
+
+ // Not Thread lines: other chat, a player quoting them, the in-combat refusal.
+ Check.False(ServerPolicy.NoteChat("Mage says, \"[REALM] id=0 inst=1 eph=1 name=Base World\"", ThreadCell), "a player saying it");
+ Check.False(ServerPolicy.NoteChat("Mage says, \"The Thread Gem opens a way into Tiny Hive.\"", ThreadCell), "a player saying the gem line");
+ Check.False(ServerPolicy.NoteChat("You cannot use the Thread Gem while in combat.", HubCell), "the in-combat refusal");
+ Check.False(ServerPolicy.NoteChat("You cast Mind Blossom on yourself", ThreadCell), "other chat");
+ Check.False(ServerPolicy.InThread(ThreadCell), "none of them started a run");
+
+ // A logout forgets the run.
+ ServerPolicy.NoteChat(RealmThread, ThreadCell);
+ ServerPolicy.Forget();
+ Check.False(ServerPolicy.InThread(ThreadCell), "forgotten at logout");
+ }
+
+ private static void RefusedInAThread()
+ {
+ var dw = new Rig("DreamWeave");
+ dw.EnterThread();
+ dw.Patrol();
+ Check.True(Said("turned off in Threads on DreamWeave"), "in a Thread on DreamWeave: told it is off");
+ Check.False(Said("Cannot get player position") || Said("Cell dat not loaded") || Said("requires you to be inside a dungeon"),
+ "and never got as far as building one");
+ Check.False(dw.Active, "no patrol running");
+ Check.False(dw.S.EnableNavigation, "navigation not switched on");
+ ServerPolicy.Forget();
+ }
+
+ private static void AllowedElsewhere()
+ {
+ // DreamWeave, not in a Thread: the patrol itself runs (outdoors here, so it asks for a dungeon).
+ var dw = new Rig("DreamWeave");
+ dw.Patrol();
+ Check.False(Said("turned off"), "DreamWeave outside a Thread: not refused");
+ Check.True(Said("requires you to be inside a dungeon"), "it went on to the patrol itself");
+
+ // DreamWeave, in a retail dungeon outside a Thread (the server said eph=0): the patrol goes on past the gate.
+ var dun = new Rig("DreamWeave");
+ dun.At(ThreadCell);
+ dun.Chat(RealmWorld);
+ dun.Patrol();
+ Check.False(Said("turned off"), "the same dungeon outside a Thread: not refused");
+ Check.True(Said("Cell dat not loaded"), "it went on to the patrol itself (no cell dat in this rig)");
+
+ // DreamWeave, after leaving the Thread by portal (eph=0 line).
+ var left = new Rig("DreamWeave");
+ left.EnterThread();
+ left.At(HubCell);
+ left.Chat(RealmHub);
+ left.Patrol();
+ Check.False(Said("turned off"), "out of the Thread again: not refused");
+
+ // Another server, even if the same lines came (they don't): untouched.
+ var ael = new Rig("Aelrynth");
+ ael.EnterThread();
+ ael.Patrol();
+ Check.False(Said("turned off"), "Aelrynth: not refused");
+ Check.True(Said("Cell dat not loaded"), "it went on to the patrol itself (no cell dat in this rig)");
+
+ var unknown = new Rig("");
+ unknown.EnterThread();
+ unknown.Patrol();
+ Check.False(Said("turned off"), "an unknown world name is not refused");
+ ServerPolicy.Forget();
+ }
+
+ private static void StopsARunningPatrol()
+ {
+ // A patrol is running in a dungeon; the character uses a Thread Gem and lands in the Thread.
+ var b = new Rig("DreamWeave");
+ b.At(OtherDungeonCell);
+ b.RunningPatrol();
+ b.Tick();
+ Check.False(Said("turned off"), "before the Thread: the patrol keeps going");
+ b.EnterThread();
+ b.Tick();
+ Check.False(b.Active, "in the Thread: the patrol is stood down");
+ Check.False(b.S.EnableNavigation, "navigation is off");
+ Check.Eq(b.S.CurrentRoute.Points.Count, 0, "its route is gone");
+ Check.True(Said("turned off in Threads on DreamWeave"), "and the character is told why");
+
+ // The same on another server: untouched.
+ var ok = new Rig("Aelrynth");
+ ok.At(OtherDungeonCell);
+ ok.RunningPatrol();
+ ok.Chat(RealmThread);
+ ok.Tick();
+ Check.False(Said("turned off"), "another server: no message");
+ Check.Eq(ok.S.CurrentRoute.Points.Count, 1, "its route is untouched");
+ ServerPolicy.Forget();
+ }
+
+ private static void OnlyThePatrol()
+ {
+ // /ra dunnav (walk to a dungeon cell) is a different command; DreamWeave's owners did not ask for it
+ // to be off, and it still runs in a Thread (outdoors here, so it gets as far as asking for a dungeon).
+ var b = new Rig("DreamWeave");
+ b.Chat(RealmThread);
+ Check.True(ServerPolicy.Run != null, "the server said: in a Thread");
+ var dunnav = typeof(RynthAiPlugin).GetMethod("HandleDungeonNavCommand", Any)!;
+ dunnav.Invoke(b.P, new object[] { new[] { "/ra", "dunnav", "12.5", "-34.2" } });
+ Check.True(Said("dunnav requires you to be inside a dungeon"), "dunnav ran");
+ Check.False(Said("turned off"), "and was not refused");
+ ServerPolicy.Forget();
+ }
+}