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
|
|
@ -6,6 +6,7 @@
|
||||||
"Item": {
|
"Item": {
|
||||||
"ammo": "Ammo",
|
"ammo": "Ammo",
|
||||||
"armour": "Armour",
|
"armour": "Armour",
|
||||||
|
"craft": "Craft",
|
||||||
"shield": "Shield",
|
"shield": "Shield",
|
||||||
"skill": "Skill",
|
"skill": "Skill",
|
||||||
"weapon": "Weapon"
|
"weapon": "Weapon"
|
||||||
|
|
@ -42,6 +43,12 @@
|
||||||
"legs": "Legs"
|
"legs": "Legs"
|
||||||
},
|
},
|
||||||
"armour": "Armour",
|
"armour": "Armour",
|
||||||
|
"aspect": "Aspect",
|
||||||
|
"aspectNames": {
|
||||||
|
"flect": "Flect",
|
||||||
|
"fract": "Fract",
|
||||||
|
"focus": "Focus"
|
||||||
|
},
|
||||||
"currency": {
|
"currency": {
|
||||||
"gold": "Gold",
|
"gold": "Gold",
|
||||||
"silver": "Silver",
|
"silver": "Silver",
|
||||||
|
|
|
||||||
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`,
|
GLIM: `glim`,
|
||||||
THINGLIM: `thin-glim`,
|
THINGLIM: `thin-glim`,
|
||||||
}),
|
}),
|
||||||
|
Aspects: Object.freeze({
|
||||||
|
FOCUS: `focus`,
|
||||||
|
FLECT: `flect`,
|
||||||
|
FRACT: `fract`,
|
||||||
|
}),
|
||||||
FatePath: [
|
FatePath: [
|
||||||
`North`,
|
`North`,
|
||||||
`East`,
|
`East`,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { HeroSummaryCardV1 } from "../Apps/ActorSheets/HeroSummaryCardV1.mjs";
|
||||||
|
|
||||||
// Data Models
|
// Data Models
|
||||||
import { AmmoData } from "../data/Item/Ammo.mjs";
|
import { AmmoData } from "../data/Item/Ammo.mjs";
|
||||||
|
import { CraftData } from "../data/Item/Craft.mjs";
|
||||||
import { HeroData } from "../data/Actor/Hero.mjs";
|
import { HeroData } from "../data/Actor/Hero.mjs";
|
||||||
import { ProtectorData } from "../data/Item/Protector.mjs";
|
import { ProtectorData } from "../data/Item/Protector.mjs";
|
||||||
import { SkillData } from "../data/Item/Skill.mjs";
|
import { SkillData } from "../data/Item/Skill.mjs";
|
||||||
|
|
@ -41,6 +42,7 @@ Hooks.once(`init`, () => {
|
||||||
CONFIG.Actor.dataModels.hero = HeroData;
|
CONFIG.Actor.dataModels.hero = HeroData;
|
||||||
CONFIG.Item.dataModels.ammo = AmmoData,
|
CONFIG.Item.dataModels.ammo = AmmoData,
|
||||||
CONFIG.Item.dataModels.armour = ProtectorData;
|
CONFIG.Item.dataModels.armour = ProtectorData;
|
||||||
|
CONFIG.Item.dataModels.craft = CraftData;
|
||||||
CONFIG.Item.dataModels.shield = ProtectorData;
|
CONFIG.Item.dataModels.shield = ProtectorData;
|
||||||
CONFIG.Item.dataModels.skill = SkillData;
|
CONFIG.Item.dataModels.skill = SkillData;
|
||||||
CONFIG.Item.dataModels.weapon = WeaponData;
|
CONFIG.Item.dataModels.weapon = WeaponData;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
"Item": {
|
"Item": {
|
||||||
"ammo": {},
|
"ammo": {},
|
||||||
"armour": {},
|
"armour": {},
|
||||||
|
"craft": {},
|
||||||
"shield": {},
|
"shield": {},
|
||||||
"skill": {},
|
"skill": {},
|
||||||
"weapon": {}
|
"weapon": {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue