Merge branch 'master-fixes' into 'master'

Création d'oeuvres

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!182
This commit is contained in:
Leratier Bretonnien 2021-03-31 06:40:56 +00:00
commit 42fb0c0b5e
5 changed files with 38 additions and 13 deletions

View File

@ -148,16 +148,16 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async creerObjet() { async creerObjet() {
let itemType = $("#creer-equipement").val(); let itemType = $(".item-type").val();
await this.actor.createOwnedItem({ name: 'Nouveau ' + itemType, type: itemType }, { renderSheet: true }); await this.actor.createOwnedItem({ name: 'Nouveau ' + itemType, type: itemType }, { renderSheet: true });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async selectObjetType() { async selectObjetType() {
let itemType = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "monnaie"]; let typeObjets = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "monnaie"];
let options = '<span class="competence-label">Selectionnez le type d\'équipement</span><select id="creer-equipement">'; let options = `<span class="competence-label">Selectionnez le type d'équipement</span><select class="item-type">`;
for (let typeName of itemType) { for (let typeName of typeObjets) {
options += '<option value="' + typeName + '">' + typeName + '</option>' options += `<option value="${typeName}">${typeName}</option>`
} }
options += '</select>'; options += '</select>';
let d = new Dialog({ let d = new Dialog({
@ -174,6 +174,27 @@ export class RdDActorSheet extends ActorSheet {
d.render(true); d.render(true);
} }
/* -------------------------------------------- */
async selectTypeOeuvre() {
let typeOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu" ];
let options = `<span class="competence-label">Selectionnez le type d'oeuvre</span><select class="item-type">`;
for (let typeName of typeOeuvres) {
options += `<option value="${typeName}">${typeName}</option>`
}
options += '</select>';
let d = new Dialog({
title: "Créer une oeuvre",
content: options,
buttons: {
one: {
icon: '<i class="fas fa-check"></i>',
label: "Créer l'oeuvre",
callback: () => this.creerObjet()
}
}
});
d.render(true);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
activateListeners(html) { activateListeners(html) {
@ -221,12 +242,15 @@ export class RdDActorSheet extends ActorSheet {
ev.preventDefault(); ev.preventDefault();
} }
}); });
html.find('#creer-tache').click(ev => { html.find('.creer-tache').click(ev => {
this.createEmptyTache(); this.createEmptyTache();
}); });
html.find('#creer-un-objet').click(ev => { html.find('.creer-un-objet').click(ev => {
this.selectObjetType(); this.selectObjetType();
}); });
html.find('.creer-une-oeuvre').click(ev => {
this.selectTypeOeuvre();
});
html.find('#nettoyer-conteneurs').click(ev => { html.find('#nettoyer-conteneurs').click(ev => {
this.actor.nettoyerConteneurs(); this.actor.nettoyerConteneurs();
}); });

View File

@ -22,7 +22,7 @@ export class Periple extends Draconique {
code() { return 'periple' } code() { return 'periple' }
tooltip(linkData) { return `Votre Périple passe par ${this.tmrDescr(linkData)}` } tooltip(linkData) { return `Votre Périple passe par ${this.tmrLabel(linkData)}` }
img() { return 'icons/svg/acid.svg' } img() { return 'icons/svg/acid.svg' }
createSprite(pixiTMR) { createSprite(pixiTMR) {

View File

@ -200,7 +200,7 @@
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab items" data-group="primary" data-tab="items">
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} <b>{{calc.surEncombrementMessage}}</b></span> - <span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} <b>{{calc.surEncombrementMessage}}</b></span> -
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span> <span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}} {{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span> <span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}} {{/if}}

View File

@ -461,6 +461,7 @@
{{!-- Connaissances Tab --}} {{!-- Connaissances Tab --}}
<div class="tab connaissances" data-group="primary" data-tab="connaissances"> <div class="tab connaissances" data-group="primary" data-tab="connaissances">
<span class="item-name"><a class="creer-une-oeuvre">Créer une oeuvre</a></span>
<h3>Oeuvres diverses :</h3> <h3>Oeuvres diverses :</h3>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.chants as |chant id|}} {{#each data.chants as |chant id|}}
@ -526,7 +527,7 @@
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
<h3>Tâches</h3><a id='creer-tache'>Créer une nouvelle Tâche</a> <h3>Tâches</h3><a class='creer-tache'>Créer une nouvelle Tâche</a>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.taches as |tache id|}} {{#each data.taches as |tache id|}}
<li class="item flexrow list-item" data-item-id="{{tache._id}}"><span class="competence-title tache-label"><a>{{tache.name}} ({{tache.data.points_de_tache_courant}}/{{tache.data.points_de_tache}})</a></span> <li class="item flexrow list-item" data-item-id="{{tache._id}}"><span class="competence-title tache-label"><a>{{tache.name}} ({{tache.data.points_de_tache_courant}}/{{tache.data.points_de_tache}})</a></span>
@ -723,7 +724,7 @@
<span class="item-name">Estimation de l'équipement : {{numberFormat calc.prixTotalEquipement decimals=2}} Sols</span> <span class="item-name">Estimation de l'équipement : {{numberFormat calc.prixTotalEquipement decimals=2}} Sols</span>
</div> </div>
<div> <div>
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span> <span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}} {{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span> <span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}} {{/if}}

View File

@ -69,7 +69,7 @@
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab items" data-group="primary" data-tab="items">
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.capacite_encombrement}} <b>{{calc.surEncombrementMessage}}</b></span> - <span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.capacite_encombrement}} <b>{{calc.surEncombrementMessage}}</b></span> -
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span> <span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}} {{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span> <span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}} {{/if}}