Git Product home page Git Product logo

obsidian-13a-monster-parser's Introduction

13th Age Monster Parser for Obsidian

/!\ Currently WIP, but the barebones parser should work (follow the instructions in How to Use)

A QuickAdd template, intended to be used to parse 13th Age monster statblocks from books (as pdf, both 1st and 3rd party) and display them using Fantasy Statblocks.

Notes

This repo does not include any actual statblocks, the tools within are to be used to parse statblocks and create them in your own vault. In the future (meaning, when this parser is working, and we started using it to actually parse monsters), I recommend checking out the Obsidian TTRPG Community's 13th Age SRD repo to find monster statblocks and rules related to 13th Age.

Dependencies

  • CustomJS: to run the parser's Javascript from a dedicated script file
  • QuickAdd: to create a file from the template via prompters
  • Fantasy Statblocks: to render the statblocks

How to Use

First Setup

  1. Install and enable the needed dependencies in your vault
  2. From this repo, download the assets folder and its content, and put them somewhere in your vault (I like having an assets dir at the root of my vaults to group this kind of files and be able to locate them easily with core functionnalities and plugins). The suggested structure is:
assets
  |- scripts
  |   |- 13A-monster-parser.js
  |- templates
      |- monster-statblock-parser.md
  1. In the CustomJS config, in the Individual Files field, put [/path/from/vault/root]/assets/scripts/13A-monster-parser.js (or the path you've chosen pointing to the parser's JS file)
  2. In the QuickAdd config:
    1. Put the path to your template folder (containing the template from this repo) in the Template Folder Path field
    2. Create a Template choice, named however you want (e.g. 13th Age Monster Parser)
    3. Click on Configure [template-name] (in the list of choices, the small cog right of your newly created choice), then
      1. In Template Path, put the path to the template (the field is a suggester, so you can type 13A-monster-[etc.] to find it easily)
      2. Enable File Name Format, then put {{value}} in the field
      3. Enable Create in Folder (to be able to choose where the new file will be created), then configure which folder you want for that
        • Enabling Choose Folder when creating a note allows you to put the new note anywhere in your vault, or
        • Disabling that, and selecting a few dedicated folders can help you centralise your monsters
      4. Disable Create in same folder as active file
      5. Disable Append Link
      6. Enable Set default behavior if file exists, and choose None, so that you don't overwrite your existing monsters when you import a new one (this can happen if 3rd party publishers choose the same name as an official monster, or 2 publishers name their monsters the same, or if you import the same monster by accident)
      7. You can enable Open, and then select Source to open the newly imported monster when finished (to check that everything was imported correctly)
      8. For New Split, choose which behavior you prefer (I prefer disabling it)
      9. Enable Focus new pane to focus the newly created note when finished
  3. In the Fantasy Statblocks config:
    1. If you're prepping for a 13th Age campaign, I suggest putting the Default Layout config to Basic 13th Age Monster Layout so that you don't have to add the layout: Basic 13th Age Monster Layout line to your statblock YAML config everytime.
    2. For the rest, the module can do a lot more than just rendering statblocks, so configure it to your needs and liking.

Example of QuickAdd config:

Parsing a monster

From the SRD

First,

