Files
WoW-Hybrid-gateway/tests/unit_emote_serializer_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

35 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Independent original70334 UnitData EmoteState bit85 goldens; offline only."""
import os
import struct
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from native_codec_driver import ROOT, load, serialize, MODES
if not Path(os.environ.get('GW_TEST_CODEC_PATH', ROOT/'build/forever-schema/libforever_codec.so')).is_file():
sys.exit(77)
P = struct.pack
library = load()
def packed(raw):
return P('<' + ('H' if len(raw) == 16 else 'B'),
sum(1 << i for i, b in enumerate(raw) if b)) + bytes(b for b in raw if b)
for owner in (4518, (0xf130 << 48) | (3310 << 24) | 1):
modern = P('<QQ', owner if owner < 2**32 else owner & 0xffffff,
(2 << 58) | (70 << 42) if owner < 2**32
else (8 << 58) | (70 << 42) | (1 << 29) | (3310 << 6))
for state in (0, 10, 13):
# Source UNIT_NPC_EMOTESTATE148 -> target group64/bit85.
# Original ClassicUnitDataBit70009 maps native bit84 to Classic85.
values = bytes([int(owner == 4518), 0, 3]) + P('<I', 32)
values += bytes.fromhex('040020000100') + P('<I', state)
block = b'\0' + packed(modern) + P('<I', len(values)) + values
expected = P('<HIBI', 1, 1, 128, len(block)) + block
body = P('<IBB', 1, 0, 0) + packed(P('<Q', owner)) + bytes([5])
body += P('<5I', 0, 0, 0, 0, 1 << 20) + P('<I', state)
actual = serialize(library, MODES.index('--unit-values'), P('<HIQI', 70, 1, 4518, 0xa9) + body)
assert actual == expected, ('Emote state/explicit clear/visibility mask differs', actual.hex(), expected.hex())
print('6 independent self/NPC persistent emote and explicit-clear goldens pass; no live animation claim.')