MC/website/scripts/build-appointments.mjs
Dev 6deb4a2e7d DuneRealms V2 clean baseline
Owner-authorised history reset; current source tree preserved exactly.
2026-11-13 00:05:14 +01:00

7 lines
2.9 KiB
JavaScript

import {mkdirSync,readFileSync,writeFileSync} from 'node:fs';
const web=new URL('../web/',import.meta.url),dir=new URL('assets/appointments/',web);mkdirSync(dir,{recursive:true});
const icons={spice:'<path d="M128 78L96 124 128 167 160 124Z"/><path d="M128 78V167M96 124H160M108 59L113 72M148 59L143 72M76 81L87 90M180 81L169 90"/><circle cx="128" cy="57" r="12"/>',water:'<path d="M128 58C118 83 95 107 95 125A33 33 0 0 0 161 125C161 107 138 83 128 58Z"/><path d="M87 157H169L156 184H100ZM108 117Q100 137 120 145"/>',crown:'<path d="M76 102L90 158H166L180 102 153 122 128 84 103 122Z"/><path d="M91 174H165M112 139H144"/><circle cx="76" cy="98" r="5"/><circle cx="128" cy="80" r="5"/><circle cx="180" cy="98" r="5"/>'};
for(const [id,shape]of Object.entries(icons)){const svg=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><title>Landsraad ${id} office emblem</title><g fill="none" stroke="#d9b66e" stroke-width="5" stroke-linejoin="round"><path d="M128 13L211 49V131Q211 192 128 235Q45 192 45 131V49Z" fill="#17362e"/><path d="M128 26L198 58V130Q198 181 128 219Q58 181 58 130V58Z" stroke-width="2"/>${shape}<path d="M28 86L37 102 28 117 40 133 34 152M228 86L219 102 228 117 216 133 222 152" stroke-width="3"/></g></svg>`;writeFileSync(new URL(id+'.svg',dir),svg);}
const section='<section class="landsraad-appointments"><figure><img src="assets/landsraad-appointments.webp" width="1600" height="533" alt="Original imperial artwork: a gold crown above sealed spice and water appointment parchments, framed by a desert palace" loading="lazy"></figure><p class="eyebrow">BY APPOINTMENT OF THE EMPEROR</p><h2>Landsraad appointments</h2><p>The Emperor appoints a spice-trading house to the <strong>Specerhuis</strong> office and a water-selling house to the <strong>Welvaart House</strong> office. These are the Landsraad appointments. The ceremonial artwork represents the offices; it does not confirm that either office is currently occupied.</p><div class="appointment-emblems"><figure><img src="assets/appointments/spice.svg" alt="Gold spice office seal" width="128" height="128"><figcaption>Specerhuis · spice rights</figcaption></figure><figure><img src="assets/appointments/water.svg" alt="Gold water office seal" width="128" height="128"><figcaption>Welvaart House · water rights</figcaption></figure></div></section>';
const page=new URL('diplomacy.html',web);let html=readFileSync(page,'utf8').replace(/<section class="landsraad-appointments">[\s\S]*?<\/section>/g,'');html=html.replace('</main>',section+'</main>').replaceAll('Spice Steward and House of Water','Specerhuis and Welvaart House Landsraad appointments');writeFileSync(page,html);
const file=new URL('manual-data.json',web),manual=JSON.parse(readFileSync(file,'utf8'));const chapter=manual.find(c=>/politic/i.test(c.title));if(chapter)chapter.body=chapter.body.replace(/<section class="landsraad-appointments">[\s\S]*?<\/section>/g,'')+section;writeFileSync(file,JSON.stringify(manual)+'\n');