diff --git a/src/RynthCore.Engine/Compatibility/ChatCommandDispatcher.cs b/src/RynthCore.Engine/Compatibility/ChatCommandDispatcher.cs index 7ca4197..8dba6f6 100644 --- a/src/RynthCore.Engine/Compatibility/ChatCommandDispatcher.cs +++ b/src/RynthCore.Engine/Compatibility/ChatCommandDispatcher.cs @@ -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); diff --git a/src/RynthCore.Engine/Compatibility/ChatLineRoute.cs b/src/RynthCore.Engine/Compatibility/ChatLineRoute.cs new file mode 100644 index 0000000..bc90936 --- /dev/null +++ b/src/RynthCore.Engine/Compatibility/ChatLineRoute.cs @@ -0,0 +1,42 @@ +using System; + +namespace RynthCore.Engine.Compatibility; + +/// +/// 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. +/// +internal static class ChatLineRoute +{ + private static readonly string[] AtEmoteCommands = ["@emotes", "@emote", "@em", "@e"]; + + /// True when (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. + 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; + } +} diff --git a/src/RynthCore.Engine/Compatibility/ClientObjectHooks.cs b/src/RynthCore.Engine/Compatibility/ClientObjectHooks.cs index aed72a1..f83d305 100644 --- a/src/RynthCore.Engine/Compatibility/ClientObjectHooks.cs +++ b/src/RynthCore.Engine/Compatibility/ClientObjectHooks.cs @@ -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; } diff --git a/src/RynthCore.Engine/Net/FlightCapture.cs b/src/RynthCore.Engine/Net/FlightCapture.cs index e079749..b966515 100644 --- a/src/RynthCore.Engine/Net/FlightCapture.cs +++ b/src/RynthCore.Engine/Net/FlightCapture.cs @@ -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; } + /// + /// Remembers the objects of the streak that just reached . 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. + /// + 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; + } + /// The refused objects, each once (trigger time only). private string TargetList() { @@ -970,35 +1029,66 @@ internal sealed unsafe class FlightCapture } } -/// At most one automatic dump per cooldown; manual dumps don't go through this. +/// +/// At most one automatic dump per cooldown and 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). +/// 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; } /// True (and the cooldown starts) when an automatic dump may be written now; - /// otherwise is how long until one may. + /// otherwise is how long until one may (-1: none more this session). 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; } } + + /// True once a session: the automatic dump just written gets the chat line. + public bool TakeAnnounce() + { + lock (_lock) + { + if (_announced) return false; + _announced = true; + return true; + } + } } diff --git a/src/RynthCore.Engine/Net/FlightFormat.cs b/src/RynthCore.Engine/Net/FlightFormat.cs index c3a5609..88c10b3 100644 --- a/src/RynthCore.Engine/Net/FlightFormat.cs +++ b/src/RynthCore.Engine/Net/FlightFormat.cs @@ -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; diff --git a/src/RynthCore.Engine/Net/FlightRecorder.cs b/src/RynthCore.Engine/Net/FlightRecorder.cs index 3f2f503..152cec1 100644 --- a/src/RynthCore.Engine/Net/FlightRecorder.cs +++ b/src/RynthCore.Engine/Net/FlightRecorder.cs @@ -17,9 +17,11 @@ // // Dumps: /rc flightdump [note] (any time), /rc flightdump auto 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--.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--.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 adds a note; /rc flight off|on|auto off|on.", }; diff --git a/src/RynthCore.Engine/UI/Data/SettingsData.cs b/src/RynthCore.Engine/UI/Data/SettingsData.cs index f582a9a..5c926c9 100644 --- a/src/RynthCore.Engine/UI/Data/SettingsData.cs +++ b/src/RynthCore.Engine/UI/Data/SettingsData.cs @@ -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" + diff --git a/tools/ChatTellTests/ChatTellTests.csproj b/tools/ChatTellTests/ChatTellTests.csproj index b1bafad..5e65cc4 100644 --- a/tools/ChatTellTests/ChatTellTests.csproj +++ b/tools/ChatTellTests/ChatTellTests.csproj @@ -4,7 +4,8 @@ Offline checks for RynthChat's /reply + /retell and paste (compiled in): src\RynthCore.Engine\Compatibility\TellMemory.cs - who to reply / retell to, read off the chat lines, and the rewrite of "/r text" into "/tell Name, text"; - src\RynthCore.Engine\UI\Data\ChatInputPaste.cs - clipboard text made into one input line. + src\RynthCore.Engine\UI\Data\ChatInputPaste.cs - clipboard text made into one input line; + src\RynthCore.Engine\Compatibility\ChatLineRoute.cs - which lines are AC emotes, not speech. Nothing native: no AC, no engine state. Run: dotnet run -c Release (exit 0 = pass, 1 = fail) --> @@ -20,6 +21,7 @@ + diff --git a/tools/ChatTellTests/Program.cs b/tools/ChatTellTests/Program.cs index 2fb6de7..c1bc74c 100644 --- a/tools/ChatTellTests/Program.cs +++ b/tools/ChatTellTests/Program.cs @@ -24,6 +24,7 @@ internal static class Program RewriteCases(); PasteClean(); PasteInsert(); + EmoteLines(); Console.WriteLine(); Console.WriteLine($"{_checks - _failed}/{_checks} checks passed."); @@ -168,6 +169,33 @@ internal static class Program Check(r == pair + "b" && c == pair.Length + 1, "never splits a surrogate pair"); } + // ── emotes (ChatLineRoute.cs) ─────────────────────────────────────────── + + private static void EmoteLines() + { + Case("emote lines go to AC's parser"); + Check(ChatLineRoute.IsAcEmoteLine("@e waves"), "@e text"); + Check(ChatLineRoute.IsAcEmoteLine("@EM waves"), "@em, any case"); + Check(ChatLineRoute.IsAcEmoteLine("@emote looks around the town curiously."), "@emote text"); + Check(ChatLineRoute.IsAcEmoteLine("@emotes"), "@emotes alone (the list)"); + Check(ChatLineRoute.IsAcEmoteLine("; waves"), "; text"); + Check(ChatLineRoute.IsAcEmoteLine(":waves"), ":text"); + Check(ChatLineRoute.IsAcEmoteLine("*wave*"), "*wave*"); + Check(ChatLineRoute.IsAcEmoteLine("*Warm Hands*"), "*two words*"); + + Case("everything else stays speech or a server command"); + Check(!ChatLineRoute.IsAcEmoteLine("hello there"), "plain words"); + Check(!ChatLineRoute.IsAcEmoteLine("@myquests"), "an ACE @command"); + Check(!ChatLineRoute.IsAcEmoteLine("@echo hi"), "@echo is not @e"); + Check(!ChatLineRoute.IsAcEmoteLine("@emu"), "@emu is not @em"); + Check(!ChatLineRoute.IsAcEmoteLine("*"), "a lone asterisk"); + Check(!ChatLineRoute.IsAcEmoteLine("**"), "two asterisks"); + Check(!ChatLineRoute.IsAcEmoteLine("* *"), "asterisks round a space"); + Check(!ChatLineRoute.IsAcEmoteLine("*wave"), "no closing asterisk"); + Check(!ChatLineRoute.IsAcEmoteLine(";"), "a lone semicolon"); + Check(!ChatLineRoute.IsAcEmoteLine(""), "empty"); + } + private static void Case(string name) { _case = name; diff --git a/tools/FlightRecorderTests/Program.cs b/tools/FlightRecorderTests/Program.cs index 388a1f1..5d4e2bc 100644 --- a/tools/FlightRecorderTests/Program.cs +++ b/tools/FlightRecorderTests/Program.cs @@ -37,6 +37,9 @@ internal static unsafe class Program DetectUseRefusalDelayedAnswers(); NoTriggerWhenCorpsesOpen(); NoTriggerForDrinksAndKits(); + NoTriggerForEssenceSummons(); + RefusalStreakNeedsQuickRetries(); + RefusalDumpOncePerObject(); DetectUnanswered(); DetectTooBusy(); DumpPolicy(); @@ -584,6 +587,69 @@ internal static unsafe class Program Eq(c.TakeTrigger(), null, "no trigger"); } + // R-20261115-172211-37eb: an essence summoned every 45 s answers UseDone(0) and its charges + // (Structure, int property 92) going down; the pet is a new object. That is a use that worked. + private static byte[] UpdateInt(uint obj, uint prop, int value) => + new Body().Bytes(1).U32(obj).U32(prop).U32(unchecked((uint)value)).Message(0x02CE); + + private static void NoTriggerForEssenceSummons() + { + Case("detector: summons from an essence (UseDone(0) + its charges drop) never trigger"); + var c = NewCapture(); + LoginAs(c); + const uint Essence = 0x8044E456; + for (int i = 0; i < 8; i++) + { + Out(c, Use(Essence)); + _t += 30; + In(c, UpdateInt(Essence, 92, 100 - i)); + In(c, UseDone(0)); + _t += 3000; + c.Tick(); + } + Eq(c.TakeTrigger(), null, "no trigger"); + Eq(c.RefusedStreak, 0, "no refused uses"); + Has(string.Join("\n", Lines(c)), "PublicUpdatePropertyInt 0x8044E456 prop 92 = 93", "the charge update is kept and decoded"); + + // A property update about an object nobody used is not kept. + int before = Recs(c).Length; + In(c, UpdateInt(0x80077777, 92, 5)); + Eq(Recs(c).Length, before, "an unused object's update is dropped"); + } + + private static void RefusalStreakNeedsQuickRetries() + { + Case("detector: refused uses spread past 30 s apart don't make a streak (the 45 s essence cadence)"); + var c = NewCapture(); + LoginAs(c); + for (int i = 0; i < 6; i++) + { + Out(c, Use(Corpse)); + _t += 30; + In(c, UseDone(0)); + _t += 2000; + c.Tick(); + _t += 46_000; + } + Eq(c.TakeTrigger(), null, "no trigger at a 48 s cadence"); + Eq(c.RefusedStreak, 1, "each refusal starts a new streak"); + } + + private static void RefusalDumpOncePerObject() + { + Case("detector: the same objects refusing again don't raise a second dump; new ones do"); + var c = NewCapture(); + LoginAs(c); + void Refuse(uint id) { Out(c, Use(id)); _t += 60; In(c, UseDone(0)); _t += 1600; c.Tick(); } + for (int i = 0; i < 4; i++) Refuse(Corpse); + Check(c.TakeTrigger()?.StartsWith("use-refusal") == true, "first streak triggers"); + for (int i = 0; i < 4; i++) Refuse(Corpse); + Eq(c.TakeTrigger(), null, "the same corpse again: no trigger"); + Has(string.Join("\n", Lines(c)), "use-refusal again at 0x80068ACE (no dump", "but a marker says so"); + for (int i = 0; i < 4; i++) Refuse(Other); + Check(c.TakeTrigger()?.Contains("0x80012345") == true, "another object triggers"); + } + private static void DetectUnanswered() { Case("detector: 3 uses with no UseDone at all -> use-unanswered trigger"); @@ -619,6 +685,17 @@ internal static unsafe class Program Check(!p.TryAccept(600_999, out _), "just before"); Check(p.TryAccept(601_000, out _), "after the cooldown"); Eq(p.Refused, 2, "refusals counted"); + + Case("dump policy: at most N automatic dumps a session; only the first is announced in chat"); + var q = new FlightDumpPolicy(600_000, 3); + Check(q.TryAccept(0, out _), "1st"); + Check(q.TakeAnnounce(), "the first dump is announced"); + Check(!q.TakeAnnounce(), "only once a session"); + Check(q.TryAccept(600_000, out _), "2nd"); + Check(q.TryAccept(1_200_000, out _), "3rd"); + Check(!q.TryAccept(10_000_000, out long w), "4th: the session's limit"); + Eq(w, -1L, "the limit reports no wait"); + Eq(q.Accepted, 3, "accepted counted"); } // ── decoding ────────────────────────────────────────────────────────────