1888 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
26 lines
3.0 KiB
Python
26 lines
3.0 KiB
Python
from pathlib import Path
|
|
from collections import Counter,defaultdict
|
|
import hashlib,json,sys
|
|
sys.path.insert(0,'ops')
|
|
from item_effect_compat import effective_item_links
|
|
W=Path('runtime/praxis-item-effects-20261020');B=Path('runtime/catalog-items-20261018')
|
|
load=lambda p:json.loads(Path(p).read_text())
|
|
package_path=Path(sys.argv[1])if len(sys.argv)>1 else Path('docs/evidence/data/item-sparse-compat/package.json');package=load(package_path);source=load(W/'source-owned-items.json');effects={r['ID']:r for r in load(B/'ItemEffect.json')}
|
|
for r in package['rows']:
|
|
if r['table_name']=='ItemEffect':
|
|
assert r.get('record_status','valid')=='valid';effects[r['id']]=dict(r['record'],ID=r['id'])
|
|
links=defaultdict(list)
|
|
for l in effective_item_links(load(B/'ItemXItemEffect.json'),package['rows']):links[l['ItemID']].append(l)
|
|
fields=('LegacySlotIndex','TriggerType','Charges','CoolDownMSec','CategoryCoolDownMSec','SpellCategoryID','SpellID','ChrSpecializationID','PlayerConditionID')
|
|
rows=[]
|
|
for p in source:
|
|
wanted=[dict(LegacySlotIndex=i-1,TriggerType=p['spelltrigger_'+str(i)],Charges=p['spellcharges_'+str(i)],CoolDownMSec=p['spellcooldown_'+str(i)],CategoryCoolDownMSec=p['spellcategorycooldown_'+str(i)],SpellCategoryID=p['spellcategory_'+str(i)],SpellID=p['spellid_'+str(i)],ChrSpecializationID=0,PlayerConditionID=0)for i in range(1,6)if p['spellid_'+str(i)]]
|
|
actual=[{k:effects[l['ItemEffectID']][k]for k in fields}for l in links[p['entry']]]
|
|
a=sorted(actual,key=lambda r:r['LegacySlotIndex']);b=sorted(wanted,key=lambda r:r['LegacySlotIndex'])
|
|
status='source-link-fields-exact'if a==b else'missing-links'if not a else'forever-only-links'if not b else'link-fields-differ'
|
|
rows.append(dict(entry=p['entry'],name=p['name'],item_class=p['class'],item_subclass=p['subclass'],status=status,source_slots=b,native_effective_slots=a,source_template_sha256=hashlib.sha256(json.dumps(p,sort_keys=True,separators=(',',':'),ensure_ascii=False,allow_nan=False).encode()).hexdigest()))
|
|
report=dict(kind='current-owned-source-effect-link-reconciliation',source_item_count=len(rows),source_effect_bearing=sum(bool(r['source_slots'])for r in rows),counts=dict(Counter(r['status']for r in rows)),effect_bearing_counts=dict(Counter(r['status']for r in rows if r['source_slots'])),items=rows,source_item_spell_ids=sorted({e['SpellID']for r in rows for e in r['source_slots']}),installed_package_sha256=hashlib.sha256(package_path.read_bytes()).hexdigest(),native_engine_verified=False,limits=['Exact relationship fields do not establish complete spell definitions, tooltip values or server proc mechanics.','Current local Tortoise templates; live Octo equality unverified.'])
|
|
(W/('reconciliation-staged.json'if len(sys.argv)>1 else'reconciliation.json')).write_text(json.dumps(report,indent=2)+'\n')
|
|
print({k:report[k]for k in('source_item_count','source_effect_bearing','counts','effect_bearing_counts')})
|
|
print('Source-empty items with Forever-only effects:',[(r['entry'],r['name'])for r in rows if r['status']=='forever-only-links'])
|