Skip to content

Latest commit

 

History

1,674 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PFRPG 2e: Kingdom Building, Camping & Weather

This module ships all OGL licensed rules to run the Kingdom, Camping and Weather rule systems for the most popular adventure for PFRPG 2e.

Documentation is included in a journal inside FoundryVTT!

Support

If you are having issues, you can either file an issue on GitHub or drop into our Discord Server (Channel)

Licensing

All PFRPG 2e content uses the Open Gaming License. If you find non OGL content, please file an issue and I'll get it removed ASAP. I've tried my best to scrub existing content, but there might still be leftovers.

The source code is licensed under the AGPLv3 license, except for the src/jsMain/kotlin/com/foundryvtt folder which is licensed under Apache License 2.0.

Art

In 5.13.0, all contributed AI generated images were removed to comply with Foundry's AI Content Policy. Instead, you can now configure an art directory in the module's settings which allows you to switch out backgrounds for the kingdom and camping sheet. If you are interested in restoring the previous behavior, you can download an archive containing the AI images and extract the containing folder into your Data/ directory. If you want to restore structures to their previous images as well, you need to do change them manually inside Foundry to use the provided images from the archive.

Installation

The package is available through the module registry

Functionality

This module ships with implementations for all the extra mechanics provided in the best sandbox PFRPG 2e adventure, including optional and popular homebrew from Vance & Kerenshara:

  • Camping Sheet
  • Kingdom Sheet
  • Weather
  • Combat Tracks

House Rules & GM Tips

You can look up my tips and house rules here

Official Module Integration

If you've enabled the official module, the following things are automatically taken care of:

  • Token Mappings for all companions and structures
  • Weather Sound Effects for rain, rainstorms, blizzard and snow
  • Default and Region combat tracks
  • Rolltable integration for:
    • Kingdom Events
    • Random Encounters
    • Cult Events

Screenshots

Kingdom Sheet

Settlements

camping sheet

Development

If you are interested in hacking on the code base, take a look at the Kotlin JS Primer for a quick intro on how to interact with the js api.

I highly recommend IntelliJ Idea Ultimate or IntelliJ Community Edition

Community Edition is free while Ultimate offers better integration. Scroll down a bit to find the Community Edition download link.

Windows Setup

Make sure you have FoundryVTT installed, and that you've launched it at least once to ensure all directories are created properly.

Install the following things:

  • git (pick all the default options)

  • node 24 click the green button named Windows Installer (.msi)

  • JDK 25 launch a Windows terminal and paste the following:

    winget install EclipseAdoptium.Temurin.25.JDK
    

Then, restart your PC.

Next, open your file explorer and paste the following path into the URL bar (CTRL + l):

%localappdata%/FoundryVTT/Data/modules/ 

This will take you to Foundry's modules folder. Inside the folder, right click onto an empty space and click Open Git Bash here (in Windows 11, that option is hidden under Show more options).

From now on, all commands will be run via the Git Bash instead of the Windows terminal.

Paste (right click -> paste) the following command into the Git Bash to install yarn:

npm install --global yarn

Then, download the code (if you are more well versed with Windows, you can probably also clone the code somewhere else and create a symlink):

git clone https://github.com/BernhardPosselt/pf2e-kingmaker-tools.git 

The folder pf2e-kingmaker-tools should now exist. Change into it:

cd pf2e-kingmaker-tools

If you don't have access to Transifex and aren't interested in becoming a translator, you need to create dummy localization files locally, otherwise the app won't load:

./gradlew createDummyTranslations

If you have access to Transifex, log into your Transifex account and retrieve your token from your account settings page. Then create your rc file using:

nano ~/.transifexrc

Paste the following contents and change TX_TOKEN to your token

