Skip to content

Commit

Permalink
kdl-unofficial-template:0.1.0 (#1787)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Heuschober <[email protected]>
  • Loading branch information
epsilonhalbe and mh-trimble authored Mar 7, 2025
1 parent af17f4a commit 20703a2
Show file tree
Hide file tree
Showing 19 changed files with 1,023 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/preview/kdl-unofficial-template/0.1.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Martin Heuschober

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
111 changes: 111 additions & 0 deletions packages/preview/kdl-unofficial-template/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# KULT: Divinity Lost unofficial scenario template

This is a typst template for the horror tabletop RPG 'KULT: Divinity Lost'.
It has been designed based on the LaTeX scenario template for Ryan Northcott's memorial scenarios.
The scenario is made for A4 paper and uses the [Mathison](https://www.dafontfree.io/mathison-typeface/) and the [Ubuntu Sans](https://github.com/canonical/Ubuntu-Sans-fonts/releases) font.

To publish a scenario for 'KULT: divinity lost' you must follow the [Helmgast AB - fan content policy](https://helmgast.se/en/meta/fan-content-policy)

> ## Warning
>
> Fonts are not included please download them from the links above and install
> them on your system OR unpack them in a local folder, e.g. `./main/assets/`
> and use the `--font-paths` command line option to compile.
The printer friendly version can be compiled with

```sh
typst compile my-scenario.typ --input printer-friendly=true
```

With a version

```sh
typst compile my-scenario.typ --input version="0.1.0"
```

Or combined

```sh
typst compile my-scenario.typ --input version="0.1.0" --input printter-friendly=true
```

This package provides a template and a few functions, see the example section for more details:

## Basic usage

```typst
#import "preview/kdl-unofficial-template:<version>" as kdl
#show: kdl.template
#kdl.pages.title.with(
title: "A tall tale",
author: "Baron von Münchhausen",
size: 64pt // optional
)()
#kdl.pages.blank
#kdl.pages.blank
#include("./chapters/01-intro.typ")
#include("./chapters/02-pre-gen.typ")
#include("./chapters/03-story.typ")
#bibliography("/template/bibliography.bib", full: true, style: "pensoft")
```

## extra functionality and customization

### Skill stuff

- `skill-tree( fort: 2, will: 1, refl: "0")` has named arguments `fort`, `will`, `refl`, `reas`, `char`, `intu`, `viol`, `perc`, `cool`, `soul` omitted arguments will just be left empty for the player to be filled in, when printing the skill tree.
- `attrs` a dictionary with `name` and `move` for each attribute (`fort`, `will`, `refl`, `reas`, `char`, `intu`, `viol`, `perc`, `cool`, `soul`, and `dis` for disadvantages), example usage `kdl.attrs.intu.name`, this is to mostly for consistency.

### Pageref

- `pageref(<label>)`: will display the page the label is found

### Styling

- `colors`: defines the following colors, these respect `printer-friendly`
- `primary`
- `secondary`
- `accent`
- `light`
- `dark`
- `text`
- `fonts` - defines the fonts for this template
- `title`: Mathison
- `normal`: Ubuntu
- `pages`
- `toc`: table of contents
- `blank`: a blank red page (omitted in printer friendly version)
- `title`: best use as follows
```
#kdl.pages.title.with(
title: "A tall tale",
author: "Baron von Münchhausen",
size: 64pt // optional
)()
```
- `is-printer-friendly`, if the printer-friendly option has been passed in
- `initialized` for initial letters/drop captions
- `move( title: [], tag: "", description: [])` allows you to define custom moves, advantages, disadvantages or custom moves, title and description can be any formatted content and will be left empty if omitted, label needs to be globally unique and is used to refer to a move e.g. with `pageref`.
Optionally you move has the following named fields:
- `attribute`: the attribute to roll for this move (e.g. `kdl.attrs.char.name`)
- `success`: description of the move's outcome on a success (15+), this can be any formatted content, including text, lists etc.
- `complications`: description of the move's outcome on a success with complications (10-14), this can be any formatted content
- `failure`: description of the move's outcome when the roll is failed (9-), this can be any formatted content
- `more`: any additional formatted content, e.g. list of options or edges
### Trackers
Boxes to tick
- `experience`
- `advancements`
- `stability`
- `wounds`
#
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions packages/preview/kdl-unofficial-template/0.1.0/lib/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#import "./src/pageref.typ": pageref
#import "./src/skills.typ": skill-tree, attrs
#import "./src/style.typ": colors, fonts, pages, is-printer-friendly, initialized, move
#import "./src/trackers.typ": advancements, experience, stability, wounds

#let template(doc) = [
#set page(
paper: "a4",
margin: (
top: 1.5cm,
inside: 1cm,
outside: 2.0cm,
bottom: 1.75cm
),
footer-descent: 1cm,
footer: context(
place(
center + horizon,
dy: -0.4cm,
dx: if calc.even(here().page()) { -10.3cm } else { 10.3cm },
block(width: 1.5cm, height: 1.5cm,
align(center + horizon,
text(
font: fonts.title,
fill: colors.secondary,
size: 32pt,
counter(page).display(),
)
)
)
)
),
background:
if not is-printer-friendly {
context(
if here().page() == 1 {
image("./assets/img/bg_title.jpg")
} else if calc.even(here().page()) {
image("./assets/img/bg_left.jpg")
} else {
image("./assets/img/bg_right.jpg")
})
}
)

#set par(justify: true)
#set text(size: 9pt, font: fonts.normal)
#set list(indent: 1em)
#set heading(numbering: "1.1")

#show heading: it => {
if (it.level == 1) {
set text(
font: fonts.title,
fill: colors.secondary,
size: 40pt,
)
if not is-printer-friendly {
pagebreak(weak:true, to: "even")
set page(background: image("./assets/img/bg_section.jpg"))
align(horizon, it)
pagebreak()
} else { it }
}
if (it.level == 2) {
context[
#set align(if (calc.even(here().page())) { left } else { right })
#set text(
font: fonts.title,
fill: colors.dark.lighten(15%),
size: 22pt,
)
#block(width: 100%, stroke: (bottom: colors.primary + 2pt), inset:
(bottom: 2mm))[
#it.body
]]
}
if (it.level == 3) {
block(text(size: 16pt, fill: colors.primary, it.body))
}
if (it.level == 4) {
block(width: 100%, stroke: (bottom: colors.secondary + 2pt),
box(stroke: if is-printer-friendly { 2pt }, fill: if not is-printer-friendly {colors.secondary},inset: 2mm )[$suit.diamond$ #it.body]
)
}
}
#doc
]
Loading

0 comments on commit 20703a2

Please sign in to comment.