Add support for the Good item type to represent all misc items in the game

This commit is contained in:
Oliver-Akins 2025-02-11 23:54:59 -07:00
parent eb6d7fee94
commit 2d804e7aa2
5 changed files with 61 additions and 0 deletions

56
module/data/Item/Good.mjs Normal file
View file

@ -0,0 +1,56 @@
import { CommonItemData } from "./Common.mjs";
const { fields } = foundry.data;
export class GoodData extends CommonItemData {
// MARK: Schema
static defineSchema() {
const schema = super.defineSchema();
schema.description = new fields.HTMLField({
blank: true,
nullable: false,
trim: true,
});
return schema;
};
// MARK: Base Data
prepareBaseData() {
super.prepareBaseData();
};
// MARK: Derived Data
prepareDerivedData() {
super.prepareDerivedData();
};
// #region Getters
// #endregion
// #region Sheet Data
async getFormFields(_ctx) {
const fields = [
{
id: `quantity`,
type: `integer`,
label: `RipCrypt.common.quantity`,
path: `system.quantity`,
value: this.quantity,
min: 0,
},
{
id: `description`,
type: `prosemirror`,
label: `RipCrypt.common.description`,
path: `system.description`,
uuid: this.parent.uuid,
value: await TextEditor.enrichHTML(this.description),
collaborative: false,
},
];
return fields;
};
// #endregion
};