Then, setup CustomJS and QuickAdd following the instructions. For QuickAdd, there are 2 options provided:

  1. manually Copy/Paste the raw text from the page in your browser -> Use 13A-srd-monster-statblock-parser.md as the QuickAdd template
  2. After downloading the full page of monsters (I recommend using https://github.com/deathau/markdownload which will retain the HTML for the monster's table), copy/paste the HTML code for the monster -> Use 13A-srd-monster-statblock-html-parser.md as the QuickAdd template

Then, you can trigger QuickAdd to create a new note using the option you just created.

Here's an example of import from the SRD's HTML:

parse-dragon-from-html-table.mp4

From a PDF (1st or 3rd Party)

For now, the parser only exists as a minimalist set of prompters. In order, the parser will prompt you for:

  1. The monster's Description
    • This is the top of the statblock, which contains: the Monster's Name, its Flavor text, the "Strength" line (e.g. Large 8th level wrecker [giant] for the Fire Giant), its Initiative bonus and its potential Vulnerability
    • /!\ Important manual step: Make sure that the monster's name on its entirety is on the first line, because the parser has no way of distinguishing between a potential second line of the monster's name and the start of it's flavor text
  2. The monster's Attacks
    • All the lines containing attacks, including any [Special Triggers] if there are any present
    • The expected format is [Attack Name] [Attack Bonus] vs. [Target's Defense] [(Any additional info, like # of targets)]โ€”[Effect]
    • /!\ Important manual step 1: All attacks' names must be on 1 line (until and including the em-dash), because the parser cannot distinguish between the start of a new attack line and the end of a potential description or trait from a previous attack. The description can be on multiple lines.
    • /!\ Important manual step 2: If there are any traits to the attack (expected format [Trait Name/Roll trigger]: [trait effect]), their name must be on a single line (up to and including the semicolon), because the parser cannot distinguish between the start of... same thing as the attacks.
  3. The monster's Traits, if any
    • Any traits not linked to an attack
    • /!\ Important manual step: If there are any traits (expected format [Trait Name/Roll trigger]: [trait effect]), their name must be on a single line (up to and including the semicolon), because the parser cannot distinguish between the start of... same thing as above.
  4. The monster's "Nastier Specials", if any
    • Any traits grouped under the Nastier Specials heading
    • /!\ Important manual step: If there are any traits (expected format [Trait Name/Roll trigger]: [trait effect]), their name must be on a single line (up to and including the semicolon), because the parser cannot distinguish between the start of... same thing as above.
    • /!\ Important note: If a nastier adds an attack to the monster, do not put it in this prompt. The parser will not be able to interpret it correctly, put it in the next section
  5. the monster's "Special Triggers", if there are some not included in its attacks
    • Sometimes, a trait will have a triggered action that is not labeled [Special Trigger] (looking at you, Fire Giant and the nastier Strength of Giants). Just put every remaining attacks in this prompt
  6. the monster's Defenses
    • AC, PD, MD and HP. If you copy paste from a book, they should be on a line each. If not, manually put each on their dedicated line.

After that, the prompter should close, and your newly imported monster's note should open inn your current Obsidian view. If you get an error message during the process, check the format of the blocks (the parser usually throws an exception in the middle if something goes wrong), and if it still doesn't work, open an issue here with the incriminating statblock, and I'll take a look at it.

Here's a picture showing which part of the monster's statblock is which block:

example-blocks-fire-giant.png

ToDo

In no particular order:

  • Write parser for the various blocks in a monster Statblock
    • Monster Desc,
    • Attacks
    • (including Triggered Attacks),
    • Traits,
    • Nastier Specials,
    • Defenses
  • Write the YAML Writer
    • Monster Desc,
    • Attacks
    • (including Triggered Attacks),
    • Traits,
    • Nastier Specials,
    • Defenses
  • Write a barebones QuickAdd prompter
    • Intended order of prompting:
    • Monster Desc,
    • Attacks
    • (including Triggered Attacks),
    • Traits,
    • Nastier Specials,
    • Defenses
  • Put all that in a Markdown file to be used as a QuickAdd template
  • Write a cleaned-up prompter with which you can choose which block to parse next
  • Add a prompter to manually enter single attacks or partial attack blocks (triggered or not) and traits (because the 13A official statblock format is only 90% standardized >.> )
  • Create a Templater variant that can add partial monster data.
  • Add a full parsing example with pictures and explicative text.

obsidian-13a-monster-parser's People

Contributors

freohr avatar sigrunixia avatar

Watchers

 avatar  avatar

Forkers

sigrunixia

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.