Merge pull request #41 from bra1n/characters-in-script-order

Characters in script order (fixes #38)
This commit is contained in:
Steffen 2020-06-30 09:52:54 +02:00 committed by GitHub
commit 6509ee3364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -9,6 +9,8 @@ import rolesJSON from "../roles.json";
Vue.use(Vuex);
const rolesJSONbyId = new Map(rolesJSON.map(role => [role.id, role]));
const getRolesByEdition = (edition = "tb") => {
const selectedEdition =
editionJSON.find(({ id }) => id === edition) || editionJSON[0];
@ -96,12 +98,14 @@ export default new Vuex.Store({
grimoire.isScreenshot = false;
}
},
setRoles(state, roles) {
setRoles(state, roleIds) {
state.roles = new Map(
rolesJSON
.filter(r => roles.includes(r.id))
.sort((a, b) => b.team.localeCompare(a.team))
.map(role => [role.id, role])
roleIds
.filter(roleId => rolesJSONbyId.has(roleId))
.sort((a, b) =>
rolesJSONbyId.get(b).team.localeCompare(rolesJSONbyId.get(a).team)
)
.map(roleId => [roleId, rolesJSONbyId.get(roleId)])
);
},
setEdition(state, edition) {