mirror of https://github.com/bra1n/townsquare.git
clearing vote history as ST clears it for everyone
fixed role distribution bug
This commit is contained in:
parent
7bf5f69fbc
commit
125d5a9510
|
@ -238,7 +238,7 @@ export default {
|
||||||
Math.round(Math.random() * 10000)
|
Math.round(Math.random() * 10000)
|
||||||
);
|
);
|
||||||
if (sessionId) {
|
if (sessionId) {
|
||||||
this.$store.commit("session/clearHistory");
|
this.$store.commit("session/clearVoteHistory");
|
||||||
this.$store.commit("session/setSpectator", false);
|
this.$store.commit("session/setSpectator", false);
|
||||||
this.$store.commit(
|
this.$store.commit(
|
||||||
"session/setSessionId",
|
"session/setSessionId",
|
||||||
|
@ -281,7 +281,7 @@ export default {
|
||||||
"Enter the channel number / name of the session you want to join"
|
"Enter the channel number / name of the session you want to join"
|
||||||
);
|
);
|
||||||
if (sessionId) {
|
if (sessionId) {
|
||||||
this.$store.commit("session/clearHistory");
|
this.$store.commit("session/clearVoteHistory");
|
||||||
this.$store.commit("session/setSpectator", true);
|
this.$store.commit("session/setSpectator", true);
|
||||||
this.$store.commit("toggleGrimoire", false);
|
this.$store.commit("toggleGrimoire", false);
|
||||||
this.$store.commit(
|
this.$store.commit(
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@close="toggleModal('voteHistory')"
|
@close="toggleModal('voteHistory')"
|
||||||
>
|
>
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
@click="clearHistory"
|
@click="clearVoteHistory"
|
||||||
icon="trash-alt"
|
icon="trash-alt"
|
||||||
class="clear"
|
class="clear"
|
||||||
title="Clear history"
|
title="Clear history"
|
||||||
|
@ -52,7 +52,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["toggleModal"]),
|
...mapMutations(["toggleModal"]),
|
||||||
...mapMutations("session", ["clearHistory"])
|
...mapMutations("session", ["clearVoteHistory"])
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -79,7 +79,7 @@ const mutations = {
|
||||||
.map(({ name }) => name)
|
.map(({ name }) => name)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
clearHistory(state) {
|
clearVoteHistory(state) {
|
||||||
state.voteHistory = [];
|
state.voteHistory = [];
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class LiveSession {
|
class LiveSession {
|
||||||
constructor(store) {
|
constructor(store) {
|
||||||
this._wss = "wss://live.clocktower.online:8080/";
|
this._wss = "wss://live.clocktower.online:8080/";
|
||||||
|
//this._wss = "wss://baumgart.biz:8080/"; //todo: delete this
|
||||||
//this._wss = "ws://localhost:8081/";
|
//this._wss = "ws://localhost:8081/";
|
||||||
this._socket = null;
|
this._socket = null;
|
||||||
this._isSpectator = true;
|
this._isSpectator = true;
|
||||||
|
@ -153,6 +154,10 @@ class LiveSession {
|
||||||
if (!this._isSpectator) return;
|
if (!this._isSpectator) return;
|
||||||
this._store.commit("session/setVotingSpeed", params);
|
this._store.commit("session/setVotingSpeed", params);
|
||||||
break;
|
break;
|
||||||
|
case "clearVoteHistory":
|
||||||
|
if (!this._isSpectator) return;
|
||||||
|
this._store.commit("session/clearVoteHistory");
|
||||||
|
break;
|
||||||
case "isVoteInProgress":
|
case "isVoteInProgress":
|
||||||
if (!this._isSpectator) return;
|
if (!this._isSpectator) return;
|
||||||
this._store.commit("session/setVoteInProgress", params);
|
this._store.commit("session/setVoteInProgress", params);
|
||||||
|
@ -566,10 +571,10 @@ class LiveSession {
|
||||||
{ index, property: "role", value: player.role.id }
|
{ index, property: "role", value: player.role.id }
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
});
|
||||||
if (Object.keys(message).length) {
|
if (Object.keys(message).length) {
|
||||||
this._send("direct", message);
|
this._send("direct", message);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -604,6 +609,7 @@ class LiveSession {
|
||||||
if (this._isSpectator) return;
|
if (this._isSpectator) return;
|
||||||
this._send("isNight", this._store.state.grimoire.isNight);
|
this._send("isNight", this._store.state.grimoire.isNight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the voting speed. ST only
|
* Send the voting speed. ST only
|
||||||
* @param votingSpeed voting speed in seconds, minimum 1
|
* @param votingSpeed voting speed in seconds, minimum 1
|
||||||
|
@ -615,6 +621,14 @@ class LiveSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the vote history for everyone. ST only
|
||||||
|
*/
|
||||||
|
clearVoteHistory() {
|
||||||
|
if (this._isSpectator) return;
|
||||||
|
this._send("clearVoteHistory");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a vote. Player or ST
|
* Send a vote. Player or ST
|
||||||
* @param index Seat of the player
|
* @param index Seat of the player
|
||||||
|
@ -737,6 +751,9 @@ export default store => {
|
||||||
case "session/setVotingSpeed":
|
case "session/setVotingSpeed":
|
||||||
session.setVotingSpeed(payload);
|
session.setVotingSpeed(payload);
|
||||||
break;
|
break;
|
||||||
|
case "session/clearVoteHistory":
|
||||||
|
session.clearVoteHistory();
|
||||||
|
break;
|
||||||
case "toggleNight":
|
case "toggleNight":
|
||||||
session.setIsNight();
|
session.setIsNight();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue