Files
WoW-Hybrid-gateway/ops/companion_summon_profile.py
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

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

25 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Pin Source effect97 MINI_PET relationships from an already-cached Spell DBC."""
import argparse,hashlib,json
from pathlib import Path
from turtle_data import DBC,spell_layout
def generate(source):
dbc=DBC(source,173);o=spell_layout()
rows=sorted({(r[0],r[o['EffectMiscValue']+i]) for r in dbc.rows for i in range(3)
if r[o['Effect']+i]==97 and 0<r[o['EffectMiscValue']+i]<=0x7fffff})
return {'source_sha256':hashlib.sha256(source.read_bytes()).hexdigest(),'source_fields':dbc.fields,
'contract':'Source Spell::EffectSummonCritter97 -> Pet(MINI_PET), actual template entry in EffectMiscValue',
'relations':[{'spell':s,'entry':e} for s,e in rows]}
def header(profile):
rows=profile['relations']
return ('// Generated by ops/companion_summon_profile.py from pinned Source Spell DBC.\n#pragma once\n#include <array>\n#include <cstdint>\nnamespace gateway::companion_profile {\n'
+'inline constexpr char SourceSHA256[]="'+profile['source_sha256']+'";\n'
+'struct Relation {uint32_t spell,entry;};\ninline constexpr std::array<Relation,'+str(len(rows))+'> Relations{{\n'
+''.join(' {'+str(r['spell'])+','+str(r['entry'])+'},\n' for r in rows)
+'}};\n}\n')
if __name__=='__main__':
p=argparse.ArgumentParser(description=__doc__);p.add_argument('--source',type=Path,required=True);p.add_argument('--profile',type=Path,required=True);p.add_argument('--header',type=Path,required=True);a=p.parse_args()
result=generate(a.source);a.profile.write_text(json.dumps(result,indent=2)+'\n');a.header.write_text(header(result))