20 lines
844 B
JavaScript
20 lines
844 B
JavaScript
export default class ArmorDataModel extends foundry.abstract.TypeDataModel {
|
|
static defineSchema() {
|
|
const { fields } = foundry.data
|
|
const stringField = (initial = "") => new fields.StringField({ required: true, nullable: false, initial })
|
|
const htmlField = (initial = "") => new fields.HTMLField({ required: true, nullable: false, initial, textSearch: true })
|
|
const intField = (initial = 0, opts = {}) => new fields.NumberField({ required: true, nullable: false, integer: true, initial, ...opts })
|
|
|
|
return {
|
|
reference: stringField(""),
|
|
description: htmlField(""),
|
|
protectionValue: intField(0),
|
|
domain: stringField(""),
|
|
obtainLevel: intField(0, { min: 0, max: 5 }),
|
|
obtainDifficulty: intField(0, { min: 0, max: 3 }),
|
|
quantity: intField(1),
|
|
notes: htmlField(""),
|
|
}
|
|
}
|
|
}
|