feat(net): Phase B.2 — MoveToState + AutonomousPosition message builders
Outbound GameAction message builders for player movement: - MoveToState (0xF61C): sent on motion state changes (start/stop walking, turn, speed change). Carries RawMotionState (flag-driven variable fields) + WorldPosition + sequence numbers. - AutonomousPosition (0xF753): periodic position heartbeat sent every ~200ms while moving. No RawMotionState — just WorldPosition + sequences + contact byte. Both follow the GameAction envelope pattern (0xF7B1 + sequence + action type) established by GameActionLoginComplete. Wire format ported from references/holtburger movement protocol — field order and alignment match exactly (contact byte + pad_to_4). Also: - Adds WriteFloat to PacketWriter (needed by both builders) - Adds SendGameAction + NextGameActionSequence to WorldSession (public wrappers for PlayerMovementController in Task 2) 11 new tests, 265 total, all green. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d9cd2b0b1d
commit
fe1c949775
6 changed files with 577 additions and 0 deletions
|
|
@ -126,6 +126,16 @@ public sealed class WorldSession : IDisposable
|
|||
/// </summary>
|
||||
private bool _loginCompleteSent;
|
||||
|
||||
/// <summary>
|
||||
/// Phase B.2: per-session game-action sequence counter. Monotonically
|
||||
/// incremented by <see cref="NextGameActionSequence"/> and embedded in
|
||||
/// every outbound MoveToState / AutonomousPosition GameAction message.
|
||||
/// ACE's GameActionPacket.HandleGameAction reads the sequence field but
|
||||
/// currently only uses it for logging — however retail clients do
|
||||
/// increment it, so we match that behaviour.
|
||||
/// </summary>
|
||||
private uint _gameActionSequence;
|
||||
|
||||
public WorldSession(IPEndPoint serverLogin)
|
||||
{
|
||||
_loginEndpoint = serverLogin;
|
||||
|
|
@ -419,6 +429,24 @@ public sealed class WorldSession : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase B.2: send a pre-built GameAction body (which already contains
|
||||
/// the 0xF7B1 envelope + sequence + action-type header). Used by the
|
||||
/// PlayerMovementController for MoveToState and AutonomousPosition.
|
||||
/// </summary>
|
||||
public void SendGameAction(byte[] gameActionBody)
|
||||
{
|
||||
SendGameMessage(gameActionBody);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase B.2: get and increment the game-action sequence counter.
|
||||
/// Call once per outbound movement message; pass the returned value
|
||||
/// to <see cref="Messages.MoveToState.Build"/> or
|
||||
/// <see cref="Messages.AutonomousPosition.Build"/>.
|
||||
/// </summary>
|
||||
public uint NextGameActionSequence() => ++_gameActionSequence;
|
||||
|
||||
private void SendGameMessage(byte[] gameMessageBody)
|
||||
{
|
||||
var fragment = GameMessageFragment.BuildSingleFragment(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue