adds requests state for Request component

This commit is contained in:
2019-06-14 15:38:24 +02:00
parent 0e71776f4f
commit dc7a0da95d
4 changed files with 51 additions and 31 deletions

View File

@@ -18,13 +18,15 @@ export const store = {
debug: true,
state: {
player_id: 0,
player_list: [
{id: 0, name: "Groupe", wealth: [0,0,0,0], debt: 0},
{id: 1, name: "Lomion", wealth: [0,0,0,0], debt: 0},
{id: 4, name: "Oilosse", wealth: [0,0,0,0], debt: 0},
{id: 3, name: "Fefi", wealth: [0,0,0,0], debt: 0},
],
show_player_chest: false,
// methods
isPlayer () {
this.player_id != 0
},
isGroup () {
this.player_id == 0
requests: { // TEST: must be initialised with players ids
0: [], 1: [], 4: [], 3: []
},
},
setActivePlayer (newPlayerId) {
@@ -36,7 +38,12 @@ export const store = {
switchPlayerChestVisibility () {
if (this.debug) console.log('switchPlayerChestVisibility', !this.state.show_player_chest)
this.state.show_player_chest = !this.state.show_player_chest
}
},
putRequest (itemId) {
const playerId = this.state.player_id
if (this.debug) console.log('newRequest from', playerId, 'on', itemId)
this.state.requests[playerId].push(itemId);
},
}
function getCookie(cname) {