Work on creating more of the necessary data models

This commit is contained in:
Oliver-Akins 2024-01-15 22:47:47 -07:00
parent ef9a3f2542
commit eb8d4f7c11
8 changed files with 56 additions and 15 deletions

View file

@ -8,10 +8,10 @@ const ammoTypes = [`quivers`, `mags`, `cells`];
const stats = [ `build`, `meta`, `presence`, `hands`, `tilt`, `rng` ];
const buildSkills = [ "defense", "magic", "melee", "platforming", "strength", ];
const metaSkills = [ "alchemy", "arcanum", "dreams", "lore", "navigation", ];
const presenceSkills = [ "animal_handling", "perception", "sneak", "speech", "vibes", ];
const handsSkills = [ "accuracy", "crafting", "engineering", "explosives", "piloting", ];
const buildSkills = [ `defense`, `magic`, `melee`, `platforming`, `strength`, ];
const metaSkills = [ `alchemy`, `arcanum`, `dreams`, `lore`, `navigation`, ];
const presenceSkills = [ `animal_handling`, `perception`, `sneak`, `speech`, `vibes`, ];
const handsSkills = [ `accuracy`, `crafting`, `engineering`, `explosives`, `piloting`, ];
const allSkills = [
...buildSkills,
@ -27,6 +27,11 @@ const skills = {
hands: handsSkills,
};
const itemTiers = [
`simple`, `greater`,
`rare`, `legendary`
];
export default {
stats,
statDice,
@ -39,4 +44,5 @@ export default {
handsSkills,
allSkills,
skills,
itemTiers,
};

View file

@ -1,5 +1,6 @@
import PlayerActor from "./Player.mjs";
/** @extends {Actor} */
export class ActorHandler extends Actor {
proxyTargets = {
player: PlayerActor,

View file

@ -1,13 +1,11 @@
import AspectItem from "./Aspect.mjs";
import SpellItem from "./Spell.mjs";
/**
* @extends {Item}
*/
/** @extends {Item} */
export class ItemHandler extends Item {
/** @override */
proxyTargets = {
aspect: AspectItem,
spell: SpellItem
};
constructor(data, ctx) {
@ -19,6 +17,11 @@ export class ItemHandler extends Item {
return this.proxyTargets[this.type];
};
async migrateSystemData() {
if (!this.fn?.migrateSystemData) return;
this.fn?.migrateSystemData.bind(this)();
};
async proxyFunction(funcName, ...args) {
if (!this.fn?.[funcName]) return;
return await this.fn?.[funcName].bind(this)(...args);

View file

@ -0,0 +1,10 @@
import { ItemHandler } from "./Handler.mjs";
/** @this {ItemHandler} */
async function migrateSystemData() {
this.system
};
export default {
migrateSystemData,
};

View file

@ -1,11 +1,22 @@
import { itemTiers } from "../../config.mjs";
export class CommonItemData extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
return {
cost: new fields.NumberField({
buy: new fields.NumberField({
initial: null,
nullable: true,
}),
usage_cost: new fields.NumberField({
initial: null,
nullable: true,
}),
tier: new fields.StringField({
initial: `simple`,
nullable: false,
choices: itemTiers,
}),
};
};
};

View file

@ -0,0 +1,15 @@
import { DescribedItemData } from "./DescribedItemData.mjs";
export class EquipmentItemData extends DescribedItemData {
static defineSchema() {
const fields = foundry.data.fields;
return mergeObject(super.defineSchema(), {
extra_inventory: new fields.NumberField({
initial: null,
nullable: true,
required: false,
}),
material
});
};
};

View file

@ -4,7 +4,6 @@ export class PetItemData extends DescribedItemData {
static defineSchema() {
const fields = foundry.data.fields;
return mergeObject(super.defineSchema(), {
purchase: new fields.NumberField({ initial: 0, }),
upkeep: new fields.NumberField({ intial: null, nullable: true }),
pokeballd: new fields.BooleanField({ initial: false }),
});

View file

@ -8,10 +8,6 @@ export class TransportationItemData extends DescribedItemData {
initial: null,
nullable: true,
}),
purchase: new fields.NumberField({
initial: null,
nullable: true,
}),
upkeep: new fields.NumberField({
initial: null,
nullable: true,