Skip to content

Commit

Permalink
update module.json, minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jbhaywood committed Aug 29, 2024
1 parent 2464cdb commit ade0e49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
13 changes: 3 additions & 10 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "5e-statblock-importer",
"title": "5e Statblock Importer",
"description": "Import monster and NPC statblocks for D&D 5e",
"version": "1.83.02",
"version": "1.83.03",
"compatibility": {
"minimum": "10",
"maximum": "12",
Expand All @@ -18,27 +18,20 @@
"flags": {}
}
],
"author": "ArcaneRoboBrain",
"relationships": {
"systems": [
{
"id": "dnd5e"
}
]
},
"systems": [
"dnd5e"
],
"esmodules": [
"./scripts/sbi.js"
],
"styles": [
"./styles/sbi.css"
],
"templates": [
"./templates/sbiWindow.html"
],
"url": "https://github.com/jbhaywood/5e-statblock-importer",
"manifest": "https://raw.githubusercontent.com/jbhaywood/5e-statblock-importer/main/module.json",
"download": "https://github.com/jbhaywood/5e-statblock-importer/archive/v1.83.02.zip"
}
"download": "https://github.com/jbhaywood/5e-statblock-importer/archive/v1.83.03.zip"
}
20 changes: 10 additions & 10 deletions scripts/sbiActor.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,25 +495,25 @@ export class sbiActor {
return size;
}
};

const sizeValue = creatureData.size.toLowerCase();
const swarmSizeValue = creatureData.swarmSize?.toLowerCase();
const detailsData = {};

sUtils.assignToObject(detailsData, "system.traits.size", getSizeAbbreviation(sizeValue));

if (swarmSizeValue) {
sUtils.assignToObject(detailsData, "system.details.type.swarm", getSizeAbbreviation(swarmSizeValue));
}

sUtils.assignToObject(detailsData, "system.details.alignment", sUtils.capitalizeAll(creatureData.alignment?.trim()));
sUtils.assignToObject(detailsData, "system.details.type.subtype", sUtils.capitalizeAll(creatureData.race?.trim()));
sUtils.assignToObject(detailsData, "system.details.type.value", creatureData.type?.trim().toLowerCase());

const hasCustomType = creatureData.customType?.trim();
if(hasCustomType) {
sUtils.assignToObject(detailsData, "system.details.type.value", "custom");
sUtils.assignToObject(detailsData, "system.details.type.custom", sUtils.capitalizeAll(creatureData.customType?.trim()));
if (hasCustomType) {
sUtils.assignToObject(detailsData, "system.details.type.value", "custom");
sUtils.assignToObject(detailsData, "system.details.type.custom", sUtils.capitalizeAll(creatureData.customType?.trim()));
}

await actor.update(detailsData);
Expand All @@ -535,7 +535,7 @@ export class sbiActor {

const spellLevel = spell.name.toLowerCase();
const spellNames = spell.value;
const spellMatches = [...spellLevel.matchAll(sRegex.spellcastingDetails)];
const spellMatches = [...spellLevel.matchAll(sRegex.spellcastingDetails)];
const slots = this.getGroupValue("slots", spellMatches);
const perday = this.getGroupValue("perday", spellMatches);

Expand Down Expand Up @@ -593,7 +593,7 @@ export class sbiActor {
}

// Set spellcasting ability.
const spellMatches = [...description.matchAll(sRegex.spellcastingDetails)];
const spellMatches = [...description.matchAll(sRegex.spellcastingDetails)];
let spellcastingAbility = this.getGroupValue("ability1", spellMatches);

if (spellcastingAbility == null) {
Expand Down Expand Up @@ -793,7 +793,7 @@ export class sbiActor {
saveDescription = description.slice(saveMatch.index);
}

if (attackDescription.length) {
if (attackDescription?.length) {
attackMatch = sRegex.attack.exec(attackDescription);
if (attackMatch) {
itemData.type = "weapon";
Expand Down

0 comments on commit ade0e49

Please sign in to comment.