RynthCore as of 2026-11-17 (internal 786d121): release 2026.11.17.1

This commit is contained in:
Tom Bohar 2026-11-17 10:31:59 -05:00
commit 8713c804ce
10 changed files with 298 additions and 24 deletions

View file

@ -228,6 +228,11 @@ internal static unsafe class ChatCommandDispatcher
if (StartsWithCmd(trimmed, "/f "))
return DispatchRaw(trimmed);
// AC's emote forms without a '/' (@e, @emote, "; text", "*wave*"): AC's own parser,
// as typed in its chat bar (ChatLineRoute.cs). As speech they were said word for word.
if (ChatLineRoute.IsAcEmoteLine(trimmed))
return DispatchRaw(trimmed);
// Bare text → say
if (!trimmed.StartsWith("/", StringComparison.Ordinal))
return DispatchSay(trimmed);

View file

@ -0,0 +1,42 @@
using System;
namespace RynthCore.Engine.Compatibility;
/// <summary>
/// Which chat lines without a leading '/' still belong to AC's own chat parser, not to plain
/// speech (Event_Talk). AC's help text (acclient.exe, "@help emote") lists them: the text
/// emote "@emote text" and its short forms "@e", "@em", "; text" and ": text", the list
/// "@emotes", and the action emotes written between asterisks ("*wave*", "*Warm Hands*"),
/// which AC turns into an animation. Sent as speech, they came out as the words themselves
/// (2026-11-16 report: no emotes from the RynthChat window). Pure: no AC, no engine state.
/// </summary>
internal static class ChatLineRoute
{
private static readonly string[] AtEmoteCommands = ["@emotes", "@emote", "@em", "@e"];
/// <summary>True when <paramref name="trimmed"/> (a trimmed line, not starting with '/')
/// is one AC's chat bar treats as an emote, so it goes to AC's parser as typed.</summary>
public static bool IsAcEmoteLine(string trimmed)
{
if (string.IsNullOrEmpty(trimmed)) return false;
char first = trimmed[0];
if (first is ';' or ':')
return trimmed.Length > 1;
if (first == '*')
return trimmed.Length > 2 && trimmed[^1] == '*' && trimmed.AsSpan(1, trimmed.Length - 2).Trim().Length > 0;
if (first == '@')
{
foreach (string cmd in AtEmoteCommands)
{
if (!trimmed.StartsWith(cmd, StringComparison.OrdinalIgnoreCase)) continue;
// The whole word: "@e hello" or "@emote" alone, never "@echo" or "@emu".
if (trimmed.Length == cmd.Length || char.IsWhiteSpace(trimmed[cmd.Length]))
return true;
}
}
return false;
}
}

View file

@ -1697,10 +1697,14 @@ internal static class ClientObjectHooks
if (!TryGetObjectQualitiesPtr(playerId, out IntPtr q))
return false;
// InqSkill / InqAttribute / InqAttribute2nd with raw 0 read the enchantment
// registry at [q+0x70] without a null check (early login): wait for it.
if (!IsReadableSpan(q, QualitiesEnchantmentRegistryOffset + 4)
|| Marshal.ReadIntPtr(q + QualitiesEnchantmentRegistryOffset) == IntPtr.Zero)
// registry at [q+0x70] without a null check. AC makes the registry when the first
// enchantment lands, so a character with nothing cast on it since login has none
// (2026-11-16: a fresh DreamWeave character's Skills panel said "Reading your
// character..." for good). Without one, only the raw (base) reads are made, and the
// buffed numbers are the base ones, as they are with nothing cast.
if (!IsReadableSpan(q, QualitiesEnchantmentRegistryOffset + 4))
return false;
int buffedRead = Marshal.ReadIntPtr(q + QualitiesEnchantmentRegistryOffset) != IntPtr.Zero ? 0 : 1;
dst.PlayerId = playerId;
dst.SkillTableRead = ReadSkillRowsLive(q, dst);
@ -1711,7 +1715,7 @@ internal static class ClientObjectHooks
for (uint sk = 1; sk <= PlayerProgress.MaxSkill; sk++)
{
int buffed = 0, raw = 0;
bool b = _inqSkillLevel(q, sk, &buffed, 0) != 0;
bool b = _inqSkillLevel(q, sk, &buffed, buffedRead) != 0;
bool r = _inqSkillLevel(q, sk, &raw, 1) != 0;
dst.SkillLevelKnown[sk] = b || r;
dst.SkillBuffed[sk] = b ? buffed : raw;
@ -1723,7 +1727,7 @@ internal static class ClientObjectHooks
for (uint a = 1; a <= 6; a++)
{
uint v = 0;
if (_inqAttribute(q, a, &v, 0) != 0) dst.AttrBuffed[a] = v;
if (_inqAttribute(q, a, &v, buffedRead) != 0) dst.AttrBuffed[a] = v;
v = 0;
if (_inqAttribute(q, a, &v, 1) != 0) dst.AttrBase[a] = v;
}
@ -1735,7 +1739,7 @@ internal static class ClientObjectHooks
for (uint i = 1; i <= 3; i++)
{
uint stype = i * 2 - 1, v = 0;
if (_inqAttribute2ndBaseLevel(q, stype, &v, 0) != 0) dst.VitalBuffed[i] = v;
if (_inqAttribute2ndBaseLevel(q, stype, &v, buffedRead) != 0) dst.VitalBuffed[i] = v;
v = 0;
if (_inqAttribute2ndBaseLevel(q, stype, &v, 1) != 0) dst.VitalBase[i] = v;
}

View file

@ -15,8 +15,8 @@
// per AutoPosIntervalMs unless a sequence or the cell changed - and any other message.
// Kept, server to client: the game events in WantedEvent, the player's motion,
// position (rate-limited like AutonomousPosition), vector and effect messages,
// teleports, system text, and object messages (delete, pickup, state, motion) about
// the objects the character just used.
// teleports, system text, and object messages (delete, pickup, state, motion, property
// updates) about the objects the character just used.
//
// Strictly read-only: nothing here changes, delays or drops traffic.
// Pure code (no engine state); compiled into tools/FlightRecorderTests.
@ -37,6 +37,9 @@ internal static class FlightOp
public const uint PlayEffect = 0xF755, PlayScriptId = 0xF754, ObjectDelete = 0xF747, PickupEvent = 0xF74A, SetState = 0xF74B;
public const uint ParentEvent = 0xF749, ServerMessage = 0xF7E0, PlayerCreate = 0xF746, CharacterLogOff = 0xF653;
public const uint InventoryRemoveObject = 0x0024, PlayerKilled = 0x019E, SetStackSize = 0x0197;
// An object's property changed (u8 sequence, guid, property, value; ACE GameMessagePublicUpdateProperty*).
public const uint PublicUpdatePropertyInt = 0x02CE, PublicUpdatePropertyInt64 = 0x02D0;
public const uint PublicUpdatePropertyBool = 0x02D2, PublicUpdatePropertyFloat = 0x02D4;
// Game events (inside 0xF7B0).
public const uint EvPopupString = 0x0004, EvInventoryPutObjInContainer = 0x0022, EvWieldObject = 0x0023;
@ -146,6 +149,8 @@ internal sealed unsafe class FlightCapture
public const int ResendMarkIntervalMs = 500; // resend-request markers per direction
public const int UseSettleMs = 1500; // UseDone(0) with nothing else this long after = refused
public const int UseRefusalStreak = 4; // refused uses in a row that trigger a dump
public const int UseRefusalGapMs = 30_000; // a refused use this long after the last one starts a new streak
public const int RefusalReportedMemory = 32; // objects a use-refusal dump already named
public const int UseUnansweredMs = 5000; // a use with no UseDone this long = unanswered
public const int UseUnansweredStreak = 3;
public const int TooBusyWindowMs = 20_000;
@ -195,6 +200,9 @@ internal sealed unsafe class FlightCapture
private int _useCount;
private int _refusedStreak, _unansweredStreak;
private readonly uint[] _refusedTargets = new uint[UseRefusalStreak];
private long _lastRefusedSent;
private readonly uint[] _refusalReported = new uint[RefusalReportedMemory];
private int _refusalReportedNext;
private readonly long[] _tooBusy = new long[TooBusyStreak];
private int _tooBusyNext;
private string? _trigger;
@ -420,6 +428,25 @@ internal sealed unsafe class FlightCapture
DetectResponse(obj, now);
}
return;
case FlightOp.PublicUpdatePropertyInt:
case FlightOp.PublicUpdatePropertyInt64:
case FlightOp.PublicUpdatePropertyBool:
case FlightOp.PublicUpdatePropertyFloat:
{
// A property of the used object changed: the use did something. A summoning essence
// answers its use with UseDone(0) and its charge count (Structure) going down by one,
// and nothing else about it (the pet is a new object); four summons in a row were
// taken for refused uses and dumped (2026-11-15, R-20261115-172211-37eb). The
// guid follows a one-byte sequence.
if (len < 9) return;
uint about = AcPacketWire.ReadU32(msg + 5);
if (about != 0 && IsTarget(about, now))
{
Keep(_in, now, FlightDir.In, f, msg, len, fullLen, seq, 0);
DetectResponse(about, now);
}
return;
}
case FlightOp.PlayerCreate:
if (obj != 0) _playerId = obj;
Keep(_in, now, FlightDir.In, f, msg, len, fullLen, seq, 0);
@ -760,6 +787,10 @@ internal sealed unsafe class FlightCapture
// use refusal: a Use answered by UseDone(0) with nothing about it afterwards (no
// ViewContents, no message about the object, no player motion with an action in it)
// for UseSettleMs; UseRefusalStreak of those in a row. A ViewContents resets it.
// 2026-11-15 (R-20261115-172211-37eb): a pet summoned from an essence every 45 s
// cooldown made a "streak" spread over three minutes. A stall retries within seconds,
// so a refused use more than UseRefusalGapMs after the last one starts a new streak,
// and the objects a dump already named do not raise another one this session.
// use unanswered: UseUnansweredStreak uses in a row with no UseDone for UseUnansweredMs.
// too busy: TooBusyStreak "You're too busy" (WeenieError 0x1D or the system text)
// within TooBusyWindowMs.
@ -907,11 +938,19 @@ internal sealed unsafe class FlightCapture
{
done = true;
_unansweredStreak = 0;
if (_refusedStreak > 0 && Ms(u.Sent - _lastRefusedSent) > UseRefusalGapMs)
_refusedStreak = 0;
_lastRefusedSent = u.Sent;
_refusedTargets[_refusedStreak % _refusedTargets.Length] = u.Target;
_refusedStreak++;
if (_refusedStreak >= UseRefusalStreak)
{
_trigger ??= $"use-refusal: {_refusedStreak} uses in a row answered UseDone(0) with nothing opened ({TargetList()})";
string targets = TargetList();
if (NoteRefusalReported())
_trigger ??= $"use-refusal: {_refusedStreak} uses in a row answered UseDone(0) with nothing opened ({targets})";
else
Mark(FlightMark.Trigger, text:
$"engine: use-refusal again at {targets} (no dump: one already named these objects this session)");
_refusedStreak = 0;
}
}
@ -934,6 +973,26 @@ internal sealed unsafe class FlightCapture
_useCount = keep;
}
/// <summary>
/// Remembers the objects of the streak that just reached <see cref="UseRefusalStreak"/>. True when
/// one of them was not named by an earlier use-refusal dump (a dump is worth it), false when
/// all were (the same chest or essence refusing again tells nothing new). Trigger time only.
/// </summary>
private bool NoteRefusalReported()
{
bool fresh = false;
int n = Math.Min(_refusedStreak, _refusedTargets.Length);
for (int i = 0; i < n; i++)
{
uint id = _refusedTargets[i];
if (Array.IndexOf(_refusalReported, id) >= 0) continue;
fresh = true;
_refusalReported[_refusalReportedNext] = id;
_refusalReportedNext = (_refusalReportedNext + 1) % _refusalReported.Length;
}
return fresh;
}
/// <summary>The refused objects, each once (trigger time only).</summary>
private string TargetList()
{
@ -970,35 +1029,66 @@ internal sealed unsafe class FlightCapture
}
}
/// <summary>At most one automatic dump per cooldown; manual dumps don't go through this.</summary>
/// <summary>
/// At most one automatic dump per cooldown and <see cref="MaxPerSession"/> per session; manual
/// dumps don't go through this. Only the first automatic dump of a session is announced in chat
/// (2026-11-15, R-20261115-172211-37eb: a player saw "Flight recorder saved (auto: ...)" in chat
/// and had "no idea if it matters at all"; it is a diagnostic for the developers, and one line
/// a session is enough to say where the files are).
/// </summary>
internal sealed class FlightDumpPolicy
{
private readonly long _cooldownMs;
private readonly int _maxPerSession;
private long _lastMs;
private bool _any;
private int _accepted;
private bool _announced;
private readonly object _lock = new();
public FlightDumpPolicy(long cooldownMs) { _cooldownMs = cooldownMs; }
public FlightDumpPolicy(long cooldownMs, int maxPerSession = int.MaxValue)
{
_cooldownMs = cooldownMs;
_maxPerSession = maxPerSession;
}
public long CooldownMs => _cooldownMs;
public int MaxPerSession => _maxPerSession;
public int Accepted { get { lock (_lock) return _accepted; } }
public int Refused { get; private set; }
/// <summary>True (and the cooldown starts) when an automatic dump may be written now;
/// otherwise <paramref name="waitMs"/> is how long until one may.</summary>
/// otherwise <paramref name="waitMs"/> is how long until one may (-1: none more this session).</summary>
public bool TryAccept(long nowMs, out long waitMs)
{
lock (_lock)
{
if (_any && nowMs - _lastMs < _cooldownMs)
if (_accepted >= _maxPerSession)
{
waitMs = -1;
Refused++;
return false;
}
if (_accepted > 0 && nowMs - _lastMs < _cooldownMs)
{
waitMs = _cooldownMs - (nowMs - _lastMs);
Refused++;
return false;
}
_any = true;
_accepted++;
_lastMs = nowMs;
waitMs = 0;
return true;
}
}
/// <summary>True once a session: the automatic dump just written gets the chat line.</summary>
public bool TakeAnnounce()
{
lock (_lock)
{
if (_announced) return false;
_announced = true;
return true;
}
}
}

