WIP: add & Edit Agate JSON file
This commit is contained in:
parent
e14e1c8b83
commit
62ce42afc1
2 changed files with 15374 additions and 0 deletions
15297
data/spells/fateforge_spells.json
Normal file
15297
data/spells/fateforge_spells.json
Normal file
File diff suppressed because one or more lines are too long
77
data/spells/notes.md
Normal file
77
data/spells/notes.md
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
# Notes
|
||||||
|
Pour transformer le json d'origine, on itérera sur le fichier pour le scinder en deux
|
||||||
|
on utilise le tools ici : https://jsoneditoronline.org/#right=cloud.f0a19b92543d4c7fa1bdb58a913707e8&left=local.xoliwi
|
||||||
|
|
||||||
|
##### Pour avoir le json en francais:
|
||||||
|
```js
|
||||||
|
function query(data) {
|
||||||
|
return _.chain(data)
|
||||||
|
.map(obj => _.pickBy(obj, (value, key) => !_.endsWith(key, "en")))
|
||||||
|
.value()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Pour deplacer les classes dans un objet "classes"
|
||||||
|
```js
|
||||||
|
function query(data) {
|
||||||
|
return _.chain(data)
|
||||||
|
.map(item => {
|
||||||
|
const {
|
||||||
|
bard = "",
|
||||||
|
cleric = "",
|
||||||
|
druid = "",
|
||||||
|
paladin = "",
|
||||||
|
ranger = "",
|
||||||
|
scholar = "",
|
||||||
|
sorcerer = "",
|
||||||
|
warlock = "",
|
||||||
|
wizard = "",
|
||||||
|
...rest
|
||||||
|
} = item;
|
||||||
|
return {
|
||||||
|
...rest,
|
||||||
|
classes: {
|
||||||
|
bard,
|
||||||
|
cleric,
|
||||||
|
druid,
|
||||||
|
paladin,
|
||||||
|
ranger,
|
||||||
|
scholar,
|
||||||
|
sorcerer,
|
||||||
|
warlock,
|
||||||
|
wizard
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.value();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
##### Pour ajouter recid et source
|
||||||
|
```js
|
||||||
|
function query(data) {
|
||||||
|
return _.chain(data)
|
||||||
|
.map((item, index) => _.merge({ recid: index }, item))
|
||||||
|
.map((item, index) => _.merge({ source: "GRI01" }, item))
|
||||||
|
.value();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Pour transformer les clé 0/1 en true/false
|
||||||
|
```js
|
||||||
|
function query(data) {
|
||||||
|
return _.chain(data)
|
||||||
|
.map((item) => ({
|
||||||
|
...item,
|
||||||
|
composite_material_destroyed: item.composite_material_destroyed = "x"? true : false,
|
||||||
|
composite_oral: item.composite_oral == 1? true : false,
|
||||||
|
has_higher_level_details: item.has_higher_level_details == 1? true : false,
|
||||||
|
ritual: item.ritual == 1? true : false,
|
||||||
|
dragons_exclusive: item.dragons_exclusive == 1? true : false,
|
||||||
|
composite_moves: item.composite_moves == 1? true : false,
|
||||||
|
composite_material: item.composite_material == 1? true : false,
|
||||||
|
corrupted: item.corrupted == 1? true : false,
|
||||||
|
concentration: item.concentration == 1? true : false,
|
||||||
|
}))
|
||||||
|
.value();
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in a new issue