Création d'oeuvres

This commit is contained in:
Vincent Vandemeulebrouck 2021-03-31 00:11:35 +02:00
parent 5383bd228d
commit e0eb04d829
4 changed files with 37 additions and 12 deletions

View File

@ -173,16 +173,16 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async creerObjet() { async creerObjet() {
let itemType = $("#creer-equipement").val(); let itemType = $(".item-type").val();
await this.createItem('Nouveau ' + itemType, itemType); await this.createItem('Nouveau ' + itemType, itemType);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
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({
@ -198,7 +198,28 @@ 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) {
@ -246,12 +267,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

@ -197,7 +197,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 chants as |chant id|}} {{#each 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 taches as |tache id|}} {{#each 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}}