Add Craft as a valid item subtype
This commit is contained in:
parent
71a02970cf
commit
09fe218076
5 changed files with 84 additions and 0 deletions
69
module/data/Item/Craft.mjs
Normal file
69
module/data/Item/Craft.mjs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
import { gameTerms } from "../../gameTerms.mjs";
|
||||
import { SkillData } from "./Skill.mjs";
|
||||
|
||||
const { fields } = foundry.data;
|
||||
|
||||
export class CraftData extends SkillData {
|
||||
// MARK: Schema
|
||||
static defineSchema() {
|
||||
const schema = super.defineSchema();
|
||||
delete schema.ability;
|
||||
|
||||
schema.aspect = new fields.StringField({
|
||||
initial: gameTerms.Aspects.FLECT,
|
||||
blank: true,
|
||||
trim: true,
|
||||
nullable: false,
|
||||
required: true,
|
||||
choices: () => Object.values(gameTerms.Aspects),
|
||||
});
|
||||
|
||||
return schema;
|
||||
};
|
||||
|
||||
// MARK: Base Data
|
||||
prepareBaseData() {
|
||||
super.prepareBaseData();
|
||||
};
|
||||
|
||||
// MARK: Derived Data
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
};
|
||||
|
||||
// #region Getters
|
||||
// #endregion
|
||||
|
||||
// #region Sheet Data
|
||||
getFormFields(_ctx) {
|
||||
const fields = [
|
||||
{
|
||||
id: `fate-path`,
|
||||
type: `dropdown`,
|
||||
label: `RipCrypt.common.aspect`,
|
||||
path: `system.aspect`,
|
||||
value: this.aspect,
|
||||
options: Object.values(gameTerms.Aspects).map(aspect => ({
|
||||
label: `RipCrypt.common.aspectNames.${aspect}`,
|
||||
value: aspect,
|
||||
})),
|
||||
},
|
||||
{
|
||||
type: `group`,
|
||||
title: `RipCrypt.common.advances`,
|
||||
paddingTop: `20px`,
|
||||
fields: Object.values(gameTerms.Rank).map(rank => {
|
||||
return {
|
||||
id: `advance-${rank}`,
|
||||
type: `text`,
|
||||
label: `RipCrypt.common.rankNames.${rank}`,
|
||||
path: `system.advances.${rank}`,
|
||||
value: this.advances[rank] ?? ``,
|
||||
};
|
||||
}),
|
||||
},
|
||||
];
|
||||
return fields;
|
||||
};
|
||||
// #endregion
|
||||
};
|
||||
|
|
@ -6,6 +6,11 @@ export const gameTerms = Object.preventExtensions({
|
|||
GLIM: `glim`,
|
||||
THINGLIM: `thin-glim`,
|
||||
}),
|
||||
Aspects: Object.freeze({
|
||||
FOCUS: `focus`,
|
||||
FLECT: `flect`,
|
||||
FRACT: `fract`,
|
||||
}),
|
||||
FatePath: [
|
||||
`North`,
|
||||
`East`,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,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 { HeroData } from "../data/Actor/Hero.mjs";
|
||||
import { ProtectorData } from "../data/Item/Protector.mjs";
|
||||
import { SkillData } from "../data/Item/Skill.mjs";
|
||||
|
|
@ -41,6 +42,7 @@ Hooks.once(`init`, () => {
|
|||
CONFIG.Actor.dataModels.hero = HeroData;
|
||||
CONFIG.Item.dataModels.ammo = AmmoData,
|
||||
CONFIG.Item.dataModels.armour = ProtectorData;
|
||||
CONFIG.Item.dataModels.craft = CraftData;
|
||||
CONFIG.Item.dataModels.shield = ProtectorData;
|
||||
CONFIG.Item.dataModels.skill = SkillData;
|
||||
CONFIG.Item.dataModels.weapon = WeaponData;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue