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

outils de création de sorts/monstres/objets

This commit is contained in:
Maxime Moraine 2020-04-22 11:17:05 +02:00
parent 6237f0e6a2
commit a6986c42c6
48 changed files with 2743 additions and 259 deletions

View file

@ -1,7 +1,11 @@
<template>
<div class="monsters">
<Breadcrumb />
<div class="d-flex align-center mb-4">
<Breadcrumb class="mr-auto" />
<v-btn color="primary" class="mr-4" depressed link to="/creation-de-monstre-pnj/"><v-icon left>mdi-plus</v-icon> Créer un monstre</v-btn>
<v-btn color="primary" depressed link to="/mon-bestiaire/">Mon bestiaire</v-btn>
</div>
<h1>Bestiaire</h1>
@ -16,6 +20,10 @@
:search="search"
>
<template v-slot:item.isInBestiary="{ item }">
<v-simple-checkbox off-icon="mdi-bookmark-outline" on-icon="mdi-bookmark" @input="toggleMonsterInBestiary(item)" :value="isMonsterInBestiary(item)"></v-simple-checkbox>
</template>
<template v-slot:item.title="{ item }">
<router-link :to="{ path: item.path }" class="subtitle-2">{{ item.title }}</router-link>
</template>
@ -51,6 +59,7 @@ export default {
sortBy: 'title',
sortDesc: false,
headers: [
{ text: "", align: 'center', sortable: false, value: 'isInBestiary' },
{ text: "Nom", align: 'start', sortable: true, value: 'title' },
{ text: "ID", align: 'center', sortable: true, value: 'frontmatter.challenge' },
{ text: "Type", align: 'start', sortable: false, value: 'frontmatter.type' },
@ -153,6 +162,22 @@ export default {
methods: {
displayList (list) { return list.join(', ') },
displayChallenge (challenge) { return displayChallenge(challenge) },
isMonsterInBestiary (monster) {
let isInBestiary = false
for (let m of this.$store.state.myMonsters.monsters) {
if (m.key == monster.key) {
isInBestiary = true
}
}
return isInBestiary
},
toggleMonsterInBestiary (monster) {
if (this.isMonsterInBestiary(monster)) {
this.$store.commit('myMonsters/removeMonster', monster)
} else {
this.$store.commit('myMonsters/addMonster', monster)
}
}
},
mounted () {