1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 21:24:18 +00:00

refonte du grimoire personnel, suivi des emplacements de sorts par niveau

This commit is contained in:
Maxime Moraine 2020-05-03 19:35:37 +02:00
parent 7cf83baed3
commit 9dae3aec37
6 changed files with 180 additions and 27 deletions

View file

@ -45,7 +45,7 @@ export default {
methods: {
download () {
saveAs(new Blob([JSON.stringify(this.$store.state.mySpells.spells)], {
saveAs(new Blob([JSON.stringify(this.$store.state.mySpells)], {
type: "text/plain;charset=utf-8"
}), "grimoire.json")
},
@ -58,15 +58,18 @@ export default {
reader.onload = function() {
let result = JSON.parse(reader.result)
let isValid = true
if (result.length >= 1) {
for (var s of result) {
if (result.spells && result.spells.length >= 1) {
for (var s of result.spells) {
if (s.pid !== 'spell') {
isValid = false
}
}
}
if (isValid) {
self.$store.commit('mySpells/setSpells', result)
self.$store.commit('mySpells/setSpells', result.spells)
if (result.spellSlots) {
self.$store.commit('mySpells/setSpellSlots', result.spellSlots)
}
}
}