Files
WoW-Hybrid-gateway/tests/slash_command_wire_admission_test.py

12 lines
845 B
Python

"""#150: client opcodes sent by native slash commands that the gateway translates must pass the Wire gameplay admission
(native/wine_pipe_host.c); otherwise they are dropped as GW_WIRE client-drop before any translator runs."""
import re
from pathlib import Path
SLASH = {0x3e018a: '/pvp', 0x2f0009: '/gdisband', 0x2f0006: 'guild delete rank', 0x2f0019: 'guild bank log'}
host = (Path(__file__).resolve().parents[1] / 'native/wine_pipe_host.c').read_text()
expr = ' '.join(re.findall(r'if\(([^{}]+)\)\{\s*init\(&c,GW_WIRE_GAMEPLAY\)', host))
admitted = {int(v, 16) for v in re.findall(r'opcode\s*==\s*(0x[0-9a-f]+)', expr)}
missing = [f'{o:06x} {n}' for o, n in SLASH.items() if o not in admitted]
assert not missing, f'slash command opcodes not admitted by the Wire: {missing}'
print(f'slash command wire admission PASS: {len(SLASH)} opcodes')