Going back to the input from the preview no longer empties the textfield, allowing for easier edits before importing
This commit is contained in:
parent
b6a1af9926
commit
3e9bc42ca4
4 changed files with 19 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "dh-importer",
|
"id": "dh-importer",
|
||||||
"title": "Daggerheart Statblock Importer",
|
"title": "Daggerheart Statblock Importer",
|
||||||
"version": "1.1.1",
|
"version": "1.2.0",
|
||||||
"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.1.1/dh-importer.zip"
|
"download": "https://git.geeks.gay/cosmo/dh-importer/releases/download/1.2.0/dh-importer.zip"
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,7 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
this.step = "input";
|
this.step = "input";
|
||||||
this.parsedData = null;
|
this.parsedData = null;
|
||||||
this.parsedDataType = null;
|
this.parsedDataType = null;
|
||||||
|
this.inputText = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
|
|
@ -45,7 +46,8 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
types: {
|
types: {
|
||||||
adversary: "Adversary",
|
adversary: "Adversary",
|
||||||
environment: "Environment"
|
environment: "Environment"
|
||||||
}
|
},
|
||||||
|
inputText: this.inputText
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,6 +77,9 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
const text = form.querySelector("textarea[name='text']").value;
|
const text = form.querySelector("textarea[name='text']").value;
|
||||||
const type = form.querySelector("select[name='type']").value;
|
const type = form.querySelector("select[name='type']").value;
|
||||||
|
|
||||||
|
// Store input text
|
||||||
|
this.inputText = text;
|
||||||
|
|
||||||
if (!text) {
|
if (!text) {
|
||||||
ui.notifications.warn("Please enter text to import.");
|
ui.notifications.warn("Please enter text to import.");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -314,10 +314,18 @@ export class DHImporter {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isAction) {
|
if (isAction) {
|
||||||
|
// Determine if this is an attack or a generic ability
|
||||||
|
const isAttack = buffer.description.match(/make.*?attack/i) ||
|
||||||
|
buffer.description.match(/(?:deal|inflict|take)\s+(\d+(?:d\d+)?(?:[\s]*[\+\-][\s]*\d+)?)\s+(direct\s+)?(\w+)\s+damage/i);
|
||||||
|
|
||||||
|
const actionType = isAttack ? "attack" : "ability";
|
||||||
|
const rollType = isAttack ? "attack" : "ability";
|
||||||
|
|
||||||
const actionId = foundry.utils.randomID();
|
const actionId = foundry.utils.randomID();
|
||||||
|
|
||||||
const action = {
|
const action = {
|
||||||
_id: actionId,
|
_id: actionId,
|
||||||
type: "attack",
|
type: actionType,
|
||||||
name: buffer.name,
|
name: buffer.name,
|
||||||
actionType: "action",
|
actionType: "action",
|
||||||
img: "icons/svg/item-bag.svg",
|
img: "icons/svg/item-bag.svg",
|
||||||
|
|
@ -327,7 +335,7 @@ export class DHImporter {
|
||||||
damage: { parts: [], includeBase: false, direct: false },
|
damage: { parts: [], includeBase: false, direct: false },
|
||||||
range: "",
|
range: "",
|
||||||
roll: {
|
roll: {
|
||||||
type: "attack", // Default to attack
|
type: rollType,
|
||||||
diceRolling: { multiplier: "flat", dice: "d6" }
|
diceRolling: { multiplier: "flat", dice: "d6" }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<div class="form-group" style="flex: 1;">
|
<div class="form-group" style="flex: 1;">
|
||||||
<label>Paste Statblocks</label>
|
<label>Paste Statblocks</label>
|
||||||
<textarea name="text" placeholder="Paste data here..."></textarea>
|
<textarea name="text" placeholder="Paste data here...">{{inputText}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="action-footer">
|
<div class="action-footer">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue