fix(inventory): await final wield confirmation
Keep the retail inventory transaction busy until authoritative WieldObject confirms the requested weapon. This prevents rapid weapon changes from overlapping on ACE and rejecting otherwise valid items such as spears. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
815ce0dec4
commit
ea5cf5b842
8 changed files with 115 additions and 9 deletions
|
|
@ -85,6 +85,13 @@ public sealed class ClientObjectTable
|
|||
/// </summary>
|
||||
public event Action<ClientObject>? MoveRolledBack;
|
||||
|
||||
/// <summary>
|
||||
/// Fires after the server has confirmed the final outstanding request for
|
||||
/// an optimistically moved item. This is later than <see cref="ObjectMoved"/>,
|
||||
/// which also fires for the initial local projection.
|
||||
/// </summary>
|
||||
public event Action<ClientObject>? MoveRequestConfirmed;
|
||||
|
||||
/// <summary>
|
||||
/// Fires for every InventoryServerSaveFailed response, including requests
|
||||
/// which did not mutate the table optimistically. Transaction coordinators
|
||||
|
|
@ -258,8 +265,16 @@ public sealed class ClientObjectTable
|
|||
public void ConfirmMove(uint itemId)
|
||||
{
|
||||
if (!_pendingMoves.TryGetValue(itemId, out var p)) return;
|
||||
if (p.outstanding <= 1) _pendingMoves.Remove(itemId);
|
||||
else _pendingMoves[itemId] = (p.container, p.slot, p.equip, p.outstanding - 1);
|
||||
if (p.outstanding <= 1)
|
||||
{
|
||||
_pendingMoves.Remove(itemId);
|
||||
if (_objects.TryGetValue(itemId, out ClientObject? item))
|
||||
MoveRequestConfirmed?.Invoke(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pendingMoves[itemId] = (p.container, p.slot, p.equip, p.outstanding - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The server rejected a move (InventoryServerSaveFailed 0x00A0) — restore the item to its
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue