Les joueurs ne peuvent plus créer de signes

Les commandes /signe+ / /signe
This commit is contained in:
Vincent Vandemeulebrouck 2023-01-05 02:14:23 +01:00
parent ec24126e75
commit 8844f76b65

View File

@ -206,16 +206,16 @@ export class RdDCommands {
let rollMode = game.settings.get("core", "rollMode"); let rollMode = game.settings.get("core", "rollMode");
if (["gmroll", "blindroll"].includes(rollMode)) { if (["gmroll", "blindroll"].includes(rollMode)) {
msg["whisper"] = ChatMessage.getWhisperRecipients("GM"); msg["whisper"] = ChatMessage.getWhisperRecipients("GM");
} }
if (rollMode === "blindroll"){ if (rollMode === "blindroll") {
msg["blind"] = true; msg["blind"] = true;
} }
msg["type"] = 0; msg["type"] = 0;
if (!this.commandsTable) { if (!this.commandsTable) {
this._registerCommands(); this._registerCommands();
} }
let command = commandLine[0].toLowerCase(); let command = commandLine[0].toLowerCase();
if (this._isCommandHandled(command)) { if (this._isCommandHandled(command)) {
let params = commandLine.slice(1); let params = commandLine.slice(1);
@ -225,7 +225,7 @@ export class RdDCommands {
return false; return false;
} }
_isCommandHandled(command){ _isCommandHandled(command) {
return this.commandsTable[command] != undefined; return this.commandsTable[command] != undefined;
} }
@ -331,7 +331,7 @@ export class RdDCommands {
diff = 0; diff = 0;
} }
const caracName = params[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) { if (competence) {
for (let actor of actors) { for (let actor of actors) {
await actor.rollCaracCompetence(caracName, competence.name, diff); await actor.rollCaracCompetence(caracName, competence.name, diff);
@ -448,17 +448,27 @@ export class RdDCommands {
} }
async creerSignesDraconiques() { 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; return true;
} }
async supprimerSignesDraconiquesEphemeres() { async supprimerSignesDraconiquesEphemeres() {
game.actors.forEach(actor => { if (game.user.isGM) {
const ephemeres = actor.items.filter(item => item.type = 'signedraconique' && item.system.ephemere); game.actors.forEach(actor => {
if (ephemeres.length > 0) { const ephemeres = actor.items.filter(item => item.type = 'signedraconique' && item.system.ephemere);
actor.deleteEmbeddedDocuments("Item", ephemeres.map(item => item.id)); 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; return true;
} }