Gestion des quantités

This commit is contained in:
sladecraven 2020-11-18 08:13:48 +01:00
parent ffa81a6568
commit e13b04b15d
9 changed files with 25 additions and 3 deletions

View File

@ -142,7 +142,7 @@ export class RdDActorSheet extends ActorSheet {
if (objet) { if (objet) {
objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template
this.objetVersConteneur[id] = conteneur._id; this.objetVersConteneur[id] = conteneur._id;
conteneur.encTotal += objet.data.encombrement; conteneur.encTotal += objet.data.encombrement * ((objet.data.quantite)?objet.data.quantite:1);
conteneur.subItems.push( objet ); conteneur.subItems.push( objet );
} }
} }

View File

@ -589,7 +589,7 @@ export class RdDActor extends Actor {
let totalEnc = 0; let totalEnc = 0;
for (const item of this.data.items) { for (const item of this.data.items) {
if ( item.data && item.data.encombrement ) { // Enc value filtering if ( item.data && item.data.encombrement ) { // Enc value filtering
totalEnc += Number(item.data.encombrement); totalEnc += Number(item.data.encombrement) * Number(((item.data.quantite)?item.data.quantite:1));
} }
} }
this.encombrementTotal = totalEnc; this.encombrementTotal = totalEnc;

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "0.9.54", "version": "0.9.55",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6", "compatibleCoreVersion": "0.7.6",
"templateVersion": 46, "templateVersion": 46,

View File

@ -1,6 +1,9 @@
<li class="item flexrow" data-item-id="{{item._id}}"> <li class="item flexrow" data-item-id="{{item._id}}">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/> <img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<h4 class="item-name">{{item.name}}</h4> <h4 class="item-name">{{item.name}}</h4>
{{#if item.data.quantite}}
<h4 class="item-quantite">{{item.data.quantite}}</h4>
{{/if}}
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a> <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> <a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>

View File

@ -466,6 +466,9 @@
<li class="item flexrow" data-item-id="{{item._id}}"> <li class="item flexrow" data-item-id="{{item._id}}">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/> <img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<h4 class="item-name">{{item.name}}</h4> <h4 class="item-name">{{item.name}}</h4>
{{#if item.data.quantite}}
<h4 class="item-quantite">{{item.data.quantite}}</h4>
{{/if}}
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-equip" title="Equiper">{{#if item.data.equipe}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a> <a class="item-control item-equip" title="Equiper">{{#if item.data.equipe}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a> <a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>

View File

@ -32,6 +32,10 @@
<label for="xp">Encombrement </label> <label for="xp">Encombrement </label>
<input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number"/>
</div> </div>
<div class="form-group">
<label>Quantité </label>
<input class="attribute-value" type="text" name="data.quantite" value="{{data.quantite}}" data-dtype="Number" />
</div>
<div class="form-group"> <div class="form-group">
<label for="xp">Prix (sols) </label> <label for="xp">Prix (sols) </label>
<input class="attribute-value" type="text" name="data.cout" value="{{data.cout}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="data.cout" value="{{data.cout}}" data-dtype="Number"/>

View File

@ -12,6 +12,10 @@
<label for="xp">Encombrement </label> <label for="xp">Encombrement </label>
<input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number"/>
</div> </div>
<div class="form-group">
<label>Quantité </label>
<input class="attribute-value" type="text" name="data.quantite" value="{{data.quantite}}" data-dtype="Number" />
</div>
<div class="form-group"> <div class="form-group">
<label for="xp">Qualité</label> <label for="xp">Qualité</label>
<input class="attribute-value" type="text" name="data.qualite" value="{{data.qualite}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="data.qualite" value="{{data.qualite}}" data-dtype="Number"/>

View File

@ -12,6 +12,10 @@
<label for="xp">Encombrement </label> <label for="xp">Encombrement </label>
<input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number"/>
</div> </div>
<div class="form-group">
<label>Quantité </label>
<input class="attribute-value" type="text" name="data.quantite" value="{{data.quantite}}" data-dtype="Number" />
</div>
<div class="form-group"> <div class="form-group">
<label for="xp">Résistance</label> <label for="xp">Résistance</label>
<input class="attribute-value" type="text" name="data.resistance" value="{{data.resistance}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="data.resistance" value="{{data.resistance}}" data-dtype="Number"/>

View File

@ -12,6 +12,10 @@
<label>Encombrement</label> <label>Encombrement</label>
<input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number" /> <input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number" />
</div> </div>
<div class="form-group">
<label>Quantité </label>
<input class="attribute-value" type="text" name="data.quantite" value="{{data.quantite}}" data-dtype="Number" />
</div>
<div class="form-group"> <div class="form-group">
<label>Prix (sols)</label> <label>Prix (sols)</label>
<input class="attribute-value" type="text" name="data.cout" value="{{data.cout}}" data-dtype="Number" /> <input class="attribute-value" type="text" name="data.cout" value="{{data.cout}}" data-dtype="Number" />