RynthSuite as of 2026-11-29 (internal 3c6745b): release 2026.11.29.1

This commit is contained in:
Tom Bohar 2026-11-29 22:28:29 -05:00
commit 95282c83fa
13 changed files with 916 additions and 36 deletions

View file

@ -699,6 +699,7 @@ public sealed partial class RynthAiPlugin
{
CancelManualChestReopen(unchecked((int)vendorId), "a vendor was opened");
_metaManager?.OnVendorOpen(vendorId);
_navigationEngine?.NoteVendorOpened(vendorId); // a nav Vendor point waits for this (NavigationEngine.VendorVisit.cs)
// AutoVendor prints the open line itself (UB's merchant-info line when it can read the
// vendor, once per open rather than on every list re-send) and may start a session.
@ -933,7 +934,7 @@ public sealed partial class RynthAiPlugin
// Same gate as HasLootWork: this claim runs every tick whatever the arbiter
// decided, so without it a full pack still claimed the next corpse. Your own
// corpse is let through unless no pack has a slot at all.
if (IsLootingBlockedByPack(settings) && !OwnCorpseBypassesPackGate(settings, maxMeters))
if (IsLootingBlockedByPack(settings) && !OwnCorpseBypassesPackGate(settings, maxMeters) && !RareCorpseBypassesPackGate(settings, maxMeters))
{
_lootSkipWhy = "the pack is full (Stop Looting When Pack Full)";
return;
@ -1263,6 +1264,8 @@ public sealed partial class RynthAiPlugin
int playerId = unchecked((int)_playerId);
WorldObject? ownCorpse = null;
double ownDistance = double.MaxValue;
WorldObject? rareCorpse = null;
double rareDistance = double.MaxValue;
foreach (WorldObject candidate in _objectCache.GetLandscapeObjects())
{
if (candidate.ObjectClass != AcObjectClass.Corpse)
@ -1302,6 +1305,14 @@ public sealed partial class RynthAiPlugin
continue;
}
// Then a corpse that generated a rare beats the others (2026-11-29): it goes before a full
// pack can stop looting (RynthAiPlugin.RareCorpses.cs).
if (IsRareCorpse(decision.LongDesc))
{
if (rareCorpse == null || dist < rareDistance) { rareCorpse = candidate; rareDistance = dist; }
continue;
}
if (dist >= distanceMeters)
continue;
@ -1314,6 +1325,11 @@ public sealed partial class RynthAiPlugin
corpse = ownCorpse;
distanceMeters = ownDistance;
}
else if (rareCorpse != null)
{
corpse = rareCorpse;
distanceMeters = rareDistance;
}
return corpse != null;
}
@ -1333,6 +1349,11 @@ public sealed partial class RynthAiPlugin
/// it) but never a stream of them; Recover My Corpse keeps its own 5 s ask (RequestOwnCorpseId). At most
/// CorpseIdPerTick requests are accepted per scan tick, so a refusal window ending with many uncached
/// corpses in range does not burst.
/// Loot Only Rare Corpses is the other re-asker (RareCorpseIdWaitInRange): its corpses wait unclaimed for
/// the description, so none of them is ever the target, and one whose only accepted request was dropped
/// stayed closed for good, a rare on it or not (found 2026-11-29 checking a Discord question about whether
/// rare-only looting opens corpses with higher-tier rares: tier never mattered, a lost ID did). Each one in
/// loot range is asked again on the same clock and cap.
/// </summary>
private void TryRequestCorpseId(WorldObject corpse, string longDesc)
{
@ -1342,8 +1363,9 @@ public sealed partial class RynthAiPlugin
bool candidate = corpse.Id == _targetCorpseId || (_openedContainerId != 0 && corpse.Id == _openedContainerId);
int asks = _corpseIdAskCount.TryGetValue(corpse.Id, out int askCount) ? askCount : 0;
bool due = !_corpseIdRequested.Contains(corpse.Id)
|| (candidate && asks <= CorpseIdMaxReasks && CorpseNameNeeded()
&& _corpseIdAskedAt.TryGetValue(corpse.Id, out long askedAt) && idNow - askedAt >= CorpseIdReaskMs);
|| (asks <= CorpseIdMaxReasks
&& _corpseIdAskedAt.TryGetValue(corpse.Id, out long askedAt) && idNow - askedAt >= CorpseIdReaskMs
&& (candidate ? CorpseNameNeeded() : RareCorpseIdWaitInRange(corpse)));
if (!due || _corpseIdAcceptedThisTick >= CorpseIdPerTick) return;
if (_corpseIdRefusedAt.TryGetValue(corpse.Id, out long refusedAt) && idNow - refusedAt < CorpseIdRefusedRetryMs) return;
if (Host.RequestId(unchecked((uint)corpse.Id)))
@ -1363,6 +1385,16 @@ public sealed partial class RynthAiPlugin
/// <summary>The loot mode reads the killer name (My Kills Only, Fellowship Kills); All Corpses does not.</summary>
private bool CorpseNameNeeded() => (_dashboard?.Settings?.LootOwnership ?? 0) < 2;
/// <summary>Loot Only Rare Corpses is on and this unidentified corpse is within the corpse approach range:
/// it opens only once its description says it generated a rare, so its ID is worth asking for again. A
/// corpse farther out gets its one request; it is asked again once the bot comes within range of it.</summary>
private bool RareCorpseIdWaitInRange(WorldObject corpse)
{
var settings = _dashboard?.Settings;
if (settings?.LootOnlyRareCorpses != true || _objectCache == null || _playerId == 0) return false;
return _objectCache.Distance(unchecked((int)_playerId), corpse.Id) <= GetCorpseApproachRangeMaxMeters(settings);
}
private CorpseLootDecision EvaluateCorpseLootDecision(WorldObject? corpse)
{
var settings = _dashboard?.Settings;
@ -1870,6 +1902,7 @@ public sealed partial class RynthAiPlugin
string matchActionLabel = string.Empty;
string matchRuleLabel = string.Empty;
bool matchIsSalvage = false;
bool matchIsRare = false;
foreach (WorldObject item in containedItems)
{
@ -1949,7 +1982,9 @@ public sealed partial class RynthAiPlugin
// A keeper already judged on this open is judged again only when its turn comes (it
// is the first match): that fresh pass is what Keep # and the mana stone cap count
// against. Re-running the profile on every waiting keeper each pass did nothing else.
if (firstMatchId != 0 && _lootEvalLogged.TryGetValue(item.Id, out string? judged) && judged.StartsWith("KEEP", StringComparison.Ordinal))
// A rare is the exception: it goes first (below), so it is judged every pass.
bool isRareItem = RareItems.IsRare(Host, item, out _);
if (firstMatchId != 0 && !isRareItem && _lootEvalLogged.TryGetValue(item.Id, out string? judged) && judged.StartsWith("KEEP", StringComparison.Ordinal))
continue;
// Evaluate against loot profile — pure classification, no UseObject.
@ -1985,14 +2020,16 @@ public sealed partial class RynthAiPlugin
if (classified)
{
// First match wins — save it for pickup below
if (firstMatchId == 0)
// First match wins — save it for pickup below. A rare beats any other match: it is
// taken before a full pack or a corpse timeout can end the corpse (2026-11-29).
if (firstMatchId == 0 || (isRareItem && !matchIsRare))
{
firstMatchId = item.Id;
matchItemName = item.Name ?? string.Empty;
matchActionLabel = actionLabel;
matchRuleLabel = ruleLabel;
matchIsSalvage = isSalvage;
matchIsRare = isRareItem;
}
// Don't break — keep evaluating to mark non-matches processed
}
@ -2037,8 +2074,9 @@ public sealed partial class RynthAiPlugin
// Keep room for weapon swaps: with a full pack the bow can't be put away to
// switch to the wand, so buffs and spell heals stop (2026-09-28 death). Leave
// the corpse rather than filling the last slots; -1 = side-pack capacity unknown.
// A rare may take a reserved slot: it is never left for the swap room (2026-11-29).
int freeSlots = WorldObjectCache.CountFreeItemSlots(Host, _objectCache);
if (freeSlots >= 0 && freeSlots < WorldObjectCache.LootReserveFreeSlots)
if (freeSlots >= 0 && freeSlots < WorldObjectCache.LootReserveFreeSlots && !(matchIsRare && freeSlots > 0))
{
if (LastPickupSettling(now))
return; // the last item lands first, then the corpse closes
@ -3539,7 +3577,8 @@ public sealed partial class RynthAiPlugin
// No room anywhere: don't start on another corpse (IsPackFull says so once in chat).
// Your own corpse is let through unless no pack has a slot at all.
if (IsLootingBlockedByPack(settings) && !OwnCorpseBypassesPackGate(settings, GetCorpseApproachRangeMaxMeters(settings)))
if (IsLootingBlockedByPack(settings) && !OwnCorpseBypassesPackGate(settings, GetCorpseApproachRangeMaxMeters(settings))
&& !RareCorpseBypassesPackGate(settings, GetCorpseApproachRangeMaxMeters(settings)))
return false;
// An open chest the player or a meta opened, eligible to loot (RynthAiPlugin.ChestLoot.cs).
@ -3882,6 +3921,18 @@ public sealed partial class RynthAiPlugin
if (LootModes.IsRares(settings.LootMode))
return ClassifyRaresMode(item, settings, preview, out actionLabel, out ruleLabel, out builtIn);
// A rare is always kept, ahead of the loot profile and every other built-in keep (2026-11-29: no
// rare may be left on a corpse). A profile with no rule for rares left it on the corpse, a
// Salvage rule that matched it salvaged it, and Mana Tap drained one no rule wanted.
if (RareItems.IsRare(Host, item, out string rareHow))
{
if (!preview) { _corpseItemsEvaluated++; _corpseMatchedIds.Add(item.Id); }
actionLabel = "Keep";
ruleLabel = RareItems.AlwaysKeptRule;
builtIn = $"a rare ({rareHow}): rares are always kept, whatever the loot profile says";
return true;
}
// Learn unknown spells (VTank ReadUnknownScrolls): a built-in rule ahead of the loot
// profile, as in VTank. A scroll of a spell we don't know and can learn is looted to read.
if (_scrollLearner != null && _scrollLearner.ShouldLootFromCorpse(item, out string learnRule, out string learnWhy, preview))
@ -4325,6 +4376,10 @@ public sealed partial class RynthAiPlugin
// counts for an item that has one.)
if (tapSettings != null && LootModes.IsRares(tapSettings.LootMode))
return false;
// A rare shown by its rare icon is kept in every mode (ClassifyLootItem), so no rule needs its
// ID: waiting for one that never came left it on the corpse ("left: no ID came").
if (RareItems.IsRare(Host, item, out _))
return false;
bool manaTapNeedsId = tapSettings != null && tapSettings.EnableManaTapping
&& tapSettings.ManaTapMinMana > 0 && _manaStoneManager != null;
@ -4425,10 +4480,15 @@ public sealed partial class RynthAiPlugin
return;
}
_completedCorpses[corpseId] = CorpseNowMs;
// A rare still on it: set aside and looted again, not marked done (RynthAiPlugin.RareCorpses.cs).
bool rareLeft = SetAsideForRareLeft(corpseId, CorpseNowMs);
if (!rareLeft)
{
_completedCorpses[corpseId] = CorpseNowMs;
_corpseCooldownUntil.Remove(corpseId);
}
EndBoostLootKillWait(corpseId);
EndDeathWaitFor(corpseId);
_corpseCooldownUntil.Remove(corpseId);
_processedCorpseItems.Clear();
_corpseItemAttempts.Clear();
_corpseIdsRequested = false;
@ -4460,7 +4520,7 @@ public sealed partial class RynthAiPlugin
// Your own death corpse has its own end line (FinishOwnCorpseRecovery).
WorldObject? doneCorpse = _objectCache?[corpseId];
string corpseName = doneCorpse?.Name is { Length: > 0 } cn ? cn : $"0x{(uint)corpseId:X8}";
if ((doneCorpse == null || !EvaluateCorpseLootDecision(doneCorpse).IsOwnDeathCorpse)
if (!rareLeft && (doneCorpse == null || !EvaluateCorpseLootDecision(doneCorpse).IsOwnDeathCorpse)
&& NothingLootedLine(corpseName) is { } nothingLine)
ChatLine(nothingLine);
LootDiag($"[RynthAi] Corpse loot: completed 0x{(uint)corpseId:X8}, releasing container.");
@ -4960,6 +5020,7 @@ public sealed partial class RynthAiPlugin
_corpseIdAskCount.Remove(sid);
_corpseSkipLogged.Remove(sid);
_corpseWaitingSince.Remove(sid);
_rareLeftRetries.Remove(sid);
// If this is the corpse we were actively looting (container was open and we received
// at least one inventory update), mark it completed before resetting. Without this,
@ -4970,8 +5031,17 @@ public sealed partial class RynthAiPlugin
// taken, the mark prevents the pointless re-open.
if (_targetCorpseId == sid && _openedContainerId == sid && _openedContainerInventoryObservedAt != 0)
{
LootDiag($"[RynthAi] Corpse loot: corpse 0x{objectId:X8} left range mid-loot; marking completed to prevent re-open.");
_completedCorpses[sid] = CorpseNowMs;
// Not with a rare still on it: seen again, it is opened again (RynthAiPlugin.RareCorpses.cs).
if (RareStillOn(sid) is { } rare)
{
LootDiag($"[RynthAi] Corpse loot: corpse 0x{objectId:X8} left range mid-loot with the rare '{rare.Name}' still on it; not marked, so it is looted again if seen.");
ChatLine($"[RynthAi] {CorpseNameFor(sid)} went out of range with a rare still on it: {rare.Name}. It is looted again if it comes back in range.");
}
else
{
LootDiag($"[RynthAi] Corpse loot: corpse 0x{objectId:X8} left range mid-loot; marking completed to prevent re-open.");
_completedCorpses[sid] = CorpseNowMs;
}
}
if (_targetCorpseId == sid)
@ -5141,7 +5211,7 @@ public sealed partial class RynthAiPlugin
/// </summary>
private bool CanClaimNextCorpse(LegacyUiSettings settings, double maxMeters)
{
if (IsLootingBlockedByPack(settings) && !OwnCorpseBypassesPackGate(settings, maxMeters)) return false;
if (IsLootingBlockedByPack(settings) && !OwnCorpseBypassesPackGate(settings, maxMeters) && !RareCorpseBypassesPackGate(settings, maxMeters)) return false;
if (_useRefusals.HoldsOpens(CorpseNowMs)) return false;
if (string.Equals(settings.BotAction, "Buffing", StringComparison.OrdinalIgnoreCase)) return false;
if (_manaStoneManager?.HoldsLootForDrain() == true) return false;
@ -5267,8 +5337,14 @@ public sealed partial class RynthAiPlugin
_corpseAbandonCounts.Remove(corpseId);
ChatLine($"[RynthAi] Own corpse: giving up after {abandons} tries; recover what is left on it by hand.");
}
else if (wasOpened && SetAsideForRareLeft(corpseId, now))
{
// A rare still on it: set aside and looted again (RynthAiPlugin.RareCorpses.cs).
}
else if (wasOpened || abandons >= 3)
{
if (!wasOpened)
SayRareCorpseUnopened(corpseId);
_completedCorpses[corpseId] = now;
_corpseCooldownUntil.Remove(corpseId);
_corpseAbandonCounts.Remove(corpseId);