removes Chest use of AppStorage, various fixes

This commit is contained in:
2019-08-01 14:46:25 +02:00
parent 15d87e3b47
commit dde7dc3770
4 changed files with 67 additions and 76 deletions

View File

@@ -1,8 +1,8 @@
<template>
<main id="app" class="container">
<PlayerView :id="state.player_id"
<PlayerView :id="state.player_id"
v-slot="{ player, loot, notifications, actions }">
<section class="section">
<main id="app" class="container">
<header class="section">
<HeaderBar :app_state="state">
<template v-slot:title>{{ player.name }}</template>
<template v-slot:links>
@@ -21,27 +21,38 @@
{{ p.name }}</a>
</template>
</HeaderBar>
<p v-if="notifications.length > 0">{{ notifications }}</p>
<p v-show="notifications.length > 0">{{ notifications }}</p>
<Wealth
:wealth="[player.cp, player.sp, player.gp, player.pp]"
:debt="player.debt"
@update="actions.updateWealth">
</wealth>
<div class="tabs is-centered is-boxed is-medium" v-show="!playerIsGroup">
</header>
<nav>
<div class="tabs is-centered is-boxed is-medium">
<ul>
<li :class="{ 'is-active': !state.show_player_chest }">
<a @click="switchPlayerChestVisibility">Coffre de groupe</a></li>
<li :class="{ 'is-active': state.show_player_chest }">
<li :class="{ 'is-active': state.show_player_chest }" v-show="!playerIsGroup">
<a @click="switchPlayerChestVisibility">Mon coffre</a></li>
</ul>
<li>
<a class="disabled">
+ {{ playerIsGroup ? 'Nouveau Loot' : 'Acheter' }}
</a>
</li>
</ul>
</div>
<Chest :items="state.show_player_chest ? loot : state.group_loot"
:player="state.show_player_chest ? player.id : 0"
</nav>
<main class="">
<Chest
:items="state.show_player_chest ? loot : state.group_loot"
:perms="permissions"
@claim="actions.putClaim"
@unclaim="actions.withdrawClaim"></Chest>
</section>
</PlayerView>
</main>
@unclaim="actions.withdrawClaim">
</Chest>
</main>
</main>
</PlayerView>
</template>
<script>
@@ -97,6 +108,12 @@ export default {
switchPlayerChestVisibility () { AppStorage.switchPlayerChestVisibility(); },
},
computed: {
permissions () {
return {
canGrab: this.state.player_id != 0 && !this.state.show_player_chest,
canSell: this.state.show_player_chest || this.state.player_id == 0,
};
},
playerIsGroup () { return this.state.player_id == 0 },
}
}