#67 Ajout d'un bouton de création d'objet sur les fiches de personnage

This commit is contained in:
sladecraven 2020-12-15 22:44:49 +01:00
parent e64c350632
commit 208a394b3e
3 changed files with 34 additions and 3 deletions

View File

@ -199,6 +199,34 @@ export class RdDActorSheet extends ActorSheet {
await this.actor.createOwnedItem( { name: 'Nouvelle tache', type: 'tache'}, { renderSheet: true } ); 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 = '<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>'
}
options += '</select>';
let d = new Dialog( {
title: "Créer un équipement",
content: options,
buttons: {
one: {
icon: '<i class="fas fa-check"></i>',
label: "Créer l'objet",
callback: () => this.creerObjet()
}
}
});
d.render(true);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
activateListeners(html) { activateListeners(html) {
@ -234,7 +262,10 @@ export class RdDActorSheet extends ActorSheet {
html.find('#creer-tache').click(ev => { html.find('#creer-tache').click(ev => {
this.createEmptyTache(); this.createEmptyTache();
}); });
html.find('#creer-un-objet').click(ev => {
this.selectObjetType();
});
// Blessure control // Blessure control
html.find('.blessure-control').click(ev => { html.find('.blessure-control').click(ev => {
const li = $(ev.currentTarget).parents(".item"); const li = $(ev.currentTarget).parents(".item");

View File

@ -1496,7 +1496,6 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async creerTacheDepuisLivre( item ) { async creerTacheDepuisLivre( item ) {
console.log("FROM ITEM", item);
let tache = { name: "Lire " + item.name, type: 'tache', let tache = { name: "Lire " + item.name, type: 'tache',
data: { data: {
carac: 'intellect', carac: 'intellect',

View File

@ -573,7 +573,8 @@
{{!-- 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 cass=item-name>Encombrement total/max : {{numberFormat data.encombrementTotal decimals=1}} / {{data.attributs.encombrement.value}} <b>{{data.surEncombrementMessage}}</b></span> <span class="item-name">Encombrement total/max : {{numberFormat data.encombrementTotal decimals=1}} / {{data.attributs.encombrement.value}} <b>{{data.surEncombrementMessage}}</b></span> -
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
<li class="competence-header flexrow"> <li class="competence-header flexrow">
<span class="competence-title competence-label">Nom</span> <span class="competence-title competence-label">Nom</span>