diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 9efb56ac..7a902cfd 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -199,6 +199,34 @@ export class RdDActorSheet extends ActorSheet { await this.actor.createOwnedItem( { name: 'Nouvelle tache', type: 'tache'}, { renderSheet: true } ); } + /* -------------------------------------------- */ + async creerObjet( ) { + let itemType = $("#creer-equipement").val(); + await this.actor.createOwnedItem( { name: 'Nouveau '+itemType, type: itemType}, { renderSheet: true } ); + } + + /* -------------------------------------------- */ + async selectObjetType( ) { + let itemType = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "monnaie"]; + let options = 'Selectionnez le type d\'équipement'; + let d = new Dialog( { + title: "Créer un équipement", + content: options, + buttons: { + one: { + icon: '', + label: "Créer l'objet", + callback: () => this.creerObjet() + } + } + }); + d.render(true); + } + /* -------------------------------------------- */ /** @override */ activateListeners(html) { @@ -234,7 +262,10 @@ export class RdDActorSheet extends ActorSheet { html.find('#creer-tache').click(ev => { this.createEmptyTache(); }); - + html.find('#creer-un-objet').click(ev => { + this.selectObjetType(); + }); + // Blessure control html.find('.blessure-control').click(ev => { const li = $(ev.currentTarget).parents(".item"); diff --git a/module/actor.js b/module/actor.js index d91608ca..c027b355 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1496,7 +1496,6 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async creerTacheDepuisLivre( item ) { - console.log("FROM ITEM", item); let tache = { name: "Lire " + item.name, type: 'tache', data: { carac: 'intellect', diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 7770e99d..dec727be 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -573,7 +573,8 @@ {{!-- Equipment Tab --}}
- Encombrement total/max : {{numberFormat data.encombrementTotal decimals=1}} / {{data.attributs.encombrement.value}} {{data.surEncombrementMessage}} + Encombrement total/max : {{numberFormat data.encombrementTotal decimals=1}} / {{data.attributs.encombrement.value}} {{data.surEncombrementMessage}} - + Créer un objet