Hello World
This commit is contained in:
commit
7d342af29f
124 files changed
+627642
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {fileURLToPath} from 'node:url';
|
||||
|
||||
// Derived table: what each Investment Environment grants, taken from the
|
||||
// client's GridFightPortalBuffConfigRow.ShowBonusIDList (granted when the
|
||||
// environment is picked; the client shows exactly these bonus bundles on the
|
||||
// portal page, GridFightPortalData.BuildBonusData) and DelayedShowBonus (granted
|
||||
// later, at the moment the portal text names). Both resolve through
|
||||
// GridFightCombinationBonusConfigRow / GridFightBasicBonusConfigRow. Nothing is
|
||||
// read from the client here; the inputs are the installed raw tables.
|
||||
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
|
||||
const DIR = path.join(ROOT, 'resources/grid_fight');
|
||||
const load = n => JSON.parse(fs.readFileSync(path.join(DIR, n), 'utf8'));
|
||||
|
||||
export function build(catalog, bonus, portals) {
|
||||
const buffs = new Map(catalog.GridFightPortalBuffConfigRow.map(r => [r.ID, r]));
|
||||
const defined = new Set([
|
||||
...bonus.GridFightBasicBonusConfigRow.map(r => r.BonusID),
|
||||
...bonus.GridFightCombinationBonusConfigRow.map(r => r.BonusID)
|
||||
]);
|
||||
const out = {};
|
||||
for (const p of portals.portals) {
|
||||
const row = buffs.get(p.id);
|
||||
if (!row) throw new Error('portal ' + p.id + ' has no PortalBuff row');
|
||||
const show = row.ShowBonusIDList ?? [], delayed = row.DelayedShowBonus ?? [];
|
||||
for (const id of [...show, ...delayed]) if (!defined.has(id)) throw new Error('portal ' + p.id + ': bonus ' + id + ' undefined');
|
||||
out[p.id] = {show, delayed, traits: row.PortalGameRefTrait ?? []};
|
||||
}
|
||||
return {
|
||||
provenance: 'Derived from catalog.raw.json GridFightPortalBuffConfigRow (ShowBonusIDList, DelayedShowBonus, PortalGameRefTrait) for the season portals of portals.json; bonus IDs resolve in bonus.raw.json. Gameplay not verified in game.',
|
||||
portals: out
|
||||
};
|
||||
}
|
||||
|
||||
export function main() {
|
||||
const out = build(load('catalog.raw.json'), load('bonus.raw.json'), load('portals.json'));
|
||||
const target = process.argv[2] ?? path.join(DIR, 'portal-bonus.json');
|
||||
fs.writeFileSync(target, JSON.stringify(out, null, 1) + '\n');
|
||||
console.log('portal-bonus: ' + Object.keys(out.portals).length + ' portals -> ' + target);
|
||||
}
|
||||
if (process.argv[1] === fileURLToPath(import.meta.url)) main();
|
||||
Reference in new issue
Block a user