mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Added background and connection questions (#1109)
This commit is contained in:
parent
8fd63d5963
commit
c6741b1c7a
14 changed files with 201 additions and 39 deletions
|
|
@ -49,6 +49,8 @@ export default class DHClass extends BaseDataItem {
|
|||
suggestedSecondaryWeapon: new ForeignDocumentUUIDField({ type: 'Item' }),
|
||||
suggestedArmor: new ForeignDocumentUUIDField({ type: 'Item' })
|
||||
}),
|
||||
backgroundQuestions: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }),
|
||||
connections: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }),
|
||||
isMulticlass: new fields.BooleanField({ initial: false })
|
||||
};
|
||||
}
|
||||
|
|
@ -96,6 +98,20 @@ export default class DHClass extends BaseDataItem {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!data.system.isMulticlass) {
|
||||
const addQuestions = (base, questions) => {
|
||||
return `${base}${questions.map(q => `<p><strong>${q}</strong></p>`).join('<br/>')}`;
|
||||
};
|
||||
const backgroundQuestions = data.system.backgroundQuestions.filter(x => x);
|
||||
const connections = data.system.connections.filter(x => x);
|
||||
await this.actor.update({
|
||||
'system.biography': {
|
||||
background: addQuestions(this.actor.system.biography.background, backgroundQuestions),
|
||||
connections: addQuestions(this.actor.system.biography.connections, connections)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const allowed = await super._preCreate(data, options, user);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue