ebullient / ttrpg-convert-cli

Utility to convert JSON data (for content you own) from 5etools or pf2etools into Obsidian-friendly Markdown.
https://www.ebullient.dev/projects/ttrpg-convert-cli/
Apache License 2.0
202 stars 42 forks source link

Inline Dice Roller not consistently working with Statblocks🐛 #515

Closed gijstemp closed 3 months ago

gijstemp commented 3 months ago

Hi there, I'm using the latest versions of Obsidian, Fantasy Statblocks, and up-to-date data from 5etools. I just ran the CLI and it seems there are some irregularities with the inline dice roller in Fantasy Statblocks. It seems that only the HP Dice Roller initiates and the rest does not. Here is an image as an example: Giant Goat

Configuration

Sources: Config File:

{
  "from": [
    "PHB",
    "DMG",
    "SCAG",
    "BAM",
    "BMT",
    "DMTCRG",
    "ESK",
    "FTD",
    "MCV2DC",
    "MCV4EC",
    "MFF",
    "MM",
    "MPMM",
    "MTF",
    "MisMV1",
    "SCC",
    "TCE",
    "ToB1-2023",
    "UAWGE",
    "VGM",
    "XGE",
    "UltimateBestiaryTheDreadedAccursed"
  ],
  "template": {
    "background": "ttrpg-convert-cli/examples/templates/tools5e/images-background2md.txt",
    "monster": "ttrpg-convert-cli/examples/templates/tools5e/monster2md-yamlStatblock-body.txt",
    "item": "ttrpg-convert-cli/examples/templates/tools5e/images-item2md.txt",
    "race": "ttrpg-convert-cli/examples/templates/tools5e/images-race2md.txt",
    "spell": "ttrpg-convert-cli/examples/templates/tools5e/images-spell2md.txt"
  },
  "useDiceRoller": true
}

Monster Template:

---
obsidianUIMode: preview
cssclass: json5e-monster
statblock: inline
{#if resource.tags }
tags:
{#for tag in resource.tags}
- {tag}
{/for}
{/if}
aliases: ["{resource.name}"]
NoteIcon: monster
BestiaryType: {resource.fullType}
SourceType: Bestiary
BookSource: {resource.source}
---
# [{resource.name}]({resource.vaultPath})
*Source: {resource.source}*  

{#if resource.description }
{resource.description}

{/if}
\```statblock
{resource.5eStatblockYaml}
\```
^statblock

\```encounter-table
name: {resource.name}
creatures:
 - 1: {resource.name}
\```

{#if resource.environment }
## Environment

{resource.environment}
{/if}

Actual Monster Statblock (from Obsidian):

"name": "Giant Goat"
"size": "Large"
"type": "beast"
"alignment": "Unaligned"
"ac": !!int "11"
"ac_class": "natural armor"
"hp": !!int "19"
"hit_dice": "3d10 + 3"
"stats":
- !!int "17"
- !!int "11"
- !!int "12"
- !!int "3"
- !!int "12"
- !!int "6"
"speed": "40 ft."
"senses": "passive Perception 11"
"languages": ""
"cr": "1/2"
"traits":
- "desc": "If the goat moves at least 20 feet straight toward a target and then hits\
    \ it with a ram attack on the same turn, the target takes an extra dice:2d4|text(5)\
    \ (2d4) bludgeoning damage. If the target is a creature, it must succeed on\
    \ a DC 13 Strength saving throw or be knocked [prone](rules/conditions.md#prone)."
  "name": "Charge"
- "desc": "The goat has advantage on Strength and Dexterity saving throws made against\
    \ effects that would knock it [prone](rules/conditions.md#prone)."
  "name": "Sure-Footed"
"actions":
- "desc": "Melee Weapon Attack: dice: d20+5 (+5) to hit, reach 5 ft., one target.\
    \ Hit: dice:2d4 + 3|text(8) (2d4 + 3) bludgeoning damage."
  "name": "Ram"
"source":
- "MM"
- "SKT"
- "SLW"
- "IDRotF"
- "CoS"
- "WBtW"
- "QftIS"
"image": "https://raw.githubusercontent.com/5etools-mirror-2/5etools-img/main/bestiary/tokens/MM/Giant%20Goat.webp"
ebullient commented 3 months ago

There are two settings, and you need both (if you're using YAML statblocks):

  "useDiceRoller": true,
  "yamlStatblocks": true,
gijstemp commented 3 months ago

Ah I must have read that wrong in the documentation. Thanks for the quick reply.

ebullient commented 3 months ago

Ah I must have read that wrong in the documentation. Thanks for the quick reply.

I will happily accept PRs for docs to make something clearer.

https://github.com/ebullient/ttrpg-convert-cli/blob/main/docs/configuration.md