1888 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
60 lines
4.9 KiB
Python
60 lines
4.9 KiB
Python
"""Stage the existing permanent swim/school policies using the shared writer."""
|
|
from pathlib import Path
|
|
import hashlib,json,sys
|
|
ROOT=Path(__file__).resolve().parents[4];sys.path.insert(0,str(ROOT/'ops'))
|
|
import spell_item_static_compat as convert
|
|
from turtle_data import DBC
|
|
from spell_passive_compat import TABLES,SUPPLEMENTAL_TABLES,fields,db2_header,BUILD
|
|
from spell_definition_common import NEW_DEFINITION_CHILD_TABLES
|
|
from item_sparse_compat import package_pages
|
|
from content_package_stage import compose_definition_candidates
|
|
work=ROOT/'runtime/item-missing-static-20261020'
|
|
load=lambda p:json.loads(Path(p).read_text())
|
|
digest=lambda p:hashlib.sha256(Path(p).read_bytes()).hexdigest()
|
|
pins={}
|
|
def pinned(p):
|
|
p=Path(p);pins[str(p)]=digest(p);return load(p)
|
|
classification=pinned(ROOT/'runtime/item-missing-definitions-20261020/classification.json')
|
|
selected=[r for r in classification['spells']if r.get('source_policy')in('school-damage','swim-speed')];assert len(selected)==2
|
|
native={t:pinned(work/'native'/(t+'.json'))for t in convert.REQUIRED_REFERENCE_TABLES}
|
|
old=ROOT/'runtime/octo-praxis-import-20261017/armor-components'
|
|
for t in('SpellCastTimes','SpellDuration','SpellRange'):native[t]=pinned(old/('skill-context-'+t+'.json'))
|
|
server=Path('/home/praxis/Servers/tortoise-docker/data/dbc')
|
|
source_tables={t:DBC(server/(t+'.dbc'),width)for t,width in dict(SpellIcon=2,SpellCastTimes=4,SpellDuration=4,SpellRange=22).items()}
|
|
for t in source_tables:pins[str(server/(t+'.dbc'))]=digest(server/(t+'.dbc'))
|
|
octo_icons=DBC(ROOT/'runtime/octo-installed-data/patch-O.mpq/SpellIcon.dbc',2);pins[str(octo_icons.path)]=digest(octo_icons.path)
|
|
for row in selected:
|
|
s=row['validated_source'];assert s['spellIconId']==1
|
|
a=source_tables['SpellIcon'];assert a.string(a.by_id[1][1])==octo_icons.string(octo_icons.by_id[1][1])
|
|
dbd=ROOT.parent/'tools/WoWDBDefs/definitions';target=ROOT.parent/'servers/trinity-forever/install/bin/dbc/enUS'
|
|
tables={t:(TABLES|SUPPLEMENTAL_TABLES)[t]for t in('Spell','SpellName',*NEW_DEFINITION_CHILD_TABLES)}
|
|
schemas={t:fields(dbd/(t+'.dbd'),t)for t in tables}
|
|
package=pinned(work/'baseline-package.json');assert len(package['rows'])==40170
|
|
maxima={};metadata={}
|
|
for t,(table,layout,field_sha)in tables.items():
|
|
maximum=db2_header(target/(t+'.db2'),table,layout);maxima[t]=max([maximum]+[r['id']for r in package['rows']if r['table_name']==t])
|
|
metadata[t]=dict(table_hash=hex(table),layout_hash=hex(layout),serialized_field_sha256=field_sha,native_max_id=maximum,allocation_bound=maxima[t],db2_sha256=digest(target/(t+'.db2')),dbd_sha256=digest(dbd/(t+'.dbd')))
|
|
asset=old/'skill-assets/interface/icons/temp.blp';raw=asset.read_bytes();pins[str(asset)]=digest(asset)
|
|
assets=[dict(path='interface/icons/temp.blp',bytes=len(raw),sha256=digest(asset),magic_hex=raw[:4].hex())]
|
|
listfile=ROOT.parent/'listfiles/community-listfile.csv';pins[str(listfile)]=digest(listfile)
|
|
names={136235:[line.strip().split(';',1)[1]for line in listfile.open()if line.startswith('136235;')]}
|
|
before=pinned(ROOT/'runtime/item-missing-definitions-20261020/original-after-all19.json')
|
|
assert before['world_readiness_confirmed']and not before['external_gateway_running']and before['local_only']
|
|
components=[]
|
|
for row in sorted(selected,key=lambda r:r['source_policy']):
|
|
s=row['validated_source'];opts=dict(school_damage=True)if row['source_policy']=='school-damage'else dict(percent_stat='swim-speed')
|
|
component=convert.new_static_component([s],native,schemas,maxima,dict(schema_version=1,build=BUILD,SpellEffect={}),source_tables=source_tables,target_icon_names=names,new_icon_ids={str(s['entry']):136235},icon_assets=assets,read_icon=lambda p:raw if p=='interface/icons/temp.blp'else b'',**opts)
|
|
component.update(native_tables={t:dict(m,allocation_bound=maxima[t])for t,m in metadata.items()},input_sha256=pins.copy())
|
|
components.append(component)
|
|
for r in component['records']:
|
|
if r['table_name']not in('Spell','SpellName'):maxima[r['table_name']]=max(maxima[r['table_name']],r['id'])
|
|
used_schemas={t:schemas[t]for t in{r['table_name']for c in components for r in c['records']}}
|
|
staged=compose_definition_candidates(package,components,used_schemas,before['spells']);assert staged['added_count']==11
|
|
result=dict(package,rows=staged['rows'],push_id=staged['push_id'],pushes=package_pages(staged['rows']))
|
|
extension=dict(package.get('definition_extension',{}));extension['source_spell_ids']=sorted(set(extension.get('source_spell_ids',[]))|set(staged['source_spell_ids']));result['definition_extension']=extension
|
|
assert len(result['rows'])==40181
|
|
for p,h in pins.items():assert digest(p)==h,p
|
|
for name,value in [('static-components.json',components),('static-package.json',result),('static-composition.json',{k:v for k,v in staged.items()if k not in('rows','header')})]:
|
|
(work/name).write_text(json.dumps(value,sort_keys=True,**(dict(separators=(',',':'))if name=='static-package.json'else dict(indent=2)))+'\n')
|
|
print('Staged2source permanent aura definitions/11rows;40181total. Source swim level20 retained. NOT installed or gameplay verified.')
|