#123 : Nettoyage des conteneurs

This commit is contained in:
sladecraven 2021-01-08 11:56:10 +01:00
parent 7cb45afa13
commit 55007b51fb
4 changed files with 21 additions and 1 deletions

View File

@ -256,6 +256,9 @@ export class RdDActorSheet extends ActorSheet {
html.find('#creer-un-objet').click(ev => {
this.selectObjetType();
});
html.find('#nettoyer-conteneurs').click(ev => {
this.actor.nettoyerConteneurs();
});
// Blessure control
html.find('.blessure-control').click(ev => {

View File

@ -732,6 +732,20 @@ export class RdDActor extends Actor {
}
}
/* -------------------------------------------- */
/** Fonction de remise à plat de l'équipement (ie vide les champs 'contenu') */
async nettoyerConteneurs( ) {
let conteneurList = this.items.filter( conteneur => conteneur.type == 'conteneur');
let conteneurFixedList = [];
for (let conteneur of conteneurList) {
if ( conteneur.data.data.contenu.length > 0 ) {
conteneurFixedList.push( { _id: conteneur._id, 'data.contenu': [] });
}
}
if ( conteneurFixedList.length > 0)
await this.updateOwnedItem( conteneurFixedList ) ;
}
/* -------------------------------------------- */
detectSurEncombrement( ) {
let diffEnc = Number(this.encTotal) - Number(this.data.data.attributs.encombrement.value);

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.2.7",
"version": "1.2.8",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.8",
"templateVersion": 80,

View File

@ -677,6 +677,9 @@
</ul>
<span class="item-name">Encombrement total/max : {{numberFormat data.encTotal 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>
{{#if data.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}}
<ul class="item-list alterne-list">
<li class="competence-header flexrow">
<span class="competence-title competence-label">Nom</span>