- 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>
49 lines
2.3 KiB
C#
49 lines
2.3 KiB
C#
// AcChatEscapes.cs — AC chat text helpers for the translator.
|
|
//
|
|
// AC carries characters above Latin-1 (Hangul, CJK, Cyrillic, ...) in chat as "<hhhh>" UTF-16 escapes,
|
|
// and the outbound chat path converts each char to one byte, so anything above U+00FF must be escaped
|
|
// before sending. Latin-1 letters (ä ö ü ñ é) stay literal; escaping them shows "<00e4>" in chat.
|
|
// Speaker names arrive wrapped in "<Tell:IIDString:id:Name>Name<\Tell>" link markup.
|
|
using System.Globalization;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace RynthCore.Plugin.RynthAi.Translate;
|
|
|
|
internal static class AcChatEscapes
|
|
{
|
|
private static readonly Regex RxEscape = new(@"<([0-9a-fA-F]{4})>", RegexOptions.CultureInvariant);
|
|
private static readonly Regex RxTellLink = new(@"<Tell:[^>]*>(?<n>[^<]*)<\\Tell>", RegexOptions.CultureInvariant);
|
|
|
|
/// <summary>Expands "<c2dc>" escapes into the characters they stand for.</summary>
|
|
public static string Decode(string text)
|
|
{
|
|
if (string.IsNullOrEmpty(text) || text.IndexOf('<') < 0) return text ?? string.Empty;
|
|
return RxEscape.Replace(text, m =>
|
|
{
|
|
int cp = int.Parse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
|
return cp is > 0 and <= 0xFFFF ? ((char)cp).ToString() : m.Value;
|
|
});
|
|
}
|
|
|
|
/// <summary>Escapes characters above U+00FF as "<hhhh>"; drops other control characters.</summary>
|
|
public static string EncodeForSend(string text)
|
|
{
|
|
if (string.IsNullOrEmpty(text)) return string.Empty;
|
|
var sb = new StringBuilder(text.Length + 16);
|
|
foreach (char c in text)
|
|
{
|
|
if (c == '\r' || c == '\n' || c == '\t') { sb.Append(' '); continue; }
|
|
if (c < 0x20) continue;
|
|
if (c <= 0xFF) { sb.Append(c); continue; }
|
|
sb.Append('<').Append(((int)c).ToString("x4", CultureInfo.InvariantCulture)).Append('>');
|
|
}
|
|
return sb.ToString().Trim();
|
|
}
|
|
|
|
/// <summary>Replaces tell-link markup with the plain name it wraps.</summary>
|
|
public static string StripLinks(string text)
|
|
=> string.IsNullOrEmpty(text) || text.IndexOf("<Tell:", System.StringComparison.Ordinal) < 0
|
|
? text ?? string.Empty
|
|
: RxTellLink.Replace(text, "${n}");
|
|
}
|