diff --git a/langs/en-ca.json b/langs/en-ca.json index b1858cc..cd97cdc 100644 --- a/langs/en-ca.json +++ b/langs/en-ca.json @@ -6,6 +6,7 @@ "Item": { "ammo": "Ammo", "armour": "Armour", + "craft": "Craft", "shield": "Shield", "skill": "Skill", "weapon": "Weapon" @@ -42,6 +43,12 @@ "legs": "Legs" }, "armour": "Armour", + "aspect": "Aspect", + "aspectNames": { + "flect": "Flect", + "fract": "Fract", + "focus": "Focus" + }, "currency": { "gold": "Gold", "silver": "Silver", diff --git a/module/data/Item/Craft.mjs b/module/data/Item/Craft.mjs new file mode 100644 index 0000000..6a677a7 --- /dev/null +++ b/module/data/Item/Craft.mjs @@ -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 +}; diff --git a/module/gameTerms.mjs b/module/gameTerms.mjs index eccaa94..f903878 100644 --- a/module/gameTerms.mjs +++ b/module/gameTerms.mjs @@ -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`, diff --git a/module/hooks/init.mjs b/module/hooks/init.mjs index c14ebea..60dc36b 100644 --- a/module/hooks/init.mjs +++ b/module/hooks/init.mjs @@ -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; diff --git a/system.json b/system.json index 0333caf..b7f85ff 100644 --- a/system.json +++ b/system.json @@ -46,6 +46,7 @@ "Item": { "ammo": {}, "armour": {}, + "craft": {}, "shield": {}, "skill": {}, "weapon": {}