RynthSuite/Plugins/RynthCore.Plugin.RynthChat/RynthChatPlugin.cs
Tom Bohar 0a4b611a90 RynthSuite as of 2026-09-05 (internal a5ff5c2)
A snapshot of the working tree for aelrynth.com/git/: the code, build files
and public docs. Internal review notes and agent instructions are left out.
MIT licensed; see LICENSE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 21:23:05 -04:00

50 lines
1.5 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");
internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.1.0");
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)
{
_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);
// 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);
}
}