RynthSuite as of 2026-12-02 (internal 152e13d): release 2026.12.1.1

This commit is contained in:
Tom Bohar 2026-12-02 06:45:07 -05:00
commit 6b5a9c7e99
65 changed files with 3920 additions and 237 deletions

View file

@ -85,6 +85,14 @@ internal sealed class ManaStoneManager
// low; no refill for a while instead of a stone every think tick.
private long _refillHoldUntil;
private const long RefillHoldMs = 2 * 60 * 1000;
// ...and once the hold ran out, the same stale read asked for a stone again: R-20261201-171624-0bcf (Coldeve),
// Loafers read 21% from before a refill, a stone every 2 minutes, each answered "Your items are fully
// charged" (the re-appraisal of 17 worn items didn't get through while looting was appraising). Now the
// server's "fully charged" stands for each worn item until its read changes (a newer appraisal) or the
// server says it is low: the read each item had then is kept, and that same read counts as full.
private readonly Dictionary<int, int> _gearFullAtRead = new();
private bool _gearFullSnapshotDue;
private long _lastNoStoneDiagAt;
// Worn gear's mana is read from its last appraisal, and ACE never sends a change to it while the
@ -312,16 +320,22 @@ internal sealed class ManaStoneManager
_host.Log($"[RynthAi] ManaStone: the server says worn gear is low ('{text.Trim()}') - refilling whatever the gear's mana reads say.");
_serverSaidGearLowAt = NowMs;
_refillHoldUntil = 0; // the server's word is newer than "fully charged"
_gearFullAtRead.Clear();
_gearFullSnapshotDue = false;
return;
}
// The stone-on-player reply's second line; it may arrive as a line of its own.
if (text.Contains("Your items are fully charged"))
{
_serverSaidGearLowAt = 0;
_gearFullSnapshotDue = true;
HoldRefills("the server says the worn items are fully charged");
}
if (text.Contains("no items equipped that need mana"))
{
_serverSaidGearLowAt = 0;
_gearFullSnapshotDue = true;
}
if (_state == TapState.TappingItem)
{
@ -833,6 +847,22 @@ internal sealed class ManaStoneManager
|| item.Name.Contains("Mana Charge", StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// What the charged-stone search looks at: the pack walk (the client's own pack lists, what
/// <see cref="HasEternalCharge"/> reads) first, then every object the cache knows. The walk can
/// hold an item the cache has no entry for yet: on 11-30 a character's gear sat at 30-46% mana for
/// an hour with "eternal=True needs=True" and "no charged stone is known" every minute, because
/// the search read the cache alone and the Eternal Mana Charge was only in the walk.
/// </summary>
private IEnumerable<WorldObject> RefillCandidates()
{
var seen = new HashSet<int>();
foreach (var item in _objectCache.GetDirectInventory(forceRefresh: false))
if (seen.Add(item.Id)) yield return item;
foreach (var item in _objectCache.AllKnownObjects())
if (seen.Add(item.Id)) yield return item;
}
// FindChargedStone walks every known object; with tapping off it gates the whole tick, so
// the answer is kept for a few seconds.
private long _chargedCheckAt;
@ -1014,7 +1044,7 @@ internal sealed class ManaStoneManager
int bestMana = 0;
bool requestedId = false;
foreach (var item in _objectCache.AllKnownObjects())
foreach (var item in RefillCandidates())
{
if (!IsRefillStone(item)) continue;
if (!IsOwnedByPlayer(item, playerId) || !InPack(item.Id)) continue;
@ -1150,6 +1180,9 @@ internal sealed class ManaStoneManager
string lowestName = "";
bool needs = false;
bool requestedThisPass = false;
bool snapshot = _gearFullSnapshotDue; // the server just said full: keep each read it had then
_gearFullSnapshotDue = false;
int trustedFull = 0;
foreach (var item in _objectCache.AllKnownObjects())
{
@ -1214,6 +1247,13 @@ internal sealed class ManaStoneManager
requestedThisPass = true;
}
}
// The server said the gear is full since this read was taken: the same read counts as full.
if (snapshot) _gearFullAtRead[item.Id] = curMana;
if (_gearFullAtRead.TryGetValue(item.Id, out int fullRead))
{
if (fullRead == curMana) { trustedFull++; continue; }
_gearFullAtRead.Remove(item.Id); // a newer appraisal: the read is real again
}
int p = (int)(curMana * 100L / maxMana);
if (p < lowestPct) { lowestPct = p; lowestName = item.Name ?? ""; }
@ -1239,6 +1279,7 @@ internal sealed class ManaStoneManager
_lastGearDiagAt = now;
_host.Log($"[RynthAi] ManaStone: gear check - worn={worn} manaReadable={readable} lowest={(readable > 0 ? $"{lowestPct}% ({lowestName})" : "n/a")} " +
$"refillBelow={(int)(pct * 100)}% eternal={eternal} needs={needs} tapping={_settings.EnableManaTapping}" +
(trustedFull > 0 ? $" fullPerServer={trustedFull}" : "") +
(serverLow ? $" serverSaidLow={(now - _serverSaidGearLowAt) / 1000}s ago" : "") +
(now < _refillHoldUntil ? $" hold={(_refillHoldUntil - now) / 1000}s" : ""));
}