-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entering data #84
Comments
@EldarcDM async function createEntity(entityClass, jsonStr) {
let json = JSON.parse(jsonStr);
var importFolder = game.folders.find(e => e.name === "Import" && e.type === entityClass.name);
if(!importFolder) {
var folderData = {name: "Import", type: entityClass.name, parent: null};
importFolder = await Folder.create(folderData);
}
var folderId = importFolder.id;
var elems;
if(Array.isArray(json)) elems = json;
else elems = [json];
let elemsToAdd = elems.map(e => mergeObject(e, {folder: folderId}));
return entityClass.create(elemsToAdd);
}
async function importDialog(entityClass) {
let dlg = new Dialog({
title: `Bulk ${entityClass.name}s Import`,
content: await renderTemplate("templates/apps/import-data.html", {entity: 'Items', name: 'New Items'}),
buttons: {
import: {
icon: '<i class="fas fa-file-import"></i>',
label: "Import",
callback: html => {
let form = html.find("form")[0];
if (!form.data.files.length) return ui.notifications.error("You did not upload a file!");
else readTextFromFile(form.data.files[0]).then(json => createEntity(entityClass, json));
}
},
no: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel"
}
},
default: "import"
}, {
width: 400
}).render(true);
} Example yaml file with spell: ---
-
name: Example Spell
type: spell
img: systems/demonlord/assets/icons/skills/wings.webp
data:
description: >-
There is a multiline spell description
<b>html</b> tags are also allowed.
tradition: Spell Tradition
spelltype: Attack
rank: 1
attribute: Will
area: >-
A sphere with a 5-yard radius centered on a point you
can reach
action:
against: Will
activatedEffect:
target:
value: 5
type: sphere |
Hi!
Thanks for this lovely Shadow of the Demon Lord system. It's awesome and you can tell the effort you've put into it.
My only issue with the system is that it's not easy entering data. I mean, when you create monsters, spells, whatever, you have to click lots of times to open a window, get a dropdown menu, select, close, open another menu... etc. It's quite slow and boring. Is there any other way to enter data so the system recognises it? Maybe from a CSV or excel file... or something?
Thank you!
The text was updated successfully, but these errors were encountered: