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() {
let itemType = $("#creer-equipement").val();
let itemType = $(".item-type").val();
await this.createItem('Nouveau ' + itemType, itemType);
}
/* -------------------------------------------- */
async selectObjetType() {
let itemType = ["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">';
for (let typeName of itemType) {
options += '<option value="' + typeName + '">' + typeName + '</option>'
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 class="item-type">`;
for (let typeName of typeObjets) {
options += `<option value="${typeName}">${typeName}</option>`
}
options += '</select>';
let d = new Dialog({
@ -198,7 +198,28 @@ export class RdDActorSheet extends ActorSheet {
});
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 */
activateListeners(html) {
@ -246,12 +267,15 @@ export class RdDActorSheet extends ActorSheet {
ev.preventDefault();
}
});
html.find('#creer-tache').click(ev => {
html.find('.creer-tache').click(ev => {
this.createEmptyTache();
});
html.find('#creer-un-objet').click(ev => {
html.find('.creer-un-objet').click(ev => {
this.selectObjetType();
});
html.find('.creer-une-oeuvre').click(ev => {
this.selectTypeOeuvre();
});
html.find('#nettoyer-conteneurs').click(ev => {
this.actor.nettoyerConteneurs();
});

View File

@ -197,7 +197,7 @@
{{!-- Equipment Tab --}}
<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"><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}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}}

View File

@ -461,6 +461,7 @@
{{!-- Connaissances Tab --}}
<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>
<ul class="item-list alterne-list">
{{#each chants as |chant id|}}
@ -526,7 +527,7 @@
</li>
{{/each}}
</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">
{{#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>
@ -723,7 +724,7 @@
<span class="item-name">Estimation de l'équipement : {{numberFormat calc.prixTotalEquipement decimals=2}} Sols</span>
</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}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}}

View File

@ -69,7 +69,7 @@
{{!-- Equipment Tab --}}
<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"><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}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}}