commit 4c952348ad74b2ebf995bac9a8b69e4824250492
parent 5f9af110458aec2a9f41bf6d6b7574a3941f20ca
Author: anon <anon@example.com>
Date: Sat, 24 Oct 2026 06:39:27 +0000
Synchronize native stationary mouse rotation with observers
Diffstat:
7 files changed, 469 insertions(+), 13 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -562,15 +562,16 @@ disconnect retention and succession policy still need period corroboration.
## Travel
-- [ ] Synchronize rotation while a character stands still. Check: turning with
+- [x] Synchronize rotation while a character stands still. Check: turning with
keys or the mouse updates another native client promptly, without requiring
walking, a later packet or reconnect. Cover start/stop, final facing, late
observers, stale sessions and both direct and WebSocket transports. Captured
- CharMouseMoveIIR (`0x25327751`) messages already reach the world reader, but
- its dispatch currently ignores them; the WebSocket sender has a maximum frame
- size, not a minimum flush threshold. Recover this message's body/head pose
- semantics and validate its handler before blaming transport buffering. Keep
- routine facing changes in memory until the normal position checkpoint.
+ CharMouseMoveIIR (`0x25327751`) now shares compact pose decoding and movement
+ handling while preserving its distinct native relay. The defect was ignored
+ dispatch, not WebSocket buffering. Two hardware Chromium WASM clients agree
+ after stationary mouse turns, keyboard turns, held-W mouse turns, final
+ release and reconnect. Facing stays in memory until the normal position
+ checkpoint. Captured layouts, validation and evidence: [movement](docs/movement.md).
- [x] Enable one verified whom-pah route. Check: its trigger reaches the intended
destination and cannot immediately bounce the player back unintentionally.
- [x] Enter the Grid through one access point. Check: eligibility is enforced
@@ -768,6 +769,11 @@ current SQLite storage when applying these findings.
`ErrorEvent: unwind`, verify that native frames and world traffic resume,
and repeat edits and zoning without requiring a page reload. Shop testing
saw frozen frames with `ABORT` false; the cause is not yet established.
+ A subsequent hardware Chromium run completed eight live edits (cross-zone,
+ same-zone position, rapid side/zone changes, inventory assignment and an
+ ability edit while holding an item) with advancing native frames and no
+ captured errors. This does not establish a fix; retain the stack-capture
+ task. Evidence: `local/live-editor-smoke/verification.json`.
These checks are additional work, not claims that the existing feature tests
already establish complete gameplay correctness. Cover positive and negative
diff --git a/docs/movement.md b/docs/movement.md
@@ -0,0 +1,126 @@
+# Player movement and stationary facing
+
+The 14.9.1 client sends keyboard movement through CharDCMoveIIR_t
+(`0x54111123`) and right-button body rotation through CharMouseMoveIIR_t
+(`0x25327751`). Both update the authoritative in-memory pose and relay to
+other players in the playfield. Routine position and facing changes use the
+existing periodic position checkpoint, rather than writing SQLite per packet.
+
+Ignoring CharMouseMove caused stationary mouse turning to remain visible only
+to its owner. The packets already arrived at the world reader. The WebSocket
+transport has a maximum frame size and does not wait for a minimum byte count
+before sending a turn.
+
+## Recovered mouse-turn message
+
+All fields are big endian. The native IIR prefix is three uint32 fields
+(message key, subject type and subject ID), followed by a one-byte pass-on
+flag. The Go dispatcher expands that flag to uint32, so handler offsets below
+start after a 16-byte prefix; the native prefix occupies 13 bytes.
+
+| Handler offset | Size | Field |
+| --- | --- | --- |
+| 0 | 4 | Message key 0x25327751 |
+| 4 | 4 | Subject type 50000 |
+| 8 | 4 | Sending character ID |
+| 12 | 4 | Pass-on flag; incoming 1, observer relay 0 |
+| 16 | 1 | Action 20; high bit denotes a separate local-correction path |
+| 17 | 2 | X, unsigned, divided by 8 |
+| 19 | 2 | Y, signed, divided by 16 |
+| 21 | 2 | Z, unsigned, divided by 8 |
+| 23 | 8 | XYZW quaternion, four signed int16 values divided by 16384 |
+| 31 | 32 | Two groups of four float32 values |
+
+The reader normalizes the decoded quaternion. A normalized handler body is
+63 bytes; its native body is 60 bytes, or 76 including the outer packet
+header. The shared compact pose is 15 bytes. CharDCMove adds a two-byte rate;
+CharMouseMove instead adds the two four-float groups. These layouts must not
+be decoded interchangeably.
+
+The trailing groups are initialized to (0,0,0,1) each and copied from the
+rotation helper. The inspected client activation does not consume them.
+Their original server-side purpose is unknown: preserve their exact bytes
+and reject non-finite values, without assigning speculative speed or time
+meanings. No sequence number or timestamp occurs in this subclass.
+
+The native sender updates the local body immediately. Its ordinary network
+sampling uses a timer and angular-motion thresholds, rather than sending
+every rendered frame. Releasing the right button sends another action 20
+with the final pose; there is no separate mouse-turn-stop action. Camera-only
+rotation is distinct from changing the actor's body facing.
+
+## Server handling
+
+An accepted mouse turn must belong to the authenticated current session,
+with a ready, living player outside zone loading. Validate the exact body
+length, owned subject identity, pass-on 1, action 20 with no correction bit,
+nonzero quaternion and finite trailing floats. Malformed lengths fail the
+request; invalid state or fields produce no pose update or relay.
+
+The common movement handler applies the decoded pose, anchors the movement
+clock and retains held forward, strafe, turn and run controls. A changed
+position interrupts an admitted nano cast; rotation alone does not. Normal
+zone checks and persistence rules still apply. Observer relays keep the
+original opcode and trailing groups, clear pass-on, and exclude the owner.
+Late observers receive the accepted facing in the normal character snapshot.
+
+Internally, movement uses full-width action, XYZ and XYZW fields.
+`targetPacket` compacts that common portion and preserves the mouse-turn tail
+when producing 14.9.1 packets. This is an internal representation, not a claim
+about a different native client's wire format.
+
+## Source evidence
+
+Target: `anarchy-vanilla-14.9.1/kkr.dll`, SHA-256
+`a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0`.
+Addresses use its original image base 0x10000000.
+
+| Symbol or path | Address |
+| --- | --- |
+| CharMouseMove constructor / activation | 0x10047200 / 0x10047350 |
+| Mouse subclass reader / writer | 0x100473f0 / 0x10047460 |
+| Common compact pose reader / writer | 0x10043dc0 / 0x10044010 |
+| Common activation | 0x10043c50 |
+| Mouse movement sender / release sender | 0x10049f10 / 0x1004a540 |
+| Network sampling decision | 0x1004a950 |
+
+Retained research: `local/rotation-research/README.md`, `evidence.json`, and
+the native batch and writer-assembly exports. Principal REA evidence:
+`ev_07887b48bc8cfd3e54e4bac7ea7c45ecd9c3d338403ff202eee803de9cbe194d`
+and `ev_b7fca2382c4a0f424443dba477896a201d711b7d9bad3fc6d08c0d45b9cb05b8`.
+The native client establishes these layouts and receiver behavior; the
+session validation and checkpoint policy are this server's implementation.
+
+For a read-only runtime body-facing probe, QQR `Vehicle::GetBodyRot`
+(0x10011250) returns vehicle+0x7c, and LLR `n3Dynel::GetRelRot`
+(0x10017f60) obtains the vehicle from dynel+0x60. The reconstructed getters
+are in `client/game/qqr.dll/lifted-0006.c` and
+`client/game/llr.dll/lifted-0008.c`. This measures body XYZW independently
+of the camera.
+
+## Verification
+
+`server/mouse_movement_test.go` covers a captured native turn, observer framing
+and opaque-field preservation, signed coordinates and quaternion normalization,
+held input preservation, casting interruption, malformed and unauthorized
+requests, direct TCP and WebSocket dispatch, late observers, and checkpoint
+restoration. SQLite audit triggers verify no per-packet writes and one due
+position update.
+
+Two headed hardware Chromium clients reproduced a 56.4-degree stationary
+owner/observer disagreement before the fix. After the fix, the owner body
+quaternion (0,0.47255489,0,0.88130122) and observer quaternion
+(0,0.47254488,0,0.88130659) differ by approximately 0.0013 degrees, consistent
+with compact quaternion quantization. Stationary X/Z did not change. All
+three captured mouse packets, including release, reached the observer in
+the same recorded millisecond as their sends; this is a local capture, not
+a latency guarantee. No turn echo reached the owner.
+
+Keyboard turning, mouse turning with W held, final release, observer reload
+and owner reconnect also retained matching body facing. Read-only vehicle
+probes, screenshots, wire captures and the verifier are retained under
+`local/rotation-smoke/`. SQLite retained the accepted final pose before fixture
+cleanup; all other database rows were unchanged by cleanup. No WASM rebuild
+or adapter change was needed. The full Go server suite, focused movement/
+casting/checkpoint race checks, and vet with the existing stdversion exception
+passed.
diff --git a/server/main.go b/server/main.go
@@ -563,7 +563,7 @@ func (server *server) serveWorldClient(client *worldClient) error {
if err := server.handleCharacterReady(client); err != nil {
return err
}
- case 0x54111123:
+ case 0x54111123, 0x25327751:
if err := server.handleMovement(client, body); err != nil {
return err
}
diff --git a/server/mouse_movement_test.go b/server/mouse_movement_test.go
@@ -0,0 +1,284 @@
+package main
+
+import (
+ "bytes"
+ "context"
+ "crypto/sha256"
+ "encoding/binary"
+ "encoding/hex"
+ "fmt"
+ "math"
+ "net"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+ "time"
+
+ "github.com/coder/websocket"
+)
+
+func mouseMovementRequest() []byte {
+ // Captured native RMB-release pose, normalized to the handler's IIR prefix.
+ packet, _ := hex.DecodeString("253277510000c35000000001000000011401e000e001b000001e3e000038670000000000000000000000003f8000000000000000000000000000003f800000")
+ return packet
+}
+
+func TestMouseMovementRelaysFacingAndCheckpointsWithoutPerPacketWrites(t *testing.T) {
+ world := newCheckpointWorld(t)
+ player := world.characters[1]
+ player.position, player.rotation = [3]float32{60, 14, 54}, [4]float32{0, 0, 0, 1}
+ if err := world.savePosition_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ owner, observer := &combatTestConn{}, &combatTestConn{}
+ client := &worldClient{id: 1, target: true, ready: true, conn: owner}
+ world.clients[1] = client
+ world.characters[2] = &character{id: 2, playfield: 950, health: 100}
+ world.clients[2] = &worldClient{id: 2, target: true, ready: true, conn: observer}
+ now := time.Now()
+ player.nextPositionSave = now.Add(20 * time.Second)
+ auditCheckpointWrites(t, world)
+ request := mouseMovementRequest()
+
+ if err := world.handleMovement(client, request); err != nil {
+ t.Fatal(err)
+ }
+ if writes := checkpointWrites(t, world); len(writes) != 0 {
+ t.Fatalf("turn rewrote durable state: %v", writes)
+ }
+ if err := world.flushPositions(now.Add(20 * time.Second)); err != nil {
+ t.Fatal(err)
+ }
+ restored := newTestInventoryServer(t).characters[1]
+
+ if len(owner.packets) != 0 || len(observer.packets) != 1 {
+ t.Fatalf("turn replies owner=%d observer=%d", len(owner.packets), len(observer.packets))
+ }
+ packet := observer.packets[0]
+ if binary.BigEndian.Uint32(packet[16:20]) != 0x25327751 || packet[28] != 0 || packet[29] != 20 || !bytes.Equal(packet[44:76], request[31:63]) {
+ t.Fatalf("native rotation relay lost its fields: %x", packet)
+ }
+ if math.Abs(float64(player.rotation[1]-0.47255)) > 0.0001 || math.Abs(float64(player.rotation[3]-0.8813)) > 0.0001 || player.position != [3]float32{60, 14, 54} {
+ t.Fatalf("unexpected rotation pose: %v %v", player.position, player.rotation)
+ }
+ if restored.rotation != player.rotation || restored.position != player.position {
+ t.Fatal("checkpoint lost accepted facing")
+ }
+ if writes := checkpointWrites(t, world); len(writes) != 1 || writes["characters/UPDATE"] != 1 {
+ t.Fatalf("turn checkpoint wrote %v", writes)
+ }
+}
+
+func TestMouseMovementRejectsInvalidInputWithoutChangingPose(t *testing.T) {
+ for _, scenario := range []string{"short", "long", "foreign owner", "wrong type", "wrong pass-on", "wrong action", "correction", "zero rotation", "NaN extra", "infinite extra", "replaced", "loading", "unready", "dead", "unsupported client"} {
+ t.Run(scenario, func(t *testing.T) {
+ world, output := newCombatWorld()
+ player, client := world.characters[1], world.clients[1]
+ player.position, player.rotation = [3]float32{60, 14, 54}, [4]float32{0, 0, 0, 1}
+ request := mouseMovementRequest()
+ malformed := false
+ switch scenario {
+ case "short":
+ request = request[:62]
+ malformed = true
+ case "long":
+ request = append(request, 0)
+ malformed = true
+ case "foreign owner":
+ binary.BigEndian.PutUint32(request[8:12], 2)
+ case "wrong type":
+ binary.BigEndian.PutUint32(request[4:8], 51035)
+ case "wrong pass-on":
+ binary.BigEndian.PutUint32(request[12:16], 0)
+ case "wrong action":
+ request[16] = 9
+ case "correction":
+ request[16] |= 0x80
+ case "zero rotation":
+ clear(request[23:31])
+ case "NaN extra":
+ binary.BigEndian.PutUint32(request[31:35], 0x7fc00000)
+ case "infinite extra":
+ binary.BigEndian.PutUint32(request[59:63], 0xff800000)
+ case "replaced":
+ world.clients[1] = &worldClient{id: 1}
+ case "loading":
+ client.loading = true
+ case "unready":
+ client.ready = false
+ case "dead":
+ player.health = 0
+ case "unsupported client":
+ client.target = false
+ }
+
+ err := world.handleMovement(client, request)
+
+ if (err != nil) != malformed || player.position != [3]float32{60, 14, 54} || player.rotation != [4]float32{0, 0, 0, 1} || len(output.packets) != 0 || !client.movementStarted.IsZero() {
+ t.Fatalf("invalid turn changed state: error=%v pose=%v/%v", err, player.position, player.rotation)
+ }
+ })
+ }
+}
+
+func TestMouseMovementKeepsHeldTranslationAndNormalizesSignedPose(t *testing.T) {
+ world, _ := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ client.forward, client.strafing, client.turning = 1, true, true
+ player.running = true
+ request := mouseMovementRequest()
+ binary.BigEndian.PutUint16(request[19:21], 0xff38) // Y=-12.5.
+ binary.BigEndian.PutUint16(request[25:27], 0xc000) // Quaternion Y=-1.
+ binary.BigEndian.PutUint16(request[29:31], 0x4000) // Quaternion W=1.
+
+ if err := world.handleMovement(client, request); err != nil {
+ t.Fatal(err)
+ }
+
+ if player.position != [3]float32{60, -12.5, 54} || math.Abs(float64(player.rotation[1]+0.70710677)) > 0.000001 || math.Abs(float64(player.rotation[3]-0.70710677)) > 0.000001 {
+ t.Fatalf("signed pose decoding: %v/%v", player.position, player.rotation)
+ }
+ if client.forward != 1 || !client.strafing || !client.turning || !player.running || client.movementStarted.IsZero() {
+ t.Fatal("mouse turn changed held movement controls")
+ }
+}
+
+func TestMouseMovementOnlyTranslationInterruptsAnAdmittedNano(t *testing.T) {
+ for _, translated := range []bool{false, true} {
+ t.Run(fmt.Sprint(translated), func(t *testing.T) {
+ world, _ := newNanoCastingWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.position = [3]float32{60, 14, 54}
+ world.characters[1000000].position = [3]float32{61, 14, 54}
+ if err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, 50000, 1000000, 53019, 29618})[20:]); err != nil {
+ t.Fatal(err)
+ }
+ if client.nanoCast == nil {
+ t.Fatal("cast was not admitted")
+ }
+ deadline := client.nanoCast.readyAt
+ request := mouseMovementRequest()
+ if translated {
+ binary.BigEndian.PutUint16(request[17:19], 488) // X=61.
+ }
+
+ if err := world.handleMovement(client, request); err != nil {
+ t.Fatal(err)
+ }
+ world.advanceNanos(deadline.Add(time.Nanosecond))
+
+ if translated {
+ if world.characters[1000000].health != 100 || player.nano != 30 {
+ t.Fatal("translation retained a pending cast")
+ }
+ } else if world.characters[1000000].health >= 100 || player.nano != 21 {
+ t.Fatal("rotation interrupted the admitted cast")
+ }
+ })
+ }
+}
+
+func TestMouseMovementNativeTransportAndLateObserver(t *testing.T) {
+ for _, transport := range []string{"direct", "WebSocket"} {
+ t.Run(transport, func(t *testing.T) {
+ world := newCheckpointWorld(t)
+ var connection net.Conn
+ if transport == "direct" {
+ client, peer := net.Pipe()
+ connection = client
+ go func() { defer peer.Close(); world.serveWorldConnection(peer) }()
+ } else {
+ world.characters[1].browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte("turn-token")))
+ host := httptest.NewServer(http.HandlerFunc(world.browserWorld))
+ defer host.Close()
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+ socket, _, err := websocket.Dial(ctx, host.URL, &websocket.DialOptions{HTTPHeader: http.Header{"Cookie": {"ao_client=turn-token"}}})
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer socket.CloseNow()
+ connection = websocket.NetConn(ctx, socket, websocket.MessageBinary)
+ }
+ defer connection.Close()
+ connection.SetDeadline(time.Now().Add(5 * time.Second))
+ cookie, _ := hex.DecodeString("dfdf00010001002000000001000000020000001b000000010000000000000000")
+ connection.Write(cookie)
+ for {
+ packet, err := readPacket(connection)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if binary.BigEndian.Uint32(packet[16:20]) == 0x5f52412e {
+ break
+ }
+ }
+ connection.Write(targetPacket(n3Packet(0x570c2039, 50000, 1, nil)))
+ if _, err := readPacket(connection); err != nil {
+ t.Fatal(err)
+ }
+ observer := &combatTestConn{}
+ observerClient := &worldClient{id: 2, conn: observer, target: true, ready: true}
+ world.mutex.Lock()
+ other := world.newCharacter_locked()
+ other.playfield = 950
+ world.clients[2] = observerClient
+ world.mutex.Unlock()
+ captured, _ := hex.DecodeString("dfdf000a0001004c0000000100000002253277510000c35000000001011401e000e001b000001e3e000038670000000000000000000000003f8000000000000000000000000000003f800000")
+
+ if _, err := connection.Write(captured); err != nil {
+ t.Fatal(err)
+ }
+ ping := systemPacket(1, nil)
+ binary.BigEndian.PutUint16(ping[2:4], 11)
+ connection.Write(ping)
+ reply, err := readPacket(connection)
+ if err != nil {
+ t.Fatal(err)
+ }
+ world.mutex.Lock()
+ latePlayer := world.newCharacter_locked()
+ latePlayer.playfield = 950
+ expected := world.characters[1].rotation
+ world.mutex.Unlock()
+ late, peer := net.Pipe()
+ defer late.Close()
+ late.SetDeadline(time.Now().Add(5 * time.Second))
+ go func() { defer peer.Close(); world.serveWorldConnection(peer) }()
+ binary.BigEndian.PutUint32(cookie[20:24], 3)
+ late.Write(cookie)
+ var snapshot []byte
+ for {
+ packet, err := readPacket(late)
+ if err != nil {
+ t.Fatal(err)
+ }
+ key := binary.BigEndian.Uint32(packet[16:20])
+ if key == 0x271b3a6b && binary.BigEndian.Uint32(packet[24:28]) == 1 {
+ snapshot = packet
+ }
+ if key == 0x5f52412e {
+ break
+ }
+ }
+
+ if binary.BigEndian.Uint16(reply[2:4]) != 11 {
+ t.Fatalf("owner received a pose echo instead of its ping: %x", reply)
+ }
+ observerClient.mutex.Lock()
+ received := len(observer.packets) != 0 && binary.BigEndian.Uint32(observer.packets[0][16:20]) == 0x25327751
+ observerClient.mutex.Unlock()
+ if !received {
+ t.Fatal("observer did not receive the native mouse turn")
+ }
+ if len(snapshot) < 60 {
+ t.Fatal("late observer did not receive the turning actor")
+ }
+ for index, value := range expected {
+ if math.Float32frombits(binary.BigEndian.Uint32(snapshot[44+index*4:])) != value {
+ t.Fatal("late observer lost accepted facing")
+ }
+ }
+ })
+ }
+}
diff --git a/server/movement_1491.go b/server/movement_1491.go
@@ -6,6 +6,12 @@ import (
)
func decodeMovement1491(body []byte) []byte {
+ result := decodeMovementBase1491(body)
+ result = binary.BigEndian.AppendUint32(result, math.Float32bits(float32(int16(binary.BigEndian.Uint16(body[15:17])))/2048))
+ return binary.BigEndian.AppendUint32(result, 0)
+}
+
+func decodeMovementBase1491(body []byte) []byte {
// kkr.dll 0x10043dc0: compact position and normalized signed quaternion.
result := binary.BigEndian.AppendUint32(nil, uint32(body[0]&127))
position := [3]float32{
@@ -25,12 +31,17 @@ func decodeMovement1491(body []byte) []byte {
for _, value := range rotation {
result = binary.BigEndian.AppendUint32(result, math.Float32bits(value/float32(math.Sqrt(squaredLength))))
}
- result = binary.BigEndian.AppendUint32(result, math.Float32bits(float32(int16(binary.BigEndian.Uint16(body[15:17])))/2048))
- return binary.BigEndian.AppendUint32(result, 0)
+ return result
}
func encodeMovement1491(body []byte) []byte {
// Generated NPC movement uses the shared full-width representation.
+ result := encodeMovementBase1491(body)
+ value := math.Float32frombits(binary.BigEndian.Uint32(body[32:36]))
+ return binary.BigEndian.AppendUint16(result, uint16(int16(value*2048)))
+}
+
+func encodeMovementBase1491(body []byte) []byte {
result := []byte{byte(binary.BigEndian.Uint32(body[:4]))}
for i, scale := range [3]float32{8, 16, 8} {
value := math.Float32frombits(binary.BigEndian.Uint32(body[4+i*4:]))
@@ -40,6 +51,5 @@ func encodeMovement1491(body []byte) []byte {
value := math.Float32frombits(binary.BigEndian.Uint32(body[16+i*4:]))
result = binary.BigEndian.AppendUint16(result, uint16(int16(value*16384)))
}
- value := math.Float32frombits(binary.BigEndian.Uint32(body[32:36]))
- return binary.BigEndian.AppendUint16(result, uint16(int16(value*2048)))
+ return result
}
diff --git a/server/target_protocol.go b/server/target_protocol.go
@@ -140,6 +140,10 @@ func targetPacket(packet []byte) []byte {
}
case 0x54111123:
packet = append(packet[:36:36], encodeMovement1491(packet[36:])...)
+ case 0x25327751:
+ body := packet[36:]
+ packet = append(packet[:36:36], encodeMovementBase1491(body)...)
+ packet = append(packet, body[32:]...)
case 0x5f52412e:
packet = binary.BigEndian.AppendUint32(packet, uint32(time.Now().Unix()))
case 0x43197d22:
diff --git a/server/world_actions.go b/server/world_actions.go
@@ -65,7 +65,33 @@ func (server *server) handleCharacterReady(client *worldClient) error {
func (server *server) handleMovement(client *worldClient, body []byte) error {
server.updateMutex.Lock()
defer server.updateMutex.Unlock()
- if client.target {
+ if len(body) < 16 {
+ return fmt.Errorf("short character movement message")
+ }
+ key := uint32(0x54111123)
+ if binary.BigEndian.Uint32(body) == 0x25327751 {
+ if !client.target {
+ return nil
+ }
+ if len(body) != 63 {
+ return fmt.Errorf("invalid mouse movement length")
+ }
+ if binary.BigEndian.Uint32(body[4:8]) != 50000 || binary.BigEndian.Uint32(body[8:12]) != client.id ||
+ binary.BigEndian.Uint32(body[12:16]) != 1 || body[16] != 20 || binary.BigEndian.Uint64(body[23:31]) == 0 {
+ return nil
+ }
+ // CharMouseMove inherits the compact pose and adds eight opaque floats.
+ for offset := 31; offset < 63; offset += 4 {
+ value := float64(math.Float32frombits(binary.BigEndian.Uint32(body[offset:])))
+ if math.IsNaN(value) || math.IsInf(value, 0) {
+ return nil
+ }
+ }
+ extra := body[31:]
+ body = append(body[:16:16], decodeMovementBase1491(body[16:31])...)
+ body = append(body, extra...)
+ key = 0x25327751
+ } else if client.target {
if len(body) < 33 {
return fmt.Errorf("short 14.9.1 movement message")
}
@@ -128,6 +154,6 @@ func (server *server) handleMovement(client *worldClient, body []byte) error {
}
server.mutex.Unlock()
server.sendCombatUpdates(updates)
- server.broadcast(playfield, client.id, n3Packet(0x54111123, 50000, client.id, body[16:]))
+ server.broadcast(playfield, client.id, n3Packet(key, 50000, client.id, body[16:]))
return nil
}