From c84128a2ca700b3dd4e152d211f2269724d20be5 Mon Sep 17 00:00:00 2001 From: MRegnard <62838312+MRegnard@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:50:09 +0100 Subject: [PATCH 01/12] Automatic Djinn and Bootlegger (#197) * Update CHANGELOG.md * Automatic addition of Djinn and Bootlegger * Correcting some spaces typos * Corrections for the linter * Some corrections for the linter * Corrections for the linter --- CHANGELOG.md | 2 +- src/components/modals/EditionModal.vue | 31 +++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b84adce..f714297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Upcoming version - +- Automatic Djinn and Bootlegger ### Version 3.20.1 - Inconsistancies in french translations for "Power" & "Character" diff --git a/src/components/modals/EditionModal.vue b/src/components/modals/EditionModal.vue index 14fe6a3..dfed0db 100644 --- a/src/components/modals/EditionModal.vue +++ b/src/components/modals/EditionModal.vue @@ -128,7 +128,7 @@ export default { }; }, computed: { - ...mapState(["modals", "locale", "editions"]), + ...mapState(["modals", "locale", "editions", "roles", "jinxes"]), }, methods: { openUpload() { @@ -193,11 +193,40 @@ export default { ); // set fabled const fabled = []; + var djinnAdded = false; + var djinnNeeded = false; + var bootleggerAdded = false; + var bootleggerNedded = false; roles.forEach((role) => { if (this.$store.state.fabled.has(role.id || role)) { fabled.push(this.$store.state.fabled.get(role.id || role)); + if ((role.id || role) == "djinn") { + djinnAdded = true; + } else if ((role.id || role) == "bootlegger") { + bootleggerAdded = true; + } + } else if (role.edition == "custom" || role.image) { + /* If the role isn't fabled, but detected as custom, we will need a Bootlegger + * NB: The actual version isn't perfect, since they only detect custom roles with an image or with the argument "edition":"custom". + * The code will could be changed later, when all non-custom roles will have an attribute "edition" + */ + bootleggerNedded = true; + } + // If the role isn't fabled, neither custom, and if we neither added a Djinn neither planned to add a Djinn, we look if this role is jinxed + else if (!djinnAdded && !djinnNeeded && this.jinxes.get(role.id)) { + this.jinxes.get(role.id).forEach((reason, second) => { + if (this.roles.get(second)) { + djinnNeeded = true; + } + }); } }); + if (djinnNeeded && !djinnAdded) { + fabled.push(this.$store.state.fabled.get("djinn")); + } + if (bootleggerNedded && !bootleggerAdded) { + fabled.push(this.$store.state.fabled.get("bootlegger")); + } this.$store.commit("players/setFabled", { fabled }); }, runEdition(edition) { From 4cdd2d340f5207164a227e89b6dd02bd48b8fa7b Mon Sep 17 00:00:00 2001 From: MRegnard <62838312+MRegnard@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:55:43 +0100 Subject: [PATCH 02/12] Adding special votes (#198) Creates a window to choose the type of special vote - Adding the argument "playerForSpecialVote" - Updating the history to take account of the special votes - Allowing all players to vote during special vote - Adding an option "Special vote" in players' menu NB: This skull will not be visible while the vote is still open. You need to close the vote first. If the vote is detected as special, the majority isn't printed This change affects the Story Teller's mark (for the case of an Atheist-script, where the Story Teller is marked as being on the block). This mark is now hidden for players if the option "Organ Grinder Vote" is turned on. --- CHANGELOG.md | 2 +- src/App.vue | 3 + src/components/Player.vue | 25 +++- src/components/TownInfo.vue | 25 +++- src/components/TownSquare.vue | 75 ++++++++++-- src/components/Vote.vue | 88 ++++++++++---- src/components/modals/SpecialVoteModal.vue | 128 +++++++++++++++++++++ src/components/modals/VoteHistoryModal.vue | 3 +- src/store/index.js | 1 + src/store/locale/en/ui.json | 12 ++ src/store/locale/fr/ui.json | 12 ++ src/store/modules/session.js | 29 +++-- src/store/socket.js | 23 +++- 13 files changed, 383 insertions(+), 43 deletions(-) create mode 100644 src/components/modals/SpecialVoteModal.vue diff --git a/CHANGELOG.md b/CHANGELOG.md index f714297..6470ee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Release Notes ## Upcoming version - +- Adding some special votes - Automatic Djinn and Bootlegger ### Version 3.20.1 diff --git a/src/App.vue b/src/App.vue index d71dfac..2525f03 100644 --- a/src/App.vue +++ b/src/App.vue @@ -34,6 +34,7 @@ + v{{ version }} @@ -55,6 +56,7 @@ import NightOrderModal from "./components/modals/NightOrderModal"; import FabledModal from "@/components/modals/FabledModal"; import VoteHistoryModal from "@/components/modals/VoteHistoryModal"; import GameStateModal from "@/components/modals/GameStateModal"; +import SpecialVoteModal from "@/components/modals/SpecialVoteModal"; export default { components: { @@ -71,6 +73,7 @@ export default { EditionModal, RolesModal, Gradients, + SpecialVoteModal, }, computed: { ...mapState(["grimoire", "session", "edition"]), diff --git a/src/components/Player.vue b/src/components/Player.vue index 393d213..6e6615c 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -53,6 +53,7 @@ +
  • +
  • + +
  • @@ -124,7 +133,7 @@ export default { countdownStyle: function () { return `--timer: ${this.$store.state.grimoire.timer.duration}`; }, - ...mapState(["edition", "grimoire", "locale"]), + ...mapState(["edition", "grimoire", "locale", "session"]), ...mapState("players", ["players"]), }, }; @@ -212,4 +221,18 @@ export default { top: -50%; } } + +.marked { + opacity: 0.5; + position: absolute; + svg { + height: 80px; + width: 80px; + stroke: white; + stroke-width: 15px; + path { + fill: white; + } + } +} diff --git a/src/components/TownSquare.vue b/src/components/TownSquare.vue index 5df095d..a35ba63 100644 --- a/src/components/TownSquare.vue +++ b/src/components/TownSquare.vue @@ -82,13 +82,31 @@
    -
    +
    {{ locale.townsquare.timer.accusation.button }}
    -
    +
    + {{ session.nomination[1][2] }} +
    +
    {{ locale.townsquare.timer.defense.button }}
    -
    +
    + {{ locale.townsquare.timer.debate.button }} +
    +
    {{ locale.townsquare.timer.debate.button }}
    @@ -389,16 +407,38 @@ export default { this.timerDuration = 1; let timerText = this.locale.townsquare.timer.accusation.text; timerText = timerText - .replace("$accusator", this.players[this.session.nomination[0]].name) - .replace("$accusee", this.players[this.session.nomination[1]].name); + .replace( + "$accusator", + typeof this.session.nomination[0] == "number" + ? this.players[this.session.nomination[0]].name + : this.session.nomination[0][0].toUpperCase() + + this.session.nomination[0].slice(1), + ) + .replace( + "$accusee", + typeof this.session.nomination[1] == "number" + ? this.players[this.session.nomination[1]].name + : this.session.nomination[1], + ); this.timerName = timerText; }, setDefenseTimer() { this.timerDuration = 1; let timerText = this.locale.townsquare.timer.defense.text; timerText = timerText - .replace("$accusee", this.players[this.session.nomination[1]].name) - .replace("$accusator", this.players[this.session.nomination[0]].name); + .replace( + "$accusee", + typeof this.session.nomination[1] == "number" + ? this.players[this.session.nomination[1]].name + : this.session.nomination[1][0].toUpperCase() + + this.session.nomination[1].slice(1), + ) + .replace( + "$accusator", + typeof this.session.nomination[0] == "number" + ? this.players[this.session.nomination[0]].name + : this.session.nomination[0], + ); this.timerName = timerText; }, setDebateTimer() { @@ -406,7 +446,26 @@ export default { let timerText = this.locale.townsquare.timer.debate.text; timerText = timerText.replace( "$accusee", - this.players[this.session.nomination[1]].name, + typeof this.session.nomination[1] == "number" + ? this.players[this.session.nomination[1]].name + : this.session.nomination[1], + ); + this.timerName = timerText; + }, + setSpecialVoteTimer() { + this.timerDuration = 1; + let timerText = + this.players[this.session.nomination[0]].name + + " " + + this.session.nomination[1][0]; + this.timerName = timerText; + }, + setSpecialDebateTimer() { + this.timerDuration = 2; + let timerText = this.session.nomination[1][1]; + timerText = timerText.replace( + "$player", + this.players[this.session.nomination[0]].name, ); this.timerName = timerText; }, diff --git a/src/components/Vote.vue b/src/components/Vote.vue index 2d69302..dd159a3 100644 --- a/src/components/Vote.vue +++ b/src/components/Vote.vue @@ -1,25 +1,34 @@