The socket connects with the shared-secret header, registers first, reassembles incoming frames of any size (the original dropped anything over 4 KiB) and reconnects two seconds after a failure. Incoming share_* frames go to the vital-sharing handlers; any other frame is a chat-box command for this character, run one per tick through the chat bar as if typed. Frames are written with Newtonsoft.Json defaults, the original's serializer, so the backend sees the same bytes. The secret lives in the character's settings. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
26 lines
627 B
C#
26 lines
627 B
C#
namespace OpenAC.MosswartMassacre.Infrastructure;
|
|
|
|
/// <summary>
|
|
/// Wall-clock time for everything the plugin stamps or measures. The backend
|
|
/// frames carry UTC timestamps and the kill-rate maths uses local time, the
|
|
/// same split the original plugin had; tests substitute a fixed clock.
|
|
/// </summary>
|
|
internal interface IClock
|
|
{
|
|
DateTime UtcNow { get; }
|
|
|
|
DateTime Now { get; }
|
|
}
|
|
|
|
internal sealed class SystemClock : IClock
|
|
{
|
|
public static SystemClock Instance { get; } = new();
|
|
|
|
private SystemClock()
|
|
{
|
|
}
|
|
|
|
public DateTime UtcNow => DateTime.UtcNow;
|
|
|
|
public DateTime Now => DateTime.Now;
|
|
}
|