1888 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
38 lines
3.9 KiB
Python
38 lines
3.9 KiB
Python
import hashlib,json,sys
|
|
from pathlib import Path
|
|
sys.path.insert(0,str(Path.cwd()/'ops'))
|
|
from turtle_data import inventory_item_snapshot
|
|
from item_icon_preflight import observed_item_display
|
|
from item_batch_stage import BASIC_INPUTS
|
|
from item_appearance_preflight import TARGET_TABLES,native_equipment_variant_candidates,missing_weapon_links,compose_weapon_links
|
|
root=Path.cwd();out=root/'runtime/item-appearance-rebase-20261021/armor-batch';out.mkdir(exist_ok=True)
|
|
source=inventory_item_snapshot(root/'runtime/all-item-templates-20261017')
|
|
exports=root/'runtime/item-appearance-target-70334-20261017'
|
|
manifest=json.loads((exports/'manifest.json').read_text())
|
|
target={}
|
|
for name in TARGET_TABLES:
|
|
p=exports/(name+'.json');raw=p.read_bytes()
|
|
if hashlib.sha256(raw).hexdigest()!=manifest['tables'][name]['export']['sha256']:raise ValueError('target export drift: '+name)
|
|
target[name]=json.loads(raw)
|
|
package=json.loads((root/'runtime/item-appearance-rebase-20261021/resource-package.json').read_text());published={(r['table_name'],r['id'])for r in package['rows']}
|
|
linked={r['ItemID']for r in target['ItemModifiedAppearance']}|{r['record']['ItemID']for r in package['rows']if r['table_name']=='ItemModifiedAppearance'}
|
|
selected={r['raw_fields']['entry']for r in source['records']if r['raw_fields']['class']==4 and r['raw_fields']['inventory_type']in(1,3,4,5,6,7,8,9,10,14,19,20) and('Item',r['raw_fields']['entry'])in published and('ItemSparse',r['raw_fields']['entry'])in published and r['raw_fields']['entry']not in linked}
|
|
# Names are only needed for shoulder geometry families. Material identities
|
|
# must still resolve exactly; a geometry match cannot stand in for a recolor.
|
|
wanted={r['FileDataID']for r in target['ModelFileData']}|{r['FileDataID']for r in target['TextureFileData']}
|
|
# The public local listfile is read once; no asset or client modification.
|
|
with (root.parent/'listfiles/community-listfile.csv').open('rb')as f:
|
|
names={};digest=hashlib.sha256()
|
|
for raw in f:
|
|
digest.update(raw);ident,sep,path=raw.rstrip(b'\r\n').partition(b';')
|
|
if sep and ident.isdigit()and int(ident)in wanted:
|
|
names.setdefault(int(ident),[]).append(path.decode().lower())
|
|
for ident in names:names[ident]=sorted(set(names[ident]))
|
|
dbc,source_context=observed_item_display(json.loads(Path(BASIC_INPUTS['observed_inventory']).read_bytes()),Path(BASIC_INPUTS['source_dbc']).read_bytes());pending={}
|
|
variants,blocked=native_equipment_variant_candidates(source,dbc,target,package['rows'],names,selected,unparented_candidates=pending)
|
|
result=missing_weapon_links(source,target,package['rows'],dict(version=1,slots={}),max(r['ID']for r in target['ItemModifiedAppearance']),visible_armor=True,selected_items=selected,parent_candidates=pending,parent_native_max=max(r['ID']for r in target['ItemAppearance']),resource_variants=variants)
|
|
report=dict(kind='all-published-missing-armor-native-reference-review',source_snapshot=source['source_identity'],source_dbc_sha256=dbc.digest(),source_context=source_context,target_build=manifest['build'],listfile_sha256=digest.hexdigest(),selected_count=len(selected),existing_variant_count=len(variants),unparented_candidates=len(pending),staged_rows=len(result['records']),source_items_selected=sorted(selected),variant_candidates=variants,parent_candidates=pending,blocked=blocked,bindings=result['bindings'],installed=False,asset_bytes_verified=False,engine_loaded=False,rendering_verified=False)
|
|
(out/'report.json').write_text(json.dumps(report,indent=2)+'\n');(out/'components.json').write_text(json.dumps(result,indent=2)+'\n')
|
|
if result['records']:(out/'package.json').write_text(json.dumps(compose_weapon_links(package,result),sort_keys=True,separators=(',',':'))+'\n')
|
|
print(json.dumps({k:report[k]for k in('selected_count','existing_variant_count','unparented_candidates','staged_rows','installed','rendering_verified')}));print('Priority bindings:',json.dumps({str(i):pending.get(i,variants.get(i))for i in(47000,61038,61253,61058)}))
|