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": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/object1678401116.json",
"title": "Root",
"type": "object",
"required": ["spell"],
"required": ["spells"],
"properties": {
"spell": {
"$id": "#root/spell",
"title": "Spell",
"spells": {
"$id": "#root/spells",
"title": "spells",
"type": "array",
"default": [],
"items": {
"$id": "#root/spell/items",
"$id": "#root/spells/items",
"title": "Items",
"type": "object",
"required": [
@ -21,7 +21,7 @@
"name",
"source",
"page",
"srd",
"fateforge_exclusive",
"level",
"school",
"time",
@ -32,7 +32,7 @@
],
"properties": {
"recid": {
"$id": "#root/spell/items/recid",
"$id": "#root/spells/items/recid",
"title": "Recid",
"type": "integer",
"examples": [0],
@ -42,7 +42,7 @@
"autoIncrement": true
},
"name": {
"$id": "#root/spell/items/name",
"$id": "#root/spells/items/name",
"title": "Name",
"type": "string",
"default": "",
@ -50,7 +50,7 @@
"pattern": "^.*$"
},
"source": {
"$id": "#root/spell/items/source",
"$id": "#root/spells/items/source",
"title": "Source",
"description": "what's the source. Each enum is a book code",
"type": "string",
@ -60,7 +60,7 @@
"pattern": "^.*$"
},
"page": {
"$id": "#root/spell/items/page",
"$id": "#root/spells/items/page",
"description": "in the book, page source",
"title": "Page",
"type": "integer",
@ -68,22 +68,22 @@
"default": 0
},
"srd": {
"$id": "#root/spell/items/srd",
"$id": "#root/spells/items/fateforge_exclusive",
"description": "is srd or a creation",
"title": "Srd",
"title": "fateforge_exclusive",
"type": "boolean",
"examples": [true],
"default": true
},
"level": {
"$id": "#root/spell/items/level",
"$id": "#root/spells/items/level",
"title": "Level",
"type": "integer",
"examples": [2],
"default": 0
},
"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",
"enum": ["A", "C", "D", "E", "I", "N", "T", "V"],
"title": "School",
@ -92,25 +92,25 @@
"pattern": "^.*$"
},
"time": {
"$id": "#root/spell/items/time",
"$id": "#root/spells/items/time",
"title": "Time",
"type": "array",
"default": [],
"items": {
"$id": "#root/spell/items/time/items",
"$id": "#root/spells/items/time/items",
"title": "Items",
"type": "object",
"required": ["number", "unit"],
"properties": {
"number": {
"$id": "#root/spell/items/time/items/number",
"$id": "#root/spells/items/time/items/number",
"title": "Number",
"type": "integer",
"examples": [1],
"default": 0
},
"unit": {
"$id": "#root/spell/items/time/items/unit",
"$id": "#root/spells/items/time/items/unit",
"title": "Unit",
"type": "string",
"default": "",
@ -124,67 +124,31 @@
}
},
"range": {
"$id": "#root/spell/items/range",
"$id": "#root/spells/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
}
}
}
}
"type": "string"
},
"components": {
"$id": "#root/spell/items/components",
"$id": "#root/spells/items/components",
"title": "Components",
"type": "object",
"properties": {
"v": {
"$id": "#root/spell/items/components/v",
"$id": "#root/spells/items/components/v",
"title": "V",
"type": "boolean",
"examples": [true],
"default": true
},
"s": {
"$id": "#root/spell/items/components/s",
"$id": "#root/spells/items/components/s",
"title": "S",
"type": "boolean",
"examples": [true],
"default": true
},
"m": {
"$id": "#root/spell/items/components/m",
"$id": "#root/spells/items/components/m",
"title": "M",
"type": "string",
"default": "",
@ -194,18 +158,18 @@
}
},
"duration": {
"$id": "#root/spell/items/duration",
"$id": "#root/spells/items/duration",
"title": "Duration",
"type": "array",
"default": [],
"items": {
"$id": "#root/spell/items/duration/items",
"$id": "#root/spells/items/duration/items",
"title": "Items",
"type": "object",
"required": ["type"],
"properties": {
"type": {
"$id": "#root/spell/items/duration/items/type",
"$id": "#root/spells/items/duration/items/type",
"title": "Type",
"type": "string",
"enum": ["timed", "permanent", "special", "instant"],
@ -217,18 +181,18 @@
}
},
"concentration": {
"$id": "#root/spell/items/concentration",
"$id": "#root/spells/items/concentration",
"title": "Concentration",
"type": "boolean",
"default": false
},
"desc": {
"$id": "#root/spell/items/desc",
"$id": "#root/spells/items/desc",
"title": "Desc",
"type": "array",
"default": [],
"items": {
"$id": "#root/spell/items/desc/items",
"$id": "#root/spells/items/desc/items",
"title": "Items",
"type": "string",
"description": "A description for the entry. Do not copy-paste gameplay infos to prevent copyright",
@ -240,12 +204,12 @@
}
},
"damageInflict": {
"$id": "#root/spell/items/damageInflict",
"$id": "#root/spells/items/damageInflict",
"title": "Damageinflict",
"type": "array",
"default": [],
"items": {
"$id": "#root/spell/items/damageInflict/items",
"$id": "#root/spells/items/damageInflict/items",
"title": "Items",
"type": "string",
"default": "",
@ -254,13 +218,13 @@
}
},
"savingThrow": {
"$id": "#root/spell/items/savingThrow",
"$id": "#root/spells/items/savingThrow",
"title": "Savingthrow",
"description": "array of saving Throw available",
"type": "array",
"default": [],
"items": {
"$id": "#root/spell/items/savingThrow/items",
"$id": "#root/spells/items/savingThrow/items",
"title": "Items",
"type": "string",
"default": "",
@ -272,12 +236,12 @@
}
},
"miscTags": {
"$id": "#root/spell/items/miscTags",
"$id": "#root/spells/items/miscTags",
"title": "Misctags",
"type": "array",
"default": [],
"items": {
"$id": "#root/spell/items/miscTags/items",
"$id": "#root/spells/items/miscTags/items",
"title": "Items",
"type": "string",
"default": "",
@ -286,12 +250,12 @@
}
},
"areaTags": {
"$id": "#root/spell/items/areaTags",
"$id": "#root/spells/items/areaTags",
"title": "Areatags",
"type": "array",
"default": [],
"items": {
"$id": "#root/spell/items/areaTags/items",
"$id": "#root/spells/items/areaTags/items",
"title": "Items",
"type": "string",
"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
##### 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
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)
.map(obj => _.pickBy(obj, (value, key) => !_.endsWith(key, "en")))
.value()
.map(obj => checkKey(obj))
.value();
}
```
##### Pour deplacer les classes dans un objet "classes"
@ -46,6 +67,68 @@ function query(data) {
.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
```js
function query(data) {