pre cw with probe and a bunch script to read game behavior
This commit is contained in:
1 parent
5120219ae2
commit
da8a32f60d
310 files changed
+219693
-872
No files matched your search
@@ -0,0 +1,42 @@
|
||||
"""Export completed, bounded Client handbook equipment capture without floats."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--capture', type=Path, required=True)
|
||||
parser.add_argument('--catalog', type=Path, required=True)
|
||||
parser.add_argument('--output', type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
raw = args.capture.read_bytes()
|
||||
lines = raw.decode('utf-8-sig').splitlines()
|
||||
if not any(line == '[GAC_CW_EQUIPMENT] END' for line in lines) or any(' ERROR ' in line for line in lines):
|
||||
raise ValueError('equipment capture did not complete successfully')
|
||||
rows = [json.loads(line.split(' ROW ', 1)[1]) for line in lines if ' ROW ' in line]
|
||||
ids = set()
|
||||
for row in rows:
|
||||
identity = row['ItemID']
|
||||
if not identity or identity in ids:
|
||||
raise ValueError('missing/duplicate equipment identity')
|
||||
ids.add(identity)
|
||||
for prop in row['GeneralPropertyList']:
|
||||
if not prop['PropertyType'] or not isinstance(prop['Value'], str):
|
||||
raise ValueError('native property value was not retained as text')
|
||||
if not rows:
|
||||
raise ValueError('equipment capture is empty')
|
||||
c = json.loads(args.catalog.read_text(encoding='utf-8-sig'))
|
||||
result = dict(format_version=1, target_client_version=c['client_version'],
|
||||
target_assembly_sha256=c['provenance']['game_assembly_sha256'],
|
||||
source_capture_sha256=hashlib.sha256(raw).hexdigest(),
|
||||
scope='Initialized equipment handbook entries; consumables and hidden entries are excluded. '
|
||||
'Read-only native getters, four entries per heartbeat, paused during Battle.',
|
||||
entries=sorted(rows, key=lambda row: row['ItemID']))
|
||||
args.output.write_text(json.dumps(result, indent=2) + '\n', encoding='utf-8')
|
||||
print(f'Exported {len(rows)} current equipment definitions')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user