diff --git a/module/actor-sheet.js b/module/actor-sheet.js index f2fcf31c..775c367b 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -150,57 +150,7 @@ export class RdDActorSheet extends ActorSheet { await this.createItem('Nouvelle tache', 'tache'); } - /* -------------------------------------------- */ - async creerObjet() { - let itemType = $(".item-type").val(); - await this.createItem('Nouveau ' + itemType, itemType); - } - - /* -------------------------------------------- */ - async selectObjetType() { - let typeObjets = RdDItem.getTypeObjetsEquipement(); - 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); - } - - /* -------------------------------------------- */ - async selectTypeOeuvre() { - let typeOeuvres = RdDItem.getTypesOeuvres(); - let options = `Selectionnez le type d'oeuvre'; - let d = new Dialog({ - title: "Créer une oeuvre", - content: options, - buttons: { - one: { - icon: '', - label: "Créer l'oeuvre", - callback: () => this.creerObjet() - } - } - }); - d.render(true); - } - /* -------------------------------------------- */ - /** @override */ + /* -------------------------------------------- */ /** @override */ activateListeners(html) { super.activateListeners(html); @@ -264,7 +214,7 @@ export class RdDActorSheet extends ActorSheet { this.createEmptyTache(); }); html.find('.creer-un-objet').click(async event => { - this.selectObjetType(); + RdDUtility.selectObjetType( this ); }); html.find('.creer-une-oeuvre').click(async event => { this.selectTypeOeuvre(); diff --git a/module/actor-vehicule-sheet.js b/module/actor-vehicule-sheet.js index 21143b19..840f4540 100644 --- a/module/actor-vehicule-sheet.js +++ b/module/actor-vehicule-sheet.js @@ -75,6 +75,11 @@ export class RdDActorVehiculeSheet extends ActorSheet { } } + /* -------------------------------------------- */ + async createItem(name, type) { + await this.actor.createEmbeddedDocuments('Item', [{ name: name, type: type }], { renderSheet: true }); + } + /* -------------------------------------------- */ /** @override */ activateListeners(html) { @@ -97,6 +102,13 @@ export class RdDActorVehiculeSheet extends ActorSheet { RdDUtility.confirmerSuppression(this, li); }); + html.find('.creer-un-objet').click(async event => { + RdDUtility.selectObjetType( this ); + }); + html.find('#nettoyer-conteneurs').click(async event => { + this.actor.nettoyerConteneurs(); + }); + // Display info about queue html.find('.conteneur-name a').click((event) => { let myID = event.currentTarget.attributes['data-item-id'].value; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 3d71f0a7..59bf7f26 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -8,6 +8,7 @@ import { TMRUtility } from "./tmr-utility.js"; import { DialogItemAchat } from "./dialog-item-achat.js"; import { ReglesOptionelles } from "./regles-optionelles.js"; import { RdDDice } from "./rdd-dice.js"; +import { RdDItem } from "./item.js"; /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 @@ -118,6 +119,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html', // Conteneur/item in Actor sheet 'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-conteneur.html', + "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html", 'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html', //Items 'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html', @@ -254,6 +256,34 @@ export class RdDUtility { return loadTemplates(templatePaths); } + /* -------------------------------------------- */ + static async creerObjet(actorSheet) { + let itemType = $(".item-type").val(); + await actorSheet.createItem('Nouveau ' + itemType, itemType); + } + + /* -------------------------------------------- */ + static async selectObjetType( actorSheet) { + let typeObjets = RdDItem.getTypeObjetsEquipement(); + 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(actorSheet) + } + } + }); + d.render(true); + } + /* -------------------------------------------- */ static buildListOptions(min, max) { let options = "" diff --git a/packs/equipement.db b/packs/equipement.db index 0f118117..32ab6bdd 100644 --- a/packs/equipement.db +++ b/packs/equipement.db @@ -1,3 +1,4 @@ +{"name":"Argent (1 sol)","type":"monnaie","img":"systems/foundryvtt-reve-de-dragon/icons/objets/piece_argent_sol.webp","data":{"quantite":null,"valeur_deniers":null,"encombrement":null,"description":"","data":{"quantite":null,"valeur_deniers":null,"encombrement":null}},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"jtRmvSuwkwMmIMf0":3},"flags":{"core":{"sourceId":"Item.6M7WG9ciKuoYtN9i"}},"_id":"0I30m9qcYJk6UR6o"} {"_id":"0Vgscex1VV4ybSUQ","name":"Bonnet de laine","type":"objet","img":"systems/foundryvtt-reve-de-dragon/icons/objets/bonnet_laine.webp","data":{"description":"","quantite":1,"encombrement":0.05,"equipe":false,"resistance":0,"qualite":0,"cout":0.06},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"rYShh2P1DNavdoBD":3},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.equipement.0Vgscex1VV4ybSUQ"}}} {"_id":"0ylGrNMzulUaKFP9","name":"Boralm","type":"ingredient","img":"systems/foundryvtt-reve-de-dragon/icons/objets/boralm.webp","data":{"description":"

Poudre brune apparaissant sur les parois des grottes.

\n

VUE/Alchimie à -1.

","niveau":0,"encombrement":0.001,"base":0,"quantite":1,"milieu":"Cavernes","rarete":"","categorie":"Alchimie","cout":0.03},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"rYShh2P1DNavdoBD":3},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.equipement.0ylGrNMzulUaKFP9"}}} {"_id":"1Dc4KzZageae7lhI","name":"Balles de jongleur","type":"objet","img":"systems/foundryvtt-reve-de-dragon/icons/objets/balle_jongleur.webp","data":{"description":"","quantite":4,"encombrement":0.1,"equipe":false,"resistance":0,"qualite":0,"cout":0.32},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"rYShh2P1DNavdoBD":3},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.equipement.1Dc4KzZageae7lhI"}}} diff --git a/rdd.code-workspace b/rdd.code-workspace new file mode 100644 index 00000000..90f806b1 --- /dev/null +++ b/rdd.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../../../foundry/foundryvtt-dev/resources/app" + } + ], + "settings": {} +} \ No newline at end of file diff --git a/system.json b/system.json index aad3c98f..ad6e13c3 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "1.4.19", + "version": "1.4.20", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.8.0", "compatibleCoreVersion": "0.8.5", diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html index 4f506b6f..73f99767 100644 --- a/templates/actor-creature-sheet.html +++ b/templates/actor-creature-sheet.html @@ -142,6 +142,10 @@ {{!-- Equipment Tab --}}
+ + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}} + +

Equipement porté

Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} {{calc.surEncombrementMessage}} - Créer un objet {{#if options.isGM}} diff --git a/templates/actor-sheet-inventaire-monnaie.html b/templates/actor-sheet-inventaire-monnaie.html new file mode 100644 index 00000000..58166551 --- /dev/null +++ b/templates/actor-sheet-inventaire-monnaie.html @@ -0,0 +1,15 @@ +

Argent et Monnaies

+ diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index d6974842..31079aed 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -578,21 +578,8 @@ {{!-- Equipment Tab --}}
-

Argent et Monnaies

- + + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}}

Equipement porté

diff --git a/templates/actor-vehicule-sheet.html b/templates/actor-vehicule-sheet.html index d3018448..1e645e71 100644 --- a/templates/actor-vehicule-sheet.html +++ b/templates/actor-vehicule-sheet.html @@ -68,6 +68,11 @@ {{!-- Equipment Tab --}}
+ + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}} + +

Equipement chargé

+ Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.capacite_encombrement}} {{calc.surEncombrementMessage}} - Créer un objet {{#if options.isGM}}