more refactoring, removing imports

This commit is contained in:
2019-07-31 21:48:59 +02:00
parent dae7633c11
commit 15d87e3b47
5 changed files with 74 additions and 73 deletions

View File

@@ -2,7 +2,7 @@
<table class="table is-fullwidth is-striped">
<thead>
<tr>
<th>{{ player == 0 ? 'Coffre de groupe' : 'Objets'}}</th>
<th>Objets</th>
<th v-if="canGrab"></th>
<th v-if="canSell">
<div class="buttons is-right">
@@ -18,7 +18,7 @@
</tr>
</thead>
<tbody v-if="app_state.initiated">
<template v-for="(item, idx) in content">
<template v-for="(item, idx) in items">
<tr :key="`row-${idx}`">
<td>
<strong>{{item.name}}</strong>
@@ -69,11 +69,16 @@
*/
export default {
props: {
items: {
type: Array,
required: true,
default: []
},
player: {
type: Number,
required: true,
default: 0
}
},
},
components: {
Request,
@@ -94,18 +99,13 @@
}
},
computed: {
content () {
const playerId = this.player;
console.log("Refresh chest of", playerId);
return this.app_state.player_loot[playerId];
},
// Can the active user sell items from this chest ?
canSell () {
return this.player == this.app_state.player_id;
},
totalSellValue () {
const selected = this.sell_selected;
return this.content
return this.items
.filter(item => selected.includes(item.id))
.map(item => item.base_price / 2)
.reduce((total,value) => total + value, 0);