v10.6.13 #624

Merged
uberwald merged 3 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2023-02-07 19:28:36 +01:00
5 changed files with 40 additions and 26 deletions

View File

@ -457,7 +457,20 @@ export class RdDActor extends RdDBaseActor {
async _jetDeMoralChateauDormant(message) { async _jetDeMoralChateauDormant(message) {
const jetMoral = await this._jetDeMoral('neutre'); const jetMoral = await this._jetDeMoral('neutre');
message.content += jetMoral.ajustement == 0 ? ' -- le moral reste stable' : ' -- le moral retourne vers 0'; message.content += ' -- le moral ' + this._messageAjustementMoral(jetMoral.ajustement);
}
_messageAjustementMoral(ajustement) {
switch (Math.sign(ajustement)) {
case 1:
return `remonte de ${ajustement}`;
case -1:
return `diminue de ${-ajustement}`;
case 0:
return 'reste stable';
default:
console.error(`Le signe de l'ajustement de moral ${ajustement} est ${Math.sign(ajustement)}, ce qui est innatendu`)
return `est ajusté de ${ajustement} (bizarre)`;
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -52,17 +52,12 @@ export class RdDBaseActorSheet extends ActorSheet {
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets); this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs); formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
this._appliquerRechercheObjets(formData.objets, formData.conteneurs, this.options.recherche); this._appliquerRechercheObjets(formData.objets, formData.conteneurs);
return formData; return formData;
} }
_appliquerRechercheObjets(objets, conteneurs, recherche) { _appliquerRechercheObjets(objets, conteneurs) {
if (recherche) { if (this.options.recherche?.text) {
this._setConteneursVisibles(objets, conteneurs);
}
}
_setConteneursVisibles(objets, conteneurs) {
const recherche = this.options.recherche; const recherche = this.options.recherche;
const allVisible = objets.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id); const allVisible = objets.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id);
let addVisible = conteneurs.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id) let addVisible = conteneurs.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id)
@ -75,6 +70,11 @@ export class RdDBaseActorSheet extends ActorSheet {
objets.forEach(it => it.system.isHidden = !allVisible.includes(it.id)) objets.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
conteneurs.forEach(it => it.system.isHidden = !allVisible.includes(it.id)) conteneurs.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
} }
else {
objets.forEach(it => it.system.isHidden = false)
conteneurs.forEach(it => it.system.isHidden = false)
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static filterItemsPerTypeForSheet(formData, itemTypes) { static filterItemsPerTypeForSheet(formData, itemTypes) {
@ -164,12 +164,8 @@ export class RdDBaseActorSheet extends ActorSheet {
.each((index, field) => { .each((index, field) => {
this._rechercheSelectArea(field); this._rechercheSelectArea(field);
}) })
.keyup(async event => { .keyup(async event => this._rechercherKeyup(event))
this._rechercherKeyup(event); .change(async event => this._rechercherKeyup(event));
})
.change(async event =>
this.options.recherche = this._optionRecherche(event.currentTarget)
);
} }
_rechercherKeyup(event) { _rechercherKeyup(event) {

View File

@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "10.6.12", "version": "10.6.13",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.12.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.13.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",

View File

@ -1,3 +1,4 @@
{{#unless item.system.isHidden}}
{{#if (ne item.type 'monnaie')}} {{#if (ne item.type 'monnaie')}}
<li class="item flexrow list-item" data-item-id="{{item._id}}" draggable="true"> <li class="item flexrow list-item" data-item-id="{{item._id}}" draggable="true">
<span class="equipement-nom {{#if (eq item.type 'conteneur')}}conteneur-name{{/if}} "> <span class="equipement-nom {{#if (eq item.type 'conteneur')}}conteneur-name{{/if}} ">
@ -57,3 +58,4 @@
</span> </span>
</li> </li>
{{/if}} {{/if}}
{{/unless}}

View File

@ -4,6 +4,9 @@
<a class="chat-card-button creer-un-objet">Nouvel objet</a> <a class="chat-card-button creer-un-objet">Nouvel objet</a>
<a class="chat-card-button nettoyer-conteneurs">Tout vider</a> <a class="chat-card-button nettoyer-conteneurs">Tout vider</a>
{{/if}} {{/if}}
<span class="embed-inline">
<input class="recherche flex-grow" type="text" value="{{options.recherche.text}}" name="recherche" size="8" data-dtype="String" placeholder=""/>
</span>
{{#unless system.illimite}} {{#unless system.illimite}}
{{#if calc.surEncombrementMessage}}<b>{{calc.surEncombrementMessage}}</b> &hyphen;{{/if}} {{#if calc.surEncombrementMessage}}<b>{{calc.surEncombrementMessage}}</b> &hyphen;{{/if}}