Add support for the Good item type to represent all misc items in the game
This commit is contained in:
parent
eb6d7fee94
commit
2d804e7aa2
5 changed files with 61 additions and 0 deletions
|
|
@ -7,6 +7,7 @@
|
|||
"ammo": "Ammo",
|
||||
"armour": "Armour",
|
||||
"craft": "Craft",
|
||||
"good": "Good",
|
||||
"shield": "Shield",
|
||||
"skill": "Skill",
|
||||
"weapon": "Weapon"
|
||||
|
|
|
|||
56
module/data/Item/Good.mjs
Normal file
56
module/data/Item/Good.mjs
Normal 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
|
||||
};
|
||||
|
|
@ -40,5 +40,6 @@ export const gameTerms = Object.preventExtensions({
|
|||
`armour`,
|
||||
`weapon`,
|
||||
`shield`,
|
||||
`good`,
|
||||
]),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { HeroSummaryCardV1 } from "../Apps/ActorSheets/HeroSummaryCardV1.mjs";
|
|||
// Data Models
|
||||
import { AmmoData } from "../data/Item/Ammo.mjs";
|
||||
import { CraftData } from "../data/Item/Craft.mjs";
|
||||
import { GoodData } from "../data/Item/Good.mjs";
|
||||
import { HeroData } from "../data/Actor/Hero.mjs";
|
||||
import { ProtectorData } from "../data/Item/Protector.mjs";
|
||||
import { SkillData } from "../data/Item/Skill.mjs";
|
||||
|
|
@ -45,6 +46,7 @@ Hooks.once(`init`, () => {
|
|||
CONFIG.Item.dataModels.ammo = AmmoData,
|
||||
CONFIG.Item.dataModels.armour = ProtectorData;
|
||||
CONFIG.Item.dataModels.craft = CraftData;
|
||||
CONFIG.Item.dataModels.good = GoodData;
|
||||
CONFIG.Item.dataModels.shield = ProtectorData;
|
||||
CONFIG.Item.dataModels.skill = SkillData;
|
||||
CONFIG.Item.dataModels.weapon = WeaponData;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
"ammo": {},
|
||||
"armour": {},
|
||||
"craft": {},
|
||||
"good": {},
|
||||
"shield": {},
|
||||
"skill": {},
|
||||
"weapon": {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue