Update GaCy-GO
This commit is contained in:
1 parent
da8a32f60d
commit
0cbe460e49
345 files changed
+98202
-77559
No files matched your search
@@ -0,0 +1,31 @@
|
||||
"""Export labelled reference penalty rules; never imports a saved run."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
p = argparse.ArgumentParser(description=__doc__)
|
||||
p.add_argument('--excel', type=Path, required=True)
|
||||
p.add_argument('--catalog', type=Path, required=True)
|
||||
p.add_argument('--binary-sha256', required=True)
|
||||
p.add_argument('--output', type=Path, required=True)
|
||||
a = p.parse_args()
|
||||
if len(bytes.fromhex(a.binary_sha256)) != 32:
|
||||
raise ValueError('Expected SHA256')
|
||||
raw = a.excel.read_bytes()
|
||||
c = json.loads(a.catalog.read_bytes())
|
||||
fields = ('ID', 'ThresholdPosition', 'ThresholdFailPlayerHPPenalty',
|
||||
'ThresholdPassBasicPlayerHPPenalty', 'ProgressPenaltyCoefficient')
|
||||
rows = [{k: int(r.get(k, 0)) for k in fields}
|
||||
for r in json.loads(raw)['grid_fight_penalty_rule']]
|
||||
a.output.write_text(json.dumps({
|
||||
'format_version': 1,
|
||||
'target_client_version': c['client_version'],
|
||||
'target_assembly_sha256': c['provenance']['game_assembly_sha256'],
|
||||
'source_kind': 'reference-implementation; captured current rules take precedence',
|
||||
'reference_executable_sha256': a.binary_sha256,
|
||||
'excel_dump_sha256': hashlib.sha256(raw).hexdigest(),
|
||||
'source_table': 'grid_fight_penalty_rule',
|
||||
'penalty_rules': rows,
|
||||
}, indent=2) + '\n', encoding='utf8')
|
||||
print(f'Exported {len(rows)} reference penalties')
|
||||
Reference in new issue
Block a user