From bf702ebc67bd241e7e1cfdb00538cd639af2f405 Mon Sep 17 00:00:00 2001 From: Tom Bohar Date: Tue, 6 Oct 2026 15:03:24 -0400 Subject: [PATCH] Snapshot for release 2026.10.6.3 (internal f2255d0) --- .../Combat/BuffManager.cs | 9 ++++++++ .../Combat/WeaponSwapGate.cs | 21 ++++++++++--------- .../Tests/OffhandTests.cs | 13 ++++++++---- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.cs b/Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.cs index 72fd7f8..a0bc785 100644 --- a/Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.cs +++ b/Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.cs @@ -335,6 +335,9 @@ public class BuffManager : IDisposable // then the swap gate's flat 3 s). The pack move stays as the fallback: once a use hasn't // got the wand into the hand in WieldResolveTimeoutMs, this session moves the weapon first. private bool _directWandSwapFailed; + // The swap gate's claim count when the wand's use went out: a later claim means another swap + // (combat putting the axe back, 12:39 on 10-06) changed the hands, so the result says nothing. + private long _pendingWieldClaim; private int _bowDequipPendingId; private DateTime _bowDequipAt = DateTime.MinValue; private int _bowDequipAttempts; @@ -3900,6 +3903,11 @@ public class BuffManager : IDisposable if ((now - _pendingWieldAt).TotalMilliseconds < WieldResolveTimeoutMs) return false; + if (_weaponSwapGate != null && _weaponSwapGate.Claims != _pendingWieldClaim) + { + _pendingWieldId = 0; // another swap since ours: not a failed wield + return false; + } int stillInHand = _directWandSwapFailed ? 0 : FindWieldedNonWandWeapon(wandId); if (stillInHand != 0 && IsWieldedLive(stillInHand)) { @@ -3981,6 +3989,7 @@ public class BuffManager : IDisposable _host.UseFor((uint)wandId, "Buff", bowId != 0 && !_directWandSwapFailed ? "buffing: switch to the wand" : "buffing: wield the wand"); NoteStanceRequest(); + _pendingWieldClaim = _weaponSwapGate?.Claims ?? 0; _pendingWieldId = wandId; _pendingWieldAt = now; _lastCastAttempt = now; diff --git a/Plugins/RynthCore.Plugin.RynthAi/Combat/WeaponSwapGate.cs b/Plugins/RynthCore.Plugin.RynthAi/Combat/WeaponSwapGate.cs index 0f5a7b2..31703ea 100644 --- a/Plugins/RynthCore.Plugin.RynthAi/Combat/WeaponSwapGate.cs +++ b/Plugins/RynthCore.Plugin.RynthAi/Combat/WeaponSwapGate.cs @@ -25,7 +25,10 @@ public sealed class WeaponSwapGate private long _lastSwapTickMs = long.MinValue / 4; private string _lastSwapBy = ""; private int _movingId; - private bool _movingWasWielded; + private long _claims; + + /// Swaps claimed so far: a caller can tell whether another swap went out after its own. + public long Claims { get { lock (_lock) { return _claims; } } } /// /// The longest one swap holds the next: a swap the server's answer can't be seen for (or @@ -65,22 +68,21 @@ public sealed class WeaponSwapGate _lastSwapTickMs = now; _lastSwapBy = requestedBy ?? ""; _movingId = 0; + _claims++; return true; } } /// /// The claimed swap moved into or out of a hand without a use (a - /// pack move or a slot wield, which the server answers with no UseDone): the swap is done - /// once the item's wielded state is no longer . + /// pack move or a slot wield): the next swap waits the full MinIntervalMs, as before. + /// Drakkon 2026-10-06 13:58: the wand went out 1.3 s after the axe's pack move (the axe read + /// out of hand) and the server then held the first cast open until a relog. The server's + /// unwield motion outlasts the item move, and nothing tells us when it ends. /// public void NoteMove(int itemId, bool wieldedNow) { - lock (_lock) - { - _movingId = itemId; - _movingWasWielded = wieldedNow; - } + lock (_lock) _movingId = itemId; } private bool LastSwapDone(long since) @@ -88,8 +90,7 @@ public sealed class WeaponSwapGate if (since < FloorMs || ServerIdle == null || IsWielded == null) return false; try { - if (!ServerIdle()) return false; - return _movingId == 0 || IsWielded(_movingId) != _movingWasWielded; + return _movingId == 0 && ServerIdle(); } catch { diff --git a/Tools/RynthCore.RynthAiHostTests/Tests/OffhandTests.cs b/Tools/RynthCore.RynthAiHostTests/Tests/OffhandTests.cs index 3e23d86..afdeb78 100644 --- a/Tools/RynthCore.RynthAiHostTests/Tests/OffhandTests.cs +++ b/Tools/RynthCore.RynthAiHostTests/Tests/OffhandTests.cs @@ -364,10 +364,15 @@ internal static class OffhandTests t = 500; Check.False(g.TryBeginSwap("weapon"), "the shield is still in hand"); wielded[7] = false; - Check.True(g.TryBeginSwap("weapon"), "the shield is off: the weapon goes at once (not at 3 s)"); - t = 700; - Check.False(g.TryBeginSwap("off hand"), "under the 400 ms floor"); - t = 1000; + t = 2999; + Check.False(g.TryBeginSwap("weapon"), "a pack move: the full 3 s even once it reads done (the server's unwield motion, 13:58 wedge)"); + t = 3000; + Check.True(g.TryBeginSwap("weapon"), "after 3 s"); + long claims = g.Claims; + t = 3300; + Check.False(g.TryBeginSwap("off hand"), "a use (the weapon): under the 400 ms floor"); + Check.Eq(g.Claims, claims, "a refused claim doesn't count"); + t = 3600; idle = false; Check.False(g.TryBeginSwap("off hand"), "the weapon's use is still unanswered"); idle = true;