#10 Debut gestion encombrement
This commit is contained in:
parent
ee3e568cd8
commit
70abeb2c87
@ -106,20 +106,26 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
// low is normal, this the base used to compute the grid.
|
// low is normal, this the base used to compute the grid.
|
||||||
data.data.fatigueHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "</table>";
|
data.data.fatigueHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "</table>";
|
||||||
data.data.materiel = this._checkNull(data.itemsByType['objet']);
|
data.data.materiel = this._checkNull(data.itemsByType['objet']);
|
||||||
|
data.data.conteneur = this._checkNull(data.itemsByType['conteneur']);
|
||||||
data.data.armes = this._checkNull(data.itemsByType['arme']);
|
data.data.armes = this._checkNull(data.itemsByType['arme']);
|
||||||
data.data.armures = this._checkNull(data.itemsByType['armure']);
|
data.data.armures = this._checkNull(data.itemsByType['armure']);
|
||||||
data.data.livres = this._checkNull(data.itemsByType['livre']);
|
data.data.livres = this._checkNull(data.itemsByType['livre']);
|
||||||
data.data.potions = this._checkNull(data.itemsByType['potions']);
|
data.data.potions = this._checkNull(data.itemsByType['potions']);
|
||||||
|
data.data.ingredients = this._checkNull(data.itemsByType['ingredient']);
|
||||||
|
data.data.munitions = this._checkNull(data.itemsByType['munition']);
|
||||||
data.data.herbes = this._checkNull(data.itemsByType['herbes']);
|
data.data.herbes = this._checkNull(data.itemsByType['herbes']);
|
||||||
data.data.sorts = this._checkNull(data.itemsByType['sort']);
|
data.data.sorts = this._checkNull(data.itemsByType['sort']);
|
||||||
data.data.queues = this._checkNull(data.itemsByType['queue']);
|
data.data.queues = this._checkNull(data.itemsByType['queue']);
|
||||||
data.data.souffles = this._checkNull(data.itemsByType['souffle']);
|
data.data.souffles = this._checkNull(data.itemsByType['souffle']);
|
||||||
data.data.ombres = this._checkNull(data.itemsByType['ombre']);
|
data.data.ombres = this._checkNull(data.itemsByType['ombre']);
|
||||||
data.data.tetes = this._checkNull(data.itemsByType['tete']);
|
data.data.tetes = this._checkNull(data.itemsByType['tete']);
|
||||||
|
data.data.objets = data.data.materiel.concat(data.data.armes).concat(data.data.armures).concat(data.data.munitions).concat(data.data.livres).concat(data.data.potions).concat(data.data.herbes).concat(data.data.ingredients);
|
||||||
data.data.competenceByCategory = data.competenceByCategory;
|
data.data.competenceByCategory = data.competenceByCategory;
|
||||||
data.data.isGM = game.user.isGM;
|
data.data.isGM = game.user.isGM;
|
||||||
data.bonusmalusTable = CONFIG.RDD.bonusmalus;
|
data.bonusmalusTable = CONFIG.RDD.bonusmalus;
|
||||||
|
|
||||||
|
this.actor.computeEncombrementTotal();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +136,12 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
new RdDEncaisser(html, this.actor ).render(true);
|
new RdDEncaisser(html, this.actor ).render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async _onDrop(event) {
|
||||||
|
super._onDrop(event)
|
||||||
|
this.actor.computeEncombrementTotal();
|
||||||
|
|
||||||
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/** @override */
|
/** @override */
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
|
@ -367,6 +367,17 @@ export class RdDActor extends Actor {
|
|||||||
await this.update( {"data.compteurs": compteurs } );
|
await this.update( {"data.compteurs": compteurs } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("Enc total : ", totalEnc);
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeEtatGeneral( )
|
computeEtatGeneral( )
|
||||||
{
|
{
|
||||||
@ -780,12 +791,10 @@ export class RdDActor extends Actor {
|
|||||||
{
|
{
|
||||||
let item = this.getOwnedItem(itemID);
|
let item = this.getOwnedItem(itemID);
|
||||||
if ( item && item.data.data ) {
|
if ( item && item.data.data ) {
|
||||||
console.log(item);
|
|
||||||
//let update = duplicate(item);
|
|
||||||
let update = {_id: item._id, "data.equipe": !item.data.data.equipe };
|
let update = {_id: item._id, "data.equipe": !item.data.data.equipe };
|
||||||
//update.data.equipe = !update.data.equipe;
|
|
||||||
//console.log(update);
|
//console.log(update);
|
||||||
await this.updateEmbeddedEntity("OwnedItem", update);
|
await this.updateEmbeddedEntity("OwnedItem", update);
|
||||||
|
this.computeEncombrementTotal(); // Mise à jour encombrement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.29",
|
"version": "0.9.30",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.6",
|
"compatibleCoreVersion": "0.7.6",
|
||||||
"templateVersion": 41,
|
"templateVersion": 41,
|
||||||
|
@ -447,6 +447,45 @@
|
|||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
|
<ol class="item-list">
|
||||||
|
{{#each data.conteneur as |item id|}}
|
||||||
|
<li class="item flexrow" data-item-id="{{item._id}}">
|
||||||
|
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
|
||||||
|
<h4 class="item-name">{{item.name}}</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>
|
||||||
|
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
<ol class="item-list">
|
||||||
|
{{#each data.materiel as |item id|}}
|
||||||
|
<li class="item flexrow" data-item-id="{{item._id}}">
|
||||||
|
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
|
||||||
|
<h4 class="item-name">{{item.name}}</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>
|
||||||
|
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
<ol class="item-list">
|
||||||
|
{{#each data.livres as |item id|}}
|
||||||
|
<li class="item flexrow" data-item-id="{{item._id}}">
|
||||||
|
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
|
||||||
|
<h4 class="item-name">{{item.name}}</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>
|
||||||
|
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{!-- Biography Tab --}}
|
{{!-- Biography Tab --}}
|
||||||
|
Loading…
Reference in New Issue
Block a user