Créer un acteur depuis /nom
This commit is contained in:
parent
d51243d74f
commit
46f5cb67f6
@ -1,3 +1,4 @@
|
||||
import { RdDActor } from "./actor.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
|
||||
@ -11,9 +12,18 @@ const words = [ 'pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i',
|
||||
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") } );
|
||||
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});
|
||||
}
|
||||
}
|
@ -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 => {
|
||||
|
16
templates/chat-command-nom.html
Normal file
16
templates/chat-command-nom.html
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
<h4>Proposition de nom: {{nom}}</h4>
|
||||
<span class="chat-card-button-area">
|
||||
<a class="button-creer-acteur chat-card-button"
|
||||
data-nom='{{nom}}'
|
||||
data-type='personnage'
|
||||
>
|
||||
Créer un Personnage</a>
|
||||
</span>
|
||||
<span class="chat-card-button-area">
|
||||
<a class="button-creer-acteur chat-card-button"
|
||||
data-nom='{{nom}}'
|
||||
data-type='creature'>
|
||||
Créer une créature</a>
|
||||
</span>
|
||||
|
Loading…
Reference in New Issue
Block a user