adds dummy impls for targeted behaviours

This commit is contained in:
2019-06-12 15:34:52 +02:00
parent 022b97520f
commit eeb297215a
5 changed files with 90 additions and 19 deletions

View File

@@ -1,22 +1,54 @@
<template>
<div class="container">
<p class="notification is-paddingless is-info" v-show="canAdd">Peut ajouter</p>
<p class="notification is-paddingless is-warning" v-show="canSell">Peut vendre</p>
<p class="notification is-paddingless is-primary" v-show="canGrab">Peut prendre</p>
<table class="table is-fullwidth is-striped">
<thead>
<tr><th>Objets de {{ player_id }}</th></tr>
<tr><th>Objets de {{ player }}</th></tr>
</thead>
<tbody>
<tr><td>Nom 1</td></tr>
<tr><td>Nom 2</td></tr>
<tr><td>Nom 3</td></tr>
<template v-for="(item, idx) in content">
<tr :key="idx"><td>{{item.name}}</td></tr>
</template>
</tbody>
</table>
</div>
</template>
<script>
import { store } from '../App.vue'
export default {
props: ["player_id"],
props: {
player: {
type: Number,
required: true,
default: 0
}
},
data () {
return {
app_state: store.state,
content: [
{id: 10, name: "Épée longue +2 acérée"},
{id: 5, name: "Ceinture de force +6"},
],
};
}
},
computed: {
// Can the active user sell items from this chest ?
canSell () {
return this.player == this.app_state.player_id;
},
// Can the user grab items from this chest ?
canGrab () {
return (this.app_state.player_id != 0 // User is not the group
&& this.player == 0); // This is the group chest
},
canAdd () {
return (this.app_state.player_id == 0
&& this.player == 0);
},
},
}
</script>