Commandes pour jet de dés

This commit is contained in:
Vincent Vandemeulebrouck
2020-12-29 00:11:58 +01:00
parent 3e42ddd314
commit 77ed4f1482
5 changed files with 227 additions and 66 deletions

View File

@ -19,6 +19,7 @@ import { TMRUtility } from "./tmr-utility.js";
import { RdDCalendrier } from "./rdd-calendrier.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDTokenHud } from "./rdd-token-hud.js";
import { RdDCommands } from "./rdd-commands.js";
/* -------------------------------------------- */
/* Foundry VTT Initialization */
@ -212,14 +213,15 @@ Hooks.once("init", async function() {
/* -------------------------------------------- */
function messageDeBienvenue(){
game.messages
.filter(it => it.user._id == game.user._id && it.data.content.match(/^Bienvenu(e)? dans le Rêve des Dragons/))
.filter(it => it.user._id == game.user._id && it.data.content.match(/^<div id="message-bienvenue-rdd/))
.forEach(it => it.delete());
ChatMessage.create( {
user: game.user._id,
whisper: [game.user._id],
content : "Bienvenue dans le Rêve des Dragons !<br> " +
"Vous trouverez quelques informations pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}" }
);
content : `<div id="message-bienvenue-rdd"><span class="rdd-roll-part">Bienvenue dans le Rêve des Dragons !</span>
<br>Vous trouverez quelques informations pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}
<br>La commande <code>/aide</code> dans le chat permet de voir les commandes spécifiques à Rêve de Dragon.</div>
` });
}
/* -------------------------------------------- */
@ -232,6 +234,8 @@ Hooks.once("renderApplication", () => {
/* -------------------------------------------- */
Hooks.once("ready", function() {
// préparation des lignes de commandes
RdDCommands.init();
/* -------------------------------------------- */
/* Affiche/Init le calendrier */
let calendrier = new RdDCalendrier();
@ -271,11 +275,15 @@ Hooks.on("preCreateToken", (scene, tokenData, options) => {
/* Foundry VTT Initialization */
/* -------------------------------------------- */
Hooks.on("chatMessage", (html, content, msg) => {
let regExp = /(\S+)/g;
let commands = content.match(regExp);
return RdDUtility.processChatCommand( commands, content, msg );
} );
if (content[0] == '/') {
let regExp = /(\S+)/g;
let commands = content.toLowerCase().match(regExp);
if (game.system.rdd.commands.processChatCommand(commands, content, msg)){
return false;
}
}
return true;
});
/* -------------------------------------------- */
Hooks.on("getCombatTrackerEntryContext", (html, options) => {