Add final fateforge_spells + issue tracker

TODO:
- verify spells description and attributes
- update json.schema
- advance on #1
This commit is contained in:
Lucas 2023-03-17 01:45:20 +01:00
parent 62ce42afc1
commit 1da611e2f3
6 changed files with 28486 additions and 2315 deletions

7
.issuetracker Normal file
View file

@ -0,0 +1,7 @@
# Integration with Issue Tracker
#
# (note that '\' need to be escaped).
[issuetracker "Issue Tracker Rule"]
regex = "((?<=#)[0-9]+)"
url = "http://185.216.25.221:3000/lucastucious/fateforge-tool/issues/$1"

View file

@ -1,19 +1,19 @@
{ {
"$comment": "TODO: Subdivide the schema to have a common definition for each data (spells, books, creatures)", "$comment": "TODO: Subdivide the schema to have a common definition for each data (spellss, books, creatures)",
"definitions": {}, "definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/object1678401116.json", "$id": "https://example.com/object1678401116.json",
"title": "Root", "title": "Root",
"type": "object", "type": "object",
"required": ["spell"], "required": ["spells"],
"properties": { "properties": {
"spell": { "spells": {
"$id": "#root/spell", "$id": "#root/spells",
"title": "Spell", "title": "spells",
"type": "array", "type": "array",
"default": [], "default": [],
"items": { "items": {
"$id": "#root/spell/items", "$id": "#root/spells/items",
"title": "Items", "title": "Items",
"type": "object", "type": "object",
"required": [ "required": [
@ -21,7 +21,7 @@
"name", "name",
"source", "source",
"page", "page",
"srd", "fateforge_exclusive",
"level", "level",
"school", "school",
"time", "time",
@ -32,7 +32,7 @@
], ],
"properties": { "properties": {
"recid": { "recid": {
"$id": "#root/spell/items/recid", "$id": "#root/spells/items/recid",
"title": "Recid", "title": "Recid",
"type": "integer", "type": "integer",
"examples": [0], "examples": [0],
@ -42,7 +42,7 @@
"autoIncrement": true "autoIncrement": true
}, },
"name": { "name": {
"$id": "#root/spell/items/name", "$id": "#root/spells/items/name",
"title": "Name", "title": "Name",
"type": "string", "type": "string",
"default": "", "default": "",
@ -50,7 +50,7 @@
"pattern": "^.*$" "pattern": "^.*$"
}, },
"source": { "source": {
"$id": "#root/spell/items/source", "$id": "#root/spells/items/source",
"title": "Source", "title": "Source",
"description": "what's the source. Each enum is a book code", "description": "what's the source. Each enum is a book code",
"type": "string", "type": "string",
@ -60,7 +60,7 @@
"pattern": "^.*$" "pattern": "^.*$"
}, },
"page": { "page": {
"$id": "#root/spell/items/page", "$id": "#root/spells/items/page",
"description": "in the book, page source", "description": "in the book, page source",
"title": "Page", "title": "Page",
"type": "integer", "type": "integer",
@ -68,22 +68,22 @@
"default": 0 "default": 0
}, },
"srd": { "srd": {
"$id": "#root/spell/items/srd", "$id": "#root/spells/items/fateforge_exclusive",
"description": "is srd or a creation", "description": "is srd or a creation",
"title": "Srd", "title": "fateforge_exclusive",
"type": "boolean", "type": "boolean",
"examples": [true], "examples": [true],
"default": true "default": true
}, },
"level": { "level": {
"$id": "#root/spell/items/level", "$id": "#root/spells/items/level",
"title": "Level", "title": "Level",
"type": "integer", "type": "integer",
"examples": [2], "examples": [2],
"default": 0 "default": 0
}, },
"school": { "school": {
"$id": "#root/spell/items/school", "$id": "#root/spells/items/school",
"description": " 'A' : Abjuration,'C' : Conjuration, 'D': Divination, 'E': Enchantment, 'N': Necromancy, 'T' : Transmutation, 'I' : Illusion, 'V' : Evocation", "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"], "enum": ["A", "C", "D", "E", "I", "N", "T", "V"],
"title": "School", "title": "School",
@ -92,25 +92,25 @@
"pattern": "^.*$" "pattern": "^.*$"
}, },
"time": { "time": {
"$id": "#root/spell/items/time", "$id": "#root/spells/items/time",
"title": "Time", "title": "Time",
"type": "array", "type": "array",
"default": [], "default": [],
"items": { "items": {
"$id": "#root/spell/items/time/items", "$id": "#root/spells/items/time/items",
"title": "Items", "title": "Items",
"type": "object", "type": "object",
"required": ["number", "unit"], "required": ["number", "unit"],
"properties": { "properties": {
"number": { "number": {
"$id": "#root/spell/items/time/items/number", "$id": "#root/spells/items/time/items/number",
"title": "Number", "title": "Number",
"type": "integer", "type": "integer",
"examples": [1], "examples": [1],
"default": 0 "default": 0
}, },
"unit": { "unit": {
"$id": "#root/spell/items/time/items/unit", "$id": "#root/spells/items/time/items/unit",
"title": "Unit", "title": "Unit",
"type": "string", "type": "string",
"default": "", "default": "",
@ -124,67 +124,31 @@
} }
}, },
"range": { "range": {
"$id": "#root/spell/items/range", "$id": "#root/spells/items/range",
"title": "Range", "title": "Range",
"type": "object", "type": "string"
"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": { "components": {
"$id": "#root/spell/items/components", "$id": "#root/spells/items/components",
"title": "Components", "title": "Components",
"type": "object", "type": "object",
"properties": { "properties": {
"v": { "v": {
"$id": "#root/spell/items/components/v", "$id": "#root/spells/items/components/v",
"title": "V", "title": "V",
"type": "boolean", "type": "boolean",
"examples": [true], "examples": [true],
"default": true "default": true
}, },
"s": { "s": {
"$id": "#root/spell/items/components/s", "$id": "#root/spells/items/components/s",
"title": "S", "title": "S",
"type": "boolean", "type": "boolean",
"examples": [true], "examples": [true],
"default": true "default": true
}, },
"m": { "m": {
"$id": "#root/spell/items/components/m", "$id": "#root/spells/items/components/m",
"title": "M", "title": "M",
"type": "string", "type": "string",
"default": "", "default": "",
@ -194,18 +158,18 @@
} }
}, },
"duration": { "duration": {
"$id": "#root/spell/items/duration", "$id": "#root/spells/items/duration",
"title": "Duration", "title": "Duration",
"type": "array", "type": "array",
"default": [], "default": [],
"items": { "items": {
"$id": "#root/spell/items/duration/items", "$id": "#root/spells/items/duration/items",
"title": "Items", "title": "Items",
"type": "object", "type": "object",
"required": ["type"], "required": ["type"],
"properties": { "properties": {
"type": { "type": {
"$id": "#root/spell/items/duration/items/type", "$id": "#root/spells/items/duration/items/type",
"title": "Type", "title": "Type",
"type": "string", "type": "string",
"enum": ["timed", "permanent", "special", "instant"], "enum": ["timed", "permanent", "special", "instant"],
@ -217,18 +181,18 @@
} }
}, },
"concentration": { "concentration": {
"$id": "#root/spell/items/concentration", "$id": "#root/spells/items/concentration",
"title": "Concentration", "title": "Concentration",
"type": "boolean", "type": "boolean",
"default": false "default": false
}, },
"desc": { "desc": {
"$id": "#root/spell/items/desc", "$id": "#root/spells/items/desc",
"title": "Desc", "title": "Desc",
"type": "array", "type": "array",
"default": [], "default": [],
"items": { "items": {
"$id": "#root/spell/items/desc/items", "$id": "#root/spells/items/desc/items",
"title": "Items", "title": "Items",
"type": "string", "type": "string",
"description": "A description for the entry. Do not copy-paste gameplay infos to prevent copyright", "description": "A description for the entry. Do not copy-paste gameplay infos to prevent copyright",
@ -240,12 +204,12 @@
} }
}, },
"damageInflict": { "damageInflict": {
"$id": "#root/spell/items/damageInflict", "$id": "#root/spells/items/damageInflict",
"title": "Damageinflict", "title": "Damageinflict",
"type": "array", "type": "array",
"default": [], "default": [],
"items": { "items": {
"$id": "#root/spell/items/damageInflict/items", "$id": "#root/spells/items/damageInflict/items",
"title": "Items", "title": "Items",
"type": "string", "type": "string",
"default": "", "default": "",
@ -254,13 +218,13 @@
} }
}, },
"savingThrow": { "savingThrow": {
"$id": "#root/spell/items/savingThrow", "$id": "#root/spells/items/savingThrow",
"title": "Savingthrow", "title": "Savingthrow",
"description": "array of saving Throw available", "description": "array of saving Throw available",
"type": "array", "type": "array",
"default": [], "default": [],
"items": { "items": {
"$id": "#root/spell/items/savingThrow/items", "$id": "#root/spells/items/savingThrow/items",
"title": "Items", "title": "Items",
"type": "string", "type": "string",
"default": "", "default": "",
@ -272,12 +236,12 @@
} }
}, },
"miscTags": { "miscTags": {
"$id": "#root/spell/items/miscTags", "$id": "#root/spells/items/miscTags",
"title": "Misctags", "title": "Misctags",
"type": "array", "type": "array",
"default": [], "default": [],
"items": { "items": {
"$id": "#root/spell/items/miscTags/items", "$id": "#root/spells/items/miscTags/items",
"title": "Items", "title": "Items",
"type": "string", "type": "string",
"default": "", "default": "",
@ -286,12 +250,12 @@
} }
}, },
"areaTags": { "areaTags": {
"$id": "#root/spell/items/areaTags", "$id": "#root/spells/items/areaTags",
"title": "Areatags", "title": "Areatags",
"type": "array", "type": "array",
"default": [], "default": [],
"items": { "items": {
"$id": "#root/spell/items/areaTags/items", "$id": "#root/spells/items/areaTags/items",
"title": "Items", "title": "Items",
"type": "string", "type": "string",
"default": "", "default": "",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -3,12 +3,33 @@ Pour transformer le json d'origine, on itérera sur le fichier pour le scinder e
on utilise le tools ici : https://jsoneditoronline.org/#right=cloud.f0a19b92543d4c7fa1bdb58a913707e8&left=local.xoliwi on utilise le tools ici : https://jsoneditoronline.org/#right=cloud.f0a19b92543d4c7fa1bdb58a913707e8&left=local.xoliwi
##### Pour avoir le json en francais: ##### Pour avoir le json en francais:
*Cette version de la fonction query utilise une récursion pour explorer les sous-objets de chaque objet dans la liste data. La fonction checkKey transforme les clés se terminant par "_fr" en supprimant cette terminaison, et elle vérifie si la clé contient un nombre avant de traiter ses sous-objets. Si la clé ne contient pas de nombre, la fonction ne traite pas les sous-objets de cette clé.*
```js ```js
function query(data) { function query(data) {
function checkKey(obj) {
obj = _.mapKeys(obj, (value, key) => {
if (_.endsWith(key, "_fr") ) {
return key.slice(0, -3);
}
return key;
});
for (const [key, value] of Object.entries(obj)) {
if (_.isObject(value) && isNaN(value) ) {
obj[key] = checkKey(value);
}
}
return _.pickBy(obj, (value, key) => !_.endsWith(key, "_en"));
}
return _.chain(data) return _.chain(data)
.map(obj => _.pickBy(obj, (value, key) => !_.endsWith(key, "en"))) .map(obj => checkKey(obj))
.value() .value();
} }
``` ```
##### Pour deplacer les classes dans un objet "classes" ##### Pour deplacer les classes dans un objet "classes"
@ -46,6 +67,68 @@ function query(data) {
.value(); .value();
} }
``` ```
##### pour renommer les components :
```js
function query(data) {
return _.chain(data)
.map(obj => {
// Renommer les clés spécifiées
obj = _.mapKeys(obj, (value, key) => {
switch(key) {
case "composite_oral":
return "v";
case "composite_moves":
return "s";
case "composite_material":
return "m";
case "material_components_fr":
return "m_fr";
case "material_components_en":
return "m_en";
case "composite_material_destroyed":
return "m_destroyed"
default:
return key;
}
});
return obj;
})
.value();
}
```
##### Pour deplacer les components dans un objet "components"
```js
function query(data) {
return _.chain(data)
.map(item => {
const {
m_destroyed = "",
v = "",
s= "",
m= "",
m_fr= "",
m_en= "",
...rest
} = item;
return {
...rest,
components: {
m_destroyed,
v,
s,
m,
m_fr,
m_en,
}
};
})
.value();
}
```
##### Pour ajouter recid et source ##### Pour ajouter recid et source
```js ```js
function query(data) { function query(data) {