RynthAi jump loot: answer merged stacks on arrival
A jump send that merged into a pack stack still waited the 500 ms PickupAnswerMinMs floor, kept for fear that a merged-away object leaves the client's request slot held. In client logs from one server the merged stacks were off the corpse 157-234 ms after the send but confirmed only at 500-516 ms, and the next send, made 1 ms after the confirm, was answered normally, so the slot was free. A jump send's merge is now answered on arrival when it is positively seen: a same-name pack stack grown (checked whenever the item is not in a pack), or the object of a STACK gone from the client. An unowned stack still in the client, and a non-stack object that vanishes, keep the floor, as does every send with no jump. The rare held slot is caught by the slot-refusal resend; its log line now says whether a floor-less merge confirm came just before it. Only jump sends take this path, so it needs Jump When Looting (LootJumpEnabled, default off). Host tests: a jump merge into a grown stack and a jump stack gone from the client are confirmed before the floor; a no-jump merge and a vanished non-stack keep it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
04ecdd64f4
commit
1fc4d68cfc
2 changed files with 106 additions and 28 deletions
|
|
@ -245,6 +245,7 @@ public sealed partial class RynthAiPlugin
|
|||
private long _currentLootItemSlotWindowMs = SlotRefusalAttributionMs; // how late after the current send its refusal line may arrive
|
||||
private long _currentLootItemFirstSlotRefusalAt; // when the current item's first slot refusal was seen (0 = none)
|
||||
private bool _currentLootItemSlotGaveUp; // the resends ran out of time: the ordinary answer wait has the item
|
||||
private long _lastEarlyMergeConfirmAt; // when a jump send's merge was confirmed before PickupAnswerMinMs (0 = none)
|
||||
private int _slotRefusalCollisions; // refusals of a send by the held slot, this session
|
||||
// [LootEval] lines: one per item per open (a matched item was re-printed before every pickup).
|
||||
private readonly Dictionary<int, string> _lootEvalLogged = new();
|
||||
|
|
@ -2349,8 +2350,13 @@ public sealed partial class RynthAiPlugin
|
|||
_currentLootItemSlotRefusedAt = now;
|
||||
if (_currentLootItemFirstSlotRefusalAt == 0) _currentLootItemFirstSlotRefusalAt = now;
|
||||
_slotRefusalCollisions++;
|
||||
long sinceMerge = _lastEarlyMergeConfirmAt == 0 ? -1 : now - _lastEarlyMergeConfirmAt;
|
||||
LootDiag($"[RynthAi] {LootTag}: the client's one request slot refused the move of 0x{(uint)_currentLootItemId:X8}: the line arrived {after} ms after the send (window {_currentLootItemSlotWindowMs} ms) " +
|
||||
$"(refusal #{_slotRefusalCollisions} this session); sending it again in {SlotRefusalRetryMs} ms, not counted as a try.");
|
||||
$"(refusal #{_slotRefusalCollisions} this session; " +
|
||||
(sinceMerge >= 0 && sinceMerge < 3000
|
||||
? $"the last confirm, {sinceMerge} ms ago, was a merge taken before the {PickupAnswerMinMs} ms floor"
|
||||
: "no floor-less merge confirm just before") +
|
||||
$"); sending it again in {SlotRefusalRetryMs} ms, not counted as a try.");
|
||||
}
|
||||
|
||||
if (now - _currentLootItemMoveRequestedAt < SlotRefusalRetryMs)
|
||||
|
|
@ -2729,18 +2735,42 @@ public sealed partial class RynthAiPlugin
|
|||
// Merged into a stack in the pack (it never shows up in the inventory): gone from the
|
||||
// client, unowned and a stack when sent (ours, 064a07a), or a same-name stack in the
|
||||
// pack has grown since the send (PR #16) - whichever shows first.
|
||||
// The grown-stack check always runs when the item is not in a pack (it used to be skipped
|
||||
// when the unowned-stack test had already said "merged"): it is the evidence a jump send
|
||||
// is confirmed early on.
|
||||
int mergedInto = 0;
|
||||
bool grown = !inPack && MergedIntoInventoryStack(out mergedInto);
|
||||
bool mergedAway = !inPack
|
||||
&& (currentItem == null || ObjectGoneFromClient(_currentLootItemId) || (currentContainer == 0 && _currentLootItemStackable)
|
||||
|| MergedIntoInventoryStack(out mergedInto));
|
||||
|| grown);
|
||||
bool landed = inPack || mergedAway;
|
||||
// The floor is ACE's motion time; a jump send skips it only for the item seen in a pack,
|
||||
// the server's answer about that object, which also frees the client's one request slot
|
||||
// (a merged-away object can leave the slot held, so a merge keeps the floor).
|
||||
// The floor is ACE's motion time; a jump send skips it for the server-only answers: the
|
||||
// item seen in a pack, or a merge with positive evidence that the whole merge was
|
||||
// applied - a pack stack seen grown, or the object of a stack gone from the client (ACE's
|
||||
// InventoryRemoveObject for it). An unowned stack with the object still in the client
|
||||
// (mergedAway only through `currentContainer == 0 && stackable`) stays weak: the corpse
|
||||
// item has been taken off but nothing yet says the pack stack took it, and an item
|
||||
// moved some other way looks the same, so that keeps the floor.
|
||||
// The client's one request slot: a merged-away object CAN leave it held (the server's
|
||||
// answer finds no object to clear it for: RynthCore ClientActionGates), and then the next
|
||||
// send is refused locally. That used to be the reason for keeping the floor on every
|
||||
// merge; in client logs from one server merged stacks were off the corpse 157-234 ms
|
||||
// after the send and the next send, made 1 ms after the confirm, was answered normally,
|
||||
// so the slot was free. The rare held slot is caught instead: the refusal is heard in chat
|
||||
// and the send repeated at once (PollSlotRefusal), never costing a try.
|
||||
bool jumpAnswer = _currentLootItemJumped && inPack;
|
||||
bool believable = jumpAnswer || now - _currentLootItemMoveRequestedAt >= PickupAnswerMinMs;
|
||||
// Only a stack can merge away: a non-stack object that vanishes (the corpse decayed,
|
||||
// someone else looted it) is not an answer and waits the floor.
|
||||
bool mergeEvidence = !inPack
|
||||
&& (mergedInto != 0
|
||||
|| (_currentLootItemStackable && (currentItem == null || ObjectGoneFromClient(_currentLootItemId))));
|
||||
bool jumpMergeAnswer = _currentLootItemJumped && mergeEvidence;
|
||||
bool belowFloor = now - _currentLootItemMoveRequestedAt < PickupAnswerMinMs;
|
||||
bool believable = jumpAnswer || jumpMergeAnswer || !belowFloor;
|
||||
long since = now - _currentLootItemLeftAt;
|
||||
bool answered = landed && believable;
|
||||
if (answered && jumpMergeAnswer && belowFloor)
|
||||
_lastEarlyMergeConfirmAt = now; // a send made right after this one is the one a held slot would refuse (PollSlotRefusal)
|
||||
if (!answered && since < PickupArriveMaxMs)
|
||||
return;
|
||||
ConfirmCurrentLootItem(
|
||||
|
|
|
|||
|
|
@ -47,10 +47,13 @@ internal static class LootJumpTests
|
|||
r.Add("jump loot: a jump pickup answered only after a bend-down's time still waits for its Return before the corpse is released", SlowAnswerKeepsReturnWait);
|
||||
r.Add("jump loot: a bend-down answer inside an earlier jump's flight ends it: the next item is queued behind that Return, with no jump", SlowAnswerEndsAirWindow);
|
||||
r.Add("jump loot: a jump send's answer at 150 ms is confirmed then, and the next corpse opened then, not at 500 ms", JumpAnswerConfirmedOnArrival);
|
||||
r.Add("jump loot: a jump send merged into a pack stack keeps the floor (the client's request slot stays held for a merged-away object)", JumpMergeKeepsAnswerFloor);
|
||||
r.Add("jump loot: the no-bend-down window after an in-air send that rode an earlier jump is anchored to that jump", AirWindowAnchoredToTheInAirJump);
|
||||
r.Add("jump loot: a jump send merged into a pack stack (object still in the client, unowned; stack grown) is confirmed on arrival, before the 500 ms floor", JumpMergeConfirmedOnArrival);
|
||||
r.Add("jump loot: a jump send of a stack whose object is gone from the client with no stack grown is confirmed on arrival too", JumpGoneConfirmedOnArrival);
|
||||
r.Add("jump loot: a send with no jump that merged still waits PickupAnswerMinMs", NoJumpMergeKeepsAnswerFloor);
|
||||
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 non-stack object that vanishes is no merge answer: the floor stays", NonStackVanishKeepsFloor);
|
||||
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: 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);
|
||||
|
|
@ -369,27 +372,6 @@ internal static class LootJumpTests
|
|||
Check.True(FakeHost.Logs.Any(l => l.Contains("no bend-down or Return to wait for")), "classed as a pickup with no bend-down");
|
||||
});
|
||||
|
||||
private static void JumpMergeKeepsAnswerFloor() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true, packStack: true);
|
||||
Check.Eq(FakeHost.ExternalMoves[0].Id, GemA, "the corpse gem goes");
|
||||
long sent = _now;
|
||||
TickFor(tick, AnswerAtMs - TickMs);
|
||||
// ACE StackableMerge: the corpse item is removed (gone from the client) and the pack stack grows.
|
||||
FakeHost.Containers.Remove(GemA);
|
||||
FakeHost.Names.Remove(GemA);
|
||||
FakeHost.Positions.Remove(GemA);
|
||||
FakeHost.Ints[(PackStack, KeyStack)] = 4;
|
||||
// The client's one-request slot is emptied only by an answer about that same object, and a
|
||||
// merged-away object is gone (RynthCore ClientActionGates): the slot can stay held, and a move
|
||||
// sent now would be dropped by the client. The floor is kept.
|
||||
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
|
||||
Check.True(confirmedAfter >= RynthAiPlugin.PickupAnswerMinMs, $"a merge keeps the floor: confirmed {confirmedAfter} ms after the send");
|
||||
// (By the floor the gem is gone from the client, which names no stack: either merge wording.)
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("pickup confirmed") && l.Contains("merged into")), "as a merge into the pack stack: "
|
||||
+ (FakeHost.Logs.LastOrDefault(l => l.Contains("pickup confirmed")) ?? "(none)"));
|
||||
});
|
||||
|
||||
// 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 second send that rode the first jump, in the air, must
|
||||
// not stretch it.
|
||||
|
|
@ -416,6 +398,72 @@ internal static class LootJumpTests
|
|||
$"the window ends JumpLandMaxMs after the jump: {until - jumpAt} ms from it (the second send was {secondAt - jumpAt} ms in)");
|
||||
});
|
||||
|
||||
private static void JumpMergeConfirmedOnArrival() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true, packStack: true);
|
||||
Check.Eq(FakeHost.ExternalMoves[0].Id, GemA, "the corpse gem goes");
|
||||
long sent = _now;
|
||||
TickFor(tick, AnswerAtMs - TickMs);
|
||||
// The object is still in the client, unowned (container 0: the unowned-stack test alone says
|
||||
// "merged"), and the same-name pack stack has grown. Only the grown stack is positive
|
||||
// evidence here, so this pins `mergedInto != 0` (and that the grown-stack check runs when
|
||||
// the unowned-stack test has already matched).
|
||||
FakeHost.Containers[GemA] = 0;
|
||||
FakeHost.Ints[(PackStack, KeyStack)] = 4;
|
||||
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
|
||||
Check.True(confirmedAfter >= 0 && confirmedAfter <= AnswerAtMs + TickMs,
|
||||
$"a merge on a jump send is confirmed on the tick it shows ({AnswerAtMs} ms), not at the floor: {confirmedAfter} ms after the send");
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("pickup confirmed") && l.Contains("merged into the stack 0x" + PackStack.ToString("X8"))),
|
||||
"as a merge into the grown pack stack: " + (FakeHost.Logs.LastOrDefault(l => l.Contains("pickup confirmed")) ?? "(none)"));
|
||||
Check.True(Field<long>("_lastEarlyMergeConfirmAt") != 0, "noted as a floor-less merge confirm (the slot-refusal log reads it)");
|
||||
});
|
||||
|
||||
// The object gone from the client is the evidence on its own for a STACK (ACE's
|
||||
// InventoryRemoveObject), with no same-name stack grown.
|
||||
private static void JumpGoneConfirmedOnArrival() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true, packStack: true);
|
||||
long sent = _now;
|
||||
TickFor(tick, AnswerAtMs - TickMs);
|
||||
FakeHost.Containers.Remove(GemA);
|
||||
FakeHost.Names.Remove(GemA);
|
||||
FakeHost.Positions.Remove(GemA); // the pack stack stays at 3
|
||||
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
|
||||
Check.True(confirmedAfter >= 0 && confirmedAfter <= AnswerAtMs + TickMs,
|
||||
$"gone from the client is enough on a jump send: confirmed {confirmedAfter} ms after the send");
|
||||
});
|
||||
|
||||
// A single object (not a stack) that vanishes (the corpse decayed, someone else looted it) is no
|
||||
// merge and no answer: the floor stays.
|
||||
private static void NonStackVanishKeepsFloor() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
long sent = _now;
|
||||
TickFor(tick, AnswerAtMs - TickMs);
|
||||
FakeHost.Containers.Remove(GemA);
|
||||
FakeHost.Names.Remove(GemA);
|
||||
FakeHost.Positions.Remove(GemA);
|
||||
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
|
||||
Check.True(confirmedAfter >= RynthAiPlugin.PickupAnswerMinMs,
|
||||
$"a vanished non-stack keeps the floor ({RynthAiPlugin.PickupAnswerMinMs} ms): confirmed {confirmedAfter} ms after the send");
|
||||
});
|
||||
|
||||
// The same merge on a send with no jump: ACE plays the pickup motion first, so the floor stays.
|
||||
private static void NoJumpMergeKeepsAnswerFloor() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: false, secondGem: false, stamina: 100u, serverGates: true, packStack: true);
|
||||
Check.Eq(FakeHost.TapJumps, 0, "no jump went out");
|
||||
long sent = _now;
|
||||
TickFor(tick, AnswerAtMs - TickMs);
|
||||
FakeHost.Containers.Remove(GemA);
|
||||
FakeHost.Names.Remove(GemA);
|
||||
FakeHost.Positions.Remove(GemA);
|
||||
FakeHost.Ints[(PackStack, KeyStack)] = 4;
|
||||
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
|
||||
Check.True(confirmedAfter >= RynthAiPlugin.PickupAnswerMinMs,
|
||||
$"a merge with no jump keeps the floor ({RynthAiPlugin.PickupAnswerMinMs} ms): confirmed {confirmedAfter} ms after the send");
|
||||
});
|
||||
|
||||
private const string SlotChat = "You can only move or use one item at a time";
|
||||
|
||||
// The client's one request slot is held: it prints its refusal locally and sends nothing, so the
|
||||
|
|
|
|||
Loading…
Reference in a new issue