mirror of
https://github.com/bra1n/townsquare.git
synced 2025-04-04 14:14:38 +00:00
making reminders for pluis 1 roles available
This commit is contained in:
parent
f1e1f7f773
commit
c27fb9c7d0
1 changed files with 27 additions and 18 deletions
|
@ -21,7 +21,7 @@
|
|||
: require('../../assets/icons/' +
|
||||
(reminder.imageAlt || reminder.role) +
|
||||
'.png')
|
||||
})`
|
||||
})`,
|
||||
}"
|
||||
></span>
|
||||
<span class="text">{{ reminder.name }}</span>
|
||||
|
@ -39,12 +39,14 @@ import { mapMutations, mapState } from "vuex";
|
|||
* @param role The role for which the reminder should be generated
|
||||
* @return {function(*): {image: string|string[]|string|*, role: *, name: *, imageAlt: string|*}}
|
||||
*/
|
||||
const mapReminder = ({ id, image, imageAlt }) => name => ({
|
||||
role: id,
|
||||
image,
|
||||
imageAlt,
|
||||
name
|
||||
});
|
||||
const mapReminder =
|
||||
({ id, image, imageAlt }) =>
|
||||
(name) => ({
|
||||
role: id,
|
||||
image,
|
||||
imageAlt,
|
||||
name,
|
||||
});
|
||||
|
||||
export default {
|
||||
components: { Modal },
|
||||
|
@ -53,31 +55,38 @@ export default {
|
|||
availableReminders() {
|
||||
let reminders = [];
|
||||
const { players, bluffs } = this.$store.state.players;
|
||||
this.$store.state.roles.forEach(role => {
|
||||
this.$store.state.roles.forEach((role) => {
|
||||
// add reminders from player roles
|
||||
if (players.some(p => p.role.id === role.id)) {
|
||||
if (players.some((p) => p.role.id === role.id)) {
|
||||
reminders = [...reminders, ...role.reminders.map(mapReminder(role))];
|
||||
}
|
||||
// add reminders from bluff/other roles
|
||||
else if (bluffs.some(bluff => bluff.id === role.id)) {
|
||||
else if (bluffs.some((bluff) => bluff.id === role.id)) {
|
||||
reminders = [...reminders, ...role.reminders.map(mapReminder(role))];
|
||||
}
|
||||
// add global reminders
|
||||
if (role.remindersGlobal && role.remindersGlobal.length) {
|
||||
reminders = [
|
||||
...reminders,
|
||||
...role.remindersGlobal.map(mapReminder(role))
|
||||
...role.remindersGlobal.map(mapReminder(role)),
|
||||
];
|
||||
}
|
||||
});
|
||||
// add fabled reminders
|
||||
this.$store.state.players.fabled.forEach(role => {
|
||||
this.$store.state.players.fabled.forEach((role) => {
|
||||
reminders = [...reminders, ...role.reminders.map(mapReminder(role))];
|
||||
});
|
||||
|
||||
// add out of script traveler reminders
|
||||
this.$store.state.otherTravelers.forEach(role => {
|
||||
if (players.some(p => p.role.id === role.id)) {
|
||||
this.$store.state.otherTravelers.forEach((role) => {
|
||||
if (players.some((p) => p.role.id === role.id)) {
|
||||
reminders = [...reminders, ...role.reminders.map(mapReminder(role))];
|
||||
}
|
||||
});
|
||||
|
||||
// add out of script role reminders
|
||||
this.$store.state.otherRoles.forEach((role) => {
|
||||
if (players.some((p) => p.role.id === role.id)) {
|
||||
reminders = [...reminders, ...role.reminders.map(mapReminder(role))];
|
||||
}
|
||||
});
|
||||
|
@ -88,7 +97,7 @@ export default {
|
|||
return reminders;
|
||||
},
|
||||
...mapState(["modals", "grimoire"]),
|
||||
...mapState("players", ["players"])
|
||||
...mapState("players", ["players"]),
|
||||
},
|
||||
methods: {
|
||||
addReminder(reminder) {
|
||||
|
@ -104,12 +113,12 @@ export default {
|
|||
this.$store.commit("players/update", {
|
||||
player,
|
||||
property: "reminders",
|
||||
value
|
||||
value,
|
||||
});
|
||||
this.$store.commit("toggleModal", "reminder");
|
||||
},
|
||||
...mapMutations(["toggleModal"])
|
||||
}
|
||||
...mapMutations(["toggleModal"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue