chore: more model stuff

This commit is contained in:
Joscha Maier 2024-10-02 14:45:44 +02:00
parent ada2dc40c5
commit 8da6565aae
No known key found for this signature in database
GPG Key ID: 8C4D045D84A30ABA
9 changed files with 49 additions and 13 deletions

25
kidsonbrooms.mjs Normal file
View File

@ -0,0 +1,25 @@
import * as models from "./modules/dataModel/_system.mjs";
/* -------------------------------------------- */
/* Foundry VTT Initialization */
/* -------------------------------------------- */
const SYSTEM = {
id: "kidsonbrooms",
}
Hooks.once("init", async function() {
console.log("Initialising Kids on Brooms system");
globalThis.kidsonbrooms = game.system;
game.system.CONST = SYSTEM;
Object.assign(CONFIG.Actor.dataModels, {
PC: models.PlayerCharacter
})
CONFIG.LOCALIZATION_PREFIXES = {
kidsonbrooms: "KidsOnBrooms"
}
})

View File

@ -1,5 +1,4 @@
{ {
"KIDSONBROOMS.EffectCreate": "Create Effect", "KIDSONBROOMS.EffectCreate": "Create Effect",
"KIDSONBROOMS.EffectToggle": "Toggle Effect", "KIDSONBROOMS.EffectToggle": "Toggle Effect",
"KIDSONBROOMS.EffectEdit": "Edit Effect", "KIDSONBROOMS.EffectEdit": "Edit Effect",

View File

@ -0,0 +1,4 @@
export * from "./itemModel.mjs";
export * from "./dataModel.mjs";
export * from "./playerCharacterModel.mjs";
export * from "./baseActorModel.mjs"

View File

@ -4,7 +4,7 @@ import Stat from "./dataModel.mjs"
/* Actor base Model */ /* Actor base Model */
/* -------------------------------------------- */ /* -------------------------------------------- */
const fields = foundry.data.fields; const fields = foundry.data.fields;
class ActorGeneral extends foundry.abstract.TypeDataModel export default class ActorGeneral extends foundry.abstract.TypeDataModel
{ {
static defineSchema(){ static defineSchema(){
return { return {

View File

@ -2,7 +2,7 @@
/* Base Models */ /* Base Models */
/* -------------------------------------------- */ /* -------------------------------------------- */
const fields = foundry.data.fields; const fields = foundry.data.fields;
class Stat extends foundry.abstract.DataModel export default class Stat extends foundry.abstract.DataModel
{ {
static defineSchema() { static defineSchema() {
return { return {
@ -15,7 +15,7 @@ class Stat extends foundry.abstract.DataModel
} }
} }
class Modifier extends foundry.abstract.DataModel export class Modifier extends foundry.abstract.DataModel
{ {
static defineSchema() { static defineSchema() {
return { return {
@ -35,7 +35,7 @@ class Modifier extends foundry.abstract.DataModel
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Effect Models */ /* Effect Models */
/* -------------------------------------------- */ /* -------------------------------------------- */
class Effect extends foundry.abstract.DataModel export class Effect extends foundry.abstract.DataModel
{ {
static defineSchema() { static defineSchema() {
return { return {
@ -45,7 +45,7 @@ class Effect extends foundry.abstract.DataModel
} }
} }
class Flaw extends foundry.abstract.DataModel export class Flaw extends foundry.abstract.DataModel
{ {
static defineSchema() { static defineSchema() {
return { return {
@ -55,7 +55,7 @@ class Flaw extends foundry.abstract.DataModel
} }
} }
class Strength extends Effect export class Strength extends Effect
{ {
static defineSchema() { static defineSchema() {
return { return {

View File

@ -5,7 +5,7 @@ import Effect from "./dataModel.mjs";
/* -------------------------------------------- */ /* -------------------------------------------- */
/* How this will work is when we first load a sheet we load all the items we have and take their effects and apply them to our stats. */ /* How this will work is when we first load a sheet we load all the items we have and take their effects and apply them to our stats. */
const fields = foundry.data.fields; const fields = foundry.data.fields;
class KidsOnBroomsItem extends foundry.abstract.TypeDataModel export default class KidsOnBroomsItem extends foundry.abstract.TypeDataModel
{ {
static defineSchema() { static defineSchema() {
return { return {
@ -23,7 +23,7 @@ class KidsOnBroomsItem extends foundry.abstract.TypeDataModel
} }
} }
class Wand extends KidsOnBroomsItem export class Wand extends KidsOnBroomsItem
{ {
static defineSchema() { static defineSchema() {
return { return {
@ -33,11 +33,11 @@ class Wand extends KidsOnBroomsItem
} }
} }
class Broom extends KidsOnBroomsItem export class Broom extends KidsOnBroomsItem
{ {
static defineSchema(){ static defineSchema(){
return { return {
look: new fields.StringField({requird: true, intial: "A broom"}), look: new fields.StringField({required: true, initial: "A broom"}),
mechanicalBenefit: new fields.EmbeddedDataField(Effect, {required: false}) mechanicalBenefit: new fields.EmbeddedDataField(Effect, {required: false})
} }
} }

View File

@ -1,11 +1,12 @@
import ActorGeneral from "./baseActorModel.mjs"; import ActorGeneral from "./baseActorModel.mjs";
import {KidsOnBroomsItem, Wand, Broom} from "./itemModel.mjs" import {Wand, Broom} from "./itemModel.mjs"
import KidsOnBroomsItem from "./itemModel.mjs"
/* -------------------------------------------- */ /* -------------------------------------------- */
/* PC Model */ /* PC Model */
/* -------------------------------------------- */ /* -------------------------------------------- */
const fields = foundry.data.fields; const fields = foundry.data.fields;
class PlayerCharacter extends ActorGeneral export default class PlayerCharacter extends ActorGeneral
{ {
static defineSchema(){ static defineSchema(){
return { return {

View File

@ -0,0 +1,7 @@
export default class KidsOnBroomsActor extends Actor {
constructor(data, context) {
super(data, context)
}
}