Commit graph RynthCore/src/RynthCore.Engine/Compatibility/AutoIdDrain.cs
Author SHA1 Message Date
Daniel Wallace
831001796b AutoId: a selected target alone no longer holds the pack
A hunting bot nearly always has something selected, so holding Inventory appraisals on a
selection would leave the pack (mana stones included) unread. Combat is now a cast in
flight (CastGate) or an attack running (ClientActionGates) only, in the pure
AutoIdPolicy.InCombat, which takes the selection as input and ignores it.

Tests: target selected with no cast and no attack is not combat and the pack sends; a
cast, or an attack, alone is combat.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 17:18:14 -07:00
Daniel Wallace
8668f2a3ca AutoId review fixes: tag before send, pack waits out combat, sweep retries
- The flight tag is registered BEFORE _requestId again, so a 0xC8 that AC puts on the
  wire inside the call is still tagged. EngineSend returns a token; a call that returns
  false or throws hands it to EngineSendFailed, which retires the entry (a no-op once it
  was matched, or when the slot now holds another id). FlightRecorderTests: a synchronous
  send is tagged, a failed send leaves no live entry, a retire for another id or a bad
  token is a no-op.
- Inventory sends wait (WaitCombat, kept, counted once) while a target is selected, a
  cast is in flight (CastGate.GetCastBusyState) or an attack runs
  (ClientActionGates.TryReadAttacking). Each 0xC8 raises AC's busy count, which plugins
  gate casts on. The selected target and an open container are not held; All mode is
  unchanged. combat= in the minute line, combat in /rc autoid status.
- The login sweep looks into containers only (ItemsCapacity > 0 in the PWD snapshot, the
  engine's own pack rule), skips a tick while the pending list is full, and is marked
  done only when nothing overflowed; otherwise it runs again once there is room.
- CollectOwnedIdsFromSnapshot has its doc comment back; HasPwdSnapshot and the new
  IsContainerInSnapshot have their own. LiveWorld's send is renamed QueueIdentify and
  block-bodied, so check_offthread_mutators.py scans it and its allow-list entry no
  longer also covers the create-path Enqueue.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 17:18:14 -07:00
Daniel Wallace
c9bbafbfb4 AutoId review fixes: login pack sweep, refused sends kept, flight tag after send
- The login pack was never appraised: at login the PWD snapshot is cold, so ownership
  reads miss, the item classified Unknown and was skipped at 2 s. Unknown now waits
  (WaitSnapshot) until the snapshot has entries or 120 s pass, and a one-shot sweep runs
  at LoginCompleteAtMs + 30 s (and again after a hot reload's MarkAlreadyComplete, which
  restamps login): the player's owned items plus each owned side pack, uncached ones
  added as inventory work. The 5/s inventory cap still applies.
- The drain moved into AutoIdDrain.cs, a pure unit behind IAutoIdWorld, so it runs
  against a fake world in EngineRobustnessTests (cold snapshot for N seconds, then every
  pack item is sent, none before login + 30 s, at most 5 per second).
- A refused EnqueueRequestId keeps the entry, is not counted as sent, ends the tick's
  sending and does not take the inventory rate slot. The priority target is re-armed on
  refusal.
- The flight tag is registered only after _requestId returns true; the pending table is
  256 (MaxRequestIdQueue); IdentifyTagging covers 200 registrations and 200 matches.
- The 4096 pending cap applies only in Limited mode; _incoming is bounded at 16384 while
  DrainTick returns early, dropping the oldest and counting them.
- 0x0022 InventoryPutObjInContainer is read in SmartBoxHooks.ParseGameEvent so it works
  with ServerMessageStream off; ServerMessageStream is back to its base text.
- check_offthread_mutators.py: the stale DrainPending allow-list entry is replaced by
  LiveWorld's Enqueue.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 17:18:13 -07:00