#45 : Verification encombrement et amelioration
This commit is contained in:
parent
317a89202a
commit
dca4e28044
@ -705,11 +705,17 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeEncombrementTotal( ) {
|
||||
computeEncombrementTotal( ) {
|
||||
let totalEnc = 0;
|
||||
for (const item of this.data.items) {
|
||||
if ( item.data && item.data.encombrement ) { // Enc value filtering
|
||||
totalEnc += Number(item.data.encombrement) * Number(((item.data.quantite)?item.data.quantite:1));
|
||||
if ( item.data && item.data.encombrement != undefined ) {
|
||||
if ( !Number(item.data.encombrement) ) item.data.encombrement = 0; // Auto-fix
|
||||
if (!item.data.quantite) item.data.quantite = 1; // Auto-fix
|
||||
item.data.encTotal = Number(item.data.encombrement) * Number(item.data.quantite);
|
||||
//console.log("Enc:", item.name, item.data.encombrement, item.data.quantite, item.data.encTotal);
|
||||
totalEnc += item.data.encTotal;
|
||||
} else {
|
||||
item.data.encTotal = 0; // Force default enc
|
||||
}
|
||||
}
|
||||
this.encombrementTotal = totalEnc;
|
||||
|
@ -209,14 +209,16 @@ export class RdDUtility {
|
||||
// Attribution des objets aux conteneurs
|
||||
for (let conteneur of data.data.conteneurs) {
|
||||
conteneur.subItems = [];
|
||||
conteneur.encTotal = 0;
|
||||
if (!conteneur.data.encTotal) conteneur.data.encTotal = 0;
|
||||
//conteneur.data.encTotal = ; Deja calculé
|
||||
if (conteneur.data.contenu) {
|
||||
for (let id of conteneur.data.contenu) {
|
||||
let objet = data.data.objets.find( objet => (id == objet._id) );
|
||||
if (objet) {
|
||||
objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template
|
||||
if (!objet.data.encombrement) objet.data.encombrement = 0; // Auto-fix
|
||||
objet.estContenu = true; // Permet de filtrer ce qifui est porté dans le template
|
||||
actorSheet.objetVersConteneur[id] = conteneur._id;
|
||||
conteneur.encTotal += objet.data.encombrement * ((objet.data.quantite)?objet.data.quantite:1);
|
||||
conteneur.data.encTotal += Number(objet.data.encombrement) * Number(((objet.data.quantite)?objet.data.quantite:1));
|
||||
conteneur.subItems.push( objet );
|
||||
}
|
||||
}
|
||||
@ -235,11 +237,11 @@ export class RdDUtility {
|
||||
if (!niveau) niveau = 1;
|
||||
let str = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor-inventaire-conteneur.html']( { item: objet} );
|
||||
if (objet.type == 'conteneur') {
|
||||
str = str + "<ol class='item-list'>";
|
||||
str = str + "<ul class='item-list alterne-list list-item-margin"+niveau+"1'>";
|
||||
for (let subItem of objet.subItems) {
|
||||
str = str + this.buildConteneur(subItem, niveau+1);
|
||||
}
|
||||
str = str + "</ol>";
|
||||
str = str + "</ul>";
|
||||
}
|
||||
return new Handlebars.SafeString(str);
|
||||
}
|
||||
|
@ -497,7 +497,6 @@ ul, li {
|
||||
.blessures-list ul {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.blessures-list li {
|
||||
flex: 1;
|
||||
flex-basis: auto;
|
||||
@ -509,7 +508,6 @@ ul, li {
|
||||
padding: 0.5rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.carac-label {
|
||||
font-weight: bold;
|
||||
}
|
||||
@ -520,6 +518,24 @@ ul, li {
|
||||
padding: 0.125rem;
|
||||
flex: 1 1 5rem;
|
||||
}
|
||||
|
||||
.item-quantite {
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
.list-item-margin1 {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.list-item-margin2 {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
.list-item-margin3 {
|
||||
margin-left: 3rem;
|
||||
}
|
||||
.list-item-margin4 {
|
||||
margin-left: 4rem;
|
||||
}
|
||||
|
||||
.sheet-competence-img {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||
"version": "0.9.90",
|
||||
"version": "0.9.91",
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.6",
|
||||
"templateVersion": 48,
|
||||
|
@ -1,9 +1,8 @@
|
||||
<li class="item flexrow list-item" data-item-id="{{item._id}}">
|
||||
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
|
||||
<h4 class="item-name">{{item.name}}</h4>
|
||||
{{#if item.data.quantite}}
|
||||
<h4 class="item-quantite">{{item.data.quantite}}</h4>
|
||||
{{/if}}
|
||||
<h4 class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</h4>
|
||||
<div class="item-controls">
|
||||
<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>
|
||||
|
@ -563,9 +563,8 @@
|
||||
<li class="item flexrow list-item" data-item-id="{{item._id}}">
|
||||
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
|
||||
<h4 class="item-name">{{item.name}}</h4>
|
||||
{{#if item.data.quantite}}
|
||||
<h4 class="item-quantite">{{item.data.quantite}}</h4>
|
||||
{{/if}}
|
||||
<h4 class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</h4>
|
||||
<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-edit" title="Editer"><i class="fas fa-edit"></i></a>
|
||||
@ -575,9 +574,9 @@
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{/each}}
|
||||
{{#each data.conteneurs as |conteneur id|}}
|
||||
{{buildConteneur this}}
|
||||
{{/each}}
|
||||
{{#each data.conteneurs as |conteneur id|}}
|
||||
{{buildConteneur this}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user