37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
|
import CommonTemplate from "./common-template.mjs"
|
||
|
import { RARETES } from "../item/raretes.js"
|
||
|
import { DECIMAL, INTEGER, INTEGER_SIGNED, MODEL_ARRAY, STRING } from "./field-types.mjs"
|
||
|
|
||
|
const fields = foundry.data.fields
|
||
|
|
||
|
export class CommonInventaire extends CommonTemplate {
|
||
|
fields() {
|
||
|
return {
|
||
|
encombrement: new fields.NumberField({ label: "Encombrement", initial: 0, ...INTEGER }),
|
||
|
quantite: new fields.NumberField({ label: "Quantité", initial: 1, ...INTEGER }),
|
||
|
qualite: new fields.NumberField({ label: "Qualité", initial: 0, ...INTEGER_SIGNED }),
|
||
|
cout: new fields.NumberField({ label: "Coût", initial: 0.0, ...DECIMAL }),
|
||
|
environnement: new fields.ArrayField(
|
||
|
new fields.SchemaField({
|
||
|
milieu: new fields.StringField({ label: "Milieu", initial: "", ...STRING }),
|
||
|
rarete: new fields.StringField({
|
||
|
label: "Rareté", initial: RARETES[0].code, ...STRING,
|
||
|
validate: (value, options) => RARETES.find(it => it.code == value)
|
||
|
}),
|
||
|
frequence: new fields.NumberField({ label: "Fréquence", initial: RARETES[0].frequence, ...INTEGER }),
|
||
|
}),
|
||
|
{ label: "Environnement", ...MODEL_ARRAY }),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
handlebars() {
|
||
|
return [
|
||
|
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-inventaire.hbs"
|
||
|
]
|
||
|
}
|
||
|
|
||
|
async prepareContext(item) {
|
||
|
return {}
|
||
|
}
|
||
|
}
|