Gestion de l'import skill/categories
This commit is contained in:
@ -251,7 +251,9 @@ export default class RMSSPlayerSheet extends ActorSheet {
|
||||
|
||||
let selectOptions = {};
|
||||
for (const pack of game.packs) {
|
||||
selectOptions[pack.metadata.id] = pack.metadata.label;
|
||||
if (pack.metadata.type === "Item") {
|
||||
selectOptions[pack.metadata.id] = pack.metadata.label;
|
||||
}
|
||||
}
|
||||
new game.rmss.applications.RMSSToolsSCImporter(selectOptions, this.actor).render(true);
|
||||
});
|
||||
|
@ -27,23 +27,27 @@ export default class RMSSToolsSCImporter extends FormApplication {
|
||||
}
|
||||
|
||||
async _updateObject(event, formData) {
|
||||
console.log("Deleting Old Skill Categories.");
|
||||
//console.log("Update ", event, formData);
|
||||
let itemType = event.submitter.value;
|
||||
let toDelete = [];
|
||||
for (const item of this.character.items) {
|
||||
if (item.type === "skill_category") {
|
||||
item.delete();
|
||||
if (item.type === itemType) {
|
||||
toDelete.push(item.id);
|
||||
}
|
||||
}
|
||||
this.character.deleteEmbeddedDocuments("Item", toDelete);
|
||||
|
||||
const pack = game.packs.get(formData.selectOptions);
|
||||
let comp = (itemType == "skill") ? formData.selectOptionsSkills : formData.selectOptionsCategories;
|
||||
const pack = game.packs.get(comp);
|
||||
const skillCategoryData = await pack.getIndex();
|
||||
|
||||
console.log("Importing New Skill Categories.");
|
||||
console.log("Importing New Skills/Skill Categories.");
|
||||
|
||||
for (const sc of skillCategoryData) {
|
||||
const newitem = await pack.getDocument(sc._id);
|
||||
|
||||
let newDocuments = [];
|
||||
if (newitem.type === "skill_category") {
|
||||
if (newitem.type === itemType) {
|
||||
console.log(newitem);
|
||||
newDocuments.push(newitem);
|
||||
}
|
||||
|
Reference in New Issue
Block a user