RynthCore as of 2026-10-05 evening (internal 0a2043e): release 2026.10.5.20 - own dat reader, plugin manifests, UI/login hooks with Loot Editor drag-and-drop, server-message stream (API v78), raise attributes and skills (API v79), nameplate sizing and overlay opacity, engine reload held while a plugin is fighting, StatusAgent character sheet, world map and travel for DrakRemote
This commit is contained in:
parent
c3e15480e5
commit
913a2a00b6
110 changed files with 12560 additions and 1151 deletions
|
|
@ -77,6 +77,83 @@ internal static class RynthLog
|
|||
EntryPoint.LogTagged("engine", msg, "ERR");
|
||||
}
|
||||
|
||||
// ── Diagnostic traces (2026-10-05, Drakkon's held casts on DreamWeave) ──
|
||||
// A movement packet sent while a cast winds up can cancel the cast or leave the server
|
||||
// holding it open, and the old movement lines were 1 in 8 with no caller. Both switches
|
||||
// are on by default; each costs one bool test when off.
|
||||
|
||||
/// <summary>Every plugin movement call (SetAutoRun, SetMotion, DoMovement/StopMovement,
|
||||
/// StopCompletely, TurnToHeading, jumps), one "Move:" line each with the calling plugin.
|
||||
/// Identical calls in a row from one caller (turns: any angle) are counted, not written,
|
||||
/// for up to MoveRepeatWindowMs; the count rides on the next line written.</summary>
|
||||
internal static bool MoveTraceEnabled = true;
|
||||
|
||||
/// <summary>Every server UseDone (0x01C7) with its sequence number and error code
|
||||
/// (before: the first 25 of a session).</summary>
|
||||
internal static bool ActionDoneTraceEnabled = true;
|
||||
|
||||
private const long MoveRepeatWindowMs = 1000;
|
||||
private static readonly object _moveGate = new();
|
||||
private static string _moveLastKey = "";
|
||||
private static long _moveLastWrittenMs = long.MinValue;
|
||||
private static int _moveRepeats;
|
||||
private static long _moveRepeatFirstMs;
|
||||
private static string _moveRepeatLastArg = "";
|
||||
|
||||
/// <summary>
|
||||
/// One plugin movement call (see <see cref="MoveTraceEnabled"/>). <paramref name="name"/>
|
||||
/// must be a string literal (it also goes into AcActionTrace, which keeps the last 256
|
||||
/// actions for crash dumps); <paramref name="a"/>/<paramref name="b"/> are its trace args.
|
||||
/// </summary>
|
||||
internal static void Move(string name, string arg, bool ok, bool collapseByKind = false, uint a = 0, uint b = 0)
|
||||
{
|
||||
Compatibility.AcActionTrace.Record(name, a, b);
|
||||
if (!MoveTraceEnabled) return;
|
||||
string? line = null;
|
||||
try
|
||||
{
|
||||
string caller = MoveCaller();
|
||||
lock (_moveGate)
|
||||
{
|
||||
long now = Environment.TickCount64;
|
||||
string key = collapseByKind ? $"{caller}|{name}" : $"{caller}|{name}({arg})|{ok}";
|
||||
if (key == _moveLastKey && now - _moveLastWrittenMs < MoveRepeatWindowMs)
|
||||
{
|
||||
if (_moveRepeats == 0) _moveRepeatFirstMs = now;
|
||||
_moveRepeats++;
|
||||
_moveRepeatLastArg = arg;
|
||||
return;
|
||||
}
|
||||
string more = "";
|
||||
if (_moveRepeats > 0)
|
||||
{
|
||||
string[] parts = _moveLastKey.Split('|');
|
||||
string what = parts.Length > 1 ? parts[1] : "?";
|
||||
string last = parts.Length > 2 ? "" : $", last {_moveRepeatLastArg}";
|
||||
more = $" (+{_moveRepeats} more {what}{last} by {parts[0]} before this, over {now - _moveRepeatFirstMs} ms)";
|
||||
}
|
||||
line = $"Move: {name}({arg}) by {caller} -> {(ok ? "ok" : "FAILED")}{more}";
|
||||
_moveLastKey = key;
|
||||
_moveLastWrittenMs = now;
|
||||
_moveRepeats = 0;
|
||||
_moveRepeatLastArg = "";
|
||||
}
|
||||
}
|
||||
catch { return; }
|
||||
Write(line);
|
||||
}
|
||||
|
||||
/// <summary>The plugin whose tick or event is calling, else the thread.</summary>
|
||||
private static string MoveCaller()
|
||||
{
|
||||
var plugin = Plugins.PluginManager.CurrentDispatch;
|
||||
if (plugin != null)
|
||||
return string.IsNullOrEmpty(plugin.DisplayName) ? plugin.FileName : plugin.DisplayName;
|
||||
return Compatibility.MainThreadGuard.IsOnMainThread()
|
||||
? "AC main thread"
|
||||
: $"thread {Environment.CurrentManagedThreadId}";
|
||||
}
|
||||
|
||||
// ── Sink ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static void Write(string message) => EntryPoint.Log(message);
|
||||
|
|
|
|||
Loading…
Reference in a new issue