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
174 stars 37 forks source link

✨ Add support for custom properties (homebrew) #349

Open Stackclash opened 6 months ago

Stackclash commented 6 months ago

I have a homebrew that has a couple of custom properties for items. I would like to include these in the template.

"itemProperty": [
    {
        "name": "Herb",
        "source": "HHbH",
        "page": 5,
        "abbreviation": "Hrb",
        "template": "{@b Location:} {{item.customProperties.lcn}} {@b Requires Preparation:} {{item.customProperties.prep}}",
        "entries": []
    }
]

Hamund's Herbalism Handbook

Here is an example of an item with these properties:

{
    "name": "Sentry Bush",
    "source": "HHbH",
    "page": 30,
    "type": "Herb",
    "rarity": "common",
    "value": 100,
    "property": [
        "Hrb"
    ],
    "entries": [
        {
            "type": "entries",
            "name": "Description:",
            "entries": [
                "A scraggly brush found only on high altitudes, its bitter twigs produce an incredibly potent stimulant that when brewed into a tea, can completely replace one's need to sleep. Due to its inaccessible location, but widely sought-after use, mountain clans are often found carrying them in their caravan to trade to people that need to stay awake for long periods of time."
            ]
        },
        {
            "type": "entries",
            "name": "Effect:",
            "entries": [
                "After preparing this herb, you gain all the benefits of 8 hours of sleep (or the equivalent form of dormancy for your race). You still need to rest for at least 8 hours in order to benefit from a long rest."
            ]
        }
    ],
    "customProperties": {
        "lcn": "Mountain",
        "prep": "Yes"
    },
    "foundryType": "consumable"
}

Hamund's Herbalism Handbook

ebullient commented 6 months ago

Item properties are absolutely already taken into account provided they are in the right format in _meta. The Herbalism Handbook works properly, IIRC.

The meta for that handbook does not include a description. This shows in rules/item-properties.md:

### Herb
_Source: Hamund's Herbalism Handbook p. 5_

And items are linked to it:

# Aboleth Stalk
*Herb, rare, Herb*  

- **Properties**: [Herb](rules/item-properties.md#Herb)
- **Cost**: 500 gp

What is missing?

Stackclash commented 6 months ago

@ebullient the properties for "Location" and "Requires Preparation". image

"customProperties": {
    "lcn": "Mountain",
    "prep": "Yes"
}

The lcn and prep keys.

ebullient commented 6 months ago

ok. A different kind of custom properties. ;)

Herb is, in and of itself, a custom Item property (at a macro level), so I didn't see the detail that you meant.

Always item template usage?

Stackclash commented 6 months ago

I'm imagining something along the lines of the following in the item template:

Location: {resource.custom.lcn}
Requires Preparation: {resource.custom.prep}
revilowaldow commented 5 months ago

Always item template usage?

Not necessarily, if you wanted a stress test try https://github.com/TheGiddyLimit/homebrew/blob/master/magicvariant/aeyana%3B%20Gemstones.json Which includes customProperties mixed with itemEntry and variant generation. Clock the hasRefs flag.

image

image

Basically this one '''item''' explodes to 46 items on the site

image See video: https://github.com/ebullient/ttrpg-convert-cli/assets/52298102/9a0a3e25-8329-413e-aeee-f88c3a14693b