add ST character reveal for player tokens

This commit is contained in:
nicfreeman1209 2021-05-03 09:51:30 +01:00
parent 3ae36e2f0f
commit 0c3cf1bf95
6 changed files with 44 additions and 2 deletions

View file

@ -1,5 +1,7 @@
# Release Notes
- add ST character reveal, per player
### Version 2.12.0
- tweak reference sheet to better fit screen in single column layout
- add warning icon overlay for setup roles on character assignment modal

View file

@ -128,6 +128,10 @@
<font-awesome-icon icon="hand-point-right" />
Nomination
</li>
<li @click="revealPlayer(player)">
<font-awesome-icon icon="satellite-dish" />
Reveal role to all
</li>
<li @click="movePlayer()">
<font-awesome-icon icon="redo-alt" />
Move player
@ -296,6 +300,9 @@ export default {
this.isMenuOpen = false;
}
},
revealPlayer() {
this.$emit("trigger", ["revealPlayer"]);
},
removePlayer() {
this.isMenuOpen = false;
this.$emit("trigger", ["removePlayer"]);

View file

@ -161,6 +161,17 @@ export default {
this.$store.commit("players/remove", playerIndex);
}
},
revealPlayer(playerIndex) {
if (!this.session.isRevealPlayerOK) {
if (
!confirm(
`Do you really want to reveal this players role to ALL other players?\n\nYou won't be asked to confirm again this game.`
)
)
return;
}
this.$store.commit("session/revealPlayer", playerIndex);
},
swapPlayer(from, to) {
if (to === undefined) {
this.cancel();

View file

@ -33,6 +33,7 @@ const faIcons = [
"Question",
"Random",
"RedoAlt",
"SatelliteDish",
"SearchMinus",
"SearchPlus",
"Square",

View file

@ -25,7 +25,8 @@ const state = () => ({
votingSpeed: 3000,
isVoteInProgress: false,
voteHistory: [],
isRolesDistributed: false
isRolesDistributed: false,
isRevealPlayerOK: false
});
const getters = {};
@ -47,6 +48,9 @@ const mutations = {
setVoteInProgress: set("isVoteInProgress"),
claimSeat: set("claimedSeat"),
distributeRoles: set("isRolesDistributed"),
revealPlayer(state) {
state.isRevealPlayerOK = true;
},
setSessionId(state, sessionId) {
state.sessionId = sessionId
.toLocaleLowerCase()

View file

@ -634,11 +634,12 @@ class LiveSession {
}
/**
* Distribute player roles to all seated players in a direct message.
* Distribute player roles to all seated players in a direct message. ST only
* This will be split server side so that each player only receives their own (sub)message.
*/
distributeRoles() {
if (this._isSpectator) return;
this._store.state.session.isRevealPlayerOK = false;
const message = {};
this._store.state.players.players.forEach((player, index) => {
if (player.id && player.role) {
@ -653,6 +654,19 @@ class LiveSession {
}
}
/**
* Announce a single players role to all other players. ST only
* @param playerIndex
*/
revealPlayer(index) {
if (this._isSpectator) return;
const player = this._store.state.players.players[index];
if (player && player.role) {
const message = { index, property: "role", value: player.role.id };
this._send("player", message);
}
}
/**
* A player nomination. ST only
* This also syncs the voting speed to the players.
@ -822,6 +836,9 @@ export default store => {
session.distributeRoles();
}
break;
case "session/revealPlayer":
session.revealPlayer(payload);
break;
case "session/nomination":
session.nomination(payload);
break;