mirror of
https://github.com/em-squared/5e-drs.git
synced 2025-12-17 07:30:47 +00:00
refonte du grimoire personnel, suivi des emplacements de sorts par niveau
This commit is contained in:
parent
7cf83baed3
commit
9dae3aec37
6 changed files with 180 additions and 27 deletions
|
|
@ -43,7 +43,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
download () {
|
||||
saveAs(new Blob([JSON.stringify(this.$store.state.myMagicItems.magicItems)], {
|
||||
saveAs(new Blob([JSON.stringify(this.$store.state.myMagicItems)], {
|
||||
type: "text/plain;charset=utf-8"
|
||||
}), "objets-magiques.json")
|
||||
},
|
||||
|
|
@ -56,15 +56,15 @@ 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.magicItems && result.magicItems.length >= 1) {
|
||||
for (var s of result.magicItems) {
|
||||
if (s.pid !== 'magicItem') {
|
||||
isValid = false
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isValid) {
|
||||
self.$store.commit('myMagicItems/setMagicItems', result)
|
||||
self.$store.commit('myMagicItems/setMagicItems', result.magicItems)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
download () {
|
||||
saveAs(new Blob([JSON.stringify(this.$store.state.myMonsters.monsters)], {
|
||||
saveAs(new Blob([JSON.stringify(this.$store.state.myMonsters)], {
|
||||
type: "text/plain;charset=utf-8"
|
||||
}), "bestiaire.json")
|
||||
},
|
||||
|
|
@ -56,15 +56,15 @@ 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.monsters && result.monsters.length >= 1) {
|
||||
for (var s of result.monsters) {
|
||||
if (s.pid !== 'monster') {
|
||||
isValid = false
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isValid) {
|
||||
self.$store.commit('myMonsters/setMonsters', result)
|
||||
self.$store.commit('myMonsters/setMonsters', result.monsters)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue