RynthCore as of 2026-09-27 (internal b778a81): version display, RynthChat Tell button, retail chat usable, release 2026.9.27.1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d9f6b0dd4c
commit
f407326377
15 changed files with 277 additions and 22 deletions
|
|
@ -51,6 +51,11 @@ if ($Version) {
|
|||
$release = [int]$p[0] * 1000000 + [int]$p[1] * 10000 + [int]$p[2] * 100 + [int]$p[3]
|
||||
}
|
||||
|
||||
# Stamp every build with the release, so the launcher, the engine log and the in-game
|
||||
# Status panel show it (RynthCore.App.BuildVersion); the SDK appends the git commit.
|
||||
$VersionArgs = @()
|
||||
if ($Version) { $VersionArgs = @("-p:Version=$Version") }
|
||||
|
||||
$ScriptDir = $PSScriptRoot
|
||||
$RepoRoot = Split-Path $ScriptDir -Parent # e.g. C:\Projects\RynthCore
|
||||
$ProjectsRoot = Split-Path $RepoRoot -Parent # e.g. C:\Projects
|
||||
|
|
@ -85,31 +90,31 @@ if (-not $SkipBuild) {
|
|||
# ── 1. Launcher (self-contained Avalonia WinExe) ─────────────────────────
|
||||
Write-Host ""
|
||||
Write-Host "[1/5] Publishing Launcher (self-contained, x86)..." -ForegroundColor Cyan
|
||||
dotnet publish $LauncherProject -c $Configuration -r win-x86 --self-contained true
|
||||
dotnet publish $LauncherProject -c $Configuration -r win-x86 --self-contained true @VersionArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "Launcher publish failed (exit $LASTEXITCODE)" }
|
||||
|
||||
# ── 2. Engine (NativeAOT — the slow one) ──────────────────────────────────
|
||||
Write-Host ""
|
||||
Write-Host "[2/5] Publishing Engine (NativeAOT, ~2 min)..." -ForegroundColor Cyan
|
||||
dotnet publish $EngineProject -c $Configuration
|
||||
dotnet publish $EngineProject -c $Configuration @VersionArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "Engine publish failed (exit $LASTEXITCODE)" }
|
||||
|
||||
# ── 3. Loader (NativeAOT, small) ──────────────────────────────────────────
|
||||
Write-Host ""
|
||||
Write-Host "[3/5] Publishing Loader (NativeAOT)..." -ForegroundColor Cyan
|
||||
dotnet publish $LoaderProject -c $Configuration
|
||||
dotnet publish $LoaderProject -c $Configuration @VersionArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "Loader publish failed (exit $LASTEXITCODE)" }
|
||||
|
||||
# ── 4. Plugin (NativeAOT) ─────────────────────────────────────────────────
|
||||
Write-Host ""
|
||||
Write-Host "[4/5] Publishing Plugin (NativeAOT)..." -ForegroundColor Cyan
|
||||
dotnet publish $PluginProject -c $Configuration
|
||||
dotnet publish $PluginProject -c $Configuration @VersionArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "Plugin publish failed (exit $LASTEXITCODE)" }
|
||||
|
||||
# ── 5. Loot Editor (self-contained Avalonia tool) ─────────────────────────
|
||||
Write-Host ""
|
||||
Write-Host "[5/5] Publishing Loot Editor (self-contained, x86)..." -ForegroundColor Cyan
|
||||
dotnet publish $LootEditorProject -c $Configuration -r win-x86 --self-contained true
|
||||
dotnet publish $LootEditorProject -c $Configuration -r win-x86 --self-contained true @VersionArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "Loot Editor publish failed (exit $LASTEXITCODE)" }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ foreach ($name in $suitePlugins) {
|
|||
Step "Building $name"
|
||||
$proj = Join-Path $RynthSuiteRoot "Plugins\RynthCore.Plugin.$name\RynthCore.Plugin.$name.csproj"
|
||||
# PublishDir overrides the projects' own (RynthNav/RynthVision publish into the live C:\Games folders).
|
||||
dotnet publish $proj -c Release "-p:PublishDir=$rel\build\$name\" -v q -nologo
|
||||
dotnet publish $proj -c Release "-p:Version=$Version" "-p:PublishDir=$rel\build\$name\" -v q -nologo
|
||||
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed for $name" }
|
||||
Copy-Item "$rel\build\$name\RynthCore.Plugin.$name.dll" "$rel\plugins\"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@
|
|||
FontSize="24"
|
||||
FontWeight="Bold"
|
||||
Foreground="#26C1A6" />
|
||||
<TextBlock x:Name="HeaderVersionText"
|
||||
FontSize="11"
|
||||
Foreground="#9AA8B3" />
|
||||
<TextBlock x:Name="HeaderUpdateText"
|
||||
IsVisible="False"
|
||||
FontSize="12"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
|
@ -146,6 +147,7 @@ internal partial class MainWindow : Window
|
|||
_serverStatusTimer.Tick += async (_, _) => await RefreshServerStatusesAsync();
|
||||
_serverStatusTimer.Start();
|
||||
Closing += (_, _) => SaveWindowLayout();
|
||||
ShowVersion();
|
||||
AppendActivity("Avalonia launcher preview ready.");
|
||||
_ = RefreshServerStatusesAsync();
|
||||
_updateTimer.Tick += async (_, _) => await CheckForUpdatesAsync();
|
||||
|
|
@ -333,10 +335,11 @@ internal partial class MainWindow : Window
|
|||
{
|
||||
string capturedPath = dllPath;
|
||||
string pluginName = Path.GetFileNameWithoutExtension(dllPath);
|
||||
string pluginVersion = BuildVersion.OfFile(dllPath);
|
||||
|
||||
var checkBox = new CheckBox
|
||||
{
|
||||
Content = pluginName,
|
||||
Content = pluginVersion.Length > 0 ? $"{pluginName} {pluginVersion}" : pluginName,
|
||||
IsChecked = !disabledSet.Contains(capturedPath)
|
||||
};
|
||||
checkBox.IsCheckedChanged += (_, _) => OnUserPluginEnabledChanged(capturedPath, checkBox);
|
||||
|
|
@ -1705,6 +1708,19 @@ internal partial class MainWindow : Window
|
|||
}
|
||||
}
|
||||
|
||||
// ── Version ───────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Launcher version under the title; the engine's (Runtime\) in its tooltip and the log.</summary>
|
||||
private void ShowVersion()
|
||||
{
|
||||
string launcher = BuildVersion.Format(typeof(MainWindow).Assembly
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion);
|
||||
string engine = BuildVersion.OfFile(Path.Combine(AppContext.BaseDirectory, "Runtime", "RynthCore.Engine.dll"));
|
||||
HeaderVersionText.Text = launcher;
|
||||
ToolTip.SetTip(HeaderVersionText, $"Launcher {launcher}\nEngine {(engine.Length > 0 ? engine : "not found")}");
|
||||
AppendActivity($"RynthCore launcher {launcher}, engine {(engine.Length > 0 ? engine : "not found")}.");
|
||||
}
|
||||
|
||||
// ── Updates (RynthUpdater) ────────────────────────────────────────────────
|
||||
// Plugins swap in place and never touch a running bot; the core installer runs only
|
||||
// with every RynthCore client closed. Nothing here ever triggers a reload (RL).
|
||||
|
|
@ -1773,8 +1789,10 @@ internal partial class MainWindow : Window
|
|||
_pluginsUpdatedThisSession.Add(done);
|
||||
AppendActivity($"Plugin updated: {done}. Running clients keep their version; it loads the next time AC starts.");
|
||||
}
|
||||
// Re-check so the panel reflects the files now on disk.
|
||||
// Re-check so the panel reflects the files now on disk, and redraw the plugin
|
||||
// rows so they show the new versions.
|
||||
_updateCheck = await _updater.CheckAsync(_pluginDllPaths.ToList());
|
||||
BuildPluginLoadout();
|
||||
}
|
||||
|
||||
private void ShowUpdateState()
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
<Compile Include="..\RynthCore.App\CharacterCacheStore.cs" Link="Shared\CharacterCacheStore.cs" />
|
||||
<Compile Include="..\RynthCore.App\LaunchContextStore.cs" Link="Shared\LaunchContextStore.cs" />
|
||||
<Compile Include="..\RynthCore.App\SessionStateStore.cs" Link="Shared\SessionStateStore.cs" />
|
||||
<Compile Include="..\RynthCore.App\BuildVersion.cs" Link="Shared\BuildVersion.cs" />
|
||||
<Compile Include="..\RynthCore.App\AppSettings.cs" Link="Shared\AppSettings.cs" />
|
||||
<Compile Include="..\RynthCore.App\AppSettingsStore.cs" Link="Shared\AppSettingsStore.cs" />
|
||||
<Compile Include="..\RynthCore.App\PluginDefinition.cs" Link="Shared\PluginDefinition.cs" />
|
||||
|
|
|
|||
46
src/RynthCore.App/BuildVersion.cs
Normal file
46
src/RynthCore.App/BuildVersion.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace RynthCore.App;
|
||||
|
||||
/// <summary>
|
||||
/// Human-readable build versions, for the launcher and the in-game UI.
|
||||
///
|
||||
/// Release builds are stamped with the release number (Build-Installer.ps1 and
|
||||
/// Publish-Update.ps1 pass -p:Version=yyyy.m.d.n), and the .NET SDK appends the git
|
||||
/// commit to the product version: "2026.9.26.3+8ca322f…". Anything built without a
|
||||
/// version (Deploy-RynthCore.ps1, an IDE build) reads "1.0.0+8ca322f…" — a dev build.
|
||||
/// NativeAOT DLLs carry the same Windows version resource, so plugins need no code.
|
||||
/// </summary>
|
||||
internal static class BuildVersion
|
||||
{
|
||||
/// <summary>"2026.9.26.3 (8ca322f)" for a release, "dev (8ca322f)" otherwise.</summary>
|
||||
public static string Format(string? productVersion)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(productVersion)) return "unknown";
|
||||
string version = productVersion.Trim();
|
||||
string commit = "";
|
||||
int plus = version.IndexOf('+');
|
||||
if (plus >= 0)
|
||||
{
|
||||
commit = version[(plus + 1)..];
|
||||
version = version[..plus];
|
||||
}
|
||||
if (commit.Length > 7) commit = commit[..7];
|
||||
if (version is "1.0.0" or "1.0.0.0") version = "dev";
|
||||
return commit.Length > 0 ? $"{version} ({commit})" : version;
|
||||
}
|
||||
|
||||
/// <summary>A DLL's or EXE's version resource, formatted; "" if it has none or can't be read.</summary>
|
||||
public static string OfFile(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
return File.Exists(path) ? Format(FileVersionInfo.GetVersionInfo(path).ProductVersion) : "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -59,7 +59,17 @@ internal static class ChatHooks
|
|||
public static bool IsInstalled => _hookInstalled;
|
||||
public static string StatusMessage => _statusMessage;
|
||||
|
||||
public static bool SuppressOriginalChat;
|
||||
public static bool SuppressOriginalChat; // the user's "Hide retail chat" option
|
||||
|
||||
/// <summary>RynthChat's panel is on screen (set by RynthChatPanel).</summary>
|
||||
public static volatile bool ChatPanelShown;
|
||||
|
||||
/// <summary>
|
||||
/// RynthChat is standing in for the retail chat: its panel is open AND "Hide retail chat"
|
||||
/// is on. Only then is the retail chatbox hidden and Enter routed to RynthChat — whichever
|
||||
/// chat is visible gets Enter.
|
||||
/// </summary>
|
||||
public static bool RynthChatOwnsChat => SuppressOriginalChat && ChatPanelShown;
|
||||
|
||||
public static IntPtr GmMainChatInstance => _gmMainChatInstance;
|
||||
|
||||
|
|
@ -119,7 +129,11 @@ internal static class ChatHooks
|
|||
catch (Exception ex) { try { RynthLog.Compat($"ChatHooks: Listen original threw {ex.GetType().Name}: {ex.Message}"); } catch { } throw; }
|
||||
}
|
||||
|
||||
private static bool _isHiddenAsserted;
|
||||
// Starts true so the first tick asserts the setting either way: after an engine reload
|
||||
// the previous generation may have left the chatbox hidden, and a fresh "false" here
|
||||
// would never show it again even with "Hide retail chat" off. SetVisible(true) on a
|
||||
// visible chatbox is a no-op.
|
||||
private static bool _isHiddenAsserted = true;
|
||||
|
||||
public static unsafe void TickHide()
|
||||
{
|
||||
|
|
@ -130,7 +144,7 @@ internal static class ChatHooks
|
|||
if (inst == IntPtr.Zero) return;
|
||||
if (_uiElementSetVisibleAddress == IntPtr.Zero) return;
|
||||
|
||||
if (SuppressOriginalChat)
|
||||
if (RynthChatOwnsChat)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -155,6 +169,6 @@ internal static class ChatHooks
|
|||
public static void ResetCachedInstance()
|
||||
{
|
||||
_gmMainChatInstance = IntPtr.Zero;
|
||||
_isHiddenAsserted = false;
|
||||
_isHiddenAsserted = true; // re-assert on the next instance, as at start-up
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,12 @@ namespace RynthCore.Engine;
|
|||
|
||||
public static class EntryPoint
|
||||
{
|
||||
internal const string BuildStamp = "2026-06-06-resize-nonmodal";
|
||||
/// <summary>
|
||||
/// This engine's version — "2026.9.26.3 (8ca322f)", or "dev (8ca322f)" for an unstamped
|
||||
/// build — read from the DLL's own version resource at init (RynthCore.App.BuildVersion).
|
||||
/// Goes into every log header and crash line, and the in-game Status panel.
|
||||
/// </summary>
|
||||
internal static string BuildStamp { get; private set; } = "unknown";
|
||||
private const int MaxRecentLogLines = 256;
|
||||
private static int _initialized;
|
||||
/// <summary>Init counter the loader passes in lpParam. 1 = cold start,
|
||||
|
|
@ -84,6 +89,12 @@ public static class EntryPoint
|
|||
try
|
||||
{
|
||||
_initCount = lpParam.ToInt32();
|
||||
try
|
||||
{
|
||||
string version = RynthCore.App.BuildVersion.OfFile(GetEngineModulePath() ?? "");
|
||||
if (version.Length > 0) BuildStamp = version;
|
||||
}
|
||||
catch { }
|
||||
|
||||
// Set up the unified log sink BEFORE anything else so all
|
||||
// subsequent failures are captured in C:\Games\RynthCore\Logs.
|
||||
|
|
@ -176,7 +187,11 @@ public static class EntryPoint
|
|||
private const uint GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = 0x00000004;
|
||||
private const uint GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 0x00000002;
|
||||
|
||||
private static unsafe string? GetEngineDirectory()
|
||||
private static string? GetEngineDirectory() =>
|
||||
GetEngineModulePath() is { } path ? Path.GetDirectoryName(path) : null;
|
||||
|
||||
/// <summary>Full path of the engine DLL actually loaded (the loader's staged copy on hot reload).</summary>
|
||||
private static unsafe string? GetEngineModulePath()
|
||||
{
|
||||
// Resolve our module by passing the address of a static method
|
||||
// compiled into our DLL. `&StaticMethod` yields a direct pointer to
|
||||
|
|
@ -216,7 +231,7 @@ public static class EntryPoint
|
|||
if (length == 0)
|
||||
return null;
|
||||
|
||||
return Path.GetDirectoryName(new string(buffer, 0, (int)length));
|
||||
return new string(buffer, 0, (int)length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -237,6 +237,19 @@ internal static unsafe class Win32Backend
|
|||
|
||||
/// <summary>Custom WM_USER message for deferred chat command dispatch.</summary>
|
||||
internal const uint WM_RYNTHCORE_CHAT = 0x0400 + 0x5243; // WM_USER + "RC"
|
||||
// Chat's Tell button (Avalonia UI thread) asks for "/tell <selected>, " to be started;
|
||||
// posted so the selection and its name are read on AC's main thread.
|
||||
internal const uint WM_RYNTHCORE_TELL = 0x0400 + 0x5244;
|
||||
|
||||
/// <summary>Fired on the game thread when the Tell button asks to address the selected object.</summary>
|
||||
public static Action? OnChatTellSelected;
|
||||
|
||||
/// <summary>Callable from any thread: runs <see cref="OnChatTellSelected"/> on AC's main thread.</summary>
|
||||
public static void RequestTellSelected()
|
||||
{
|
||||
if (_gameHwnd != IntPtr.Zero)
|
||||
PostMessage(_gameHwnd, WM_RYNTHCORE_TELL, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
/// <summary>The game's main window handle.</summary>
|
||||
public static IntPtr GameHwnd => _gameHwnd;
|
||||
|
|
@ -820,6 +833,11 @@ internal static unsafe class Win32Backend
|
|||
OnChatSend?.Invoke();
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
if (msg == WM_RYNTHCORE_TELL)
|
||||
{
|
||||
OnChatTellSelected?.Invoke();
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
// ── Chat: Enter in-game activates the chat TextBox ───────────
|
||||
// Numpad Enter (extended key, lParam bit 24) is reserved for AC functions — never capture it.
|
||||
|
|
@ -827,7 +845,11 @@ internal static unsafe class Win32Backend
|
|||
// panel TextBox this branch otherwise runs BEFORE the text-input
|
||||
// forwarding block and hijacks Enter into chat capture — stealing
|
||||
// the TextBox's own commit handler and every subsequent keystroke.
|
||||
if (msg == WM_KEYDOWN && (int)wParam == VK_RETURN && !IsExtendedKey(lParam) && !ChatCaptureActive && !AvaloniaTextInputActive)
|
||||
// RynthChatOwnsChat: only while RynthChat is open AND hiding the retail chatbox —
|
||||
// whichever chat is visible gets Enter. Otherwise Enter belongs to AC's own chat,
|
||||
// which used to be unusable whenever RynthChat was installed, even closed.
|
||||
if (msg == WM_KEYDOWN && (int)wParam == VK_RETURN && !IsExtendedKey(lParam) && !ChatCaptureActive && !AvaloniaTextInputActive
|
||||
&& RynthCore.Engine.Compatibility.ChatHooks.RynthChatOwnsChat)
|
||||
{
|
||||
if (OnChatCaptureActivated != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -493,6 +493,12 @@ internal static class PluginLoader
|
|||
if (strPtr != IntPtr.Zero)
|
||||
plugin.VersionString = Marshal.PtrToStringAnsi(strPtr) ?? "";
|
||||
}
|
||||
// The DLL's version resource is stamped at release time with the release and commit;
|
||||
// the plugins' own RynthPluginVersion strings are hand-written and never change.
|
||||
string fileVersion = RynthCore.App.BuildVersion.OfFile(
|
||||
plugin.SourceFilePath.Length > 0 ? plugin.SourceFilePath : plugin.FilePath);
|
||||
if (fileVersion.Length > 0)
|
||||
plugin.VersionString = fileVersion;
|
||||
|
||||
string ver = string.IsNullOrEmpty(plugin.VersionString) ? "" : $" v{plugin.VersionString}";
|
||||
string caps = BuildCapsList(plugin);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="..\RynthCore.App\CharacterCacheStore.cs" Link="Shared\CharacterCacheStore.cs" />
|
||||
<Compile Include="..\RynthCore.App\SessionStateStore.cs" Link="Shared\SessionStateStore.cs" />
|
||||
<Compile Include="..\RynthCore.App\BuildVersion.cs" Link="Shared\BuildVersion.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Prevent trimmer from removing ImGui.NET's DllImport methods -->
|
||||
|
|
|
|||
|
|
@ -1263,7 +1263,9 @@ internal class RynthOverlayWindow : Window
|
|||
|
||||
var stack = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 4, Margin = new Thickness(8, 4) };
|
||||
_barStack = stack;
|
||||
stack.Children.Add(new TextBlock { Text = "RC", FontWeight = FontWeight.Bold, Foreground = Brushes.LightGreen, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0,0,10,0) });
|
||||
var rcLabel = new TextBlock { Text = "RC", FontWeight = FontWeight.Bold, Foreground = Brushes.LightGreen, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0,0,10,0) };
|
||||
ToolTip.SetTip(rcLabel, $"RynthCore {EntryPoint.BuildStamp}"); // plugins: Status panel
|
||||
stack.Children.Add(rcLabel);
|
||||
|
||||
var barSuppressed = new HashSet<string> { "Monsters", "Settings", "Nav", "Meta", "Items" };
|
||||
foreach (var p in registeredPanels)
|
||||
|
|
|
|||
|
|
@ -346,6 +346,17 @@ internal static partial class RynthAiPanel
|
|||
Foreground = ColText,
|
||||
VerticalAlignment = VerticalAlignment.Center
|
||||
});
|
||||
// RynthAi's version (its DLL's version resource), filled by the poll below —
|
||||
// the plugin may load after the panel is built, and changes on a reload.
|
||||
var versionText = new TextBlock
|
||||
{
|
||||
FontSize = 10,
|
||||
Foreground = ColMute,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Margin = new Thickness(8, 2, 0, 0)
|
||||
};
|
||||
int versionPollTicks = 0;
|
||||
titleStack.Children.Add(versionText);
|
||||
titleRow.Children.Add(titleStack);
|
||||
|
||||
var chipRow = new StackPanel
|
||||
|
|
@ -836,6 +847,14 @@ internal static partial class RynthAiPanel
|
|||
var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(33) };
|
||||
timer.Tick += (_, _) =>
|
||||
{
|
||||
if (versionPollTicks-- <= 0) // ~every 2 s; the timer runs at 30 Hz
|
||||
{
|
||||
versionPollTicks = 60;
|
||||
string ver = "";
|
||||
foreach (var p in PluginManager.Plugins)
|
||||
if (p.DisplayName.Contains("RynthAi", StringComparison.OrdinalIgnoreCase)) { ver = p.VersionString; break; }
|
||||
if (versionText.Text != ver) versionText.Text = ver;
|
||||
}
|
||||
if (_getSnapshotJson == null) TryBind();
|
||||
|
||||
// TL;DR #7: signal the popout host (if floating) that a new
|
||||
|
|
|
|||
|
|
@ -334,6 +334,27 @@ internal static class RynthChatPanel
|
|||
ScrollViewer.SetHorizontalScrollBarVisibility(chatInputBox, ScrollBarVisibility.Disabled);
|
||||
ScrollViewer.SetVerticalScrollBarVisibility(chatInputBox, ScrollBarVisibility.Disabled);
|
||||
|
||||
// Tell: start "/tell <selected>, " for the NPC or player selected in the game — quest
|
||||
// NPCs usually haven't spoken to you, so there's no name to click in the scrollback.
|
||||
// Typing "/tell" (or "/t") alone and pressing Enter does the same.
|
||||
var tellButton = new Button
|
||||
{
|
||||
Content = "Tell",
|
||||
FontSize = 10,
|
||||
Height = 22,
|
||||
Padding = new Thickness(8, 0),
|
||||
Margin = new Thickness(0, 1, 2, 1),
|
||||
VerticalContentAlignment = VerticalAlignment.Center,
|
||||
Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x0E, 0x2E, 0x3A)),
|
||||
Foreground = Brushes.White,
|
||||
};
|
||||
ToolTip.SetTip(tellButton, "Select an NPC or player in the game, then click to start /tell <name>, — or type /tell and press Enter.");
|
||||
tellButton.Click += (_, _) => Win32Backend.RequestTellSelected();
|
||||
var inputRow = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") };
|
||||
inputRow.Children.Add(chatInputBox);
|
||||
inputRow.Children.Add(tellButton);
|
||||
Grid.SetColumn(tellButton, 1);
|
||||
|
||||
// ── Main layout ────────────────────────────────────────────────
|
||||
var mainLayout = new DockPanel
|
||||
{
|
||||
|
|
@ -341,10 +362,10 @@ internal static class RynthChatPanel
|
|||
};
|
||||
DockPanel.SetDock(tabStrip, Dock.Top);
|
||||
DockPanel.SetDock(searchBox, Dock.Top);
|
||||
DockPanel.SetDock(chatInputBox, Dock.Bottom);
|
||||
DockPanel.SetDock(inputRow, Dock.Bottom);
|
||||
mainLayout.Children.Add(tabStrip);
|
||||
mainLayout.Children.Add(searchBox);
|
||||
mainLayout.Children.Add(chatInputBox);
|
||||
mainLayout.Children.Add(inputRow);
|
||||
mainLayout.Children.Add(scrollViewer);
|
||||
|
||||
// ── "Copied N lines" flash (top-right, above the scrollback) ──
|
||||
|
|
@ -373,11 +394,14 @@ internal static class RynthChatPanel
|
|||
|
||||
var suppressChatCheck = new CheckBox
|
||||
{
|
||||
Content = "Hide retail chat",
|
||||
Content = "Hide retail chat (Enter types here)",
|
||||
IsChecked = ChatHooks.SuppressOriginalChat,
|
||||
FontSize = 9,
|
||||
Foreground = Brushes.White,
|
||||
};
|
||||
ToolTip.SetTip(suppressChatCheck,
|
||||
"On: the retail chatbox is hidden and Enter types in RynthChat.\n" +
|
||||
"Off: the retail chatbox is shown and Enter types there; RynthChat keeps showing lines and its Tell button still works.");
|
||||
suppressChatCheck.IsCheckedChanged += (_, _) =>
|
||||
{
|
||||
ChatHooks.SuppressOriginalChat = suppressChatCheck.IsChecked == true;
|
||||
|
|
@ -783,6 +807,8 @@ internal static class RynthChatPanel
|
|||
var defaultBorderBrush = chatInputBox.BorderBrush;
|
||||
var activeBorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xD7, 0x00));
|
||||
|
||||
string defaultWatermark = chatInputBox.Watermark ?? "";
|
||||
|
||||
Win32Backend.OnChatCaptureActivated = () =>
|
||||
{
|
||||
_captureText = "";
|
||||
|
|
@ -792,9 +818,40 @@ internal static class RynthChatPanel
|
|||
{
|
||||
chatInputBox.Text = "";
|
||||
chatInputBox.BorderBrush = activeBorderBrush;
|
||||
chatInputBox.Watermark = defaultWatermark;
|
||||
});
|
||||
};
|
||||
|
||||
// Start "/tell <selected name>, " and leave the player typing. Game thread only
|
||||
// (Tell button via WM_RYNTHCORE_TELL, or "/tell" alone in OnChatSend), where the
|
||||
// selection and its name read live. Nothing selected → a hint in the input box.
|
||||
bool BeginTellToSelected()
|
||||
{
|
||||
if (!TryGetSelectedTellName(out string name))
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
chatInputBox.Text = "";
|
||||
chatInputBox.Watermark = "Select an NPC or player in the game first, then Tell.";
|
||||
});
|
||||
return false;
|
||||
}
|
||||
_captureText = $"/tell {name}, ";
|
||||
_cursorPos = _captureText.Length;
|
||||
_historyIndex = -1;
|
||||
Win32Backend.ChatCaptureActive = true; // keep typing: keys now go to this line
|
||||
var (snap, pos) = (_captureText, _cursorPos);
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
chatInputBox.Text = snap;
|
||||
chatInputBox.CaretIndex = pos;
|
||||
chatInputBox.BorderBrush = activeBorderBrush;
|
||||
chatInputBox.Watermark = defaultWatermark;
|
||||
});
|
||||
return true;
|
||||
}
|
||||
Win32Backend.OnChatTellSelected = () => BeginTellToSelected();
|
||||
|
||||
Win32Backend.OnChatChar = c =>
|
||||
{
|
||||
_captureText = _captureText[.._cursorPos] + c + _captureText[_cursorPos..];
|
||||
|
|
@ -885,6 +942,17 @@ internal static class RynthChatPanel
|
|||
Win32Backend.OnChatSend = () =>
|
||||
{
|
||||
string text = _captureText.Trim();
|
||||
// "/tell" or "/t" alone addresses the selected NPC or player instead of being
|
||||
// sent (AC would only answer with the usage line).
|
||||
if (text.Equals("/tell", StringComparison.OrdinalIgnoreCase) || text.Equals("/t", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!BeginTellToSelected())
|
||||
{
|
||||
_captureText = ""; _cursorPos = 0; _historyIndex = -1;
|
||||
Dispatcher.UIThread.Post(() => chatInputBox.BorderBrush = defaultBorderBrush);
|
||||
}
|
||||
return;
|
||||
}
|
||||
_captureText = "";
|
||||
_cursorPos = 0;
|
||||
_historyIndex = -1;
|
||||
|
|
@ -972,6 +1040,13 @@ internal static class RynthChatPanel
|
|||
RebuildTabs();
|
||||
SelectTab(_activeChannel);
|
||||
|
||||
// Whether RynthChat is on screen decides who owns Enter and whether the retail
|
||||
// chatbox is hidden (ChatHooks.RynthChatOwnsChat). A closed RynthChat used to keep
|
||||
// both: Enter typed into the invisible panel — every key swallowed until Enter or
|
||||
// Escape — and the retail chat stayed hidden, so there was no chat at all.
|
||||
root.AttachedToVisualTree += (_, _) => SetShown(true);
|
||||
root.DetachedFromVisualTree += (_, _) => SetShown(false);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
@ -1194,6 +1269,34 @@ internal static class RynthChatPanel
|
|||
|
||||
internal static bool FloatingSelectionActive => _selDragging;
|
||||
|
||||
/// <summary>The panel went on or off screen (opened, closed, popped out or back in).</summary>
|
||||
private static void SetShown(bool shown)
|
||||
{
|
||||
ChatHooks.ChatPanelShown = shown;
|
||||
if (!shown && Win32Backend.ChatCaptureActive)
|
||||
{
|
||||
// Abandon a half-typed line rather than keep swallowing keys for a closed panel.
|
||||
Win32Backend.ChatCaptureActive = false;
|
||||
_captureText = "";
|
||||
_cursorPos = 0;
|
||||
_historyIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of the creature selected in the game — an NPC or another player — for /tell.
|
||||
/// AC's main thread only (the name read is live there). Never yourself, never an item.
|
||||
/// </summary>
|
||||
private static bool TryGetSelectedTellName(out string name)
|
||||
{
|
||||
name = "";
|
||||
uint id = SelectedTargetHooks.ReadCurrentSelectedId();
|
||||
if (id == 0 || id == ClientHelperHooks.GetPlayerId()) return false;
|
||||
const uint ItemTypeCreature = 0x00000010;
|
||||
if (ClientObjectHooks.TryGetItemType(id, out uint flags) && (flags & ItemTypeCreature) == 0) return false;
|
||||
return ClientObjectHooks.TryGetObjectName(id, out name) && !string.IsNullOrWhiteSpace(name);
|
||||
}
|
||||
|
||||
// RL loads fresh plugin copies without unloading the old ones: drop the
|
||||
// exports bound below so the next poll re-binds to the live copy.
|
||||
static RynthChatPanel() => PluginManager.PluginsUnloaded += () =>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ internal static class StatusPanel
|
|||
panel.Children.Clear();
|
||||
|
||||
AddHeader(panel, "Engine");
|
||||
AddRow(panel, "Build", EntryPoint.BuildStamp);
|
||||
AddRow(panel, "Version", EntryPoint.BuildStamp);
|
||||
AddRow(panel, "Game HWND", $"0x{EntryPoint.GameHwnd:X8}");
|
||||
AddRow(panel, "Plugin dir", PluginManager.PluginDirectory);
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ internal static class StatusPanel
|
|||
foreach (var p in plugins)
|
||||
{
|
||||
string state = p.Failed ? "FAILED" : p.Initialized ? "OK" : "pending";
|
||||
string version = p.VersionString.Length > 0 ? $" v{p.VersionString}" : "";
|
||||
string version = p.VersionString.Length > 0 ? $" {p.VersionString}" : "";
|
||||
AddRow(panel, p.DisplayName + version, state, p.Failed);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue