diff --git a/module/actor/random/app-personnage-aleatoire.js b/module/actor/random/app-personnage-aleatoire.js index 20764e13..3ca90ced 100644 --- a/module/actor/random/app-personnage-aleatoire.js +++ b/module/actor/random/app-personnage-aleatoire.js @@ -102,12 +102,8 @@ export class AppPersonnageAleatoire extends FormApplication { constructor(actor) { super({}) this.actor = actor - this.current = AppPersonnageAleatoire.getActorValues() - this.checked = Object.fromEntries(CONTROLS.map(it => [it.name, [0, '', undefined].includes(it.getter(this.current))])) - } - - static getActorValues() { - return Object.fromEntries(CONTROLS.map(it => [it.name, it.getter(this.actor)])); + this.current = Object.fromEntries(CONTROLS.map(it => [it.name, it.getter(this.actor)])); + this.checked = Object.fromEntries(CONTROLS.map(it => [it.name, [0, '', undefined].includes(this.current[it.name])])) } async getData(options) { @@ -141,7 +137,7 @@ export class AppPersonnageAleatoire extends FormApplication { async onApply() { const updates = Object.fromEntries( CONTROLS.filter(control => game.user.isGM || control.name != 'name') - .map(control => [control.path, control.getter(this.current)]) + .map(control => [control.path, this.current[control.name]]) ) await this.actor.update(updates) await this.close() diff --git a/templates/actor/random/app-personnage-aleatoire.hbs b/templates/actor/random/app-personnage-aleatoire.hbs index 6d1e5901..b933896d 100644 --- a/templates/actor/random/app-personnage-aleatoire.hbs +++ b/templates/actor/random/app-personnage-aleatoire.hbs @@ -8,35 +8,35 @@ {{/if}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/random/sexe-aleatoire.hbs" label="Sexe" fieldname="sexe" type="text" - value=current.system.sexe checked=checked.sexe + value=current.sexe checked=checked.sexe }} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs" label="Age" fieldname="age" type="entier" min=10 max=100 - value=current.system.age checked=checked.age + value=current.age checked=checked.age }} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs" label="Taille" fieldname="taille" type="text" - value=current.system.taille checked=checked.taille + value=current.taille checked=checked.taille }} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs" label="Poids" fieldname="poids" type="text" - value=current.system.poids checked=checked.poids + value=current.poids checked=checked.poids }} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs" label="Main directrice" fieldname="main" type="text" - value=current.system.main checked=checked.main + value=current.main checked=checked.main }} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs" label="Heure de naissance" fieldname="heure" type="heure" - value=current.system.heure checked=checked.heure + value=current.heure checked=checked.heure }} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs" label="Cheveux" fieldname="cheveux" type="text" - value=current.system.cheveux checked=checked.cheveux + value=current.cheveux checked=checked.cheveux }} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs" label="Yeux" fieldname="yeux" type="text" - value=current.system.yeux checked=checked.yeux + value=current.yeux checked=checked.yeux }}