From 8844f76b65b28f15eaadea735c57f5b7c6533262 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 5 Jan 2023 02:14:23 +0100 Subject: [PATCH] =?UTF-8?q?Les=20joueurs=20ne=20peuvent=20plus=20cr=C3=A9e?= =?UTF-8?q?r=20de=20signes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les commandes /signe+ / /signe --- module/rdd-commands.js | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/module/rdd-commands.js b/module/rdd-commands.js index c24e8af0..c92ca693 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -206,16 +206,16 @@ export class RdDCommands { let rollMode = game.settings.get("core", "rollMode"); if (["gmroll", "blindroll"].includes(rollMode)) { msg["whisper"] = ChatMessage.getWhisperRecipients("GM"); - } - if (rollMode === "blindroll"){ + } + if (rollMode === "blindroll") { msg["blind"] = true; - } + } msg["type"] = 0; if (!this.commandsTable) { this._registerCommands(); } - + let command = commandLine[0].toLowerCase(); if (this._isCommandHandled(command)) { let params = commandLine.slice(1); @@ -225,7 +225,7 @@ export class RdDCommands { return false; } - _isCommandHandled(command){ + _isCommandHandled(command) { return this.commandsTable[command] != undefined; } @@ -331,7 +331,7 @@ export class RdDCommands { diff = 0; } const caracName = params[0]; - let competence = length > 1 ? actors[0].getCompetence(Misc.join(params.slice(1, length), ' ')) : {name:undefined}; + let competence = length > 1 ? actors[0].getCompetence(Misc.join(params.slice(1, length), ' ')) : { name: undefined }; if (competence) { for (let actor of actors) { await actor.rollCaracCompetence(caracName, competence.name, diff); @@ -448,17 +448,27 @@ export class RdDCommands { } async creerSignesDraconiques() { - DialogCreateSigneDraconique.createSigneForActors(); + if (game.user.isGM) { + DialogCreateSigneDraconique.createSigneForActors(); + } + else { + ui.notifications.warn("Seul le MJ est autorisé à utiliser la commande /signe"); + } return true; } async supprimerSignesDraconiquesEphemeres() { - game.actors.forEach(actor => { - const ephemeres = actor.items.filter(item => item.type = 'signedraconique' && item.system.ephemere); - if (ephemeres.length > 0) { - actor.deleteEmbeddedDocuments("Item", ephemeres.map(item => item.id)); - } - }); + if (game.user.isGM) { + game.actors.forEach(actor => { + const ephemeres = actor.items.filter(item => item.type = 'signedraconique' && item.system.ephemere); + if (ephemeres.length > 0) { + actor.deleteEmbeddedDocuments("Item", ephemeres.map(item => item.id)); + } + }); + } + else { + ui.notifications.warn("Seul le MJ est autorisé à utiliser la commande /signe"); + } return true; }