RynthSuite/Plugins/RynthCore.Plugin.RynthChat/RynthChatPlugin.cs
BlankenshipG 10e0050b9f chore(release): hot push bump plugins for 2026.10.15.8
ILT 0.2.11, Chat 0.3.3, Oracle 0.2.9; Ai HandWritten stays 0.5.0-legacy-ui. ProductVersion 2026.10.15.8.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-18 15:59:53 -04:00

54 lines
1.7 KiB
C#

using System;
using System.Runtime.InteropServices;
using RynthCore.PluginCore;
namespace RynthCore.Plugin.RynthChat;
public sealed class RynthChatPlugin : RynthPluginBase
{
internal static readonly IntPtr NamePointer = Marshal.StringToHGlobalAnsi("RynthChat");
// Previous release: 0.3.2.
internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.3.3");
private readonly ChatBuffer _buffer = new();
public override int Initialize()
{
Host.Log("[RynthChat] Plugin initialized.");
return 0;
}
public override void OnLoginComplete()
{
Host.Log("[RynthChat] Login complete.");
}
public override void OnLogout()
{
Host.Log("[RynthChat] Logout.");
}
public override void OnChatWindowText(string? text, int chatType, ref int eat)
{
// Always buffer for RynthChat, even when an earlier plugin ate the line for retail.
_buffer.Add(text, chatType);
}
public override void OnChatBarEnter(string? text, ref int eat)
{
// Phase 5: intercept + own outgoing chat.
}
internal string BuildScrollbackJson(ulong sinceSeq) => _buffer.BuildJson(sinceSeq);
internal int SetScrollbackCapacity(int lines) => _buffer.SetCapacity(lines);
// Called on the game thread from the engine's deferred chat dispatch
// (Win32Backend posts WM_RYNTHCORE_CHAT so this runs on a fresh, non-reentrant
// message dispatch rather than inline inside the Enter keystroke handler).
internal void SendLine(string text)
{
if (!Host.HasInvokeChatParser || string.IsNullOrWhiteSpace(text)) return;
Host.InvokeChatParser(text);
}
}