mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Added background and connection questions
This commit is contained in:
parent
9dd773001d
commit
def0adf1c8
14 changed files with 201 additions and 39 deletions
|
|
@ -46,6 +46,10 @@ export default class ClassSheet extends DHBaseItemSheet {
|
|||
template: 'systems/daggerheart/templates/sheets/items/class/settings.hbs',
|
||||
scrollable: ['.settings']
|
||||
},
|
||||
questions: {
|
||||
template: 'systems/daggerheart/templates/sheets/items/class/questions.hbs',
|
||||
scrollable: ['.questions']
|
||||
},
|
||||
effects: {
|
||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||
scrollable: ['.effects']
|
||||
|
|
@ -55,7 +59,13 @@ export default class ClassSheet extends DHBaseItemSheet {
|
|||
/** @inheritdoc */
|
||||
static TABS = {
|
||||
primary: {
|
||||
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'settings' }, { id: 'effects' }],
|
||||
tabs: [
|
||||
{ id: 'description' },
|
||||
{ id: 'features' },
|
||||
{ id: 'settings' },
|
||||
{ id: 'questions' },
|
||||
{ id: 'effects' }
|
||||
],
|
||||
initial: 'description',
|
||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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