From bcf1d8827d2d5ee07434dedfb2ee8c0199c5abf1 Mon Sep 17 00:00:00 2001 From: Joscha Maier Date: Sun, 29 Sep 2024 14:58:03 +0200 Subject: [PATCH] stuff --- modules/dataModel/dataModel.js | 106 ++++++++++++++++++++++++++ modules/dataModel/kidsonbrooms.mjs | 0 package-lock.json | 118 +++++++++++++++++++++++++++++ package.json | 1 + system.json | 23 +++++- templates/item/item-sheet.html | 0 6 files changed, 245 insertions(+), 3 deletions(-) create mode 100644 modules/dataModel/dataModel.js create mode 100644 modules/dataModel/kidsonbrooms.mjs create mode 100644 templates/item/item-sheet.html diff --git a/modules/dataModel/dataModel.js b/modules/dataModel/dataModel.js new file mode 100644 index 0000000..0f09ca2 --- /dev/null +++ b/modules/dataModel/dataModel.js @@ -0,0 +1,106 @@ +const fields = foundry.data.fields; + +/* -------------------------------------------- */ +/* Base Models */ +/* -------------------------------------------- */ + +class Stat extends foundry.abstract.DataModel +{ + static defineSchema() { + return { + id: new StringField({ required: true, initial: "statID"}), + name: new StringField({ required: true, intial: "Stat"}), + die: new NumberField({ required: true, integer: true, min: 0, max: 20, initial: 4}), + modifiers: new ArrayField({ required: true, type: Modifier, default: []}), + }; + } +} + +class Modifier extends foundry.abstract.DataModel +{ + static defineSchema() { + return { + statID: new StringField({ required: true, initial: "statID"}), + name: new StringField({ required: true, initial: "Modifier"}), + value: new NumberField({ required: true, integer: true, initial: 0}), + }; + } + + Modifier(statID,name,value) { + this.statID = statID; + this.name = name; + this.value = value; + }; +} + +/* -------------------------------------------- */ +/* Effect Models */ +/* -------------------------------------------- */ + +class EffectDataModel extends foundry.abstract.DataModel +{ + static defineSchema() { + return { + description: new StringField({ required: true, initial: "A EffectDescription" }), + modifier: new EmbeddedDataField(Modifier, { required: true, nullable: true, default: null}), + }; + } +} + +class Flaw extends foundry.abstract.DataModel +{ + static defineSchema() { + return { + name: new StringField({ required: true, initial: "Flaw"}), + description: new StringField({ required: true, initial: "A FlawDescription" }) + }; + } +} + +class Strength extends EffectDataModel +{ + static defineSchema() { + return { + ...super.defineSchema(), + name: new StringField({ required: true, initial: "Strength"}) + }; + } +} + +/* -------------------------------------------- */ +/* Item Models */ +/* -------------------------------------------- */ +/* 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. */ + +class Item extends foundry.abstract.TypeDataModel +{ + static defineSchema() { + return { + name: new StringField({ required: true, initial: "Item"}), + description: new StringField({ required: true, initial: "An ItemDescription" }), + effects: new ArrayField({ required: true, type: EffectDataModel, default: []}), + }; + } + + Item(name,description,effects) { + this.name = name; + this.description = description; + this.effects = effects; + } +} + +class Wand extends Item +{ + static defineSchema() { + return { + name: new StringField({ required: true, initial: "Wand"}), + wood: new EmbeddedDataField(Item, { required: true, nullable: true, default: null}), //These are just items! + core: new EmbeddedDataField(Item, { required: true, nullable: true, default: null}), + }; + } +} + + +/* -------------------------------------------- */ +/* Actor Models */ +/* -------------------------------------------- */ diff --git a/modules/dataModel/kidsonbrooms.mjs b/modules/dataModel/kidsonbrooms.mjs new file mode 100644 index 0000000..e69de29 diff --git a/package-lock.json b/package-lock.json index be348f8..3e5cbfb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,9 +13,23 @@ }, "devDependencies": { "gulp": "^5.0.0", + "mathjs": "^13.1.1", "sass": "^1.79.3" } }, + "node_modules/@babel/runtime": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz", + "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@gulpjs/messages": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@gulpjs/messages/-/messages-1.1.0.tgz", @@ -299,6 +313,20 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/complex.js": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.1.1.tgz", + "integrity": "sha512-8njCHOTtFFLtegk6zQo0kkVX1rngygb/KQI6z1qZxlFI3scluC+LVTCFbrkWjBv4vvLlbQ9t88IPMC6k95VTTg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/infusion" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -318,6 +346,13 @@ "node": ">= 10.13.0" } }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "dev": true, + "license": "MIT" + }, "node_modules/detect-file": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", @@ -364,6 +399,13 @@ "node": ">=6" } }, + "node_modules/escape-latex": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz", + "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==", + "dev": true, + "license": "MIT" + }, "node_modules/expand-tilde": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", @@ -488,6 +530,20 @@ "node": ">=0.10.0" } }, + "node_modules/fraction.js": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://github.com/sponsors/rawify" + } + }, "node_modules/fs-mkdirp-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-2.0.1.tgz", @@ -975,6 +1031,13 @@ "node": ">=0.10.0" } }, + "node_modules/javascript-natural-sort": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", + "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", + "dev": true, + "license": "MIT" + }, "node_modules/kidsonbroomsfoundryvtt": { "resolved": "", "link": true @@ -1024,6 +1087,30 @@ "node": ">=0.10.0" } }, + "node_modules/mathjs": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-13.1.1.tgz", + "integrity": "sha512-duaSAy7m4F+QtP1Dyv8MX2XuxcqpNDDlGly0SdVTCqpAmwdOFWilDdQKbLdo9RfD6IDNMOdo9tIsEaTXkconlQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime": "^7.25.4", + "complex.js": "^2.1.1", + "decimal.js": "^10.4.3", + "escape-latex": "^1.2.0", + "fraction.js": "^4.3.7", + "javascript-natural-sort": "^0.7.1", + "seedrandom": "^3.0.5", + "tiny-emitter": "^2.1.0", + "typed-function": "^4.2.1" + }, + "bin": { + "mathjs": "bin/cli.js" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -1210,6 +1297,13 @@ "node": ">= 10.13.0" } }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "dev": true, + "license": "MIT" + }, "node_modules/remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", @@ -1338,6 +1432,13 @@ "node": ">=14.0.0" } }, + "node_modules/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==", + "dev": true, + "license": "MIT" + }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -1493,6 +1594,13 @@ "b4a": "^1.6.4" } }, + "node_modules/tiny-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", + "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", + "dev": true, + "license": "MIT" + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1517,6 +1625,16 @@ "node": ">=10.13.0" } }, + "node_modules/typed-function": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.1.tgz", + "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, "node_modules/unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", diff --git a/package.json b/package.json index 33080d3..6d06d02 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "license": "ISC", "devDependencies": { "gulp": "^5.0.0", + "mathjs": "^13.1.1", "sass": "^1.79.3" }, "dependencies": { diff --git a/system.json b/system.json index 187cb7e..c3defff 100644 --- a/system.json +++ b/system.json @@ -1,5 +1,5 @@ { - "name": "Kids-On-Brooms", + "name": "kidsonbrooms", "title": "Kids on Brooms", "description": "This is a implementation of the Kids on Brooms system in FoundryVTT.", "version": "0.1.0", @@ -7,6 +7,7 @@ "minimum": 12, "verified": 12 }, + "esmodules": ["modules/kidsonbrooms.mjs"], "authors": [{ "name": "Joscha Maier", "url": "https://github.com/josmaier" @@ -16,8 +17,24 @@ "name": "English", "path": "lang/en.json" }], + "packs": [], + "packFolders": [], "socket": true, - "url": "https://github.com/josmaier/KidsOnBroomsFoundryVTT", + "url": "https://gitlab.com/wintermyst/kidsonbrooms", "manifest": "https://your/hosted/system/repo/system.json", - "download": "https://your/packaged/download/archive.zip" + "download": "https://your/packaged/download/archive.zip", + "gridDistance": 5, + "gridUnits": "ft", + "relationships": { + "requires": [ + { + "id": "lib-wrapper", + "type": "module", + "compatibility": { + "minimum": "1.0.0.0", + "verified": "1.12.6.0" + } + } + ] + } } diff --git a/templates/item/item-sheet.html b/templates/item/item-sheet.html new file mode 100644 index 0000000..e69de29