const fs = require('fs'); const path = require('path'); const sharp = require('C:/Users/EDY/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/sharp'); const root = path.resolve(__dirname, '../../..'); const generated = 'C:/Users/EDY/.codex/generated_images/01a18192-0539-7f22-a6ee-e31a7c74be1b'; const files = { serpentine:'exec-46c5e8a2-1fe0-4239-aa61-4f2be5cbdd26.png', longhorn:'exec-61b864db-1874-4c74-90d5-e60ebb5e43b2.png', switchback:'exec-092f49c4-7679-4b60-b171-7ba1b7d426e2.png', chokepoint:'exec-7f2a3c1c-eb12-441e-8b04-080440fa4e6e.png' }; (async()=>{ for (const [id,file] of Object.entries(files)) { fs.copyFileSync(path.join(generated,file),path.join(__dirname,id+'-source.png')); const png=await sharp(path.join(generated,file)).resize(750,1047,{fit:'fill'}).png().toBuffer(); fs.writeFileSync(path.join(root,'Assets/BuffaloSiege/Art/map.'+id+'.png'),png); fs.writeFileSync(path.join(__dirname,id+'.png'),png); } const wood=path.join(generated,'exec-ac24b9e0-9f14-4119-9ce6-d1a25f6eb06a.png'); fs.copyFileSync(wood,path.join(__dirname,'wood-panel-source.png')); const png=await sharp(wood).trim().resize({width:1024}).png().toBuffer(); fs.writeFileSync(path.join(root,'Assets/BuffaloSiege/Art/ui.button.wood.png'),png); fs.writeFileSync(path.join(__dirname,'wood-panel.png'),png); const file=path.join(root,'Assets/BuffaloSiege/Art/asset-manifest.json'); const manifest=JSON.parse(fs.readFileSync(file));const e=manifest.assets.find(x=>x.id==='ui.button.wood'); e.nineSlice=[44,44,44,44];e.transparentPadding=[0,0,0,0]; const meta=await sharp(png).metadata();e.width=meta.width;e.height=meta.height; fs.writeFileSync(file,JSON.stringify(manifest,null,2)+'\n'); console.log('Imported four painted maps and a nine-slice wood panel: '+meta.width+'x'+meta.height); })();