mirror of https://github.com/bra1n/townsquare.git
Merge branch 'issue/38/characters-in-script-order'
This commit is contained in:
commit
8a982eace2
|
@ -9,6 +9,8 @@ import rolesJSON from "../roles.json";
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
|
|
||||||
|
const rolesJSONbyId = new Map(rolesJSON.map(role => [role.id, role]));
|
||||||
|
|
||||||
const getRolesByEdition = (edition = "tb") => {
|
const getRolesByEdition = (edition = "tb") => {
|
||||||
const selectedEdition =
|
const selectedEdition =
|
||||||
editionJSON.find(({ id }) => id === edition) || editionJSON[0];
|
editionJSON.find(({ id }) => id === edition) || editionJSON[0];
|
||||||
|
@ -96,12 +98,14 @@ export default new Vuex.Store({
|
||||||
grimoire.isScreenshot = false;
|
grimoire.isScreenshot = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setRoles(state, roles) {
|
setRoles(state, roleIds) {
|
||||||
state.roles = new Map(
|
state.roles = new Map(
|
||||||
rolesJSON
|
roleIds
|
||||||
.filter(r => roles.includes(r.id))
|
.filter(roleId => rolesJSONbyId.has(roleId))
|
||||||
.sort((a, b) => b.team.localeCompare(a.team))
|
.sort((a, b) =>
|
||||||
.map(role => [role.id, role])
|
rolesJSONbyId.get(b).team.localeCompare(rolesJSONbyId.get(a).team)
|
||||||
|
)
|
||||||
|
.map(roleId => [roleId, rolesJSONbyId.get(roleId)])
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
setEdition(state, edition) {
|
setEdition(state, edition) {
|
||||||
|
|
Loading…
Reference in New Issue