Files
scrollsmith/dungeonTemplate.js
Keli Grubb ed95dd08a2
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
initial commit
2025-08-29 22:56:40 -04:00

166 lines
3.4 KiB
JavaScript

export function dungeonTemplate(data) {
return `
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>${data.title}</title>
<link href="https://fonts.googleapis.com/css2?family=Uncial+Antiqua&family=EB+Garamond&display=swap" rel="stylesheet">
<style>
@page {
size: A4 landscape;
margin: 0; /* remove outer white margins */
}
body {
margin: 0;
padding: 1cm;
background: #d6c5a3; /* light parchment-like color, no image */
font-family: 'EB Garamond', serif;
color: #2b2118;
}
h1 {
font-family: 'Uncial Antiqua', cursive;
text-align: center;
font-size: 2.6em;
margin: 0.2em 0 0.3em;
color: #3e1f0e;
border-bottom: 2px solid #3e1f0e;
padding-bottom: 0.2em;
}
.flavor {
text-align: center;
font-style: italic;
margin: 0.5em 0 1em;
font-size: 1.15em;
}
.columns {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 1cm;
}
.col {
display: flex;
flex-direction: column;
font-size: 0.95em;
line-height: 1.4em;
}
h2 {
font-family: 'Uncial Antiqua', cursive;
font-size: 1.3em;
margin: 0.5em 0 0.3em;
color: #3e1f0e;
border-bottom: 1px solid #3e1f0e;
}
.map img {
max-width: 100%;
border: 3px solid #3e1f0e;
margin-bottom: 0.5em;
}
.room h3 {
margin: 0.3em 0 0.1em;
font-size: 1.1em;
font-weight: bold;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.9em;
margin: 0.5em 0;
background: rgba(255, 255, 255, 0.85); /* slight overlay for readability */
}
th, td {
border: 1px solid #3e1f0e;
padding: 0.3em;
text-align: left;
}
th {
background: #d9c6a5;
}
ul {
margin: 0.3em 0 0.6em 1em;
padding: 0;
}
footer {
text-align: center;
font-size: 0.8em;
color: #5a4632;
margin-top: 0.5em;
font-style: italic;
}
</style>
</head>
<body>
<h1>${data.title}</h1>
<p class="flavor">${data.flavor}</p>
<div class="columns">
<!-- Column 1 -->
<div class="col">
<h2>Map</h2>
<div class="map">
<img src="file://${data.map}" alt="Dungeon Map">
</div>
<h2>Adventure Hooks</h2>
<ul>
${data.hooks.map(h => `<li>${h}</li>`).join("")}
</ul>
<h2>Rumors</h2>
<ul>
${data.rumors.map(r => `<li>${r}</li>`).join("")}
</ul>
</div>
<!-- Column 2 -->
<div class="col">
<h2>Keyed Rooms</h2>
${data.rooms.map((room, i) => `
<div class="room">
<h3>${i+1}. ${room.name}</h3>
<p>${room.description}</p>
</div>
`).join("")}
</div>
<!-- Column 3 -->
<div class="col">
<h2>Encounters</h2>
<table>
<tr><th>Name</th><th>Details</th></tr>
${data.encounters.map(e => `
<tr>
<td>${e.name}</td>
<td>${e.details}</td>
</tr>
`).join("")}
</table>
<h2>Treasure</h2>
<ul>
${data.treasure.map(t => `<li>${t}</li>`).join("")}
</ul>
<h2>NPCs</h2>
<ul>
${data.npcs.map(n => `<li><b>${n.name}</b>: ${n.trait}</li>`).join("")}
</ul>
</div>
</div>
<footer>
Generated with DungeonBuilder • © ${new Date().getFullYear()}
</footer>
</body>
</html>
`;
}