Snapshot for release 2026.10.19.1 (internal fa7a8f6)

This commit is contained in:
Tom Bohar 2026-10-19 09:11:20 -04:00
commit 44074df011
110 changed files with 8017 additions and 291 deletions

View file

@ -40,7 +40,12 @@ internal static partial class PluginManager
private readonly record struct PendingEnchantmentAdded(uint SpellId, double DurationSeconds);
private readonly record struct PendingEnchantmentRemoved(uint EnchantmentId);
private const int MaxPendingIncomingChats = 256;
// A /myquests reply is one line per quest flag (hundreds on a played character) and arrives
// in one burst; a slow pump tick (a busy plugin window) must not drop its head. Lines are short
// strings, so a deep queue costs little. Drops are counted and logged (DispatchQueuedChatWindowText).
private const int MaxPendingIncomingChats = 4096;
private static long _droppedIncomingChats; // lines dropped unheard since the last log
private static long _droppedIncomingChatsLoggedMs; // when that was last logged
private const int MaxPendingBusyCountEvents = 128;
private const int MaxPendingTargetChanges = 128;
private const int MaxPendingCombatModeChanges = 128;
@ -674,7 +679,10 @@ internal static partial class PluginManager
lock (PendingIncomingChatsLock)
{
if (_pendingIncomingChats.Count >= MaxPendingIncomingChats)
{
_pendingIncomingChats.Dequeue().Held?.Decide(eat: false); // dropped unheard: it shows
_droppedIncomingChats++;
}
_pendingIncomingChats.Enqueue(new PendingIncomingChat(text, chatType, held));
}
@ -1722,14 +1730,26 @@ internal static partial class PluginManager
System.Threading.Interlocked.Exchange(ref _chatPumpBeatMs, Environment.TickCount64);
PendingIncomingChat[] pending;
long dropped = 0;
lock (PendingIncomingChatsLock)
{
if (_pendingIncomingChats.Count == 0)
return;
// Report drops at most every 10 s (a flood would otherwise flood the log too).
long nowMs = Environment.TickCount64;
if (_droppedIncomingChats > 0 && nowMs - _droppedIncomingChatsLoggedMs >= 10_000)
{
dropped = _droppedIncomingChats;
_droppedIncomingChats = 0;
_droppedIncomingChatsLoggedMs = nowMs;
}
pending = _pendingIncomingChats.ToArray();
pending = _pendingIncomingChats.Count == 0 ? Array.Empty<PendingIncomingChat>() : _pendingIncomingChats.ToArray();
_pendingIncomingChats.Clear();
}
// Logged outside the lock: AC's main thread queues chat under it.
if (dropped > 0)
RynthLog.Plugin($"PluginManager: {dropped} incoming chat line(s) dropped before plugins heard them (queue full at {MaxPendingIncomingChats}).");
if (pending.Length == 0)
return;
unsafe
{
@ -1775,6 +1795,14 @@ internal static partial class PluginManager
}
eaten = HeldChatQueue.PluginsAteIt(eat, threw);
// RynthChat's Hide rules / standard filters live in the engine, not in a plugin, so
// without this a hidden line still printed in AC's own chat window. Only a held line
// can still be kept out (one already printed has gone); a failure lets it show.
if (!eaten && evt.Held != null)
{
try { eaten = UI.Data.ChatModel.ShouldHideInRetail(evt.Text, unchecked((int)evt.ChatType)); }
catch (Exception ex) { RynthLog.Plugin($"PluginManager: retail chat filter check failed ({ex.GetType().Name}: {ex.Message})."); }
}
}
finally
{