Ajout des objets monnaies pour les créatures et les véhicules

This commit is contained in:
sladecraven 2021-06-02 16:04:35 +02:00
parent 10ade1789b
commit 67a674e7b4
10 changed files with 83 additions and 68 deletions

View File

@ -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 = `<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({
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);
}
/* -------------------------------------------- */
async selectTypeOeuvre() {
let typeOeuvres = RdDItem.getTypesOeuvres();
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) {
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();

View File

@ -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;

View File

@ -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 = `<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({
title: "Créer un équipement",
content: options,
buttons: {
one: {
icon: '<i class="fas fa-check"></i>',
label: "Créer l'objet",
callback: () => this.creerObjet(actorSheet)
}
}
});
d.render(true);
}
/* -------------------------------------------- */
static buildListOptions(min, max) {
let options = ""

View File

@ -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":"<p>Poudre brune apparaissant sur les parois des grottes.</p>\n<p>VUE/Alchimie &agrave; -1.</p>","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"}}}

11
rdd.code-workspace Normal file
View File

@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
},
{
"path": "../../../foundry/foundryvtt-dev/resources/app"
}
],
"settings": {}
}

View File

@ -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",

View File

@ -142,6 +142,10 @@
{{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}}
<span class="item-name"><h4>Equipement porté</h4></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 class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}}

View File

@ -0,0 +1,15 @@
<span class="item-name"><h4>Argent et Monnaies</h4></span>
<ul class="item-list alterne-list">
{{#each monnaie as |piece id|}}
<li class="item flexrow list-item" data-item-id="{{piece._id}}">
<img class="sheet-competence-img" src="{{piece.img}}" title="{{piece.name}}"/>
<span class="competence-title competence-label">{{piece.name}}</span>
<span class="competence-title competence-label">{{piece.data.quantite}}</span>
<span class="competence-title"><a class="monnaie-plus">+</a><a class="monnaie-moins">-</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>

View File

@ -578,21 +578,8 @@
{{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items">
<span class="item-name"><h4>Argent et Monnaies</h4></span>
<ul class="item-list alterne-list">
{{#each monnaie as |piece id|}}
<li class="item flexrow list-item" data-item-id="{{piece._id}}">
<img class="sheet-competence-img" src="{{piece.img}}" title="{{piece.name}}"/>
<span class="competence-title competence-label">{{piece.name}}</span>
<span class="competence-title competence-label">{{piece.data.quantite}}</span>
<span class="competence-title"><a class="monnaie-plus">+</a><a class="monnaie-moins">-</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}}
<span class="item-name"><h4>Equipement porté</h4></span>
<div>

View File

@ -68,6 +68,11 @@
{{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}}
<span class="item-name"><h4>Equipement chargé</h4></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 class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}}