Skip to content

Commit

Permalink
feature: added compatibility with V12 and dnd5e 3+
Browse files Browse the repository at this point in the history
  • Loading branch information
gioppoluca committed Aug 6, 2024
1 parent c24ae5f commit b94e578
Show file tree
Hide file tree
Showing 7 changed files with 1,877 additions and 236 deletions.
295 changes: 295 additions & 0 deletions mappings/dnd5e/extended/2.4.1/npc.js

Large diffs are not rendered by default.

544 changes: 544 additions & 0 deletions mappings/dnd5e/extended/2.4.1/player.js

Large diffs are not rendered by default.

214 changes: 107 additions & 107 deletions mappings/dnd5e/extended/latest/player.js

Large diffs are not rendered by default.

295 changes: 295 additions & 0 deletions mappings/dnd5e/standard/2.4.1/npc.js

Large diffs are not rendered by default.

502 changes: 502 additions & 0 deletions mappings/dnd5e/standard/2.4.1/player.js

Large diffs are not rendered by default.

204 changes: 102 additions & 102 deletions mappings/dnd5e/standard/latest/player.js

Large diffs are not rendered by default.

59 changes: 32 additions & 27 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,33 +376,38 @@ class SheetExportconfig extends FormApplication {
// console.log(fieldMapping)
// functionSet.secm.setCurrentField(field);
// functionSet.secm.setCurrentFontsize(getDefaultFontSize(field.acroField));

switch (type) {
case "PDFTextField":
if (field.isMultiline()) {
input.innerHTML = fieldMapping ? fieldMapping.calculated : "";
} else {
input.setAttribute("type", "text");
input.value = fieldMapping ? fieldMapping.calculated : "";
}
field.setText(fieldMapping ? (fieldMapping.calculated ? fieldMapping.calculated.toString() : "") : "");
field.markAsClean();
break;
case "PDFCheckBox":
input.setAttribute("type", "checkbox");
input.checked = fieldMapping ? fieldMapping.calculated : "";
fieldMapping ? (fieldMapping.calculated ? field.check() : field.uncheck()) : field.uncheck();
break;
case "PDFButton":
console.log("PDFButton");
break;
case "PDFRadioGroup":
console.log("PDFRadioGroup");
break;

default:
// console.log("nothing in switch");
break;
try {

switch (type) {
case "PDFTextField":
if (field.isMultiline()) {
input.innerHTML = fieldMapping ? fieldMapping.calculated : "";
} else {
input.setAttribute("type", "text");
input.value = fieldMapping ? fieldMapping.calculated : "";
}
field.setText(fieldMapping ? (fieldMapping.calculated ? fieldMapping.calculated.toString() : "") : "");
field.markAsClean();
break;
case "PDFCheckBox":
input.setAttribute("type", "checkbox");
input.checked = fieldMapping ? fieldMapping.calculated : "";
fieldMapping ? (fieldMapping.calculated ? field.check() : field.uncheck()) : field.uncheck();
break;
case "PDFButton":
console.log("PDFButton");
break;
case "PDFRadioGroup":
console.log("PDFRadioGroup");
break;

default:
// console.log("nothing in switch");
break;
}
} catch (error) {
console.error(`Error processing field ${name} of type ${type}:`, error);
ui.notifications.error(`Error processing field ${name}: ${error.message}`);
}
row.appendChild(input); // Add to DOM

Expand Down

0 comments on commit b94e578

Please sign in to comment.