Aide tchat dans un dialogue
This commit is contained in:
parent
19f5e2af59
commit
c251727dea
@ -165,11 +165,25 @@ export class RdDCommands {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
help(msg, table = undefined) {
|
||||
async help(msg) {
|
||||
this.help(msg, undefined);
|
||||
}
|
||||
async help(msg, table) {
|
||||
let list = []
|
||||
this._buildSubTableHelp(list, table || this.commandsTable);
|
||||
const messageAide = list.reduce((a, b) => a + '</li><li class="list-item">' + b);
|
||||
RdDCommands._chatAnswer(msg, `Commandes disponibles<ul class="alterne-list"><li class="list-item">${messageAide}</li></ul>`);
|
||||
|
||||
let html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/settings/dialog-aide-commands.html", { commands: list });
|
||||
let d = new Dialog(
|
||||
{
|
||||
title: "Commandes disponibles dans le tchat",
|
||||
content: html,
|
||||
buttons: {},
|
||||
},
|
||||
{
|
||||
width: 600, height: 500,
|
||||
});
|
||||
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -220,23 +234,23 @@ export class RdDCommands {
|
||||
}
|
||||
|
||||
let actors = canvas.tokens.controlled.map(it => it.actor).filter(it => it);
|
||||
if (actors && actors.length > 0){
|
||||
if (actors && actors.length > 0) {
|
||||
let length = params.length;
|
||||
let diff = Number(params[length-1]);
|
||||
if (Number.isInteger(Number(diff))){
|
||||
length --;
|
||||
let diff = Number(params[length - 1]);
|
||||
if (Number.isInteger(Number(diff))) {
|
||||
length--;
|
||||
}
|
||||
else {
|
||||
diff = 0;
|
||||
}
|
||||
const caracName = params[0];
|
||||
const compName = length>1 ? params.slice(1, length).reduce((a, b) => `${a} ${b}`): undefined;
|
||||
const compName = length > 1 ? params.slice(1, length).reduce((a, b) => `${a} ${b}`) : undefined;
|
||||
for (let actor of actors) {
|
||||
await actor.rollCaracCompetence(caracName, compName, diff);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
ui.notifications.warn("Sélectionnez au moins un personnage pour lancer les dés")
|
||||
}
|
||||
}
|
||||
|
20
templates/settings/dialog-aide-commands.html
Normal file
20
templates/settings/dialog-aide-commands.html
Normal file
@ -0,0 +1,20 @@
|
||||
<h3>Dés spéciaux</h3>
|
||||
<ul class="alterne-list">
|
||||
<li class="list-item">
|
||||
<strong>/roll 1d7</strong>: lance un dé de rencontre
|
||||
</li>
|
||||
<li class="list-item">
|
||||
<strong>/roll 1dr</strong>: lance un dé draconique (de 0à 7, relance et additionne en cas de 7)
|
||||
</li>
|
||||
<li class="list-item">
|
||||
<strong>/roll 1dh</strong>: lance le dé des heures (de 1 à 12)
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Commandes disponibles</h3>
|
||||
<ul class="alterne-list">
|
||||
{{#each commands as |command key|}}
|
||||
<li class="list-item">
|
||||
{{{command}}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
Loading…
Reference in New Issue
Block a user