30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
/**
|
||
* Chroniques de l'Étrange — Système FoundryVTT
|
||
*
|
||
* Chroniques de l'Étrange est un jeu de rôle édité par Antre-Monde Éditions.
|
||
* Ce système FoundryVTT est une implémentation indépendante et n'est pas
|
||
* affilié à Antre-Monde Éditions,
|
||
* mais a été réalisé avec l'autorisation d'Antre-Monde Éditions.
|
||
*
|
||
* @author LeRatierBretonnien
|
||
* @copyright 2024–2026 LeRatierBretonnien
|
||
* @license CC BY-NC-SA 4.0 – https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||
*/
|
||
|
||
export default class EquipmentDataModel extends foundry.abstract.TypeDataModel {
|
||
static defineSchema() {
|
||
const { fields } = foundry.data
|
||
const numberField = (initial = 0, extra = {}) => new fields.NumberField({ required: true, nullable: false, integer: true, initial, ...extra })
|
||
const stringField = (initial = "") => new fields.StringField({ required: true, nullable: false, initial })
|
||
const htmlField = (initial = "") => new fields.HTMLField({ required: true, nullable: false, initial, textSearch: true })
|
||
|
||
return {
|
||
reference: stringField(""),
|
||
description: htmlField(""),
|
||
quantity: numberField(1, { min: 0 }),
|
||
weight: numberField(0, { min: 0 }),
|
||
notes: htmlField(""),
|
||
}
|
||
}
|
||
}
|