import fs from 'fs'; import path from 'path'; export interface LakeConfig { id: string; text: string; priority?: boolean; coords: [number, number]; maxVolume?: number; minLevel?: number; maxLevel?: number; storageLevel?: number; navigationForbidden?: boolean; } // Preserve existing minLevel, maxLevel, storageLevel that were scraped from PVL. // Only update maxVolume, coords, and navigationForbidden. import { lakesConfig as oldConfig } from './lakesConfig'; const exactData: Record> = { "VLL1|1": { maxVolume: 306.0, coords: [48.6322, 14.2215], navigationForbidden: false }, "VLL2|1": { maxVolume: 1.6, coords: [48.6250, 14.3180], navigationForbidden: false }, "VLHN|1": { maxVolume: 21.1, coords: [49.1830, 14.4440], navigationForbidden: false }, "VLKO|1": { maxVolume: 2.8, coords: [49.2550, 14.3980], navigationForbidden: false }, "VLOR|2": { maxVolume: 716.5, coords: [49.6060, 14.1700], navigationForbidden: false }, "VLSL|2": { maxVolume: 269.3, coords: [49.8220, 14.4360], navigationForbidden: false }, "VLST|2": { maxVolume: 11.2, coords: [49.8450, 14.4120], navigationForbidden: false }, "MARI|1": { maxVolume: 33.8, coords: [48.8470, 14.4870], navigationForbidden: true }, "MZHR|3": { maxVolume: 56.7, coords: [49.7890, 13.1550], navigationForbidden: false }, "ZESV|2": { maxVolume: 266.6, coords: [49.7040, 15.1150], navigationForbidden: true }, "VLKA|2": { maxVolume: 12.8, coords: [49.6380, 14.2580], navigationForbidden: false }, "VLVE|2": { maxVolume: 11.1, coords: [49.9390, 14.3910], navigationForbidden: false }, "BLHU|1": { maxVolume: 5.7, coords: [49.0270, 13.9870], navigationForbidden: true }, "UHNY|3": { maxVolume: 16.0, coords: [49.2610, 13.1230], navigationForbidden: true }, "KCKC|3": { maxVolume: 9.3, coords: [50.0630, 13.9310], navigationForbidden: true }, "KLKL|3": { maxVolume: 1.5, coords: [49.7540, 13.5640], navigationForbidden: false }, "RACU|3": { maxVolume: 5.5, coords: [49.7150, 13.3640], navigationForbidden: false }, "TRTR|2": { maxVolume: 4.1, coords: [49.5260, 15.1950], navigationForbidden: false }, "HESE|2": { maxVolume: 1.9, coords: [49.5070, 15.2630], navigationForbidden: false }, "MZLU|3": { maxVolume: 2.3, coords: [49.8050, 12.6390], navigationForbidden: true }, "STZL|3": { maxVolume: 14.5, coords: [50.0930, 13.1360], navigationForbidden: true }, "PPPI|3": { maxVolume: 1.6, coords: [49.6910, 13.9570], navigationForbidden: true }, "LILA|3": { maxVolume: 0.8, coords: [49.6640, 13.8820], navigationForbidden: true }, "OPOB|3": { maxVolume: 0.6, coords: [49.7110, 13.9370], navigationForbidden: true }, "STST|2": { maxVolume: 1.0, coords: [49.7910, 14.0040], navigationForbidden: false }, "HEVR|2": { maxVolume: 0.5, coords: [49.5070, 15.2440], navigationForbidden: false }, "CRSO|1": { maxVolume: 1.4, coords: [48.7750, 14.5360], navigationForbidden: false }, "SCHU|1": { maxVolume: 0.8, coords: [48.7840, 14.7350], navigationForbidden: false }, "SVSV|2": { maxVolume: 1.2, coords: [49.5750, 15.9520], navigationForbidden: true }, "SAPI|2": { maxVolume: 1.5, coords: [49.5930, 15.9320], navigationForbidden: false }, "SMSM|3": { maxVolume: 0.7, coords: [49.8970, 14.0580], navigationForbidden: false }, "CPZA|3": { maxVolume: 0.5, coords: [49.8050, 13.8510], navigationForbidden: false }, "BIBI|1": { maxVolume: 0.3, coords: [49.1670, 14.0410], navigationForbidden: false }, "SPKA|1": { maxVolume: 0.3, coords: [48.9740, 14.5450], navigationForbidden: false }, "SPNE|2": { maxVolume: 0.4, coords: [49.7710, 15.1760], navigationForbidden: false }, "SPZH|1": { maxVolume: 0.2, coords: [49.2310, 15.3120], navigationForbidden: true }, "KLDP|3": { maxVolume: 0.5, coords: [49.6640, 13.7530], navigationForbidden: true }, "KLHP|3": { maxVolume: 0.7, coords: [49.6550, 13.7610], navigationForbidden: true }, "CPDR|3": { maxVolume: 0.1, coords: [49.8050, 13.8550], navigationForbidden: false }, }; function main() { const updated = oldConfig.map(lake => { const fresh = exactData[lake.id]; if (fresh) { return { ...lake, maxVolume: fresh.maxVolume, coords: fresh.coords, navigationForbidden: fresh.navigationForbidden }; } return lake; }); let newContent = `export interface LakeConfig { id: string; text: string; priority?: boolean; coords: [number, number]; maxVolume?: number; minLevel?: number; maxLevel?: number; storageLevel?: number; navigationForbidden?: boolean; } export const lakesConfig: LakeConfig[] = [ `; updated.forEach((l, idx) => { newContent += ` { id: "${l.id}", text: "${l.text}", ${l.priority ? 'priority: true, ' : ''}coords: [${l.coords[0].toFixed(4)}, ${l.coords[1].toFixed(4)}], maxVolume: ${l.maxVolume}, minLevel: ${l.minLevel}, maxLevel: ${l.maxLevel}, storageLevel: ${l.storageLevel}, navigationForbidden: ${l.navigationForbidden} }${idx === updated.length - 1 ? '' : ','}\n`; }); newContent += `];\n`; fs.writeFileSync(path.resolve('./scripts/lakesConfig.ts'), newContent); console.log("lakesConfig.ts updated with precise static data and navigation limits!"); } main();