[https://app.transifex.com]
rest_hostname = https://rest.api.transifex.com
token         = TX_TOKEN

Save the file with CTRL + o, then exit with CTRL + x.

Pull all translation files using:

./gradlew txPull

Then compile the application using:

./gradlew assemble

Now open FoundryVTT. The module should be listed as installed. You will need to run the assemble command again each time you change a file, git pull or pull translations from Transifex

You can pull the latest changes inside the folder using:

git pull

Linux & macOS Setup

Install the following things using your package manager or homebrew:

  • JDK 25
  • git
  • docker or podman

Ubuntu:

sudo apt install git openjdk-25-jdk

Arch:

sudo pacman -S git jdk25-openjdk yarn

macOS:

brew install --cask temurin@25

Then restart your machine for the JVM changes to take effect.

First, create a folder to clone the repository into:

mkdir dev
cd dev

Then, clone the repository:

git clone https://github.com/BernhardPosselt/pf2e-kingmaker-tools.git

Then link this directory to your foundry data folder:

Linux:

sudo mount --bind /home/bernhard/dev/pf2e-kingmaker-tools /home/bernhard/.local/share/FoundryVTT/Data/modules/pf2e-kingmaker-tools

If you want to automount it, add this to your /etc/fstab

/home/bernhard/dev/pf2e-kingmaker-tools /home/bernhard/.local/share/FoundryVTT/Data/modules/pf2e-kingmaker-tools none defaults,bind 0 0

If you don't have access to Transifex and aren't interested in becoming a translator, you need to create dummy localization files locally, otherwise the app won't load:

./gradlew createDummyTranslations

If you have access to Transifex, you need to pull all language files from Transifex where TX_TOKEN is obtained from your account settings page. Create your rc file using:

nano ~/.transifexrc

Paste the following contents and change TX_TOKEN to your token

[https://app.transifex.com]
rest_hostname = https://rest.api.transifex.com
token         = TX_TOKEN

Save the file with CTRL + o, then exit with CTRL + x.

Pull all translation files using:

./gradlew txPull

Then compile the application using:

./gradlew assemble

or if you want to both build it and run its tests:

./gradlew build

To execute tests run:

./gradlew jsTest

Finally, start Foundry.

You can release a new version by changing the version in build.gradle.kts and then executing:

GITHUB_TOKEN="token_here" FOUNDRY_TOKEN="token_here" ./gradlew foundryvttRelease

Finally, start your local FoundryVTT instance using the provided Dockerfile and a compose file looking roughly like this:

services:
  foundry:
    build:
      context: .
      args:
        TIMED_URL: "https://r2.foundryvtt.com/releases/13.351/FoundryVTT-Node-13.351.zip?verify=secret"
    ports:
      - "30000:30000"
    volumes:
      # needs to be owned by user 1000:1000
      - "/home/bernhard/.local/share/FoundryVTT/:/home/node/.local/share/FoundryVTT/"
docker compose build
docker compose up

Enable Schema Autocompletion Support in IntelliJ

Some files are in JSON rather than actual code. To get autocompletion for these in IntelliJ, you need to enable custom schemas.

In settings, go to Languages & Frameworks > Schemas and DTDs > JSON Schema Mappings.

Click on the + to add a new mapping for each schema. Then add the following (see a list of values further down below):

  • Name: Name of the Schema
  • Schema file or URL: Path to the Schema file in ./schemas/
  • Schema Version: Always JSON Schema version 7
  • Then click on the + below and Directory

Example:

  • : Recipes:
    • Name: Recipes
    • Schema file or URL: schemas/recipes.json
    • Directory: data/recipes

Translations

Help out as a Translator

If you want to help translating this module as a Translator open an issue on GitHub with your email and language or contact me on Discord, so I can send you an invite to the project on Transifex.

Don't edit the files in lang/ directly. Every file except for en.json will be overridden by changes from Transifex. Instead, edit the translations in Transifex.

You can pull changes either by setting up the project locally (check out the relevant Setup section above!):

./gradlew txPull
./gradlew assemble

or by manually downloading by clicking on your language in Transifex and choosing Download for use Then place the downloaded file into Data/modules/pf2e-kingmaker-tools/dist/lang/ru.json (adjust name depending on your translation). The location of the data folder depends on your Operating System. However, make sure to only perform this on your local dev instance and not on your hosted services due to security reasons: translations might include malicious HTML and those strings are only stripped when building the project.

A note on Lores: Lores in the 2e system can currently not be translated properly and if you use translated lores, you lose automation that matches on the lore name. You can use translated lores in this module by overriding activities and lores manually. Translations will be implemented once the 2e system allows for it

Help out as a Developer

This module skips the built-in Foundry translation system since it's broken and unusable. Nonetheless, you need to link your json files in the module.json file for each language, otherwise Foundry will not let you change your language in the settings.

Making Changes in Code

Translations are persisted in lang/en.json. DO NOT EDIT other translation files directly since they will be overridden by changes from Transifex. You can arbitrarily nest JSON values and reference them using the path. For instance:

{
  "key": {
    "something": "value"
  }
}

would be referenced using key.something. Translations can be parameterized:

{
  "key": {
    "something": "{greeting} to you"
  }
}

Plurals can be translated using ICU (with coins being passed as an int parameter):

{
  "key": {
    "something": "He paid {coins, plural, =0 {nothing} =1 {one coin} =other{# coins}} for his groceries"
  }
}

It's also possible to use different translations based on a parameter, e.g. gender (with gender being passed as either "male" or "female"; other is the catchall case):

{
  "key": {
    "something": "{gender, select, female {She} male {He} other {They}} went to the party"
  }
}

There are 2 places where you can translate strings:

In Kotlin code:

// single value
t("key.something")
// values with context
t("key.something", recordOf("greeting" to "hello"))

In Handlebars templates:

{{localizeKM "key.something"}}
{{localizeKM "key.something" greeting="hello"}}

Pushing Changes

Strings are not edited in the repository. Instead, they are pushed to Transifex first, edited and then pulled.

After you've made your changes in lang/en.json, you need to push it to your translators using:

./gradlew txPush

About

A collection of utilities to run the most popular PFRPG 2e sandbox adventure in FoundryVTT

Resources

Stars

30 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages