1888 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
66 lines
5.0 KiB
Python
66 lines
5.0 KiB
Python
"""Drive the existing skill converter with the complete eligible source cohort."""
|
|
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 item_sparse_compat import package_pages
|
|
from content_package_stage import compose_definition_candidates
|
|
|
|
work=ROOT/'runtime/item-missing-definitions-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(work/'classification.json')
|
|
eligible=[r['validated_source']for r in classification['spells']if r.get('source_policy')=='skill-bonus']
|
|
selected=[s for s in eligible if s['spellIconId']==1]
|
|
deferred=[dict(spell_id=s['entry'],reason='Exact source icon756/native132938 asset bytes not yet verified; no substitute icon used.')for s in eligible if s['spellIconId']!=1]
|
|
assert len(selected)==15 and len(deferred)==1
|
|
native={t:pinned(work/'native'/(t+'.json'))for t in convert.REQUIRED_REFERENCE_TABLES}
|
|
native['SkillLine']=pinned(work/'native/SkillLine.json')
|
|
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(SkillLine=22,SpellIcon=2,SpellCastTimes=4,SpellDuration=4,SpellRange=22).items()}
|
|
for t in source_tables:pins[str(server/(t+'.dbc'))]=digest(server/(t+'.dbc'))
|
|
octo_skills=DBC(ROOT/'runtime/octo-installed-data/patch-5.mpq/SkillLine.dbc',22)
|
|
octo_icons=DBC(ROOT/'runtime/octo-installed-data/patch-O.mpq/SpellIcon.dbc',2)
|
|
for p in(octo_skills.path,octo_icons.path):pins[str(p)]=digest(p)
|
|
for s in selected:
|
|
for e in s['effects']:
|
|
if not e[0]:continue
|
|
a=source_tables['SkillLine'].by_id[e[7]];b=octo_skills.by_id[e[7]]
|
|
assert a[:2]==b[:2] and source_tables['SkillLine'].string(a[3])==octo_skills.string(b[3])
|
|
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=TABLES|{'SpellClassOptions':SUPPLEMENTAL_TABLES['SpellClassOptions']}
|
|
schemas={t:fields(dbd/(t+'.dbd'),t)for t in tables}
|
|
package=pinned(ROOT/'runtime/item-constant-division-20261020/candidate/package.json')
|
|
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;')]}
|
|
component=convert.new_skill_component(selected,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 for s in selected},icon_assets=assets,read_icon=lambda p:raw if p=='interface/icons/temp.blp'else b'')
|
|
component.update(native_tables=metadata,input_sha256=pins,deferred_source_records=deferred,source_manifest_sha256=classification['source_manifest_sha256'])
|
|
before=pinned(work/'original-before-all18.json')
|
|
assert before['all_unavailable'] and before['world_readiness_confirmed'] and not before['external_gateway_running']
|
|
used_schemas={t:schemas[t]for t in {r['table_name']for r in component['records']}}
|
|
staged=compose_definition_candidates(package,[component],used_schemas,before['spells'])
|
|
assert staged['added_count']==75
|
|
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'])==40170
|
|
for p,h in pins.items():assert digest(p)==h,p
|
|
for name,value in [('skill-component.json',component),('skill-package.json',result),('skill-composition.json',{k:v for k,v in staged.items()if k not in('rows','header')})]:
|
|
(work/name).write_text(json.dumps(value,indent=2,sort_keys=True)+'\n')
|
|
print('Staged15complete source skill-spell definitions/75rows +1retained interval row;40170total. One exact icon asset deferred. Not installed or gameplay verified.')
|