mirror of https://github.com/bra1n/townsquare.git
parent
205bd0ba79
commit
4d2afadc01
|
@ -101,7 +101,7 @@
|
||||||
<!-- On block icon -->
|
<!-- On block icon -->
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
icon="skull"
|
icon="skull"
|
||||||
v-if="player.isMarked"
|
v-if="session.markedPlayerId === index"
|
||||||
class="on-block"
|
class="on-block"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -250,11 +250,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setMarked() {
|
setMarked() {
|
||||||
this.$store.commit("players/setMarked", this.session.nomination[1]);
|
this.$store.commit("session/setMarkedPlayerId", this.session.nomination[1]);
|
||||||
this.finish();
|
this.finish();
|
||||||
},
|
},
|
||||||
removeMarked() {
|
removeMarked() {
|
||||||
this.$store.commit("players/setMarked", -1);
|
this.$store.commit("session/setMarkedPlayerId", -1);
|
||||||
this.finish();
|
this.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ const NEWPLAYER = {
|
||||||
reminders: [],
|
reminders: [],
|
||||||
isVoteless: false,
|
isVoteless: false,
|
||||||
isDead: false,
|
isDead: false,
|
||||||
isMarked: false,
|
|
||||||
pronouns: ""
|
pronouns: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,14 +136,6 @@ const mutations = {
|
||||||
move(state, [from, to]) {
|
move(state, [from, to]) {
|
||||||
state.players.splice(to, 0, state.players.splice(from, 1)[0]);
|
state.players.splice(to, 0, state.players.splice(from, 1)[0]);
|
||||||
},
|
},
|
||||||
setMarked(state, playerIndex) {
|
|
||||||
state.players.forEach(player => {
|
|
||||||
player.isMarked = false;
|
|
||||||
});
|
|
||||||
if (playerIndex >= 0) {
|
|
||||||
state.players[playerIndex].isMarked = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setBluff(state, { index, role } = {}) {
|
setBluff(state, { index, role } = {}) {
|
||||||
if (index !== undefined) {
|
if (index !== undefined) {
|
||||||
state.bluffs.splice(index, 1, role);
|
state.bluffs.splice(index, 1, role);
|
||||||
|
|
|
@ -25,6 +25,7 @@ const state = () => ({
|
||||||
votingSpeed: 3000,
|
votingSpeed: 3000,
|
||||||
isVoteInProgress: false,
|
isVoteInProgress: false,
|
||||||
voteHistory: [],
|
voteHistory: [],
|
||||||
|
markedPlayerId: -1,
|
||||||
isRolesDistributed: false
|
isRolesDistributed: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ const mutations = {
|
||||||
setPing: set("ping"),
|
setPing: set("ping"),
|
||||||
setVotingSpeed: set("votingSpeed"),
|
setVotingSpeed: set("votingSpeed"),
|
||||||
setVoteInProgress: set("isVoteInProgress"),
|
setVoteInProgress: set("isVoteInProgress"),
|
||||||
|
setMarkedPlayerId: set("markedPlayerId"),
|
||||||
claimSeat: set("claimedSeat"),
|
claimSeat: set("claimedSeat"),
|
||||||
distributeRoles: set("isRolesDistributed"),
|
distributeRoles: set("isRolesDistributed"),
|
||||||
setSessionId(state, sessionId) {
|
setSessionId(state, sessionId) {
|
||||||
|
|
|
@ -168,9 +168,9 @@ class LiveSession {
|
||||||
if (!this._isSpectator) return;
|
if (!this._isSpectator) return;
|
||||||
this._store.commit("players/remove", params);
|
this._store.commit("players/remove", params);
|
||||||
break;
|
break;
|
||||||
case "onBlock":
|
case "marked":
|
||||||
if (!this._isSpectator) return;
|
if (!this._isSpectator) return;
|
||||||
this._store.commit("players/setMarked", params);
|
this._store.commit("session/setMarkedPlayerId", params);
|
||||||
break;
|
break;
|
||||||
case "isNight":
|
case "isNight":
|
||||||
if (!this._isSpectator) return;
|
if (!this._isSpectator) return;
|
||||||
|
@ -255,7 +255,6 @@ class LiveSession {
|
||||||
id: player.id,
|
id: player.id,
|
||||||
isDead: player.isDead,
|
isDead: player.isDead,
|
||||||
isVoteless: player.isVoteless,
|
isVoteless: player.isVoteless,
|
||||||
isMarked: player.isMarked,
|
|
||||||
pronouns: player.pronouns,
|
pronouns: player.pronouns,
|
||||||
...(player.role && player.role.team === "traveler"
|
...(player.role && player.role.team === "traveler"
|
||||||
? { roleId: player.role.id }
|
? { roleId: player.role.id }
|
||||||
|
@ -277,6 +276,7 @@ class LiveSession {
|
||||||
votingSpeed: session.votingSpeed,
|
votingSpeed: session.votingSpeed,
|
||||||
lockedVote: session.lockedVote,
|
lockedVote: session.lockedVote,
|
||||||
isVoteInProgress: session.isVoteInProgress,
|
isVoteInProgress: session.isVoteInProgress,
|
||||||
|
markedPlayerId: session.markedPlayerId,
|
||||||
fabled: fabled.map(({ id }) => id),
|
fabled: fabled.map(({ id }) => id),
|
||||||
...(session.nomination ? { votes: session.votes } : {})
|
...(session.nomination ? { votes: session.votes } : {})
|
||||||
});
|
});
|
||||||
|
@ -299,6 +299,7 @@ class LiveSession {
|
||||||
votes,
|
votes,
|
||||||
lockedVote,
|
lockedVote,
|
||||||
isVoteInProgress,
|
isVoteInProgress,
|
||||||
|
markedPlayerId,
|
||||||
fabled
|
fabled
|
||||||
} = data;
|
} = data;
|
||||||
const players = this._store.state.players.players;
|
const players = this._store.state.players.players;
|
||||||
|
@ -317,7 +318,7 @@ class LiveSession {
|
||||||
const player = players[x];
|
const player = players[x];
|
||||||
const { roleId } = state;
|
const { roleId } = state;
|
||||||
// update relevant properties
|
// update relevant properties
|
||||||
["name", "id", "isDead", "isVoteless", "isMarked", "pronouns"].forEach(
|
["name", "id", "isDead", "isVoteless", "pronouns"].forEach(
|
||||||
property => {
|
property => {
|
||||||
const value = state[property];
|
const value = state[property];
|
||||||
if (player[property] !== value) {
|
if (player[property] !== value) {
|
||||||
|
@ -352,8 +353,9 @@ class LiveSession {
|
||||||
votes,
|
votes,
|
||||||
votingSpeed,
|
votingSpeed,
|
||||||
lockedVote,
|
lockedVote,
|
||||||
isVoteInProgress
|
isVoteInProgress,
|
||||||
});
|
});
|
||||||
|
this._store.commit("session/setMarkedPlayerId", markedPlayerId);
|
||||||
this._store.commit("players/setFabled", {
|
this._store.commit("players/setFabled", {
|
||||||
fabled: fabled.map(id => this._store.state.fabled.get(id))
|
fabled: fabled.map(id => this._store.state.fabled.get(id))
|
||||||
});
|
});
|
||||||
|
@ -710,7 +712,7 @@ class LiveSession {
|
||||||
*/
|
*/
|
||||||
setMarked(playerIndex) {
|
setMarked(playerIndex) {
|
||||||
if (this._isSpectator) return;
|
if (this._isSpectator) return;
|
||||||
this._send("onBlock", playerIndex);
|
this._send("marked", playerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -865,7 +867,7 @@ export default store => {
|
||||||
case "players/setFabled":
|
case "players/setFabled":
|
||||||
session.sendFabled();
|
session.sendFabled();
|
||||||
break;
|
break;
|
||||||
case "players/setMarked":
|
case "session/setMarkedPlayerId":
|
||||||
session.setMarked(payload);
|
session.setMarked(payload);
|
||||||
break;
|
break;
|
||||||
case "players/swap":
|
case "players/swap":
|
||||||
|
|
Loading…
Reference in New Issue