WLC Format
WeaveLore can load any content, not just the default spells and rules, as long as it's presented in a format it understands. This page defines this format, which we will call WLC (from WeaveLore Content).
WLC is simply a JSON file with a particular structure. Here is a simple example of a WLC database with a single spell and a single rule:
{
"format": "WLC",
"formatVersion": "0.3.0",
"sources": [
{
"name": "John Doe's Homebrew",
"description": "This is homebrew content created by John Doe. Find more at johndoe.com.",
"version": 1,
"spells": [
{
"name": "Nuke",
"classes": ["wizard", "sorcerer"],
"school": "evocation",
"level": 9,
"range": "120 feet",
"duration": "Instantaneous",
"casting": "1 action",
"verbal": true,
"somatic": true,
"material": 2,
"materials": "Uranium worth at least 1000 gp",
"concentration": false,
"ritual": false,
"description": "<p>This is one paragraph.</p><p>This is another paragraph.</p>",
"aoe": {
"type": "sphere",
"radius": 80
}
}
],
"rules": [
{
"name": "Tired",
"icon": "stars",
"category": "Condition",
"tags": ["energy"],
"description": "<p>This is one paragraph.</p><p>This is another paragraph.</p>"
}
]
}
]
}
You can save the above text as a JSON file and you should be able to import it.
You can find below a detailed description of each field, which will attempt to be precise and unambiguous to ensure your content remains compatible and issue-free in the long term. The application will automatically validate many of these restrictions for you, but not all of them.
[String] Must always contain the string WLC
. It is used as a simple and instant way to tell whether a file contains WeaveLore content.
[String] Determines which version of the WLC format the file was created for. You must use the same you see in this guide.
[Array] An array that represents where each group of spells comes from. For example, a user could have one source for the SRD, another for a fan-made expansion pack, and another for their homebrew content. If you're making custom content to share, you'll normally define a single source. If you're backing up your database, there will normally be many sources.
When WeaveLore imports a file, it imports all the sources within the file into the local database. If a source with a given name already exists, one of two things will happen:
- If the new source has a version number equal or greater, it will overwrite the preexistent source
- If not, this source will be ignored
[String] The name of the source. It must be short (no more than 32 characters).
[String] A brief description about the contents of this source. You should include some information that allows users to know who published this file, in case they want to look for updates.
[Number] A version number you yourself assign to your source. The number must be an integer and increment by one every time you publish an updated version of your content.
[Array] The list of spells that this source includes.
[Array] The list of rules that this source includes.
For fields that accept HTML (like description
, materials
, and atHigherLevels
), consider the following restrictions:
- You must not use HTML tags other than paragraphs (
<p>
), unordered lists (<ul> <li>
), tables (<table> <thead> <tbody> <tr> <th> <td>
), italics (<i>
) and bold (<b>
). - Your HTML must be valid (no unclosed tags, etc).
- You must not add any attributes to the tags.
If you're looking to convert an existing JSON spell list into WLC, the following tips might help:
-
material
can usually be programatically inferred from the material list. If it containsconsumes
, it's almost certainly a type3
. If the spell containsgp
, it's almost certainly a type2
. - The only field you will probably have to add manually is
aoe
, but it is optional, so you can first give your source a try without using it.
- You may be able to load content that doesn't follow the restrictions above, but it may cease to work at any time. More stringent automatic validations will be performed in future versions.
- You might notice that the application internally adds some additional attributes to each spell:
downcasedName
andcodename
. Since these are auto-generated when imported, they must not be present in WLC files. - Due to browser security features (namely CORS), importing from external URLs only works on servers that set the
Access-Control-Allow-Origin
HTTP header. - If you have any question about this format or would like to propose a change, feel free to ask on the subreddit.