40 lines
2.9 KiB
JavaScript
40 lines
2.9 KiB
JavaScript
// Supplemental runtime documents use the freshly proved catalog and stage tables.
|
|
import * as e from './common.mjs';
|
|
export const BATTLE_TYPES=['GridFightBonfireHealConfigRow','GridFightBonfireEventRow','ConstValueCommonRow',
|
|
'GridFightShopPriceConfigRow','GridFightFormationWaveConfigRow','GridFightStageLevelValueConfigRow',
|
|
'GridFightPenaltyRuleConfigRow','GridFightEnemyDifficultyLvConfigRow','GridFightBonusRuleConfigRow',
|
|
'GridFightBinaryNodeRuleConfigRow','GridFightLevelBaseValueConfigRow'];
|
|
export function build(raw,stage,season){
|
|
const battle=Object.fromEntries(BATTLE_TYPES.map(n=>[n,raw[n]??stage[n]??e.fail('Missing battle table '+n)])),
|
|
template=raw.GridFightTraitElationTemplateConfigRow.find(r=>r.ID===1);
|
|
if(!template)e.fail('Missing deterministic elation template 1');
|
|
const ids=new Set(['PreEquipList','FirstRecommendEquipList','SecondRecommendEquipList'].flatMap(k=>template[k]??[])),
|
|
equipment=raw.GridFightEquipConfigRow.filter(r=>ids.has(r.ID));
|
|
if(equipment.length!==ids.size)e.fail('Unresolved elation equipment');
|
|
return {'battle.json':battle,'elation.json':{
|
|
season_id:season.season_id,sub_season_id:season.raw.selected_module.SubSeasonID,template_id:template.ID,
|
|
selection:'Deterministic valid fallback; native template and equipment tables have no season selector. Not a weighted gameplay roll.',
|
|
raw:{GridFightTraitElationTemplateConfigRow:template,GridFightEquipConfigRow:equipment},
|
|
evidence:{limitations:['Native tables and field bindings proved; runtime lookup and hotfix behavior not established for this build.']}
|
|
}};
|
|
}
|
|
export function main(){
|
|
const a=e.cli(['stage']),load=n=>e.loadJSON(e.path.join(a.stage,n+'.json')),
|
|
raw=load('catalog.raw'),catalogProof=load('catalog-provenance'),stageProof=load('stage-provenance'),
|
|
outputs=build(raw,load('rounds.raw'),load('season')),
|
|
proofs=[...catalogProof.tables,...stageProof.tables, ...load('items-provenance').tables],
|
|
proof=n=>proofs.find(p=>p.table===n)??e.fail('Missing proof '+n);
|
|
outputs['battle-provenance.json']=BATTLE_TYPES.map(proof);
|
|
outputs['elation.json'].evidence.tables=['GridFightTraitElationTemplateConfigRow','GridFightEquipConfigRow'].map(proof);
|
|
const eq=load('equipment');
|
|
outputs['equipment-chip-rewards-provenance.json']={
|
|
source:'Matching staged beta client native tables and English TextMap',catalog_sha256:e.sha256_file(e.path.join(a.stage,'catalog.json')),
|
|
client_identity:catalogProof,exporter:'tools/gridfight-extract-node/equipment.mjs',
|
|
tables:['GridFightEquipConfigRow','GridFightSPSilverWolfChooseConfigRow','GridFightSeasonItemConfigRow'],
|
|
contracts:Object.fromEntries(eq.equipment.filter(r=>r.battle_reward).map(r=>[r.id,r.battle_reward])),
|
|
behavior_limits:['Static configuration and description checks; gameplay not verified.']
|
|
};
|
|
for(const [file,value]of Object.entries(outputs))e.atomic_json(e.path.join(a.stage,file),value);
|
|
}
|
|
e.runMain(import.meta.url,main);
|