diff --git a/Jenkinsfile b/Jenkinsfile index 505513e..bcc526f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,6 +15,10 @@ pipeline { MASTER_PLAINTEXT_FILE = "Ravenous_master_handbook_plaintext.pdf" MASTER_OUTPUT_FILE = "Ravenous_master_handbook_build.pdf" MASTER_PUBLISHED_FILE = "Ravenous_master_handbook.pdf" + MASTER_BALANCE_SOURCE_FILE = "balance_report_master.typ" + 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" MASTER_PASSWORD = "billy" // Important: published books live under /mnt/books @@ -87,18 +91,28 @@ pipeline { --encrypt "${MASTER_PASSWORD}" "${MASTER_PASSWORD}" 40 -- \ "${MASTER_PLAINTEXT_FILE}" "${MASTER_OUTPUT_FILE}" + echo "Building ${MASTER_BALANCE_SOURCE_FILE} -> ${MASTER_BALANCE_PLAINTEXT_FILE}" + typst compile "${MASTER_BALANCE_SOURCE_FILE}" "${MASTER_BALANCE_PLAINTEXT_FILE}" + + echo "Protecting the master balance report with the master-handbook policy" + qpdf --allow-weak-crypto \ + --encrypt "${MASTER_PASSWORD}" "${MASTER_PASSWORD}" 40 -- \ + "${MASTER_BALANCE_PLAINTEXT_FILE}" "${MASTER_BALANCE_OUTPUT_FILE}" + test -f "${OUTPUT_FILE}" test -f "${BALANCE_OUTPUT_FILE}" test -f "${MASTER_OUTPUT_FILE}" + test -f "${MASTER_BALANCE_OUTPUT_FILE}" - # Never archive or publish the unprotected intermediate. - rm "${MASTER_PLAINTEXT_FILE}" + # Never archive or publish unprotected master intermediates. + rm "${MASTER_PLAINTEXT_FILE}" "${MASTER_BALANCE_PLAINTEXT_FILE}" echo "Builds complete:" ls -lh \ "${OUTPUT_FILE}" \ "${BALANCE_OUTPUT_FILE}" \ - "${MASTER_OUTPUT_FILE}" + "${MASTER_OUTPUT_FILE}" \ + "${MASTER_BALANCE_OUTPUT_FILE}" ''' } } @@ -106,7 +120,7 @@ pipeline { stage('Archive PDFs') { steps { archiveArtifacts( - artifacts: "${OUTPUT_FILE},${BALANCE_OUTPUT_FILE},${MASTER_OUTPUT_FILE}", + artifacts: "${OUTPUT_FILE},${BALANCE_OUTPUT_FILE},${MASTER_OUTPUT_FILE},${MASTER_BALANCE_OUTPUT_FILE}", fingerprint: true ) } @@ -154,12 +168,12 @@ pipeline { publishChecks( conclusion: 'SUCCESS', name: 'Build Successful', - summary: 'The Ravenous rulebook, master handbook, and balance report were built successfully.', - text: 'All three PDFs were compiled and published successfully.', + summary: 'The Ravenous rulebook, master handbook, and balance reports were built successfully.', + text: 'All four PDFs were compiled and published successfully.', title: 'Build Successful' ) - echo '✅ Ravenous books and balance report built and published!' + echo '✅ Ravenous books and balance reports built and published!' } failure { @@ -193,7 +207,8 @@ pipeline { * Publish the generated Ravenous PDFs. * * Build artifacts retain explicit CI names in Jenkins, while published copies - * use stable rulebook, master-handbook, and balance-report names. + * use stable rulebook, master-handbook, and balance-report names. Master-facing + * PDFs are encrypted before either step. * * @param targetDir Directory receiving the compiled book. */ @@ -201,7 +216,7 @@ def deployTo(String targetDir) { sh """ set -e - echo "Publishing Ravenous, its master handbook, and its balance report to ${targetDir}" + echo "Publishing Ravenous, its master handbook, and its balance reports to ${targetDir}" mkdir -p "${targetDir}" @@ -217,10 +232,15 @@ def deployTo(String targetDir) { "${env.MASTER_OUTPUT_FILE}" \ "${targetDir}/${env.MASTER_PUBLISHED_FILE}" + rsync -a \ + "${env.MASTER_BALANCE_OUTPUT_FILE}" \ + "${targetDir}/${env.MASTER_BALANCE_PUBLISHED_FILE}" + echo "Published:" ls -lh \ "${targetDir}/${env.PUBLISHED_FILE}" \ "${targetDir}/${env.BALANCE_PUBLISHED_FILE}" \ - "${targetDir}/${env.MASTER_PUBLISHED_FILE}" + "${targetDir}/${env.MASTER_PUBLISHED_FILE}" \ + "${targetDir}/${env.MASTER_BALANCE_PUBLISHED_FILE}" """ } diff --git a/README.md b/README.md index ee3f838..c475dee 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,9 @@ typst compile balance_report_master.typ balance_report_master.pdf Its sections are enabled in `data/config/balance_report_master.yaml`. The initial report covers common creature profiles, rewards, and regional difficulty; later creature-specific analyses can be added independently. + +In CI, this report is handled like the master handbook: Jenkins compiles a +temporary plaintext PDF, protects it with `qpdf` and `MASTER_PASSWORD`, deletes +the plaintext intermediate, then archives and publishes only +`Ravenous_master_balance_report_build.pdf`. The stable deployed filename is +`Ravenous_master_balance_report.pdf`. diff --git a/data/config/balance_report_master.yaml b/data/config/balance_report_master.yaml index ade44d8..6ca9a59 100644 --- a/data/config/balance_report_master.yaml +++ b/data/config/balance_report_master.yaml @@ -15,9 +15,11 @@ regional_map: image: /images/maps/full_map.png regions: Treorst: + theme: treorst # The regional cartouche sits offshore; anchor_* points to the land. x: 57 y: 39 + elbow_x: 61 anchor_x: 66 anchor_y: 47 subregions: @@ -26,3 +28,68 @@ regional_map: Thenet: { x: 78, y: 49 } Ebil: { x: 74, y: 58 } Kraorst: { x: 66, y: 61 } + Arendörst: { x: 63, y: 53 } + Khateb: { x: 71, y: 62 } + Steingrund: + theme: steingrund + x: 43 + y: 11 + elbow_x: 48 + anchor_x: 55 + anchor_y: 23 + subregions: + Eiword: { x: 58, y: 12 } + Eistein: { x: 51, y: 14 } + Akranoï: { x: 45, y: 24 } + Amaronsaen: { x: 52, y: 28 } + Stornsten: { x: 50, y: 36 } + Einlinsti: { x: 60, y: 29 } + Yarkatoi: { x: 66, y: 25 } + Karadrien: { x: 74, y: 17 } + Fangrdaël: + theme: fangdrael + x: 39 + y: 45 + elbow_x: 36 + anchor_x: 34 + anchor_y: 61 + subregions: + Mako: { x: 51, y: 72 } + Adasaën: { x: 25, y: 51 } + YonSen: + theme: yon-sen + x: 89 + y: 20 + elbow_x: 86 + anchor_x: 88 + anchor_y: 34 + subregions: + Karoi Jin: { x: 89, y: 29 } + Tayun: { x: 91, y: 39 } + Ayan Ojoshi: { x: 81, y: 43 } + Dreikinsteps: + theme: drekinsteps + x: 29 + y: 10 + elbow_x: 25 + anchor_x: 20 + anchor_y: 22 + subregions: {} + Anankar: + theme: anankar + x: 86 + y: 76 + elbow_x: 81 + anchor_x: 73 + anchor_y: 70 + subregions: + Ajanshaien: { x: 69, y: 64 } + Akh Shära: { x: 68, y: 70 } + Draän: + theme: draan + x: 49 + y: 52 + elbow_x: 53 + anchor_x: 57 + anchor_y: 57 + subregions: {} diff --git a/data/src/db b/data/src/db index da4c1d1..93bef21 160000 --- a/data/src/db +++ b/data/src/db @@ -1 +1 @@ -Subproject commit da4c1d16c0fa20cb120bff8453da8cf088a58b8a +Subproject commit 93bef217af6586a73aa00bf45764bae84e6a7c81 diff --git a/setup/analysis/creature_common_report.typ b/setup/analysis/creature_common_report.typ index edb5d65..a3f15d4 100644 --- a/setup/analysis/creature_common_report.typ +++ b/setup/analysis/creature_common_report.typ @@ -5,6 +5,7 @@ #import "creature_common_metrics.typ": * #import "report_style.typ": chart-theme, metric-card, report-theme, rounded #import "../theme/tables.typ" as tables +#import "../theme/themes.typ" as themes #let dash(value, digits: 1) = if value == none { [—] } else { rounded(value, digits: digits) } #let compact-profile(profile) = ( @@ -426,7 +427,10 @@ let configured = if map-config == none { (:) } else { map-config.at("regions", default: (:)) } - let mapped = region-summaries.filter(item => item.region in configured) + let mapped = configured.keys().map(region => { + let summary = region-summaries.find(item => item.region == region) + if summary == none { (region: region, count: 0) } else { summary } + }) let map-source = if map-config == none { none } else { map-config.at("image", default: none) } @@ -444,18 +448,37 @@ #image(map-source, width: map-width, height: map-height) #for item in mapped { let coordinates = configured.at(item.region) + let region-theme-name = coordinates.at("theme", default: "steingrund") + let region-theme = if region-theme-name in themes.themes { + themes.make-theme(theme-name: region-theme-name) + } else { report-theme } + let subregion-color = region-theme.at("map-marker", default: region-theme.heading-accent) + let subregion-stroke = region-theme.at("map-marker-stroke", default: region-theme.parchment-light) let marker-size = 21pt + calc.min(item.count, 20) * 0.45pt let anchor-x = coordinates.at("anchor_x", default: coordinates.x) let anchor-y = coordinates.at("anchor_y", default: coordinates.y) + let elbow-x = coordinates.at("elbow_x", default: ( + coordinates.x + anchor-x + ) / 2) place( top + left, dx: map-x(coordinates.x), dy: map-y(coordinates.y), line( end: ( - map-x(anchor-x - coordinates.x), + map-x(elbow-x - coordinates.x), 0pt, + ), + stroke: 1.1pt + region-theme.heading, + ), + ) + place( + top + left, + dx: map-x(elbow-x), dy: map-y(coordinates.y), + line( + end: ( + map-x(anchor-x - elbow-x), map-y(anchor-y - coordinates.y), ), - stroke: 1.1pt + report-theme.chart-1, + stroke: 1.1pt + region-theme.heading, ), ) place( @@ -466,16 +489,16 @@ #circle( width: marker-size, height: marker-size, - fill: report-theme.chart-1.transparentize(8%), - stroke: 1.1pt + report-theme.parchment-light, + fill: region-theme.heading.transparentize(5%), + stroke: 1.1pt + region-theme.parchment-light, )[#align(center + horizon)[#text( size: 8pt, weight: "bold", fill: white, )[#item.count]]] #align(center)[#box( - fill: report-theme.parchment-light.transparentize(8%), - stroke: 0.45pt + report-theme.border, + fill: region-theme.parchment-light.transparentize(5%), + stroke: 0.45pt + region-theme.border, inset: (x: 3pt, y: 1pt), radius: 2pt, - )[#text(size: 6.5pt, weight: "bold", fill: report-theme.heading)[#item.region]]] + )[#text(size: 6.5pt, weight: "bold", fill: region-theme.heading)[#item.region]]] ], ) let configured-subregions = coordinates.at("subregions", default: (:)) @@ -491,15 +514,15 @@ box[ #circle( width: 6.4pt, height: 6.4pt, - fill: report-theme.chart-2, - stroke: 0.75pt + report-theme.parchment-light, + fill: subregion-color, + stroke: 0.75pt + subregion-stroke, ) #h(1.5pt) #box( - fill: report-theme.parchment-light.transparentize(7%), - stroke: 0.35pt + report-theme.border, + fill: region-theme.parchment-light.transparentize(5%), + stroke: 0.35pt + region-theme.border, inset: (x: 2pt, y: 0.6pt), radius: 1.5pt, - )[#text(size: 5.8pt, weight: "bold", fill: report-theme.heading)[ + )[#text(size: 5.8pt, weight: "bold", fill: region-theme.heading)[ #name · #amount ]] ], diff --git a/setup/theme/themes.typ b/setup/theme/themes.typ index e760623..63b0a2d 100644 --- a/setup/theme/themes.typ +++ b/setup/theme/themes.typ @@ -219,6 +219,47 @@ font: "Libertinus Serif", ), + treorst: ( + // Imperial court palette: royal purple, ceremonial gold, ivory and navy. + ink: rgb("#272238"), + muted-ink: rgb("#6D647A"), + gold: rgb("#C39A3D"), + dark-gold: rgb("#87651F"), + parchment: rgb("#F4EBD7"), + parchment-dark: rgb("#E5D4AE"), + parchment-light: rgb("#FFF9E9"), + parchment-accent: rgb("#EEDDB8"), + border: rgb("#C7A967"), + blood: rgb("#7C2348"), + muted: rgb("#786E7E"), + chart-1: rgb("#702A68"), // imperial purple + chart-2: rgb("#C39A3D"), // ceremonial gold + chart-3: rgb("#263F67"), // royal navy + chart-4: rgb("#9A3653"), // court crimson + map-marker: rgb("#1756A3"), // vivid royal blue, legible over Anankar + map-marker-stroke: rgb("#FFF9E9"), + + heading: rgb("#61245D"), + heading-accent: rgb("#A97F25"), + heading-subtle: rgb("#655B73"), + emphasis: rgb("#862750"), + link: rgb("#304E79"), + + heading-numbering: "1.", + section-symbol: "⚜", + chapter-symbol: "♛", + small-symbol: "✦", + bullet-symbol: "›", + separator-symbol: "❖", + + progress-full: "♛", + progress-half: "♕", + progress-void: "♔", + + star: "★", + font: "Libertinus Serif", + ), + anankar: ( //----- Base colors ----- ink: rgb("#3A3025"),