|
|
|
@ -39,21 +39,22 @@ export class RdDCommands {
|
|
|
|
|
rddCommands.registerCommand({ path: ["/meteo"], func: (content, msg, params) => rddCommands.getMeteo(msg, params), descr: "Propose une météo marine" });
|
|
|
|
|
rddCommands.registerCommand({ path: ["/nom"], func: (content, msg, params) => RdDNameGen.getName(msg, params), descr: "Génère un nom aléatoire" });
|
|
|
|
|
|
|
|
|
|
rddCommands.registerCommand({
|
|
|
|
|
path: ["/tmr"], func: (content, msg, params) => rddCommands.findTMR(msg, params),
|
|
|
|
|
descr: `Cherche où se trouve une case des Terres médianes
|
|
|
|
|
<br><strong>/tmr sord</strong> indique que la cité Sordide est en D13
|
|
|
|
|
<br><strong>/tmr foret</strong> donne la liste des TMR dont le nom contient "foret" (donc, toutes les forêts)` });
|
|
|
|
|
rddCommands.registerCommand({
|
|
|
|
|
path: ["/tmra"], func: (content, msg, params) => rddCommands.getTMRAleatoire(msg, params),
|
|
|
|
|
descr: `Tire une case aléatoire des Terres médianes
|
|
|
|
|
<br><strong>/tmra forêt</strong> détermine une 'forêt' aléatoire
|
|
|
|
|
<br><strong>/tmra</strong> détermine une case aléatoire dans toutes les TMR` });
|
|
|
|
|
rddCommands.registerCommand({
|
|
|
|
|
path: ["/tmr"], func: (content, msg, params) => rddCommands.findTMR(msg, params),
|
|
|
|
|
descr: `Cherche où se trouve une case des Terres médianes
|
|
|
|
|
<br><strong>/tmr? sordide</strong> indique que la cité Sordide est en D13
|
|
|
|
|
<br><strong>/tmr? foret</strong> donne la liste des TMR dont le nom contient "foret" (donc, toutes les forêts)` });
|
|
|
|
|
rddCommands.registerCommand({
|
|
|
|
|
path: ["/tmrr"], func: (content, msg, params) => rddCommands.getRencontreTMR(params),
|
|
|
|
|
descr: `Détermine une rencontre dans un type de case
|
|
|
|
|
<br><strong>/tmrr foret</strong> lance un d100 et détermine la rencontre correspondante en 'forêt'
|
|
|
|
|
<br><strong>/tmrr forêt 47</strong> détermine la rencontre en 'forêt' pour un jet de dé de 47`
|
|
|
|
|
<br><strong>/tmrr forêt</strong> détermine une rencontre aléatoire en 'forêt'
|
|
|
|
|
<br><strong>/tmrr mauvaise</strong> détermine une mauvaise rencontre aléatoire
|
|
|
|
|
<br><strong>/tmrr for 47</strong> détermine la rencontre en 'forêt' pour un jet de dé de 47`
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
rddCommands.registerCommand({
|
|
|
|
@ -84,7 +85,7 @@ export class RdDCommands {
|
|
|
|
|
|
|
|
|
|
rddCommands.registerCommand({
|
|
|
|
|
path: ["/payer"], func: (content, msg, params) => RdDUtility.afficherDemandePayer(params[0], params[1]),
|
|
|
|
|
descr: `Permet de payer un montant. Exemples:
|
|
|
|
|
descr: `Demande aux joueurs de payer un montant. Exemples:
|
|
|
|
|
<br><strong>/payer 5s 10d</strong> permet d'envoyer un message pour payer 5 sols et 10 deniers
|
|
|
|
|
<br><strong>/payer 10d</strong> permet d'envoyer un message pour payer 10 deniers`
|
|
|
|
|
});
|
|
|
|
@ -180,7 +181,7 @@ export class RdDCommands {
|
|
|
|
|
return this._processCommand(this.commandsTable, command, params, content, msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_processCommand(commandsTable, name, params, content = '', msg = {}, path = "") {
|
|
|
|
|
async _processCommand(commandsTable, name, params, content = '', msg = {}, path = "") {
|
|
|
|
|
let command = commandsTable[name];
|
|
|
|
|
path = path + name + " ";
|
|
|
|
|
if (command && command.subTable) {
|
|
|
|
@ -193,7 +194,7 @@ export class RdDCommands {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (command && command.func) {
|
|
|
|
|
const result = command.func(content, msg, params);
|
|
|
|
|
const result = await command.func(content, msg, params);
|
|
|
|
|
if (result == false) {
|
|
|
|
|
RdDCommands._chatAnswer(msg, command.descr);
|
|
|
|
|
}
|
|
|
|
@ -250,10 +251,8 @@ export class RdDCommands {
|
|
|
|
|
if (params.length == 1 || params.length == 2) {
|
|
|
|
|
return TMRRencontres.rollRencontre(params[0], params[1])
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollRdd(msg, params) {
|
|
|
|
@ -305,20 +304,20 @@ export class RdDCommands {
|
|
|
|
|
show: { title: "Table de résolution" }
|
|
|
|
|
};
|
|
|
|
|
await RdDResolutionTable.rollData(rollData);
|
|
|
|
|
RdDCommands._chatAnswer(msg, await RdDResolutionTable.buildRollDataHtml(rollData));
|
|
|
|
|
return RdDCommands._chatAnswer(msg, await RdDResolutionTable.buildRollDataHtml(rollData));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollDeDraconique(msg) {
|
|
|
|
|
let ddr = await RdDDice.rollTotal("1dr + 7");
|
|
|
|
|
RdDCommands._chatAnswer(msg, `Lancer d'un Dé draconique: ${ddr}`);
|
|
|
|
|
return RdDCommands._chatAnswer(msg, `Lancer d'un Dé draconique: ${ddr}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getTMRAleatoire(msg, params) {
|
|
|
|
|
if (params.length < 2) {
|
|
|
|
|
let type = params[0];
|
|
|
|
|
const tmr = await TMRUtility.getTMRAleatoire(type ? (it => it.type == type) : (it => true));
|
|
|
|
|
RdDCommands._chatAnswer(msg, `Case aléatoire: ${tmr.coord} - ${tmr.label}`);
|
|
|
|
|
return RdDCommands._chatAnswer(msg, `Case aléatoire: ${tmr.coord} - ${tmr.label}`);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return false;
|
|
|
|
@ -326,6 +325,7 @@ export class RdDCommands {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async findTMR(msg, params) {
|
|
|
|
|
if (params && params.length > 0) {
|
|
|
|
|
const search = Misc.join(params, ' ');
|
|
|
|
|
const found = TMRUtility.findTMR(search);
|
|
|
|
|
if (found?.length > 0) {
|
|
|
|
@ -333,13 +333,15 @@ export class RdDCommands {
|
|
|
|
|
}
|
|
|
|
|
return RdDCommands._chatAnswer(msg, 'Aucune TMR correspondant à ' + search);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
getCoutXpComp(msg, params) {
|
|
|
|
|
if (params && (params.length == 1 || params.length == 2)) {
|
|
|
|
|
let to = params.length == 1 ? Number(params[0]) : Number(params[1]);
|
|
|
|
|
let from = params.length == 1 ? to - 1 : Number(params[0]);
|
|
|
|
|
RdDCommands._chatAnswer(msg, `Coût pour passer une compétence de ${from} à ${to}: ${RdDItemCompetence.getDeltaXp(from, to)}`);
|
|
|
|
|
return RdDCommands._chatAnswer(msg, `Coût pour passer une compétence de ${from} à ${to}: ${RdDItemCompetence.getDeltaXp(from, to)}`);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return false;
|
|
|
|
@ -350,7 +352,7 @@ export class RdDCommands {
|
|
|
|
|
getCoutXpCarac(msg, params) {
|
|
|
|
|
if (params && params.length == 1) {
|
|
|
|
|
let to = Number(params[0]);
|
|
|
|
|
RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to)}`);
|
|
|
|
|
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to)}`);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return false;
|
|
|
|
|