View file

@ -191,6 +191,10 @@ internal static class FlightFormat
FlightOp.InventoryRemoveObject => "InventoryRemoveObject",
FlightOp.SetStackSize => "SetStackSize",
FlightOp.PlayerKilled => "PlayerKilled",
FlightOp.PublicUpdatePropertyInt => "PublicUpdatePropertyInt",
FlightOp.PublicUpdatePropertyInt64 => "PublicUpdatePropertyInt64",
FlightOp.PublicUpdatePropertyBool => "PublicUpdatePropertyBool",
FlightOp.PublicUpdatePropertyFloat => "PublicUpdatePropertyFloat",
0xF7C8 => "CharacterEnterWorldRequest",
0xF657 => "CharacterEnterWorld",
0xF7DE => "TurbineChat",
@ -501,6 +505,10 @@ internal static class FlightFormat
case FlightOp.ParentEvent: { uint p = rd.U32(); uint c = rd.U32(); s = $"ParentEvent {Id(c)} onto {Id(p)} loc {rd.I32()}"; break; }
case FlightOp.InventoryRemoveObject: s = $"InventoryRemoveObject {Id(rd.U32())}"; break;
case FlightOp.SetStackSize: { rd.U8(); uint id = rd.U32(); uint n = rd.U32(); s = $"SetStackSize {Id(id)} size {n}"; break; }
case FlightOp.PublicUpdatePropertyInt: { rd.U8(); uint id = rd.U32(); uint p = rd.U32(); s = $"PublicUpdatePropertyInt {Id(id)} prop {p} = {rd.I32()}"; break; }
case FlightOp.PublicUpdatePropertyInt64:
case FlightOp.PublicUpdatePropertyBool:
case FlightOp.PublicUpdatePropertyFloat: { rd.U8(); uint id = rd.U32(); uint p = rd.U32(); s = $"{OpcodeName(op)} {Id(id)} prop {p}"; break; }
case FlightOp.ServerMessage: { string t = rd.Str(); uint ct = rd.U32(); s = $"ServerMessage \"{t}\" (chat type {ct})"; break; }
case FlightOp.PlayerCreate: s = $"PlayerCreate {Id(rd.U32())}"; break;
case FlightOp.CharacterLogOff: s = "CharacterLogOff"; break;

