diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 62a4776..1eaab02 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -1036,13 +1036,12 @@ export class PegasusActor extends Actor { let updates = { 'data.biodata.rolename': role.name } let newItems = [] await this.deleteAllItemsByType('role') - newItems.push(role); + newItems.push(role) this.getIncreaseStatValue(updates, role.data.statincrease1) this.getIncreaseStatValue(updates, role.data.statincrease2) - //newItems = newItems.concat(duplicate(role.data.specialisationsplus1)) - newItems = newItems.concat(duplicate(role.data.specialperk)) + newItems = newItems.concat( duplicate(role.data.specialability) ) // Add new ability await this.update(updates) await this.createEmbeddedDocuments('Item', newItems) diff --git a/modules/pegasus-item-sheet.js b/modules/pegasus-item-sheet.js index 49f89d0..145ac07 100644 --- a/modules/pegasus-item-sheet.js +++ b/modules/pegasus-item-sheet.js @@ -253,7 +253,6 @@ export class PegasusItemSheet extends ItemSheet { async addRolePerk(event, item, dataItem) { let newItem = duplicate(item.data); newItem._id = randomID(dataItem.id.length); - console.log("Add spec", event, newItem); if (event.toElement.className == 'drop-perk2') { let perkArray = duplicate(this.object.data.data.perks); perkArray.push(newItem); @@ -265,6 +264,16 @@ export class PegasusItemSheet extends ItemSheet { await this.object.update({ 'data.specialperk': perkArray }); } } + /* -------------------------------------------- */ + async addRoleAbility(event, item, dataItem) { + let newItem = duplicate(item.data) + newItem._id = randomID(dataItem.id.length) + if (event.toElement.className == 'drop-specialability') { + let abiArray = duplicate(this.object.data.data.specialability) + abiArray.push(newItem) + await this.object.update({ 'data.specialability': abiArray }) + } + } /* -------------------------------------------- */ async addPower(event, item, dataItem) { @@ -479,20 +488,22 @@ export class PegasusItemSheet extends ItemSheet { } if (this.object.type == 'role') { - let data = event.dataTransfer.getData('text/plain'); + let data = event.dataTransfer.getData('text/plain') if (data) { - let dataItem = JSON.parse(data); - let item = await PegasusUtility.searchItem(dataItem); + let dataItem = JSON.parse(data) + let item = await PegasusUtility.searchItem(dataItem) if (item.data.type == 'specialisation') { - return this.addRoleSpecialisation(event, item, dataItem); + return this.addRoleSpecialisation(event, item, dataItem) } if (item.data.type == 'perk') { - return this.addRolePerk(event, item, dataItem); + return this.addRolePerk(event, item, dataItem) + } + if (item.data.type == 'ability') { + return this.addRoleAbility(event, item, dataItem) } } } - - ui.notifications.warn("This item can not be dropped over another item"); + ui.notifications.warn("This item can not be dropped over another item") } /* -------------------------------------------- */ diff --git a/styles/simple.css b/styles/simple.css index c562fa5..1cb264b 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1211,6 +1211,7 @@ ul, li { .drop-ability-power, .drop-ability-spec, .drop-spec-power, +.drop-specialability, .drop-abilities, .drop-optionnal-abilities, .drop-specialperk1, diff --git a/system.json b/system.json index e725806..28f4f11 100644 --- a/system.json +++ b/system.json @@ -180,9 +180,9 @@ "styles": [ "styles/simple.css" ], - "templateVersion": 89, + "templateVersion": 90, "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "0.5.10", + "version": "0.5.11", "background" : "./images/ui/pegasus_welcome_page.webp" } diff --git a/template.json b/template.json index 2557e41..db09437 100644 --- a/template.json +++ b/template.json @@ -239,7 +239,7 @@ "specialisationsplus1": [], "powers1": [], "MR": 0, - "specialperk": [], + "specialability": [], "specincrease": [], "perks": [], "description": "" diff --git a/templates/item-role-sheet.html b/templates/item-role-sheet.html index b0aa6eb..ed33517 100644 --- a/templates/item-role-sheet.html +++ b/templates/item-role-sheet.html @@ -52,16 +52,16 @@ {{/each}}