RynthAi jump loot: flight budget for in-air sends

A pickup sent in the air on an earlier jump is a no-bend-down pickup
only if the server still sees the character jumping when the move
reaches it. Sent late in the flight it arrived after the landing, and
ACE played the whole bend-down and Return (about 2 s; in client logs
from one server the in-air bend-downs came out at 1701 and 2707 ms) where
landing and taking a fresh jump costs about 0.5 s.

When jumpAge + the recent no-bend-down send-to-off-corpse time (mean of
the last 4, 200 ms until one is measured) is over LootJumpFlightBudgetMs
(809, the largest jumpAge + off-corpse among 56 in-air no-bend-down sends
in those logs), the pickup is held for the landing and then goes with a
fresh jump. The hold is logged once per send. A slot resend keeps the
jump inside the budget and goes plain past it.

Only jump sends take this path, so it needs Jump When Looting
(LootJumpEnabled, default off).

Host tests: a slot resend inside the budget keeps the jump flag and one
past it drops it; the window after a slot resend is anchored to the
jump; the reset clears the hold-logged flag; the budget lets an early
in-air send through and holds a late one until the landing, then jumps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-07 09:36:35 -08:00
commit f758a35b37
2 changed files with 172 additions and 9 deletions

View file

@ -52,16 +52,21 @@ internal static class LootJumpTests
r.Add("jump loot: a send the client's held request slot refused (chat line) is sent again within 250 ms, is not one of the 3 tries, and does not wait the answer window", SlotRefusedResentQuickly);
r.Add("jump loot: a slot refusal heard long after the send, or a player's words, is not ours (no resend)", LateSlotRefusalIgnored);
r.Add("jump loot: a refusal line 100 ms after the send, then the server answer at 200 ms, is a single move", ForeignRefusalThenAnswerSingleMove);
r.Add("jump loot: a slot resend inside the flight budget keeps the jump flag", ResendInsideBudgetKeepsJump);
r.Add("jump loot: a slot resend past the flight budget drops the jump flag", ResendPastBudgetDropsJump);
r.Add("jump loot: slot resends go on past 7.5 s (9 s of refusals, still resending, no try used)", SlotResendsStillGoingAt9s);
r.Add("jump loot: after 11.5 s of slot refusals the ordinary answer wait takes over", SlotResendCapHandsOver);
r.Add("jump loot: a send made while the motion queue is busy has its refusal at 700 ms taken for its own and resent", DeferredSendRefusalAt700IsResent);
r.Add("jump loot: another item action just before the refusal line keeps it from being taken for ours (one move)", ForeignItemActionSuppressesAttribution);
r.Add("jump loot: ResetCurrentLootItem clears the slot-refusal fields", ResetClearsSlotFields);
r.Add("jump loot: the no-bend-down window after a resend is anchored to the jump, not the resend", AirWindowAnchoredToTheJump);
r.Add("jump loot: ResetCurrentLootItem clears the slot-refusal fields and the hold-logged flag", ResetClearsSlotFields);
r.Add("jump loot: with Jump When Looting off a slot refusal line changes nothing (no quick resend)", SlotNetNeedsJumpLoot);
r.Add("jump loot: a slot refusal heard while a fight has the tick is resent only after the fight, at once, with no try used", SlotRefusalWaitsOutAFight);
r.Add("jump loot: a UseOnFor between the loot send and the refusal line keeps the line from being taken for ours (no resend)", UseOnForSuppressesAttribution);
r.Add("jump loot: the looter's own UseOnFor (Loot) is not stamped, so a refusal line after it is still ours (resent)", LootUseOnForIsNotStamped);
r.Add("jump loot: another item action 1 s before a busy-queue send (2500 ms window) keeps its refusal line from being taken for ours", ForeignActionLookbackUsesSendWindow);
r.Add("jump loot: the flight budget lets an early in-air send through with no new jump", FlightBudgetLetsEarlySendThrough);
r.Add("jump loot: the flight budget holds a late in-air send until the landing, then jumps again", FlightBudgetHoldsLateSend);
r.Add("jump loot: a fast refusal that is not 'too busy' (a code-0 save-failed) does not turn the no-bend-down call off", NonBusyRefusalKeepsNoMotion);
r.Add("jump loot: a send with no jump still waits PickupAnswerMinMs before its answer is believed", NoJumpKeepsAnswerFloor);
r.Add("jump loot: a jump send's weak sign (an unowned stack, no pack stack grown) still waits PickupAnswerMinMs", JumpWeakSignKeepsAnswerFloor);
@ -481,6 +486,32 @@ internal static class LootJumpTests
Check.Eq(FakeHost.ExternalMoves.Count, 1, "a single move: the answer beat the resend");
});
private static void ResendInsideBudgetKeepsJump() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
Air(up: true);
Check.True(Field<bool>("_currentLootItemJumped"), "the first send rode the jump");
TickFor(tick, 2 * TickMs);
_bot.NoteSlotRefusalChat(SlotChat);
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 1000);
Check.Eq(FakeHost.ExternalMoves.Count, 2, "sent again");
Check.True(Field<bool>("_currentLootItemJumped"), "250 ms in, inside the budget: the resend keeps the jump (a no-bend-down answer is still believed)");
Check.Eq(FakeHost.TapJumps, 1, "and takes no new jump");
});
private static void ResendPastBudgetDropsJump() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
Air(up: true);
SetField("_noMotionOffCorpse", new long[] { 700, 0, 0, 0 }); // a slow server: jumpAge + 700 is over the budget
SetField("_noMotionOffCorpseCount", 1);
TickFor(tick, 2 * TickMs);
_bot.NoteSlotRefusalChat(SlotChat);
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 1000);
Check.Eq(FakeHost.ExternalMoves.Count, 2, "sent again");
Check.False(Field<bool>("_currentLootItemJumped"), "past the budget the resend goes plain (the floor applies)");
});
// The resends are time-based: the engine clears a request slot whose object is still present only
// after 10 s, so the item keeps being sent for SlotRefusalGiveUpMs from its first refusal.
// One refused send after another, each answered by a refusal line 40 ms after the send, for
@ -564,17 +595,41 @@ internal static class LootJumpTests
Check.False(FakeHost.Logs.Any(l => l.Contains("request slot refused")), "not logged as ours");
});
// The no-bend-down window after a pickup is anchored to the JUMP (it ends JumpLandMaxMs after
// it), not to the send that confirmed: a resend 250 ms later must not stretch it.
private static void AirWindowAnchoredToTheJump() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
long jumpAt = _now;
Air(up: true);
TickFor(tick, 2 * TickMs);
_bot.NoteSlotRefusalChat(SlotChat);
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 1000);
Check.Eq(FakeHost.ExternalMoves.Count, 2, "resent");
long resendAt = _now;
TickFor(tick, 100);
FakeHost.Containers[GemA] = Player; // no bend-down
TickUntil(tick, () => Confirmed(GemA), 500);
Check.True(Confirmed(GemA), "confirmed");
Check.True(FakeHost.Logs.Any(l => l.Contains("no bend-down or Return to wait for")), "as a no-bend-down pickup");
long until = Field<long>("_jumpPickupAirUntil");
Check.True(Math.Abs(until - (jumpAt + ActionPacer.JumpLandMaxMs)) <= TickMs,
$"the window ends JumpLandMaxMs after the jump: {until - jumpAt} ms from it (resend was {resendAt - jumpAt} ms in)");
});
private static void ResetClearsSlotFields() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
TickFor(tick, 2 * TickMs);
_bot.NoteSlotRefusalChat(SlotChat);
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 1000);
SetField("_flightHoldLogged", true);
Check.True(Field<int>("_currentLootItemSlotResends") > 0, "a slot resend was made");
typeof(RynthAiPlugin).GetMethod("ResetCurrentLootItem", Any)!.Invoke(_bot, null);
Check.Eq(Field<int>("_currentLootItemSlotResends"), 0, "resends cleared");
Check.Eq(Field<int>("_currentLootItemSlotSeqAtSend"), 0, "baseline cleared");
Check.Eq(Field<long>("_currentLootItemSlotRefusedAt"), 0L, "refusal time cleared");
Check.False(Field<bool>("_flightHoldLogged"), "hold-logged flag cleared");
});
// The net runs with Jump When Looting on only: with it off, a refusal line changes nothing and
@ -670,6 +725,46 @@ internal static class LootJumpTests
Check.False(Field<bool>("_currentLootItemFightHeld"), "the fresh send carries no fight flag");
});
// The flight budget (RynthAiPlugin.LootJumpFlightBudgetMs): a send in the air with no fresh jump is
// predicted by jumpAge + the recent no-bend-down answer time.
private static void FlightBudgetLetsEarlySendThrough() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: true, stamina: 100u, serverGates: true, thirdGem: true);
uint first = FakeHost.ExternalMoves[0].Id;
Air(up: true);
TickFor(tick, 100);
FakeHost.Containers[first] = Player; // answered 100 ms in, no bend-down
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 500);
Check.Eq(FakeHost.ExternalMoves.Count, 2, "the next send goes out at the confirm: " + Order());
Check.Eq(FakeHost.TapJumps, 1, "in the air, with no new jump");
Check.False(FakeHost.Logs.Any(l => l.Contains("holding 0x")), "no hold logged");
});
private static void FlightBudgetHoldsLateSend() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: true, stamina: 100u, serverGates: true, thirdGem: true);
uint first = FakeHost.ExternalMoves[0].Id;
Air(up: true);
TickFor(tick, 460);
FakeHost.Containers[first] = Player; // answered ~480 ms in, still no bend-down (under the 500 ms mark)
TickUntil(tick, () => Confirmed(first), 300);
Check.True(Confirmed(first), "the first is confirmed");
Check.True(FakeHost.Logs.Any(l => l.Contains("no bend-down or Return to wait for")), "as a no-bend-down pickup");
// jumpAge ~500 plus an answer that took ~480 ms is over the budget: the next one waits for the landing.
TickFor(tick, 400);
Check.Eq(FakeHost.ExternalMoves.Count, 1, "no send into the rest of the flight: " + Order());
Check.Eq(FakeHost.TapJumps, 1, "no jump yet");
Check.Eq(FakeHost.Logs.Count(l => l.Contains("holding 0x")), 1, "the hold is logged once");
string hold = FakeHost.Logs.FirstOrDefault(l => l.Contains("holding 0x")) ?? "(none)";
Check.True(hold.Contains("ms into the flight") && hold.Contains("takes about 4"), "naming jumpAge and expectedAnswerMs: " + hold);
Air(up: false); // landed
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 1500);
Check.Eq(FakeHost.ExternalMoves.Count, 2, "after the landing the next goes");
int at = FakeHost.Order.IndexOf($"move:{FakeHost.ExternalMoves[1].Id:X8}");
Check.True(at > 0 && FakeHost.Order[at - 1] == "tapjump", "with a fresh jump: " + Order());
Check.Eq(FakeHost.TapJumps, 2, "two jumps in all");
});
// Only "You're too busy" (0x1D) proves the no-bend-down call wrong. A save-failed with
// no code (a full pack, or anything else) that comes fast is not that evidence.
private static void NonBusyRefusalKeepsNoMotion() => Clocked(() =>