View file

@ -17,9 +17,11 @@
//
// Dumps: /rc flightdump [note] (any time), /rc flightdump auto <reason> and the plugin
// command (SendPluginCommand("RynthCore.FlightRecorder", "dump", reason)) for automatic
// ones - at most one per AutoDumpCooldownMs, written AutoDumpDelayMs after the trigger so
// the aftermath is in it too. Files: Logs\flight-<pid>-<yyyyMMdd-HHmmss>.txt, written on
// a short-lived engine thread.
// ones - at most one per AutoDumpCooldownMs and AutoDumpsPerSession per session, written
// AutoDumpDelayMs after the trigger so the aftermath is in it too. Files:
// Logs\flight-<pid>-<yyyyMMdd-HHmmss>.txt, written on a short-lived engine thread. Only the
// first automatic dump of a session says so in chat, in words that say nothing is wrong
// (2026-11-15, R-20261115-172211-37eb); the rest go to the engine log only.
//
// engine.json "FlightRecorder": false turns it off at the next client start (no sendto
// hook, nothing recorded); /rc flight off|on pauses it for the session.
@ -39,6 +41,7 @@ internal static unsafe class FlightRecorder
{
public const int Capacity = 16384; // entries (152 bytes each, ~2.5 MB)
public const long AutoDumpCooldownMs = 10 * 60 * 1000;
public const int AutoDumpsPerSession = 3;
public const int AutoDumpDelayMs = 3000;
public const int PruneDays = 14;
@ -48,7 +51,7 @@ internal static unsafe class FlightRecorder
private static FlightCapture? _cap;
private static volatile bool _paused;
private static volatile bool _autoOff;
private static readonly FlightDumpPolicy Policy = new(AutoDumpCooldownMs);
private static readonly FlightDumpPolicy Policy = new(AutoDumpCooldownMs, AutoDumpsPerSession);
private static long _lastSummaryMs;
private static int _lastSendErrors;
@ -234,6 +237,11 @@ internal static unsafe class FlightRecorder
long now = Environment.TickCount64;
if (!Policy.TryAccept(now, out long waitMs))
{
if (waitMs < 0)
{
c.Mark(FlightMark.Trigger, text: $"{source}: {reason} (no dump: {Policy.MaxPerSession} automatic dumps this session already)");
return $"Not dumped: {Policy.MaxPerSession} automatic dumps this session already (/rc flightdump writes one now).";
}
c.Mark(FlightMark.Trigger, text: $"{source}: {reason} (no dump: one was written {(Policy.CooldownMs - waitMs) / 1000} s ago)");
return $"Not dumped: the last automatic dump was {(Policy.CooldownMs - waitMs) / 1000} s ago (one per {Policy.CooldownMs / 60000} min).";
}
@ -313,8 +321,10 @@ internal static unsafe class FlightRecorder
_lastDump = path;
Interlocked.Increment(ref _dumpsWritten);
RynthLog.Compat($"FlightRecorder: wrote {path} ({records.Length} entries; {why}).");
if (announce)
AcMainThreadQueue.EnqueueWriteToChat($"[RynthCore] Flight recorder saved ({why}): {path}", 1);
// The reason stays in the file and the log: in chat it read like an error to players.
if (announce && Policy.TakeAnnounce())
AcMainThreadQueue.EnqueueWriteToChat(
$"[RynthCore] Saved a diagnostic snapshot for the developers to {path} (nothing to do; attach it to a problem report if something went wrong). Later ones this session go to the log only.", 1);
}
catch (Exception ex)
{
@ -398,7 +408,7 @@ internal static unsafe class FlightRecorder
{
$"Flight recorder: {(_paused ? "PAUSED" : "recording")}, {c.Ring.Total} entries recorded (ring {c.Ring.Capacity}, {c.Ring.Bytes / 1024} KB), " +
$"send hook {(RawPacketHooks.IsSendInstalled ? "installed" : "NOT installed")}, receive hook {(RawPacketHooks.IsInstalled ? "installed" : "NOT installed")}, player 0x{c.PlayerId:X8}",
$"Automatic dumps {(_autoOff ? "OFF" : "on")} (one per {AutoDumpCooldownMs / 60000} min, {Policy.Refused} refused by the limit); " +
$"Automatic dumps {(_autoOff ? "OFF" : "on")} (one per {AutoDumpCooldownMs / 60000} min, {Policy.Accepted}/{AutoDumpsPerSession} this session, {Policy.Refused} refused by the limit); " +
$"refused-use streak {c.RefusedStreak}; dumps written {_dumpsWritten}{(_lastDump.Length > 0 ? ", last " + _lastDump : "")}",
"/rc flightdump [note] writes it now; /rc flight mark <text> adds a note; /rc flight off|on|auto off|on.",
};

View file

@ -289,6 +289,7 @@ internal sealed class RynthAiSettings
public bool LootJumpEnabled { get; set; }
public bool LootChestsMacroOff { get; set; } = true; // Pickup with macro off; a RynthAi that doesn't send it leaves it on
public bool LootChestsMacroOffLeaveOpen { get; set; } // its "Leave the chest open", off by default
public bool? LootNearbyChests { get; set; } // Loot Nearby Chests (off by default); null until RynthAi sends it
// Looting rows since 2026-11-11, null until RynthAi sends them (a save then sends null, which RynthAi
// leaves alone): Loot Mode (0 the loot profile, 1 rares and needed mana stones only), the Item Tool's
// chest relock wait (s), and Loot By Name (names separated by |, and the radius in yards).
@ -1278,7 +1279,7 @@ internal static class SettingsSchema
Int("Emergency Heal At", s => s.EmergencyHealAt, (s, v) => s.EmergencyHealAt = v, 0, 100, 1,
"At or under this health %, out of Magic mode a healing kit is used ahead of the\nnormal Heal At chain (kit, Heal Self, potion), and while a spell cast is pending a kit\nor potion is used. Stamina to Health has its own line below. 0 = off. Starts at 30."),
Int("Stamina To Health At", s => s.StaminaToHealthAt, (s, v) => s.StaminaToHealthAt = v, 0, 100, 1,
"At or under this health %, cast Stamina to Health Self ahead of the normal\nHeal At chain (out of Magic mode a kit is tried first). If it can't be cast,\nthe normal chain (kit, Heal Self, potion) runs. 0 = never cast it. Starts at 30."),
"At or under this health %, cast Stamina to Health Self ahead of the normal\nHeal At chain. Set it above Emergency Heal At to make it your emergency heal:\nbetween the two lines the spell goes first, kit or no kit. At or under Emergency\nHeal At, out of Magic mode a kit is tried first. If it can't be cast, the normal\nchain (kit, Heal Self, potion) runs. 0 = never cast it. Starts at 30."),
Int("Stamina To Health Min Stamina", s => s.StaminaToHealthMinStamina, (s, v) => s.StaminaToHealthMinStamina = v, 0, 100, 1,
"Cast Stamina to Health only while stamina is over this %, so it doesn't\ndrain you to nothing. Starts at 20."),
Int("Kit Min Success %", s => s.KitMinSuccessPct, (s, v) => s.KitMinSuccessPct = v, 0, 100, 1,
@ -1691,6 +1692,13 @@ internal static class SettingsSchema
"When the pickup is done the chest stays open and chat says what was taken, so you can check it\n" +
"and take anything your profile missed. Untick it and RynthAi closes the chest when it's done\n" +
"(some chests lock again on close).", when: s => s.LootChestsMacroOff),
Bool("Loot Nearby Chests", s => s.LootNearbyChests ?? false, (s, v) => s.LootNearbyChests = v,
"While the macro runs with Looting on and you're not fighting, walks to a chest within loot range\n" +
"(Corpse Max range), opens it and loots it by your loot profile, then leaves it alone until it resets\n" +
"(it locks again, or the chest relock wait passes). A locked chest: a key you carry that fits is used;\n" +
"else a lockpick, if your Lockpick skill gives you at least 50% against its lock; else it's skipped\n" +
"and tried again in 10 minutes. Corpses come first. Off by default. Status: /ra chests.",
when: s => s.LootNearbyChests.HasValue),
Int("Chest relock wait (s)", s => s.ChestRelockWaitSec ?? 125, (s, v) => s.ChestRelockWaitSec = v, 5, 600, 5,
"The Item Tool's chest key looter: the next key goes into a chest this long after it was opened (sooner when the\n" +
"chest shows locked again). 125 covers ACE's usual chest reset (120 s); a chest that resets sooner can use less.\n" +