mirror of https://github.com/bra1n/townsquare.git
added night order to reference sheet (closes #30)
This commit is contained in:
parent
f8eb473ab3
commit
8b55ae1416
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "townsquare",
|
"name": "townsquare",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"description": "Blood on the Clocktower Town Square",
|
"description": "Blood on the Clocktower Town Square",
|
||||||
"author": "Steffen Baumgart",
|
"author": "Steffen Baumgart",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -5,7 +5,18 @@
|
||||||
@close="toggleModal('reference')"
|
@close="toggleModal('reference')"
|
||||||
v-if="roles.size"
|
v-if="roles.size"
|
||||||
>
|
>
|
||||||
<h3>{{ editionName }} Character Reference</h3>
|
<template v-if="!isNightOrder">
|
||||||
|
<font-awesome-icon
|
||||||
|
@click="isNightOrder = !isNightOrder"
|
||||||
|
icon="cloud-moon"
|
||||||
|
class="toggle"
|
||||||
|
title="Show Night Order"
|
||||||
|
/>
|
||||||
|
<h3>
|
||||||
|
Character Reference
|
||||||
|
<font-awesome-icon icon="address-card" />
|
||||||
|
{{ editionName }}
|
||||||
|
</h3>
|
||||||
<ul class="legend">
|
<ul class="legend">
|
||||||
<li>
|
<li>
|
||||||
<span class="name">Name</span>
|
<span class="name">Name</span>
|
||||||
|
@ -16,7 +27,11 @@
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div v-for="(teamRoles, team) in rolesGrouped" :key="team" :class="[team]">
|
<div
|
||||||
|
v-for="(teamRoles, team) in rolesGrouped"
|
||||||
|
:key="team"
|
||||||
|
:class="[team]"
|
||||||
|
>
|
||||||
<h4>{{ team }}</h4>
|
<h4>{{ team }}</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="role in teamRoles" :class="[team]" :key="role.id">
|
<li v-for="role in teamRoles" :class="[team]" :key="role.id">
|
||||||
|
@ -37,6 +52,64 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<font-awesome-icon
|
||||||
|
@click="isNightOrder = !isNightOrder"
|
||||||
|
icon="address-card"
|
||||||
|
class="toggle"
|
||||||
|
title="Show Character Reference"
|
||||||
|
/>
|
||||||
|
<h3>
|
||||||
|
Night Order
|
||||||
|
<font-awesome-icon icon="cloud-moon" />
|
||||||
|
{{ editionName }}
|
||||||
|
</h3>
|
||||||
|
<div class="night">
|
||||||
|
<ul class="first">
|
||||||
|
<li class="headline">First Night</li>
|
||||||
|
<li
|
||||||
|
v-for="role in rolesFirstNight"
|
||||||
|
:key="role.id"
|
||||||
|
:class="[role.team]"
|
||||||
|
>
|
||||||
|
<span class="name">
|
||||||
|
{{ role.name }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
v-if="role.id"
|
||||||
|
v-bind:style="{
|
||||||
|
backgroundImage: `url(${require('../../assets/icons/' +
|
||||||
|
role.id +
|
||||||
|
'.png')})`
|
||||||
|
}"
|
||||||
|
></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="other">
|
||||||
|
<li class="headline">Other Nights</li>
|
||||||
|
<li
|
||||||
|
v-for="role in rolesOtherNight"
|
||||||
|
:key="role.id"
|
||||||
|
:class="[role.team]"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
v-if="role.id"
|
||||||
|
v-bind:style="{
|
||||||
|
backgroundImage: `url(${require('../../assets/icons/' +
|
||||||
|
role.id +
|
||||||
|
'.png')})`
|
||||||
|
}"
|
||||||
|
></span>
|
||||||
|
<span class="name">
|
||||||
|
{{ role.name }}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -51,13 +124,14 @@ export default {
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
roleSelection: {}
|
roleSelection: {},
|
||||||
|
isNightOrder: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
editionName: function() {
|
editionName: function() {
|
||||||
const edition = editionJSON.find(({ id }) => id === this.edition);
|
const edition = editionJSON.find(({ id }) => id === this.edition);
|
||||||
return edition ? edition.name : "Custom script";
|
return edition ? edition.name : "Custom Script";
|
||||||
},
|
},
|
||||||
rolesGrouped: function() {
|
rolesGrouped: function() {
|
||||||
const rolesGrouped = {};
|
const rolesGrouped = {};
|
||||||
|
@ -82,6 +156,26 @@ export default {
|
||||||
});
|
});
|
||||||
return players;
|
return players;
|
||||||
},
|
},
|
||||||
|
rolesFirstNight: function() {
|
||||||
|
const rolesFirstNight = [];
|
||||||
|
this.roles.forEach(role => {
|
||||||
|
if (role.firstNight) {
|
||||||
|
rolesFirstNight.push(role);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rolesFirstNight.sort((a, b) => a.firstNight - b.firstNight);
|
||||||
|
return rolesFirstNight;
|
||||||
|
},
|
||||||
|
rolesOtherNight: function() {
|
||||||
|
const rolesOtherNight = [];
|
||||||
|
this.roles.forEach(role => {
|
||||||
|
if (role.otherNight) {
|
||||||
|
rolesOtherNight.push(role);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rolesOtherNight.sort((a, b) => a.otherNight - b.otherNight);
|
||||||
|
return rolesOtherNight;
|
||||||
|
},
|
||||||
...mapState(["roles", "modals", "edition"]),
|
...mapState(["roles", "modals", "edition"]),
|
||||||
...mapState("players", ["players"])
|
...mapState("players", ["players"])
|
||||||
},
|
},
|
||||||
|
@ -94,6 +188,20 @@ export default {
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "../../vars.scss";
|
@import "../../vars.scss";
|
||||||
|
|
||||||
|
.toggle {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
top: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 svg {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
h4 {
|
h4 {
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -216,4 +324,45 @@ ul {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.night {
|
||||||
|
display: flex;
|
||||||
|
align-items: start;
|
||||||
|
justify-content: center;
|
||||||
|
> *:first-child {
|
||||||
|
margin-right: 2vh;
|
||||||
|
}
|
||||||
|
> * {
|
||||||
|
flex-grow: 0;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.headline {
|
||||||
|
display: block;
|
||||||
|
font-weight: bold;
|
||||||
|
border-bottom: 1px solid white;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
border-color: white;
|
||||||
|
}
|
||||||
|
.name {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
.first {
|
||||||
|
.icon {
|
||||||
|
border-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.other {
|
||||||
|
li .name {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
border-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -7,11 +7,13 @@ import { fab } from "@fortawesome/free-brands-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||||
|
|
||||||
const faIcons = [
|
const faIcons = [
|
||||||
|
"AddressCard",
|
||||||
"BookOpen",
|
"BookOpen",
|
||||||
"BroadcastTower",
|
"BroadcastTower",
|
||||||
"Camera",
|
"Camera",
|
||||||
"Chair",
|
"Chair",
|
||||||
"CheckSquare",
|
"CheckSquare",
|
||||||
|
"CloudMoon",
|
||||||
"Cog",
|
"Cog",
|
||||||
"Copy",
|
"Copy",
|
||||||
"Dice",
|
"Dice",
|
||||||
|
|
|
@ -1297,9 +1297,9 @@
|
||||||
{
|
{
|
||||||
"id": "amnesiac",
|
"id": "amnesiac",
|
||||||
"edition": "",
|
"edition": "",
|
||||||
"firstNight": 20,
|
"firstNight": 21,
|
||||||
"firstNightReminder": "Decide the Amnesiac's entire ability. If the Amnesiac's ability causes them to wake tonight: Wake the Amnesiac and run their ability.",
|
"firstNightReminder": "Decide the Amnesiac's entire ability. If the Amnesiac's ability causes them to wake tonight: Wake the Amnesiac and run their ability.",
|
||||||
"otherNight": 20,
|
"otherNight": 30,
|
||||||
"otherNightReminder": "If the Amnesiac's ability causes them to wake tonight: Wake the Amnesiac and run their ability.",
|
"otherNightReminder": "If the Amnesiac's ability causes them to wake tonight: Wake the Amnesiac and run their ability.",
|
||||||
"reminders": [],
|
"reminders": [],
|
||||||
"setup": false,
|
"setup": false,
|
||||||
|
|
|
@ -25,7 +25,8 @@ const getters = {
|
||||||
nightOrder({ players }) {
|
nightOrder({ players }) {
|
||||||
const firstNight = [0];
|
const firstNight = [0];
|
||||||
const otherNight = [0];
|
const otherNight = [0];
|
||||||
players.forEach(({ role }) => {
|
players.forEach(({ role, isDead }) => {
|
||||||
|
if (isDead) return;
|
||||||
if (role.firstNight && !firstNight.includes(role.firstNight)) {
|
if (role.firstNight && !firstNight.includes(role.firstNight)) {
|
||||||
firstNight.push(role.firstNight);
|
firstNight.push(role.firstNight);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue