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>
This commit is contained in:
Daniel Wallace 2026-10-12 16:29:54 -07:00
commit 831001796b
5 changed files with 29 additions and 13 deletions

View file

@ -27,8 +27,8 @@
// a client crashed in AC's CreateObject handling during the
// login create burst). A container the player opened after the last
// transition ended is not deferred. Inventory sends are capped at 5 a
// second and wait while a target is selected or a cast or attack is in
// flight. Creatures, ground items, other players: never.
// second and wait while a cast or attack is in flight (a selected
// target alone does not hold them). Creatures, ground items, other players: never.
// Off nothing, the selected target included.
// Plugins calling the host RequestId are not limited by any of this.
//
@ -98,7 +98,7 @@ internal static class AutoIdPolicy
WaitRate,
/// <summary>Place unknown and the object snapshot still empty: keep it (up to UnknownMaxWaitMs).</summary>
WaitSnapshot,
/// <summary>Inventory while in combat (a target selected, a cast or an attack in flight): keep it.</summary>
/// <summary>Inventory while in combat (a cast or an attack in flight, InCombat): keep it.</summary>
WaitCombat,
}
@ -113,8 +113,7 @@ internal static class AutoIdPolicy
/// <paramref name="inventoryRateOk"/>: Inventory only, the send rate allows one now (<see cref="InventoryRateAllows"/>).
/// <paramref name="snapshotWarm"/>: Unknown only, the object snapshot has been filled (an
/// object missing from a warm snapshot is not coming; one missing from a cold one may be).
/// <paramref name="combatBusy"/>: Inventory only, a target is selected or a cast or attack is in
/// flight. Each 0xC8 raises AC's busy count, which plugins gate casts on, so the pack waits.
/// <paramref name="combatBusy"/>: Inventory only, a cast or attack is in flight (<see cref="InCombat"/>). Each 0xC8 raises AC's busy count, which plugins gate casts on, so the pack waits.
/// </summary>
public static Verdict Decide(AutoIdMode mode, Class cls, long ageMs, bool inDefer, bool openedAfterSettle,
bool fresh, bool cached, bool inventoryRateOk = true, bool snapshotWarm = true,
@ -161,6 +160,15 @@ internal static class AutoIdPolicy
}
}
/// <summary>
/// In combat for the Inventory hold: a cast in flight (<paramref name="castBusy"/>, CastGate) or an
/// attack running. A selected target alone is NOT combat (<paramref name="selectedTarget"/> is taken
/// only so the tests can show that): a hunting bot nearly always has something selected, and the
/// pack (mana stones included) would never be appraised.
/// </summary>
public static bool InCombat(uint selectedTarget, int castBusy, bool attacking) =>
castBusy != 0 || attacking;
/// <summary>
/// When the last transition ended: the later of the settle window's end
/// (WorldTransitionState.SettleUntilMs, 0 = none yet; it only moves on a death, a portal,