diff --git a/Plugins/RynthCore.Plugin.RynthAi/Combat/CombatManager.Offhand.cs b/Plugins/RynthCore.Plugin.RynthAi/Combat/CombatManager.Offhand.cs
index ddc9442..4b0a832 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Combat/CombatManager.Offhand.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Combat/CombatManager.Offhand.cs
@@ -241,14 +241,26 @@ public partial class CombatManager
_host.HasWieldItem, pick, source, mainElement, explicitIsDefault: source == DefaultOffhandSource);
// Nothing listed planned: put back what RynthAi took off itself, when the hands allow it.
- if (plan.Id == 0 && mode != OffhandMode.None && _stowedOffhandId != 0 && _stowedOffhandId != mainId)
+ // Report "offhand not always being equipped after buffing/dying" (#rynth-issues, 11-28):
+ // - Dual wield: buffing's wand (or a death mid-swap) put both weapons in the pack, and only
+ // the off hand's was remembered. With neither in hand the weapon choice can pick that one
+ // for the main hand; the old main weapon then never came back. It goes in the off hand now.
+ // - Offhand None on the rule (hands off) kept buffing's stowed shield in the pack for good:
+ // buffing goes by the global setting, so it took it off. What RynthAi took off itself
+ // goes back on whatever the mode; under None only into an empty off hand (it never takes
+ // anything off then).
+ int putBack = _stowedOffhandId;
+ if (putBack != 0 && putBack == mainId && _fightOffId == mainId
+ && _fightMainId != 0 && _fightMainId != mainId && _fightMainId != off)
+ putBack = _fightMainId;
+ if (plan.Id == 0 && putBack != 0 && putBack != mainId && (mode != OffhandMode.None || off == 0 || off == putBack))
{
- var stowed = _worldFilter[_stowedOffhandId];
- if (stowed == null || _stowedOffhandId == off) _stowedOffhandId = 0;
+ var stowed = _worldFilter[putBack];
+ if (stowed == null || putBack == off) _stowedOffhandId = 0;
else if ((kind == MainHandKind.OneHandedMelee
&& (IsShieldItem(stowed) || (IsOffhandWeaponItem(stowed) && _host.HasWieldItem)))
|| (kind == MainHandKind.Thrown && IsShieldItem(stowed))) // a thrown weapon keeps a shield
- plan = new OffhandPlan(_stowedOffhandId, "putting back what was taken off");
+ plan = new OffhandPlan(putBack, "putting back what was taken off");
}
return plan;
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/Combat/CombatManager.cs b/Plugins/RynthCore.Plugin.RynthAi/Combat/CombatManager.cs
index b255708..544e3e9 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Combat/CombatManager.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Combat/CombatManager.cs
@@ -2486,6 +2486,12 @@ public partial class CombatManager : IDisposable
// the same target is re-engaged. It was a single run-back jump, which covers a yard or two: never
// out of a 12-yard ring. The jump (face the object, Jumper "xs") stays only for an engine without
// heading snap or autorun. Spotted by SilentKelpie (Forgejo rynth PR #12); re-implemented here.
+ //
+ // Clear is not over (2026-12-04): the danger the request names goes off a few seconds after the
+ // request (the Handler's ring about 4 s after its channel line), so attacks stay held for
+ // BackAwayStayOutMs from the request. Once clear it stands (autorun off) outside the radius and runs
+ // again if the danger comes closer. R-20261204-122802-7806 was clear after 1.5 s, re-engaged at once,
+ // walked back in and died in the ring at 4 s.
/// BackAwayFrom results (RynthAi.Hub BackAwayFrom passes them on as they are).
internal const int BackAwayStarted = 1, BackAwayNotNow = 0, BackAwayOutside = 2, BackAwayUnknownObject = 3, BackAwayJumpRefused = -1;
@@ -2499,7 +2505,11 @@ public partial class CombatManager : IDisposable
/// Yards past the radius the run goes before it stops.
internal const double BackAwayMarginYards = 4.0;
/// The longest a run lasts (blocked, or the danger keeps up).
- internal const double BackAwayRunMaxMs = 6_000;
+ internal const double BackAwayRunMaxMs = 8_000;
+ /// Attacks stay held this long from the request, even once clear (the danger has gone off by then).
+ internal const double BackAwayStayOutMs = 5_000;
+ /// Standing out, it runs again once the danger is this much inside the stop distance.
+ internal const double BackAwayRerunYards = 1.0;
private const double BackAwayTurnRefreshMs = 250, BackAwayRunRefreshMs = 1_000;
/// Think last drove the run this long ago (another activity has the tick): the combat poll drives it.
private const double BackAwayOrphanMs = 150;
@@ -2510,6 +2520,7 @@ public partial class CombatManager : IDisposable
// The run.
private bool _backAwayRunning;
+ private bool _backAwayStanding;
private int _backAwayId;
private string _backAwayName = "";
private double _backAwaySafeYards;
@@ -2542,6 +2553,8 @@ public partial class CombatManager : IDisposable
{
string why = string.IsNullOrWhiteSpace(reason) ? "a server plugin's request" : reason.Trim();
if (!_settings.IsMacroRunning || !_settings.EnableCombat) return BackAwayNotNow;
+ if (_backAwayRunning && objectId == _backAwayId && objectId != 0)
+ return RenewBackAwayRun(radiusYards, why);
if (BackAwayActive) return BackAwayNotNow;
uint me = _host.GetPlayerId();
if (me == 0 || objectId == 0) return BackAwayUnknownObject;
@@ -2609,6 +2622,7 @@ public partial class CombatManager : IDisposable
_host.TurnToHeadingBy(BackAwaySource, away);
bool running = _host.SetAutoRunBy(BackAwaySource, true);
_backAwayRunning = true;
+ _backAwayStanding = false;
_backAwayId = objectId;
_backAwayName = name;
_backAwaySafeYards = danger + BackAwayMarginYards;
@@ -2617,14 +2631,31 @@ public partial class CombatManager : IDisposable
_backAwayUntil = DateTime.MinValue;
_backAwayJumpStarted = false;
_host.Log($"[CombatEvade] Back away ({why}): running away from '{name}' at {dist:0.0} m " +
- $"(danger {danger:0.#} m, stops at {_backAwaySafeYards:0.#} m), heading {away:0}" +
+ $"(danger {danger:0.#} m, stops at {_backAwaySafeYards:0.#} m, stays out {BackAwayStayOutMs / 1000:0.#} s), heading {away:0}" +
(running ? "." : " (autorun held; trying again)."));
}
///
- /// One step of the run: stop when outside the radius plus the margin, when the danger is gone or
- /// after ; else re-aim away from it and keep autorun on. True while it
- /// holds attacks.
+ /// The same danger asked about again while the run holds (it is going off again): the stay-out and
+ /// the run's limit start over from now, the radius grows if the new one is larger.
+ ///
+ private int RenewBackAwayRun(double radiusYards, string why)
+ {
+ DateTime now = RynthClock.Now;
+ double danger = Math.Max(double.IsNaN(radiusYards) ? 0 : radiusYards, Math.Max(1, _settings.RingRange));
+ _backAwaySafeYards = Math.Max(_backAwaySafeYards, danger + BackAwayMarginYards);
+ _backAwayRunStart = now;
+ _host.Log($"[CombatEvade] Back away ({why}): '{_backAwayName}' again - staying out {BackAwayStayOutMs / 1000:0.#} s more " +
+ $"(stops at {_backAwaySafeYards:0.#} m).");
+ return BackAwayStarted;
+ }
+
+ ///
+ /// One step of the run. Outside the radius plus the margin it stands (autorun off) until
+ /// from the request, then it is over; inside it re-aims away and keeps
+ /// autorun on (standing, only once the danger is inside). Over at once
+ /// when the danger is gone; after wherever it is. True while it holds
+ /// attacks.
///
private bool StepBackAwayRun(DateTime now)
{
@@ -2633,8 +2664,9 @@ public partial class CombatManager : IDisposable
uint me = _host.GetPlayerId();
double d = me != 0 && _backAwayId != 0 ? _worldFilter.Distance(unchecked((int)me), _backAwayId) : -1;
bool gone = d < 0 || d == double.MaxValue || double.IsNaN(d);
+ bool outside = !gone && d >= (_backAwayStanding ? _backAwaySafeYards - BackAwayRerunYards : _backAwaySafeYards);
string? done = gone ? "the danger is gone"
- : d >= _backAwaySafeYards ? $"clear at {d:0.0} m"
+ : outside && elapsed >= BackAwayStayOutMs ? $"clear at {d:0.0} m"
: elapsed >= BackAwayRunMaxMs ? $"run timed out at {d:0.0} m"
: null;
if (done != null)
@@ -2643,6 +2675,24 @@ public partial class CombatManager : IDisposable
_host.Log($"[CombatEvade] Back away done after {elapsed:0} ms ({done}) - re-engaging.");
return false;
}
+ if (outside)
+ {
+ if (!_backAwayStanding)
+ {
+ _backAwayStanding = true;
+ try { _host.SetAutoRunBy(BackAwaySource, false); } catch { }
+ _backAwayAutoRunAt = DateTime.MinValue;
+ _host.Log($"[CombatEvade] Back away: out at {d:0.0} m after {elapsed:0} ms - standing clear of '{_backAwayName}' " +
+ $"until {BackAwayStayOutMs / 1000:0.#} s.");
+ }
+ return true;
+ }
+ if (_backAwayStanding)
+ {
+ _backAwayStanding = false;
+ _backAwayTurnAt = _backAwayAutoRunAt = DateTime.MinValue;
+ _host.Log($"[CombatEvade] Back away: '{_backAwayName}' closed to {d:0.0} m - running again.");
+ }
if ((now - _backAwayTurnAt).TotalMilliseconds >= BackAwayTurnRefreshMs && TryGetHeadingTo(_backAwayId, out double toward, out _))
{
if (_host.TurnToHeadingBy(BackAwaySource, (float)((toward + 180.0) % 360.0))) _backAwayTurnAt = now;
@@ -2657,6 +2707,7 @@ public partial class CombatManager : IDisposable
{
if (!_backAwayRunning) return;
_backAwayRunning = false;
+ _backAwayStanding = false;
_backAwayId = 0;
_backAwayRunStart = _backAwayTurnAt = _backAwayAutoRunAt = _backAwayTickAt = DateTime.MinValue;
try { _host.SetAutoRunBy(BackAwaySource, false); } catch { }
@@ -5839,6 +5890,18 @@ public partial class CombatManager : IDisposable
// Listed weapons whose wield requirement isn't met (logged once each).
private readonly HashSet _wieldReqNoted = new();
+ // Monsters tab weapons left out of the plan, by weapon and reason (logged once each).
+ private readonly HashSet _fixedLeftOutNoted = new();
+
+ ///
+ /// A weapon set on the Monsters tab can't be used, so the next pick (often the monster's
+ /// weakness) takes over: say once why (R-20261130-200251-9dff).
+ ///
+ private void NoteFixedLeftOut(int id, string noteAs, string why)
+ {
+ if (_fixedLeftOutNoted.Add($"{id}:{why}"))
+ _host.Log($"[EquipDiag] {noteAs} weapon 0x{(uint)id:X8} '{WeaponName(id)}' left out: {why}. The next weapon choice applies.");
+ }
// Listed weapons found not to be ours (logged once each).
private readonly HashSet _notCarriedNoted = new();
internal const double NotCarriedGraceMs = 5000;
@@ -5878,7 +5941,20 @@ public partial class CombatManager : IDisposable
&& !rule.Name.Equals("Default", StringComparison.OrdinalIgnoreCase);
bool TryFixed(int id, string source, string noteAs, bool isDefault, bool listOnly)
{
- if (fixedId != 0 || id == 0 || !CanWieldNow(id)) return false;
+ if (fixedId != 0 || id == 0) return false;
+ // The weapon in hand is wielded already: its requirement was met when it went on (the
+ // same exemption CandidateFor makes). A buffed skill that reads short now no longer
+ // swaps the player's own pick away for the weakness pick.
+ if (id != InHandWeaponId() && !CanWieldNow(id))
+ {
+ // R-20261130-200251-9dff: a Monsters rule's weapon left out here went unsaid, so the
+ // weakness pick took over with nothing in the log to say why.
+ if (!listOnly)
+ NoteFixedLeftOut(id, noteAs, SkillTooLowFor(id)
+ ? "the server refused it for too low a skill lately (left out for 30 min)"
+ : "its wield requirement isn't met: " + (WieldRequirements.Unmet(_host, _charSkills, unchecked((uint)id)) ?? "?"));
+ return false;
+ }
if (!listed.Any(c => c.Id == id))
{
if (listOnly) { NoteUnlisted(id, noteAs); return false; }
@@ -5887,6 +5963,8 @@ public partial class CombatManager : IDisposable
{
if (caster && _unlistedNoted.Add(id))
_host.Log($"[EquipDiag] {noteAs} weapon 0x{(uint)id:X8} '{WeaponName(id)}' is a caster and the character can't fight with magic: {CanMagicDiag()}");
+ else if (_worldFilter[id] == null)
+ NoteFixedLeftOut(id, noteAs, "the game doesn't know that item (not carried, or its id changed: pick the weapon again on the Monsters tab)");
return false;
}
if (_unlistedNoted.Add(id))
diff --git a/Plugins/RynthCore.Plugin.RynthAi/Combat/PetManager.cs b/Plugins/RynthCore.Plugin.RynthAi/Combat/PetManager.cs
index f0f5e74..ddaf9e4 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Combat/PetManager.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Combat/PetManager.cs
@@ -197,6 +197,14 @@ internal sealed class PetManager
private readonly HashSet _holderNotReadyLogged = new();
/// A listed essence not appraised yet waits this long for its appraisal, once.
private const long AppraisalWaitMs = 3_000;
+ // Listed "essences" that are no pet essence at all (R-20261204-141918-4808: an "Essence of ..."
+ // item typed Pet in the Items list by its name, never appraised, was used about every minute; the
+ // server answered "The Essence of ... cannot be used"). Skipped for the session by name once the
+ // server says it cannot be used, or once EmptySummonsMax summons from it brought nothing and it
+ // shows no charges (every combat pet device has a charge count). Each said once in chat.
+ private readonly HashSet _unusableNames = new(StringComparer.OrdinalIgnoreCase);
+ private readonly Dictionary _emptySummons = new(StringComparer.OrdinalIgnoreCase);
+ internal const int EmptySummonsMax = 2;
/// After a summon lands, its essence is judged again this long (its appraisal may still come).
private const long LandedCheckMs = 15_000;
@@ -265,6 +273,8 @@ internal sealed class PetManager
// (it waits only AppraisalWaitMs) may turn out no combat pet device.
_landedDeviceId = _activeDeviceId;
_landedCheckUntil = now + LandedCheckMs;
+ string? landedName = _objectCache[_activeDeviceId]?.Name;
+ if (!string.IsNullOrEmpty(landedName)) _emptySummons.Remove(landedName);
if (PetDeviceKind.Judge(_host, unchecked((uint)_activeDeviceId)) == PetDeviceKind.Verdict.Unknown && _host.HasRequestId)
_host.RequestId(unchecked((uint)_activeDeviceId));
GoIdle();
@@ -308,7 +318,10 @@ internal sealed class PetManager
AssumePetFor(now, AssumeActiveAfterSummonMs);
}
else if (_state == PetState.Summoning)
+ {
_assumePetActiveUntil = 0;
+ NoteEmptySummon(_activeDeviceId, _preActionCharges);
+ }
Reset();
return;
}
@@ -378,6 +391,22 @@ internal sealed class PetManager
GoIdle();
return;
}
+ // "The - cannot be used": not a pet essence (or not one this character may use).
+ // Nothing started, so no essence waits on it; the rest of the list is tried now.
+ if (text.Contains("cannot be used", StringComparison.OrdinalIgnoreCase))
+ {
+ string name = _objectCache[_activeDeviceId]?.Name ?? "";
+ if (name.Length > 0 && text.Contains(name, StringComparison.OrdinalIgnoreCase))
+ {
+ // The refusal is the server's answer to the use (no UseDone comes): combat and
+ // buffs stop waiting on it now (R-20261204-162443-5c2b: a 3.5 s pause each time).
+ if (_activeDeviceId != 0) ActionPacer.NoteRefused(unchecked((uint)_activeDeviceId));
+ if (_activeDeviceId != 0) _deviceCooldownUntil.Remove(_activeDeviceId);
+ MarkUnusable(name, "the server says it cannot be used");
+ GoIdle();
+ }
+ return;
+ }
return;
}
@@ -704,6 +733,40 @@ internal sealed class PetManager
return true;
}
+ ///
+ /// A summon timed out with no pet and no charge drop. From an item with no charge count at all
+ /// (not summoned with a read of charges, and nothing about it says combat pet device: a 0 the server
+ /// called full is summoned as -1 too) it counts; of them in a row and
+ /// that name is skipped for the session ().
+ ///
+ private void NoteEmptySummon(int deviceId, int charges)
+ {
+ if (deviceId == 0 || charges >= 0) return;
+ if (ReadCharges(deviceId) >= 0) return;
+ if (PetDeviceKind.Judge(_host, unchecked((uint)deviceId)) == PetDeviceKind.Verdict.Combat) return;
+ string name = _objectCache[deviceId]?.Name ?? "";
+ if (name.Length == 0) return;
+ int n = _emptySummons.TryGetValue(name, out int c) ? c + 1 : 1;
+ _emptySummons[name] = n;
+ if (n >= EmptySummonsMax)
+ MarkUnusable(name, $"{n} summons from it brought no pet and it shows no charges");
+ }
+
+ /// Skips every listed essence named for the session; says so once in chat.
+ private void MarkUnusable(string name, string why)
+ {
+ _emptySummons.Remove(name);
+ if (!_unusableNames.Add(name)) return;
+ string line = $"[RynthAi] Pet: '{name}' is listed as a Pet in the Items list, but {why}; the summoner skips it. " +
+ "If it isn't a pet essence, remove it from the Items list.";
+ _host.Log(line);
+ RynthLog.Write(LogCat.Pets, line);
+ try { _host.WriteToChat(line, 2); } catch { }
+ }
+
+ /// Host tests: names the summoner skips for the session.
+ internal IReadOnlyCollection UnusableNames => _unusableNames;
+
private void GoIdle()
{
_state = PetState.Idle;
@@ -960,6 +1023,9 @@ internal sealed class PetManager
foreach (int id in ids)
{
uint uid = unchecked((uint)id);
+ // The server said it cannot be used, or it never brought a pet (MarkUnusable).
+ if (_unusableNames.Count > 0 && _objectCache[id]?.Name is string listedName && _unusableNames.Contains(listedName))
+ continue;
// A server's holder that doesn't hold all its summons yet summons nothing (the server
// refuses it, and the 45 s park would follow): skipped, logged once until it is full.
if (PetElements.IsHolder(_host, uid, _objectCache[id]?.Name))
diff --git a/Plugins/RynthCore.Plugin.RynthAi/CorpseOpenController.cs b/Plugins/RynthCore.Plugin.RynthAi/CorpseOpenController.cs
index ab826d6..9efebc1 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/CorpseOpenController.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/CorpseOpenController.cs
@@ -467,6 +467,10 @@ public sealed partial class RynthAiPlugin
// lifetime by a wide margin (so an aged-out entry's corpse is provably gone and
// can never be re-looted) while staying well under server GUID-reuse timescales.
private const long CompletedCorpseRetentionMs = 30 * 60_000; // 30 min
+ /// An open container the client shows farther than this is stale, never claimed (SyncCorpseContainerState).
+ internal const double ReconcileOpenMaxMeters = 20.0;
+ /// The stale open container last logged as not claimed (one line per container).
+ private int _staleOpenNoted;
private void PruneCorpseCollections()
{
@@ -4894,6 +4898,23 @@ public sealed partial class RynthAiPlugin
if (_completedCorpses.ContainsKey(rawOpen))
return;
+ // The engine's open container is the last ViewContents until its StopViewing: a corpse
+ // that rotted or was left behind without one stays "open" for hours. Only one near the
+ // character is really open (R-20261204-051349-d8d0: a corpse from 6 h before was claimed
+ // again each time its completed mark aged out, every 30 min, and ended "Nothing to loot").
+ double openDist = _objectCache?.Distance(unchecked((int)_playerId), rawOpen) ?? double.MaxValue;
+ if (openDist > ReconcileOpenMaxMeters)
+ {
+ if (_staleOpenNoted != rawOpen)
+ {
+ _staleOpenNoted = rawOpen;
+ LootDiag($"[RynthAi] Corpse loot: the client still shows 0x{(uint)rawOpen:X8} open, but it is "
+ + (openDist < 100_000 ? $"{openDist:0} m away" : "nowhere near")
+ + ": not claimed.");
+ }
+ return;
+ }
+
bool switchedTarget = _targetCorpseId != 0 && _targetCorpseId != rawOpen;
_openedContainerId = rawOpen;
_openedContainerAt = now;
diff --git a/Plugins/RynthCore.Plugin.RynthAi/ItemInfo/MagItemDescriber.cs b/Plugins/RynthCore.Plugin.RynthAi/ItemInfo/MagItemDescriber.cs
index 7099464..c7b3bea 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/ItemInfo/MagItemDescriber.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/ItemInfo/MagItemDescriber.cs
@@ -816,7 +816,10 @@ internal sealed class CacheItemPropertySource : IItemPropertySource
if (n <= 0) return Array.Empty();
int take = Math.Min(n, buf.Length);
var list = new List(take);
- for (int i = 0; i < take; i++) list.Add(unchecked((int)buf[i]));
+ // An enchantment cast on the item (ACE flags it 0x80000000: a worn shirt's banes) isn't one
+ // of its spells, for the item lines and the loot rules alike (#rynth-issues 2026-12-01).
+ for (int i = 0; i < take; i++)
+ if ((buf[i] & 0x80000000u) == 0) list.Add(unchecked((int)buf[i]));
return list;
}
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyDashboardRenderer.cs b/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyDashboardRenderer.cs
index 3e5718d..267ca66 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyDashboardRenderer.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyDashboardRenderer.cs
@@ -1357,6 +1357,7 @@ internal sealed partial class LegacyDashboardRenderer
StaminaToHealthAt = s.StaminaToHealthAt,
StaminaToHealthMinStamina = s.StaminaToHealthMinStamina,
StopMacroOnDeath = s.StopMacroOnDeath,
+ LeaveGameOnDeath = s.LeaveGameOnDeath,
DeathRecallMode = s.DeathRecallMode,
DeathRecallSpellId = s.DeathRecallSpellId,
DeathRecallItem = s.DeathRecallItem,
@@ -1653,6 +1654,7 @@ internal sealed partial class LegacyDashboardRenderer
s.StaminaToHealthAt = Math.Clamp(p.StaminaToHealthAt, 0, 100);
s.StaminaToHealthMinStamina = Math.Clamp(p.StaminaToHealthMinStamina, 0, 100);
s.StopMacroOnDeath = p.StopMacroOnDeath;
+ if (p.LeaveGameOnDeath is int leave) s.LeaveGameOnDeath = Math.Clamp(leave, 0, 2); // absent = unchanged
// Absent (older engine) = unchanged.
if (p.DeathRecallMode is int recallMode) s.DeathRecallMode = Math.Clamp(recallMode, 0, 2);
if (p.DeathRecallSpellId is int recallSpell && recallSpell > 0) s.DeathRecallSpellId = recallSpell;
@@ -2262,6 +2264,7 @@ internal sealed partial class LegacyDashboardRenderer
dst.StaminaToHealthAt = tmp.StaminaToHealthAt;
dst.StaminaToHealthMinStamina= tmp.StaminaToHealthMinStamina;
dst.StopMacroOnDeath = tmp.StopMacroOnDeath;
+ dst.LeaveGameOnDeath = Math.Clamp(tmp.LeaveGameOnDeath, 0, 2);
dst.DeathRecallMode = Math.Clamp(tmp.DeathRecallMode, 0, 2);
dst.DeathRecallSpellId = tmp.DeathRecallSpellId > 0 ? tmp.DeathRecallSpellId : 48;
dst.DeathRecallItem = tmp.DeathRecallItem ?? string.Empty;
diff --git a/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyUiSettings.cs b/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyUiSettings.cs
index 479714a..14be77a 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyUiSettings.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyUiSettings.cs
@@ -365,6 +365,11 @@ public sealed class LegacyUiSettings
public int StaminaToHealthAt = 30;
public int StaminaToHealthMinStamina = 20;
public bool StopMacroOnDeath = false;
+ // Leave Game On Death (2026-12-02, R-20261202-160920-52c7; a RynthAi setting with two choices, log out or
+ // exit the game): after a death while the macro ran, once respawned
+ // and settled, the macro stops and 1 = the client logs out (/logout), 2 = the game closes (/rc quit).
+ // 0 = off (the default). Before Recall On Death and the corpse trip, which it skips.
+ public int LeaveGameOnDeath = 0;
// Recall On Death (RynthAiPlugin.DeathRecall.cs): after a death while the macro ran, once
// respawned: 0 off, 1 cast DeathRecallSpellId, 2 use the inventory item named DeathRecallItem
// (exact name, else the first containing it). Travel Back To My Corpse starts after it.
@@ -1593,6 +1598,7 @@ public sealed class SettingsBridgePayload
public int StaminaToHealthAt { get; set; } = 30;
public int StaminaToHealthMinStamina { get; set; } = 20;
public bool StopMacroOnDeath { get; set; }
+ public int? LeaveGameOnDeath { get; set; } // Leave Game On Death 0/1/2 (2026-12-02); absent = unchanged
public bool StopMacroOnNoComponents { get; set; }
public bool? ShowNoComponentsWarning { get; set; } // Show No Components Warning (2026-11-27); absent = unchanged
// Absent from an older engine: null keeps the plugin's values.
diff --git a/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyWeaponsUi.cs b/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyWeaponsUi.cs
index 11ae41f..104254f 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyWeaponsUi.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/LegacyUi/LegacyWeaponsUi.cs
@@ -202,7 +202,7 @@ internal sealed class LegacyWeaponsUi
case AcObjectClass.Lockpick: return "Lockpick";
case AcObjectClass.Misc:
case AcObjectClass.CombatPet:
- return wo.Name.Contains("Essence", StringComparison.OrdinalIgnoreCase) ? "Pet" : null;
+ return IsPetEssenceName(wo.Name) ? "Pet" : null;
default: return null;
}
}
@@ -259,9 +259,27 @@ internal sealed class LegacyWeaponsUi
return "Lockpick";
// Combat-pet summoning essences (PetDevices) — consumed by PetManager.
- if (name.Contains("Essence", StringComparison.OrdinalIgnoreCase))
+ if (IsPetEssenceName(name))
return "Pet";
return "General";
}
+
+ ///
+ /// A pet essence's name: "... Essence", or "... Essence (50)" with its level. Not an item that only
+ /// has the word in it: "Essence of ..." (R-20261204-141918-4808: one typed Pet by "Essence" anywhere
+ /// in its name was used as a pet essence about every minute) or "Scroll of Gift of Essence".
+ ///
+ internal static bool IsPetEssenceName(string? name)
+ {
+ if (string.IsNullOrWhiteSpace(name)) return false;
+ string n = name.Trim();
+ if (n.EndsWith(")", StringComparison.Ordinal))
+ {
+ int open = n.LastIndexOf(" (", StringComparison.Ordinal);
+ if (open > 0 && int.TryParse(n.AsSpan(open + 2, n.Length - open - 3), out _)) n = n[..open].TrimEnd();
+ }
+ return n.EndsWith(" Essence", StringComparison.OrdinalIgnoreCase)
+ && !n.StartsWith("Scroll of ", StringComparison.OrdinalIgnoreCase);
+ }
}
diff --git a/Plugins/RynthCore.Plugin.RynthAi/Meta/ExpressionEngine.cs b/Plugins/RynthCore.Plugin.RynthAi/Meta/ExpressionEngine.cs
index 7cc027d..138832b 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/Meta/ExpressionEngine.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/Meta/ExpressionEngine.cs
@@ -3706,6 +3706,7 @@ internal sealed partial class ExpressionEngine
["StaminaToHealthAt"] = (() => s.StaminaToHealthAt.ToString(CultureInfo.InvariantCulture), v => s.StaminaToHealthAt = Math.Clamp((int)ToDouble(v), 0, 100)),
["StaminaToHealthMinStamina"] = (() => s.StaminaToHealthMinStamina.ToString(CultureInfo.InvariantCulture), v => s.StaminaToHealthMinStamina = Math.Clamp((int)ToDouble(v), 0, 100)),
["StopMacroOnDeath"] = (() => B(s.StopMacroOnDeath), v => s.StopMacroOnDeath = ToDouble(v) != 0),
+ ["LeaveGameOnDeath"] = (() => I(s.LeaveGameOnDeath), v => { if (int.TryParse(v, out int i)) s.LeaveGameOnDeath = Math.Clamp(i, 0, 2); }),
["DeathRecallMode"] = (() => I(s.DeathRecallMode), v => { if (int.TryParse(v, out int i)) s.DeathRecallMode = Math.Clamp(i, 0, 2); }),
["DeathRecallSpellId"] = (() => I(s.DeathRecallSpellId), v => { if (int.TryParse(v, out int i) && i > 0) s.DeathRecallSpellId = i; }),
["DeathRecallItem"] = (() => s.DeathRecallItem, v => s.DeathRecallItem = v?.Trim() ?? string.Empty),
@@ -3716,6 +3717,10 @@ internal sealed partial class ExpressionEngine
["EscapeHazards"] = (() => B(s.EscapeHazards), v => s.EscapeHazards = ToDouble(v) != 0),
["TravelToOwnCorpse"] = (() => B(s.TravelToOwnCorpse), v => s.TravelToOwnCorpse = ToDouble(v) != 0),
["KeepHuntingAfterDeath"] = (() => B(s.KeepHuntingAfterDeath), v => s.KeepHuntingAfterDeath = ToDouble(v) != 0),
+ // Patrol On Login / Hunt On Login (2026-12-01): one choice, as the two boxes (LoginAutoStart.Exclusive), so a
+ // script or meta that starts the character itself at login can see them and turn them off.
+ ["PatrolOnLogin"] = (() => B(s.PatrolOnLogin), v => { (s.PatrolOnLogin, s.HuntOnLogin) = LoginAutoStart.Exclusive(s.PatrolOnLogin, s.HuntOnLogin, ToDouble(v) != 0, s.HuntOnLogin); }),
+ ["HuntOnLogin"] = (() => B(s.HuntOnLogin), v => { (s.PatrolOnLogin, s.HuntOnLogin) = LoginAutoStart.Exclusive(s.PatrolOnLogin, s.HuntOnLogin, s.PatrolOnLogin, ToDouble(v) != 0); }),
["ItemInfoOnSelect"] = (() => B(s.ItemInfoSettings.OnSelect), v => s.ItemInfoSettings.OnSelect = ToDouble(v) != 0),
// The looter's "Looted" line names the rule and the item's details (salvage: on request).
["ItemInfoLootChat"] = (() => B(s.ItemInfoSettings.LootChat), v => s.ItemInfoSettings.LootChat = ToDouble(v) != 0),
diff --git a/Plugins/RynthCore.Plugin.RynthAi/OutdoorHunt.cs b/Plugins/RynthCore.Plugin.RynthAi/OutdoorHunt.cs
index c08915e..bdf26de 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/OutdoorHunt.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/OutdoorHunt.cs
@@ -257,6 +257,8 @@ internal sealed class OutdoorHunt
_roamSeen.Clear();
_roamSkip.Clear();
_roaming = false;
+ SpotFine();
+ _steppingBack = false;
_lastPlan = _lastPick = _arrivedSince = DateTime.MinValue;
Note = $"started at {at.X:0},{at.Y:0}";
}
@@ -266,6 +268,7 @@ internal sealed class OutdoorHunt
Active = false;
TargetId = 0;
_roaming = false;
+ _steppingBack = false;
WalkingOut = false;
_outTries = 0;
}
@@ -380,6 +383,7 @@ internal sealed class OutdoorHunt
var p = w.P;
if (Reaches(p, target.Pos))
{
+ SpotFine();
_plannedTo = target.Pos;
_lastPlan = now;
if (p.Length > ArrivedYd && !EndsHere(p, me))
@@ -398,6 +402,7 @@ internal sealed class OutdoorHunt
else
{
Skip(target.Id, now);
+ LeftOutHere(me, target.Id);
Note = $"'{target.Name}' can't be reached any more ({Describe(p, w.Why, target.Pos)}): left out for {SkipSec:0} s";
}
}
@@ -406,6 +411,15 @@ internal sealed class OutdoorHunt
NewTarget();
}
+ // Stepping back off a spot no walk left (StepBack): let it finish, then look again at once.
+ if (_steppingBack)
+ {
+ double since = (now - _stepBackAt).TotalSeconds;
+ if ((!routeDone || since < 1) && since < StepBackMaxSec) return new Decision(Act.None);
+ _steppingBack = false;
+ _lastPick = DateTime.MinValue;
+ }
+
// A roam walk that ran out: its square is seen (got there) or left out (didn't).
if (_roaming && routeDone) EndRoamWalk(now, me);
@@ -430,6 +444,7 @@ internal sealed class OutdoorHunt
else
{
Skip(c.Id, now);
+ LeftOutHere(me, c.Id);
Note = $"'{c.Name}' left out for {SkipSec:0} s: {Describe(p, w.Why, c.Pos)}";
}
}
@@ -450,6 +465,7 @@ internal sealed class OutdoorHunt
/// The chosen monster becomes the target: walked to, or stood by when the walk's end is already here.
private Decision Go(DateTime now, Candidate c, HuntWalk w, string pack = "")
{
+ SpotFine();
if (TargetId != c.Id) NewTarget();
if (_roaming) { _roaming = false; Note = $"'{c.Name}' in range: the roam ends"; }
TargetId = c.Id;
@@ -472,6 +488,7 @@ internal sealed class OutdoorHunt
///
private Decision Waiting()
{
+ if (StepBack() is Decision back) return back;
if (Roam && _meBuilding == 0 && !IsIndoorCell(_meCellNow))
{
if (_roaming) return new Decision(Act.None); // still on the way
@@ -557,6 +574,7 @@ internal sealed class OutdoorHunt
continue;
}
if (p.Length <= ArrivedYd) { _roamSeen[sq] = now; continue; }
+ SpotFine();
_roaming = true;
_roamSquare = sq;
_roamTo = p.Corners[^1];
@@ -670,6 +688,7 @@ internal sealed class OutdoorHunt
else
{
Skip(c.Id, now);
+ LeftOutHere(me, c.Id);
Note = $"'{c.Name}' left out for {SkipSec:0} s: {Describe(w.P, w.Why, c.Pos)}";
}
}
@@ -706,6 +725,102 @@ internal sealed class OutdoorHunt
return Go(now, _eligible[target], walks[target], pack);
}
+ // ── A spot no walk leaves (2026-12-03, a Yanshi Thread) ─────────────────────────────────────────
+ // The hunt stood for minutes in a doorway (building B470#3's) with thirty monsters round it: every walk
+ // planned from there failed (the doorstep was a crumb of RynthNav's map, cut off from the street; fixed
+ // there too), so one monster after another was left out, then the roam's squares, and it waited "for
+ // respawns". Two steps back and it hunted again. When BadSpotLeftOuts monsters have been left out from
+ // one spot and no walk from it reached anything, that is the spot, not the monsters: back a few yards the
+ // way it came (where it walked, so no wall between), and the ones left out from there are looked at again.
+ // At most StepBackMax times until a walk works again; then it waits, as before.
+
+ /// Monsters left out from one spot (no walk from it reaching anything) before the hunt steps back.
+ public int BadSpotLeftOuts { get; set; } = 3;
+ /// How far the step back goes, the way it came (yd, straight from the spot).
+ public double StepBackYd { get; set; } = 4;
+ /// Step backs until a walk works again; then it waits.
+ public int StepBackMax { get; set; } = 2;
+ /// A step back that hasn't run out by now is over anyway.
+ public double StepBackMaxSec { get; set; } = 8;
+ /// Within this of the spot the walks failed from, it is still there.
+ internal const double SpotYd = 2;
+ internal const int TrailMax = 64;
+
+ private readonly List _trail = new(); // where it walked outdoors, every StepYd, newest last
+ private readonly HashSet _leftOutHere = new();
+ private bool _hasBadSpot;
+ private Vec _badSpot;
+ private int _stepBacks;
+ private bool _steppingBack;
+ private DateTime _stepBackAt = DateTime.MinValue;
+ /// Stepping back off a spot no walk left.
+ public bool SteppingBack => _steppingBack;
+ internal int TrailSteps => _trail.Count;
+
+ private void KeepTrail(Vec me)
+ {
+ if (_trail.Count > 0 && _trail[^1].FlatDistanceTo(me) > 20) _trail.Clear(); // a portal, a recall: a new trail
+ // Back near a step already on the trail: the loop since is cut (as the way in).
+ for (int i = 0; i < _trail.Count - 1; i++)
+ if (_trail[i].FlatDistanceTo(me) < StepYd) { _trail.RemoveRange(i + 1, _trail.Count - i - 1); return; }
+ if (_trail.Count == 0 || _trail[^1].FlatDistanceTo(me) >= StepYd)
+ {
+ _trail.Add(me);
+ if (_trail.Count > TrailMax) _trail.RemoveAt(0);
+ }
+ }
+
+ /// A monster left out because no walk from where the character stands gets to it.
+ private void LeftOutHere(Vec me, int id)
+ {
+ if (!_hasBadSpot || me.FlatDistanceTo(_badSpot) > SpotYd)
+ {
+ _hasBadSpot = true;
+ _badSpot = me;
+ _leftOutHere.Clear();
+ }
+ _leftOutHere.Add(id);
+ }
+
+ /// A walk from here worked: the spot is fine, and the step backs start again.
+ private void SpotFine()
+ {
+ _hasBadSpot = false;
+ _leftOutHere.Clear();
+ _stepBacks = 0;
+ }
+
+ /// The way back: the trail, newest first, until from here; null when there is none to speak of.
+ internal List? WayBack(Vec me)
+ {
+ var way = new List();
+ for (int i = _trail.Count - 1; i >= 0; i--)
+ {
+ if (_trail[i].FlatDistanceTo(me) < 1.0 && way.Count == 0) continue;
+ way.Add(_trail[i]);
+ if (_trail[i].FlatDistanceTo(me) >= StepBackYd) break;
+ }
+ return way.Count > 0 && way[^1].FlatDistanceTo(me) > SpotYd ? way : null;
+ }
+
+ private Decision? StepBack()
+ {
+ if (!_hasBadSpot || _leftOutHere.Count < BadSpotLeftOuts || _meNow.FlatDistanceTo(_badSpot) > SpotYd) return null;
+ if (_stepBacks >= StepBackMax || _meBuilding != 0 || IsIndoorCell(_meCellNow)) return null;
+ var way = WayBack(_meNow);
+ if (way == null) return null;
+ _stepBacks++;
+ int n = _leftOutHere.Count;
+ foreach (int id in _leftOutHere) _skip.Remove(id);
+ _leftOutHere.Clear();
+ _hasBadSpot = false;
+ _steppingBack = true;
+ _stepBackAt = _now;
+ Note = $"no walk from {_meNow.X:0},{_meNow.Y:0} gets anywhere ({n} monsters left out from there): back {way[^1].FlatDistanceTo(_meNow):0} yd "
+ + $"the way it came, and those {n} looked at again ({_stepBacks} of {StepBackMax})";
+ return new Decision(Act.Walk, way, 0, Note);
+ }
+
// ── Indoors ──────────────────────────────────────────────────────────────────────────────────
// A building's rooms are off RynthNav's landscape map: it plans no walk from in there, and every
// monster came back "not on the map" (a test hunt 10-23, after combat chased one inside: the hunt left
@@ -736,6 +851,7 @@ internal sealed class OutdoorHunt
{
if (!indoors)
{
+ KeepTrail(me);
_wayIn.Clear();
_lastOutdoors = me;
_knowsOutdoors = true;
@@ -743,6 +859,7 @@ internal sealed class OutdoorHunt
_outTries = 0;
return;
}
+ _trail.Clear(); // the way back starts again outside: never back through a building's walls
if (_wayIn.Count == 0)
{
if (!_knowsOutdoors) return;
diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Safety.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Safety.cs
index 5dc1df0..a3b4074 100644
--- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Safety.cs
+++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.Safety.cs
@@ -12,6 +12,8 @@ namespace RynthCore.Plugin.RynthAi;
public sealed partial class RynthAiPlugin
{
private bool _deathSeen;
+ // Leave Game On Death: armed at the death edge (the macro was running), done at the respawn edge.
+ private bool _logOutOnRespawn;
private readonly Queue _noComponentFails = new();
private long _packFullCheckedAt;
private bool _packFull;
@@ -32,6 +34,7 @@ public sealed partial class RynthAiPlugin
try { RecordDeathSpot(); } // where the corpse will be (RynthAiPlugin.OwnCorpse.cs)
catch (Exception ex) { Log($"[RynthAi] Death spot not recorded: {ex.Message}"); }
ArmDeathRecall(s); // before Stop Macro On Death: it reads whether the macro ran
+ _logOutOnRespawn = s.LeaveGameOnDeath is 1 or 2 && s.IsMacroRunning; // the same: before the stop below
if (s.StopMacroOnDeath && s.IsMacroRunning)
{
HandleMacroRunCommand("stop", Array.Empty(), "Stop Macro On Death");
@@ -44,6 +47,32 @@ public sealed partial class RynthAiPlugin
}
}
+ ///
+ /// The respawn edge with Leave Game On Death armed (R-20261202-160920-52c7): the macro stops, then the
+ /// client logs out (1: /logout, as /mt logout) or the game closes (2: /rc quit, as /mt quit). After the
+ /// respawn, not at the death: AC is in portal space to the lifestone until then. True when it left (or tried).
+ ///
+ private bool LogOutAfterDeath()
+ {
+ if (!_logOutOnRespawn) return false;
+ _logOutOnRespawn = false;
+ var s = _dashboard?.Settings;
+ if (s == null || s.LeaveGameOnDeath is not (1 or 2)) return false;
+ bool exit = s.LeaveGameOnDeath == 2;
+ _deathRecallArmed = false;
+ if (s.IsMacroRunning) HandleMacroRunCommand("stop", Array.Empty(), "Leave Game On Death");
+ if (!Host.HasInvokeChatParser)
+ {
+ ChatLine($"[RynthAi] Leave Game On Death: this RynthCore can't {(exit ? "close the game" : "log out")} for you - macro stopped instead.");
+ return true;
+ }
+ ChatLine(exit ? "[RynthAi] You died - closing the game (Leave Game On Death: exit the game)."
+ : "[RynthAi] You died - logging out (Leave Game On Death: log out).");
+ Log($"[RynthAi] Leave Game On Death: {(exit ? "/rc quit" : "/logout")} after the respawn.");
+ Host.InvokeChatParser(exit ? "/rc quit" : "/logout");
+ return true;
+ }
+
private long _deathHoldUntil;
private bool _deathHolding;
// When the character was last seen dead (TickCount64; 0 = not this session). The Dungeon Patrol
@@ -128,6 +157,7 @@ public sealed partial class RynthAiPlugin
else
{
Log("[RynthAi] Respawned — resuming.");
+ if (LogOutAfterDeath()) return hold; // Leave Game On Death: no recall, no corpse trip
try
{
// Recall On Death first; the corpse trip then starts from where it lands (EndDeathRecall).
diff --git a/Plugins/RynthCore.Plugin.RynthChat/ChatClassifier.cs b/Plugins/RynthCore.Plugin.RynthChat/ChatClassifier.cs
index 26df5fb..e795158 100644
--- a/Plugins/RynthCore.Plugin.RynthChat/ChatClassifier.cs
+++ b/Plugins/RynthCore.Plugin.RynthChat/ChatClassifier.cs
@@ -82,17 +82,33 @@ internal static class ChatClassifier
///
/// True for a line a player typed: say, tells both ways, emotes, allegiance, fellowship, every
/// channel line, an admin's tell, and a room line of any other type ("[Room] Name says, \"").
- /// Never plugin output, item info, combat or spell words.
+ /// Never plugin output, item info, combat or spell words, nor a tell from an NPC (0.4.1).
///
internal static bool IsPlayerChat(string channel, int chatType, string? text)
{
if (channel is Rynth or Items) return false;
+ if (IsNpcTell(chatType, text)) return false;
if (channel is Chat or Channels) return true;
if (chatType == 0x1F) return true; // AdminTell
if (channel == Combat) return false;
return LooksLikeSpeech(text);
}
+ ///
+ /// True for a tell an NPC sent you (0.4.1, 2026-12-02). The server sends NPC and player tells
+ /// alike (type 0x03); the client links the sender's name only for a player (sender id
+ /// 0x50000001-0x6FFFFFFF, HearDirectSpeech at 0x00572370), so a tell with no link is an NPC's.
+ /// The engine's ChatPlayerText.IsNpcTell has the same rule; keep the two the same.
+ ///
+ internal static bool IsNpcTell(int chatType, string? text)
+ {
+ if (chatType != 0x03 || string.IsNullOrEmpty(text)) return false;
+ string t = text.TrimStart();
+ if (t.StartsWith(" 0 && t.IndexOf('"', 0, at) < 0;
+ }
+
/// "[Tag] Name says, \"" / "[Tag] Name tells you, \"" (AC's name links allowed), or "You say ..., \"".
internal static bool LooksLikeSpeech(string? text)
{
diff --git a/Plugins/RynthCore.Plugin.RynthChat/RynthChatPlugin.cs b/Plugins/RynthCore.Plugin.RynthChat/RynthChatPlugin.cs
index 99206a7..722a33f 100644
--- a/Plugins/RynthCore.Plugin.RynthChat/RynthChatPlugin.cs
+++ b/Plugins/RynthCore.Plugin.RynthChat/RynthChatPlugin.cs
@@ -7,7 +7,7 @@ namespace RynthCore.Plugin.RynthChat;
public sealed class RynthChatPlugin : RynthPluginBase
{
internal static readonly IntPtr NamePointer = Marshal.StringToHGlobalAnsi("RynthChat");
- internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.4.0");
+ internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.4.1");
private readonly ChatBuffer _buffer = new();
diff --git a/Plugins/RynthCore.Plugin.RynthDefective/Appraisal/AppraisalText.cs b/Plugins/RynthCore.Plugin.RynthDefective/Appraisal/AppraisalText.cs
index abfb9f8..ae99c84 100644
--- a/Plugins/RynthCore.Plugin.RynthDefective/Appraisal/AppraisalText.cs
+++ b/Plugins/RynthCore.Plugin.RynthDefective/Appraisal/AppraisalText.cs
@@ -357,14 +357,25 @@ internal static class AppraisalText
if (s.Lines.Count > 0) doc.Sections.Add(s);
}
+ /// ACE's flag on an appraisal spell id that is an enchantment cast on the item.
+ internal const uint CastOnItemFlag = 0x80000000;
+
private static void Magic(AppraisalInput o, AppraisalDoc doc)
{
var s = new AppraiseSection("Magic");
if (o.Spells.Count > 0)
{
+ // ACE flags the enchantments cast on an item (0x80000000): a shirt worn under armor
+ // listed the player's banes as its own spells (#rynth-issues 2026-12-01).
var names = new List(o.Spells.Count);
- foreach (uint id in o.Spells) names.Add(o.SpellName(id));
- s.Add("Spells: " + string.Join(", ", names), AppraiseTone.Magic);
+ var buffs = new List();
+ foreach (uint id in o.Spells)
+ {
+ if ((id & CastOnItemFlag) != 0) buffs.Add(o.SpellName(id & 0xFFFF));
+ else names.Add(o.SpellName(id));
+ }
+ if (names.Count > 0) s.Add("Spells: " + string.Join(", ", names), AppraiseTone.Magic);
+ if (buffs.Count > 0) s.Add("Buffs on it: " + string.Join(", ", buffs), AppraiseTone.Dim);
}
if (o.DataIds.TryGetValue(DSpell, out uint spell) && spell != 0 && !o.Spells.Contains(spell))
s.Add("Spell: " + o.SpellName(spell), AppraiseTone.Magic);
diff --git a/Plugins/RynthCore.Plugin.RynthInventory/Views/InventoryView.cs b/Plugins/RynthCore.Plugin.RynthInventory/Views/InventoryView.cs
index e712529..c2b5b12 100644
--- a/Plugins/RynthCore.Plugin.RynthInventory/Views/InventoryView.cs
+++ b/Plugins/RynthCore.Plugin.RynthInventory/Views/InventoryView.cs
@@ -286,8 +286,11 @@ internal sealed partial class InventoryView
if (!drew) w.Dummy(size, size);
}
+ /// " x25" for a stack; " (12 uses)" for a kit, lockpick or essence, as AC shows its uses left.
private static string StackText(ItemRecord it) =>
- it.Stack > 1 ? " x" + it.Stack.ToString("N0", CultureInfo.InvariantCulture) : string.Empty;
+ it.Stack > 1 ? " x" + it.Stack.ToString("N0", CultureInfo.InvariantCulture)
+ : it.MaxUses > 0 ? " (" + it.Uses.ToString("N0", CultureInfo.InvariantCulture) + (it.Uses == 1 ? " use)" : " uses)")
+ : string.Empty;
private bool IsStale(DateTime seenUtc) =>
seenUtc != default && (_c.UtcNow - seenUtc).TotalDays >= Math.Max(1, _c.Settings.StaleDays);
diff --git a/Plugins/RynthCore.Plugin.RynthNav/NavPathQuery.cs b/Plugins/RynthCore.Plugin.RynthNav/NavPathQuery.cs
index fe40b54..630f5e8 100644
--- a/Plugins/RynthCore.Plugin.RynthNav/NavPathQuery.cs
+++ b/Plugins/RynthCore.Plugin.RynthNav/NavPathQuery.cs
@@ -99,6 +99,79 @@ internal static class NavPathQuery
return r;
}
+ // ── Crumbs (2026-12-03, the Yanshi Thread B470) ──────────────────────────────────────────────────
+ // The mesh keeps its agent radius from every wall, and in a doorway that can leave a few polygons of its
+ // own: a crumb, joined to nothing. A walk planned from one reaches nowhere. The hunt stood for minutes in
+ // building #3's doorway with thirty monsters round it, every walk "the goal can't be reached" or ending on
+ // the crumb; two steps back, on the street, it hunted again. A walk that starts on a crumb steps off it
+ // first: to the nearest ground of a bigger piece within CrumbStepUnits, a step the character can take.
+
+ /// A piece of the mesh of at most this many polygons, joined to nothing bigger, is a crumb.
+ public const int CrumbMaxPolys = 24;
+ /// How far round a start on a crumb the ground it was cut off from is looked for (world units).
+ public const float CrumbStepUnits = 3.0f;
+ /// How far up or down from the start that ground may be (world units).
+ public const float CrumbStepRise = 2.0f;
+
+ /// The polygons of 's piece when it is a crumb (at most ), else null.
+ internal static HashSet? CrumbOf(DtNavMeshQuery q, long start)
+ {
+ if (start == 0) return null;
+ DtNavMesh nav = q.GetAttachedNavMesh();
+ var seen = new HashSet { start };
+ var stack = new Stack();
+ stack.Push(start);
+ while (stack.Count > 0)
+ {
+ long r = stack.Pop();
+ if (nav.GetTileAndPolyByRef(r, out DtMeshTile tile, out DtPoly poly).Failed() || tile?.links == null || poly == null) continue;
+ for (int i = poly.firstLink; i != DtDetour.DT_NULL_LINK && i >= 0 && i < tile.links.Length; i = tile.links[i].next)
+ {
+ long nb = tile.links[i].refs;
+ if (nb == 0 || !seen.Add(nb)) continue;
+ if (seen.Count > CrumbMaxPolys) return null;
+ stack.Push(nb);
+ }
+ }
+ return seen;
+ }
+
+ ///
+ /// The ground nearest (Detour axes) within across and
+ /// up or down that isn't on or another crumb. 0 when
+ /// there is none. Every polygon in the box is looked at (Detour's nearest-polygon lookup would keep
+ /// handing back the crumb itself).
+ ///
+ internal static long StepOffCrumb(DtNavMeshQuery q, RcVec3f start, HashSet crumb, IDtQueryFilter filter, out RcVec3f pt,
+ float reach = CrumbStepUnits)
+ {
+ pt = default;
+ var polys = new long[256];
+ q.QueryPolygons(start, new RcVec3f(reach, CrumbStepRise, reach), filter, polys, out int pc, polys.Length);
+ long best = 0;
+ double bestD = double.MaxValue;
+ var small = new HashSet(crumb); // polygons known to be on a crumb
+ var big = new HashSet(); // and on a bigger piece
+ for (int i = 0; i < pc; i++)
+ {
+ long r = polys[i];
+ if (small.Contains(r)) continue;
+ if (q.ClosestPointOnPoly(r, start, out RcVec3f cp, out _).Failed()) continue;
+ double flat = Math.Sqrt((cp.X - start.X) * (cp.X - start.X) + (cp.Z - start.Z) * (cp.Z - start.Z));
+ double rise = Math.Abs(cp.Y - start.Y);
+ if (flat > reach || rise > CrumbStepRise) continue;
+ double d = flat + 0.5 * rise;
+ if (d >= bestD) continue;
+ if (!big.Contains(r))
+ {
+ if (CrumbOf(q, r) is HashSet other) { small.UnionWith(other); continue; }
+ big.Add(r);
+ }
+ best = r; bestD = d; pt = cp;
+ }
+ return best;
+ }
+
///
/// How far past a circle's edge the plain corridor's straight path must stay, everywhere, for it to be
/// taken over the corridor round the circles (): the corners pushed off the walls
@@ -249,6 +322,22 @@ internal static class NavPathQuery
q.FindNearestPoly(new RcVec3f((float)gx, (float)gz, (float)gy), WideExtents, plain, out long gRef, out RcVec3f gPt, out _);
if (gRef == 0) return r.Fail(RynthNavPathApiV1.ResultNoMesh, "no navmesh at the goal");
+ // A start on a crumb (unless the goal is on it too): the walk steps off it first. A goal on one: the
+ // walk goes to the ground beside it and steps onto it last.
+ RcVec3f crumbStart = sPt, crumbGoal = gPt;
+ bool stepped = false, steppedGoal = false;
+ HashSet? sCrumb = CrumbOf(q, sRef), gCrumb = CrumbOf(q, gRef);
+ if (sCrumb != null && !sCrumb.Contains(gRef) && StepOffCrumb(q, sPt, sCrumb, plain, out RcVec3f sOff) is long sNew && sNew != 0)
+ {
+ sRef = sNew; sPt = sOff; stepped = true;
+ r.SteppedOff = FlatUnits(crumbStart, sOff);
+ }
+ if (gCrumb != null && !gCrumb.Contains(sRef) && StepOffCrumb(q, gPt, gCrumb, plain, out RcVec3f gOff) is long gNew && gNew != 0)
+ {
+ gRef = gNew; gPt = gOff; steppedGoal = true;
+ r.GoalSteppedOff = FlatUnits(crumbGoal, gOff);
+ }
+
bool avoid = (flags & RynthNavPathApiV1.PathAvoidPortals) != 0 && portals != null && portals.Portals.Count > 0;
if (avoid) { portals!.AllowA = sRef; portals.AllowB = gRef; }
r.Portals = avoid ? portals!.Portals.Count : 0;
@@ -298,6 +387,11 @@ internal static class NavPathQuery
r.Bent = wps.Count - before;
}
if ((flags & RynthNavPathApiV1.PathWallClearance) != 0) r.Pushed = PushFromWalls(q, wps, wallClearance, plain, ZAt);
+ // Stepped off a crumb: the walk starts where the character stands, the step its first leg; a goal on
+ // one is its last leg.
+ if (stepped) wps.Insert(0, (crumbStart.X, crumbStart.Z));
+ bool goalLeg = steppedGoal && !partial; // only on a walk that gets beside it
+ if (goalLeg) wps.Add((crumbGoal.X, crumbGoal.Z));
int limit = Math.Max(2, maxCorners);
if (wps.Count > limit)
@@ -305,7 +399,7 @@ internal static class NavPathQuery
if ((flags & RynthNavPathApiV1.PathAllowPartial) == 0)
return r.Fail(RynthNavPathApiV1.ResultNoPath, $"{wps.Count} corners, room for {limit}");
wps.RemoveRange(limit, wps.Count - limit); // the first stretch of the way; plan again from its end
- partial = true; r.Truncated = true;
+ partial = true; r.Truncated = true; goalLeg = false;
}
for (int i = 0; i < wps.Count; i++)
@@ -314,6 +408,8 @@ internal static class NavPathQuery
double z = double.NaN;
for (int k = 0; k < ox.Length && double.IsNaN(z); k++)
if (ox[k] == x && oy[k] == y) z = oz[k]; // a corner Detour gave: its own height
+ if (double.IsNaN(z) && stepped && i == 0) z = crumbStart.Y; // the crumb's own height
+ if (double.IsNaN(z) && goalLeg && i == wps.Count - 1) z = crumbGoal.Y;
if (double.IsNaN(z)) z = HeightAt(q, plain, x, y, ZAt(x, y));
r.Corners.Add((x, y, z));
if (i > 0)
@@ -329,6 +425,8 @@ internal static class NavPathQuery
return r.Code;
}
+ private static double FlatUnits(RcVec3f a, RcVec3f b) => Math.Sqrt((a.X - b.X) * (a.X - b.X) + (a.Z - b.Z) * (a.Z - b.Z));
+
/// The mesh's height under (x, y) near ; the guess when there's no polygon there.
private static double HeightAt(DtNavMeshQuery q, IDtQueryFilter filter, double x, double y, float zGuess)
{
@@ -373,6 +471,10 @@ internal sealed class PathExResult
/// The plain corridor was taken: shorter than the way round the circles, and clear of them all (NavPathQuery.Corridor).
public bool PlainClear;
public int Polys, Portals, Bent, Pushed;
+ /// The start was on a crumb (NavPathQuery.CrumbOf): how far the walk's first leg steps off it; 0 = it wasn't.
+ public double SteppedOff;
+ /// The goal was on a crumb: how far its last leg steps onto it; 0 = it wasn't.
+ public double GoalSteppedOff;
public string Note = "";
public void Reset()
@@ -382,6 +484,7 @@ internal sealed class PathExResult
Length = EndDistance = 0;
Partial = Truncated = FellBack = PlainClear = false;
Polys = Portals = Bent = Pushed = 0;
+ SteppedOff = GoalSteppedOff = 0;
Note = "";
}
diff --git a/Plugins/RynthCore.Plugin.RynthNav/RynthNavPlugin.PathApi.cs b/Plugins/RynthCore.Plugin.RynthNav/RynthNavPlugin.PathApi.cs
index 181379e..516fc83 100644
--- a/Plugins/RynthCore.Plugin.RynthNav/RynthNavPlugin.PathApi.cs
+++ b/Plugins/RynthCore.Plugin.RynthNav/RynthNavPlugin.PathApi.cs
@@ -120,6 +120,8 @@ public sealed partial class RynthNavPlugin
string extras = "";
if (r.Portals > 0) extras += $"; {r.Portals} portal(s) avoided{(r.FellBack ? " (no way round them: plain path)" : r.PlainClear ? " (the plain path, shorter and clear of them)" : "")}{(r.Bent > 0 ? $", bent round {r.Bent}" : "")}";
if (r.Pushed > 0) extras += $"; {r.Pushed} corner(s) {_wallClearance:0.#} m off the walls";
+ if (r.SteppedOff > 0) extras += $"; the start was on a cut-off crumb of the mesh: the first leg steps {r.SteppedOff:F1}u off it";
+ if (r.GoalSteppedOff > 0) extras += $"; the goal is on a cut-off crumb of the mesh: the last leg steps {r.GoalSteppedOff:F1}u onto it";
Host.Log($"[RynthNav] path request ex (flags 0x{flags:X}): {what}{extras}; ({sx:F0},{sy:F0}) -> ({gx:F0},{gy:F0}), {_tileCount} tiles, {ms:F1} ms");
}
return r.Code;
diff --git a/Plugins/Shared/ActionPacer.cs b/Plugins/Shared/ActionPacer.cs
index 6d9f21a..1bbaf3b 100644
--- a/Plugins/Shared/ActionPacer.cs
+++ b/Plugins/Shared/ActionPacer.cs
@@ -250,6 +250,24 @@ internal static class ActionPacer
}
}
+ ///
+ /// The server refused the use of with a chat line and no UseDone ("The ...
+ /// cannot be used"): that line is its answer, so the use stops holding the others
+ /// (R-20261204-162443-5c2b: each refused summon held combat for the 3.5 s answer wait). True
+ /// when it was the use waiting.
+ ///
+ public static bool NoteRefused(uint id)
+ {
+ lock (Gate)
+ {
+ if (_cur == null || id == 0 || _cur.Id != id) return false;
+ if (_cur.Kind != PacedKind.ItemUse && _cur.Kind != PacedKind.WorldUse) return false;
+ _cur = null;
+ _answered++;
+ return true;
+ }
+ }
+
/// Forget the outstanding action (logout, death, portal): the server dropped it.
public static void Forget(string why)
{
diff --git a/Plugins/Shared/RynthAiHubApi.cs b/Plugins/Shared/RynthAiHubApi.cs
index 981013d..ab5100c 100644
--- a/Plugins/Shared/RynthAiHubApi.cs
+++ b/Plugins/Shared/RynthAiHubApi.cs
@@ -206,8 +206,10 @@ public unsafe struct RynthAiHubApiV1
///
/// BackAwayFrom(objectId, radiusYards, holdMs): a server plugin's "get out of this radius now" (RynthILT:
/// the Empyrean Handler's lethal ring). RynthAi stops attacking, faces directly away from the object and
- /// runs until outside the radius plus a margin (re-aiming as it goes; at most a few seconds), holds its
- /// attacks until then and re-engages the same target; the radius is at least the player's Ring Range.
+ /// runs until outside the radius plus a margin (re-aiming as it goes), stands clear there until 5 s
+ /// after the request (running again if the object comes closer), holds its attacks until then and
+ /// re-engages the same target; the radius is at least the player's Ring Range. The same object asked
+ /// about again while it holds starts the 5 s over (returns BackAwayStarted).
/// On an engine without heading snap or autorun it run-back jumps instead (holdMs = the jump's charge,
/// 100-3000). Only while RynthAi's macro runs with combat
/// on. Returns and the other BackAway* results. Pump thread.
diff --git a/Shared/RynthCore.LootSdk/Editing/LootRuleText.cs b/Shared/RynthCore.LootSdk/Editing/LootRuleText.cs
index 3c540c3..68137f2 100644
--- a/Shared/RynthCore.LootSdk/Editing/LootRuleText.cs
+++ b/Shared/RynthCore.LootSdk/Editing/LootRuleText.cs
@@ -65,6 +65,9 @@ public static class LootRuleText
(362, "SummoningMastery"), (364, "UseLevelRequirement"), (366, "UseRequiresSkill"),
(368, "UseRequiresSkillSpec"), (369, "UseRequiresLevel"),
(179, "ImbuedEffect"), (265, "EquipmentSetId (armor set)"),
+ // #rynth-issues 11-30 "some missing labels on loot rules": cloak rules showed "key 176" and
+ // "key 352" where VTank's editor names them. VTank's names first, ACE's after.
+ (176, "ActivationReqSkillId (AppraisalItemSkill)"), (352, "CloakChanceType (CloakWeaveProc)"),
(218, "EquippedSlots"), (353, "WeaponType"), (370, "DamageRating"), (371, "DamageResistRating"),
(372, "CritRating"), (373, "CritResistRating"), (374, "CritDamageRating"),
(375, "CritDamageResistRating"), (376, "HealBoostRating"), (377, "NetherResistRating"), (379, "VitalityRating"),
diff --git a/Tools/RynthCore.LootSdkTests/LootAddAttributeTests.cs b/Tools/RynthCore.LootSdkTests/LootAddAttributeTests.cs
index 55c87d5..73db7b3 100644
--- a/Tools/RynthCore.LootSdkTests/LootAddAttributeTests.cs
+++ b/Tools/RynthCore.LootSdkTests/LootAddAttributeTests.cs
@@ -232,6 +232,9 @@ internal static partial class Program
Check(LootRuleText.LongKeys.Any(k => k.Id == 9053) && LootRuleText.LongKeys.Any(k => k.Id == 9075), "vocab: pet keys named");
Check(LootRuleText.LongKeys.Any(k => k.Id == 92 && k.Name.StartsWith("UsesRemaining")), "vocab: 92 is uses remaining");
Check(LootRuleText.LongKeys.Any(k => k.Id == 107 && k.Name == "ItemCurMana") && LootRuleText.LongKeys.Any(k => k.Id == 108 && k.Name == "ItemMaxMana"), "vocab: current and max mana");
+ // #rynth-issues 11-30: cloak rules showed "key 176" / "key 352".
+ Check(LootRuleText.LongKeys.Any(k => k.Id == 176 && k.Name.StartsWith("ActivationReqSkillId"))
+ && LootRuleText.LongKeys.Any(k => k.Id == 352 && k.Name.StartsWith("CloakChanceType")), "vocab: cloak keys named as VTank names them");
var ids = LootRuleText.LongKeys.Select(k => k.Id).ToList();
Eq(ids.Count, ids.Distinct().Count(), "vocab: no long key named twice");
}
diff --git a/Tools/RynthCore.RynthAiHostTests/Program.cs b/Tools/RynthCore.RynthAiHostTests/Program.cs
index a5dc7c7..4eeec73 100644
--- a/Tools/RynthCore.RynthAiHostTests/Program.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Program.cs
@@ -173,6 +173,7 @@ internal static class Program
InstallPathsTests.Register(runner);
PetRefillTests.Register(runner);
PetSummonStopsTests.Register(runner);
+ PetNotAnEssenceTests.Register(runner);
PetSelectionTests.Register(runner);
PetElementTests.Register(runner);
AutoStackTests.Register(runner);
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/BackAwayTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/BackAwayTests.cs
index 5fb1a93..9648927 100644
--- a/Tools/RynthCore.RynthAiHostTests/Tests/BackAwayTests.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/BackAwayTests.cs
@@ -11,7 +11,8 @@ namespace RynthCore.RynthAiHostTests.Tests;
// BackAwayFrom). It was the Empyrean Handler lethal-ring evade (Silentkelpie's PR 12) until 2026-10-20,
// when the Handler's detection and its setting went to RynthILT (Infinite Leaftide content); RynthAi
// keeps the generic part: stop attacking, run away (face directly away, autorun until outside the radius
-// plus a margin, re-aiming as it goes), hold attacks until clear, then re-engage. A single back-jump until
+// plus a margin, re-aiming as it goes), hold attacks until clear and the stay-out is over (the danger goes
+// off a few seconds after the request; R-20261204-122802-7806), then re-engage. A single back-jump until
// 2026-11-27 (it covers a yard or two); it stays only for an engine without heading snap / autorun
// (spotted by SilentKelpie, Forgejo rynth PR #12). Gated: only while the macro is running with combat on,
// and only inside the radius (at least Ring Range). RynthAi alone never reacts to the Handler's line.
@@ -24,8 +25,9 @@ internal static class BackAwayTests
public static void Register(Runner r)
{
- r.Add("back away: inside the radius with the macro running and combat on, runs away (faces away, autorun on, no back-jump); not now while it runs", Runs);
- r.Add("back away: the run re-aims away, holds attacks, stops outside the radius plus the margin (autorun off) and re-engages", RunEnds);
+ r.Add("back away: inside the radius with the macro running and combat on, runs away (faces away, autorun on, no back-jump); the same danger again renews it", Runs);
+ r.Add("back away: the run re-aims away, holds attacks, stops outside the radius plus the margin (autorun off) and re-engages after the stay-out", RunEnds);
+ r.Add("back away: clear early, it stands out until the danger has gone off, runs again if it comes closer, and a second request renews the stay-out", StaysOut);
r.Add("back away: the run ends with autorun off when the macro stops, combat goes off, the danger is gone or it times out", RunStops);
r.Add("back away: an engine without heading snap or autorun gets the old back-jump", JumpFallback);
r.Add("back away: not with the macro stopped or combat off", Gated);
@@ -92,8 +94,10 @@ internal static class BackAwayTests
Check.True(FakeHost.AutoRun, "autorun on");
Check.True(Math.Abs(FakeHost.HeadingDeg - 180.0) < 1.0, $"faces directly away (the danger is north; heading {FakeHost.HeadingDeg:0})");
Check.True(rig.Combat.BackAwayActive, "combat holds while it runs");
- Check.Eq(rig.Ask(), RynthAiHub.BackAwayNotNow, "a second request while running: not now");
Check.True(FakeHost.Logs.Exists(l => l.Contains("[CombatEvade]") && l.Contains("running away")), "logged as a run");
+ Check.Eq(rig.Ask(), RynthAiHub.BackAwayStarted, "the same danger again while running: renewed");
+ Check.True(FakeHost.Logs.Exists(l => l.Contains("again") && l.Contains("staying out")), "logged as renewed");
+ Check.Eq(rig.Jumps, 0, "still no back-jump");
});
private static void RunEnds() => OnClock(() =>
@@ -115,13 +119,65 @@ internal static class BackAwayTests
MoveSouth(12f); // 17 yards from it: outside 12 + 4
_now = _now.AddMilliseconds(300);
- Check.False(Think(rig), "clear: Think re-engages");
+ Check.True(Think(rig), "clear early: still holding (the danger hasn't gone off yet)");
+ Check.False(FakeHost.AutoRun, "standing: autorun off");
+ Check.True(rig.Combat.BackAwayActive, "still held");
+
+ _now = _now.AddMilliseconds(CombatManager.BackAwayStayOutMs);
+ Check.False(Think(rig), "clear and the stay-out is over: Think re-engages");
Check.False(FakeHost.AutoRun, "autorun off");
Check.False(rig.Combat.BackAwayActive, "no longer held");
Check.True(FakeHost.Logs.Exists(l => l.Contains("Back away done") && l.Contains("clear at")), "logged as clear");
Check.Eq(rig.Ask(), RynthAiHub.BackAwayOutside, "a new request out here: outside");
});
+ // R-20261204-122802-7806: clear 1.5 s after the request, re-engaged at once, walked back into the ring
+ // and died at 4 s. Now it stands clear until the stay-out is over.
+ private static void StaysOut() => OnClock(() =>
+ {
+ var rig = new Rig(dangerYards: 5);
+ DateTime start = _now;
+ rig.Ask(radius: 12);
+ MoveSouth(12.2f); // 17.2 yards from it at 1.5 s
+ _now = start.AddMilliseconds(1_540);
+ Check.True(Think(rig), "clear at 1.5 s: attacks still held");
+ Check.False(FakeHost.AutoRun, "standing clear: autorun off");
+ Check.True(FakeHost.Logs.Exists(l => l.Contains("standing clear")), "logged as standing");
+
+ _now = start.AddMilliseconds(2_500);
+ Check.True(Think(rig), "2.5 s: still standing out");
+ Check.False(FakeHost.AutoRun, "autorun stays off while it stands");
+
+ // The danger comes closer: 15.6 yards is inside 16 but not 1 yard inside: still standing.
+ FakeHost.Positions[Danger] = (Lb | 0x1C, 96f, 96f - 12.2f + 15.6f, 0f);
+ _now = start.AddMilliseconds(2_800);
+ Check.True(Think(rig), "a little closer: still held");
+ Check.False(FakeHost.AutoRun, "less than a yard inside: still standing");
+
+ // 14 yards: runs again, away from it.
+ FakeHost.Positions[Danger] = (Lb | 0x1C, 96f, 96f - 12.2f + 14f, 0f);
+ FakeHost.HeadingDeg = 0;
+ _now = start.AddMilliseconds(3_100);
+ Check.True(Think(rig), "closer: still held");
+ Check.True(FakeHost.AutoRun, "runs again");
+ Check.True(Math.Abs(FakeHost.HeadingDeg - 180.0) < 1.0, $"away from it (heading {FakeHost.HeadingDeg:0})");
+ Check.True(FakeHost.Logs.Exists(l => l.Contains("running again")), "logged");
+
+ // Clear again at 4 s, then the same danger is asked about again at 4.5 s: the stay-out starts over.
+ MoveSouth(12.2f + 4f); // 18 yards
+ _now = start.AddMilliseconds(4_000);
+ Check.True(Think(rig), "clear again: held");
+ Check.False(FakeHost.AutoRun, "standing");
+ _now = start.AddMilliseconds(4_500);
+ Check.Eq(rig.Ask(radius: 12), RynthAiHub.BackAwayStarted, "a second request while standing out: renewed");
+ _now = start.AddMilliseconds(6_000);
+ Check.True(Think(rig), "6 s: the renewed stay-out still holds");
+ _now = start.AddMilliseconds(9_600);
+ Check.False(Think(rig), "past the renewed stay-out: re-engages");
+ Check.False(rig.Combat.BackAwayActive, "over");
+ Check.False(FakeHost.AutoRun, "autorun off");
+ });
+
private static void RunStops() => OnClock(() =>
{
var macro = new Rig(5);
@@ -158,7 +214,11 @@ internal static class BackAwayTests
MoveSouth(12f);
_now = _now.AddMilliseconds(500);
orphan.Combat.PollBackAway();
- Check.False(orphan.Combat.BackAwayActive, "the poll ended it once clear");
+ Check.True(orphan.Combat.BackAwayActive, "the poll stood it clear (stay-out not over)");
+ Check.False(FakeHost.AutoRun, "standing: autorun off");
+ _now = _now.AddMilliseconds(CombatManager.BackAwayStayOutMs);
+ orphan.Combat.PollBackAway();
+ Check.False(orphan.Combat.BackAwayActive, "the poll ended it once clear and the stay-out was over");
Check.False(FakeHost.AutoRun, "autorun off");
});
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/CommandReplyTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/CommandReplyTests.cs
index 8469b85..cd089e8 100644
--- a/Tools/RynthCore.RynthAiHostTests/Tests/CommandReplyTests.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/CommandReplyTests.cs
@@ -26,6 +26,7 @@ internal static class CommandReplyTests
public static void Register(Runner r)
{
r.Add("command replies: CommandReply - typed always answers, a script's success is quiet, errors once a minute", HelperRules);
+ r.Add("leave game on death (R-20261202-160920-52c7): armed at a death with the macro on; at the respawn /logout (1) or /rc quit (2); off or macro off: nothing; the setting saves, bridges, maps", LogOutOnDeath);
r.Add("day/night timer (R-20261202-122606-0b16): RynthAi's now - its window in the manifest, /ra daynight show|hide|clear|box, /rdef's hand-over", DayNightInRynthAi);
r.Add("command replies: every typed command answers in chat, never with the catch-all line", TypedAlwaysAnswers);
r.Add("command replies: a typed command's wrong form answers with a failure line (the failure colour)", TypedWrongFormsFail);
@@ -525,6 +526,66 @@ internal static class CommandReplyTests
finally { RynthAiPlugin.GameClockOverride = null; }
}
+ // R-20261202-160920-52c7: "need another program or feature or something to be able to log out when death happens".
+ // It became a RynthAi setting, Leave Game On Death.
+ private static void LogOutOnDeath()
+ {
+ static void Die(Rig rig)
+ {
+ var v = (PlayerVitalsCache)rig.Get("_vitals")!;
+ v.MaxHealth = 100;
+ v.CurrentHealth = 0;
+ rig.Call("CheckPlayerDeath", rig.S);
+ }
+
+ // 1 = log out, 2 = exit the game.
+ foreach (var (mode, cmd, said) in new[] { (1, "/logout", "logging out"), (2, "/rc quit", "closing the game") })
+ {
+ using var rig = new Rig();
+ rig.S.LeaveGameOnDeath = mode;
+ rig.S.IsMacroRunning = true;
+ Die(rig);
+ Check.True((bool)rig.Get("_logOutOnRespawn")!, $"mode {mode}: died with the macro on: armed");
+ Check.False(FakeHost.ChatCommands.Contains(cmd), $"mode {mode}: nothing at the death (AC is going to the lifestone)");
+ var lines = Rig.Lines(() => Check.True((bool)rig.Call("LogOutAfterDeath")!, $"mode {mode}: the respawn: leaves"));
+ Check.True(FakeHost.ChatCommands.Contains(cmd), $"mode {mode}: {cmd} sent: " + string.Join(" | ", FakeHost.ChatCommands));
+ Check.Eq(FakeHost.ChatCommands.Count(c => c is "/logout" or "/rc quit"), 1, $"mode {mode}: only that one");
+ Check.False(rig.S.IsMacroRunning, $"mode {mode}: the macro stopped");
+ Check.True(lines.Any(l => l.Text.Contains(said, StringComparison.Ordinal)), $"mode {mode}: said in chat");
+ Check.False((bool)rig.Call("LogOutAfterDeath")!, $"mode {mode}: once only");
+ }
+ using (var off = new Rig())
+ {
+ off.S.IsMacroRunning = true;
+ Die(off);
+ Check.False((bool)off.Call("LogOutAfterDeath")!, "off (the default): nothing");
+ Check.False(FakeHost.ChatCommands.Any(c => c is "/logout" or "/rc quit"), "nothing sent");
+ }
+ using (var idle = new Rig())
+ {
+ idle.S.LeaveGameOnDeath = 1;
+ idle.S.IsMacroRunning = false;
+ Die(idle);
+ Check.False((bool)idle.Call("LogOutAfterDeath")!, "the macro wasn't running (you were playing): stays");
+ }
+
+ // The setting: off by default, an older profile loads off; saved, bridged (absent = unchanged), in the settings map.
+ Check.Eq(new LegacyUiSettings().LeaveGameOnDeath, 0, "off by default");
+ var old = System.Text.Json.JsonSerializer.Deserialize("{\"StopMacroOnDeath\":true}", RynthAiJsonContext.Default.LegacyUiSettings);
+ Check.True(old != null && old.LeaveGameOnDeath == 0, "an older profile: off");
+ var saved = System.Text.Json.JsonSerializer.Deserialize(
+ System.Text.Json.JsonSerializer.Serialize(new LegacyUiSettings { LeaveGameOnDeath = 2 }, RynthAiJsonContext.Default.LegacyUiSettings),
+ RynthAiJsonContext.Default.LegacyUiSettings);
+ Check.True(saved != null && saved.LeaveGameOnDeath == 2, "exit the game is saved and loaded");
+ var payload = System.Text.Json.JsonSerializer.Deserialize("{\"PatrolOnLogin\":false}", RynthAiJsonContext.Default.SettingsBridgePayload);
+ Check.True(payload != null && payload.LeaveGameOnDeath == null, "an older engine's payload has no value (left alone)");
+ var live = new LegacyUiSettings();
+ var map = ExpressionTests.Engine(settings: live).BuildSettingsMapPublic();
+ Check.True(map.TryGetValue("LeaveGameOnDeath", out var entry), "in the settings map");
+ entry.Set("9");
+ Check.Eq(live.LeaveGameOnDeath, 2, "set through the map, held to 0-2");
+ }
+
private sealed class Rig : IDisposable
{
public readonly RynthAiPlugin P = new();
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/CorpseCloseTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/CorpseCloseTests.cs
index 558fd98..d7f553d 100644
--- a/Tools/RynthCore.RynthAiHostTests/Tests/CorpseCloseTests.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/CorpseCloseTests.cs
@@ -45,6 +45,7 @@ internal static class CorpseCloseTests
r.Add("loot timeout: a pickup held for a cast's answer does not time the corpse out; the pickup goes on the answer", HeldPickupKeepsCorpseClock);
r.Add("loot timeout: an unheld stall (nothing to take, nothing held) still times the corpse out", UnheldStallStillTimesOut);
r.Add("corpse close: the close is held back only when the next corpse can be claimed now (not while buffing), and a hold that starts later ends the wait", DeferredCloseNeedsClaimableCorpse);
+ r.Add("corpse claim (R-20261204-051349-d8d0): a corpse the client still shows open but far off or nowhere is not claimed (logged once); one near is", StaleOpenNotClaimed);
}
private static long _now;
@@ -179,6 +180,34 @@ internal static class CorpseCloseTests
Check.True(bot.Completed(CorpseA), "corpse A is completed");
}
+ // The engine's open container stays the last ViewContents until its StopViewing: a corpse from
+ // hours before was claimed again every time its completed mark aged out (30 min) and ended
+ // "Nothing to loot on ...".
+ private static void StaleOpenNotClaimed() => Clocked(() =>
+ {
+ World(twoCorpses: false);
+ FakeHost.Positions.Remove(CorpseA); // long gone from the client's world
+ var host = FakeHost.Create(Player);
+ var bot = new Bot(host);
+ bot.Create(CorpseA, GemA);
+ FakeHost.GroundContainer = CorpseA;
+ bot.TickFor(200);
+ Check.Eq(bot.Get("_openedContainerId"), 0, "no position: not claimed");
+ Check.False(Logged("reconciled open corpse"), "no reconcile");
+ Check.True(Logged($"the client still shows 0x{CorpseA:X8} open, but it is nowhere near: not claimed"), "logged");
+ Check.Eq(FakeHost.Logs.Count(l => l.Contains("not claimed")), 1, "once, not every tick");
+
+ FakeHost.Positions[CorpseA] = (Me0.Cell, Me0.X + 150f, Me0.Y, Me0.Z); // 150 m off
+ bot.TickFor(200);
+ Check.Eq(bot.Get("_openedContainerId"), 0, "150 m off: not claimed");
+ Check.False(FakeHost.Uses.Contains(CorpseA), "and not walked to");
+
+ FakeHost.Positions[CorpseA] = (Me0.Cell, Me0.X + 1f, Me0.Y, Me0.Z); // really open, beside the character
+ bot.Tick();
+ Check.Eq(bot.Get("_openedContainerId"), unchecked((int)CorpseA), "1 m off: claimed");
+ Check.True(Logged("reconciled open corpse"), "as a reconcile");
+ });
+
private static void NextCorpseWithoutClose() => Clocked(() =>
{
World(twoCorpses: true);
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/ExpressionTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/ExpressionTests.cs
index 852b7e5..7b0788a 100644
--- a/Tools/RynthCore.RynthAiHostTests/Tests/ExpressionTests.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/ExpressionTests.cs
@@ -45,6 +45,7 @@ internal static class ExpressionTests
r.Add("expr: ub-IT's remaining functions answer (no-equivalent ones with ub-IT's empty values)", UbCompatFunctions);
r.Add("expr: object type, options and unknown functions", TypesOptionsUnknown);
r.Add("expr: RynthAi settings and meta state from expressions", SettingsAndState);
+ r.Add("expr: Patrol On Login and Hunt On Login read and set as one choice (12-01)", LoginStartSettings);
r.Add("expr: character properties, skills, vitals through the host", CharacterFunctions);
r.Add("expr: position and coordinate functions", Coordinates);
r.Add("expr: spell expiration", SpellExpiration);
@@ -735,6 +736,23 @@ internal static class ExpressionTests
Is(e, "vtgetmeta[]", "Conquest 10");
}
+ private static void LoginStartSettings()
+ {
+ var s = new LegacyUiSettings();
+ var e = Engine(settings: s);
+ Is(e, "ragetsetting[PatrolOnLogin]", "0");
+ Is(e, "ragetsetting[HuntOnLogin]", "0");
+ Is(e, "rasetsetting[PatrolOnLogin, 1]", "1");
+ Check.True(s.PatrolOnLogin && !s.HuntOnLogin, "Patrol On Login on");
+ Is(e, "ragetsetting[patrolonlogin]", "1");
+ Is(e, "rasetsetting[HuntOnLogin, true]", "1");
+ Check.True(!s.PatrolOnLogin && s.HuntOnLogin, "Hunt On Login on clears Patrol On Login (one choice, as the boxes)");
+ Is(e, "rasetsetting[PatrolOnLogin, 0]", "1");
+ Check.True(!s.PatrolOnLogin && s.HuntOnLogin, "Patrol On Login off leaves Hunt On Login");
+ Is(e, "rasetsetting[HuntOnLogin, 0]", "1");
+ Check.True(!s.PatrolOnLogin && !s.HuntOnLogin, "both off");
+ }
+
private static void CharacterFunctions()
{
FakeHost.Reset();
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/OffhandTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/OffhandTests.cs
index 3507cf7..b912005 100644
--- a/Tools/RynthCore.RynthAiHostTests/Tests/OffhandTests.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/OffhandTests.cs
@@ -56,6 +56,8 @@ internal static class OffhandTests
r.Add("weapons: vitae doesn't leave out a weapon whose requirement is the base skill (the Shashqa at 40% vitae)", VitaeAndBaseSkillRequirement);
r.Add("offhand: no Dual Wield skill -> the shield", NoSkillShield);
r.Add("offhand: None -> hands off (a worn shield is never taken off)", NoneHandsOff);
+ r.Add("offhand (#rynth-issues 11-28): after buffing stowed both dual-wield weapons, the old main one goes back in the off hand", DualPairBackAfterBuff);
+ r.Add("offhand (#rynth-issues 11-28): a shield buffing took off goes back on under a rule's Offhand None (an empty off hand only)", StowedShieldBackUnderNone);
r.Add("offhand: an unlisted shield is never wielded", UnlistedNeverUsed);
r.Add("offhand: no flip-flop, and a retry cap", NoFlipFlop);
r.Add("offhand: the Items list (shields aren't weapons, no element) and buffing's wand", ItemsAndBuffing);
@@ -255,6 +257,56 @@ internal static class OffhandTests
// ── Combat ────────────────────────────────────────────────────────────────
+ private static void SetFightWeapons(Rig rig, uint main, uint off)
+ {
+ typeof(CombatManager).GetField("_fightMainId", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(rig.C, unchecked((int)main));
+ typeof(CombatManager).GetField("_fightOffId", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(rig.C, unchecked((int)off));
+ }
+
+ private static void DualPairBackAfterBuff()
+ {
+ var rig = new Rig(dualWieldSkill: true);
+ rig.List(Sword, Dagger); // no shield listed: Auto plans no off hand
+ SetFightWeapons(rig, Sword, Dagger); // the last swing: sword + dagger
+ rig.C.NoteOffhandStowed(unchecked((int)Dagger)); // buffing's wand: both into the pack
+ Rig.Unwield(Sword);
+ rig.InHand = 0;
+
+ // The weapon choice now picks the dagger for the main hand: the sword goes in the off hand.
+ var plan = rig.C.OffhandPlanFor(rig.Target, null, unchecked((int)Dagger));
+ Check.Eq(unchecked((uint)plan.Id), Sword, "the old main weapon goes in the off hand: " + plan.Source);
+ Check.Eq(plan.Source, "putting back what was taken off", "source");
+
+ // The sword chosen for the main hand: the dagger goes back, as before.
+ plan = rig.C.OffhandPlanFor(rig.Target, null, unchecked((int)Sword));
+ Check.Eq(unchecked((uint)plan.Id), Dagger, "the main weapon back: the stowed dagger goes back");
+
+ // Not after a dual-wield swing: a stowed weapon picked for the main hand puts nothing back.
+ var solo = new Rig(dualWieldSkill: true);
+ solo.List(Sword, Dagger);
+ SetFightWeapons(solo, Sword, 0);
+ solo.C.NoteOffhandStowed(unchecked((int)Dagger));
+ Check.Eq(solo.C.OffhandPlanFor(solo.Target, null, unchecked((int)Dagger)).Id, 0, "no pair last fight: nothing to put back");
+ }
+
+ private static void StowedShieldBackUnderNone()
+ {
+ var rig = new Rig();
+ rig.List(Sword); // the shield isn't listed
+ rig.Rule(OffhandRules.RuleNone); // this monster: hands off
+ rig.C.NoteOffhandStowed(unchecked((int)Shield)); // buffing (global Auto) took the shield off
+ var plan = rig.C.OffhandPlanFor(rig.Target, rig.S.MonsterRules[1], unchecked((int)Sword));
+ Check.Eq(unchecked((uint)plan.Id), Shield, "the shield buffing took off goes back on: " + plan.Source);
+
+ // Something else in the off hand: hands off, nothing is swapped.
+ var busy = new Rig();
+ busy.List(Sword);
+ busy.Rule(OffhandRules.RuleNone);
+ Rig.Wield(Round, ShieldSlot);
+ busy.C.NoteOffhandStowed(unchecked((int)Shield));
+ Check.Eq(busy.C.OffhandPlanFor(busy.Target, busy.S.MonsterRules[1], unchecked((int)Sword)).Id, 0, "None and a worn shield: left alone");
+ }
+
private static void OneHanderShield()
{
// The sword isn't in hand yet: it goes on first, no shield before it.
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/OutdoorHuntTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/OutdoorHuntTests.cs
index e2cdbf9..a048c29 100644
--- a/Tools/RynthCore.RynthAiHostTests/Tests/OutdoorHuntTests.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/OutdoorHuntTests.cs
@@ -40,6 +40,8 @@ internal static class OutdoorHuntTests
r.Add("hunt fence (2026-11-17 Thread 32D9): combat fights beside the character and no farther out than it, even outside the fence", FenceSkipsRule);
r.Add("hunt (2026-11-17 fort Thread 3073): stuck again and again at a spot: that monster left out, and no walk by the spot", SnaggedSpot);
r.Add("hunt: a monster right beside it that combat doesn't take: stands, then leaves it out", RightHere);
+ r.Add("hunt (12-03 Yanshi doorway): every walk from one spot fails: back a few yards the way it came, the ones left out looked at again", StepsBackOffABadSpot);
+ r.Add("hunt (12-03): a spot no walk leaves, twice: then it waits; no trail: it waits; one walk that works and it never steps back", StepBackLimits);
r.Add("hunt (test 10-23): in a building it walks back out the way it went in (the loops it made cut out)", WayBackOut);
r.Add("hunt: in a building with no way in known, or the walks out ending still inside: it waits", IndoorsWaits);
r.Add("hunt pick (11-08): Nearest is the hunt as it was (the lone one 10 yd off, not the pack)", PickNearestUnchanged);
@@ -531,6 +533,99 @@ internal static class OutdoorHuntTests
Check.True(h.Note.Contains("ended still inside"), h.Note);
}
+ // 12-03, a Yanshi Thread: the hunt stood in a doorway with thirty monsters round it, every walk from there
+ // failing; two steps back it hunted again. Walks fail from within 2 yd of the doorway, work from anywhere else.
+ private static readonly OutdoorHunt.Vec Doorway = new(1010, 1000, 0);
+ private static OutdoorHunt.PathResult FromDoorwayNoWay(OutdoorHunt.Vec a, OutdoorHunt.Vec b)
+ => a.FlatDistanceTo(Doorway) <= 2
+ ? new(OutdoorHunt.PathStatus.NoPath, Array.Empty(), 0, 0)
+ : new(OutdoorHunt.PathStatus.Ok, new[] { b }, a.DistanceTo(b), 0);
+
+ /// The hunt walked east along a street to the doorway, a yard at a time.
+ private static OutdoorHunt WalkedToTheDoorway()
+ {
+ var h = new OutdoorHunt();
+ h.Start(T0, V(990, 1000));
+ for (int x = 990; x <= 1010; x++) h.Track(V(x, 1000), indoors: false);
+ return h;
+ }
+
+ private static List RoundTheDoorway(OutdoorHunt.Vec me) =>
+ Sorted(C(1, 1030, 1010, me), C(2, 1025, 985, me), C(3, 1040, 1000, me), C(4, 1000, 1030, me));
+
+ private static void StepsBackOffABadSpot()
+ {
+ var h = WalkedToTheDoorway();
+ var me = Doorway;
+ var d = h.Tick(T0, me, true, RoundTheDoorway(me), FromDoorwayNoWay);
+ Check.Eq(d.Act, OutdoorHunt.Act.Walk, "it doesn't stand there: it walks");
+ Check.Eq(d.TargetId, 0, "to no monster");
+ var end = d.Corners!.Last();
+ Check.True(end.FlatDistanceTo(me) >= h.StepBackYd && end.X < me.X && Math.Abs(end.Y - 1000) < 0.01,
+ $"back west along the street it came by, {h.StepBackYd:0} yd ({end.X},{end.Y})");
+ Check.True(d.Corners!.All(c => Math.Abs(c.Y - 1000) < 0.01 && c.X < me.X), "every step of it on the way it came");
+ Check.True(h.SteppingBack, "stepping back");
+ Check.True(h.PendingNotes.Any(n => n.Contains("no walk from 1010,1000 gets anywhere") && n.Contains("4 monsters left out")),
+ "logged: " + string.Join(" | ", h.PendingNotes));
+ for (int id = 1; id <= 4; id++) Check.False(h.IsSkipped(id, T0.AddSeconds(1)), $"monster {id} is looked at again");
+
+ // On the way back: nothing new until the step back runs out.
+ var mid = V(1008, 1000);
+ h.Track(mid, false);
+ d = h.Tick(T0.AddSeconds(1), mid, false, RoundTheDoorway(mid), FromDoorwayNoWay);
+ Check.Eq(d.Act, OutdoorHunt.Act.None, "on the way back: carries on");
+ // Back on the street: it hunts again at once.
+ var back = end;
+ h.Track(back, false);
+ d = h.Tick(T0.AddSeconds(2.5), back, true, RoundTheDoorway(back), FromDoorwayNoWay);
+ Check.Eq(d.Act, OutdoorHunt.Act.Walk, "from there it hunts");
+ Check.True(d.TargetId != 0, "a monster this time");
+ Check.False(h.SteppingBack, "the step back is over");
+ }
+
+ private static void StepBackLimits()
+ {
+ // Every spot is bad (a nav with no way from anywhere): two step backs, then it waits.
+ var h = WalkedToTheDoorway();
+ h.Roam = false;
+ OutdoorHunt.PathResult None(OutdoorHunt.Vec a, OutdoorHunt.Vec b) => new(OutdoorHunt.PathStatus.NoPath, Array.Empty(), 0, 0);
+ var me = Doorway;
+ var t = T0;
+ int backs = 0;
+ for (int round = 0; round < 8; round++)
+ {
+ // Each tick 2 s on, the last walk over (a step back runs out at its end).
+ var d = h.Tick(t, me, true, RoundTheDoorway(me), None);
+ if (d.Act == OutdoorHunt.Act.Walk && d.TargetId == 0)
+ {
+ backs++;
+ me = d.Corners!.Last();
+ h.Track(me, false);
+ }
+ t = t.AddSeconds(2);
+ }
+ Check.Eq(backs, h.StepBackMax, $"{h.StepBackMax} step backs, no more");
+ var last = h.Tick(t.AddSeconds(200), me, true, RoundTheDoorway(me), None);
+ Check.Eq(last.Act, OutdoorHunt.Act.Idle, "then it waits, as before");
+
+ // No trail (it never walked: started right there): it waits, as before.
+ var h2 = new OutdoorHunt();
+ h2.Start(T0, Doorway);
+ h2.Roam = false;
+ var d2 = h2.Tick(T0, Doorway, true, RoundTheDoorway(Doorway), FromDoorwayNoWay);
+ Check.Eq(d2.Act, OutdoorHunt.Act.Idle, "no way back known: it waits");
+
+ // Two left out but one walk works: it hunts that one; no step back.
+ var h3 = WalkedToTheDoorway();
+ var nav = new Nav();
+ nav.Overrides[(1030, 1010)] = new(OutdoorHunt.PathStatus.NoPath, Array.Empty(), 0, 0);
+ nav.Overrides[(1025, 985)] = new(OutdoorHunt.PathStatus.NoPath, Array.Empty(), 0, 0);
+ nav.Overrides[(1040, 1000)] = new(OutdoorHunt.PathStatus.NoPath, Array.Empty(), 0, 0);
+ var d3 = h3.Tick(T0, Doorway, true, RoundTheDoorway(Doorway), nav.Path);
+ Check.Eq(d3.TargetId, 4, "the one a walk gets to");
+ Check.False(h3.SteppingBack, "no step back");
+ }
+
private static readonly DateTime T0 = new(2026, 10, 23, 16, 0, 0);
private static OutdoorHunt.Vec V(double x, double y) => new(x, y, 0);
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/PetNotAnEssenceTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/PetNotAnEssenceTests.cs
new file mode 100644
index 0000000..e4f36ec
--- /dev/null
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/PetNotAnEssenceTests.cs
@@ -0,0 +1,199 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using RynthCore.Loot;
+using RynthCore.Plugin.RynthAi;
+using RynthCore.Plugin.RynthAi.LegacyUi;
+using RynthCore.Plugin.Shared;
+using RynthCore.PluginSdk;
+using RynthCore.RynthAiHostTests.Fakes;
+using RynthCore.RynthAiTests.Harness;
+
+namespace RynthCore.RynthAiHostTests.Tests;
+
+// R-20261204-141918-4808: an "Essence of ..." item, typed Pet in the Items list because "Essence" was
+// anywhere in its name, was used as a pet essence about every minute. It had no charge count and its
+// appraisal never landed, so PetDeviceKind could not rule it out; the server answered "The Essence of
+// ... cannot be used" (or nothing at all, and the summon timed out). Now that answer, or two summons
+// from it that bring nothing while it shows no charges, skip it for the session, said once in chat;
+// and only a name ending in "Essence" (or "Essence (50)") is typed Pet.
+internal static class PetNotAnEssenceTests
+{
+ private const uint Player = 0x50000D31;
+ private const uint Mob = 0x80320010;
+ private const uint Bogus = 0x80320001;
+ private const uint Bogus2 = 0x80320002;
+ private const uint Real = 0x80320003;
+ private const uint StructureKey = 92;
+ private const uint Lb = 0xA9B40000;
+ private const string BogusName = "Essence of Zerzelikyr";
+
+ public static void Register(Runner r)
+ {
+ r.Add("pets (R-20261204-141918-4808): 'The
- cannot be used' skips that name for the session (every copy), said once in chat", RefusedSkipped);
+ r.Add("pets (R-20261204-162443-5c2b): the refusal is the use's answer: combat and buffs stop waiting on it at once", RefusalAnswersTheUse);
+ r.Add("pets (R-20261204-141918-4808): two silent summons from an item with no charges skip it; an essence with charges is never skipped so", SilentTimeoutsSkipped);
+ r.Add("items list: only a name ending in 'Essence' (or 'Essence (50)') is typed Pet; 'Essence of ...' is not", PetEssenceNames);
+ }
+
+ private sealed class Rig : IDisposable
+ {
+ public long Now = 2_000_000;
+ public readonly LegacyUiSettings S = new() { SummonPets = true, MonsterRange = 20, CustomPetRange = 5, PetAutoRefill = false };
+ public readonly PetManager Pets;
+ public readonly RynthCoreHost Host;
+
+ public Rig(bool bogus = true, bool secondBogus = false, bool real = false)
+ {
+ FakeHost.Reset();
+ FakeHost.WeaponCalls = true; // UseObject, RequestId, HasAppraisalData
+ Place(Player, "Pet Tester", 96, 96, creature: false);
+ FakeHost.PlayerPose = (Lb | 0x1C, 96f, 96f, 0f);
+ Place(Mob, "Drudge Skulker", 96, 99, creature: true);
+ var known = new List { Mob };
+ if (bogus) Item(Bogus, BogusName, known);
+ if (secondBogus) Item(Bogus2, BogusName, known);
+ if (real)
+ {
+ Item(Real, "Fire Moar Essence (50)", known);
+ FakeHost.Ints[(Real, StructureKey)] = 50;
+ }
+ var host = FakeHost.Create(Player);
+ Host = host;
+ var cache = FakeHost.MakeCache(host, Player, known);
+ S.IsMacroRunning = true;
+ if (bogus) S.ConsumableRules.Add(new ConsumableRule { Id = unchecked((int)Bogus), Name = BogusName, Type = "Pet" });
+ if (secondBogus) S.ConsumableRules.Add(new ConsumableRule { Id = unchecked((int)Bogus2), Name = BogusName, Type = "Pet" });
+ if (real) S.ConsumableRules.Add(new ConsumableRule { Id = unchecked((int)Real), Name = "Fire Moar Essence (50)", Type = "Pet" });
+ var combat = new CombatManager(host, S, cache);
+ combat.SetPlayerId(Player);
+ combat.ScanNearbyTargets();
+ Check.True(combat.ScannedTargets.Count == 1, "rig: the monster is scanned");
+ PetManager.Clock = () => Now;
+ Pets = new PetManager(host, S, cache, combat, null);
+ }
+
+ private static void Item(uint id, string name, List known)
+ {
+ FakeHost.Names[id] = name;
+ FakeHost.Containers[id] = Player;
+ known.Add(id);
+ }
+
+ private static void Place(uint id, string name, float x, float y, bool creature)
+ {
+ FakeHost.Names[id] = name;
+ FakeHost.Positions[id] = (Lb | 0x1C, x, y, 0f);
+ if (creature) FakeHost.ItemTypes[id] = 0x10;
+ }
+
+ public void Run(long ms)
+ {
+ for (long t = 0; t < ms; t += 100)
+ {
+ Now += 100;
+ Pets.OnHeartbeat(0);
+ }
+ }
+
+ /// Runs until has been used times (or the time runs out).
+ public void RunUntilUses(uint id, int n, long maxMs = 120_000)
+ {
+ for (long t = 0; t < maxMs && Uses(id) < n; t += 100)
+ {
+ Now += 100;
+ Pets.OnHeartbeat(0);
+ }
+ }
+
+ public static int Uses(uint id) => FakeHost.Uses.Count(u => u == id);
+
+ public void Dispose() => PetManager.Clock = static () => Environment.TickCount64;
+ }
+
+ private static int ChatLines(string part) => FakeHost.Chat.Count(l => l.Contains(part, StringComparison.Ordinal));
+
+ private static void RefusedSkipped()
+ {
+ using var rig = new Rig(secondBogus: true);
+ rig.RunUntilUses(Bogus, 1);
+ Check.Eq(Rig.Uses(Bogus), 1, "the listed item is tried once (no appraisal ever lands: unknown, so it is used)");
+ rig.Pets.OnChatWindowText($"The {BogusName} cannot be used");
+ Check.True(rig.Pets.UnusableNames.Contains(BogusName), "the name is skipped for the session");
+ Check.Eq(ChatLines("is listed as a Pet in the Items list, but the server says it cannot be used"), 1, "one chat line says so and why");
+
+ rig.Run(180_000);
+ Check.Eq(Rig.Uses(Bogus), 1, "never used again");
+ Check.Eq(Rig.Uses(Bogus2), 0, "nor its same-named copy");
+ Check.Eq(ChatLines("is listed as a Pet"), 1, "still one chat line");
+
+ // A "cannot be used" naming something else is not this essence's answer.
+ using var other = new Rig();
+ other.RunUntilUses(Bogus, 1);
+ other.Pets.OnChatWindowText("The Lockpick cannot be used");
+ Check.Eq(other.Pets.UnusableNames.Count, 0, "another item's refusal changes nothing");
+ }
+
+ private static void RefusalAnswersTheUse()
+ {
+ using var rig = new Rig();
+ ActionPacer.Reset(); ActionPacer.Enabled = true; ActionPacer.NowMs = () => rig.Now;
+ try
+ {
+ rig.RunUntilUses(Bogus, 1);
+ // The plugin's use hook records it (RynthAiPlugin.Pacing); this rig has no plugin, so as it does.
+ ActionPacer.Begin(rig.Host, PacedKind.ItemUse, Bogus, BogusName, "RynthAi/Pet", 0);
+ rig.Now += 30;
+ Check.True(ActionPacer.Outstanding(rig.Host, out _), "the summon's use waits for the server's answer");
+ Check.False(ActionPacer.NoteRefused(Bogus + 99), "another item's refusal is not this use's answer");
+ rig.Pets.OnChatWindowText($"The {BogusName} cannot be used");
+ Check.False(ActionPacer.Outstanding(rig.Host, out _), "the refusal answered it: nothing waits the 3.5 s");
+ }
+ finally
+ {
+ ActionPacer.Enabled = false; ActionPacer.Reset(); ActionPacer.NowMs = () => Environment.TickCount64;
+ }
+ }
+
+ private static void SilentTimeoutsSkipped()
+ {
+ using (var rig = new Rig())
+ {
+ rig.RunUntilUses(Bogus, 1);
+ rig.Run(9_000); // the 8 s summon timeout: no pet, no charge drop
+ Check.Eq(rig.Pets.UnusableNames.Count, 0, "one silent summon: not yet");
+ rig.RunUntilUses(Bogus, 2);
+ Check.Eq(Rig.Uses(Bogus), 2, "tried again after the essence cooldown");
+ rig.Run(9_000);
+ Check.True(rig.Pets.UnusableNames.Contains(BogusName), "two silent summons, no charges: skipped");
+ Check.Eq(ChatLines("2 summons from it brought no pet and it shows no charges"), 1, "said once in chat");
+ rig.Run(180_000);
+ Check.Eq(Rig.Uses(Bogus), 2, "never used again");
+ }
+
+ // A real essence (a charge count) whose summons time out is never skipped this way.
+ using (var real = new Rig(bogus: false, real: true))
+ {
+ real.RunUntilUses(Real, 3, 300_000);
+ real.Run(9_000);
+ Check.True(Rig.Uses(Real) >= 3, $"still summoned from ({Rig.Uses(Real)} uses)");
+ Check.Eq(real.Pets.UnusableNames.Count, 0, "never skipped: it shows charges");
+ }
+ }
+
+ private static void PetEssenceNames()
+ {
+ foreach (string n in new[] { "Fire Moar Essence (50)", "Common Golem Essence", "Legendary Dark Shaman Essence", "Frost K'nath Essence (200)", " Wisp Essence " })
+ Check.True(LegacyWeaponsUi.IsPetEssenceName(n), $"'{n}' is a pet essence name");
+ foreach (string n in new[] { BogusName, "Essence of Kemeroi", "Scroll of Gift of Essence", "Essence", "Essence (50)", "Lockpick", "", null })
+ Check.False(LegacyWeaponsUi.IsPetEssenceName(n), $"'{n}' is not");
+
+ var bogus = new WorldObject(unchecked((int)Bogus), BogusName, AcObjectClass.Misc);
+ Check.Eq(LegacyWeaponsUi.PackConsumableType(bogus), null, "Fill from pack leaves an 'Essence of ...' out");
+ var real = new WorldObject(unchecked((int)Real), "Fire Moar Essence (50)", AcObjectClass.Misc);
+ Check.Eq(LegacyWeaponsUi.PackConsumableType(real), "Pet", "and still lists a real essence");
+ var detect = typeof(LegacyWeaponsUi).GetMethod("DetectConsumableType", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)!;
+ Check.Eq((string)detect.Invoke(null, new object[] { bogus })!, "General", "Add selected types it General, not Pet");
+ Check.Eq((string)detect.Invoke(null, new object[] { real })!, "Pet", "and a real essence Pet");
+ }
+}
diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/WeaponTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/WeaponTests.cs
index e722ad6..62deedc 100644
--- a/Tools/RynthCore.RynthAiHostTests/Tests/WeaponTests.cs
+++ b/Tools/RynthCore.RynthAiHostTests/Tests/WeaponTests.cs
@@ -999,8 +999,30 @@ internal static class WeaponTests
const uint Unknown = 0x6000006F;
p = rig.C.PlanFor(rig.Target, Own(Unknown));
Check.Eq(unchecked((uint)p.WeaponId), ListedWand, "an unknown rule weapon is skipped: the weakness pick");
+ // R-20261130-200251-9dff: that used to be silent. Now the log says why, once.
+ int UnknownNotes() => FakeHost.Logs.Count(l => l.Contains($"0x{Unknown:X8}") && l.Contains("left out: the game doesn't know that item"));
+ Check.Eq(UnknownNotes(), 1, "the unknown rule weapon is logged, with why");
+ rig.C.PlanFor(rig.Target, Own(Unknown));
+ Check.Eq(UnknownNotes(), 1, "once");
rig.S.ItemRules.Add(new() { Id = unchecked((int)FireWand), Name = "Fire Wand", Element = "Fire", ElementSource = "icon" });
+ // A rule weapon the server refused 'skill too low' lately sits out (said why); one already
+ // in hand stays the plan's weapon: it is wielded, so it can be (R-20261130-200251-9dff).
+ var tooLow = (Dictionary)typeof(CombatManager)
+ .GetField("_skillTooLowUntil", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(rig.C)!;
+ tooLow[unchecked((int)FireWand)] = DateTime.UtcNow.AddDays(1);
+ rig.C.InHandOverride = () => unchecked((int)ListedWand);
+ p = rig.C.PlanFor(rig.Target, Own(FireWand));
+ Check.Eq(unchecked((uint)p.WeaponId), ListedWand, "refused lately and not in hand: the weakness pick");
+ Check.True(FakeHost.Logs.Any(l => l.Contains("Monsters rule 'Ethereal' weapon") && l.Contains("left out: the server refused it for too low a skill")),
+ "the log says why: " + string.Join(" | ", FakeHost.Logs.Where(l => l.Contains("left out")).Take(4)));
+ rig.C.InHandOverride = () => unchecked((int)FireWand);
+ p = rig.C.PlanFor(rig.Target, Own(FireWand));
+ Check.Eq(unchecked((uint)p.WeaponId), FireWand, "already in hand: the rule's weapon stays");
+ Check.Eq(p.Source, "Monsters rule weapon", "source");
+ tooLow.Clear();
+ rig.C.InHandOverride = null;
+
// Through combat's equip pass: the rule matched by name drives the wield.
rig.S.MonsterRules.Add(Own(FireWand));
rig.C.InHandOverride = () => unchecked((int)ListedWand); // the weakness pick is in hand
diff --git a/Tools/RynthCore.RynthAiTests/Tests/ChatClassifierTests.cs b/Tools/RynthCore.RynthAiTests/Tests/ChatClassifierTests.cs
index 36123da..ba3b39b 100644
--- a/Tools/RynthCore.RynthAiTests/Tests/ChatClassifierTests.cs
+++ b/Tools/RynthCore.RynthAiTests/Tests/ChatClassifierTests.cs
@@ -57,6 +57,15 @@ internal static class ChatClassifierTests
Check.False(Player("[RynthAi] Bob says, \"x\"", 0x02), "plugin output, whatever it says");
Check.False(Player("[RynthAi Item] Bob's Sword", 0x00), "item info");
Check.False(Player("You have killed 50 Drudges! Your task is complete!", 0x00), "a kill task line");
+
+ // 0.4.1: an NPC's tell comes with the same type as a player's, but with no name link.
+ Check.False(Player("Town Crier tells you, \"Hear ye\"", 0x03), "a tell from an NPC");
+ Check.True(ChatClassifier.IsNpcTell(0x03, "Agent of the Arcanum tells you, \"Well met.\""), "IsNpcTell: no link");
+ Check.False(ChatClassifier.IsNpcTell(0x03, Link + " tells you, \"hi\""), "IsNpcTell: a player's (linked) tell");
+ Check.False(ChatClassifier.IsNpcTell(0x04, "You tell Town Crier, \"hi\""), "IsNpcTell: a tell you send");
+ Check.False(ChatClassifier.IsNpcTell(0x1F, "Admin tells you, \"hello\""), "IsNpcTell: an admin tell (0x1F)");
+ Check.False(ChatClassifier.IsNpcTell(0x03, "You think, \"hmm\""), "IsNpcTell: a tell to yourself");
+ Check.Eq(ChatClassifier.ChannelFor("Town Crier tells you, \"Hear ye\"", 0x03), ChatClassifier.Chat, "an NPC's tell stays on Chat");
}
private static string[] TextsIn(string json)
diff --git a/Tools/RynthDefective.Tests/AppraisalTests.cs b/Tools/RynthDefective.Tests/AppraisalTests.cs
index 37fd0f4..f437adc 100644
--- a/Tools/RynthDefective.Tests/AppraisalTests.cs
+++ b/Tools/RynthDefective.Tests/AppraisalTests.cs
@@ -65,6 +65,16 @@ namespace RynthDefective.Tests
Check(Lines(d, "Requirements").Contains("Activation requires Arcane Lore: 300"), "arcane lore");
Check(Lines(d, "Properties").Contains("Properties: Bonded, Attuned (can't be given), Retained, Unenchantable"), "flags: " + string.Join(" | ", Lines(d, "Properties")));
Check(d.Bars.Count == 1 && d.Bars[0].Kind == AppraiseBarKind.Mana && d.Bars[0].Current == 1234 && d.Bars[0].Max == 2000, "the mana bar");
+
+ // #rynth-issues 2026-12-01: a worn shirt's banes (ACE flags enchantments 0x80000000) are buffs, not its spells.
+ var shirt = Item(0x4);
+ shirt.Spells.Add(2149);
+ shirt.Spells.Add(4407u | AppraisalText.CastOnItemFlag);
+ var sm = Lines(AppraisalText.Build(shirt), "Magic");
+ string own = sm.FirstOrDefault(l => l.StartsWith("Spells: ")) ?? "";
+ string buffs = sm.FirstOrDefault(l => l.StartsWith("Buffs on it: ")) ?? "";
+ Check(own.Length > 0 && buffs.Length > 0 && !own.Contains(shirt.SpellName(4407)) && buffs.Contains(shirt.SpellName(4407)),
+ "buffs cast on an item get their own line: " + string.Join(" | ", sm));
}
private static void AppraiseCaster()
diff --git a/Tools/RynthNav.GraphTests/Program.cs b/Tools/RynthNav.GraphTests/Program.cs
index 1506203..ab09947 100644
--- a/Tools/RynthNav.GraphTests/Program.cs
+++ b/Tools/RynthNav.GraphTests/Program.cs
@@ -60,6 +60,7 @@ internal static partial class Program
Run(nameof(RealDungeons), RealDungeons);
RunRouteMaker(); // RouteMakerTests.cs
RunPortalFloors(); // PortalFloorTests.cs
+ RunStartSnaps(); // StartSnapTests.cs
}
finally { try { Directory.Delete(_root, true); } catch { } }
Console.WriteLine();
diff --git a/Tools/RynthNav.GraphTests/StartSnapTests.cs b/Tools/RynthNav.GraphTests/StartSnapTests.cs
new file mode 100644
index 0000000..835f421
--- /dev/null
+++ b/Tools/RynthNav.GraphTests/StartSnapTests.cs
@@ -0,0 +1,101 @@
+using System;
+using System.Collections.Generic;
+using DotRecast.Core.Numerics;
+using DotRecast.Detour;
+using RynthCore.Plugin.Shared;
+using RynthNav.Routing;
+
+// 12-03, the Yanshi Thread (B470): the hunt stood for minutes in building #3's doorway with thirty monsters
+// round it, every one "left out" (the walk "can't be reached" or ending 60-100 yd short); two steps back and it
+// hunted again. The doorstep is a crumb of the mesh: three polygons joined to nothing, the street 1.1 u away.
+// A walk from a crumb steps off it first; a walk to one steps onto it last (NavPathQuery.CrumbOf/StepOffCrumb).
+internal static partial class Program
+{
+ private static void RunStartSnaps()
+ {
+ Run(nameof(CrumbStepOffMadeUp), CrumbStepOffMadeUp);
+ Run(nameof(RealDoorwayStart), RealDoorwayStart);
+ }
+
+ /// A small island beside a big floor: the island is a crumb, the floor isn't, and the step off finds the floor.
+ private static void CrumbStepOffMadeUp()
+ {
+ // A big floor of uneven slabs (so it's many polygons) and a 9x9 island 6 u east of it.
+ var slabs = new List<(float, float, float, float, float)>();
+ for (int i = 0; i < 6; i++)
+ for (int j = 0; j < 6; j++)
+ slabs.Add((10 + i * 20, 10 + j * 20, 30 + i * 20, 30 + j * 20, ((i + j) % 3) * 0.3f));
+ slabs.Add((136, 60, 145, 69, 0f));
+ var q = QueryOn(BakeLayers("excrumb", slabs.ToArray()));
+ var filter = new DtQueryDefaultFilter();
+ q.FindNearestPoly(new RcVec3f(140.5f, 0, 64.5f), new RcVec3f(2, 2, 2), filter, out long island, out RcVec3f ip, out _);
+ q.FindNearestPoly(new RcVec3f(70, 0, 70), new RcVec3f(2, 2, 2), filter, out long floor, out _, out _);
+ Check(island != 0 && floor != 0, "both pieces baked");
+ if (island == 0 || floor == 0) return;
+ HashSet? crumb = NavPathQuery.CrumbOf(q, island);
+ Check(crumb != null && crumb.Count <= NavPathQuery.CrumbMaxPolys, $"the island is a crumb ({crumb?.Count} polygons)");
+ Check(NavPathQuery.CrumbOf(q, floor) == null, "the big floor isn't");
+ if (crumb == null) return;
+ long none = NavPathQuery.StepOffCrumb(q, ip, crumb, filter, out _);
+ Check(none == 0, $"no bigger ground within {NavPathQuery.CrumbStepUnits} u: nowhere to step");
+ var far = Ex(q, 140.5, 64.5, 70, 70, 0);
+ Check(far.Code == RynthNavPathApiV1.ResultNoPath && far.SteppedOff == 0, $"and the walk off it can't be made, as before ({far.Code}, {far.Note})");
+ long off = NavPathQuery.StepOffCrumb(q, ip, crumb, filter, out RcVec3f op, 16f);
+ Check(off != 0 && op.X < 132 && op.X > 120, $"within 16 u: the floor's edge facing it ({op.X:F1}, {op.Z:F1})");
+ Check(off == 0 || NavPathQuery.CrumbOf(q, off) == null, "on the big floor, not on another crumb");
+ }
+
+ private static void RealDoorwayStart()
+ {
+ string dir = Environment.GetEnvironmentVariable("RYNTHNAV_NAVDATA") ?? @"C:\Games\RynthCore\NavData";
+ DtNavMeshQuery? q = Around(dir, 0xB470);
+ if (q == null) { Console.WriteLine(" (no real NavData here: skipped)"); return; }
+ var filter = new DtQueryDefaultFilter();
+ // Where the character stood (RynthRemote's status, 16:08): cell B4700019, the door at 34633,21527.
+ double e = 34633.11, n = 21527.03, z = 42.09;
+ long s = NavPathQuery.SnapStart(q, new RcVec3f((float)e, (float)z, (float)n), filter, out RcVec3f sPt);
+ double flat = Math.Sqrt((sPt.X - e) * (sPt.X - e) + (sPt.Z - n) * (sPt.Z - n));
+ Console.WriteLine($" the start snaps to {sPt.X:F1},{sPt.Z:F1} height {sPt.Y:F1} ({flat:F1} u across, {sPt.Y - z:+0.0;-0.0} u up)");
+ Check(s != 0 && flat < 1 && Math.Abs(sPt.Y - z) < 1, "the walk's start is the ground at the character's feet");
+
+ HashSet? crumb = NavPathQuery.CrumbOf(q, s);
+ Console.WriteLine($" its piece of the mesh: {(crumb == null ? "joined" : crumb.Count + " polygon(s)")}");
+ Check(crumb != null, "the doorstep is a crumb");
+ if (crumb == null) return;
+ long off = NavPathQuery.StepOffCrumb(q, sPt, crumb, filter, out RcVec3f op);
+ double step = Math.Sqrt((op.X - sPt.X) * (op.X - sPt.X) + (op.Z - sPt.Z) * (op.Z - sPt.Z));
+ Console.WriteLine($" steps off to {op.X:F1},{op.Z:F1} h {op.Y:F1}, {step:F1} u across");
+ Check(off != 0 && step < 2 && Math.Abs(op.Y - sPt.Y) < 1, "the street is a short step away, at the same height");
+
+ // Every walk from the doorway across the town (as the hunt asks: start, goal at the character's height).
+ foreach (var (ge, gn, name) in new[] { (34605.2, 21514.1, "town middle"), (34633.0, 21550.0, "23 u north"), (34633.0, 21505.0, "22 u south"),
+ (34660.0, 21527.0, "27 u east"), (34610.0, 21527.0, "23 u west"), (34580.0, 21600.0, "far NW") })
+ {
+ var r = Ex(q, e, n, ge, gn, 0, sz: z, gz: z);
+ Console.WriteLine($" to {name}: code {r.Code}, {r.Corners.Count} corners, {r.Length:F0} u, ends {r.EndDistance:F1} u from it, steps off {r.SteppedOff:F1} u");
+ Check(r.Code == RynthNavPathApiV1.ResultOk && r.EndDistance < 1, $"to the {name}: the walk is made ({r.Code}, {r.Note})");
+ if (r.Corners.Count < 2) continue;
+ Check(r.SteppedOff > 0 && r.SteppedOff <= NavPathQuery.CrumbStepUnits, $"to the {name}: it steps off the crumb ({r.SteppedOff:F1} u)");
+ Check(Flat(r.Corners[0], sPt.X, sPt.Z) < 0.1 && Flat(r.Corners[1], op.X, op.Z) < 0.1,
+ $"to the {name}: it starts where the character stands, then the step off");
+ }
+ // With the hunt's flags (portals avoided, walls kept off, partial allowed).
+ var hunt = Ex(q, e, n, 34605.2, 21514.1, RynthNavPathApiV1.PathAllowPartial | RynthNavPathApiV1.PathAvoidPortals | RynthNavPathApiV1.PathWallClearance,
+ new AvoidFilter(new PortalAvoid()), sz: z, gz: z);
+ Check(hunt.Code == RynthNavPathApiV1.ResultOk && hunt.SteppedOff > 0, $"with the hunt's flags too ({hunt.Code}, {hunt.Note})");
+
+ // The other way: a walk to the doorstep steps onto it last.
+ var back = Ex(q, 34605.2, 21514.1, e, n, 0, sz: z, gz: z);
+ Console.WriteLine($" town middle to the doorstep: code {back.Code}, {back.Length:F0} u, ends {back.EndDistance:F1} u from it, last leg {back.GoalSteppedOff:F1} u");
+ Check(back.Code == RynthNavPathApiV1.ResultOk && back.GoalSteppedOff > 0 && back.EndDistance < 1,
+ $"to the doorstep: the walk ends on it ({back.Code}, {back.EndDistance:F1} u short, {back.Note})");
+ Check(back.Corners.Count >= 2 && Flat(back.Corners[^2], op.X, op.Z) < 2.5, "its last leg is the short step from the street");
+
+ // From the street the walk is as it always was.
+ var street = Ex(q, 34631.0, 21527.0, 34605.2, 21514.1, 0, sz: z, gz: z);
+ long sw = NavPathQuery.SnapStart(q, new RcVec3f(34631.0f, (float)z, 21527.0f), filter, out _);
+ Console.WriteLine($" from 2 u west: code {street.Code}, {street.Length:F0} u, steps off {street.SteppedOff:F1} u (its piece {(NavPathQuery.CrumbOf(q, sw) == null ? "joined" : "a crumb")})");
+ Check(street.Code == RynthNavPathApiV1.ResultOk, "from two steps back the walk is made");
+ if (NavPathQuery.CrumbOf(q, sw) == null) Check(street.SteppedOff == 0, "and, starting on the joined ground, it steps off nothing");
+ }
+}