From c8bddd3ef6af472b987a50314fbdf2daa80a3b2f Mon Sep 17 00:00:00 2001 From: LUCASTUCIOUS Date: Fri, 10 Mar 2023 00:54:45 +0100 Subject: [PATCH] Move json struct to json.schema --- .vscode/settings.json | 11 + .vscode/spells-schemas.json | 306 ++++++++++++++++++++++++++++ README.md | 43 +--- data/spells/spells-grimoire-en.json | 10 +- data/spells/spells-grimoire-fr.json | 6 +- 5 files changed, 327 insertions(+), 49 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 .vscode/spells-schemas.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d009129 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "json.schemas": [ + + { + "fileMatch": [ + "data/spells/*.json" + ], + "url": "/./.vscode/spells-schemas.json" + } + ], +} \ No newline at end of file diff --git a/.vscode/spells-schemas.json b/.vscode/spells-schemas.json new file mode 100644 index 0000000..b5fada0 --- /dev/null +++ b/.vscode/spells-schemas.json @@ -0,0 +1,306 @@ +{ + "$comment": "TODO: Subdivide the schema to have a common definition for each data (spells, books, creatures)", + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/object1678401116.json", + "title": "Root", + "type": "object", + "required": ["spell"], + "properties": { + "spell": { + "$id": "#root/spell", + "title": "Spell", + "type": "array", + "default": [], + "items": { + "$id": "#root/spell/items", + "title": "Items", + "type": "object", + "required": [ + "recid", + "name", + "source", + "page", + "srd", + "level", + "school", + "time", + "range", + "components", + "duration", + "desc" + ], + "properties": { + "recid": { + "$id": "#root/spell/items/recid", + "title": "Recid", + "type": "integer", + "examples": [0], + "default": 0, + "description": "unique id for the spell, for localization purpose", + "uniqueItems": true, + "autoIncrement": true + }, + "name": { + "$id": "#root/spell/items/name", + "title": "Name", + "type": "string", + "default": "", + "examples": ["Acid Arrow"], + "pattern": "^.*$" + }, + "source": { + "$id": "#root/spell/items/source", + "title": "Source", + "description": "what's the source. Each enum is a book code", + "type": "string", + "default": "GRI01", + "enum": ["GRI01", "ENC01", "CRE01", "GRI02", "ENC02", "CRE02"], + "examples": ["GRI01"], + "pattern": "^.*$" + }, + "page": { + "$id": "#root/spell/items/page", + "description": "in the book, page source", + "title": "Page", + "type": "integer", + "examples": [110], + "default": 0 + }, + "srd": { + "$id": "#root/spell/items/srd", + "description": "is srd or a creation", + "title": "Srd", + "type": "boolean", + "examples": [true], + "default": true + }, + "level": { + "$id": "#root/spell/items/level", + "title": "Level", + "type": "integer", + "examples": [2], + "default": 0 + }, + "school": { + "$id": "#root/spell/items/school", + "description": " 'A' : Abjuration,'C' : Conjuration, 'D': Divination, 'E': Enchantment, 'N': Necromancy, 'T' : Transmutation, 'I' : Illusion, 'V' : Evocation", + "enum": ["A", "C", "D", "E", "I", "N", "T", "V"], + "title": "School", + "type": "string", + "examples": ["E"], + "pattern": "^.*$" + }, + "time": { + "$id": "#root/spell/items/time", + "title": "Time", + "type": "array", + "default": [], + "items": { + "$id": "#root/spell/items/time/items", + "title": "Items", + "type": "object", + "required": ["number", "unit"], + "properties": { + "number": { + "$id": "#root/spell/items/time/items/number", + "title": "Number", + "type": "integer", + "examples": [1], + "default": 0 + }, + "unit": { + "$id": "#root/spell/items/time/items/unit", + "title": "Unit", + "type": "string", + "default": "", + "examples": ["action"], + "pattern": "^.*$" + } + }, + "dependentRequired": { + "number": ["unit"] + } + } + }, + "range": { + "$id": "#root/spell/items/range", + "title": "Range", + "type": "object", + "required": ["type", "distance"], + "properties": { + "type": { + "$id": "#root/spell/items/range/type", + "title": "Type", + "type": "string", + "default": "point", + "examples": ["point"], + "pattern": "^.*$", + "enum": ["point", "cone", "sphere", "cylinder", "special"], + "description": "point by default, but can be cone, sphere, cylinder, special " + }, + "distance": { + "$id": "#root/spell/items/range/distance", + "title": "Distance", + "type": "object", + "required": ["type", "amount"], + "properties": { + "type": { + "$id": "#root/spell/items/range/distance/type", + "title": "Type", + "type": "string", + "default": "", + "examples": ["feet"], + "pattern": "^.*$" + }, + "amount": { + "$id": "#root/spell/items/range/distance/amount", + "title": "Amount", + "type": "integer", + "examples": [90], + "default": 0 + } + } + } + } + }, + "components": { + "$id": "#root/spell/items/components", + "title": "Components", + "type": "object", + "properties": { + "v": { + "$id": "#root/spell/items/components/v", + "title": "V", + "type": "boolean", + "examples": [true], + "default": true + }, + "s": { + "$id": "#root/spell/items/components/s", + "title": "S", + "type": "boolean", + "examples": [true], + "default": true + }, + "m": { + "$id": "#root/spell/items/components/m", + "title": "M", + "type": "string", + "default": "", + "examples": ["powdered rhubarb leaf and an adder’s stomach"], + "pattern": "^.*$" + } + } + }, + "duration": { + "$id": "#root/spell/items/duration", + "title": "Duration", + "type": "array", + "default": [], + "items": { + "$id": "#root/spell/items/duration/items", + "title": "Items", + "type": "object", + "required": ["type"], + "properties": { + "type": { + "$id": "#root/spell/items/duration/items/type", + "title": "Type", + "type": "string", + "enum": ["timed", "permanent", "special", "instant"], + "default": "", + "examples": ["instant"], + "pattern": "^.*$" + } + } + } + }, + "concentration": { + "$id": "#root/spell/items/concentration", + "title": "Concentration", + "type": "boolean", + "default": false + }, + "desc": { + "$id": "#root/spell/items/desc", + "title": "Desc", + "type": "array", + "default": [], + "items": { + "$id": "#root/spell/items/desc/items", + "title": "Items", + "type": "string", + "description": "A description for the entry. Do not copy-paste gameplay infos to prevent copyright", + "default": "", + "examples": [ + "A shimmering green arrow streaks toward a target within range and bursts in a spray of acid." + ], + "pattern": "^.*$" + } + }, + "damageInflict": { + "$id": "#root/spell/items/damageInflict", + "title": "Damageinflict", + "type": "array", + "default": [], + "items": { + "$id": "#root/spell/items/damageInflict/items", + "title": "Items", + "type": "string", + "default": "", + "examples": ["acid"], + "pattern": "^.*$" + } + }, + "savingThrow": { + "$id": "#root/spell/items/savingThrow", + "title": "Savingthrow", + "description": "array of saving Throw available", + "type": "array", + "default": [], + "items": { + "$id": "#root/spell/items/savingThrow/items", + "title": "Items", + "type": "string", + "default": "", + "enum": ["Dex", "Str", "Sag", "Cha", "Int", "Con"], + "examples": [""], + "pattern": "^.*$", + "minItems": 1, + "uniqueItems": true + } + }, + "miscTags": { + "$id": "#root/spell/items/miscTags", + "title": "Misctags", + "type": "array", + "default": [], + "items": { + "$id": "#root/spell/items/miscTags/items", + "title": "Items", + "type": "string", + "default": "", + "examples": [""], + "pattern": "^.*$" + } + }, + "areaTags": { + "$id": "#root/spell/items/areaTags", + "title": "Areatags", + "type": "array", + "default": [], + "items": { + "$id": "#root/spell/items/areaTags/items", + "title": "Items", + "type": "string", + "default": "", + "examples": [""], + "pattern": "^.*$" + } + } + } + } + } + } +} diff --git a/README.md b/README.md index ff58051..56a71ef 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,9 @@ -#FateforgeTools -blabla +# FateforgeTools +A suite of tools for Fateforge players and Masters. ### Lib - bryntum-grid - water.css - data localize - jquery - -## Spells - -### JSON structure - -| field | type | value | -| ------------------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -| id | _number_ | unique id for the spell, for localization purpose | -| name | _string_ | spell's name | -| source | _number_ | where the spell is coming from | -| page | _number_ | page source | -| srd | _boolean_ | is this a srd or a creation | -| level | _number_ | spell's level | -| school | _string_ | spell school : "A" : Abjuration,"C" : Conjuration, "D": Divination, "E": Enchantment, "N": Necromancy, "T" : Transmutation, "I" : Illusion, "V" : Evocation | -| time | _array_ | incantation time | -| time.number | _number_ | | -| time.unit | _string_ | | -| range | _module_ | | -| range.type | _string_ | point by default, but can be cone, sphere, cylinder, special | -| range.distance | _module_ | | -| range.distance.type | _string_ | feet or meter or other unit measure | -| range.distance.amount | _number_ | amount of distance in `range.distance.type` | -| components | _module_ | | -| components.v | _boolean_ | verbal component | -| components.s | _boolean_ | somatic component | -| components.m | _string_ | materials components | -| duration | _array_ | | -| duration.type | _string_ | timed, permanent, special or instant | -| duration.duration | _module_ | | -| duration.duration.type | _string_ | minute or hours | -| duration.duration.amount | _number_ | amount of `duration.duration.type` | -| concentration | _boolena_ | does spell need concentration ? | -| desc | _array_ | markdown description of the spell | -| damageInflict | _string_ | | -| conditionInflict | _string_ | | -| savingThrow | _array_ | array of string of saving Throw available | -| miscTags | _array_ | | -| | | | +- w2ui \ No newline at end of file diff --git a/data/spells/spells-grimoire-en.json b/data/spells/spells-grimoire-en.json index 4d9a885..2435f92 100644 --- a/data/spells/spells-grimoire-en.json +++ b/data/spells/spells-grimoire-en.json @@ -3,7 +3,7 @@ { "recid": 0, "name": "Acid Arrow", - "source": "GRI", + "source": "GRI01", "page": 110, "srd": true, "level": 2, @@ -35,14 +35,13 @@ "A shimmering green arrow streaks toward a target within range and bursts in a spray of acid." ], "damageInflict": ["acid"], - "savingThrow": [""], "miscTags": ["", ""], "areaTags": ["", ""] }, { "recid": 1, "name": "Acid Blob", - "source": "GRI", + "source": "GRI01", "page": 110, "srd": false, "level": 1, @@ -73,14 +72,13 @@ "A yellowish bubble shoots from your pointed finger toward a creature of your choice within range" ], "damageInflict": ["acid"], - "savingThrow": [""], "miscTags": ["", ""], "areaTags": ["", ""] }, { "recid": 2, "name": "Acid Splash", - "source": "GRI", + "source": "GRI01", "page": 126, "srd": true, "level": 1, @@ -111,7 +109,7 @@ "You hurl a bubble of acid. " ], "damageInflict": ["acid"], - "savingThrow": ["Dexterity"], + "savingThrow": ["Dex"], "miscTags": ["", ""], "areaTags": ["", ""] } diff --git a/data/spells/spells-grimoire-fr.json b/data/spells/spells-grimoire-fr.json index 5e0b91a..bc0b54c 100644 --- a/data/spells/spells-grimoire-fr.json +++ b/data/spells/spells-grimoire-fr.json @@ -3,7 +3,7 @@ { "recid": 0, "name": "Flèche Acide", - "source": "GRI", + "source": "GRI01", "page": 188, "srd": true, "level": 2, @@ -42,7 +42,7 @@ { "recid": 1, "name": "Bille Acide", - "source": "GRI", + "source": "GRI01", "page": 134, "srd": false, "level": 1, @@ -80,7 +80,7 @@ { "recid": 2, "name": "Aspersion acide", - "source": "GRI", + "source": "GRI01", "page": 126, "srd": true, "level": 1,