Player handbook

This commit is contained in:
Dandaedre 2026-08-23 18:18:53 +02:00
parent 85d451a67a
commit cf95669f34
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
6 changed files with 138 additions and 12 deletions

44
Jenkinsfile vendored
View File

@ -4,6 +4,24 @@
pipeline {
agent { label 'rust_no_docker' }
parameters {
choice(
name: 'PLAYER_THEME',
choices: ['warm', 'steel', 'fangdrael', 'bw', 'high-contrast', 'yon-sen', 'steingrund', 'treorst', 'anankar', 'drekinsteps', 'draan'],
description: 'Color theme for the player handbook.'
)
string(
name: 'PLAYER_CHAPTERS',
defaultValue: '',
description: 'Optional comma-separated player-handbook chapter allow-list.'
)
string(
name: 'PLAYER_DISABLED_CHAPTERS',
defaultValue: '',
description: 'Optional comma-separated player-handbook chapter deny-list.'
)
}
environment {
SOURCE_FILE = "main.typ"
OUTPUT_FILE = "Ravenous_build.pdf"
@ -19,6 +37,9 @@ pipeline {
MASTER_BALANCE_PLAINTEXT_FILE = "Ravenous_master_balance_report_plaintext.pdf"
MASTER_BALANCE_OUTPUT_FILE = "Ravenous_master_balance_report_build.pdf"
MASTER_BALANCE_PUBLISHED_FILE = "Ravenous_master_balance_report.pdf"
PLAYER_SOURCE_FILE = "player_handbook.typ"
PLAYER_OUTPUT_FILE = "Ravenous_player_handbook_build.pdf"
PLAYER_PUBLISHED_FILE = "Ravenous_player_handbook.pdf"
MASTER_PASSWORD = "billy"
// Important: published books live under /mnt/books
@ -83,6 +104,14 @@ pipeline {
echo "Building ${BALANCE_SOURCE_FILE} -> ${BALANCE_OUTPUT_FILE}"
typst compile "${BALANCE_SOURCE_FILE}" "${BALANCE_OUTPUT_FILE}"
echo "Building ${PLAYER_SOURCE_FILE} -> ${PLAYER_OUTPUT_FILE}"
typst compile \
--input preset=player-handbook \
--input theme="${PLAYER_THEME}" \
--input chapters="${PLAYER_CHAPTERS}" \
--input disabled_chapters="${PLAYER_DISABLED_CHAPTERS}" \
"${PLAYER_SOURCE_FILE}" "${PLAYER_OUTPUT_FILE}"
echo "Building ${MASTER_SOURCE_FILE} -> ${MASTER_PLAINTEXT_FILE}"
typst compile "${MASTER_SOURCE_FILE}" "${MASTER_PLAINTEXT_FILE}"
@ -101,6 +130,7 @@ pipeline {
test -f "${OUTPUT_FILE}"
test -f "${BALANCE_OUTPUT_FILE}"
test -f "${PLAYER_OUTPUT_FILE}"
test -f "${MASTER_OUTPUT_FILE}"
test -f "${MASTER_BALANCE_OUTPUT_FILE}"
@ -111,6 +141,7 @@ pipeline {
ls -lh \
"${OUTPUT_FILE}" \
"${BALANCE_OUTPUT_FILE}" \
"${PLAYER_OUTPUT_FILE}" \
"${MASTER_OUTPUT_FILE}" \
"${MASTER_BALANCE_OUTPUT_FILE}"
'''
@ -120,7 +151,7 @@ pipeline {
stage('Archive PDFs') {
steps {
archiveArtifacts(
artifacts: "${OUTPUT_FILE},${BALANCE_OUTPUT_FILE},${MASTER_OUTPUT_FILE},${MASTER_BALANCE_OUTPUT_FILE}",
artifacts: "${OUTPUT_FILE},${PLAYER_OUTPUT_FILE},${BALANCE_OUTPUT_FILE},${MASTER_OUTPUT_FILE},${MASTER_BALANCE_OUTPUT_FILE}",
fingerprint: true
)
}
@ -168,8 +199,8 @@ pipeline {
publishChecks(
conclusion: 'SUCCESS',
name: 'Build Successful',
summary: 'The Ravenous rulebook, master handbook, and balance reports were built successfully.',
text: 'All four PDFs were compiled and published successfully.',
summary: 'The Ravenous rulebook, player handbook, master handbook, and balance reports were built successfully.',
text: 'All five PDFs were compiled and published successfully.',
title: 'Build Successful'
)
@ -216,7 +247,7 @@ def deployTo(String targetDir) {
sh """
set -e
echo "Publishing Ravenous, its master handbook, and its balance reports to ${targetDir}"
echo "Publishing Ravenous, its player and master handbooks, and its balance reports to ${targetDir}"
mkdir -p "${targetDir}"
@ -228,6 +259,10 @@ def deployTo(String targetDir) {
"${env.BALANCE_OUTPUT_FILE}" \
"${targetDir}/${env.BALANCE_PUBLISHED_FILE}"
rsync -a \
"${env.PLAYER_OUTPUT_FILE}" \
"${targetDir}/${env.PLAYER_PUBLISHED_FILE}"
rsync -a \
"${env.MASTER_OUTPUT_FILE}" \
"${targetDir}/${env.MASTER_PUBLISHED_FILE}"
@ -240,6 +275,7 @@ def deployTo(String targetDir) {
ls -lh \
"${targetDir}/${env.PUBLISHED_FILE}" \
"${targetDir}/${env.BALANCE_PUBLISHED_FILE}" \
"${targetDir}/${env.PLAYER_PUBLISHED_FILE}" \
"${targetDir}/${env.MASTER_PUBLISHED_FILE}" \
"${targetDir}/${env.MASTER_BALANCE_PUBLISHED_FILE}"
"""

View File

@ -13,11 +13,29 @@ typst compile main.typ main.pdf
typst compile balance_report.typ balance_report.pdf
```
All shared build settings live in `data/config/build.yaml`. To build the
player-facing edition with the predefined chapter exclusions, use one override:
All shared build settings live in `data/config/build.yaml`. Build the dedicated
player-facing edition with the predefined chapter exclusions using:
```sh
typst compile --input preset=player-handbook main.typ player-handbook.pdf
typst compile --input preset=player-handbook player_handbook.typ player-handbook.pdf
```
Select any theme from `setup/theme/themes.typ` with the `theme` input:
```sh
typst compile --input preset=player-handbook --input theme=steel \
player_handbook.typ player-handbook-steel.pdf
```
Sections can be toggled with comma-separated chapter IDs. `chapters` is an
allow-list; `disabled_chapters` removes entries from it (or from the default
set when no allow-list is supplied):
```sh
typst compile --input preset=player-handbook \
--input chapters=title,origins,schools,rules \
--input disabled_chapters=rules \
player_handbook.typ player-handbook-classes.pdf
```
The preset can be combined with independent origin and school selectors:
@ -27,7 +45,7 @@ typst compile \
--input preset=player-handbook \
--input origin=dragon_1 \
--input school=artilleur \
main.typ dragon-1-artilleur-handbook.pdf
player_handbook.typ dragon-1-artilleur-handbook.pdf
```
`origin` and `school` default to an empty string, which includes every entry.

39
player_handbook.typ Normal file
View File

@ -0,0 +1,39 @@
// Player-facing handbook. The preset is supplied by the build command so the
// same chapter-selection machinery remains available to every entry point.
#import "/setup/setup.typ": (
build-config, chapter-enabled, config_main, disable-warnings, theme,
)
#show: config_main
#if not build-config.warnings { disable-warnings() }
// A dedicated cover keeps this artifact distinct from the complete rulebook.
#if chapter-enabled("title") {
page(numbering: none)[
#align(center + horizon)[
#text(size: 42pt, weight: "bold", fill: theme.blood)[RAVENOUS]
#v(0.7em)
#text(size: 18pt, tracking: 0.08em, fill: theme.gold)[LIVRE DU JOUEUR]
#v(2em)
#text(size: 11pt, style: "italic")[Par Le Dandaedre]
]
]
pagebreak()
outline(title: "Table des matières")
pagebreak()
}
#if chapter-enabled("presentation") {
include "chapters/introduction/presentation.typ"
}
#if chapter-enabled("hunters-and-calamities") {
include "chapters/hunters_and_calamities.typ"
}
#if chapter-enabled("origins") { include "chapters/origines.typ" }
#if chapter-enabled("schools") { include "chapters/schools/schools.typ" }
#if chapter-enabled("crafting") { include "chapters/artisanat.typ" }
#if chapter-enabled("races") { include "chapters/races.typ" }
#if chapter-enabled("rules") { include "chapters/rules/rules.typ" }
#if chapter-enabled("creation") { include "chapters/creation.typ" }
#if chapter-enabled("character_sheet") { include "chapters/character_sheet.typ" }
#if chapter-enabled("experience-gains") { include "chapters/experience_gains.typ" }

View File

@ -6,11 +6,23 @@
#let school-trigrams = config.schools.trigrams
#let craft-trigrams = config.crafts.trigrams
#let known-chapters = (
"title", "acknowledgements", "presentation", "geography",
"hunters-and-calamities", "origins", "schools", "crafting", "races",
"rules", "creation", "character_sheet", "experience-gains",
"game-master-help", "bestiary",
)
#let comma-list(value) = value.split(",").map(item => item.trim()).filter(item => item != "")
// `--input preset=...` is the lightweight entry point for alternate editions.
#let selected-preset = sys.inputs.at("preset", default: raw-build-config.preset)
#assert(selected-preset in presets, message: "Unknown build preset: " + selected-preset)
#let selected-origin = sys.inputs.at("origin", default: raw-build-config.origin)
#let selected-school = sys.inputs.at("school", default: raw-build-config.school)
#let selected-theme = sys.inputs.at("theme", default: document-config.color_scheme)
#let selected-chapters = comma-list(sys.inputs.at("chapters", default: ""))
#let input-disabled-chapters = comma-list(sys.inputs.at("disabled_chapters", default: ""))
#let selected-creature-id = sys.inputs.at(
"creature_id",
default: raw-build-config.at("creature_id", default: ""),
@ -24,9 +36,18 @@
#let preset-disabled-chapters = presets.at(selected-preset).disabled_chapters
#let preset-master-only = presets.at(selected-preset).at("master_only", default: false)
#let disabled-chapters = (
raw-build-config.disabled_chapters + preset-disabled-chapters
raw-build-config.disabled_chapters + preset-disabled-chapters + input-disabled-chapters
).dedup()
#assert(
selected-chapters.all(id => id in known-chapters),
message: "Unknown chapter in chapters input",
)
#assert(
disabled-chapters.all(id => id in known-chapters),
message: "Unknown chapter in disabled_chapters input",
)
#let build-config = (
max-tier-exclusive: raw-build-config.max_tier_exclusive,
warnings: raw-build-config.warnings,
@ -34,6 +55,8 @@
master-only: preset-master-only,
origin: selected-origin,
school: selected-school,
theme: selected-theme,
chapters: selected-chapters,
creature-id: selected-creature-id,
disabled-chapters: disabled-chapters,
)
@ -42,7 +65,10 @@
#let tier-is-enabled(tier) = tier == none or tier < max-tier-exclusive
#let craft-tiers = range(0, max-tier-exclusive)
#let school-tiers = range(1, max-tier-exclusive)
#let chapter-enabled(id) = id not in disabled-chapters
#let chapter-enabled(id) = (
id not in disabled-chapters
and (selected-chapters.len() == 0 or id in selected-chapters)
)
#let origin-enabled(id) = selected-origin == "" or selected-origin == id
#let school-enabled(id) = selected-school == "" or selected-school == id

View File

@ -427,6 +427,9 @@
),
)
// Public identifiers accepted by the `theme` build input.
#let theme-names = themes.keys()
//----- Return the complete selected theme -----
#let make-theme(theme-name: default-theme) = {
themes.at(theme-name)

View File

@ -1,6 +1,6 @@
//----- Theme constructors -----
#import "themes.typ" as th
#import "../build_config.typ": document-config
#import "../build_config.typ": build-config, document-config
// make-theme, make-theme-variable, fantasy-label,fantasy-rule,fantasy-section
//----- Project metadata -----
@ -12,7 +12,11 @@
)
//----- Select the active color scheme -----
#let color_scheme = document-config.color_scheme
#let color_scheme = build-config.theme
#assert(
color_scheme in th.theme-names,
message: "Unknown theme '" + color_scheme + "'. Available themes: " + th.theme-names.join(", "),
)
//----- Build the active theme and its variable form -----
#let theme = th.make-theme(theme-name: color_scheme)