12.0.33 - la vieillesse d'Astrobazzarh #736

Merged
uberwald merged 2 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2025-01-10 20:40:37 +01:00
5 changed files with 22 additions and 19 deletions

View File

@ -1,4 +1,8 @@
# 12.0 # 12.0
## 12.0.33 - la vieillesse d'Astrobazzarh
- retour de l'expérience pour les joueurs
- suppression du message "Pas de caractéristique" sur les jets d'odorat-goût
## 12.0.32 - les rêveries d'Astrobazzarh ## 12.0.32 - les rêveries d'Astrobazzarh
- Ajout des Items Race pour gérer les ajustements liés aux races - Ajout des Items Race pour gérer les ajustements liés aux races

View File

@ -1596,7 +1596,7 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */ /* -------------------------------------------- */
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
if (!Misc.isFirstConnectedGM()) { if (!Misc.hasConnectedGM()) {
return return
} }
hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM) hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)

View File

@ -21,7 +21,7 @@ export class RdDBaseActor extends Actor {
static $findCaracByName(carac, name) { static $findCaracByName(carac, name) {
const caracList = Object.entries(carac); const caracList = Object.entries(carac);
let entry = Misc.findFirstLike(name, caracList, { mapper: it => it[0], description: 'caractéristique' }); let entry = Misc.findFirstLike(name, caracList, { mapper: it => it[0], description: 'caractéristique', onMessage: m => { } });
if (!entry || entry.length == 0) { if (!entry || entry.length == 0) {
entry = Misc.findFirstLike(name, caracList, { mapper: it => it[1].label, description: 'caractéristique' }); entry = Misc.findFirstLike(name, caracList, { mapper: it => it[1].label, description: 'caractéristique' });
} }

View File

@ -1,5 +1,12 @@
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
const DEFAULT_FIND_OPTIONS = {
mapper: it => it.name,
preFilter: it => true,
description: 'valeur',
onMessage: m => ui.notifications.info(m)
}
/** /**
* This class is intended as a placeholder for utility methods unrelated * This class is intended as a placeholder for utility methods unrelated
* to actual classes of the game system or of FoundryVTT * to actual classes of the game system or of FoundryVTT
@ -209,6 +216,10 @@ export class Misc {
static isFirstConnectedGM() { static isFirstConnectedGM() {
return game.user == Misc.firstConnectedGM(); return game.user == Misc.firstConnectedGM();
} }
static hasConnectedGM() {
return Misc.firstConnectedGM();
}
static firstConnectedGMId() { static firstConnectedGMId() {
return Misc.firstConnectedGM()?.id; return Misc.firstConnectedGM()?.id;
@ -226,13 +237,7 @@ export class Misc {
/* -------------------------------------------- */ /* -------------------------------------------- */
static findFirstLike(value, elements, options = {}) { static findFirstLike(value, elements, options = {}) {
options = foundry.utils.mergeObject({ options = foundry.utils.mergeObject(DEFAULT_FIND_OPTIONS, options, { overwrite: true, inplace: false });
mapper: it => it.name,
preFilter: it => true,
description: 'valeur',
onMessage: m => ui.notifications.info(m)
}, options, { overwrite: true, inplace: false });
const subset = this.findAllLike(value, elements, options); const subset = this.findAllLike(value, elements, options);
if (subset.length == 0) { if (subset.length == 0) {
console.log(`Aucune ${options.description} pour ${value}`); console.log(`Aucune ${options.description} pour ${value}`);
@ -251,13 +256,7 @@ export class Misc {
} }
static findAllLike(value, elements, options = {}) { static findAllLike(value, elements, options = {}) {
options = foundry.utils.mergeObject({ options = foundry.utils.mergeObject(DEFAULT_FIND_OPTIONS, options, { overwrite: true, inplace: false });
mapper: it => it.name,
preFilter: it => true,
description: 'valeur',
onMessage: m => ui.notifications.info(m)
}, options);
if (!value) { if (!value) {
options.onMessage(`Pas de ${options.description} correspondant à une valeur vide`); options.onMessage(`Pas de ${options.description} correspondant à une valeur vide`);
return []; return [];

View File

@ -1,9 +1,9 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "12.0.32", "version": "12.0.33",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.32/rddsystem.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.33/rddsystem.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.32/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.33/system.json",
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
"compatibility": { "compatibility": {
"minimum": "11", "minimum": "11",