forked from unimatrix/web
21 lines
5.3 KiB
JavaScript
21 lines
5.3 KiB
JavaScript
import {mkdirSync,writeFileSync,readFileSync} from 'node:fs';
|
|
const web=new URL('../web/',import.meta.url),directory=new URL('assets/planet-glyphs/',web);mkdirSync(directory,{recursive:true});
|
|
// Original angular letterforms; these are not traced or adapted from franchise pictograms.
|
|
const alphabet={U:'M0 0V15L5 20H11L16 15V0',H:'M0 0V20M16 0V20M0 10H16',F:'M0 20V0H16M0 10H12',A:'M0 20L8 0 16 20M4 12H12',R:'M0 20V0H12L16 6 8 12H0M8 12L16 20',K:'M0 0V20M16 0L0 10 16 20',I:'M2 0H14M8 0V20M2 20H14',S:'M16 0H4L0 6 16 14 12 20H0',C:'M16 0H5L0 5V15L5 20H16',L:'M0 0V20H16',D:'M0 20V0H8L16 8V12L8 20Z',N:'M0 20V0L16 20V0',G:'M16 0H5L0 5V15L5 20H16V10H8',E:'M16 0H0V20H16M0 10H12',P:'M0 20V0H10L16 6 10 12H0',M:'M0 20V0L8 10 16 0V20',T:'M0 0H16M8 0V20',O:'M4 0H12L16 5V15L12 20H4L0 15V5Z',V:'M0 0L8 20 16 0'};
|
|
const planets=[
|
|
{id:'serevan',name:'Arrakduin',seed:'ARRAKDUIN',color:'#e9bc70',symbol:'M78 163L128 61 178 163M100 119H156M95 163L128 139 161 163M128 61V42M170 104L188 86'},
|
|
{id:'pelareth',name:'Kaladam',seed:'KALADAM',color:'#8bd4cb',symbol:'M167 77L128 52 87 77V142L128 174 167 142M128 52V174M87 110H167M104 126L128 107 151 126'},
|
|
{id:'varkesh',name:'Giedermark',seed:'GIEDERMARK',color:'#c6a4d9',symbol:'M86 62V164H167V117H127M86 62H167L142 87H106M127 117V68M127 68L178 94V148'},
|
|
{id:'orivane',name:'Kaiterhof',seed:'KAITERHOF',color:'#d6cc91',symbol:'M91 53V171M168 57L91 111 168 170M116 94L140 53 168 99M132 123V174M168 57H188'},
|
|
{id:'nivareth',name:'Sigmadraken IV',seed:'SIGMADRAKENIV',color:'#a9cee4',symbol:'M165 57H93L77 82 170 141 154 170H80M126 48V180M85 111L126 84 169 111M92 149L127 170 162 149'}
|
|
];
|
|
function art(planet){const ring=`<circle cx="128" cy="128" r="111" stroke="${planet.color}" stroke-width="1.3" stroke-dasharray="170 20 75 16 120 20" opacity=".65"/><path d="M118 10L128 2 138 10M118 246L128 254 138 246" stroke="${planet.color}" stroke-width="2"/><circle cx="128" cy="128" r="83" stroke="${planet.color}" stroke-width="1" opacity=".2"/>`;
|
|
const letters=[...planet.seed].map((letter,index)=>{const angle=-100+index*(200/Math.max(1,planet.seed.length-1));return `<g transform="translate(128 128) rotate(${angle}) translate(-4 -104) scale(.42)" stroke="${planet.color}" stroke-width="2.5" opacity=".9"><path d="${alphabet[letter]}"/></g>`;}).join('');
|
|
return `<g fill="none" stroke-linecap="square" stroke-linejoin="miter">${ring}${letters}<path d="${planet.symbol}" stroke="${planet.color}" stroke-width="5"/><path d="M57 191L73 185M181 185L197 191" stroke="${planet.color}" stroke-width="2"/><circle cx="61" cy="69" r="2" fill="${planet.color}"/><circle cx="194" cy="166" r="2" fill="${planet.color}"/></g>`;}
|
|
for(const planet of planets)writeFileSync(new URL(planet.id+'.svg',directory),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" role="img"><title>${planet.name} route sigil</title>${art(planet)}</svg>`);
|
|
const atlas=`<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="650" viewBox="0 0 1600 650"><rect width="1600" height="650" fill="#102321"/><path d="M60 92H1540M60 563H1540" stroke="#496255"/><text x="60" y="62" fill="#d4b476" font-family="sans-serif" font-size="18" letter-spacing="5">VAERKRING · CELESTIAL ROUTE SIGILS</text><text x="60" y="132" fill="#ede5cc" font-family="serif" font-size="30">Five worlds. One constellation alphabet.</text>${planets.map((planet,index)=>`<g transform="translate(${60+index*305} 195)"><rect width="278" height="330" rx="4" fill="#142d29" stroke="#365149"/><g transform="translate(11 12)">${art(planet)}</g><text x="139" y="303" text-anchor="middle" fill="${planet.color}" font-family="sans-serif" font-size="18" letter-spacing="3">${planet.name.toUpperCase()}</text></g>`).join('')}<text x="60" y="605" fill="#a4b1a5" font-family="sans-serif" font-size="15">dunerealms.com · Original angular ligatures · Shared website and game-menu artwork</text></svg>`;
|
|
writeFileSync(new URL('atlas.svg',directory),atlas);
|
|
const section='<section class="planet-glyph-atlas" id="route-sigils"><p class="eyebrow">VAERKRING / CELESTIAL ROUTES</p><h2>Read the stars. Find your world.</h2><p>Each world has an original angular route sigil, drawn from our own constellation alphabet. Match the symbol here with its icon in the planet travel menu. Labels identify destinations; the artwork does not change fares or access rules.</p><div class="planet-glyph-grid">'+planets.map(p=>`<figure><img src="assets/planet-glyphs/${p.id}.svg" width="256" height="256" alt="${p.name} route sigil" loading="lazy"><figcaption>${p.name}</figcaption></figure>`).join('')+'</div></section>';
|
|
for(const name of ['arrakis.html']){const url=new URL(name,web);let html=readFileSync(url,'utf8').replace(/<section class="planet-glyph-atlas"[\s\S]*?<\/section>/g,'').replace(/<p class="planet-symbols-shortcut">[\s\S]*?<\/p>/g,'');html=html.replace(/(<h1>[^<]*<\/h1>)/,'$1<p class="planet-symbols-shortcut"><a href="#route-sigils">Planet dial symbols →</a></p>');html=html.replace('<nav id="realm-menu"',section+'<nav id="realm-menu"');writeFileSync(url,html);}
|
|
const manualUrl=new URL('manual-data.json',web),manual=JSON.parse(readFileSync(manualUrl,'utf8'));const travel=manual.find(chapter=>chapter.id==='solaris-spice-sales-and-guild-travel');travel.body=travel.body.replace(/<section class="planet-glyph-atlas"[\s\S]*?<\/section>/g,'')+section;writeFileSync(manualUrl,JSON.stringify(manual)+'\n');
|
|
console.log('Built five original planet route sigils and atlas');
|

Staff