XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
// Derive public scoop ratings from the existing pinned, unmodified EDSY data.
const fs=require('node:fs'),path=require('node:path'),vm=require('node:vm'),crypto=require('node:crypto');
const root=path.resolve(__dirname,'..'),file=path.join(root,'XFEEDToolBox.Core/Outfitting/Edsy/eddb.js');
const context={};vm.createContext(context);vm.runInContext(fs.readFileSync(file,'utf8'),context);
const modules=Object.values(context.eddb.module).filter(m=>m.mtype==='ifs'&&m.scooprate>0&&m.fdname)
    .map(m=>({symbol:m.fdname.toLowerCase(),tonnesPerSecond:m.scooprate})).sort((a,b)=>a.symbol.localeCompare(b.symbol));
if(modules.length!==40)throw new Error('Unexpected pinned scoop catalogue size: '+modules.length);
fs.writeFileSync(path.join(root,'XFEEDToolBox.Core/Navigation/scoop-reference.json'),JSON.stringify({
    source:'https://github.com/taleden/EDSY',commit:'1fafc5d9f2d07e2e92443657c83d0c65b897bb00',
    sourceSha256:crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex'),unit:'tonnes/second',modules},null,2)+'\n');
console.log(JSON.stringify({modules:modules.length}));