RynthAi jump loot: resend at once when the client's request slot refused the move
The acclient holds one pending inventory request. While it is held, it
refuses any other item move with a LOCAL chat line ("You can only move or
use one item at a time"): nothing reaches the server, no WeenieError
comes, and the engine's MoveItemExternal returns true regardless. The
looter took that send for one in flight and waited the whole answer
window (PickupAnswerWaitMs, 4-8 s) before trying again, and the retry
cost the item one of its 3 tries. At the jump-loot cadence this stalled
the loot 4-8 s at a time.
The line is now heard (NoteSlotRefusalChat, anchored at the line start,
stamped with its arrival time on the loot clock) and attributed to the
current send when it arrived within the send's window (200 ms, or 2.5 s
for a send made while the motion queue was busy, since the engine's main
thread queue holds the move that long) and no other item action of this
plugin went out between that same window before the send and the line
(UseAudit.LastItemActionAt). The send is then repeated 250 ms after it,
without a jump, never counted as one of the 3 tries or as a too-busy free
retry, for up to 11.5 s from the item's first slot refusal (the engine
clears a held slot after 10 s); then the ordinary answer wait takes over.
The refusal baseline is taken in SendLootPickup, the one path every send
goes through, own-corpse sends included.
Item actions are stamped at every UseFor and UseOnFor except the
looter's own, the wand, weapon and offhand wields, the ground pickup, the
give helper and the item tool's give, the salvage sends and panel adds,
the meta give actions and salvage-panel add, the MagTools give, drop and
dequip, the HUD and MiniRemote uses, the stack merges and the trade adds.
Not stamped: vendor buy and sell, the salvage panel execute, pack-to-pack
moves and stack splits, the legacy swap wields and the dashboard's panel
drag (the UseAudit doc names the files). Other plugins' item actions are
not seen: each plugin compiles its own copy of UseAudit.
Adapted to upstream's fight hold: no slot resend while a fight has the
tick (the client drops an item move while the character attacks); the
line is attributed by its arrival time, so the resend goes at once after
the fight, and the fresh send does not inherit the fight flag.
Gated by Jump When Looting (LootJumpEnabled, default off): the net was
measured and tuned on ACE's jump-loot cadence. With the setting off every
send keeps its old wait. The UseAudit stamps are a timestamp only.
Host tests: a slot-refused send is resent in about 250 ms with no try
used; a late line or a player's words are not ours; a line then the
server's answer at 200 ms is one move; resends go on past 7.5 s and hand
over after 11.5 s; a busy-queue send's refusal at 700 ms is its own;
another item action before the line, a UseOnFor included, suppresses it,
and so does one 1 s before a busy-queue send; the reset clears the slot
fields; the looter's own UseOnFor is not stamped, so a line after it is
still ours; with the setting off nothing changes; a refusal during a fight
(driven through the real fight hold) is resent only after it; an
own-corpse send after an earlier refusal line is one move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
88680977f5
commit
04ecdd64f4
22 changed files with 526 additions and 5 deletions
|
|
@ -49,6 +49,19 @@ internal static class LootJumpTests
|
|||
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 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: 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: 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: 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);
|
||||
|
|
@ -69,12 +82,15 @@ internal static class LootJumpTests
|
|||
{
|
||||
var old = RynthAiPlugin.CorpseClock;
|
||||
var oldPace = ActionPacer.NowMs;
|
||||
var oldUse = UseAudit.NowMs;
|
||||
_now = 50_000_000;
|
||||
UseAudit.ForgetItemAction();
|
||||
UseAudit.NowMs = () => _now; // the item-action stamp (UseAudit.LastItemActionAt) on the same clock
|
||||
RynthAiPlugin.CorpseClock = () => _now;
|
||||
ActionPacer.NowMs = () => _now; // the loot jump's air hold (ActionPacer.LootJumpAirborne) on the same clock
|
||||
ActionPacer.ForgetLootJump();
|
||||
try { body(); }
|
||||
finally { RynthAiPlugin.CorpseClock = old; ActionPacer.NowMs = oldPace; ActionPacer.ForgetLootJump(); }
|
||||
finally { RynthAiPlugin.CorpseClock = old; ActionPacer.NowMs = oldPace; UseAudit.NowMs = oldUse; ActionPacer.ForgetLootJump(); }
|
||||
}
|
||||
|
||||
private static RynthAiPlugin _bot = null!; // the bot LootUntilFirstMove made
|
||||
|
|
@ -400,6 +416,260 @@ 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 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
|
||||
// server never answers. The send is repeated 250 ms after, without using one of the 3 tries and
|
||||
// without waiting PickupAnswerWaitMs (4-8 s).
|
||||
private static void SlotRefusedResentQuickly() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
long sent = _now;
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "one move out");
|
||||
Check.Eq(Field<int>("_currentLootItemMoveAttempts"), 1, "the first try");
|
||||
TickFor(tick, 2 * TickMs);
|
||||
_bot.NoteSlotRefusalChat(SlotChat); // the client's local refusal
|
||||
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 1000);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 2, "sent again");
|
||||
long resentAfter = _now - sent;
|
||||
Check.True(resentAfter >= RynthAiPlugin.SlotRefusalRetryMs - TickMs && resentAfter <= RynthAiPlugin.SlotRefusalRetryMs + 3 * TickMs,
|
||||
$"about {RynthAiPlugin.SlotRefusalRetryMs} ms after the refused send: {resentAfter} ms");
|
||||
Check.Eq(FakeHost.ExternalMoves[1].Id, GemA, "the same item");
|
||||
Check.Eq(Field<int>("_currentLootItemMoveAttempts"), 1, "still the first try");
|
||||
Check.Eq(Field<int>("_currentLootItemFreeRetries"), 0, "and not a too-busy free retry either");
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("request slot refused the move of 0x" + GemA.ToString("X8"))), "logged for the live logs");
|
||||
Check.False(FakeHost.Logs.Any(l => l.Contains("retrying use")), "not the ordinary retry");
|
||||
// Refused again: the same, still no try used.
|
||||
TickFor(tick, 2 * TickMs);
|
||||
_bot.NoteSlotRefusalChat(SlotChat);
|
||||
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 3, 1000);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 3, "and again");
|
||||
Check.Eq(Field<int>("_currentLootItemMoveAttempts"), 1, "still the first try");
|
||||
// The slot is free now and the server answers.
|
||||
TickFor(tick, 100);
|
||||
FakeHost.Containers[GemA] = Player;
|
||||
TickUntil(tick, () => Confirmed(GemA), 1000);
|
||||
Check.True(Confirmed(GemA), "the pickup is confirmed");
|
||||
});
|
||||
|
||||
// The refusal text of something else (a buff swap, a use) first seen long after our send is not ours,
|
||||
// and a player's words are never the client's line.
|
||||
private static void LateSlotRefusalIgnored() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
_bot.NoteSlotRefusalChat("Tarsh tells you, \"" + SlotChat + "\"");
|
||||
Check.Eq(Field<int>("_slotRefusalSeq"), 0, "a player's words never count");
|
||||
TickFor(tick, RynthAiPlugin.SlotRefusalAttributionMs + 100);
|
||||
_bot.NoteSlotRefusalChat(SlotChat);
|
||||
TickFor(tick, 600);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "no resend: the move is still awaiting its answer");
|
||||
Check.False(FakeHost.Logs.Any(l => l.Contains("request slot refused")), "not logged as ours");
|
||||
});
|
||||
|
||||
// A refusal line from something else lands 100 ms after our send (inside the attribution window,
|
||||
// so it is taken for ours); the server answers at 200 ms, before the resend is due at 250 ms:
|
||||
// one move only.
|
||||
private static void ForeignRefusalThenAnswerSingleMove() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
TickFor(tick, 100);
|
||||
_bot.NoteSlotRefusalChat(SlotChat);
|
||||
TickFor(tick, 100);
|
||||
FakeHost.Containers[GemA] = Player; // the server answer at ~200 ms
|
||||
TickFor(tick, 600);
|
||||
Check.True(Confirmed(GemA), "the pickup is confirmed");
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "a single move: the answer beat the resend");
|
||||
});
|
||||
|
||||
// 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
|
||||
// <paramref name="ms"/> of fake time. Returns the number of resends made.
|
||||
private static int RefuseForMs(Action tick, long ms)
|
||||
{
|
||||
long end = _now + ms;
|
||||
int resends = 0;
|
||||
while (_now < end)
|
||||
{
|
||||
int before = FakeHost.ExternalMoves.Count;
|
||||
TickFor(tick, 2 * TickMs);
|
||||
_bot.NoteSlotRefusalChat(SlotChat);
|
||||
TickUntil(tick, () => FakeHost.ExternalMoves.Count > before, 500);
|
||||
if (FakeHost.ExternalMoves.Count == before) break;
|
||||
resends++;
|
||||
}
|
||||
return resends;
|
||||
}
|
||||
|
||||
private static void SlotResendsStillGoingAt9s() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
int resends = RefuseForMs(tick, 9000);
|
||||
Check.True(resends >= 30, $"still resending after 9 s of refusals (a count cap of 30 would have stopped at 7.5 s): {resends} resends");
|
||||
Check.False(Field<bool>("_currentLootItemSlotGaveUp"), "not given up");
|
||||
Check.Eq(Field<int>("_currentLootItemMoveAttempts"), 1, "and no try used");
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, resends + 1, "one move per resend: " + Order());
|
||||
});
|
||||
|
||||
// After SlotRefusalGiveUpMs from the first refusal the ordinary answer wait takes over.
|
||||
private static void SlotResendCapHandsOver() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
long start = _now;
|
||||
int resends = RefuseForMs(tick, RynthAiPlugin.SlotRefusalGiveUpMs + 2000);
|
||||
Check.True(Field<bool>("_currentLootItemSlotGaveUp"), $"given up after {_now - start} ms ({resends} resends)");
|
||||
Check.True(_now - start >= RynthAiPlugin.SlotRefusalGiveUpMs, $"not before {RynthAiPlugin.SlotRefusalGiveUpMs} ms: {_now - start}");
|
||||
Check.True(_now - start <= RynthAiPlugin.SlotRefusalGiveUpMs + 1000, $"and soon after it: {_now - start}");
|
||||
int moves = FakeHost.ExternalMoves.Count;
|
||||
TickFor(tick, 2 * TickMs);
|
||||
_bot.NoteSlotRefusalChat(SlotChat);
|
||||
TickFor(tick, 1000);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, moves, "no resend after it: the ordinary answer wait (4 s or more) holds the item");
|
||||
Check.Eq(Field<int>("_currentLootItemMoveAttempts"), 1, "and no try was used");
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("the ordinary answer wait takes over")), "logged");
|
||||
});
|
||||
|
||||
// A send made while the character's motion queue is busy is held by the engine's main-thread queue
|
||||
// (up to 2.5 s): its refusal line can come long after 200 ms and is still its own.
|
||||
private static void DeferredSendRefusalAt700IsResent() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: true, stamina: 100u, serverGates: true);
|
||||
uint first = FakeHost.ExternalMoves[0].Id;
|
||||
Air(up: true);
|
||||
TickFor(tick, 100);
|
||||
FakeHost.CastBusy = 1; // the jump's motion plays
|
||||
FakeHost.Containers[first] = Player; // no bend-down: the next goes out in the air
|
||||
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 500);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 2, "the second move is out while the queue is busy");
|
||||
Check.Eq(Field<long>("_currentLootItemSlotWindowMs"), RynthAiPlugin.SlotRefusalDeferredWindowMs, "its refusal window is the deferred one");
|
||||
TickFor(tick, 700);
|
||||
_bot.NoteSlotRefusalChat(SlotChat);
|
||||
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 3, 600);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 3, "a refusal 700 ms after the send is taken for its own and the item is sent again");
|
||||
});
|
||||
|
||||
// Another item action of this plugin went out just before the line: it may be that one's refusal.
|
||||
private static void ForeignItemActionSuppressesAttribution() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
TickFor(tick, 50);
|
||||
_host.UseFor(0x80263199u, "Buff", "test: a buff item use"); // the UseAudit choke point notes it
|
||||
TickFor(tick, 50);
|
||||
_bot.NoteSlotRefusalChat(SlotChat); // 100 ms after the send
|
||||
TickFor(tick, 600);
|
||||
FakeHost.Containers[GemA] = Player; // the answer, 700 ms in
|
||||
TickFor(tick, 100);
|
||||
Check.True(Confirmed(GemA), "the pickup is confirmed");
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "one move: the line was not taken for ours");
|
||||
Check.False(FakeHost.Logs.Any(l => l.Contains("request slot refused")), "not logged as ours");
|
||||
});
|
||||
|
||||
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);
|
||||
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");
|
||||
});
|
||||
|
||||
// The net runs with Jump When Looting on only: with it off, a refusal line changes nothing and
|
||||
// the send keeps its ordinary answer wait.
|
||||
private static void SlotNetNeedsJumpLoot() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: false, secondGem: false, stamina: 100u, serverGates: true);
|
||||
TickFor(tick, 2 * TickMs);
|
||||
_bot.NoteSlotRefusalChat(SlotChat); // inside the attribution window
|
||||
TickFor(tick, 1000);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "no quick resend with jump-loot off");
|
||||
Check.False(FakeHost.Logs.Any(l => l.Contains("request slot refused")), "not taken for a slot refusal");
|
||||
});
|
||||
|
||||
// A UseOnFor (a kit, a mana stone, a lockpick) between a loot send and the refusal line is another
|
||||
// item action of this plugin: the line may be its refusal, so it is not taken for the loot send's.
|
||||
private static void UseOnForSuppressesAttribution() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
TickFor(tick, 40);
|
||||
_host.UseOnFor(0x80263198u, Player, "Buff", "test: a kit on the player"); // UseAudit.UseOnFor notes it
|
||||
TickFor(tick, 40);
|
||||
_bot.NoteSlotRefusalChat(SlotChat); // 80 ms after the send
|
||||
TickFor(tick, 600);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "no resend: the line was not taken for ours");
|
||||
Check.False(FakeHost.Logs.Any(l => l.Contains("request slot refused")), "not logged as ours");
|
||||
});
|
||||
|
||||
// The looter's own UseOnFor ("Loot") is not another item action: it leaves LastItemActionAt as it
|
||||
// was, so a refusal line after it is still taken for the loot send's and the item is resent.
|
||||
private static void LootUseOnForIsNotStamped() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
TickFor(tick, 40);
|
||||
long before = UseAudit.LastItemActionAt;
|
||||
_host.UseOnFor(0x80263198u, Player, "Loot", "test: the looter's own use");
|
||||
Check.Eq(UseAudit.LastItemActionAt, before, "a Loot UseOnFor leaves the stamp as it was");
|
||||
TickFor(tick, 40);
|
||||
_bot.NoteSlotRefusalChat(SlotChat); // 80 ms after the send
|
||||
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 600);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 2, "resent: the line was taken for ours");
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("request slot refused")), "logged as ours");
|
||||
});
|
||||
|
||||
// A send made while the motion queue is busy has a 2500 ms refusal window, and the look back for
|
||||
// another item action is that same window: an action 1 s before such a send keeps a line that
|
||||
// arrives 700 ms after it from being taken for the send's (a 200 ms look back would miss it).
|
||||
private static void ForeignActionLookbackUsesSendWindow() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: true, stamina: 100u, serverGates: true);
|
||||
uint first = FakeHost.ExternalMoves[0].Id;
|
||||
Air(up: true);
|
||||
TickFor(tick, 100);
|
||||
FakeHost.CastBusy = 1; // the jump's motion plays
|
||||
FakeHost.Containers[first] = Player; // no bend-down: the next goes out in the air
|
||||
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 500);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 2, "the second move is out while the queue is busy");
|
||||
Check.Eq(Field<long>("_currentLootItemSlotWindowMs"), RynthAiPlugin.SlotRefusalDeferredWindowMs, "its window is the deferred one");
|
||||
var clock = UseAudit.NowMs;
|
||||
UseAudit.NowMs = () => _now - 1000; // another item action 1 s before this send
|
||||
UseAudit.NoteItemAction();
|
||||
UseAudit.NowMs = clock;
|
||||
TickFor(tick, 700);
|
||||
_bot.NoteSlotRefusalChat(SlotChat);
|
||||
TickFor(tick, 600);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 2, "no resend: the earlier item action may own the line");
|
||||
Check.False(FakeHost.Logs.Any(l => l.Contains("request slot refused")), "not logged as ours");
|
||||
});
|
||||
|
||||
// A fight has the tick (HoldOpenCorpseForFight, reached through TickCorpseOpening with Combat
|
||||
// given the tick): no resend then, since the client drops an item move while the character
|
||||
// attacks. The refusal heard during the fight is attributed by its own arrival time, so after the
|
||||
// fight the item goes again at once, without costing a try, and the fight flag of the refused send
|
||||
// is not carried onto the fresh one.
|
||||
private static void SlotRefusalWaitsOutAFight() => Clocked(() =>
|
||||
{
|
||||
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
|
||||
void FightTick()
|
||||
{
|
||||
SetField("_activity", BotActivity.Combat);
|
||||
typeof(RynthAiPlugin).GetMethod("TickCorpseOpening", Any)!.Invoke(_bot, null);
|
||||
}
|
||||
TickFor(tick, 2 * TickMs);
|
||||
_bot.NoteSlotRefusalChat(SlotChat); // 40 ms after the send: ours
|
||||
for (int i = 0; i < 25; i++) { _now += TickMs; FightTick(); } // 500 ms of fight
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("waits for the fight")), "the corpse is held for the fight");
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "no resend while a fight has the tick");
|
||||
long fightEnd = _now;
|
||||
TickUntil(tick, () => FakeHost.ExternalMoves.Count >= 2, 500);
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 2, "after the fight the refused move goes again");
|
||||
Check.True(_now - fightEnd <= 2 * TickMs, $"at once: {_now - fightEnd} ms after the fight");
|
||||
Check.Eq(Field<int>("_currentLootItemMoveAttempts"), 1, "not one of the 3 tries");
|
||||
Check.False(Field<bool>("_currentLootItemFightHeld"), "the fresh send carries no fight flag");
|
||||
});
|
||||
|
||||
// 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(() =>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ internal static class OwnCorpseTests
|
|||
{
|
||||
r.Add("own corpse: recognised by exact name + 'Killed by' line, never a namesake or another player's", Identification);
|
||||
r.Add("own corpse: every item is taken, the loot profile and Loot From ignored, then closed", RecoveredWhole);
|
||||
r.Add("own corpse: a slot-refusal line heard earlier in the session does not make an own-corpse send repeat (one move, the server silent)", EarlierSlotRefusalNoSpuriousResend);
|
||||
r.Add("own corpse: another player's corpse with a similar name is left alone", SimilarNameUntouched);
|
||||
r.Add("own corpse: Recover My Corpse off = the behaviour before (profile only, My Kills skips it)", SettingOffIsOldBehaviour);
|
||||
r.Add("own corpse: beats a nearer corpse of your kill; a timeout retries it instead of writing it off", PriorityAndTimeout);
|
||||
|
|
@ -203,6 +204,32 @@ internal static class OwnCorpseTests
|
|||
Check.False(bot.Get<bool>("_currentLootItemIsSalvage"), "nothing queued for salvage");
|
||||
}
|
||||
|
||||
// The refusal count is session-wide. An own-corpse send used to leave its baseline at 0, so any
|
||||
// refusal line heard earlier (a buff swap's) read as a refusal of this send and the item was
|
||||
// sent again 250 ms later into a server that was still busy with the first (two in flight).
|
||||
// The baseline is taken in the shared send path now. Real time, as the other tests here.
|
||||
private static void EarlierSlotRefusalNoSpuriousResend()
|
||||
{
|
||||
World("Corpse of " + Me, "Killed by Ancient Water Elemental.", closeCalls: true);
|
||||
var bot = NewBot();
|
||||
bot.S.LootJumpEnabled = true; // the slot-refusal net runs only with Jump When Looting on
|
||||
bot.P.NoteSlotRefusalChat("You can only move or use one item at a time"); // an earlier, unrelated refusal
|
||||
bot.Tick(BotActivity.Looting);
|
||||
Check.True(FakeHost.Uses.Contains(Corpse), "the corpse is opened");
|
||||
foreach (uint id in new[] { Gem, Cloak, Coins })
|
||||
bot.Cache.OnCreateObject(id);
|
||||
bot.Cache.Tick();
|
||||
FakeHost.GroundContainer = Corpse;
|
||||
bot.P.OnViewObjectContents(Corpse);
|
||||
for (int i = 0; i < 400 && FakeHost.ExternalMoves.Count == 0; i++) { bot.Tick(BotActivity.Looting); Thread.Sleep(10); }
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "the first own-corpse move is out: " + Moves());
|
||||
Check.Eq(bot.Get<int>("_currentLootItemSlotSeqAtSend"), bot.Get<int>("_slotRefusalSeq"), "the send took the refusal baseline (shared send path)");
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
while (sw.ElapsedMilliseconds < 600) { bot.Tick(BotActivity.Looting); Thread.Sleep(10); } // the server is silent
|
||||
Check.Eq(FakeHost.ExternalMoves.Count, 1, "exactly one move over 600 ms: " + Moves());
|
||||
Check.False(FakeHost.Logs.Any(l => l.Contains("request slot refused")), "no refusal was taken for this send");
|
||||
}
|
||||
|
||||
private static void SimilarNameUntouched()
|
||||
{
|
||||
World("Corpse of " + Me + "s", "Killed by Ancient Water Elemental.");
|
||||
|
|
|
|||
Loading…
Reference in a new issue