diff --git a/module/rdd-namegen.js b/module/rdd-namegen.js index 52713906..f054f435 100644 --- a/module/rdd-namegen.js +++ b/module/rdd-namegen.js @@ -1,19 +1,29 @@ +import { RdDActor } from "./actor.js"; import { Misc } from "./misc.js"; import { RdDDice } from "./rdd-dice.js"; -const words = [ 'pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i', 'onse', 'iane', 'ane', 'zach', 'arri', 'ba', 'bo', 'bi', - 'alta', 'par', 'pir', 'zor', 'zir', 'de', 'pol', 'tran', 'no', 'la', 'al' , 'pul', 'one', 'ner', 'nur', 'mac', 'mery', - 'cat', 'do', 'di', 'der', 'er', 'el', 'far', 'fer', 'go', 'guer', 'hot', 'jor', 'jar', 'ji', 'kri', 'ket', 'lor', 'hur', - 'lar', 'lir', 'lu', 'pot', 'pro', 'pra', 'pit', 'qua', 'qui', 're', 'ral', 'sal', 'sen', 'ted', 'to', 'ta', 'lars', 'ver', - 'vin', 'ov', 'wal', 'ry', 'ly', '' ]; +const words = ['pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i', 'onse', 'iane', 'ane', 'zach', 'arri', 'ba', 'bo', 'bi', + 'alta', 'par', 'pir', 'zor', 'zir', 'de', 'pol', 'tran', 'no', 'la', 'al', 'pul', 'one', 'ner', 'nur', 'mac', 'mery', + 'cat', 'do', 'di', 'der', 'er', 'el', 'far', 'fer', 'go', 'guer', 'hot', 'jor', 'jar', 'ji', 'kri', 'ket', 'lor', 'hur', + 'lar', 'lir', 'lu', 'pot', 'pro', 'pra', 'pit', 'qua', 'qui', 're', 'ral', 'sal', 'sen', 'ted', 'to', 'ta', 'lars', 'ver', + 'vin', 'ov', 'wal', 'ry', 'ly', '']; /* -------------------------------------------- */ export class RdDNameGen { - static async getName( msg, params ) { - let name = Misc.upperFirst( await RdDDice.rollOneOf(words) + await RdDDice.rollOneOf(words) ) - //console.log(name); - ChatMessage.create( { content: `Nom : ${name}`, whisper: ChatMessage.getWhisperRecipients("GM") } ); + static async getName(msg, params) { + const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-command-nom.html`, { + nom: Misc.upperFirst(await RdDDice.rollOneOf(words) + await RdDDice.rollOneOf(words)) + }); + ChatMessage.create({ content: html, whisper: ChatMessage.getWhisperRecipients("GM") }); } + static async onCreerActeur(event) { + const button = event.currentTarget; + await RdDActor.create({ + name: button.attributes['data-nom'].value, + type: button.attributes['data-type'].value + }, + {renderSheet: true}); + } } \ No newline at end of file diff --git a/module/rdd-utility.js b/module/rdd-utility.js index d6f26d13..afc4b2e3 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -11,6 +11,7 @@ import { RdDDice } from "./rdd-dice.js"; import { RdDItem } from "./item.js"; import { Monnaie } from "./item-monnaie.js"; import { RdDPossession } from "./rdd-possession.js"; +import { RdDNameGen } from "./rdd-namegen.js"; /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 @@ -704,6 +705,7 @@ export class RdDUtility { // gestion bouton tchat Acheter html.on("click", '.button-acheter', event => DialogItemAchat.onButtonAcheter(event)); + html.on("click", '.button-creer-acteur', event => RdDNameGen.onCreerActeur(event)); // Gestion du bouton payer html.on("click", '.payer-button', event => { diff --git a/templates/chat-command-nom.html b/templates/chat-command-nom.html new file mode 100644 index 00000000..8467fe6e --- /dev/null +++ b/templates/chat-command-nom.html @@ -0,0 +1,16 @@ + +