Files
WoW-Hybrid-gateway/ops/quest_poi_dataset_header.py

32 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Embed the reviewed QPOI dataset for the native gateway build (no live I/O)."""
import argparse
import hashlib
from pathlib import Path
# reviewed datasets: W16 Blizzard Classic areas; 2026-11-27 areas rebuilt from tw_world spawns
# (ops/quest_poi_from_spawns.py, owner: hand-drawn areas cover places where nothing spawns)
PINS = {"77d756e15323a9e3014ce7ad2e4015f59cb3c698d86ee39cd4c1bc7acad09e94": "W16 terrain",
"7ff66cf874d3694b38b0e0c019e01c874127743f7e436f04711e8f28b1355152": "server spawns 2026-11-27"}
def main():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("dataset", type=Path)
p.add_argument("output", type=Path)
a = p.parse_args()
data = a.dataset.read_bytes()
PIN = hashlib.sha256(data).hexdigest()
if PIN not in PINS:
raise SystemExit("dataset hash differs from the reviewed datasets")
a.output.parent.mkdir(parents=True, exist_ok=True)
with a.output.open("w") as f:
f.write('// Generated by ops/quest_poi_dataset_header.py; SHA256 ' + PIN + '\n#pragma once\n')
f.write('inline constexpr unsigned char quest_poi_dataset_bytes[]={\n')
for i in range(0, len(data), 32):
f.write(','.join(str(x) for x in data[i:i+32]) + ',\n')
f.write('};\n')
print(f"Embedded {len(data)} reviewed quest POI bytes")
if __name__ == "__main__":
main()