feat(rynthai): ILT Hub, HUDs, item info, chat translation, ground loot and nav editing
- ILT Hub (overlay window, /ra hub): character progression, pets, quests, gear, banking, guardian, buff keepers, session rates, USD import. - Floating HUDs: combat tracker, item count HUD, Mini Remote (/ra remote, /ra huds). - Item info (Mag-style describer) on select, with its own settings window. - Chat translation (/ra translate) for chosen channels. - Ground loot: loose items matching the loot profile are picked up when no corpse is in range (CorpseOpenController). - Nav: breadcrumb recorder, route overlay, and the route editor commands the engine Nav panel sends (multi-select move/duplicate/delete, reverse, snap to path, pauses, portals, simplify, trail -> route). - Pets: refill-loop guard for essences the server just confirmed full; optional ILT Hub hooks (summon on empty, hold, yield a cosmetic pet). - QuestTracker: quiet refreshes, Disabled / LastStatus for the hub. - WorldObjectCache: typed items (keys, gems, comps, food) are placed in inventory or landscape by ownership instead of staying Unknown. - Install-aware data folders (RynthInstallPaths) and a per-category diagnostics log (Diagnostics/RynthLog, diagnostics.json). - Monster Editor: VirindiTank USD import and "Import UB damage insights" (ub-mob-seed.json); RynthAi loads the seed (UbMobSeedStore). Kept as on rynth/main: combat (ammo, off-hand/shield rules), AutoStack in InventoryManager, LegacyAdvancedSettingsUi and the version stamping. No host API slots are used; new engine data comes from optional exports (RynthPluginRenderOverlay, RynthPluginGetProgressionJson, RynthPluginGetCharmsJson). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
6847868401
commit
09b14d4ed1
97 changed files with 20718 additions and 71 deletions
128
Shared/RynthInstallPaths.cs
Normal file
128
Shared/RynthInstallPaths.cs
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace RynthCore.Install;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves where RynthCore and RynthSuite are installed. The installer lets the user pick
|
||||
/// both folders and records them under <c>Software\Rynth</c> (HKCU for a per-user install,
|
||||
/// HKLM for an all-users install), so nothing may assume <c>C:\Games\...</c> any more.
|
||||
/// <para>
|
||||
/// Resolution order per folder: environment override (<c>RYNTHCORE_DIR</c> /
|
||||
/// <c>RYNTHSUITE_DIR</c>, for dev setups) → HKCU → HKLM (32-bit view, where the 32-bit
|
||||
/// installer writes) → the historical default under <c>C:\Games</c>. Results are cached
|
||||
/// for the life of the process.
|
||||
/// </para>
|
||||
/// Linked into the RynthAi plugin and the Loot / Monster editors. RynthCore keeps an identical copy in
|
||||
/// <c>src/RynthCore.App/RynthInstallPaths.cs</c> (engine, launcher, injector) — change both together.
|
||||
/// Registry access is a direct RegGetValueW P/Invoke so it works under NativeAOT and trimming
|
||||
/// without pulling in Microsoft.Win32.Registry.
|
||||
/// </summary>
|
||||
internal static class RynthInstallPaths
|
||||
{
|
||||
/// <summary>Default RynthCore folder (pre-2026.10.4.2 installs always used this).</summary>
|
||||
public const string DefaultCoreDir = @"C:\Games\RynthCore";
|
||||
|
||||
/// <summary>Default RynthSuite folder (pre-2026.10.4.2 installs always used this).</summary>
|
||||
public const string DefaultSuiteDir = @"C:\Games\RynthSuite";
|
||||
|
||||
/// <summary>Registry key (under HKCU or HKLM) written by the installer.</summary>
|
||||
public const string RegistryKey = @"Software\Rynth";
|
||||
|
||||
private static string? _coreDir;
|
||||
private static string? _suiteDir;
|
||||
|
||||
/// <summary>RynthCore install folder (launcher, <c>Runtime\</c>, <c>Logs\</c>, <c>Tools\</c>).</summary>
|
||||
public static string CoreDir => _coreDir ??= Resolve("RYNTHCORE_DIR", "CoreDir", DefaultCoreDir);
|
||||
|
||||
/// <summary>RynthSuite folder (plugins and their data, e.g. <c>RynthAi\</c>).</summary>
|
||||
public static string SuiteDir => _suiteDir ??= Resolve("RYNTHSUITE_DIR", "SuiteDir", DefaultSuiteDir);
|
||||
|
||||
/// <summary>Unified RynthCore log folder (<c><CoreDir>\Logs</c>).</summary>
|
||||
public static string CoreLogsDir => Path.Combine(CoreDir, "Logs");
|
||||
|
||||
/// <summary>RynthAi plugin home and data root (<c><SuiteDir>\RynthAi</c>).</summary>
|
||||
public static string RynthAiDir => Path.Combine(SuiteDir, "RynthAi");
|
||||
|
||||
/// <summary>Reads a string value from <c>Software\Rynth</c> (HKCU first, then HKLM 32-bit view); null when absent.</summary>
|
||||
public static string? ReadSetting(string valueName)
|
||||
=> ReadRegistryString(HKEY_CURRENT_USER, valueName, 0)
|
||||
?? ReadRegistryString(HKEY_LOCAL_MACHINE, valueName, RRF_SUBKEY_WOW6432KEY);
|
||||
|
||||
/// <summary>Deletes a value from HKCU <c>Software\Rynth</c> (used for one-shot installer hand-offs). Best effort.</summary>
|
||||
public static void DeleteUserSetting(string valueName)
|
||||
{
|
||||
try { RegDeleteKeyValueW(HKEY_CURRENT_USER, RegistryKey, valueName); } catch { }
|
||||
}
|
||||
|
||||
private static string Resolve(string envVar, string valueName, string fallback)
|
||||
{
|
||||
string? fromEnv = null;
|
||||
try { fromEnv = Environment.GetEnvironmentVariable(envVar); } catch { }
|
||||
|
||||
foreach (string? candidate in new[] { fromEnv, ReadSetting(valueName) })
|
||||
{
|
||||
string? normalized = Normalize(candidate);
|
||||
if (normalized != null) return normalized;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/// <summary>Accepts only absolute paths; trims whitespace, quotes and trailing separators.</summary>
|
||||
private static string? Normalize(string? path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path)) return null;
|
||||
string p = path.Trim().Trim('"').TrimEnd('\\', '/');
|
||||
if (p.Length == 2 && p[1] == ':') p += "\\"; // keep "D:" as the drive root "D:\"
|
||||
try
|
||||
{
|
||||
if (!Path.IsPathFullyQualified(p)) return null;
|
||||
string full = Path.GetFullPath(p);
|
||||
return full.Length > 3 ? full.TrimEnd('\\') : full; // "D:\" stays a root
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Win32 registry (advapi32) ───────────────────────────────────────────
|
||||
|
||||
private static readonly IntPtr HKEY_CURRENT_USER = new(unchecked((int)0x80000001));
|
||||
private static readonly IntPtr HKEY_LOCAL_MACHINE = new(unchecked((int)0x80000002));
|
||||
private const uint RRF_RT_REG_SZ = 0x00000002;
|
||||
private const uint RRF_RT_REG_EXPAND_SZ = 0x00000004;
|
||||
private const uint RRF_SUBKEY_WOW6432KEY = 0x00020000;
|
||||
private const int ERROR_SUCCESS = 0;
|
||||
|
||||
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
|
||||
private static extern int RegGetValueW(IntPtr hkey, string lpSubKey, string lpValue, uint dwFlags,
|
||||
IntPtr pdwType, char[]? pvData, ref uint pcbData);
|
||||
|
||||
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
|
||||
private static extern int RegDeleteKeyValueW(IntPtr hkey, string lpSubKey, string lpValueName);
|
||||
|
||||
private static string? ReadRegistryString(IntPtr root, string valueName, uint viewFlags)
|
||||
{
|
||||
try
|
||||
{
|
||||
uint flags = RRF_RT_REG_SZ | RRF_RT_REG_EXPAND_SZ | viewFlags;
|
||||
uint bytes = 0;
|
||||
if (RegGetValueW(root, RegistryKey, valueName, flags, IntPtr.Zero, null, ref bytes) != ERROR_SUCCESS || bytes < 2)
|
||||
return null;
|
||||
|
||||
var buffer = new char[(bytes + 1) / 2];
|
||||
if (RegGetValueW(root, RegistryKey, valueName, flags, IntPtr.Zero, buffer, ref bytes) != ERROR_SUCCESS)
|
||||
return null;
|
||||
|
||||
int len = Array.IndexOf(buffer, '\0');
|
||||
return new string(buffer, 0, len >= 0 ? len : buffer.Length);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Missing advapi32 entry point or access denied — fall back to the defaults.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
77
Shared/UbMobSeed.cs
Normal file
77
Shared/UbMobSeed.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace RynthCore.CreatureSeed;
|
||||
|
||||
/// <summary>
|
||||
/// Monster damage-type seed derived from UtilityBelt's <c>mob_damage_insights.ldb</c>.
|
||||
/// Written by the Monster Editor ("Import UB damage insights"); read (never written)
|
||||
/// by the RynthAi plugin as a fallback for the "Auto" damage type when a monster
|
||||
/// has no appraised resists yet.
|
||||
/// File: <c><SuiteDir>\RynthAi\CreatureData\ub-mob-seed.json</c>.
|
||||
/// Compiled into both projects so the schema cannot drift; plain properties with
|
||||
/// defaults keep it source-generator (NativeAOT) friendly.
|
||||
/// </summary>
|
||||
public sealed class UbMobSeedFile
|
||||
{
|
||||
/// <summary>Current schema version written by the importer.</summary>
|
||||
public const int CurrentVersion = 1;
|
||||
|
||||
/// <summary>File name inside <c>RynthAi\CreatureData</c>.</summary>
|
||||
public const string FileName = "ub-mob-seed.json";
|
||||
|
||||
/// <summary>Schema version of this file; readers ignore files with a newer major version.</summary>
|
||||
public int Version { get; set; } = CurrentVersion;
|
||||
|
||||
/// <summary>UTC time the importer produced the file (ISO-8601).</summary>
|
||||
public string GeneratedUtc { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Most common UB world name across the imported rows (e.g. "InfiniteLeaftide").</summary>
|
||||
public string World { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Hits a damage type needs before it is ranked at all.</summary>
|
||||
public int MinHitsPerType { get; set; }
|
||||
|
||||
/// <summary>Source databases that contributed rows (full paths, for traceability).</summary>
|
||||
public List<string> Sources { get; set; } = new();
|
||||
|
||||
/// <summary>One entry per monster with at least two comparable damage types.</summary>
|
||||
public List<UbMobSeedEntry> Entries { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>Seeded damage-type ranking for one monster.</summary>
|
||||
public sealed class UbMobSeedEntry
|
||||
{
|
||||
/// <summary>Weenie class id; 0 for name-only rows imported from Mag-Tools.</summary>
|
||||
public uint Wcid { get; set; }
|
||||
|
||||
/// <summary>Last display name UB saw for this monster.</summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>"ub" (live UB wcid rows) or "magtools" (name-keyed Mag-Tools XML imports).</summary>
|
||||
public string Source { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>All hits UB recorded against this monster (every type, including unranked ones).</summary>
|
||||
public long TotalHits { get; set; }
|
||||
|
||||
/// <summary>Ranked damage types, best first. Only types meeting the hit threshold are listed.</summary>
|
||||
public List<UbMobSeedElement> Elements { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>Observed outgoing-damage statistics for one damage type against one monster.</summary>
|
||||
public sealed class UbMobSeedElement
|
||||
{
|
||||
/// <summary>RynthAi element name: Slash, Pierce, Bludgeon, Fire, Cold, Lightning, Acid or Nether.</summary>
|
||||
public string Element { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Hits recorded with this damage type.</summary>
|
||||
public int Hits { get; set; }
|
||||
|
||||
/// <summary>Average damage per hit with this damage type.</summary>
|
||||
public double AvgDamage { get; set; }
|
||||
|
||||
/// <summary>Largest single hit (0 for Mag-Tools rows, which do not record it).</summary>
|
||||
public long MaxHit { get; set; }
|
||||
|
||||
/// <summary>Relative effectiveness 0..1 (1 = best type for this monster); used for the ranking.</summary>
|
||||
public double Score { get; set; }
|
||||
}
|
||||
Loading…
Reference in a new issue