added fabled to session gamestate object

This commit is contained in:
Steffen 2020-12-01 22:42:21 +01:00
parent ede5d353f4
commit f915a1a7f8
1 changed files with 13 additions and 2 deletions

View File

@ -206,13 +206,14 @@ class LiveSession {
: {}) : {})
})); }));
const { session } = this._store.state; const { session } = this._store.state;
const { fabled } = this._store.state.players;
this.sendEdition(); this.sendEdition();
this.sendFabled();
this._send("gs", { this._send("gs", {
gamestate: this._gamestate, gamestate: this._gamestate,
nomination: session.nomination, nomination: session.nomination,
votingSpeed: session.votingSpeed, votingSpeed: session.votingSpeed,
lockedVote: session.lockedVote, lockedVote: session.lockedVote,
fabled: fabled.map(({ id }) => id),
...(session.nomination ? { votes: session.votes } : {}) ...(session.nomination ? { votes: session.votes } : {})
}); });
} }
@ -224,13 +225,23 @@ class LiveSession {
*/ */
_updateGamestate(data) { _updateGamestate(data) {
if (!this._isSpectator) return; if (!this._isSpectator) return;
const { gamestate, nomination, votingSpeed, votes, lockedVote } = data; const {
gamestate,
nomination,
votingSpeed,
votes,
lockedVote,
fabled
} = data;
this._store.commit("session/nomination", { this._store.commit("session/nomination", {
nomination, nomination,
votes, votes,
votingSpeed, votingSpeed,
lockedVote lockedVote
}); });
this._store.commit("players/setFabled", {
fabled: fabled.map(id => this._store.state.fabled.get(id))
});
const players = this._store.state.players.players; const players = this._store.state.players.players;
// adjust number of players // adjust number of players
if (players.length < gamestate.length) { if (players.length < gamestate.length) {