mirror of https://github.com/bra1n/townsquare.git
custom roles are no longer synced in live games due to traffic and security concerns (closes #60)
This commit is contained in:
parent
c09d1c7101
commit
200c7f9b7d
|
@ -69,7 +69,8 @@ For base game characters, it is sufficient to only provide the ID, similar to wh
|
|||
- **team**: the team of the character, has to be one of `townsfolk`, `outsider`, `minion`, `demon` or `traveler`
|
||||
- **ability**: the displayed ability text of the character
|
||||
|
||||
_Note:_ custom characters are currently not supported in live sessions and will not be synchronised to other players.
|
||||
_Note:_ in order to use custom characters in live sessions, your players have to load the same JSON file that the storyteller
|
||||
has loaded before joining the live session.
|
||||
|
||||
## [Code of Conduct](CODE_OF_CONDUCT.md)
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
>the documentation</a
|
||||
>
|
||||
on how to write a custom character definition file.
|
||||
<b>Only load custom JSON files from sources that you trust!</b>
|
||||
<h3>Some popular custom scripts:</h3>
|
||||
<ul class="scripts">
|
||||
<li
|
||||
|
|
|
@ -163,7 +163,9 @@ export default new Vuex.Store({
|
|||
// map existing roles to base definition or pre-populate custom roles to ensure all properties
|
||||
.map(
|
||||
role =>
|
||||
rolesJSONbyId.get(role.id) || Object.assign({}, customRole, role)
|
||||
rolesJSONbyId.get(role.id) ||
|
||||
state.roles.get(role.id) ||
|
||||
Object.assign({}, customRole, role)
|
||||
)
|
||||
// default empty icons to good / evil / traveler
|
||||
.map(role => {
|
||||
|
|
|
@ -15,6 +15,7 @@ module.exports = store => {
|
|||
}
|
||||
if (localStorage.roles !== undefined) {
|
||||
store.commit("setCustomRoles", JSON.parse(localStorage.roles));
|
||||
store.commit("setEdition", "custom");
|
||||
}
|
||||
if (localStorage.bluffs !== undefined) {
|
||||
JSON.parse(localStorage.bluffs).forEach((role, index) => {
|
||||
|
@ -85,7 +86,10 @@ module.exports = store => {
|
|||
if (!payload.length) {
|
||||
localStorage.removeItem("roles");
|
||||
} else {
|
||||
localStorage.setItem("roles", JSON.stringify(payload));
|
||||
localStorage.setItem(
|
||||
"roles",
|
||||
JSON.stringify(store.getters.customRoles)
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "players/setBluff":
|
||||
|
|
|
@ -320,7 +320,7 @@ class LiveSession {
|
|||
const { edition } = this._store.state;
|
||||
let roles;
|
||||
if (edition === "custom") {
|
||||
roles = this._store.getters.customRoles;
|
||||
roles = Array.from(this._store.state.roles.keys());
|
||||
}
|
||||
this._send("edition", {
|
||||
edition,
|
||||
|
@ -338,7 +338,23 @@ class LiveSession {
|
|||
if (!this._isSpectator) return;
|
||||
this._store.commit("setEdition", edition);
|
||||
if (roles) {
|
||||
this._store.commit("setCustomRoles", roles);
|
||||
this._store.commit(
|
||||
"setCustomRoles",
|
||||
roles.map(id => ({ id }))
|
||||
);
|
||||
if (this._store.state.roles.size !== roles.length) {
|
||||
const missing = [];
|
||||
roles.forEach(id => {
|
||||
if (!this._store.state.roles.get(id)) {
|
||||
missing.push(id);
|
||||
}
|
||||
});
|
||||
alert(
|
||||
`This session contains custom characters that can't be found. ` +
|
||||
`Please load them before joining! ` +
|
||||
`Missing roles: ${missing.join(", ")}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue