Commande /tmr
This commit is contained in:
@ -101,6 +101,11 @@ export class Misc {
|
||||
return [...new Set(array)];
|
||||
}
|
||||
|
||||
static join(params, separator = '') {
|
||||
return params.reduce((a, b) => a + separator + b);
|
||||
}
|
||||
|
||||
|
||||
static data(it) {
|
||||
if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
|
||||
return it.data;
|
||||
@ -129,7 +134,7 @@ export class Misc {
|
||||
return Misc.firstConnectedGM()?.id ?? game.user.id;
|
||||
}
|
||||
|
||||
static getActiveUser(id){
|
||||
static getActiveUser(id) {
|
||||
return game.users.entities.find(u => u.id == id && u.active);
|
||||
}
|
||||
|
||||
@ -143,7 +148,7 @@ export class Misc {
|
||||
static isUniqueConnectedGM() {
|
||||
return game.user.id == Misc.firstConnectedGM()?.id;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static findPlayer(name) {
|
||||
return Misc.findFirstLike(name, game.users, { description: 'joueur' });
|
||||
@ -173,7 +178,7 @@ export class Misc {
|
||||
let single = subset.find(it => Grammar.toLowerCaseNoAccent(options.mapper(it)) == Grammar.toLowerCaseNoAccent(value));
|
||||
if (!single) {
|
||||
single = subset[0];
|
||||
const choices = subset.map(it => options.mapper(it)).reduce((a, b) => `${a}<br>${b}`);
|
||||
const choices = Misc.join(subset.map(it => options.mapper(it)), '<br>');
|
||||
options.info(`Plusieurs choix de ${options.description}s possibles:<br>${choices}<br>Le premier sera choisi: ${mapToValue(single)}`);
|
||||
}
|
||||
return single;
|
||||
|
Reference in New Issue
Block a user