From 9cacbbbad4e2ac216e3a6f264890091ae95ec591 Mon Sep 17 00:00:00 2001 From: CPTN Cosmo Date: Fri, 23 Jan 2026 20:15:19 +0100 Subject: [PATCH] minor bugfix for close button mainly --- module.json | 4 ++-- scripts/app.js | 2 +- scripts/importer.js | 10 +--------- styles/importer.css | 6 +++--- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/module.json b/module.json index a68e00d..35cba3e 100644 --- a/module.json +++ b/module.json @@ -1,7 +1,7 @@ { "id": "dh-importer", "title": "Daggerheart Importer", - "version": "1.0.0", + "version": "1.0.1", "compatibility": { "minimum": "13", "verified": "13" @@ -34,5 +34,5 @@ "description": "Imports Adversaries and Environments from text blocks into the Daggerheart system.", "url": "https://github.com/cptn-cosmo/dh-importer", "manifest": "https://git.geeks.gay/cosmo/dh-importer/raw/branch/main/module.json", - "download": "https://git.geeks.gay/cosmo/dh-importer/releases/download/1.0.0/dh-importer.zip" + "download": "https://git.geeks.gay/cosmo/dh-importer/releases/download/1.0.1/dh-importer.zip" } \ No newline at end of file diff --git a/scripts/app.js b/scripts/app.js index e8b2543..0899031 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -86,7 +86,7 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) { static async onImport(event, target) { try { - const formData = new FormDataExtended(this.element).object; + const formData = new foundry.applications.ux.FormDataExtended(this.element).object; for (const actor of this.parsedData) { actor.useFeatures = {}; diff --git a/scripts/importer.js b/scripts/importer.js index 651158e..6ad5614 100644 --- a/scripts/importer.js +++ b/scripts/importer.js @@ -165,18 +165,12 @@ export class DHImporter { } else if (prevLine.match(/STRESS:/i)) { data.system.resources.stress.max = val; } else if (prevLine.includes("minor") || prevPrevLine.includes("minor")) { - data.system.damageThresholds.minor = val; // System doesn't have minor usually? - // Wait, Daggerheart system model: major, severe. Minor is usually just 1 HP. - // But let's check input: "minor \n 1 HP \n 9". 9 is likely the threshold. - // However, data.system.damageThresholds usually only stores Major/Severe in Foundry system? - // Let's assume we ignore minor or map it if valid. + data.system.damageThresholds.minor = val; } else if (prevLine.includes("major") || prevPrevLine.includes("major")) { data.system.damageThresholds.major = val; } else if (prevLine.includes("severe") || prevPrevLine.includes("severe")) { data.system.damageThresholds.severe = val; } else if (prevLine.includes("HP")) { - // "1 HP" / "2 HP" lines often precede thresholds - // If we see "9" after "1 HP", check if "minor" was before that. if (prevPrevLine.includes("minor")) { /* ignore or store */ } if (prevPrevLine.includes("major")) data.system.damageThresholds.major = val; if (prevPrevLine.includes("severe")) data.system.damageThresholds.severe = val; @@ -225,8 +219,6 @@ export class DHImporter { if (firstColon > -1) { const name = line.substring(0, firstColon).trim(); const rest = line.substring(firstColon + 1).trim(); - // "Melee 1d8+3 phy" -> split by first space? or known ranges? - // Heuristic: Range is usually one word (Melee, Close, Far) const rangeMatch = rest.match(/^(\w+)\s+(.*)$/); if (rangeMatch) { parts = [name + ":" + rangeMatch[1], rangeMatch[2]]; diff --git a/styles/importer.css b/styles/importer.css index 325ef85..aad3c84 100644 --- a/styles/importer.css +++ b/styles/importer.css @@ -77,7 +77,7 @@ font-size: 1.1em; } -.dh-importer-app button { +.dh-importer-app .window-content button { background: linear-gradient(180deg, #5b1c1c 0%, #3a0e0e 100%); border: 1px solid #7a6a4a; color: #ffd700; @@ -90,14 +90,14 @@ transition: all 0.2s; } -.dh-importer-app button:hover { +.dh-importer-app .window-content button:hover { background: linear-gradient(180deg, #7a2828 0%, #561414 100%); box-shadow: 0 0 8px #cbb484; text-shadow: 0 0 5px #ffd700; border-color: #ffd700; } -.dh-importer-app button i { +.dh-importer-app .window-content button i { margin-right: 5px; }