Small cleanup

- extrait de méthode pour tirage dans un array
- utilisation des operateur ?: / ??
This commit is contained in:
Vincent Vandemeulebrouck
2021-02-12 01:11:03 +01:00
parent 9f2e17537d
commit 1cb4a7dbf5
7 changed files with 70 additions and 78 deletions

View File

@ -1,3 +1,4 @@
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
const words = [ 'pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i', 'onse', 'iane', 'ane', 'zach', 'arri', 'ba', 'bo', 'bi',
@ -7,9 +8,7 @@ const words = [ 'pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i',
export class RdDNameGen {
static getName( msg, params ) {
let max = words.length;
let name = words[new Roll("1d"+max+" -1").roll().total];
name += words[new Roll("1d"+max+" -1").roll().total];
let name = Misc.upperFirst( Misc.rollOneOf(words) + Misc.rollOneOf(words) )
//console.log(name);
ChatMessage.create( { content: `Nom : ${name}`, whisper: ChatMessage.getWhisperRecipients("GM") } );
}