Fix Description aléatoire

This commit was merged in pull request #822.
This commit is contained in:
2026-07-17 03:07:30 +02:00
parent a55904742b
commit 5dbd7c3784
2 changed files with 11 additions and 15 deletions
@@ -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()
@@ -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
}}
</div>
<hr>