Compare commits
No commits in common. "main" and "1.2.1" have entirely different histories.
2 changed files with 11 additions and 26 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "dh-importer",
|
"id": "dh-importer",
|
||||||
"title": "Daggerheart Statblock Importer",
|
"title": "Daggerheart Statblock Importer",
|
||||||
"version": "1.2.2",
|
"version": "1.2.1",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13",
|
"minimum": "13",
|
||||||
"verified": "13"
|
"verified": "13"
|
||||||
|
|
@ -34,5 +34,5 @@
|
||||||
"description": "Imports Adversaries and Environments from text blocks into the Daggerheart system.",
|
"description": "Imports Adversaries and Environments from text blocks into the Daggerheart system.",
|
||||||
"url": "https://github.com/cptn-cosmo/dh-importer",
|
"url": "https://github.com/cptn-cosmo/dh-importer",
|
||||||
"manifest": "https://git.geeks.gay/cosmo/dh-importer/raw/branch/main/module.json",
|
"manifest": "https://git.geeks.gay/cosmo/dh-importer/raw/branch/main/module.json",
|
||||||
"download": "https://git.geeks.gay/cosmo/dh-importer/releases/download/1.2.2/dh-importer.zip"
|
"download": "https://git.geeks.gay/cosmo/dh-importer/releases/download/1.2.1/dh-importer.zip"
|
||||||
}
|
}
|
||||||
|
|
@ -279,19 +279,8 @@ export class DHImporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
static _parseExperienceLine(line, data) {
|
static _parseExperienceLine(line, data) {
|
||||||
// Handle "Experience: Manipulate +2, Infiltrate +2" or "Knowledge (Arcana, History) +2"
|
// "Ambusher +3"
|
||||||
const parts = line.split(",");
|
const match = line.match(/(.+?)\s+([+-]?\d+)$/);
|
||||||
let buffer = "";
|
|
||||||
|
|
||||||
for (let part of parts) {
|
|
||||||
buffer = buffer ? buffer + "," + part : part;
|
|
||||||
|
|
||||||
// Check if buffer matches "Name +Value"
|
|
||||||
// We trim to handle spaces around commas
|
|
||||||
const trimmed = buffer.trim();
|
|
||||||
// Regex to match "Name +Value" at the end of the string
|
|
||||||
const match = trimmed.match(/(.+?)\s+([+-]?\d+)$/);
|
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const currentCount = Object.keys(data.system.experiences).length;
|
const currentCount = Object.keys(data.system.experiences).length;
|
||||||
const key = "exp" + currentCount;
|
const key = "exp" + currentCount;
|
||||||
|
|
@ -299,12 +288,8 @@ export class DHImporter {
|
||||||
name: match[1].trim(),
|
name: match[1].trim(),
|
||||||
value: parseInt(match[2])
|
value: parseInt(match[2])
|
||||||
};
|
};
|
||||||
// Reset buffer as we found a complete experience
|
|
||||||
buffer = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If buffer remains (e.g. "Some Trait" without number), it is ignored, consistent with previous behavior.
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to create feature item data
|
* Helper to create feature item data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue