RynthSuite/Plugins/RynthCore.Plugin.RynthChat/RynthChatPlugin.cs
BlankenshipG 0532d8d981 feat(suite): Vaulted Dungeons tab, Oracle breeding/charms, Mini Remote Options
Port tonight's Suite work onto standing sk for upstream release prep: ILT Vaulted Dungeons (Options-gated), chat 0x1C channels, Oracle Charms/Pet Breeding, Mini Remote Options opens Settings. HandWrittenVersion stays 0.5.0-legacy-ui.

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.1.
internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.3.2");
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);
}
}